1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?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"/>
- </resultMap>
- <select id="getList" parameterType="BizArchiveInput" 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,
- (select sum(t5.amount) from biz_payment t5 where t5.contract_id = t1.id and t5.verify_status = 1) as paid_amount
- 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
- AND t1.status !=4
- <if test="fromId != null">AND t1.from_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="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="nonpayment == true">
- AND (select ifnull(sum(col.arrive_amount), 0) from biz_collection col where col.contract_id = t1.id and col.status = 1) < t1.true_amount
- </if>
- </trim>
- </select>
- <delete id="physicalDelete">
- DELETE FROM biz_archive_input
- <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
- <if test="id != null">
- id = #{id} AND
- </if>
- <!-- 删除条件为其他外键可以在这里加 -->
- </trim>
- </delete>
- </mapper>
|