123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- <?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="cn.ezhizao.project.business.order.mapper.BizArchiveInputMapper">
- <resultMap type="cn.ezhizao.project.business.order.domain.BizArchiveInput" id="BizArchiveInputResult">
- <id column="id" property="id"/>
- <result column="source_id" property="sourceId"/>
- <result column="referrer_data_source" property="referrerDataSource"/>
- <association property="sourceName"
- column="{ source_id = source_id, referrer_data_source = referrer_data_source }"
- select="getSourceName"/>
- <association property="alterNumber" column="{ id = id, from_id = from_id }" select="getAlterNumber"/>
- </resultMap>
- <select id="getSourceName" resultType="java.lang.String">
- <if test="referrer_data_source == null">
- select '' as name
- </if>
- <if test="referrer_data_source == 'company'">
- select name from biz_company where biz_company.id = #{source_id}
- </if>
- <if test="referrer_data_source == 'employee'">
- select nick_name from sys_user where sys_user.user_id = #{source_id}
- </if>
- <if test="referrer_data_source == 'channel'">
- select name from biz_channel where biz_channel.id = #{source_id}
- </if>
- <if test="referrer_data_source == ''">
- select '' as name
- </if>
- </select>
- <select id="getAlterNumber" resultType="java.lang.Integer">
- select count(1) from biz_archive_input t where t.deleted = 0
- <if test="from_id == 0">
- and t.from_id = #{id}
- </if>
- <if test="from_id != 0">
- and t.from_id = #{from_id} or t.id = #{from_id}
- </if>
- </select>
- <select id="getList" parameterType="InputVo" resultMap="BizArchiveInputResult">
- SELECT
- t1.*,
- t2.name as company_name,
- t2.social_credit_code as social_credit_code,
- t3.nick_name as signer_name,
- t4.title as source_category_name,
- t4.referrer_data_source
- FROM biz_archive_input t1
- left join biz_company t2 on t2.id = t1.company_id
- left join sys_user t3 on t3.user_id = t1.signer_id
- left join biz_source t4 on t4.id = t1.source_category_id
- <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
- t1.deleted = 0
- <if test="fromId != null">AND (t1.from_id = #{fromId} or t1.id = #{fromId})</if>
- <if test="id != null and id != ''">AND t1.id = #{id}</if>
- <if test="companyName != null and companyName != ''">AND t2.name like concat("%", #{companyName}, "%")</if>
- <if test="archiveTypeId != null">and archive_type_id = #{archiveTypeId}</if>
- <if test="companyId != null and companyId != ''">AND t1.company_id = #{companyId}</if>
- <if test="archiveCode != null and archiveCode != ''">AND t1.archive_code = #{archiveCode}</if>
- <if test="startMonth != null ">AND t1.start_month = #{startMonth}</if>
- <if test="endMonth != null ">AND t1.end_month = #{endMonth}</if>
- <if test="proofUrl != null and proofUrl != ''">AND t1.proof_url = #{proofUrl}</if>
- <if test="contractNo != null and contractNo != ''">AND t1.contract_no = #{contractNo}</if>
- <if test="formDate != null ">AND t1.form_date = #{formDate}</if>
- <if test="amount != null ">AND t1.amount = #{amount}</if>
- <if test="verifyStatus != null ">AND t1.verify_status = #{verifyStatus}</if>
- <if test="contractType != null ">AND t1.contract_type = #{contractType}</if>
- <if test="serviceType != null ">AND t1.service_type = #{serviceType}</if>
- <if test="outputDate != null ">AND t1.output_date = #{outputDate}</if>
- <if test="monthNum != null ">AND t1.month_num = #{monthNum}</if>
- <if test="companyName != null and companyName != '' ">AND t2.name like concat('%', #{companyName}, '%')</if>
- <if test="verifyRemark != null and verifyRemark != ''">AND t1.verify_remark = #{verifyRemark}</if>
- <if test="tenantId != null">AND t1.tenant_id = #{tenantId}</if>
- <if test="isKeepAccount != null">AND <if test="isKeepAccount == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 1)
- </if>
- <if test="isSocialSecurity != null">AND <if test="isSocialSecurity == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 2)
- </if>
- <if test="isHousingFund != null">AND <if test="isHousingFund == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 3)
- </if>
- <if test="isReturnTax != null">AND <if test="isReturnTax == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 4)
- </if>
- <if test="isRegister != null">AND <if test="isRegister == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 5)
- </if>
- <if test="isAlter != null">AND <if test="isAlter == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 6)
- </if>
- <if test="isLogout != null">AND <if test="isLogout == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 7)
- </if>
- <if test="isQualified != null">AND <if test="isQualified == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 8)
- </if>
- <if test="isOther != null">AND <if test="isOther == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 9)
- </if>
- </trim>
- </select>
- <select id="getListByInput" parameterType="InputVo" resultMap="BizArchiveInputResult">
- SELECT
- t1.*,
- t2.name as company_name,
- t2.customer_label_id as customerLabelId,
- t5.lable as customerLabelName,
- t2.social_credit_code as social_credit_code,
- t3.nick_name as signer_name,
- t4.title as source_category_name,
- t4.referrer_data_source
- FROM biz_archive_input t1
- left join biz_company t2 on t2.id = t1.company_id
- left join sys_user t3 on t3.user_id = t1.signer_id
- left join biz_source t4 on t4.id = t1.source_category_id
- left join biz_lable t5 on t5.id = t2.customer_label_id
- <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
- t1.deleted = 0
- <if test="fromId != null">AND (t1.from_id = #{fromId} or t1.id = #{fromId})</if>
- <if test="id != null and id != ''">AND t1.id = #{id}</if>
- <if test="contractNo!=null and contractNo != '' ">AND t1.contract_no like concat("%",#{contractNo}, "%")</if>
- <if test="companyName != null and companyName != ''">AND t2.name like concat("%", #{companyName}, "%")</if>
- <if test="archiveTypeId != null">and archive_type_id = #{archiveTypeId}</if>
- <if test="companyId != null and companyId != ''">AND t1.company_id = #{companyId}</if>
- <if test="archiveCode != null and archiveCode != ''">AND t1.archive_code = #{archiveCode}</if>
- <if test="startMonth != null ">AND t1.start_month = #{startMonth}</if>
- <if test="endMonth != null ">AND t1.end_month = #{endMonth}</if>
- <if test="proofUrl != null and proofUrl != ''">AND t1.proof_url = #{proofUrl}</if>
- <if test="boss != null and boss != ''">AND t1.boss like concat("%",#{boss}, "%")</if>
- <if test="formDate!= null and formDate.size() ">
- AND (
- DATE_FORMAT(t1.form_date,'%Y-%m-%d') >= #{formDate[0]}
- AND
- DATE_FORMAT(t1.form_date,'%Y-%m-%d') <= #{formDate[1]}
- )
- </if>
- <if test="amount != null ">AND t1.amount = #{amount}</if>
- <if test="verifyStatus != null ">AND t1.verify_status = #{verifyStatus}</if>
- <if test="contractType != null ">AND t1.contract_type = #{contractType}</if>
- <if test="serviceType != null ">AND t1.service_type = #{serviceType}</if>
- <if test="outputDate != null ">AND t1.output_date = #{outputDate}</if>
- <if test="monthNum != null ">AND t1.month_num = #{monthNum}</if>
- <if test="companyName != null and companyName != '' ">AND t2.name like concat('%', #{companyName}, '%')</if>
- <if test="verifyRemark != null and verifyRemark != ''">AND t1.verify_remark = #{verifyRemark}</if>
- <if test="tenantId != null">AND t1.tenant_id = #{tenantId}</if>
- <if test="isKeepAccount != null">AND <if test="isKeepAccount == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 1)
- </if>
- <if test="isSocialSecurity != null">AND <if test="isSocialSecurity == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 2)
- </if>
- <if test="isHousingFund != null">AND <if test="isHousingFund == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 3)
- </if>
- <if test="isReturnTax != null">AND <if test="isReturnTax == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 4)
- </if>
- <if test="isRegister != null">AND <if test="isRegister == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 5)
- </if>
- <if test="isAlter != null">AND <if test="isAlter == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 6)
- </if>
- <if test="isLogout != null">AND <if test="isLogout == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 7)
- </if>
- <if test="isQualified != null">AND <if test="isQualified == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 8)
- </if>
- <if test="isOther != null">AND <if test="isOther == 0">not</if> exists (select 1 from
- biz_archive_input_detail t5 where t5.deleted = 0 and t5.contract_id = t1.id and t5.task_type_id = 9)
- </if>
- <if test="customerLabelId != null and customerLabelId.size() > 0">
- AND t2.customer_label_id IN
- <foreach collection="customerLabelId" index="index" item="item" separator="," open="(" close=")">
- #{item,jdbcType=BIGINT}
- </foreach>
- </if>
- </trim>
- </select>
- <update id="removeByIds">
- UPDATE biz_archive_input
- SET deleted=1
- WHERE id in
- <foreach collection="ids" item="id" index="index" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <update id="deleteByDate">
- update biz_entrust entrust set entrust.deleted = 1,update_time = now(),updater_id = #{updaterId}
- where work_order_id = #{workOrderId}
- and task_type_id = #{taskTypeId}
- <![CDATA[and current_month > #{endDate} ]]>
- </update>
- <delete id="physicalDelete">
- DELETE FROM biz_archive_input
- <where>
- <if test="id != null">
- AND id = #{id}
- </if>
- <if test="tenantId != null">
- AND tenant_id = #{tenantId}
- </if>
- </where>
- </delete>
- </mapper>
|