|
|
@@ -0,0 +1,395 @@
|
|
|
+<?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.mst.ReceiptMapper">
|
|
|
+
|
|
|
+ <!-- 通用设置 -->
|
|
|
+ <!-- 通用查询列 -->
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ receipt_id, receipt_set_id, receipt_status, receipt_type, apply_staff, apply_date, cp_id, cp_name, tax_no, cp_email, cp_address, cp_phone, open_bank, bank_account, receipt_amt, receipt_content, receipt_date, receipt_staff, receipt_obj, tax_rate, flg_valid, op_create_time, op_create_user_id, op_update_time, op_update_user_id, op_app_code, op_timestamp, op_db_user
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 通用查询映射结果 -->
|
|
|
+ <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.Receipt">
|
|
|
+ <id column="receipt_id" property="receiptId"/>
|
|
|
+ <result column="receipt_set_id" property="receiptSetId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="receipt_status" property="receiptStatus"/>
|
|
|
+ <result column="receipt_type" property="receiptType"/>
|
|
|
+ <result column="apply_staff" property="applyStaff"/>
|
|
|
+ <result column="apply_date" property="applyDate" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="cp_id" property="cpId"/>
|
|
|
+ <result column="cp_name" property="cpName"/>
|
|
|
+ <result column="tax_no" property="taxNo"/>
|
|
|
+ <result column="cp_email" property="cpEmail"/>
|
|
|
+ <result column="cp_address" property="cpAddress"/>
|
|
|
+ <result column="cp_phone" property="cpPhone"/>
|
|
|
+ <result column="open_bank" property="openBank"/>
|
|
|
+ <result column="bank_account" property="bankAccount"/>
|
|
|
+ <result column="receipt_amt" property="receiptAmt"/>
|
|
|
+ <result column="receipt_content" property="receiptContent"/>
|
|
|
+ <result column="receipt_date" property="receiptDate" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="receipt_staff" property="receiptStaff"/>
|
|
|
+ <result column="receipt_obj" property="receiptObj"/>
|
|
|
+ <result column="tax_rate" property="taxRate"/>
|
|
|
+ <result column="flg_valid" property="flgValid"/>
|
|
|
+ <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="op_create_user_id" property="opCreateUserId"/>
|
|
|
+ <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="op_update_user_id" property="opUpdateUserId"/>
|
|
|
+ <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="receiptSetId != null and receiptSetId != ''">
|
|
|
+ AND receipt_set_id = #{receiptSetId}
|
|
|
+ </if>
|
|
|
+ <if test="receiptStatus != null and receiptStatus != ''">
|
|
|
+ AND receipt_status = #{receiptStatus}
|
|
|
+ </if>
|
|
|
+ <if test="receiptType != null and receiptType != ''">
|
|
|
+ AND receipt_type = #{receiptType}
|
|
|
+ </if>
|
|
|
+ <if test="applyStaff != null and applyStaff != ''">
|
|
|
+ AND apply_staff = #{applyStaff}
|
|
|
+ </if>
|
|
|
+ <if test="applyDate != null">
|
|
|
+ AND apply_date = #{applyDate}
|
|
|
+ </if>
|
|
|
+ <if test="cpId != null">
|
|
|
+ AND cp_id = #{cpId}
|
|
|
+ </if>
|
|
|
+ <if test="cpName != null and cpName != ''">
|
|
|
+ AND cp_name = #{cpName}
|
|
|
+ </if>
|
|
|
+ <if test="taxNo != null and taxNo != ''">
|
|
|
+ AND tax_no = #{taxNo}
|
|
|
+ </if>
|
|
|
+ <if test="cpEmail != null and cpEmail != ''">
|
|
|
+ AND cp_email = #{cpEmail}
|
|
|
+ </if>
|
|
|
+ <if test="cpAddress != null and cpAddress != ''">
|
|
|
+ AND cp_address = #{cpAddress}
|
|
|
+ </if>
|
|
|
+ <if test="cpPhone != null and cpPhone != ''">
|
|
|
+ AND cp_phone = #{cpPhone}
|
|
|
+ </if>
|
|
|
+ <if test="openBank != null and openBank != ''">
|
|
|
+ AND open_bank = #{openBank}
|
|
|
+ </if>
|
|
|
+ <if test="bankAccount != null and bankAccount != ''">
|
|
|
+ AND bank_account = #{bankAccount}
|
|
|
+ </if>
|
|
|
+ <if test="receiptAmt != null">
|
|
|
+ AND receipt_amt = #{receiptAmt}
|
|
|
+ </if>
|
|
|
+ <if test="receiptContent != null and receiptContent != ''">
|
|
|
+ AND receipt_content = #{receiptContent}
|
|
|
+ </if>
|
|
|
+ <if test="receiptDate != null">
|
|
|
+ AND receipt_date = #{receiptDate}
|
|
|
+ </if>
|
|
|
+ <if test="receiptStaff != null and receiptStaff != ''">
|
|
|
+ AND receipt_staff = #{receiptStaff}
|
|
|
+ </if>
|
|
|
+ <if test="receiptObj != null and receiptObj != ''">
|
|
|
+ AND receipt_obj = #{receiptObj}
|
|
|
+ </if>
|
|
|
+ <if test="taxRate != null">
|
|
|
+ AND tax_rate = #{taxRate}
|
|
|
+ </if>
|
|
|
+ <if test="flgValid != null">
|
|
|
+ AND flg_valid = #{flgValid}
|
|
|
+ </if>
|
|
|
+ <if test="opCreateTime != null">
|
|
|
+ AND op_create_time = #{opCreateTime}
|
|
|
+ </if>
|
|
|
+ <if test="opCreateUserId != null">
|
|
|
+ AND op_create_user_id = #{opCreateUserId}
|
|
|
+ </if>
|
|
|
+ <if test="opUpdateTime != null">
|
|
|
+ AND op_update_time = #{opUpdateTime}
|
|
|
+ </if>
|
|
|
+ <if test="opUpdateUserId != null">
|
|
|
+ AND op_update_user_id = #{opUpdateUserId}
|
|
|
+ </if>
|
|
|
+ <if test="opAppCode != null and opAppCode != ''">
|
|
|
+ AND op_app_code = #{opAppCode}
|
|
|
+ </if>
|
|
|
+ <if test="opTimestamp != null">
|
|
|
+ AND op_timestamp = #{opTimestamp}
|
|
|
+ </if>
|
|
|
+ <if test="opDbUser != null and opDbUser != ''">
|
|
|
+ AND op_db_user = #{opDbUser}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 通用查询列 -->
|
|
|
+ <sql id="Base_Column_List_list">
|
|
|
+ tmr.receipt_id,
|
|
|
+ tmr.receipt_set_id,
|
|
|
+ tmr.receipt_status,
|
|
|
+ tmr.receipt_type,
|
|
|
+ tmr.apply_staff,
|
|
|
+ tmr.apply_date,
|
|
|
+ tmr.cp_id,
|
|
|
+ tmr.cp_name,
|
|
|
+ tmr.tax_no,
|
|
|
+ tmr.cp_email,
|
|
|
+ tmr.cp_address,
|
|
|
+ tmr.cp_phone,
|
|
|
+ tmr.open_bank,
|
|
|
+ tmr.bank_account,
|
|
|
+ tmr.receipt_amt,
|
|
|
+ tmr.receipt_content,
|
|
|
+ tmr.receipt_date,
|
|
|
+ tmr.receipt_staff,
|
|
|
+ tmr.receipt_obj,
|
|
|
+ tmr.tax_rate,
|
|
|
+ tmr.flg_valid,
|
|
|
+ tmr.op_create_time,
|
|
|
+ tmr.op_create_user_id,
|
|
|
+ tmr.op_update_time,
|
|
|
+ tmr.op_update_user_id,
|
|
|
+ tmr.op_app_code,
|
|
|
+ tmr.op_timestamp,
|
|
|
+ tmr.op_db_user
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 通用查询映射结果 -->
|
|
|
+ <resultMap id="BaseResultMap_list" type="com.dk.mdm.model.response.mst.ReceiptResponse">
|
|
|
+ <id column="receipt_id" property="receiptId"/>
|
|
|
+ <result column="receipt_set_id" property="receiptSetId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="receipt_status" property="receiptStatus"/>
|
|
|
+ <result column="receipt_type" property="receiptType"/>
|
|
|
+ <result column="apply_staff" property="applyStaff"/>
|
|
|
+ <result column="apply_date" property="applyDate" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="cp_id" property="cpId"/>
|
|
|
+ <result column="cp_name" property="cpName"/>
|
|
|
+ <result column="tax_no" property="taxNo"/>
|
|
|
+ <result column="cp_email" property="cpEmail"/>
|
|
|
+ <result column="cp_address" property="cpAddress"/>
|
|
|
+ <result column="cp_phone" property="cpPhone"/>
|
|
|
+ <result column="open_bank" property="openBank"/>
|
|
|
+ <result column="bank_account" property="bankAccount"/>
|
|
|
+ <result column="receipt_amt" property="receiptAmt"/>
|
|
|
+ <result column="receipt_content" property="receiptContent"/>
|
|
|
+ <result column="receipt_date" property="receiptDate" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="receipt_staff" property="receiptStaff"/>
|
|
|
+ <result column="receipt_obj" property="receiptObj"/>
|
|
|
+ <result column="tax_rate" property="taxRate"/>
|
|
|
+ <result column="flg_valid" property="flgValid"/>
|
|
|
+ <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="op_create_user_id" property="opCreateUserId"/>
|
|
|
+ <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="op_update_user_id" property="opUpdateUserId"/>
|
|
|
+ <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_list">
|
|
|
+ <where>
|
|
|
+ <if test="receiptSetId != null and receiptSetId != ''">
|
|
|
+ AND tmr.receipt_set_id = #{receiptSetId}
|
|
|
+ </if>
|
|
|
+ <if test="receiptStatus != null and receiptStatus != ''">
|
|
|
+ AND tmr.receipt_status = #{receiptStatus}
|
|
|
+ </if>
|
|
|
+ <if test="receiptType != null and receiptType != ''">
|
|
|
+ AND tmr.receipt_type = #{receiptType}
|
|
|
+ </if>
|
|
|
+ <if test="applyStaff != null and applyStaff != ''">
|
|
|
+ AND tmr.apply_staff = #{applyStaff}
|
|
|
+ </if>
|
|
|
+ <if test="applyDate != null">
|
|
|
+ AND tmr.apply_date = #{applyDate}
|
|
|
+ </if>
|
|
|
+ <if test="cpId != null">
|
|
|
+ AND tmr.cp_id = #{cpId}
|
|
|
+ </if>
|
|
|
+ <if test="cpName != null and cpName != ''">
|
|
|
+ AND tmr.cp_name = #{cpName}
|
|
|
+ </if>
|
|
|
+ <if test="taxNo != null and taxNo != ''">
|
|
|
+ AND tmr.tax_no = #{taxNo}
|
|
|
+ </if>
|
|
|
+ <if test="cpEmail != null and cpEmail != ''">
|
|
|
+ AND tmr.cp_email = #{cpEmail}
|
|
|
+ </if>
|
|
|
+ <if test="cpAddress != null and cpAddress != ''">
|
|
|
+ AND tmr.cp_address = #{cpAddress}
|
|
|
+ </if>
|
|
|
+ <if test="cpPhone != null and cpPhone != ''">
|
|
|
+ AND tmr.cp_phone = #{cpPhone}
|
|
|
+ </if>
|
|
|
+ <if test="openBank != null and openBank != ''">
|
|
|
+ AND tmr.open_bank = #{openBank}
|
|
|
+ </if>
|
|
|
+ <if test="bankAccount != null and bankAccount != ''">
|
|
|
+ AND tmr.bank_account = #{bankAccount}
|
|
|
+ </if>
|
|
|
+ <if test="receiptAmt != null">
|
|
|
+ AND tmr.receipt_amt = #{receiptAmt}
|
|
|
+ </if>
|
|
|
+ <if test="receiptContent != null and receiptContent != ''">
|
|
|
+ AND tmr.receipt_content = #{receiptContent}
|
|
|
+ </if>
|
|
|
+ <if test="receiptDate != null">
|
|
|
+ AND tmr.receipt_date = #{receiptDate}
|
|
|
+ </if>
|
|
|
+ <if test="receiptStaff != null and receiptStaff != ''">
|
|
|
+ AND tmr.receipt_staff = #{receiptStaff}
|
|
|
+ </if>
|
|
|
+ <if test="receiptObj != null and receiptObj != ''">
|
|
|
+ AND tmr.receipt_obj = #{receiptObj}
|
|
|
+ </if>
|
|
|
+ <if test="taxRate != null">
|
|
|
+ AND tmr.tax_rate = #{taxRate}
|
|
|
+ </if>
|
|
|
+ <if test="flgValid != null">
|
|
|
+ AND tmr.flg_valid = #{flgValid}
|
|
|
+ </if>
|
|
|
+ <if test="opCreateTime != null">
|
|
|
+ AND tmr.op_create_time = #{opCreateTime}
|
|
|
+ </if>
|
|
|
+ <if test="opCreateUserId != null">
|
|
|
+ AND tmr.op_create_user_id = #{opCreateUserId}
|
|
|
+ </if>
|
|
|
+ <if test="opUpdateTime != null">
|
|
|
+ AND tmr.op_update_time = #{opUpdateTime}
|
|
|
+ </if>
|
|
|
+ <if test="opUpdateUserId != null">
|
|
|
+ AND tmr.op_update_user_id = #{opUpdateUserId}
|
|
|
+ </if>
|
|
|
+ <if test="opAppCode != null and opAppCode != ''">
|
|
|
+ AND tmr.op_app_code = #{opAppCode}
|
|
|
+ </if>
|
|
|
+ <if test="opTimestamp != null">
|
|
|
+ AND tmr.op_timestamp = #{opTimestamp}
|
|
|
+ </if>
|
|
|
+ <if test="opDbUser != null and opDbUser != ''">
|
|
|
+ AND tmr.op_db_user = #{opDbUser}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <sql id="idsForeach">
|
|
|
+ <!-- 根据主键receiptId批量操作 -->
|
|
|
+ WHERE receipt_id in
|
|
|
+ <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 查询表dkic_a.t_mst_receipt,(条件查询+分页)列表 -->
|
|
|
+ <select id="selectByCond" resultMap="BaseResultMap_list">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List_list"/>
|
|
|
+ , sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "receiptStatusName"
|
|
|
+ , sys.f_get_name_i18n(tdk2.kind_name_i18n, #{i18n}) as "receiptTypeName"
|
|
|
+ FROM dkic_a.t_mst_receipt tmr
|
|
|
+ left JOIN sys.t_data_kind as tdk1 on tmr.receipt_status = tdk1.kind_code
|
|
|
+ left JOIN sys.t_data_kind as tdk2 on tmr.receipt_type = tdk2.kind_code
|
|
|
+ <include refid="Condition_list"/>
|
|
|
+ <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
+ limit #{end} offset #{start}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询表dkic_a.t_mst_receipt,(条件查询)个数 -->
|
|
|
+ <select id="countByCond" resultType="Long">
|
|
|
+ SELECT
|
|
|
+ count(1)
|
|
|
+ FROM dkic_a.t_mst_receipt tmr
|
|
|
+ <include refid="Condition_list"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据主键查询表dkic_a.t_mst_receipt的一行数据 -->
|
|
|
+ <select id="selectById" resultMap="BaseResultMap">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ FROM dkic_a.t_mst_receipt
|
|
|
+ WHERE receipt_id = #{receiptId}::uuid
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据主键锁定表dkic_a.t_mst_receipt的一行数据 -->
|
|
|
+ <select id="selectByIdForUpdate" resultMap="BaseResultMap">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ FROM dkic_a.t_mst_receipt
|
|
|
+ WHERE receipt_id = #{receiptId}
|
|
|
+ for update
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据主键锁定表dkic_a.t_mst_receipt的多行数据 -->
|
|
|
+ <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ FROM dkic_a.t_mst_receipt
|
|
|
+ <include refid="idsForeach"/>
|
|
|
+ for update
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertBatch">
|
|
|
+ insert into dkic_a.t_mst_receipt
|
|
|
+ (
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ receipt_set_id,
|
|
|
+ receipt_status,
|
|
|
+ receipt_type,
|
|
|
+ apply_staff,
|
|
|
+ apply_date,
|
|
|
+ cp_id,
|
|
|
+ cp_name,
|
|
|
+ tax_no,
|
|
|
+ cp_email,
|
|
|
+ cp_address,
|
|
|
+ cp_phone,
|
|
|
+ open_bank,
|
|
|
+ bank_account,
|
|
|
+ receipt_amt,
|
|
|
+ receipt_content,
|
|
|
+ receipt_date,
|
|
|
+ receipt_staff,
|
|
|
+ receipt_obj,
|
|
|
+ tax_rate,
|
|
|
+ op_app_code,
|
|
|
+ </trim>
|
|
|
+ )
|
|
|
+ values
|
|
|
+ <foreach collection="list" index="index" item="item" separator=",">
|
|
|
+ (
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ #{item.receiptSetId}::uuid,
|
|
|
+ #{item.receiptStatus},
|
|
|
+ #{item.receiptType},
|
|
|
+ #{item.applyStaff},
|
|
|
+ #{item.applyDate},
|
|
|
+ #{item.cpId},
|
|
|
+ #{item.cpName},
|
|
|
+ #{item.taxNo},
|
|
|
+ #{item.cpEmail},
|
|
|
+ #{item.cpAddress},
|
|
|
+ #{item.cpPhone},
|
|
|
+ #{item.openBank},
|
|
|
+ #{item.bankAccount},
|
|
|
+ #{item.receiptAmt},
|
|
|
+ #{item.receiptContent},
|
|
|
+ #{item.receiptDate},
|
|
|
+ #{item.receiptStaff},
|
|
|
+ #{item.receiptObj},
|
|
|
+ #{item.taxRate},
|
|
|
+ #{item.opAppCode},
|
|
|
+ </trim>
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+</mapper>
|