| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- <?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.mdm.mapper.mac.AccountMapper">
- <!-- 通用设置 -->
- <!-- 通用查询列 -->
- <sql id="Base_Column_List">
- ac.object_id, ac.object_type, ac.receipt, ac.receipt_lock, ac.contract_assets, ac.receivable,
- ac.receivable_handle, ac.receivable_waive, ac.receivable_residue, ac.receipt_residue, ac.payment,
- ac.pur_estimate, ac.payable, ac.payable_handle, ac.payable_waive, ac.payable_residue,
- ac.payment_residue, ac.remarks, ac.flg_valid, ac.cp_id
- </sql>
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mac.Account">
- <id column="object_id" property="objectId"/>
- <result column="object_type" property="objectType"/>
- <result column="receipt" property="receipt"/>
- <result column="receipt_lock" property="receiptLock"/>
- <result column="contract_assets" property="contractAssets"/>
- <result column="receivable" property="receivable"/>
- <result column="receivable_handle" property="receivableHandle"/>
- <result column="receivable_waive" property="receivableWaive"/>
- <result column="receivable_residue" property="receivableResidue"/>
- <result column="receipt_residue" property="receiptResidue"/>
- <result column="payment" property="payment"/>
- <result column="pur_estimate" property="purEstimate"/>
- <result column="payable" property="payable"/>
- <result column="payable_handle" property="payableHandle"/>
- <result column="payable_waive" property="payableWaive"/>
- <result column="payable_residue" property="payableResidue"/>
- <result column="payment_residue" property="paymentResidue"/>
- <result column="remarks" property="remarks"/>
- <result column="flg_valid" property="flgValid"/>
- <result column="cp_id" property="cpId"/>
- </resultMap>
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mac.AccountResponse">
- <id column="object_id" property="objectId"/>
- <result column="object_type" property="objectType"/>
- <result column="receipt" property="receipt"/>
- <result column="receipt_lock" property="receiptLock"/>
- <result column="contract_assets" property="contractAssets"/>
- <result column="receivable" property="receivable"/>
- <result column="receivable_handle" property="receivableHandle"/>
- <result column="receivable_waive" property="receivableWaive"/>
- <result column="receivable_residue" property="receivableResidue"/>
- <result column="receipt_residue" property="receiptResidue"/>
- <result column="payment" property="payment"/>
- <result column="pur_estimate" property="purEstimate"/>
- <result column="payable" property="payable"/>
- <result column="payable_handle" property="payableHandle"/>
- <result column="payable_waive" property="payableWaive"/>
- <result column="payable_residue" property="payableResidue"/>
- <result column="payment_residue" property="paymentResidue"/>
- <result column="remarks" property="remarks"/>
- <result column="flg_valid" property="flgValid"/>
- <result column="cp_id" property="cpId"/>
- </resultMap>
- <!-- 通用条件列 -->
- <sql id="Condition">
- <where>
- <if test="objectType != null and objectType != ''">
- AND object_type = #{objectType}
- </if>
- <if test="receipt != null">
- AND receipt = #{receipt}
- </if>
- <if test="receiptLock != null">
- AND receipt_lock = #{receiptLock}
- </if>
- <if test="contractAssets != null">
- AND contract_assets = #{contractAssets}
- </if>
- <if test="receivable != null">
- AND receivable = #{receivable}
- </if>
- <if test="receivableHandle != null">
- AND receivable_handle = #{receivableHandle}
- </if>
- <if test="receivableWaive != null">
- AND receivable_waive = #{receivableWaive}
- </if>
- <if test="receivableResidue != null">
- AND receivable_residue = #{receivableResidue}
- </if>
- <if test="receiptResidue != null">
- AND receipt_residue = #{receiptResidue}
- </if>
- <if test="payment != null">
- AND payment = #{payment}
- </if>
- <if test="purEstimate != null">
- AND pur_estimate = #{purEstimate}
- </if>
- <if test="payable != null">
- AND payable = #{payable}
- </if>
- <if test="payableHandle != null">
- AND payable_handle = #{payableHandle}
- </if>
- <if test="payableWaive != null">
- AND payable_waive = #{payableWaive}
- </if>
- <if test="payableResidue != null">
- AND payable_residue = #{payableResidue}
- </if>
- <if test="paymentResidue != null">
- AND payment_residue = #{paymentResidue}
- </if>
- <if test="remarks != null and remarks != ''">
- AND remarks = #{remarks}
- </if>
- <if test="flgValid != null">
- AND flg_valid = #{flgValid}
- </if>
- <if test="cpId != null">
- AND cp_id = #{cpId}
- </if>
- </where>
- </sql>
- <sql id="idsForeach">
- <!-- 根据主键objectId批量操作 -->
- WHERE ac.object_id in
- <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </sql>
- <!-- 查询表t_mac_account,(条件查询+分页)列表 -->
- <select id="selectByCond" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM dkic_b.t_mac_account ac
- <include refid="Condition"/>
- <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
- limit #{end} offset #{start}
- </if>
- </select>
- <!-- 查询表t_mac_account,(条件查询)个数 -->
- <select id="countByCond" resultType="Long">
- SELECT
- count(1)
- FROM dkic_b.t_mac_account ac
- <include refid="Condition"/>
- </select>
- <!-- 根据主键查询表t_mac_account的一行数据 -->
- <select id="selectById" resultMap="BaseResultMapResponse">
- SELECT
- <include refid="Base_Column_List"/>
- ,sys.f_get_name_i18n(tdk.kind_name_i18n, #{i18n}) AS "objectTypeName"
- ,tmp.sup_name AS "supplierName"
- ,tmc.cus_name as "cusName"
- ,tmc.cus_phone as "cusPhone"
- FROM dkic_b.t_mac_account ac
- LEFT JOIN sys.t_data_kind tdk ON tdk.kind_code = ac.object_type
- Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = ac.object_id
- left join dkic_b.t_mst_customer tmc on ac.object_id = tmc.cus_id
- WHERE ac.object_id = #{objectId}::uuid
- </select>
- <!-- 根据主键锁定表t_mac_account的一行数据 -->
- <select id="selectByIdForUpdate" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM dkic_b.t_mac_account ac
- WHERE ac.object_id = #{id}::uuid
- for update
- </select>
- <!-- 根据主键锁定表t_mac_account的多行数据 -->
- <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM dkic_b.t_mac_account ac
- <include refid="idsForeach"/>
- for update
- </select>
- <insert id="insertBatch">
- insert into dkic_b.t_mac_account
- (
- <trim suffixOverrides=",">
- object_type,
- receipt,
- receipt_lock,
- contract_assets,
- receivable,
- receivable_handle,
- receivable_waive,
- receivable_residue,
- receipt_residue,
- payment,
- pur_estimate,
- payable,
- payable_handle,
- payable_waive,
- payable_residue,
- payment_residue,
- remarks,
- cp_id,
- </trim>
- )
- values
- <foreach collection="list" index="index" item="item" separator=",">
- (
- <trim suffixOverrides=",">
- #{item.objectType},
- #{item.receipt},
- #{item.receiptLock},
- #{item.contractAssets},
- #{item.receivable},
- #{item.receivableHandle},
- #{item.receivableWaive},
- #{item.receivableResidue},
- #{item.receiptResidue},
- #{item.payment},
- #{item.purEstimate},
- #{item.payable},
- #{item.payableHandle},
- #{item.payableWaive},
- #{item.payableResidue},
- #{item.paymentResidue},
- #{item.remarks},
- #{item.cpId},
- </trim>
- )
- </foreach>
- </insert>
- </mapper>
|