|
@@ -27,50 +27,89 @@
|
|
|
<result column="cp_id" property="cpId"/>
|
|
<result column="cp_id" property="cpId"/>
|
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
+ <!-- 通用查询映射结果 -->
|
|
|
|
|
+ <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mac.OtherReceivableResponse">
|
|
|
|
|
+ <id column="receivable_id" property="receivableId"/>
|
|
|
|
|
+ <result column="receivable_no" property="receivableNo"/>
|
|
|
|
|
+ <result column="object_type" property="objectType"/>
|
|
|
|
|
+ <result column="object_id" property="objectId" typeHandler="UuidTypeHandler"/>
|
|
|
|
|
+ <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
|
|
|
|
|
+ <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
|
|
|
|
|
+ <result column="sum_amt_receivable" property="sumAmtReceivable"/>
|
|
|
|
|
+ <result column="acc_item_id" property="accItemId" typeHandler="UuidTypeHandler"/>
|
|
|
|
|
+ <result column="acc_date" property="accDate" typeHandler="TimestampTypeHandler"/>
|
|
|
|
|
+ <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"/>
|
|
|
|
|
+ </resultMap>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
<!-- 通用条件列 -->
|
|
<!-- 通用条件列 -->
|
|
|
<sql id="Condition">
|
|
<sql id="Condition">
|
|
|
<where>
|
|
<where>
|
|
|
<if test="receivableNo != null and receivableNo != ''">
|
|
<if test="receivableNo != null and receivableNo != ''">
|
|
|
- AND receivable_no = #{receivableNo}
|
|
|
|
|
|
|
+ AND t.receivable_no LIKE concat('%',my_ex.likequery(#{receivableNo}),'%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="objectType != null and objectType != ''">
|
|
<if test="objectType != null and objectType != ''">
|
|
|
- AND object_type = #{objectType}
|
|
|
|
|
|
|
+ AND t.object_type = #{objectType}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="objectId != null and objectId != ''">
|
|
<if test="objectId != null and objectId != ''">
|
|
|
- AND object_id = #{objectId}
|
|
|
|
|
|
|
+ AND t.object_id = #{objectId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="orgId != null and orgId != ''">
|
|
<if test="orgId != null and orgId != ''">
|
|
|
- AND org_id = #{orgId}
|
|
|
|
|
|
|
+ AND t.org_id = #{orgId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="staffId != null and staffId != ''">
|
|
<if test="staffId != null and staffId != ''">
|
|
|
- AND staff_id = #{staffId}
|
|
|
|
|
|
|
+ AND t.staff_id = #{staffId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="sumAmtReceivable != null">
|
|
<if test="sumAmtReceivable != null">
|
|
|
- AND sum_amt_receivable = #{sumAmtReceivable}
|
|
|
|
|
|
|
+ AND t.sum_amt_receivable = #{sumAmtReceivable}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="accItemId != null and accItemId != ''">
|
|
<if test="accItemId != null and accItemId != ''">
|
|
|
- AND acc_item_id = #{accItemId}
|
|
|
|
|
|
|
+ AND t.acc_item_id = #{accItemId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="accDate != null">
|
|
<if test="accDate != null">
|
|
|
- AND acc_date = #{accDate}
|
|
|
|
|
|
|
+ AND t.acc_date = #{accDate}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="remarks != null and remarks != ''">
|
|
<if test="remarks != null and remarks != ''">
|
|
|
- AND remarks = #{remarks}
|
|
|
|
|
|
|
+ AND t.remarks = #{remarks}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="annexPaths != null and annexPaths != ''">
|
|
<if test="annexPaths != null and annexPaths != ''">
|
|
|
- AND annex_paths = #{annexPaths}
|
|
|
|
|
|
|
+ AND t.annex_paths = #{annexPaths}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="makeStaff != null and makeStaff != ''">
|
|
<if test="makeStaff != null and makeStaff != ''">
|
|
|
- AND make_staff = #{makeStaff}
|
|
|
|
|
|
|
+ AND t.make_staff = #{makeStaff}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="makeTime != null">
|
|
<if test="makeTime != null">
|
|
|
- AND make_time = #{makeTime}
|
|
|
|
|
|
|
+ AND t.make_time = #{makeTime}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="flgValid != null">
|
|
<if test="flgValid != null">
|
|
|
- AND flg_valid = #{flgValid}
|
|
|
|
|
|
|
+ AND t.flg_valid = #{flgValid}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="cpId != null">
|
|
<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="cusName != null and cusName != ''">
|
|
|
|
|
+ AND tmc.cus_name LIKE concat('%',my_ex.likequery(#{cusName}),'%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orgIds != null and orgIds.size() > 0">
|
|
|
|
|
+ AND t.org_id =any(#{orgIds, typeHandler=UuidListTypeHandler})
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="staffIds != null and staffIds.size() > 0">
|
|
|
|
|
+ AND t.staff_id =any(#{staffIds, typeHandler=UuidListTypeHandler})
|
|
|
|
|
+ </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>
|
|
|
|
|
+ <if test="flgValidList != null and flgValidList.size()>0">
|
|
|
|
|
+ AND t.flg_valid =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
|
|
|
</if>
|
|
</if>
|
|
|
</where>
|
|
</where>
|
|
|
</sql>
|
|
</sql>
|
|
@@ -84,11 +123,38 @@
|
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
|
|
<!-- 查询表t_mac_other_receivable,(条件查询+分页)列表 -->
|
|
<!-- 查询表t_mac_other_receivable,(条件查询+分页)列表 -->
|
|
|
- <select id="selectByCond" resultMap="BaseResultMap">
|
|
|
|
|
- SELECT
|
|
|
|
|
- <include refid="Base_Column_List"/>
|
|
|
|
|
- FROM t_mac_other_receivable
|
|
|
|
|
|
|
+ <select id="selectByCond" resultMap="BaseResultMapResponse">
|
|
|
|
|
+ SELECT t.receivable_id,
|
|
|
|
|
+ t.receivable_no,
|
|
|
|
|
+ t.object_type,
|
|
|
|
|
+ sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "objectTypeName",
|
|
|
|
|
+ t.object_id,
|
|
|
|
|
+ tmc.cus_code as "cusCode",
|
|
|
|
|
+ tmc.cus_name as "cusName",
|
|
|
|
|
+ tmc.cus_phone as "cusPhone",
|
|
|
|
|
+ t.org_id,
|
|
|
|
|
+ tmo.org_name as "orgName",
|
|
|
|
|
+ t.staff_id,
|
|
|
|
|
+ tms.staff_name as "staffName",
|
|
|
|
|
+ t.sum_amt_receivable,
|
|
|
|
|
+ t.acc_item_id,
|
|
|
|
|
+ t.acc_date,
|
|
|
|
|
+ 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_other_receivable as t
|
|
|
|
|
+ left join dkic_b.t_mst_customer tmc
|
|
|
|
|
+ on tmc.cus_id = t.object_id and t.object_type in ('对象类型-客户')
|
|
|
|
|
+ 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 sys.t_data_kind as tdk1 on tdk1.kind_code = t.object_type
|
|
|
<include refid="Condition"/>
|
|
<include refid="Condition"/>
|
|
|
|
|
+ order by t.op_create_time desc
|
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
limit #{end} offset #{start}
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
</if>
|
|
@@ -98,7 +164,13 @@
|
|
|
<select id="countByCond" resultType="Long">
|
|
<select id="countByCond" resultType="Long">
|
|
|
SELECT
|
|
SELECT
|
|
|
count(1)
|
|
count(1)
|
|
|
- FROM t_mac_other_receivable
|
|
|
|
|
|
|
+ FROM dkic_b.t_mac_other_receivable as t
|
|
|
|
|
+ left join dkic_b.t_mst_customer tmc
|
|
|
|
|
+ on tmc.cus_id = t.object_id and t.object_type in ('对象类型-客户')
|
|
|
|
|
+ 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 sys.t_data_kind as tdk1 on tdk1.kind_code = t.object_type
|
|
|
<include refid="Condition"/>
|
|
<include refid="Condition"/>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
@@ -106,7 +178,7 @@
|
|
|
<select id="selectById" resultMap="BaseResultMap">
|
|
<select id="selectById" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
SELECT
|
|
|
<include refid="Base_Column_List"/>
|
|
<include refid="Base_Column_List"/>
|
|
|
- FROM t_mac_other_receivable
|
|
|
|
|
|
|
+ FROM dkic_b.t_mac_other_receivable
|
|
|
WHERE receivable_id = #{receivableId}::uuid
|
|
WHERE receivable_id = #{receivableId}::uuid
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
@@ -114,7 +186,7 @@
|
|
|
<select id="selectByIdForUpdate" resultMap="BaseResultMap">
|
|
<select id="selectByIdForUpdate" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
SELECT
|
|
|
<include refid="Base_Column_List"/>
|
|
<include refid="Base_Column_List"/>
|
|
|
- FROM t_mac_other_receivable
|
|
|
|
|
|
|
+ FROM dkic_b.t_mac_other_receivable
|
|
|
WHERE receivable_id = #{id}::uuid
|
|
WHERE receivable_id = #{id}::uuid
|
|
|
for update
|
|
for update
|
|
|
</select>
|
|
</select>
|
|
@@ -123,13 +195,13 @@
|
|
|
<select id="selectByIdsForUpdate" resultMap="BaseResultMap">
|
|
<select id="selectByIdsForUpdate" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
SELECT
|
|
|
<include refid="Base_Column_List"/>
|
|
<include refid="Base_Column_List"/>
|
|
|
- FROM t_mac_other_receivable
|
|
|
|
|
|
|
+ FROM dkic_b.t_mac_other_receivable
|
|
|
<include refid="idsForeach"/>
|
|
<include refid="idsForeach"/>
|
|
|
for update
|
|
for update
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insertBatch">
|
|
<insert id="insertBatch">
|
|
|
- insert into t_mac_other_receivable
|
|
|
|
|
|
|
+ insert into dkic_b.t_mac_other_receivable
|
|
|
(
|
|
(
|
|
|
<trim suffixOverrides=",">
|
|
<trim suffixOverrides=",">
|
|
|
receivable_no,
|
|
receivable_no,
|