|
|
@@ -51,6 +51,64 @@
|
|
|
<result column="op_db_user" property="opDbUser"/>
|
|
|
</resultMap>
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <sql id="Base_Column_List_Response">
|
|
|
+ tpir.return_id, tpir.return_no, tpir.return_type, tpir.into_id, tpir.pur_id, tpir.into_no, tpir.pur_no, tpir.org_id,
|
|
|
+ tpir.staff_id, tpir.sup_id, tpir.contact_name, tpir.contact_phone, tpir.delivery_date, tpir.sum_quantity,
|
|
|
+ tpir.sum_standard, tpir.sum_amount, tpir.sale_discount, tpir.return_status, tpir.out_status,
|
|
|
+ tpir.outing_qty, tpir.outing_amt, tpir.out_qty, tpir.out_amt, tpir.amt_payable, tpir.amt_handle, tpir.amt_residue,
|
|
|
+ tpir.remarks, tpir.annex_paths, tpir.make_staff, tpir.make_time, tpir.flg_valid, tpir.cp_id
|
|
|
+ </sql>
|
|
|
+
|
|
|
+
|
|
|
+ <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.ivt.IntoReturnResponse">
|
|
|
+ <id column="return_id" property="returnId"/>
|
|
|
+ <result column="return_no" property="returnNo"/>
|
|
|
+ <result column="return_type" property="returnType"/>
|
|
|
+ <result column="into_id" property="intoId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="pur_id" property="purId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="into_no" property="intoNo"/>
|
|
|
+ <result column="pur_no" property="purNo"/>
|
|
|
+ <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="sup_id" property="supId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="contact_name" property="contactName"/>
|
|
|
+ <result column="contact_phone" property="contactPhone"/>
|
|
|
+ <result column="delivery_date" property="deliveryDate" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="sum_quantity" property="sumQuantity"/>
|
|
|
+ <result column="sum_standard" property="sumStandard"/>
|
|
|
+ <result column="sum_amount" property="sumAmount"/>
|
|
|
+ <result column="sale_discount" property="saleDiscount"/>
|
|
|
+ <result column="return_status" property="returnStatus"/>
|
|
|
+ <result column="out_status" property="outStatus"/>
|
|
|
+ <result column="outing_qty" property="outingQty"/>
|
|
|
+ <result column="outing_amt" property="outingAmt"/>
|
|
|
+ <result column="out_qty" property="outQty"/>
|
|
|
+ <result column="out_amt" property="outAmt"/>
|
|
|
+ <result column="amt_payable" property="amtPayable"/>
|
|
|
+ <result column="amt_handle" property="amtHandle"/>
|
|
|
+ <result column="amt_residue" property="amtResidue"/>
|
|
|
+ <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="sup_name" property="supName"/>
|
|
|
+ <result column="sup_code" property="supCode"/>
|
|
|
+
|
|
|
+ <result column="staff_name" property="staffName"/>
|
|
|
+ <result column="staff_code" property="staffCode"/>
|
|
|
+
|
|
|
+ <result column="org_name" property="orgName"/>
|
|
|
+ <result column="org_code" property="orgCode"/>
|
|
|
+
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+
|
|
|
<!-- 通用条件列 -->
|
|
|
<sql id="Condition">
|
|
|
<where>
|
|
|
@@ -171,6 +229,105 @@
|
|
|
</where>
|
|
|
</sql>
|
|
|
|
|
|
+ <sql id="Condition_Response">
|
|
|
+ <where>
|
|
|
+ <if test="returnNo != null and returnNo != ''">
|
|
|
+ AND tpir.return_no = #{returnNo}
|
|
|
+ </if>
|
|
|
+ <if test="returnType != null and returnType != ''">
|
|
|
+ AND tpir.return_type = #{returnType}
|
|
|
+ </if>
|
|
|
+ <if test="intoId != null and intoId != ''">
|
|
|
+ AND tpir.into_id = #{intoId}
|
|
|
+ </if>
|
|
|
+ <if test="purId != null and purId != ''">
|
|
|
+ AND tpir.pur_id = #{purId}
|
|
|
+ </if>
|
|
|
+ <if test="intoNo != null and intoNo != ''">
|
|
|
+ AND tpir.into_no = #{intoNo}
|
|
|
+ </if>
|
|
|
+ <if test="purNo != null and purNo != ''">
|
|
|
+ AND tpir.pur_no = #{purNo}
|
|
|
+ </if>
|
|
|
+ <if test="orgId != null and orgId != ''">
|
|
|
+ AND tpir.org_id = #{orgId}
|
|
|
+ </if>
|
|
|
+ <if test="staffId != null and staffId != ''">
|
|
|
+ AND tpir.staff_id = #{staffId}
|
|
|
+ </if>
|
|
|
+ <if test="supId != null and supId != ''">
|
|
|
+ AND tpir.sup_id = #{supId}
|
|
|
+ </if>
|
|
|
+ <if test="contactName != null and contactName != ''">
|
|
|
+ AND tpir.contact_name = #{contactName}
|
|
|
+ </if>
|
|
|
+ <if test="contactPhone != null and contactPhone != ''">
|
|
|
+ AND tpir.contact_phone = #{contactPhone}
|
|
|
+ </if>
|
|
|
+ <if test="deliveryDate != null">
|
|
|
+ AND tpir.delivery_date = #{deliveryDate}
|
|
|
+ </if>
|
|
|
+ <if test="sumQuantity != null">
|
|
|
+ AND tpir.sum_quantity = #{sumQuantity}
|
|
|
+ </if>
|
|
|
+ <if test="sumStandard != null">
|
|
|
+ AND tpir.sum_standard = #{sumStandard}
|
|
|
+ </if>
|
|
|
+ <if test="sumAmount != null">
|
|
|
+ AND tpir.sum_amount = #{sumAmount}
|
|
|
+ </if>
|
|
|
+ <if test="saleDiscount != null">
|
|
|
+ AND tpir.sale_discount = #{saleDiscount}
|
|
|
+ </if>
|
|
|
+ <if test="returnStatus != null and returnStatus != ''">
|
|
|
+ AND tpir.return_status = #{returnStatus}
|
|
|
+ </if>
|
|
|
+ <if test="outStatus != null and outStatus != ''">
|
|
|
+ AND tpir.out_status = #{outStatus}
|
|
|
+ </if>
|
|
|
+ <if test="outingQty != null">
|
|
|
+ AND tpir.outing_qty = #{outingQty}
|
|
|
+ </if>
|
|
|
+ <if test="outingAmt != null">
|
|
|
+ AND tpir.outing_amt = #{outingAmt}
|
|
|
+ </if>
|
|
|
+ <if test="outQty != null">
|
|
|
+ AND tpir.out_qty = #{outQty}
|
|
|
+ </if>
|
|
|
+ <if test="outAmt != null">
|
|
|
+ AND tpir.out_amt = #{outAmt}
|
|
|
+ </if>
|
|
|
+ <if test="amtPayable != null">
|
|
|
+ AND tpir.amt_payable = #{amtPayable}
|
|
|
+ </if>
|
|
|
+ <if test="amtHandle != null">
|
|
|
+ AND tpir.amt_handle = #{amtHandle}
|
|
|
+ </if>
|
|
|
+ <if test="amtResidue != null">
|
|
|
+ AND tpir.amt_residue = #{amtResidue}
|
|
|
+ </if>
|
|
|
+ <if test="remarks != null and remarks != ''">
|
|
|
+ AND tpir.remarks = #{remarks}
|
|
|
+ </if>
|
|
|
+ <if test="annexPaths != null and annexPaths != ''">
|
|
|
+ AND tpir.annex_paths = #{annexPaths}
|
|
|
+ </if>
|
|
|
+ <if test="makeStaff != null and makeStaff != ''">
|
|
|
+ AND tpir.make_staff = #{makeStaff}
|
|
|
+ </if>
|
|
|
+ <if test="makeTime != null">
|
|
|
+ AND tpir.make_time = #{makeTime}
|
|
|
+ </if>
|
|
|
+ <if test="flgValid != null">
|
|
|
+ AND tpir.flg_valid = #{flgValid}
|
|
|
+ </if>
|
|
|
+ <if test="cpId != null">
|
|
|
+ AND tpir.cp_id = #{cpId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
<sql id="idsForeach">
|
|
|
<!-- 根据主键returnId批量操作 -->
|
|
|
WHERE return_id in
|
|
|
@@ -179,12 +336,26 @@
|
|
|
</foreach>
|
|
|
</sql>
|
|
|
|
|
|
+ <sql id="Base_Column_List_Join">
|
|
|
+
|
|
|
+ tms.sup_name AS sup_name,
|
|
|
+ tms.sup_code AS sup_code,
|
|
|
+ tmsf.staff_name AS staff_name,
|
|
|
+ tmsf.staff_code AS staff_code,
|
|
|
+ tmo.org_name AS org_name,
|
|
|
+ tmo.org_code AS org_code
|
|
|
+ </sql>
|
|
|
+
|
|
|
<!-- 查询表t_psi_into_return,(条件查询+分页)列表 -->
|
|
|
- <select id="selectByCond" resultMap="BaseResultMap">
|
|
|
+ <select id="selectByCond" resultMap="BaseResultMapResponse">
|
|
|
SELECT
|
|
|
- <include refid="Base_Column_List"/>
|
|
|
- FROM t_psi_into_return
|
|
|
- <include refid="Condition"/>
|
|
|
+ <include refid="Base_Column_List_Response"/>,
|
|
|
+ <include refid="Base_Column_List_Join"/>
|
|
|
+ FROM dkic_b.t_psi_into_return tpir
|
|
|
+ left join dkic_b.t_mst_supplier tms on tms.sup_id = tpir.sup_id
|
|
|
+ left join dkic_b.t_mst_staff tmsf on tmsf.staff_id = tpir.staff_id
|
|
|
+ left join dkic_b.t_mst_org tmo on tmo.org_id = tpir.org_id
|
|
|
+ <include refid="Condition_Response"/>
|
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
|
@@ -194,15 +365,15 @@
|
|
|
<select id="countByCond" resultType="Long">
|
|
|
SELECT
|
|
|
count(1)
|
|
|
- FROM t_psi_into_return
|
|
|
- <include refid="Condition"/>
|
|
|
+ FROM dkic_b.t_psi_into_return tpir
|
|
|
+ <include refid="Condition_Response"/>
|
|
|
</select>
|
|
|
|
|
|
<!-- 根据主键查询表t_psi_into_return的一行数据 -->
|
|
|
<select id="selectById" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
|
<include refid="Base_Column_List"/>
|
|
|
- FROM t_psi_into_return
|
|
|
+ FROM dkic_b.t_psi_into_return
|
|
|
WHERE return_id = #{returnId}::uuid
|
|
|
</select>
|
|
|
|
|
|
@@ -210,7 +381,7 @@
|
|
|
<select id="selectByIdForUpdate" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
|
<include refid="Base_Column_List"/>
|
|
|
- FROM t_psi_into_return
|
|
|
+ FROM dkic_b.t_psi_into_return
|
|
|
WHERE return_id = #{returnId}
|
|
|
for update
|
|
|
</select>
|
|
|
@@ -219,13 +390,13 @@
|
|
|
<select id="selectByIdsForUpdate" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
|
<include refid="Base_Column_List"/>
|
|
|
- FROM t_psi_into_return
|
|
|
+ FROM dkic_b.t_psi_into_return
|
|
|
<include refid="idsForeach"/>
|
|
|
for update
|
|
|
</select>
|
|
|
|
|
|
<insert id="insertBatch">
|
|
|
- insert into t_psi_into_return
|
|
|
+ insert into dkic_b.t_psi_into_return
|
|
|
(
|
|
|
<trim suffixOverrides=",">
|
|
|
return_no,
|