|
@@ -241,4 +241,143 @@
|
|
|
a.contract_no
|
|
|
) b
|
|
|
</select>
|
|
|
+ <!--获得利润核算列表总数-->
|
|
|
+ <select id="getContractCountByCondition" parameterType="Map" resultType="java.lang.Integer">
|
|
|
+ SELECT
|
|
|
+ COUNT(m.id)
|
|
|
+ FROM contract_management_info m
|
|
|
+ LEFT JOIN warehouse_in_out_info wi on m.contract_no = wi.contract_no
|
|
|
+-- LEFT JOIN warehouse_position_info wp on wi.id = wp.base_id
|
|
|
+ WHERE
|
|
|
+ m.comp_id = #{compId}
|
|
|
+ AND m.delete_flag = '0'
|
|
|
+ <if test="searchTypeCon != null and searchTypeCon != ''">
|
|
|
+ <!--执行中-->
|
|
|
+ <if test="searchTypeCon == 1">
|
|
|
+ AND (m.status_flag == '1' or approve_status='待决策人审核')
|
|
|
+ </if>
|
|
|
+ <!--已完成-->
|
|
|
+ <if test="searchTypeCon == 2">
|
|
|
+ AND m.status_flag = '3'
|
|
|
+ </if>
|
|
|
+ <!--发运结束-->
|
|
|
+ <if test="searchTypeCon == 3">
|
|
|
+ AND m.status_flag = '2'
|
|
|
+ </if>
|
|
|
+ <!--待执行-->
|
|
|
+ <if test="searchTypeCon == 4">
|
|
|
+ AND m.status_flag = '0'
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="searchContractType != null and searchContractType != ''">
|
|
|
+ <!--销售合同-->
|
|
|
+ <if test="searchContractType == 1">
|
|
|
+ AND m.contract_type = '1'
|
|
|
+ </if>
|
|
|
+ <!--采购合同-->
|
|
|
+ <if test="searchContractType == 2">
|
|
|
+ AND m.contract_type = '2'
|
|
|
+ </if>
|
|
|
+ <!--代收合同-->
|
|
|
+ <if test="searchContractType == 3">
|
|
|
+ AND m.contract_type = '3'
|
|
|
+ AND m.agreement_type = '代收合同'
|
|
|
+ </if>
|
|
|
+ <!--代储合同-->
|
|
|
+ <if test="searchContractType == 4">
|
|
|
+ AND m.contract_type = '1'
|
|
|
+ AND m.agreement_type = '代储合同'
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null">
|
|
|
+ AND (DATE_FORMAT(m.signing_date,"%Y%m%d") >=
|
|
|
+ DATE_FORMAT(#{startDate},"%Y%m%d"))
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null">
|
|
|
+ AND (DATE_FORMAT(m.signing_date,"%Y%m%d") <=
|
|
|
+ DATE_FORMAT(#{endDate},"%Y%m%d"))
|
|
|
+ </if>
|
|
|
+ <if test="searchKeyWord != null and searchKeyWord != ''">
|
|
|
+ AND (lower(m.contract_no) like lower(CONCAT('%',#{searchKeyWord},'%'))
|
|
|
+ OR lower( m.buyer) like lower(CONCAT('%',#{searchKeyWord},'%'))
|
|
|
+ OR lower( m.seller) like lower(CONCAT('%',#{searchKeyWord},'%')))
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <!--利润核算列表查询-->
|
|
|
+ <select id="getContractListByCondition" parameterType="Map"
|
|
|
+ resultType="com.yh.saas.plugin.yiliangyiyun.entity.ContractManagementInfo">
|
|
|
+ SELECT
|
|
|
+ m.id,
|
|
|
+ m.comp_id as compId,
|
|
|
+ m.contract_no as contractNo,
|
|
|
+ m.contract_type as contractType,
|
|
|
+ m.seller,
|
|
|
+ m.buyer,
|
|
|
+ m.signing_date,
|
|
|
+ m.status,
|
|
|
+ wi.warehouse_name as warehouseName,
|
|
|
+ wi.net_weight as netWeight,
|
|
|
+ m.approve_status as approveStatus,
|
|
|
+ m.agreement_type as agreementType
|
|
|
+ FROM contract_management_info m
|
|
|
+ LEFT JOIN warehouse_in_out_info wi on m.contract_no = wi.contract_no
|
|
|
+ WHERE
|
|
|
+ m.comp_id = #{compId}
|
|
|
+ AND m.delete_flag = '0'
|
|
|
+ <if test="searchTypeCon != null and searchTypeCon != ''">
|
|
|
+ <!--执行中-->
|
|
|
+ <if test="searchTypeCon == 1">
|
|
|
+ AND (m.status_flag == '1' or approve_status='待决策人审核')
|
|
|
+ </if>
|
|
|
+ <!--已完成-->
|
|
|
+ <if test="searchTypeCon == 2">
|
|
|
+ AND m.status_flag = '3'
|
|
|
+ </if>
|
|
|
+ <!--发运结束-->
|
|
|
+ <if test="searchTypeCon == 3">
|
|
|
+ AND m.status_flag = '2'
|
|
|
+ </if>
|
|
|
+ <!--待执行-->
|
|
|
+ <if test="searchTypeCon == 4">
|
|
|
+ AND m.status_flag = '0'
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="searchContractType != null and searchContractType != ''">
|
|
|
+ <!--销售合同-->
|
|
|
+ <if test="searchContractType == 1">
|
|
|
+ AND m.contract_type = '1'
|
|
|
+ </if>
|
|
|
+ <!--采购合同-->
|
|
|
+ <if test="searchContractType == 2">
|
|
|
+ AND m.contract_type = '2'
|
|
|
+ </if>
|
|
|
+ <!--代收合同-->
|
|
|
+ <if test="searchContractType == 3">
|
|
|
+ AND m.contract_type = '2'
|
|
|
+ AND m.agreement_type = '代收合同'
|
|
|
+ </if>
|
|
|
+ <!--代储合同-->
|
|
|
+ <if test="searchContractType == 4">
|
|
|
+ AND m.contract_type = '1'
|
|
|
+ AND m.agreement_type = '代储合同'
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null">
|
|
|
+ AND (DATE_FORMAT(m.signing_date,"%Y%m%d") >=
|
|
|
+ DATE_FORMAT(#{startDate},"%Y%m%d"))
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null">
|
|
|
+ AND (DATE_FORMAT(m.signing_date,"%Y%m%d") <=
|
|
|
+ DATE_FORMAT(#{endDate},"%Y%m%d"))
|
|
|
+ </if>
|
|
|
+ <if test="searchKeyWord != null and searchKeyWord != ''">
|
|
|
+ AND (lower(m.contract_no) like lower(CONCAT('%',#{searchKeyWord},'%'))
|
|
|
+ OR lower( m.buyer) like lower(CONCAT('%',#{searchKeyWord},'%'))
|
|
|
+ OR lower( m.seller) like lower(CONCAT('%',#{searchKeyWord},'%')))
|
|
|
+ </if>
|
|
|
+ ORDER BY m.signing_date DESC
|
|
|
+ <if test="currentPage != null and currentPage != ''">
|
|
|
+ LIMIT ${startRecord}, ${pageSize}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|