504 lines
		
	
	
		
			28 KiB
		
	
	
	
		
			XML
		
	
	
	
			
		
		
	
	
			504 lines
		
	
	
		
			28 KiB
		
	
	
	
		
			XML
		
	
	
	
<?xml version="1.0" encoding="UTF-8" ?>
 | 
						|
<!DOCTYPE mapper
 | 
						|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
						|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
						|
<mapper namespace="com.bonus.canteen.core.ims.mapper.SupplierMapper">
 | 
						|
    <resultMap type="com.bonus.canteen.core.ims.domain.Supplier" id="SupplierResult">
 | 
						|
        <result property="supplierId"    column="supplier_id"    />
 | 
						|
        <result property="supplierCode"    column="supplier_code"    />
 | 
						|
        <result property="supplierName"    column="supplier_name"    />
 | 
						|
        <result property="areaId"    column="area_id"    />
 | 
						|
        <result property="address"    column="address"    />
 | 
						|
        <result property="linkman"    column="linkman"    />
 | 
						|
        <result property="linkmanPhone"    column="linkman_phone"    />
 | 
						|
        <result property="email"    column="email"    />
 | 
						|
        <result property="openingBank"    column="opening_bank"    />
 | 
						|
        <result property="bankAccount"    column="bank_account"    />
 | 
						|
        <result property="supplierSimpleName"    column="supplier_simple_name"    />
 | 
						|
        <result property="telephone"    column="telephone"    />
 | 
						|
        <result property="companyWeb"    column="company_web"    />
 | 
						|
        <result property="regionProvince"    column="region_province"    />
 | 
						|
        <result property="regionCity"    column="region_city"    />
 | 
						|
        <result property="regionDistrict"    column="region_district"    />
 | 
						|
        <result property="ifReceiveNotice"    column="if_receive_notice"    />
 | 
						|
        <result property="noticeStyle"    column="notice_style"    />
 | 
						|
        <result property="supplierUserId"    column="supplier_user_id"    />
 | 
						|
        <result property="status"    column="status"    />
 | 
						|
        <result property="wechat"    column="wechat"    />
 | 
						|
        <result property="taxRate"    column="tax_rate"    />
 | 
						|
        <result property="paymentDays"    column="payment_days"    />
 | 
						|
        <result property="standbyLinkman"    column="standby_linkman"    />
 | 
						|
        <result property="standbyPhone"    column="standby_phone"    />
 | 
						|
        <result property="standbyWechat"    column="standby_wechat"    />
 | 
						|
        <result property="standbyEmail"    column="standby_email"    />
 | 
						|
        <result property="registFund"    column="regist_fund"    />
 | 
						|
        <result property="establishDate"    column="establish_date"    />
 | 
						|
        <result property="workersNum"    column="workers_num"    />
 | 
						|
        <result property="clientNum"    column="client_num"    />
 | 
						|
        <result property="lastYearOperatingIncome"    column="last_year_operating_income"    />
 | 
						|
        <result property="beforeYearOperatingIncome"    column="before_year_operating_income"    />
 | 
						|
        <result property="businessScope"    column="business_scope"    />
 | 
						|
        <result property="topFiveClient"    column="top_five_client"    />
 | 
						|
        <result property="topFiveSupplier"    column="top_five_supplier"    />
 | 
						|
        <result property="companyIntroduction"    column="company_introduction"    />
 | 
						|
        <result property="mainAdvantage"    column="main_advantage"    />
 | 
						|
        <result property="supplierScore"    column="supplier_score"    />
 | 
						|
        <result property="idCardImgZ"    column="id_card_img_z"    />
 | 
						|
        <result property="idCardImgF"    column="id_card_img_f"    />
 | 
						|
        <result property="attachment"    column="attachment"    />
 | 
						|
        <result property="remark"    column="remark"    />
 | 
						|
        <result property="delFlag"    column="del_flag"    />
 | 
						|
        <result property="createBy"    column="create_by"    />
 | 
						|
        <result property="createTime"    column="create_time"    />
 | 
						|
        <result property="updateBy"    column="update_by"    />
 | 
						|
        <result property="updateTime"    column="update_time"    />
 | 
						|
    </resultMap>
 | 
						|
 | 
						|
    <sql id="selectSupplierVo">
 | 
						|
        select supplier_id, supplier_code, supplier_name, area_id, address, linkman, linkman_phone,
 | 
						|
               email, opening_bank, bank_account, supplier_simple_name, telephone, company_web,
 | 
						|
               region_province, region_city, region_district, if_receive_notice, notice_style,
 | 
						|
               supplier_user_id, status, wechat, tax_rate, payment_days, standby_linkman, standby_phone,
 | 
						|
               standby_wechat, standby_email, regist_fund, establish_date, workers_num, client_num,
 | 
						|
               last_year_operating_income, before_year_operating_income, business_scope, top_five_client,
 | 
						|
               top_five_supplier, company_introduction, main_advantage, supplier_score, id_card_img_z,
 | 
						|
               id_card_img_f, attachment, remark, del_flag, create_by, create_time, update_by, update_time
 | 
						|
        from ims_supplier
 | 
						|
    </sql>
 | 
						|
 | 
						|
    <select id="selectSupplierList" parameterType="com.bonus.canteen.core.ims.domain.Supplier" resultMap="SupplierResult">
 | 
						|
        <include refid="selectSupplierVo"/>
 | 
						|
        <where>
 | 
						|
            del_flag = 0
 | 
						|
            <if test="supplierCode != null  and supplierCode != ''"> and supplier_code = #{supplierCode}</if>
 | 
						|
            <if test="supplierName != null  and supplierName != ''"> and supplier_name like concat('%', #{supplierName}, '%')</if>
 | 
						|
            <if test="areaId != null "> and area_id = #{areaId}</if>
 | 
						|
            <if test="address != null  and address != ''"> and address = #{address}</if>
 | 
						|
            <if test="linkman != null  and linkman != ''"> and linkman = #{linkman}</if>
 | 
						|
            <if test="linkmanPhone != null  and linkmanPhone != ''"> and linkman_phone = #{linkmanPhone}</if>
 | 
						|
            <if test="email != null  and email != ''"> and email = #{email}</if>
 | 
						|
            <if test="openingBank != null  and openingBank != ''"> and opening_bank = #{openingBank}</if>
 | 
						|
            <if test="bankAccount != null  and bankAccount != ''"> and bank_account = #{bankAccount}</if>
 | 
						|
            <if test="supplierSimpleName != null  and supplierSimpleName != ''"> and supplier_simple_name like concat('%', #{supplierSimpleName}, '%')</if>
 | 
						|
            <if test="telephone != null  and telephone != ''"> and telephone = #{telephone}</if>
 | 
						|
            <if test="companyWeb != null  and companyWeb != ''"> and company_web = #{companyWeb}</if>
 | 
						|
            <if test="regionProvince != null  and regionProvince != ''"> and region_province = #{regionProvince}</if>
 | 
						|
            <if test="regionCity != null  and regionCity != ''"> and region_city = #{regionCity}</if>
 | 
						|
            <if test="regionDistrict != null  and regionDistrict != ''"> and region_district = #{regionDistrict}</if>
 | 
						|
            <if test="ifReceiveNotice != null "> and if_receive_notice = #{ifReceiveNotice}</if>
 | 
						|
            <if test="noticeStyle != null "> and notice_style = #{noticeStyle}</if>
 | 
						|
            <if test="supplierUserId != null "> and supplier_user_id = #{supplierUserId}</if>
 | 
						|
            <if test="status != null "> and status = #{status}</if>
 | 
						|
            <if test="wechat != null  and wechat != ''"> and wechat = #{wechat}</if>
 | 
						|
            <if test="taxRate != null "> and tax_rate = #{taxRate}</if>
 | 
						|
            <if test="paymentDays != null "> and payment_days = #{paymentDays}</if>
 | 
						|
            <if test="standbyLinkman != null  and standbyLinkman != ''"> and standby_linkman = #{standbyLinkman}</if>
 | 
						|
            <if test="standbyPhone != null  and standbyPhone != ''"> and standby_phone = #{standbyPhone}</if>
 | 
						|
            <if test="standbyWechat != null  and standbyWechat != ''"> and standby_wechat = #{standbyWechat}</if>
 | 
						|
            <if test="standbyEmail != null  and standbyEmail != ''"> and standby_email = #{standbyEmail}</if>
 | 
						|
            <if test="registFund != null "> and regist_fund = #{registFund}</if>
 | 
						|
            <if test="establishDate != null "> and establish_date = #{establishDate}</if>
 | 
						|
            <if test="workersNum != null "> and workers_num = #{workersNum}</if>
 | 
						|
            <if test="clientNum != null "> and client_num = #{clientNum}</if>
 | 
						|
            <if test="lastYearOperatingIncome != null "> and last_year_operating_income = #{lastYearOperatingIncome}</if>
 | 
						|
            <if test="beforeYearOperatingIncome != null "> and before_year_operating_income = #{beforeYearOperatingIncome}</if>
 | 
						|
            <if test="businessScope != null  and businessScope != ''"> and business_scope = #{businessScope}</if>
 | 
						|
            <if test="topFiveClient != null  and topFiveClient != ''"> and top_five_client = #{topFiveClient}</if>
 | 
						|
            <if test="topFiveSupplier != null  and topFiveSupplier != ''"> and top_five_supplier = #{topFiveSupplier}</if>
 | 
						|
            <if test="companyIntroduction != null  and companyIntroduction != ''"> and company_introduction = #{companyIntroduction}</if>
 | 
						|
            <if test="mainAdvantage != null  and mainAdvantage != ''"> and main_advantage = #{mainAdvantage}</if>
 | 
						|
            <if test="supplierScore != null "> and supplier_score = #{supplierScore}</if>
 | 
						|
            <if test="idCardImgZ != null  and idCardImgZ != ''"> and id_card_img_z = #{idCardImgZ}</if>
 | 
						|
            <if test="idCardImgF != null  and idCardImgF != ''"> and id_card_img_f = #{idCardImgF}</if>
 | 
						|
            <if test="attachment != null  and attachment != ''"> and attachment = #{attachment}</if>
 | 
						|
        </where>
 | 
						|
    </select>
 | 
						|
 | 
						|
    <select id="selectSupplierBySupplierId" parameterType="Long" resultMap="SupplierResult">
 | 
						|
        <include refid="selectSupplierVo"/>
 | 
						|
        where supplier_id = #{supplierId}
 | 
						|
    </select>
 | 
						|
 | 
						|
    <insert id="insertSupplier" parameterType="com.bonus.canteen.core.ims.domain.Supplier" useGeneratedKeys="true" keyProperty="supplierId">
 | 
						|
        insert into ims_supplier
 | 
						|
        <trim prefix="(" suffix=")" suffixOverrides=",">
 | 
						|
            <if test="supplierCode != null">supplier_code,</if>
 | 
						|
            <if test="supplierName != null and supplierName != ''">supplier_name,</if>
 | 
						|
            <if test="areaId != null">area_id,</if>
 | 
						|
            <if test="address != null">address,</if>
 | 
						|
            <if test="linkman != null">linkman,</if>
 | 
						|
            <if test="linkmanPhone != null">linkman_phone,</if>
 | 
						|
            <if test="email != null">email,</if>
 | 
						|
            <if test="openingBank != null">opening_bank,</if>
 | 
						|
            <if test="bankAccount != null">bank_account,</if>
 | 
						|
            <if test="supplierSimpleName != null">supplier_simple_name,</if>
 | 
						|
            <if test="telephone != null">telephone,</if>
 | 
						|
            <if test="companyWeb != null">company_web,</if>
 | 
						|
            <if test="regionProvince != null">region_province,</if>
 | 
						|
            <if test="regionCity != null">region_city,</if>
 | 
						|
            <if test="regionDistrict != null">region_district,</if>
 | 
						|
            <if test="ifReceiveNotice != null">if_receive_notice,</if>
 | 
						|
            <if test="noticeStyle != null">notice_style,</if>
 | 
						|
            <if test="supplierUserId != null">supplier_user_id,</if>
 | 
						|
            <if test="status != null">status,</if>
 | 
						|
            <if test="wechat != null">wechat,</if>
 | 
						|
            <if test="taxRate != null">tax_rate,</if>
 | 
						|
            <if test="paymentDays != null">payment_days,</if>
 | 
						|
            <if test="standbyLinkman != null">standby_linkman,</if>
 | 
						|
            <if test="standbyPhone != null">standby_phone,</if>
 | 
						|
            <if test="standbyWechat != null">standby_wechat,</if>
 | 
						|
            <if test="standbyEmail != null">standby_email,</if>
 | 
						|
            <if test="registFund != null">regist_fund,</if>
 | 
						|
            <if test="establishDate != null">establish_date,</if>
 | 
						|
            <if test="workersNum != null">workers_num,</if>
 | 
						|
            <if test="clientNum != null">client_num,</if>
 | 
						|
            <if test="lastYearOperatingIncome != null">last_year_operating_income,</if>
 | 
						|
            <if test="beforeYearOperatingIncome != null">before_year_operating_income,</if>
 | 
						|
            <if test="businessScope != null">business_scope,</if>
 | 
						|
            <if test="topFiveClient != null">top_five_client,</if>
 | 
						|
            <if test="topFiveSupplier != null">top_five_supplier,</if>
 | 
						|
            <if test="companyIntroduction != null">company_introduction,</if>
 | 
						|
            <if test="mainAdvantage != null">main_advantage,</if>
 | 
						|
            <if test="supplierScore != null">supplier_score,</if>
 | 
						|
            <if test="idCardImgZ != null">id_card_img_z,</if>
 | 
						|
            <if test="idCardImgF != null">id_card_img_f,</if>
 | 
						|
            <if test="attachment != null">attachment,</if>
 | 
						|
            <if test="remark != null">remark,</if>
 | 
						|
            <if test="delFlag != null">del_flag,</if>
 | 
						|
            <if test="createBy != null">create_by,</if>
 | 
						|
            <if test="createTime != null">create_time,</if>
 | 
						|
            <if test="updateBy != null">update_by,</if>
 | 
						|
            <if test="updateTime != null">update_time,</if>
 | 
						|
         </trim>
 | 
						|
        <trim prefix="values (" suffix=")" suffixOverrides=",">
 | 
						|
            <if test="supplierCode != null">#{supplierCode},</if>
 | 
						|
            <if test="supplierName != null and supplierName != ''">#{supplierName},</if>
 | 
						|
            <if test="areaId != null">#{areaId},</if>
 | 
						|
            <if test="address != null">#{address},</if>
 | 
						|
            <if test="linkman != null">#{linkman},</if>
 | 
						|
            <if test="linkmanPhone != null">#{linkmanPhone},</if>
 | 
						|
            <if test="email != null">#{email},</if>
 | 
						|
            <if test="openingBank != null">#{openingBank},</if>
 | 
						|
            <if test="bankAccount != null">#{bankAccount},</if>
 | 
						|
            <if test="supplierSimpleName != null">#{supplierSimpleName},</if>
 | 
						|
            <if test="telephone != null">#{telephone},</if>
 | 
						|
            <if test="companyWeb != null">#{companyWeb},</if>
 | 
						|
            <if test="regionProvince != null">#{regionProvince},</if>
 | 
						|
            <if test="regionCity != null">#{regionCity},</if>
 | 
						|
            <if test="regionDistrict != null">#{regionDistrict},</if>
 | 
						|
            <if test="ifReceiveNotice != null">#{ifReceiveNotice},</if>
 | 
						|
            <if test="noticeStyle != null">#{noticeStyle},</if>
 | 
						|
            <if test="supplierUserId != null">#{supplierUserId},</if>
 | 
						|
            <if test="status != null">#{status},</if>
 | 
						|
            <if test="wechat != null">#{wechat},</if>
 | 
						|
            <if test="taxRate != null">#{taxRate},</if>
 | 
						|
            <if test="paymentDays != null">#{paymentDays},</if>
 | 
						|
            <if test="standbyLinkman != null">#{standbyLinkman},</if>
 | 
						|
            <if test="standbyPhone != null">#{standbyPhone},</if>
 | 
						|
            <if test="standbyWechat != null">#{standbyWechat},</if>
 | 
						|
            <if test="standbyEmail != null">#{standbyEmail},</if>
 | 
						|
            <if test="registFund != null">#{registFund},</if>
 | 
						|
            <if test="establishDate != null">#{establishDate},</if>
 | 
						|
            <if test="workersNum != null">#{workersNum},</if>
 | 
						|
            <if test="clientNum != null">#{clientNum},</if>
 | 
						|
            <if test="lastYearOperatingIncome != null">#{lastYearOperatingIncome},</if>
 | 
						|
            <if test="beforeYearOperatingIncome != null">#{beforeYearOperatingIncome},</if>
 | 
						|
            <if test="businessScope != null">#{businessScope},</if>
 | 
						|
            <if test="topFiveClient != null">#{topFiveClient},</if>
 | 
						|
            <if test="topFiveSupplier != null">#{topFiveSupplier},</if>
 | 
						|
            <if test="companyIntroduction != null">#{companyIntroduction},</if>
 | 
						|
            <if test="mainAdvantage != null">#{mainAdvantage},</if>
 | 
						|
            <if test="supplierScore != null">#{supplierScore},</if>
 | 
						|
            <if test="idCardImgZ != null">#{idCardImgZ},</if>
 | 
						|
            <if test="idCardImgF != null">#{idCardImgF},</if>
 | 
						|
            <if test="attachment != null">#{attachment},</if>
 | 
						|
            <if test="remark != null">#{remark},</if>
 | 
						|
            <if test="delFlag != null">#{delFlag},</if>
 | 
						|
            <if test="createBy != null">#{createBy},</if>
 | 
						|
            <if test="createTime != null">#{createTime},</if>
 | 
						|
            <if test="updateBy != null">#{updateBy},</if>
 | 
						|
            <if test="updateTime != null">#{updateTime},</if>
 | 
						|
         </trim>
 | 
						|
    </insert>
 | 
						|
 | 
						|
    <update id="updateSupplier" parameterType="com.bonus.canteen.core.ims.domain.Supplier">
 | 
						|
        update ims_supplier
 | 
						|
        <trim prefix="SET" suffixOverrides=",">
 | 
						|
            <if test="supplierCode != null">supplier_code = #{supplierCode},</if>
 | 
						|
            <if test="supplierName != null and supplierName != ''">supplier_name = #{supplierName},</if>
 | 
						|
            <if test="areaId != null">area_id = #{areaId},</if>
 | 
						|
            <if test="address != null">address = #{address},</if>
 | 
						|
            <if test="linkman != null">linkman = #{linkman},</if>
 | 
						|
            <if test="linkmanPhone != null">linkman_phone = #{linkmanPhone},</if>
 | 
						|
            <if test="email != null">email = #{email},</if>
 | 
						|
            <if test="openingBank != null">opening_bank = #{openingBank},</if>
 | 
						|
            <if test="bankAccount != null">bank_account = #{bankAccount},</if>
 | 
						|
            <if test="supplierSimpleName != null">supplier_simple_name = #{supplierSimpleName},</if>
 | 
						|
            <if test="telephone != null">telephone = #{telephone},</if>
 | 
						|
            <if test="companyWeb != null">company_web = #{companyWeb},</if>
 | 
						|
            <if test="regionProvince != null">region_province = #{regionProvince},</if>
 | 
						|
            <if test="regionCity != null">region_city = #{regionCity},</if>
 | 
						|
            <if test="regionDistrict != null">region_district = #{regionDistrict},</if>
 | 
						|
            <if test="ifReceiveNotice != null">if_receive_notice = #{ifReceiveNotice},</if>
 | 
						|
            <if test="noticeStyle != null">notice_style = #{noticeStyle},</if>
 | 
						|
            <if test="supplierUserId != null">supplier_user_id = #{supplierUserId},</if>
 | 
						|
            <if test="status != null">status = #{status},</if>
 | 
						|
            <if test="wechat != null">wechat = #{wechat},</if>
 | 
						|
            <if test="taxRate != null">tax_rate = #{taxRate},</if>
 | 
						|
            <if test="paymentDays != null">payment_days = #{paymentDays},</if>
 | 
						|
            <if test="standbyLinkman != null">standby_linkman = #{standbyLinkman},</if>
 | 
						|
            <if test="standbyPhone != null">standby_phone = #{standbyPhone},</if>
 | 
						|
            <if test="standbyWechat != null">standby_wechat = #{standbyWechat},</if>
 | 
						|
            <if test="standbyEmail != null">standby_email = #{standbyEmail},</if>
 | 
						|
            <if test="registFund != null">regist_fund = #{registFund},</if>
 | 
						|
            <if test="establishDate != null">establish_date = #{establishDate},</if>
 | 
						|
            <if test="workersNum != null">workers_num = #{workersNum},</if>
 | 
						|
            <if test="clientNum != null">client_num = #{clientNum},</if>
 | 
						|
            <if test="lastYearOperatingIncome != null">last_year_operating_income = #{lastYearOperatingIncome},</if>
 | 
						|
            <if test="beforeYearOperatingIncome != null">before_year_operating_income = #{beforeYearOperatingIncome},</if>
 | 
						|
            <if test="businessScope != null">business_scope = #{businessScope},</if>
 | 
						|
            <if test="topFiveClient != null">top_five_client = #{topFiveClient},</if>
 | 
						|
            <if test="topFiveSupplier != null">top_five_supplier = #{topFiveSupplier},</if>
 | 
						|
            <if test="companyIntroduction != null">company_introduction = #{companyIntroduction},</if>
 | 
						|
            <if test="mainAdvantage != null">main_advantage = #{mainAdvantage},</if>
 | 
						|
            <if test="supplierScore != null">supplier_score = #{supplierScore},</if>
 | 
						|
            <if test="idCardImgZ != null">id_card_img_z = #{idCardImgZ},</if>
 | 
						|
            <if test="idCardImgF != null">id_card_img_f = #{idCardImgF},</if>
 | 
						|
            <if test="attachment != null">attachment = #{attachment},</if>
 | 
						|
            <if test="remark != null">remark = #{remark},</if>
 | 
						|
            <if test="delFlag != null">del_flag = #{delFlag},</if>
 | 
						|
            <if test="createBy != null">create_by = #{createBy},</if>
 | 
						|
            <if test="createTime != null">create_time = #{createTime},</if>
 | 
						|
            <if test="updateBy != null">update_by = #{updateBy},</if>
 | 
						|
            <if test="updateTime != null">update_time = #{updateTime},</if>
 | 
						|
        </trim>
 | 
						|
        where supplier_id = #{supplierId}
 | 
						|
    </update>
 | 
						|
 | 
						|
    <delete id="deleteSupplierBySupplierId" parameterType="Long">
 | 
						|
        update ims_supplier set del_flag = 2 where supplier_id = #{supplierId}
 | 
						|
    </delete>
 | 
						|
 | 
						|
    <delete id="deleteSupplierBySupplierIds" parameterType="String">
 | 
						|
        update ims_supplier set del_flag = 2,supplier_user_id = null  where supplier_id in
 | 
						|
        <foreach item="supplierId" collection="array" open="(" separator="," close=")">
 | 
						|
            #{supplierId}
 | 
						|
        </foreach>
 | 
						|
    </delete>
 | 
						|
 | 
						|
    <select id="getMaxSupplierCode" resultType="java.lang.String">
 | 
						|
        select MAX(supplier_code) from ims_supplier WHERE  LENGTH(supplier_code )  =6
 | 
						|
    </select>
 | 
						|
 | 
						|
    <select id="selectAllList" resultType="com.bonus.canteen.core.ims.vo.SupplierPageVO">
 | 
						|
        SELECT DISTINCT
 | 
						|
            a.supplier_id,
 | 
						|
            a.supplier_code,
 | 
						|
            a.supplier_name,
 | 
						|
            a.area_id,
 | 
						|
            aa.area_name,
 | 
						|
            a.address,
 | 
						|
            a.linkman,
 | 
						|
            a.linkman_phone,
 | 
						|
            a.email,
 | 
						|
            a.wechat,
 | 
						|
            a.opening_bank,
 | 
						|
            a.bank_account,
 | 
						|
            a.supplier_simple_name,
 | 
						|
            a.telephone,
 | 
						|
            a.company_web,
 | 
						|
            a.region_province,
 | 
						|
            a.region_city,
 | 
						|
            a.region_district,
 | 
						|
            a.tax_rate,
 | 
						|
            a.payment_days,
 | 
						|
            a.standby_linkman,
 | 
						|
            a.standby_phone,
 | 
						|
            a.standby_email,
 | 
						|
            a.standby_wechat,
 | 
						|
            a.regist_fund,
 | 
						|
            a.establish_date,
 | 
						|
            a.workers_num,
 | 
						|
            a.client_num,
 | 
						|
            a.last_year_operating_income,
 | 
						|
            a.before_year_operating_income,
 | 
						|
            a.business_scope,
 | 
						|
            a.top_five_client,
 | 
						|
            a.top_five_supplier,
 | 
						|
            a.company_introduction,
 | 
						|
            a.main_advantage,
 | 
						|
            a.if_receive_notice,
 | 
						|
            a.notice_style,
 | 
						|
            a.supplier_user_id,
 | 
						|
            sys.user_name as supplier_user_name,
 | 
						|
            a.`status`,
 | 
						|
            a.supplier_score,
 | 
						|
            a.create_time,
 | 
						|
            a.create_by,
 | 
						|
            a.update_time,
 | 
						|
            a.update_by,
 | 
						|
            a.id_card_img_z,
 | 
						|
            a.id_card_img_f,
 | 
						|
            a.attachment
 | 
						|
        FROM
 | 
						|
            ims_supplier a
 | 
						|
                LEFT JOIN ims_supplier_category b on a.supplier_id = b.supplier_id
 | 
						|
                LEFT JOIN basic_area aa on a.area_id = aa.area_id
 | 
						|
        LEFT JOIN sys_user sys on sys.user_id = a.supplier_user_id
 | 
						|
        where
 | 
						|
            a.del_flag =  #{delFlag}
 | 
						|
        <if test="content.supplierId != null">
 | 
						|
            and a.supplier_id = #{content.supplierId}
 | 
						|
        </if>
 | 
						|
        <if test="content.supplierCode != null and content.supplierCode != ''">
 | 
						|
            and a.supplier_code = #{content.supplierCode}
 | 
						|
        </if>
 | 
						|
        <if test="content.supplierName != null and content.supplierName != ''">
 | 
						|
            and a.supplier_name like concat('%',#{content.supplierName},'%')
 | 
						|
        </if>
 | 
						|
        <if test="content.areaIdList != null and content.areaIdList.size() > 0">
 | 
						|
            AND a.area_id in
 | 
						|
            <foreach collection="content.areaIdList" item="item" separator="," open="(" close=")">
 | 
						|
                #{item}
 | 
						|
            </foreach>
 | 
						|
        </if>
 | 
						|
        <if test="content.linkman != null and content.linkman != ''">
 | 
						|
            and a.linkman like concat('%',#{content.linkman},'%')
 | 
						|
        </if>
 | 
						|
        <if test="content.status != null">
 | 
						|
            and a.status = #{content.status}
 | 
						|
        </if>
 | 
						|
 | 
						|
        <if test="content.ifBindSupplierUser != null and content.ifBindSupplierUser == 1">
 | 
						|
            and a.supplier_user_id is not null
 | 
						|
        </if>
 | 
						|
        <if test="content.ifBindSupplierUser != null and content.ifBindSupplierUser == 2">
 | 
						|
            and a.supplier_user_id is null
 | 
						|
        </if>
 | 
						|
        <if test="content.supplierScore != null">
 | 
						|
            and a.supplier_score <![CDATA[ >= ]]> #{content.supplierScore}
 | 
						|
        </if>
 | 
						|
        <if test="content.categoryIdList != null and content.categoryIdList.size() > 0">
 | 
						|
            and b.category_id in
 | 
						|
            <foreach collection="content.categoryIdList" item="categoryId" separator="," open="(" close=")">
 | 
						|
                #{categoryId}
 | 
						|
            </foreach>
 | 
						|
        </if>
 | 
						|
        order by a.supplier_id desc
 | 
						|
 | 
						|
    </select>
 | 
						|
 | 
						|
    <select id="supplyStatistics" resultType="com.bonus.canteen.core.ims.vo.SupplyStatisticsPageVO">
 | 
						|
        select
 | 
						|
            isr.supplier_id,isr.supplier_name as supplierName,isr.supplier_code as supplierCode,ba.area_name as areaName
 | 
						|
             ,IFNULL(zb.bid_num, 0) as bidNumbers,IFNULL(zb.quote_amount, 0) as cumulativeBidAmount,IFNULL(hgl.hgl, 0) as deliveryPassRate
 | 
						|
             ,IFNULL(cg.order_amount, 0) as orderAmount,IFNULL(cg.total_num, 0) as orderNum
 | 
						|
             ,last.bid_time as lastBidDate
 | 
						|
             ,last.quote_amount as lastBidAmount
 | 
						|
        from
 | 
						|
            ims_supplier isr
 | 
						|
                left join basic_area ba on isr.area_id = ba.area_id
 | 
						|
                left join (
 | 
						|
                select supplier_id,sum(bid_num) as bid_num,sum(quote_amount) as quote_amount from(
 | 
						|
                     select   isr.supplier_id,isr.supplier_code,isr.supplier_name
 | 
						|
                          ,case when iig.bid_status='3' then 1 else 0 end as bid_num,iig.quote_amount
 | 
						|
                     from ims_supplier isr
 | 
						|
                              left join  (select * from ims_inquiry_supplier where bid_status='3') iig on isr.supplier_id = iig.supplier_id
 | 
						|
                     where iig.quote_amount is not null
 | 
						|
                 ) a
 | 
						|
                group by supplier_id
 | 
						|
            ) zb on isr.supplier_id=zb.supplier_id
 | 
						|
                left join(
 | 
						|
                select supplier_id,case when inspect_qualified_num/delivery_total_num >1 then 1 else inspect_qualified_num/delivery_total_num end as hgl from(
 | 
						|
                     select   isr.supplier_id,isr.supplier_code,isr.supplier_name
 | 
						|
                          ,sum(iig.delivery_total_num) as delivery_total_num,sum(iig.inspect_qualified_num) as inspect_qualified_num
 | 
						|
                     from ims_supplier isr
 | 
						|
                              left join  (select * from ims_inspect_goods where status='2') iig on isr.supplier_id = iig.delivery_supplier_id
 | 
						|
                     where iig.delivery_total_num is not null
 | 
						|
                     group by isr.supplier_id
 | 
						|
                 ) a
 | 
						|
            ) hgl on isr.supplier_id=hgl.supplier_id
 | 
						|
                left join (
 | 
						|
                select isr.supplier_id,isr.supplier_code,isr.supplier_name
 | 
						|
                     ,sum(iog.order_amount) as order_amount,sum(iog.total_num) as total_num
 | 
						|
                from ims_supplier isr
 | 
						|
                         left join ims_order_goods iog on isr.supplier_id=iog.supplier_id
 | 
						|
                where iog.order_amount is not null
 | 
						|
                group by isr.supplier_id
 | 
						|
            ) cg on isr.supplier_id=cg.supplier_id
 | 
						|
                left join (
 | 
						|
                SELECT * FROM (
 | 
						|
                  select isr.supplier_id,isr.supplier_code,isr.supplier_name
 | 
						|
                       ,ii.bid_time,iig.quote_amount
 | 
						|
                  from ims_supplier isr
 | 
						|
                           left join  (select * from ims_inquiry_supplier where bid_status='3') iig on isr.supplier_id = iig.supplier_id
 | 
						|
                           left join ims_inquiry ii on iig.inquiry_id=ii.inquiry_id
 | 
						|
                  where ii.bid_time is not null
 | 
						|
                  order by ii.bid_time desc
 | 
						|
              ) r group by supplier_id
 | 
						|
            ) last on isr.supplier_id=last.supplier_id
 | 
						|
            where isr.del_flag='0'
 | 
						|
            <if test="content.supplierId != null">
 | 
						|
                and isr.area_id = #{content.areaId}
 | 
						|
            </if>
 | 
						|
            <if test="content.supplierId != null">
 | 
						|
                and isr.supplier_id = #{content.supplierId}
 | 
						|
            </if>
 | 
						|
    </select>
 | 
						|
 | 
						|
    <select id="selectSupplier" resultType="com.bonus.canteen.core.ims.vo.SupplierScoreVO">
 | 
						|
        SELECT
 | 
						|
        a.supplier_id,
 | 
						|
        a.supplier_name,
 | 
						|
        a.area_id,
 | 
						|
        aa.area_name
 | 
						|
        FROM
 | 
						|
        ims_supplier a
 | 
						|
        LEFT JOIN basic_area aa on a.area_id = aa.area_id
 | 
						|
        where
 | 
						|
        a.del_flag = #{delFlag}
 | 
						|
        <if test="content.supplierId != null">
 | 
						|
            and a.supplier_id = #{content.supplierId}
 | 
						|
        </if>
 | 
						|
        <if test="content.areaIdList != null and content.areaIdList.size() > 0">
 | 
						|
            and a.area_id in
 | 
						|
            <foreach collection="content.areaIdList" item="item" separator="," open="(" close=")">
 | 
						|
                #{item}
 | 
						|
            </foreach>
 | 
						|
        </if>
 | 
						|
    </select>
 | 
						|
 | 
						|
    <select id="listSupplierScoreSupplier" resultType="com.bonus.canteen.core.ims.model.SupplierScoreSupplierModel">
 | 
						|
        SELECT
 | 
						|
        a.supplier_id,
 | 
						|
        a.supplier_name,
 | 
						|
        a.area_id,
 | 
						|
        a.last_year_operating_income,
 | 
						|
        a.workers_num,
 | 
						|
        a.regist_fund,
 | 
						|
        count(b.supplier_id) mainQualificationNum
 | 
						|
        FROM
 | 
						|
        ims_supplier a
 | 
						|
        LEFT JOIN ( SELECT supplier_id FROM ims_supplier_qualification WHERE expiration_date >= NOW() AND main_flag =
 | 
						|
        #{mainFlag} ) b ON a.supplier_id = b.supplier_id
 | 
						|
        WHERE
 | 
						|
        a.del_flag = #{delFlag}
 | 
						|
        <if test="content.supplierId != null">
 | 
						|
            and a.supplier_id = #{content.supplierId}
 | 
						|
        </if>
 | 
						|
        <if test="content.areaId != null">
 | 
						|
            and a.area_id = #{content.areaId}
 | 
						|
        </if>
 | 
						|
        <if test="content.areaId == null">
 | 
						|
            and a.area_id is null
 | 
						|
        </if>
 | 
						|
        GROUP BY
 | 
						|
        a.supplier_id,
 | 
						|
        a.supplier_name,
 | 
						|
        a.area_id,
 | 
						|
        a.last_year_operating_income,
 | 
						|
        a.workers_num,
 | 
						|
        a.regist_fund
 | 
						|
    </select>
 | 
						|
</mapper>
 |