|
|
@@ -9,6 +9,13 @@
|
|
|
, cat_code, cat_name, parent_id, display_no, top_id, level_upper, level_lower, level_leaf, level_no, level_code, level_name, 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">
|
|
|
+ tmgc.cat_id
|
|
|
+ , tmgc.cat_code, tmgc.cat_name, tmgc.parent_id, tmgc.display_no, tmgc.top_id, tmgc.level_upper,
|
|
|
+ tmgc.level_lower, tmgc.level_leaf, tmgc.level_no, tmgc.level_code, tmgc.level_name, tmgc.remarks, tmgc.flg_valid, tmgc.cp_id
|
|
|
+ </sql>
|
|
|
+
|
|
|
+
|
|
|
<!-- 通用查询映射结果 -->
|
|
|
<resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.GoodsCategory">
|
|
|
<id column="cat_id" property="catId"/>
|
|
|
@@ -52,76 +59,57 @@
|
|
|
<result column="remarks" property="remarks"/>
|
|
|
<result column="flg_valid" property="flgValid"/>
|
|
|
<result column="cp_id" property="cpId"/>
|
|
|
+ <result column="parentName" property="parentName"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<!-- 通用条件列 -->
|
|
|
<sql id="Condition">
|
|
|
<where>
|
|
|
<if test="catCode != null and catCode != ''">
|
|
|
- AND cat_code = #{catCode}
|
|
|
+ AND tmgc.cat_code = #{catCode}
|
|
|
</if>
|
|
|
<if test="catName != null and catName != ''">
|
|
|
- AND cat_name = #{catName}
|
|
|
+ AND tmgc.cat_name = #{catName}
|
|
|
</if>
|
|
|
<if test="parentId != null and parentId != ''">
|
|
|
- AND parent_id = #{parentId}
|
|
|
+ AND tmgc.parent_id = #{parentId}
|
|
|
</if>
|
|
|
<if test="displayNo != null">
|
|
|
- AND display_no = #{displayNo}
|
|
|
+ AND tmgc.display_no = #{displayNo}
|
|
|
</if>
|
|
|
<if test="topId != null and topId != ''">
|
|
|
- AND top_id = #{topId}
|
|
|
+ AND tmgc.top_id = #{topId}
|
|
|
</if>
|
|
|
<if test="levelUpper != null and levelUpper != ''">
|
|
|
- AND level_upper = #{levelUpper}
|
|
|
+ AND tmgc.level_upper = #{levelUpper}
|
|
|
</if>
|
|
|
<if test="levelLower != null and levelLower != ''">
|
|
|
- AND level_lower = #{levelLower}
|
|
|
+ AND tmgc.level_lower = #{levelLower}
|
|
|
</if>
|
|
|
<if test="levelLeaf != null">
|
|
|
- AND level_leaf = #{levelLeaf}
|
|
|
+ AND tmgc.level_leaf = #{levelLeaf}
|
|
|
</if>
|
|
|
<if test="levelNo != null">
|
|
|
- AND level_no = #{levelNo}
|
|
|
+ AND tmgc.level_no = #{levelNo}
|
|
|
</if>
|
|
|
<if test="levelCode != null and levelCode != ''">
|
|
|
- AND level_code = #{levelCode}
|
|
|
+ AND tmgc.level_code = #{levelCode}
|
|
|
</if>
|
|
|
<if test="levelName != null and levelName != ''">
|
|
|
- AND level_name = #{levelName}
|
|
|
+ AND tmgc.level_name = #{levelName}
|
|
|
</if>
|
|
|
<if test="remarks != null and remarks != ''">
|
|
|
- AND remarks = #{remarks}
|
|
|
+ AND tmgc.remarks = #{remarks}
|
|
|
</if>
|
|
|
<if test="flgValid != null">
|
|
|
- AND flg_valid = #{flgValid}
|
|
|
+ AND tmgc.flg_valid = #{flgValid}
|
|
|
</if>
|
|
|
<if test="cpId != null">
|
|
|
- AND 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 tmgc.cp_id = #{cpId}
|
|
|
</if>
|
|
|
+
|
|
|
<if test="searchText != null">
|
|
|
- AND (position(#{searchText} in cat_code) > 0 OR position(#{searchText} in cat_name) > 0 OR position(#{searchText} in remarks) > 0 )
|
|
|
+ AND (position(#{searchText} in tmgc.cat_code) > 0 OR position(#{searchText} in tmgc.cat_name) > 0 OR position(#{searchText} in tmgc.remarks) > 0 )
|
|
|
</if>
|
|
|
</where>
|
|
|
</sql>
|
|
|
@@ -137,10 +125,13 @@
|
|
|
<!-- 查询表t_mst_goods_category,(条件查询+分页)列表 -->
|
|
|
<select id="selectByCond" resultMap="BaseResultMapResponse">
|
|
|
SELECT
|
|
|
- <include refid="Base_Column_List"/>
|
|
|
- FROM dkic_b.t_mst_goods_category
|
|
|
+ <include refid="Base_Column_List_Join"/>,
|
|
|
+
|
|
|
+ (select cat_name FROM dkic_b.t_mst_goods_category tmstg where tmstg.cat_id = tmgc.parent_id) AS "parentName"
|
|
|
+ FROM dkic_b.t_mst_goods_category tmgc
|
|
|
+
|
|
|
<include refid="Condition"/>
|
|
|
- ORDER BY display_no
|
|
|
+ ORDER BY tmgc.display_no
|
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
|
@@ -150,7 +141,7 @@
|
|
|
<select id="countByCond" resultType="Long">
|
|
|
SELECT
|
|
|
count(1)
|
|
|
- FROM dkic_b.t_mst_goods_category
|
|
|
+ FROM dkic_b.t_mst_goods_category tmgc
|
|
|
<include refid="Condition"/>
|
|
|
</select>
|
|
|
|