|
|
@@ -8,6 +8,11 @@
|
|
|
brand_id, brand_code, brand_name, short_name, display_no, remarks, flg_valid, cp_id, op_create_time, op_create_user_id, op_update_time, op_update_user_id, op_app_code, op_timestamp, op_db_user
|
|
|
</sql>
|
|
|
|
|
|
+ <sql id="Base_Column_List_Join">
|
|
|
+ tmgb.brand_id, tmgb.brand_code, tmgb.brand_name, tmgb.short_name, tmgb.display_no, tmgb.remarks, tmgb.flg_valid, tmgb.cp_id
|
|
|
+ </sql>
|
|
|
+
|
|
|
+
|
|
|
<!-- 通用查询映射结果 -->
|
|
|
<resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.GoodsBrand">
|
|
|
<id column="brand_id" property="brandId"/>
|
|
|
@@ -27,51 +32,47 @@
|
|
|
<result column="op_db_user" property="opDbUser"/>
|
|
|
</resultMap>
|
|
|
|
|
|
+
|
|
|
+ <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mst.GoodsBrandResponse">
|
|
|
+ <id column="brand_id" property="brandId"/>
|
|
|
+ <result column="brand_code" property="brandCode"/>
|
|
|
+ <result column="brand_name" property="brandName"/>
|
|
|
+ <result column="short_name" property="shortName"/>
|
|
|
+ <result column="display_no" property="displayNo"/>
|
|
|
+ <result column="remarks" property="remarks"/>
|
|
|
+ <result column="flg_valid" property="flgValid"/>
|
|
|
+ <result column="cp_id" property="cpId"/>
|
|
|
+ <result column="goodsBrand" property="goodsBrand"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
<!-- 通用条件列 -->
|
|
|
<sql id="Condition">
|
|
|
<where>
|
|
|
<if test="brandCode != null and brandCode != ''">
|
|
|
- AND brand_code = #{brandCode}
|
|
|
+ AND tmgb.brand_code = #{brandCode}
|
|
|
</if>
|
|
|
<if test="brandName != null and brandName != ''">
|
|
|
- AND brand_name = #{brandName}
|
|
|
+ AND tmgb.brand_name = #{brandName}
|
|
|
</if>
|
|
|
<if test="shortName != null and shortName != ''">
|
|
|
- AND short_name = #{shortName}
|
|
|
+ AND tmgb.short_name = #{shortName}
|
|
|
</if>
|
|
|
<if test="displayNo != null">
|
|
|
- AND display_no = #{displayNo}
|
|
|
+ AND tmgb.display_no = #{displayNo}
|
|
|
</if>
|
|
|
<if test="remarks != null and remarks != ''">
|
|
|
- AND remarks = #{remarks}
|
|
|
+ AND tmgb.remarks = #{remarks}
|
|
|
</if>
|
|
|
<if test="flgValid != null">
|
|
|
- AND flg_valid = #{flgValid}
|
|
|
+ AND tmgb.flg_valid = #{flgValid}
|
|
|
</if>
|
|
|
<if test="cpId != null">
|
|
|
- AND cp_id = #{cpId}
|
|
|
+ AND tmgb.cp_id = #{cpId}
|
|
|
</if>
|
|
|
<if test="opCreateTime != null">
|
|
|
- AND op_create_time = #{opCreateTime}
|
|
|
- </if>
|
|
|
- <if test="opCreateUserId != null and opCreateUserId != ''">
|
|
|
- AND op_create_user_id = #{opCreateUserId}
|
|
|
- </if>
|
|
|
- <if test="opUpdateTime != null">
|
|
|
- AND op_update_time = #{opUpdateTime}
|
|
|
- </if>
|
|
|
- <if test="opUpdateUserId != null and opUpdateUserId != ''">
|
|
|
- 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}
|
|
|
+ AND tmgb.op_create_time = #{opCreateTime}
|
|
|
</if>
|
|
|
+
|
|
|
</where>
|
|
|
</sql>
|
|
|
|
|
|
@@ -84,38 +85,44 @@
|
|
|
</sql>
|
|
|
|
|
|
<!-- 查询表t_mst_goods_brand,(条件查询+分页)列表 -->
|
|
|
- <select id="selectByCond" resultMap="BaseResultMap">
|
|
|
+ <select id="selectByCond" resultMap="BaseResultMapResponse">
|
|
|
SELECT
|
|
|
- <include refid="Base_Column_List"/>
|
|
|
- FROM t_mst_goods_brand
|
|
|
+ <include refid="Base_Column_List_Join"/>,
|
|
|
+ '商品品牌' AS "goodsBrand"
|
|
|
+ FROM dkic_b.t_mst_goods_brand tmgb
|
|
|
<include refid="Condition"/>
|
|
|
+ order by display_no asc
|
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
+ <select id="setBrandCode" resultType="String">
|
|
|
+ select dkic_b.f_create_code(1,#{brandId}::uuid,'品牌');
|
|
|
+ </select>
|
|
|
+
|
|
|
<!-- 查询表t_mst_goods_brand,(条件查询)个数 -->
|
|
|
<select id="countByCond" resultType="Long">
|
|
|
SELECT
|
|
|
count(1)
|
|
|
- FROM t_mst_goods_brand
|
|
|
+ FROM dkic_b.t_mst_goods_brand tmgb
|
|
|
<include refid="Condition"/>
|
|
|
</select>
|
|
|
|
|
|
<!-- 根据主键查询表t_mst_goods_brand的一行数据 -->
|
|
|
<select id="selectById" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
|
- <include refid="Base_Column_List"/>
|
|
|
- FROM t_mst_goods_brand
|
|
|
- WHERE brand_id = #{brandId}::uuid
|
|
|
+ <include refid="Base_Column_List_Join"/>
|
|
|
+ FROM dkic_b.t_mst_goods_brand tmgb
|
|
|
+ WHERE tmgb.brand_id = #{brandId}::uuid
|
|
|
</select>
|
|
|
|
|
|
<!-- 根据主键锁定表t_mst_goods_brand的一行数据 -->
|
|
|
<select id="selectByIdForUpdate" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
|
- <include refid="Base_Column_List"/>
|
|
|
- FROM t_mst_goods_brand
|
|
|
- WHERE brand_id = #{brandId}
|
|
|
+ <include refid="Base_Column_List_Join"/>
|
|
|
+ FROM dkic_b.t_mst_goods_brand tmgb
|
|
|
+ WHERE tmgb.brand_id = #{brandId}
|
|
|
for update
|
|
|
</select>
|
|
|
|
|
|
@@ -123,13 +130,13 @@
|
|
|
<select id="selectByIdsForUpdate" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
|
<include refid="Base_Column_List"/>
|
|
|
- FROM t_mst_goods_brand
|
|
|
+ FROM dkic_b.t_mst_goods_brand
|
|
|
<include refid="idsForeach"/>
|
|
|
for update
|
|
|
</select>
|
|
|
|
|
|
<insert id="insertBatch">
|
|
|
- insert into t_mst_goods_brand
|
|
|
+ insert into dkic_b.t_mst_goods_brand
|
|
|
(
|
|
|
<trim suffixOverrides=",">
|
|
|
brand_code,
|
|
|
@@ -137,8 +144,7 @@
|
|
|
short_name,
|
|
|
display_no,
|
|
|
remarks,
|
|
|
- cp_id,
|
|
|
- op_app_code,
|
|
|
+ cp_id,=
|
|
|
</trim>
|
|
|
)
|
|
|
values
|
|
|
@@ -151,9 +157,46 @@
|
|
|
#{item.displayNo},
|
|
|
#{item.remarks},
|
|
|
#{item.cpId},
|
|
|
- #{item.opAppCode},
|
|
|
</trim>
|
|
|
)
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectDisplayNo" resultType="Integer">
|
|
|
+ SELECT MAX(display_no) + 1 FROM dkic_b.t_mst_goods_brand
|
|
|
+ <include refid="Condition"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <update id="updateById" parameterType="com.dk.mdm.model.pojo.mst.GoodsBrand">
|
|
|
+ update
|
|
|
+ dkic_b.t_mst_goods_brand
|
|
|
+ <set>
|
|
|
+ <if test="et.brandCode != null">
|
|
|
+ brand_code = #{et.brandCode},
|
|
|
+ </if>
|
|
|
+ <if test="et.brandName != null">
|
|
|
+ brand_name = #{et.brandName},
|
|
|
+ </if>
|
|
|
+ <if test="et.shortName != null">
|
|
|
+ short_name = #{et.shortName},
|
|
|
+ </if>
|
|
|
+ <if test="et.displayNo != null">
|
|
|
+ display_no = #{et.displayNo},
|
|
|
+ </if>
|
|
|
+ <if test="et.remarks != null">
|
|
|
+ remarks = #{et.remarks},
|
|
|
+ </if>
|
|
|
+ <if test="et.cpId != null">
|
|
|
+ cp_id = #{et.cpId},
|
|
|
+ </if>
|
|
|
+ <if test="et.flgValid != null">
|
|
|
+ flg_valid = #{et.flgValid},
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </set>
|
|
|
+ where brand_id = #{et.brandId}::uuid
|
|
|
+ </update>
|
|
|
</mapper>
|