|
|
@@ -39,86 +39,103 @@
|
|
|
<result column="op_db_user" property="opDbUser"/>
|
|
|
</resultMap>
|
|
|
|
|
|
+ <!-- 通用查询映射结果 -->
|
|
|
+ <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mac.ReceiptResponse">
|
|
|
+ <id column="receipt_id" property="receiptId"/>
|
|
|
+ <result column="receipt_no" property="receiptNo"/>
|
|
|
+ <result column="receipt_date" property="receiptDate" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="receipt_type" property="receiptType"/>
|
|
|
+ <result column="order_id" property="orderId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="receipt_mac" property="receiptMac" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="receipt_amt" property="receiptAmt"/>
|
|
|
+ <result column="receivable_id" property="receivableId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="waive_amt" property="waiveAmt"/>
|
|
|
+ <result column="handle_amt" property="handleAmt"/>
|
|
|
+ <result column="residue_amt" property="residueAmt"/>
|
|
|
+ <result column="remarks" property="remarks"/>
|
|
|
+ <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
|
|
|
+ <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="flg_valid" property="flgValid"/>
|
|
|
+ <result column="cp_id" property="cpId"/>
|
|
|
+ <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="op_app_code" property="opAppCode"/>
|
|
|
+ <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="op_db_user" property="opDbUser"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
<!-- 通用条件列 -->
|
|
|
<sql id="Condition">
|
|
|
<where>
|
|
|
<if test="receiptNo != null and receiptNo != ''">
|
|
|
- AND receipt_no = #{receiptNo}
|
|
|
+ AND t.receipt_no LIKE concat('%',my_ex.likequery(#{receiptNo}),'%')
|
|
|
</if>
|
|
|
<if test="receiptDate != null">
|
|
|
- AND receipt_date = #{receiptDate}
|
|
|
- </if>
|
|
|
- <if test="receiptType != null and receiptType != ''">
|
|
|
- AND receipt_type = #{receiptType}
|
|
|
+ AND t.receipt_date = #{receiptDate}
|
|
|
</if>
|
|
|
<if test="orderId != null and orderId != ''">
|
|
|
- AND order_id = #{orderId}
|
|
|
- </if>
|
|
|
- <if test="cusId != null and cusId != ''">
|
|
|
- AND cus_id = #{cusId}
|
|
|
- </if>
|
|
|
- <if test="orgId != null and orgId != ''">
|
|
|
- AND org_id = #{orgId}
|
|
|
- </if>
|
|
|
- <if test="staffId != null and staffId != ''">
|
|
|
- AND staff_id = #{staffId}
|
|
|
- </if>
|
|
|
- <if test="receiptMac != null and receiptMac != ''">
|
|
|
- AND receipt_mac = #{receiptMac}
|
|
|
+ AND t.order_id = #{orderId}
|
|
|
</if>
|
|
|
<if test="receiptAmt != null">
|
|
|
- AND receipt_amt = #{receiptAmt}
|
|
|
+ AND t.receipt_amt = #{receiptAmt}
|
|
|
</if>
|
|
|
<if test="receivableId != null and receivableId != ''">
|
|
|
- AND receivable_id = #{receivableId}
|
|
|
+ AND t.receivable_id = #{receivableId}
|
|
|
</if>
|
|
|
<if test="waiveAmt != null">
|
|
|
- AND waive_amt = #{waiveAmt}
|
|
|
+ AND t.waive_amt = #{waiveAmt}
|
|
|
</if>
|
|
|
<if test="handleAmt != null">
|
|
|
- AND handle_amt = #{handleAmt}
|
|
|
+ AND t.handle_amt = #{handleAmt}
|
|
|
</if>
|
|
|
<if test="residueAmt != null">
|
|
|
- AND residue_amt = #{residueAmt}
|
|
|
+ AND t.residue_amt = #{residueAmt}
|
|
|
</if>
|
|
|
<if test="remarks != null and remarks != ''">
|
|
|
- AND remarks = #{remarks}
|
|
|
+ AND t.remarks = #{remarks}
|
|
|
</if>
|
|
|
<if test="annexPaths != null and annexPaths != ''">
|
|
|
- AND annex_paths = #{annexPaths}
|
|
|
+ AND t.annex_paths = #{annexPaths}
|
|
|
</if>
|
|
|
<if test="makeStaff != null and makeStaff != ''">
|
|
|
- AND make_staff = #{makeStaff}
|
|
|
- </if>
|
|
|
- <if test="makeTime != null">
|
|
|
- AND make_time = #{makeTime}
|
|
|
+ AND t.make_staff = #{makeStaff}
|
|
|
</if>
|
|
|
<if test="flgValid != null">
|
|
|
- AND flg_valid = #{flgValid}
|
|
|
+ AND t.flg_valid = #{flgValid}
|
|
|
</if>
|
|
|
<if test="cpId != null">
|
|
|
- AND cp_id = #{cpId}
|
|
|
+ AND t.cp_id = #{cpId}
|
|
|
+ </if>
|
|
|
+ <if test="cusPhone != null and cusPhone != ''">
|
|
|
+ AND tmc.cus_phone LIKE concat('%',my_ex.likequery(#{cusPhone}),'%')
|
|
|
</if>
|
|
|
- <if test="opCreateTime != null">
|
|
|
- AND op_create_time = #{opCreateTime}
|
|
|
+ <if test="cusName != null and cusName != ''">
|
|
|
+ AND tmc.cus_name LIKE concat('%',my_ex.likequery(#{cusName}),'%')
|
|
|
</if>
|
|
|
- <if test="opCreateUserId != null and opCreateUserId != ''">
|
|
|
- AND op_create_user_id = #{opCreateUserId}
|
|
|
+ <if test="addressFull != null and addressFull != ''">
|
|
|
+ AND tmc.address_full LIKE concat('%',my_ex.likequery(#{addressFull}),'%')
|
|
|
</if>
|
|
|
- <if test="opUpdateTime != null">
|
|
|
- AND op_update_time = #{opUpdateTime}
|
|
|
+ <if test="orgIdList != null and orgIdList.size() > 0">
|
|
|
+ AND t.org_id =any(#{orgIdList, typeHandler=uuidListTypeHandler})
|
|
|
</if>
|
|
|
- <if test="opUpdateUserId != null and opUpdateUserId != ''">
|
|
|
- AND op_update_user_id = #{opUpdateUserId}
|
|
|
+ <if test="staffIdList != null and staffIdList.size() > 0">
|
|
|
+ AND t.staff_id =any(#{staffIdList, typeHandler=uuidListTypeHandler})
|
|
|
</if>
|
|
|
- <if test="opAppCode != null and opAppCode != ''">
|
|
|
- AND op_app_code = #{opAppCode}
|
|
|
+ <if test="receiptTypeList != null and receiptTypeList.size() > 0">
|
|
|
+ AND t.receipt_type =any(#{receiptTypeList, typeHandler=StringListTypeHandler})
|
|
|
</if>
|
|
|
- <if test="opTimestamp != null">
|
|
|
- AND op_timestamp = #{opTimestamp}
|
|
|
+ <if test="receiptMacList != null and receiptMacList.size() > 0">
|
|
|
+ AND t.receipt_mac =any(#{receiptMacList, typeHandler=uuidListTypeHandler})
|
|
|
</if>
|
|
|
- <if test="opDbUser != null and opDbUser != ''">
|
|
|
- AND op_db_user = #{opDbUser}
|
|
|
+ <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>
|
|
|
@@ -132,11 +149,45 @@
|
|
|
</sql>
|
|
|
|
|
|
<!-- 查询表t_mac_receipt,(条件查询+分页)列表 -->
|
|
|
- <select id="selectByCond" resultMap="BaseResultMap">
|
|
|
- SELECT
|
|
|
- <include refid="Base_Column_List"/>
|
|
|
- FROM t_mac_receipt
|
|
|
- <include refid="Condition"/>
|
|
|
+ <select id="selectByCond" resultMap="BaseResultMapResponse">
|
|
|
+ SELECT t.receipt_id,
|
|
|
+ t.receipt_no,
|
|
|
+ t.receipt_date,
|
|
|
+ t.receipt_type,
|
|
|
+ sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "receiptTypeName",
|
|
|
+ t.order_id,
|
|
|
+ tpo.order_no as "orderNo",
|
|
|
+ t.cus_id,
|
|
|
+ tmc.cus_code as "cusCode",
|
|
|
+ tmc.cus_name as "cusName",
|
|
|
+ tmc.cus_phone as "cusPhone",
|
|
|
+ tmc.address_full as "addressFull",
|
|
|
+ t.org_id,
|
|
|
+ tmo.org_name as "orgName",
|
|
|
+ t.staff_id,
|
|
|
+ tms.staff_name as "staffName",
|
|
|
+ t.receipt_mac,
|
|
|
+ t.receipt_amt,
|
|
|
+ t.receivable_id,
|
|
|
+ t.waive_amt,
|
|
|
+ t.handle_amt,
|
|
|
+ t.residue_amt,
|
|
|
+ t.remarks,
|
|
|
+ t.annex_paths,
|
|
|
+ t.make_staff,
|
|
|
+ makestaff.staff_name as "makeStaffName",
|
|
|
+ t.make_time,
|
|
|
+ t.flg_valid,
|
|
|
+ t.cp_id
|
|
|
+ FROM dkic_b.t_mac_receipt as t
|
|
|
+ left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.receipt_type
|
|
|
+ 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_customer tmc on tmc.cus_id = t.cus_id
|
|
|
+ left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
|
|
|
+ left join dkic_b.t_psi_order as tpo on tpo.order_id = t.order_id
|
|
|
+ <include refid="Condition"/>
|
|
|
+ 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>
|
|
|
@@ -146,7 +197,8 @@
|
|
|
<select id="countByCond" resultType="Long">
|
|
|
SELECT
|
|
|
count(1)
|
|
|
- FROM t_mac_receipt
|
|
|
+ FROM t_mac_receipt as t
|
|
|
+ left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
|
|
|
<include refid="Condition"/>
|
|
|
</select>
|
|
|
|