|
|
@@ -0,0 +1,275 @@
|
|
|
+<?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.oauth.mapper.ReceiptSetMapper">
|
|
|
+
|
|
|
+ <!-- 通用设置 -->
|
|
|
+ <!-- 通用查询列 -->
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ set_id
|
|
|
+ , cp_id, cp_name, tax_no, cp_email, cp_address, cp_phone, open_bank, bank_account, flg_default, display_no, 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.oauth.response.ReceiptSetResponse">
|
|
|
+ <id column="set_id" property="setId"/>
|
|
|
+ <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="flg_default" property="flgDefault"/>
|
|
|
+ <result column="display_no" property="displayNo"/>
|
|
|
+ <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="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="flgDefault != null">
|
|
|
+ AND flg_default = #{flgDefault}
|
|
|
+ </if>
|
|
|
+ <if test="displayNo != null">
|
|
|
+ AND display_no = #{displayNo}
|
|
|
+ </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="idsForeach">
|
|
|
+ <!-- 根据主键setId批量操作 -->
|
|
|
+ WHERE set_id in
|
|
|
+ <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 查询表t_mst_receipt_set,(条件查询+分页)列表 -->
|
|
|
+ <select id="selectByCond" resultMap="BaseResultMap">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ FROM t_mst_receipt_set
|
|
|
+ <include refid="Condition"/>
|
|
|
+ <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
+ limit #{end} offset #{start}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <!-- 查询表t_mst_receipt_set,(条件查询+分页)列表 -->
|
|
|
+ <select id="selectReceiptSet" resultMap="BaseResultMap">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ FROM dkic_a.t_mst_receipt_set
|
|
|
+ <include refid="Condition"/>
|
|
|
+ <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
+ limit #{end} offset #{start}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <!-- 查询表t_mst_receipt_set,(条件查询)个数 -->
|
|
|
+ <select id="countByCond" resultType="Long">
|
|
|
+ SELECT
|
|
|
+ count(1)
|
|
|
+ FROM t_mst_receipt_set
|
|
|
+ <include refid="Condition"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据主键查询表t_mst_receipt_set的一行数据 -->
|
|
|
+ <select id="selectById" resultMap="BaseResultMap">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ FROM dkic_a.t_mst_receipt_set
|
|
|
+ WHERE set_id = #{setId}::uuid
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据主键锁定表t_mst_receipt_set的一行数据 -->
|
|
|
+ <select id="selectByIdForUpdate" resultMap="BaseResultMap">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ FROM t_mst_receipt_set
|
|
|
+ WHERE set_id = #{setId}
|
|
|
+ for update
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据主键锁定表t_mst_receipt_set的多行数据 -->
|
|
|
+ <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ FROM t_mst_receipt_set
|
|
|
+ <include refid="idsForeach"/>
|
|
|
+ for update
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertBatch">
|
|
|
+ insert into t_mst_receipt_set
|
|
|
+ (
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ cp_id,
|
|
|
+ cp_name,
|
|
|
+ tax_no,
|
|
|
+ cp_email,
|
|
|
+ cp_address,
|
|
|
+ cp_phone,
|
|
|
+ open_bank,
|
|
|
+ bank_account,
|
|
|
+ flg_default,
|
|
|
+ display_no,
|
|
|
+ op_app_code,
|
|
|
+ </trim>
|
|
|
+ )
|
|
|
+ values
|
|
|
+ <foreach collection="list" index="index" item="item" separator=",">
|
|
|
+ (
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ #{item.cpId},
|
|
|
+ #{item.cpName},
|
|
|
+ #{item.taxNo},
|
|
|
+ #{item.cpEmail},
|
|
|
+ #{item.cpAddress},
|
|
|
+ #{item.cpPhone},
|
|
|
+ #{item.openBank},
|
|
|
+ #{item.bankAccount},
|
|
|
+ #{item.flgDefault},
|
|
|
+ #{item.displayNo},
|
|
|
+ #{item.opAppCode},
|
|
|
+ </trim>
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 更新数据-->
|
|
|
+ <update id="updateById" parameterType="com.dk.oauth.model.pojo.ReceiptSet">
|
|
|
+ update dkic_a.t_mst_receipt_set
|
|
|
+ <set>
|
|
|
+ <if test="cpName != null">
|
|
|
+ cp_name = #{cpName,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="taxNo != null">
|
|
|
+ tax_no = #{taxNo,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="cpEmail != null">
|
|
|
+ cp_email = #{cpEmail,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="cpAddress != null">
|
|
|
+ cp_address = #{cpAddress,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="cpPhone != null">
|
|
|
+ cp_phone = #{cpPhone,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="openBank != null">
|
|
|
+ open_bank = #{openBank,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="bankAccount != null">
|
|
|
+ bank_account = #{bankAccount,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="flgValid != null">
|
|
|
+ flg_valid = #{flgValid,jdbcType=BOOLEAN},
|
|
|
+ </if>
|
|
|
+ <if test="flgDefault != null">
|
|
|
+ flg_default = #{flgDefault,jdbcType=BOOLEAN},
|
|
|
+ </if>
|
|
|
+ <if test="displayNo != null">
|
|
|
+ display_no = #{displayNo,jdbcType=NUMERIC},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where set_id = #{setId,typeHandler=UuidTypeHandler}
|
|
|
+
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <insert id="insertSingle">
|
|
|
+ INSERT INTO dkic_a.t_mst_receipt_set
|
|
|
+ (
|
|
|
+ cp_id,
|
|
|
+ cp_name,
|
|
|
+ tax_no,
|
|
|
+ cp_email,
|
|
|
+ cp_address,
|
|
|
+ cp_phone,
|
|
|
+ open_bank,
|
|
|
+ bank_account,
|
|
|
+ flg_default,
|
|
|
+ display_no,
|
|
|
+ op_app_code
|
|
|
+ )
|
|
|
+ VALUES
|
|
|
+ (
|
|
|
+ #{cpId},
|
|
|
+ #{cpName},
|
|
|
+ #{taxNo},
|
|
|
+ #{cpEmail},
|
|
|
+ #{cpAddress},
|
|
|
+ #{cpPhone},
|
|
|
+ #{openBank},
|
|
|
+ #{bankAccount},
|
|
|
+ #{flgDefault},
|
|
|
+ #{displayNo},
|
|
|
+ #{opAppCode}
|
|
|
+ )
|
|
|
+ </insert>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 获取显示顺序的最大值 -->
|
|
|
+ <select id="getMaxDisplayNo" resultType="Integer">
|
|
|
+ select max(display_no) + 1
|
|
|
+ from dkic_a.t_mst_receipt_set
|
|
|
+ where 1=1
|
|
|
+ <if test="flgValid != null">
|
|
|
+ and flg_valid = #{flgValid}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </select>
|
|
|
+</mapper>
|