|
@@ -4,7 +4,22 @@
|
|
|
<!-- 基础的返回map 多表复杂的 自行组合 -->
|
|
|
<resultMap id="BaseResultMap" type="cn.ezhizao.project.business.collection.domain.BizCollectionDetail">
|
|
|
</resultMap>
|
|
|
-
|
|
|
+ <resultMap id="DetailResultMap" type="cn.ezhizao.project.business.collection.domain.BizCollectionDetail">
|
|
|
+ <id column="id" property="id"/>
|
|
|
+ <result column="collection_id" property="collectionId"/>
|
|
|
+ <result column="contract_id" property="contractId"/>
|
|
|
+ <association property="bizCollection" column="collection_id" select="getCollection" javaType="cn.ezhizao.project.business.collection.domain.BizCollection" />
|
|
|
+ <association property="bizArchiveInput" column="contract_id" select="getArchiveInput" javaType="cn.ezhizao.project.business.collection.domain.vo.ArchiveVo" />
|
|
|
+ </resultMap>
|
|
|
+ <select id="getCollection" resultType="cn.ezhizao.project.business.collection.domain.BizCollection">
|
|
|
+ select *,user1.nick_name as applierName,user2.nick_name as verifyName from biz_collection
|
|
|
+ left join sys_user user1 on user1.user_id = biz_collection.applier_id
|
|
|
+ left join sys_user user2 on user2.user_id = biz_collection.verify_id
|
|
|
+ where id = #{collection_id}
|
|
|
+ </select>
|
|
|
+ <select id="getArchiveInput" resultType="cn.ezhizao.project.business.collection.domain.vo.ArchiveVo">
|
|
|
+ select * from biz_archive_input where id = #{contract_id}
|
|
|
+ </select>
|
|
|
<!--带条件的List查询-->
|
|
|
<select id="getList" resultMap="BaseResultMap">
|
|
|
<include refid="getListSql"/>
|
|
@@ -111,4 +126,105 @@
|
|
|
AND collection_id = #{collectionId}
|
|
|
</if>
|
|
|
</delete>
|
|
|
+ <select id="getDetailList" resultMap="DetailResultMap">
|
|
|
+ select detail.*,(select sum(cd.arrive_amount) from biz_collection_detail cd left join biz_collection c on c.id =
|
|
|
+ cd.collection_id
|
|
|
+ where cd.contract_detail_id = detail.contract_detail_id
|
|
|
+ and cd.deleted = 0 and detail.contract_id = cd.contract_id and c.status = 1) arrived from biz_collection_detail
|
|
|
+ detail
|
|
|
+ LEFT JOIN biz_collection collection on collection.id = detail.collection_id
|
|
|
+ LEFT JOIN biz_task_type t2 on t2.id = detail.task_type_id
|
|
|
+ LEFT JOIN biz_archive_input_detail inputDetail on inputDetail.id = detail.contract_detail_id
|
|
|
+ LEFT JOIN biz_archive_input input on input.id = inputDetail.contract_id
|
|
|
+ LEFT JOIN biz_company company on detail.company_id = company.id
|
|
|
+ left join sys_user user1 on user1.user_id = collection.verify_id
|
|
|
+ left join sys_user user2 on user2.user_id = collection.applier_id
|
|
|
+ <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
|
|
|
+ detail.deleted = 0 AND collection.status = 1
|
|
|
+ <if test="id != null ">
|
|
|
+ AND detail.id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="collectionId != null ">
|
|
|
+ AND detail.collection_id = #{collectionId}
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null">
|
|
|
+ AND detail.tenant_id = #{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="collectionIds != null and collectionIds.size > 0 ">
|
|
|
+ AND collection_id in
|
|
|
+ <foreach collection="collectionIds" index="index" item="item" separator="," open="(" close=")">
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
+ </foreach>
|
|
|
+
|
|
|
+ </if>
|
|
|
+ <if test="contractDetailId != null">
|
|
|
+ AND detail.contract_detail_id = #{contractDetailId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="bizArchiveInput != null and bizArchiveInput.contractNo != null and bizArchiveInput.contractNo != ''">
|
|
|
+ AND input.contract_no LIKE CONCAT('%', #{bizArchiveInput.contractNo},'%')
|
|
|
+ </if>
|
|
|
+ <if test="bizArchiveInput != null and bizArchiveInput.boss != null and bizArchiveInput.boss != ''">
|
|
|
+ AND input.boss LIKE CONCAT('%', #{bizArchiveInput.boss},'%')
|
|
|
+ </if>
|
|
|
+ <if test="bizArchiveInput != null and bizArchiveInput.party != null and bizArchiveInput.party != ''">
|
|
|
+ AND input.party LIKE CONCAT('%', #{bizArchiveInput.party},'%')
|
|
|
+ </if>
|
|
|
+ <if test="bizArchiveInput != null and bizArchiveInput.contractType != null">
|
|
|
+ AND input.contract_type = #{bizArchiveInput.contractType}
|
|
|
+ </if>
|
|
|
+ <if test="bizCollection != null and bizCollection.verifyName != null and bizCollection.verifyName != ''">
|
|
|
+ AND user1.nick_name LIKE CONCAT('%', #{bizCollection.verifyName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="bizCollection != null and bizCollection.applierName != null and bizCollection.applierName != ''">
|
|
|
+ AND user2.nick_name LIKE CONCAT('%', #{bizCollection.applierName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="bizCollection != null and bizCollection.isProject != null">
|
|
|
+ AND collection.is_project = #{bizCollection.isProject}
|
|
|
+ </if>
|
|
|
+ <if test="bizCollection != null and bizCollection.projectMainName != null and bizCollection.projectMainName != ''">
|
|
|
+ AND collection.project_main_name LIKE CONCAT('%', #{bizCollection.projectMainName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="bizCollection != null and bizCollection.projectName != null and bizCollection.projectName != ''">
|
|
|
+ AND collection.project_name LIKE CONCAT('%', #{bizCollection.projectName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="verifyStatus != null">
|
|
|
+ AND collection.status = #{verifyStatus}
|
|
|
+ </if>
|
|
|
+ <if test="contractId != null ">
|
|
|
+ AND detail.contract_id = #{contractId}
|
|
|
+ </if>
|
|
|
+ <if test="bizCollection != null and bizCollection.companyName != null and bizCollection.companyName != '' ">
|
|
|
+ AND company.name LIKE CONCAT('%', #{bizCollection.companyName},'%')
|
|
|
+ </if>
|
|
|
+ <if test=" bizArchiveInput != null and bizArchiveInput.map != null and bizArchiveInput.map.receiptDateFilter != null">
|
|
|
+ AND (
|
|
|
+ DATE_FORMAT(collection.arrive_date,'%Y-%m-%d') >= #{bizArchiveInput.map.receiptDateFilter[0]}
|
|
|
+ AND
|
|
|
+ DATE_FORMAT(collection.arrive_date,'%Y-%m-%d') <= #{bizArchiveInput.map.receiptDateFilter[1]}
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test=" bizArchiveInput != null and bizArchiveInput.map != null and bizArchiveInput.map.actuallyDateFilter != null">
|
|
|
+ AND(
|
|
|
+ DATE_FORMAT(collection.actually_date,'%Y-%m-%d') >= #{bizArchiveInput.map.actuallyDateFilter[0]}
|
|
|
+ AND
|
|
|
+ DATE_FORMAT(collection.actually_date,'%Y-%m-%d') <= #{bizArchiveInput.map.actuallyDateFilter[1]}
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="taskTypeId != null ">
|
|
|
+ and detail.task_type_id = #{taskTypeId} AND
|
|
|
+ </if>
|
|
|
+ <if test="remark != null and remark != '' ">
|
|
|
+ detail.remark = #{remark} AND
|
|
|
+ </if>
|
|
|
+ <if test="ids != null ">
|
|
|
+ detail.contract_id IN
|
|
|
+ <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
+ </foreach>
|
|
|
+ AND
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ order by detail.create_time desc
|
|
|
+ </select>
|
|
|
</mapper>
|