|
@@ -129,15 +129,22 @@
|
|
|
and create_date > #{year}
|
|
|
</select>
|
|
|
<select id="getPrintListByCondition" parameterType="Map" resultType="com.yh.saas.plugin.yiliangyiyun.entity.GeneralAuditInfo">
|
|
|
- select
|
|
|
+ select * FROM (
|
|
|
+ select
|
|
|
a.id,
|
|
|
a.businessNo as businessNo,
|
|
|
a.creater as creater,
|
|
|
a.type as type,
|
|
|
a.businessCode as businessCode,
|
|
|
a.status,
|
|
|
- a.createDate as createDate
|
|
|
+ case when a.type ='入库单请款' then IFNULL( sum( w.payment_request_amount ), 0 ) else e.amount_money end as
|
|
|
+ amountMoney,
|
|
|
+ a.createDate as createDate,
|
|
|
+ e.payer_header as payerHeader,
|
|
|
+ e.warehouse_name as warehouseName
|
|
|
FROM v_audit_print a
|
|
|
+ left join expense_info e on e.id = a.id and e.delete_flag = '0'
|
|
|
+ left join warehousing_order_record w on w.batch_id = a.id and w.delete_flag = '0'
|
|
|
where a.compId= #{compId}
|
|
|
<if test="searchType != null and searchType != ''">
|
|
|
AND a.type = #{searchType}
|
|
@@ -154,30 +161,44 @@
|
|
|
AND (DATE_FORMAT(a.createDate,"%Y%m%d") <=
|
|
|
DATE_FORMAT(#{endDate},"%Y%m%d"))
|
|
|
</if>
|
|
|
+ group by a.id
|
|
|
ORDER BY a.createDate DESC
|
|
|
+ ) tt
|
|
|
+ <if test="amountMoney != null and amountMoney != ''">
|
|
|
+ where tt.amountMoney like CONCAT('%',#{amountMoney},'%')
|
|
|
+ </if>
|
|
|
<if test="currentPage != null and currentPage != ''">
|
|
|
LIMIT ${startRecord}, ${pageSize}
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="getPrintCountByCondition" parameterType="Map" resultType="java.lang.Integer">
|
|
|
- SELECT
|
|
|
- COUNT(a.id)
|
|
|
- FROM v_audit_print a
|
|
|
- where a.compId= #{compId}
|
|
|
- <if test="searchType != null and searchType != ''">
|
|
|
- AND a.type = #{searchType}
|
|
|
- </if>
|
|
|
- <if test="searchKeyWord != null and searchKeyWord != ''">
|
|
|
- AND (lower(a.businessNo) like lower(CONCAT('%',#{searchKeyWord},'%'))
|
|
|
- OR lower(a.creater) like lower(CONCAT('%',#{searchKeyWord},'%')))
|
|
|
- </if>
|
|
|
- <if test="startDate != null">
|
|
|
- AND (DATE_FORMAT(a.createDate,"%Y%m%d") >=
|
|
|
- DATE_FORMAT(#{startDate},"%Y%m%d"))
|
|
|
- </if>
|
|
|
- <if test="endDate != null">
|
|
|
- AND (DATE_FORMAT(a.createDate,"%Y%m%d") <=
|
|
|
- DATE_FORMAT(#{endDate},"%Y%m%d"))
|
|
|
+ SELECT COUNT(*) from(
|
|
|
+ SELECT
|
|
|
+ case when a.type ='入库单请款' then IFNULL( sum( w.payment_request_amount ), 0 ) else e.amount_money end as
|
|
|
+ amountMoney
|
|
|
+ FROM v_audit_print a
|
|
|
+ left join expense_info e on e.id = a.id and e.delete_flag = '0'
|
|
|
+ left join warehousing_order_record w on w.batch_id = a.id and w.delete_flag = '0'
|
|
|
+ where a.compId= #{compId}
|
|
|
+ <if test="searchType != null and searchType != ''">
|
|
|
+ AND a.type = #{searchType}
|
|
|
+ </if>
|
|
|
+ <if test="searchKeyWord != null and searchKeyWord != ''">
|
|
|
+ AND (lower(a.businessNo) like lower(CONCAT('%',#{searchKeyWord},'%'))
|
|
|
+ OR lower(a.creater) like lower(CONCAT('%',#{searchKeyWord},'%')))
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null">
|
|
|
+ AND (DATE_FORMAT(a.createDate,"%Y%m%d") >=
|
|
|
+ DATE_FORMAT(#{startDate},"%Y%m%d"))
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null">
|
|
|
+ AND (DATE_FORMAT(a.createDate,"%Y%m%d") <=
|
|
|
+ DATE_FORMAT(#{endDate},"%Y%m%d"))
|
|
|
+ </if>
|
|
|
+ group by a.id
|
|
|
+ ) tt
|
|
|
+ <if test="amountMoney != null and amountMoney != ''">
|
|
|
+ where tt.amountMoney like CONCAT('%',#{amountMoney},'%')
|
|
|
</if>
|
|
|
</select>
|
|
|
</mapper>
|