|
|
@@ -0,0 +1,549 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+<mapper namespace="com.dk.finance.mapper.fia.AssetClearMapper">
|
|
|
+
|
|
|
+ <!-- **************************************** 数据库基础列映射 **************************************** -->
|
|
|
+ <resultMap id="Pojo_ResultMap" type="com.dk.finance.model.pojo.fia.AssetClear">
|
|
|
+ <id column="doc_id" property="docId"/>
|
|
|
+ <result column="doc_no" property="docNo"/>
|
|
|
+ <result column="kind_code" property="kindCode"/>
|
|
|
+ <result column="status_invoice" property="statusInvoice"/>
|
|
|
+ <result column="status_flow" property="statusFlow"/>
|
|
|
+ <result column="org_id" property="orgId" typeHandler="com.dk.common.infrastructure.handler.UuidTypeHandler"/>
|
|
|
+ <result column="staff_id" property="staffId" typeHandler="com.dk.common.infrastructure.handler.UuidTypeHandler"/>
|
|
|
+ <result column="summary" property="summary"/>
|
|
|
+ <result column="status_receipt" property="statusReceipt"/>
|
|
|
+ <result column="mac_id" property="macId" typeHandler="com.dk.common.infrastructure.handler.UuidTypeHandler"/>
|
|
|
+ <result column="sum_amt_cash" property="sumAmtCash"/>
|
|
|
+ <result column="sum_amt_charge" property="sumAmtCharge"/>
|
|
|
+ <result column="sum_amt_total_cash" property="sumAmtTotalCash"/>
|
|
|
+ <result column="sum_amt_should" property="sumAmtShould"/>
|
|
|
+ <result column="obj_type" property="objType"/>
|
|
|
+ <result column="obj_id" property="objId" typeHandler="com.dk.common.infrastructure.handler.UuidTypeHandler"/>
|
|
|
+ <result column="due_date" property="dueDate" typeHandler="com.dk.common.infrastructure.handler.TimestampTypeHandler"/>
|
|
|
+ <result column="print_times" property="printTimes"/>
|
|
|
+ <result column="reversed_type" property="reversedType"/>
|
|
|
+ <result column="reversed_id" property="reversedId" typeHandler="com.dk.common.infrastructure.handler.UuidTypeHandler"/>
|
|
|
+ <result column="reversed_no" property="reversedNo"/>
|
|
|
+ <result column="apv_submit_id" property="apvSubmitId" typeHandler="com.dk.common.infrastructure.handler.UuidTypeHandler"/>
|
|
|
+ <result column="apv_staff_ids" property="apvStaffIds" typeHandler="com.dk.common.infrastructure.handler.UuidListTypeHandler"/>
|
|
|
+ <result column="apv_result_time" property="apvResultTime" typeHandler="com.dk.common.infrastructure.handler.TimestampTypeHandler"/>
|
|
|
+ <result column="annex_paths" property="annexPaths" typeHandler="com.dk.common.infrastructure.handler.JsonTypeHandler"/>
|
|
|
+ <result column="other_annex_paths" property="otherAnnexPaths" typeHandler="com.dk.common.infrastructure.handler.JsonTypeHandler"/>
|
|
|
+ <result column="remarks" property="remarks"/>
|
|
|
+ <result column="acc_date" property="accDate" typeHandler="com.dk.common.infrastructure.handler.TimestampTypeHandler"/>
|
|
|
+ <result column="make_staff" property="makeStaff" typeHandler="com.dk.common.infrastructure.handler.UuidTypeHandler"/>
|
|
|
+ <result column="make_time" property="makeTime" typeHandler="com.dk.common.infrastructure.handler.TimestampTypeHandler"/>
|
|
|
+ <result column="flg_valid" property="flgValid"/>
|
|
|
+ <result column="own_cp_id" property="ownCpId"/>
|
|
|
+ <result column="ctr_cp_id" property="ctrCpId"/>
|
|
|
+ <result column="op_create_time" property="opCreateTime" typeHandler="com.dk.common.infrastructure.handler.TimestampTypeHandler"/>
|
|
|
+ <result column="op_update_time" property="opUpdateTime" typeHandler="com.dk.common.infrastructure.handler.TimestampTypeHandler"/>
|
|
|
+ <result column="op_update_staff_id" property="opUpdateStaffId" typeHandler="com.dk.common.infrastructure.handler.UuidTypeHandler"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- **************************************** 查询映射结果 **************************************** -->
|
|
|
+ <resultMap id="Response_ResultMap" type="com.dk.finance.model.response.fia.AssetClearResponse">
|
|
|
+ <!-- **************************************** 当前表映射 **************************************** -->
|
|
|
+ <id column="doc_id" property="docId"/>
|
|
|
+ <result column="doc_no" property="docNo"/>
|
|
|
+ <result column="kind_code" property="kindCode"/>
|
|
|
+ <result column="status_invoice" property="statusInvoice"/>
|
|
|
+ <result column="status_flow" property="statusFlow"/>
|
|
|
+ <result column="org_id" property="orgId" typeHandler="com.dk.common.infrastructure.handler.UuidTypeHandler"/>
|
|
|
+ <result column="staff_id" property="staffId" typeHandler="com.dk.common.infrastructure.handler.UuidTypeHandler"/>
|
|
|
+ <result column="summary" property="summary"/>
|
|
|
+ <result column="status_receipt" property="statusReceipt"/>
|
|
|
+ <result column="mac_id" property="macId" typeHandler="com.dk.common.infrastructure.handler.UuidTypeHandler"/>
|
|
|
+ <result column="sum_amt_cash" property="sumAmtCash"/>
|
|
|
+ <result column="sum_amt_charge" property="sumAmtCharge"/>
|
|
|
+ <result column="sum_amt_total_cash" property="sumAmtTotalCash"/>
|
|
|
+ <result column="sum_amt_should" property="sumAmtShould"/>
|
|
|
+ <result column="obj_type" property="objType"/>
|
|
|
+ <result column="obj_id" property="objId" typeHandler="com.dk.common.infrastructure.handler.UuidTypeHandler"/>
|
|
|
+ <result column="due_date" property="dueDate" typeHandler="com.dk.common.infrastructure.handler.TimestampTypeHandler"/>
|
|
|
+ <result column="print_times" property="printTimes"/>
|
|
|
+ <result column="reversed_type" property="reversedType"/>
|
|
|
+ <result column="reversed_id" property="reversedId" typeHandler="com.dk.common.infrastructure.handler.UuidTypeHandler"/>
|
|
|
+ <result column="reversed_no" property="reversedNo"/>
|
|
|
+ <result column="apv_submit_id" property="apvSubmitId" typeHandler="com.dk.common.infrastructure.handler.UuidTypeHandler"/>
|
|
|
+ <result column="apv_staff_ids" property="apvStaffIds" typeHandler="com.dk.common.infrastructure.handler.UuidListTypeHandler"/>
|
|
|
+ <result column="apv_result_time" property="apvResultTime" typeHandler="com.dk.common.infrastructure.handler.TimestampTypeHandler"/>
|
|
|
+ <result column="annex_paths" property="annexPaths" typeHandler="com.dk.common.infrastructure.handler.JsonTypeHandler"/>
|
|
|
+ <result column="other_annex_paths" property="otherAnnexPaths" typeHandler="com.dk.common.infrastructure.handler.JsonTypeHandler"/>
|
|
|
+ <result column="remarks" property="remarks"/>
|
|
|
+ <result column="acc_date" property="accDate" typeHandler="com.dk.common.infrastructure.handler.TimestampTypeHandler"/>
|
|
|
+ <result column="make_staff" property="makeStaff" typeHandler="com.dk.common.infrastructure.handler.UuidTypeHandler"/>
|
|
|
+ <result column="make_time" property="makeTime" typeHandler="com.dk.common.infrastructure.handler.TimestampTypeHandler"/>
|
|
|
+ <result column="flg_valid" property="flgValid"/>
|
|
|
+ <result column="own_cp_id" property="ownCpId"/>
|
|
|
+ <result column="ctr_cp_id" property="ctrCpId"/>
|
|
|
+ <result column="op_create_time" property="opCreateTime" typeHandler="com.dk.common.infrastructure.handler.TimestampTypeHandler"/>
|
|
|
+ <result column="op_update_time" property="opUpdateTime" typeHandler="com.dk.common.infrastructure.handler.TimestampTypeHandler"/>
|
|
|
+ <result column="op_update_staff_id" property="opUpdateStaffId" typeHandler="com.dk.common.infrastructure.handler.UuidTypeHandler"/>
|
|
|
+ <!-- **************************************** 关联表映射 **************************************** -->
|
|
|
+ <result column="op_update_staff_name" property="opUpdateStaffName"/>
|
|
|
+ <result column="status_invoice_name" property="statusInvoiceName"/>
|
|
|
+ <result column="status_receipt_name" property="statusReceiptName"/>
|
|
|
+ <result column="status_flow_name" property="statusFlowName"/>
|
|
|
+ <result column="orgName" property="orgName"/>
|
|
|
+ <result column="makeStaffName" property="makeStaffName"/>
|
|
|
+ <result column="staffName" property="staffName"/>
|
|
|
+ <result column="macName" property="macName"/>
|
|
|
+ <result column="unRecAmt" property="unRecAmt"/>
|
|
|
+ <result column="objName" property="objName"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- **************************************** 当前表列 **************************************** -->
|
|
|
+ <sql id="Base_Columns">
|
|
|
+ t.doc_id,
|
|
|
+ t.doc_no,
|
|
|
+ t.kind_code,
|
|
|
+ t.status_invoice,
|
|
|
+ t.status_flow,
|
|
|
+ t.org_id,
|
|
|
+ t.staff_id,
|
|
|
+ t.summary,
|
|
|
+ t.status_receipt,
|
|
|
+ t.mac_id,
|
|
|
+ t.sum_amt_cash,
|
|
|
+ t.sum_amt_charge,
|
|
|
+ t.sum_amt_total_cash,
|
|
|
+ t.sum_amt_should,
|
|
|
+ t.obj_type,
|
|
|
+ t.obj_id,
|
|
|
+ t.due_date,
|
|
|
+ t.print_times,
|
|
|
+ t.reversed_type,
|
|
|
+ t.reversed_id,
|
|
|
+ t.reversed_no,
|
|
|
+ t.apv_submit_id,
|
|
|
+ t.apv_staff_ids,
|
|
|
+ t.apv_result_time,
|
|
|
+ t.annex_paths,
|
|
|
+ t.other_annex_paths,
|
|
|
+ t.remarks,
|
|
|
+ t.acc_date,
|
|
|
+ t.make_staff,
|
|
|
+ t.make_time,
|
|
|
+ t.flg_valid,
|
|
|
+ t.own_cp_id,
|
|
|
+ t.ctr_cp_id,
|
|
|
+ t.op_create_time,
|
|
|
+ t.op_update_time,
|
|
|
+ t.op_update_staff_id,
|
|
|
+
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- **************************************** 当前表查询条件 **************************************** -->
|
|
|
+ <sql id="Base_Conditions">
|
|
|
+ <if test="docNo != null and docNo != ''">
|
|
|
+ AND t.doc_no LIKE concat('%',pgex.likequery(#{docNo}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="kindCode != null and kindCode != ''">
|
|
|
+ AND t.kind_code LIKE concat('%',pgex.likequery(#{kindCode}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="statusInvoice != null and statusInvoice != ''">
|
|
|
+ AND t.status_invoice LIKE concat('%',pgex.likequery(#{statusInvoice}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="statusFlow != null and statusFlow != ''">
|
|
|
+ AND t.status_flow LIKE concat('%',pgex.likequery(#{statusFlow}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="orgId != null">
|
|
|
+ AND t.org_id = #{orgId}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="staffId != null">
|
|
|
+ AND t.staff_id = #{staffId}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="summary != null and summary != ''">
|
|
|
+ AND t.summary LIKE concat('%',pgex.likequery(#{summary}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="statusReceipt != null and statusReceipt != ''">
|
|
|
+ AND t.status_receipt LIKE concat('%',pgex.likequery(#{statusReceipt}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="macId != null">
|
|
|
+ AND t.mac_id = #{macId}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="sumAmtCash != null">
|
|
|
+ AND t.sum_amt_cash = #{sumAmtCash}
|
|
|
+ </if>
|
|
|
+ <if test="sumAmtCharge != null">
|
|
|
+ AND t.sum_amt_charge = #{sumAmtCharge}
|
|
|
+ </if>
|
|
|
+ <if test="sumAmtTotalCash != null">
|
|
|
+ AND t.sum_amt_total_cash = #{sumAmtTotalCash}
|
|
|
+ </if>
|
|
|
+ <if test="sumAmtShould != null">
|
|
|
+ AND t.sum_amt_should = #{sumAmtShould}
|
|
|
+ </if>
|
|
|
+ <if test="objType != null">
|
|
|
+ AND t.obj_type = #{objType}
|
|
|
+ </if>
|
|
|
+ <if test="objId != null">
|
|
|
+ AND t.obj_id = #{objId}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="printTimes != null">
|
|
|
+ AND t.print_times = #{printTimes}
|
|
|
+ </if>
|
|
|
+ <if test="reversedType != null">
|
|
|
+ AND t.reversed_type = #{reversedType}
|
|
|
+ </if>
|
|
|
+ <if test="reversedId != null">
|
|
|
+ AND t.reversed_id = #{reversedId}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="reversedNo != null and reversedNo != ''">
|
|
|
+ AND t.reversed_no LIKE concat('%',pgex.likequery(#{reversedNo}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="apvSubmitId != null">
|
|
|
+ AND t.apv_submit_id = #{apvSubmitId}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="apvStaffIds != null">
|
|
|
+ AND t.apv_staff_ids = #{apvStaffIds}
|
|
|
+ </if>
|
|
|
+ <if test="annexPaths != null">
|
|
|
+ AND t.annex_paths = #{annexPaths}
|
|
|
+ </if>
|
|
|
+ <if test="otherAnnexPaths != null">
|
|
|
+ AND t.other_annex_paths = #{otherAnnexPaths}
|
|
|
+ </if>
|
|
|
+ <if test="remarks != null and remarks != ''">
|
|
|
+ AND t.remarks LIKE concat('%',pgex.likequery(#{remarks}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="makeStaff != null">
|
|
|
+ AND t.make_staff = #{makeStaff}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="flgValid != null">
|
|
|
+ AND t.flg_valid = #{flgValid}
|
|
|
+ </if>
|
|
|
+ <if test="ownCpId != null">
|
|
|
+ AND t.own_cp_id = #{ownCpId}
|
|
|
+ </if>
|
|
|
+ <if test="ctrCpId != null">
|
|
|
+ AND t.ctr_cp_id = #{ctrCpId}
|
|
|
+ </if>
|
|
|
+ <if test="opUpdateStaffId != null">
|
|
|
+ AND t.op_update_staff_id = #{opUpdateStaffId}::uuid
|
|
|
+ </if>
|
|
|
+ <!-- **************************************** 自动生成其他查询条件 **************************************** -->
|
|
|
+
|
|
|
+ <if test="dueDateStart != null">
|
|
|
+ AND t.due_date >= #{dueDateStart}
|
|
|
+ </if>
|
|
|
+ <if test="dueDateEnd != null">
|
|
|
+ AND t.due_date <= #{dueDateEnd}
|
|
|
+ </if>
|
|
|
+ <if test="apvResultTimeStart != null">
|
|
|
+ AND t.apv_result_time >= #{apvResultTimeStart}::timestamp with time zone
|
|
|
+ </if>
|
|
|
+ <if test="apvResultTimeEnd != null">
|
|
|
+ AND t.apv_result_time < #{apvResultTimeEnd}::timestamp with time zone + interval '1 day'
|
|
|
+ </if>
|
|
|
+ <if test="accDateStart != null">
|
|
|
+ AND t.acc_date >= #{accDateStart}
|
|
|
+ </if>
|
|
|
+ <if test="accDateEnd != null">
|
|
|
+ AND t.acc_date <= #{accDateEnd}
|
|
|
+ </if>
|
|
|
+ <if test="makeTimeStart != null">
|
|
|
+ AND t.make_time >= #{makeTimeStart}::timestamp with time zone
|
|
|
+ </if>
|
|
|
+ <if test="makeTimeEnd != null">
|
|
|
+ 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 test="ownCpIdList != null and ownCpIdList.size()>0">
|
|
|
+ AND t.own_cp_id = any(#{ownCpIdList, typeHandler= BigIntListTypeHandler})
|
|
|
+ </if>
|
|
|
+ <if test="opCreateTimeStart != null">
|
|
|
+ AND t.op_create_time >= #{opCreateTimeStart}::timestamp with time zone
|
|
|
+ </if>
|
|
|
+ <if test="opCreateTimeEnd != null">
|
|
|
+ AND t.op_create_time < #{opCreateTimeEnd}::timestamp with time zone + interval '1 day'
|
|
|
+ </if>
|
|
|
+ <if test="opUpdateTimeStart != null">
|
|
|
+ AND t.op_update_time >= #{opUpdateTimeStart}::timestamp with time zone
|
|
|
+ </if>
|
|
|
+ <if test="opUpdateTimeEnd != null">
|
|
|
+ AND t.op_update_time < #{opUpdateTimeEnd}::timestamp with time zone + interval '1 day'
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- **************************************** 关联表列 **************************************** -->
|
|
|
+ <sql id="Join_Columns">
|
|
|
+ t.sum_amt_should - t.sum_amt_total_cash as "unRecAmt",
|
|
|
+ update_staff.staff_name AS op_update_staff_name,
|
|
|
+ org.org_name AS "orgName",
|
|
|
+ tms.staff_name AS "makeStaffName",
|
|
|
+ tms1.staff_name AS "staffName",
|
|
|
+ tmma.mac_name as "macName",
|
|
|
+ obj.obj_name as "objName",
|
|
|
+ myex.f_get_name_i18n(tdk.kind_name_i18n,#{i18n}) AS status_invoice_name,
|
|
|
+ myex.f_get_name_i18n(tdkf.kind_name_i18n,#{i18n}) AS status_flow_name,
|
|
|
+ myex.f_get_name_i18n(tdkr.kind_name_i18n,#{i18n}) AS status_receipt_name,
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- **************************************** 关联表 **************************************** -->
|
|
|
+ <sql id="Join_Tables">
|
|
|
+ LEFT JOIN dkscu_b.t_mst_staff AS update_staff ON t.op_update_staff_id = update_staff.staff_id
|
|
|
+ LEFT JOIN dkscu_bs.t_data_kind tdk ON t.status_invoice = tdk.kind_code
|
|
|
+ LEFT JOIN dkscu_bs.t_data_kind tdkf ON t.status_flow = tdkf.kind_code
|
|
|
+ LEFT JOIN dkscu_bs.t_data_kind tdkr ON t.status_receipt = tdkr.kind_code
|
|
|
+ LEFT JOIN dkscu_b.t_mst_organization org ON t.org_id = org.org_id
|
|
|
+ LEFT JOIN dkscu_b.t_mst_staff tms ON tms.staff_id = t.make_staff
|
|
|
+ LEFT JOIN dkscu_b.t_mst_staff tms1 ON tms1.staff_id = t.staff_id
|
|
|
+ LEFT JOIN dkscu_b.t_mst_money_account tmma ON t.mac_id = tmma.mac_id
|
|
|
+ LEFT JOIN dkscu_b.t_mst_obj AS obj ON t.obj_id = obj.obj_id
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- **************************************** 关联表查询条件 **************************************** -->
|
|
|
+ <sql id="Join_Conditions">
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 查询表t_fia_asset_clear,(条件查询+分页)列表 -->
|
|
|
+ <select id="selectByCond" resultMap="Response_ResultMap">
|
|
|
+ SELECT
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ <include refid="Base_Columns"/>
|
|
|
+ <include refid="Join_Columns"/>
|
|
|
+ </trim>
|
|
|
+ FROM dkscu_b.t_fia_asset_clear t
|
|
|
+ <include refid="Join_Tables"/>
|
|
|
+ <where>
|
|
|
+ <include refid="Base_Conditions"/>
|
|
|
+ <include refid="Join_Conditions"/>
|
|
|
+ </where>
|
|
|
+ <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
+ limit #{end} offset #{start}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询表t_fia_asset_clear,(条件查询)个数 -->
|
|
|
+ <select id="countByCond" resultType="Long">
|
|
|
+ SELECT
|
|
|
+ count(1)
|
|
|
+ FROM dkscu_b.t_fia_asset_clear t
|
|
|
+ <include refid="Join_Tables"/>
|
|
|
+ <where>
|
|
|
+ <include refid="Base_Conditions"/>
|
|
|
+ <include refid="Join_Conditions"/>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据主键查询表t_fia_asset_clear的一行数据 -->
|
|
|
+ <select id="selectById" resultMap="Response_ResultMap">
|
|
|
+ SELECT
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ <include refid="Base_Columns"/>
|
|
|
+ <include refid="Join_Columns"/>
|
|
|
+ </trim>
|
|
|
+ FROM dkscu_b.t_fia_asset_clear t
|
|
|
+ <include refid="Join_Tables"/>
|
|
|
+ WHERE t.doc_id = #{id}::uuid
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据主键docId批量操作 -->
|
|
|
+ <sql id="idList">
|
|
|
+ WHERE t.doc_id in
|
|
|
+ <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
|
|
|
+ #{item}::uuid
|
|
|
+ </foreach>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 根据主键锁定表t_fia_asset_clear的一行数据 -->
|
|
|
+ <select id="selectByIdForUpdate" resultMap="Pojo_ResultMap">
|
|
|
+ SELECT
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ <include refid="Base_Columns"/>
|
|
|
+ </trim>
|
|
|
+ FROM dkscu_b.t_fia_asset_clear t
|
|
|
+ WHERE t.doc_id = #{id}::uuid
|
|
|
+ for update
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据主键锁定表t_fia_asset_clear的多行数据 -->
|
|
|
+ <select id="selectByIdsForUpdate" resultMap="Pojo_ResultMap">
|
|
|
+ SELECT
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ <include refid="Base_Columns"/>
|
|
|
+ </trim>
|
|
|
+ FROM dkscu_b.t_fia_asset_clear t
|
|
|
+ <include refid="idList"/>
|
|
|
+ for update
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 批量新建 -->
|
|
|
+ <insert id="insertBatch" useGeneratedKeys="true" keyProperty="docId">
|
|
|
+ <include refid="insertBatchSql"/>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <sql id="insertBatchSql">
|
|
|
+ insert into dkscu_b.t_fia_asset_clear
|
|
|
+ (
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ doc_id,
|
|
|
+ doc_no,
|
|
|
+ kind_code,
|
|
|
+ status_invoice,
|
|
|
+ status_flow,
|
|
|
+ org_id,
|
|
|
+ staff_id,
|
|
|
+ summary,
|
|
|
+ status_receipt,
|
|
|
+ mac_id,
|
|
|
+ sum_amt_cash,
|
|
|
+ sum_amt_charge,
|
|
|
+ sum_amt_total_cash,
|
|
|
+ sum_amt_should,
|
|
|
+ obj_type,
|
|
|
+ obj_id,
|
|
|
+ due_date,
|
|
|
+ print_times,
|
|
|
+ reversed_type,
|
|
|
+ reversed_id,
|
|
|
+ reversed_no,
|
|
|
+ apv_submit_id,
|
|
|
+ apv_staff_ids,
|
|
|
+ apv_result_time,
|
|
|
+ annex_paths,
|
|
|
+ other_annex_paths,
|
|
|
+ remarks,
|
|
|
+ acc_date,
|
|
|
+ make_staff,
|
|
|
+ make_time,
|
|
|
+ own_cp_id,
|
|
|
+ ctr_cp_id,
|
|
|
+ </trim>
|
|
|
+ )
|
|
|
+ values
|
|
|
+ <foreach collection="list" index="index" item="item" separator=",">
|
|
|
+ (
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ #{item.docId}::uuid,
|
|
|
+ #{item.docNo},
|
|
|
+ #{item.kindCode},
|
|
|
+ #{item.statusInvoice},
|
|
|
+ #{item.statusFlow},
|
|
|
+ #{item.orgId}::uuid,
|
|
|
+ #{item.staffId}::uuid,
|
|
|
+ #{item.summary},
|
|
|
+ #{item.statusReceipt},
|
|
|
+ #{item.macId}::uuid,
|
|
|
+ <choose>
|
|
|
+ <when test="item.sumAmtCash != null">
|
|
|
+ #{item.sumAmtCash},
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ DEFAULT,
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <choose>
|
|
|
+ <when test="item.sumAmtCharge != null">
|
|
|
+ #{item.sumAmtCharge},
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ DEFAULT,
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <choose>
|
|
|
+ <when test="item.sumAmtTotalCash != null">
|
|
|
+ #{item.sumAmtTotalCash},
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ DEFAULT,
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <choose>
|
|
|
+ <when test="item.sumAmtShould != null">
|
|
|
+ #{item.sumAmtShould},
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ DEFAULT,
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <choose>
|
|
|
+ <when test="item.objType != null">
|
|
|
+ #{item.objType},
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ DEFAULT,
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ #{item.objId}::uuid,
|
|
|
+ #{item.dueDate},
|
|
|
+ <choose>
|
|
|
+ <when test="item.printTimes != null">
|
|
|
+ #{item.printTimes},
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ DEFAULT,
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ #{item.reversedType},
|
|
|
+ #{item.reversedId}::uuid,
|
|
|
+ #{item.reversedNo},
|
|
|
+ #{item.apvSubmitId}::uuid,
|
|
|
+ #{item.apvStaffIds,typeHandler=UuidListTypeHandler},
|
|
|
+ #{item.apvResultTime},
|
|
|
+ #{item.annexPaths,typeHandler=JsonTypeHandler},
|
|
|
+ #{item.otherAnnexPaths,typeHandler=JsonTypeHandler},
|
|
|
+ #{item.remarks},
|
|
|
+ #{item.accDate},
|
|
|
+ #{item.makeStaff}::uuid,
|
|
|
+ <choose>
|
|
|
+ <when test="item.makeTime != null">
|
|
|
+ #{item.makeTime},
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ DEFAULT,
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ #{item.ownCpId},
|
|
|
+ #{item.ctrCpId},
|
|
|
+ </trim>
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 批量保存 - 有id则编辑无id则新建 -->
|
|
|
+ <insert id="saveBatch" useGeneratedKeys="true" keyProperty="docId">
|
|
|
+ <include refid="insertBatchSql"/>
|
|
|
+ on conflict (doc_id) do update set
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ doc_no = excluded."doc_no",
|
|
|
+ kind_code = excluded."kind_code",
|
|
|
+ status_invoice = excluded."status_invoice",
|
|
|
+ status_flow = excluded."status_flow",
|
|
|
+ org_id = excluded."org_id",
|
|
|
+ staff_id = excluded."staff_id",
|
|
|
+ summary = excluded."summary",
|
|
|
+ status_receipt = excluded."status_receipt",
|
|
|
+ mac_id = excluded."mac_id",
|
|
|
+ sum_amt_cash = excluded."sum_amt_cash",
|
|
|
+ sum_amt_charge = excluded."sum_amt_charge",
|
|
|
+ sum_amt_total_cash = excluded."sum_amt_total_cash",
|
|
|
+ sum_amt_should = excluded."sum_amt_should",
|
|
|
+ obj_type = excluded."obj_type",
|
|
|
+ obj_id = excluded."obj_id",
|
|
|
+ due_date = excluded."due_date",
|
|
|
+ print_times = excluded."print_times",
|
|
|
+ reversed_type = excluded."reversed_type",
|
|
|
+ reversed_id = excluded."reversed_id",
|
|
|
+ reversed_no = excluded."reversed_no",
|
|
|
+ apv_submit_id = excluded."apv_submit_id",
|
|
|
+ apv_staff_ids = excluded."apv_staff_ids",
|
|
|
+ apv_result_time = excluded."apv_result_time",
|
|
|
+ annex_paths = excluded."annex_paths",
|
|
|
+ other_annex_paths = excluded."other_annex_paths",
|
|
|
+ remarks = excluded."remarks",
|
|
|
+ acc_date = excluded."acc_date",
|
|
|
+ make_staff = excluded."make_staff",
|
|
|
+ make_time = excluded."make_time",
|
|
|
+ own_cp_id = excluded."own_cp_id",
|
|
|
+ ctr_cp_id = excluded."ctr_cp_id",
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+</mapper>
|