|
|
@@ -69,6 +69,12 @@
|
|
|
<if test="purNo != null and purNo != ''">
|
|
|
AND tpp.pur_no like concat('%', my_ex.likequery(#{purNo}) , '%')
|
|
|
</if>
|
|
|
+ <if test="purTypeList != null and purTypeList.size()>0">
|
|
|
+ AND tpp.pur_type =any(#{purTypeList,typeHandler=StringListTypeHandler})
|
|
|
+ </if>
|
|
|
+ <if test="purStatusList != null and purStatusList.size()>0">
|
|
|
+ AND tpp.pur_status =any(#{purStatusList,typeHandler=StringListTypeHandler})
|
|
|
+ </if>
|
|
|
<if test="supIdlist != null and supIdlist.size()>0">
|
|
|
AND tpp.sup_id = any(#{supIdlist,typeHandler=UuidListTypeHandler})
|
|
|
</if>
|
|
|
@@ -125,6 +131,12 @@
|
|
|
<if test="purNo != null and purNo != ''">
|
|
|
AND tpp.pur_no like concat('%', my_ex.likequery(#{purNo}) , '%')
|
|
|
</if>
|
|
|
+ <if test="purTypeList != null and purTypeList.size()>0">
|
|
|
+ AND tpp.pur_type =any(#{purTypeList,typeHandler=StringListTypeHandler})
|
|
|
+ </if>
|
|
|
+ <if test="purStatusList != null and purStatusList.size()>0">
|
|
|
+ AND tpp.pur_status =any(#{purStatusList,typeHandler=StringListTypeHandler})
|
|
|
+ </if>
|
|
|
<if test="supIdlist != null and supIdlist.size()>0">
|
|
|
AND tpp.sup_id = any(#{supIdlist,typeHandler=UuidListTypeHandler})
|
|
|
</if>
|
|
|
@@ -163,6 +175,9 @@
|
|
|
<if test="orderNo != null and orderNo != ''">
|
|
|
AND t.order_no LIKE concat('%',my_ex.likequery(#{orderNo}),'%')
|
|
|
</if>
|
|
|
+ <if test="ordTypeList != null and ordTypeList.size()>0">
|
|
|
+ AND t.ord_type =any(#{ordTypeList,typeHandler=StringListTypeHandler})
|
|
|
+ </if>
|
|
|
<if test="addressFull != null and addressFull != ''">
|
|
|
AND t.address_full LIKE concat('%',my_ex.likequery(#{addressFull}),'%')
|
|
|
</if>
|
|
|
@@ -190,8 +205,8 @@
|
|
|
<if test="staffIdList != null and staffIdList.size() > 0">
|
|
|
AND t.staff_id =any(#{staffIdList, typeHandler=uuidListTypeHandler})
|
|
|
</if>
|
|
|
- <if test="outStatusList != null and outStatusList.size() > 0">
|
|
|
- AND t.out_status =any(#{outStatusList, typeHandler=StringListTypeHandler})
|
|
|
+ <if test="ordStatusList != null and ordStatusList.size() > 0">
|
|
|
+ AND t.ord_status =any(#{ordStatusList, typeHandler=StringListTypeHandler})
|
|
|
</if>
|
|
|
<if test="deliveryDateStart != null and deliveryDateEnd != null">
|
|
|
AND t.delivery_date >= #{deliveryDateStart}::timestamp with time zone
|
|
|
@@ -232,6 +247,12 @@
|
|
|
<if test="orderNo != null and orderNo != ''">
|
|
|
AND t.order_no LIKE concat('%',my_ex.likequery(#{orderNo}),'%')
|
|
|
</if>
|
|
|
+ <if test="ordTypeList != null and ordTypeList.size()>0">
|
|
|
+ AND t.ord_type =any(#{ordTypeList,typeHandler=StringListTypeHandler})
|
|
|
+ </if>
|
|
|
+ <if test="ordStatusList != null and ordStatusList.size() > 0">
|
|
|
+ AND t.ord_status =any(#{ordStatusList, typeHandler=StringListTypeHandler})
|
|
|
+ </if>
|
|
|
<if test="addressFull != null and addressFull != ''">
|
|
|
AND t.address_full LIKE concat('%',my_ex.likequery(#{addressFull}),'%')
|
|
|
</if>
|
|
|
@@ -259,9 +280,6 @@
|
|
|
<if test="staffIdList != null and staffIdList.size() > 0">
|
|
|
AND t.staff_id =any(#{staffIdList, typeHandler=uuidListTypeHandler})
|
|
|
</if>
|
|
|
- <if test="outStatusList != null and outStatusList.size() > 0">
|
|
|
- AND t.out_status =any(#{outStatusList, typeHandler=StringListTypeHandler})
|
|
|
- </if>
|
|
|
<if test="deliveryDateStart != null and deliveryDateEnd != null">
|
|
|
AND t.delivery_date >= #{deliveryDateStart}::timestamp with time zone
|
|
|
AND t.delivery_date < #{deliveryDateEnd}::timestamp with time zone + interval '1 day'
|
|
|
@@ -389,8 +407,8 @@
|
|
|
<if test="cpId != null">
|
|
|
AND t.cp_id = #{cpId}
|
|
|
</if>
|
|
|
- <if test="outNo != null and outNo != ''">
|
|
|
- AND t.out_no LIKE concat('%',my_ex.likequery(#{outNo}),'%')
|
|
|
+ <if test="intoNo != null and intoNo != ''">
|
|
|
+ AND t.into_no LIKE concat('%',my_ex.likequery(#{outNo}),'%')
|
|
|
</if>
|
|
|
<if test="supIdlist != null and supIdlist.size()>0">
|
|
|
AND t.sup_id = any(#{supIdlist,typeHandler=UuidListTypeHandler})
|
|
|
@@ -398,8 +416,8 @@
|
|
|
<if test="contactPhone != null and contactPhone != ''">
|
|
|
AND t.contact_phone LIKE concat('%',my_ex.likequery(#{contactPhone}),'%')
|
|
|
</if>
|
|
|
- <if test="outTypeList != null and outTypeList.size()>0">
|
|
|
- AND t.out_type =any(#{outTypeList,typeHandler=StringListTypeHandler})
|
|
|
+ <if test="intoTypeList != null and intoTypeList.size()>0">
|
|
|
+ AND t.into_type =any(#{intoTypeList,typeHandler=StringListTypeHandler})
|
|
|
</if>
|
|
|
<if test="fromNo != null and fromNo != ''">
|
|
|
AND t.from_no LIKE concat('%',my_ex.likequery(#{fromNo}),'%')
|
|
|
@@ -413,12 +431,12 @@
|
|
|
<if test="staffIdList != null and staffIdList.size() > 0">
|
|
|
AND t.staff_id =any(#{staffIdList, typeHandler=uuidListTypeHandler})
|
|
|
</if>
|
|
|
- <if test="outStatusList != null and outStatusList.size() > 0">
|
|
|
- AND t.out_status =any(#{outStatusList, typeHandler=StringListTypeHandler})
|
|
|
+ <if test="intoStatusList != null and intoStatusList.size() > 0">
|
|
|
+ AND t.into_status =any(#{intoStatusList, typeHandler=StringListTypeHandler})
|
|
|
</if>
|
|
|
- <if test="outDateStart != null and outDateEnd != null">
|
|
|
- AND t.out_date >= #{outDateStart}::timestamp with time zone
|
|
|
- AND t.out_date < #{outDateEnd}::timestamp with time zone + interval '1 day'
|
|
|
+ <if test="intoDateStart != null and intoDateEnd != null">
|
|
|
+ AND t.into_date >= #{intoDateStart}::timestamp with time zone
|
|
|
+ AND t.into_date < #{intoDateEnd}::timestamp with time zone + interval '1 day'
|
|
|
</if>
|
|
|
<if test="makeTimeStart != null and makeTimeEnd != null">
|
|
|
AND t.make_time >= #{makeTimeStart}::timestamp with time zone
|
|
|
@@ -455,8 +473,8 @@
|
|
|
<if test="cpId != null">
|
|
|
AND t.cp_id = #{cpId}
|
|
|
</if>
|
|
|
- <if test="outNo != null and outNo != ''">
|
|
|
- AND t.out_no LIKE concat('%',my_ex.likequery(#{outNo}),'%')
|
|
|
+ <if test="intoNo != null and intoNo != ''">
|
|
|
+ AND t.into_no LIKE concat('%',my_ex.likequery(#{outNo}),'%')
|
|
|
</if>
|
|
|
<if test="supIdlist != null and supIdlist.size()>0">
|
|
|
AND t.sup_id = any(#{supIdlist,typeHandler=UuidListTypeHandler})
|
|
|
@@ -464,8 +482,8 @@
|
|
|
<if test="contactPhone != null and contactPhone != ''">
|
|
|
AND t.contact_phone LIKE concat('%',my_ex.likequery(#{contactPhone}),'%')
|
|
|
</if>
|
|
|
- <if test="outTypeList != null and outTypeList.size()>0">
|
|
|
- AND t.out_type =any(#{outTypeList,typeHandler=StringListTypeHandler})
|
|
|
+ <if test="intoTypeList != null and intoTypeList.size()>0">
|
|
|
+ AND t.into_type =any(#{intoTypeList,typeHandler=StringListTypeHandler})
|
|
|
</if>
|
|
|
<if test="fromNo != null and fromNo != ''">
|
|
|
AND t.from_no LIKE concat('%',my_ex.likequery(#{fromNo}),'%')
|
|
|
@@ -479,12 +497,48 @@
|
|
|
<if test="staffIdList != null and staffIdList.size() > 0">
|
|
|
AND t.staff_id =any(#{staffIdList, typeHandler=uuidListTypeHandler})
|
|
|
</if>
|
|
|
- <if test="outStatusList != null and outStatusList.size() > 0">
|
|
|
- AND t.out_status =any(#{outStatusList, typeHandler=StringListTypeHandler})
|
|
|
+ <if test="intoStatusList != null and intoStatusList.size() > 0">
|
|
|
+ AND t.into_status =any(#{intoStatusList, typeHandler=StringListTypeHandler})
|
|
|
</if>
|
|
|
- <if test="outDateStart != null and outDateEnd != null">
|
|
|
- AND t.out_date >= #{outDateStart}::timestamp with time zone
|
|
|
- AND t.out_date < #{outDateEnd}::timestamp with time zone + interval '1 day'
|
|
|
+ <if test="intoDateStart != null and intoDateEnd != null">
|
|
|
+ AND t.into_date >= #{intoDateStart}::timestamp with time zone
|
|
|
+ AND t.into_date < #{intoDateEnd}::timestamp with time zone + interval '1 day'
|
|
|
+ </if>
|
|
|
+ <if test="makeTimeStart != null and makeTimeEnd != null">
|
|
|
+ AND t.make_time >= #{makeTimeStart}::timestamp with time zone
|
|
|
+ AND t.make_time < #{makeTimeEnd}::timestamp with time zone + interval '1 day'
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 客户收款明细表条件列 -->
|
|
|
+ <sql id="Condition_RecPayDetailReport">
|
|
|
+ <where>
|
|
|
+ t.rp_type in ('收付款类型-收款', '收付款类型-退收款')
|
|
|
+ <if test="cpId != null">
|
|
|
+ AND t.cp_id = #{cpId}
|
|
|
+ </if>
|
|
|
+ <if test="rpNo != null and rpNo != ''">
|
|
|
+ AND t.rp_no LIKE concat('%',my_ex.likequery(#{rpNo}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="contactPhone != null and contactPhone != ''">
|
|
|
+ AND t.contact_phone LIKE concat('%',my_ex.likequery(#{contactPhone}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="biznisNo != null and biznisNo != ''">
|
|
|
+ AND t.biznis_no LIKE concat('%',my_ex.likequery(#{biznisNo}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="cusName != null and cusName != ''">
|
|
|
+ AND tmc.cus_name LIKE concat('%',my_ex.likequery(#{cusName}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="orgIdList != null and orgIdList.size() > 0">
|
|
|
+ AND t.org_id =any(#{orgIdList, typeHandler=uuidListTypeHandler})
|
|
|
+ </if>
|
|
|
+ <if test="staffIdList != null and staffIdList.size() > 0">
|
|
|
+ AND t.staff_id =any(#{staffIdList, typeHandler=uuidListTypeHandler})
|
|
|
+ </if>
|
|
|
+ <if test="accDateStart != null and accDateEnd != null">
|
|
|
+ AND t.acc_date >= #{accDateStart}::timestamp with time zone
|
|
|
+ AND t.acc_date < #{accDateEnd}::timestamp with time zone + interval '1 day'
|
|
|
</if>
|
|
|
<if test="makeTimeStart != null and makeTimeEnd != null">
|
|
|
AND t.make_time >= #{makeTimeStart}::timestamp with time zone
|
|
|
@@ -503,6 +557,7 @@
|
|
|
,tmp.sup_name as "supplierName"
|
|
|
,tpp.pickup_date as "pickupDate"
|
|
|
,sys.f_get_name_i18n(tdk2.kind_name_i18n, #{i18n}) as "purStatusName"
|
|
|
+ ,sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "purTypeName"
|
|
|
,tpp.contact_name as "contactName"
|
|
|
,tpp.contact_phone as "contactPhone"
|
|
|
,tpp.intoing_qty as "intoingQtySum"
|
|
|
@@ -521,6 +576,7 @@
|
|
|
Left join dkic_b.t_mst_staff tms1 on tpp.make_staff = tms1.staff_id
|
|
|
Left join dkic_b.t_mst_warehouse tmw on tpp.wh_id = tmw.wh_id
|
|
|
left join sys.t_data_kind tdk2 on tdk2.kind_code = tpp.pur_status
|
|
|
+ left join sys.t_data_kind tdk1 on tdk1.kind_code = tpp.pur_type
|
|
|
<include refid="Condition_PurReport"/>
|
|
|
order by tpp.op_create_time desc
|
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
@@ -538,6 +594,7 @@
|
|
|
,tmp.sup_name as "supplierName"
|
|
|
,tpp.pickup_date as "pickupDate"
|
|
|
,sys.f_get_name_i18n(tdk2.kind_name_i18n, #{i18n}) as "purStatusName"
|
|
|
+ ,sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "purTypeName"
|
|
|
,tpp.contact_name as "contactName"
|
|
|
,tpp.contact_phone as "contactPhone"
|
|
|
,tpp.intoing_qty as "intoingQtySum"
|
|
|
@@ -574,6 +631,7 @@
|
|
|
Left join dkic_b.t_mst_staff as tms1 on tpp.make_staff = tms1.staff_id
|
|
|
Left join dkic_b.t_mst_warehouse as tmw on tpp.wh_id = tmw.wh_id
|
|
|
left join sys.t_data_kind as tdk2 on tdk2.kind_code = tpp.pur_status
|
|
|
+ left join sys.t_data_kind tdk1 on tdk1.kind_code = tpp.pur_type
|
|
|
left join dkic_b.t_psi_purchase_item as tppi on tppi.pur_id = tpp.pur_id
|
|
|
left join dkic_b.t_mst_goods_sku as tmgs on tmgs.sku_id = tppi.sku_id
|
|
|
left join dkic_b.t_mst_goods_brand as tmgb on tmgb.brand_id = tmgs.brand_id
|
|
|
@@ -905,4 +963,95 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
+ <!-- 客户收款明细报表主表 -->
|
|
|
+ <select id="getRecPayDetailReport" resultType="java.util.Map">
|
|
|
+ SELECT
|
|
|
+ t.rp_no as "rpNo",
|
|
|
+ t.biznis_no as "biznisNo",
|
|
|
+ tmo.org_name as "orgName",
|
|
|
+ tms.staff_name as "staffName",
|
|
|
+ tmc.cus_name as "cusName",
|
|
|
+ tmc.cus_phone as "cusPhone",
|
|
|
+ sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "rpTypeName",
|
|
|
+ tmma.mac_name as "macName",
|
|
|
+ tmrpi.amt_rec as "amtRec",
|
|
|
+ t.acc_date as "accDate",
|
|
|
+ t.remarks,
|
|
|
+ makestaff.staff_name as "makeStaffName"
|
|
|
+ FROM dkic_b.t_mac_rec_pay_item as tmrpi
|
|
|
+ left join dkic_b.t_mac_rec_pay t on tmrpi.rp_id = t.rp_id
|
|
|
+ left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
|
|
|
+ left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
|
|
|
+ left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
|
|
|
+ left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.object_id
|
|
|
+ left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.rp_type
|
|
|
+ left join dkic_b.t_mst_money_account tmma on tmma.mac_id = tmrpi.mac_id
|
|
|
+ <include refid="Condition_RecPayDetailReport"/>
|
|
|
+ order by t.op_create_time desc
|
|
|
+ <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
+ limit #{end} offset #{start}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <sql id="ConditionSalesTrackingReport">
|
|
|
+ <where>
|
|
|
+ <if test="cpId != null">
|
|
|
+ tpo.cp_id = #{cpId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 销售跟踪表 列表查询 -->
|
|
|
+ <select id="getSalesTrackingReport" resultType="java.util.Map">
|
|
|
+ SELECT
|
|
|
+ tpo.order_id AS "orderId"
|
|
|
+ ,tpo.order_no AS "orderNo"
|
|
|
+ ,tpo.order_type AS "orderType"
|
|
|
+ ,sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) AS "orderTypeName"
|
|
|
+ ,tpo.sum_quantity AS "sumQuantity"
|
|
|
+ ,tpo.sum_amount AS "sumAmount"
|
|
|
+ ,tpo.sum_standard AS "sumStandard"
|
|
|
+ ,tpo.sale_discount AS "saleDiscount"
|
|
|
+ ,tpo.order_status AS "orderStatus"
|
|
|
+ ,sys.f_get_name_i18n(tdk2.kind_name_i18n, #{i18n}) as "orderStatusName"
|
|
|
+ ,tpo.out_status AS "outStatus"
|
|
|
+ ,sys.f_get_name_i18n(tdk3.kind_name_i18n, #{i18n}) as "outStatusName"
|
|
|
+ ,tpo.outing_qty AS "outingQty"
|
|
|
+ ,tpo.outing_amt AS "outingAmt"
|
|
|
+ ,tpo.out_qty AS "outQty"
|
|
|
+ ,tpo.out_amt AS "outAmt"
|
|
|
+ ,tpo.return_qty AS "returnQty"
|
|
|
+ ,tpo.return_amt AS "returnAmt"
|
|
|
+ ,tpo.amt_receivable AS "amtReceivable"
|
|
|
+ ,tpo.amt_handle AS "amtHandle"
|
|
|
+ ,tpo.amt_residue AS "amtResidue"
|
|
|
+ ,tpo.make_time AS "makeTime"
|
|
|
+ ,tmc.cus_code AS "cusCode"
|
|
|
+ ,tmc.cus_name As "cusName"
|
|
|
+ ,tmc.cus_phone As "cusPhone"
|
|
|
+ FROM
|
|
|
+ dkic_b.t_psi_order tpo
|
|
|
+ left join dkic_b.t_mst_customer tmc on tpo.cus_id = tmc.cus_id
|
|
|
+ left join sys.t_data_kind as tdk1 on tpo.order_type = tdk1.kind_code
|
|
|
+ left join sys.t_data_kind as tdk2 on tpo.order_status = tdk2.kind_code
|
|
|
+ left join sys.t_data_kind as tdk3 on tpo.out_status = tdk3.kind_code
|
|
|
+ <include refid="ConditionSalesTrackingReport"/>
|
|
|
+ order by tpo.op_create_time desc
|
|
|
+ <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
+ limit #{end} offset #{start}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <select id="getSalesTrackingReportCount" resultType="java.lang.Long">
|
|
|
+ SELECT count(1)
|
|
|
+ FROM
|
|
|
+ dkic_b.t_psi_order tpo
|
|
|
+ <include refid="ConditionSalesTrackingReport"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|