|
@@ -9,9 +9,9 @@
|
|
|
, org_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, org_code
|
|
, org_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, org_code
|
|
|
</sql>
|
|
</sql>
|
|
|
<sql id="Base_Column_List_view">
|
|
<sql id="Base_Column_List_view">
|
|
|
- parent.org_id
|
|
|
|
|
- , parent.org_name, parent.parent_id, parent.display_no, parent.top_id </sql>
|
|
|
|
|
-
|
|
|
|
|
|
|
+ parent.org_id,parent.flg_valid,parent.level_leaf,parent.org_code,parent.level_name
|
|
|
|
|
+ , parent.org_name, parent.parent_id, parent.display_no, parent.top_id
|
|
|
|
|
+ </sql>
|
|
|
<!-- 通用查询映射结果 -->
|
|
<!-- 通用查询映射结果 -->
|
|
|
<resultMap id="BaseResultMap" type="com.dk.mdm.model.response.mst.OrgResponse">
|
|
<resultMap id="BaseResultMap" type="com.dk.mdm.model.response.mst.OrgResponse">
|
|
|
<id column="org_id" property="orgId"/>
|
|
<id column="org_id" property="orgId"/>
|
|
@@ -46,129 +46,47 @@
|
|
|
<sql id="Condition">
|
|
<sql id="Condition">
|
|
|
<where>
|
|
<where>
|
|
|
<if test="orgName != null and orgName != ''">
|
|
<if test="orgName != null and orgName != ''">
|
|
|
- AND org_name = #{orgName}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="parentId != null and parentId != ''">
|
|
|
|
|
- AND parent_id = #{parentId}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="displayNo != null">
|
|
|
|
|
- AND display_no = #{displayNo}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="topId != null and topId != ''">
|
|
|
|
|
- AND top_id = #{topId}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="levelUpper != null and levelUpper != ''">
|
|
|
|
|
- AND level_upper = #{levelUpper}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="levelLower != null and levelLower != ''">
|
|
|
|
|
- AND level_lower = #{levelLower}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="levelLeaf != null">
|
|
|
|
|
- AND level_leaf = #{levelLeaf}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="levelNo != null">
|
|
|
|
|
- AND level_no = #{levelNo}
|
|
|
|
|
|
|
+ AND parent.org_name = #{orgName}
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="levelCode != null and levelCode != ''">
|
|
|
|
|
- AND level_code = #{levelCode}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="levelName != null and levelName != ''">
|
|
|
|
|
- AND level_name = #{levelName}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="remarks != null and remarks != ''">
|
|
|
|
|
- AND remarks = #{remarks}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="flgValid != null">
|
|
|
|
|
- AND flg_valid = #{flgValid}
|
|
|
|
|
|
|
+ <if test="flgValidList != null and flgValidList.size>0">
|
|
|
|
|
+ AND parent.flg_valid =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
|
|
|
</if>
|
|
</if>
|
|
|
<if test="cpId != null">
|
|
<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}
|
|
|
|
|
|
|
+ AND parent.cp_id = #{cpId}
|
|
|
</if>
|
|
</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 test="parentId != null and parentId != ''">
|
|
|
|
|
+ AND parent.parent_id = #{parentId}
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="opDbUser != null and opDbUser != ''">
|
|
|
|
|
- AND op_db_user = #{opDbUser}
|
|
|
|
|
|
|
+ <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
|
|
+ limit #{end} offset #{start}
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="orgCode != null and orgCode != ''">
|
|
|
|
|
- AND org_code = #{orgCode}
|
|
|
|
|
|
|
+ <if test="searchText !=null">
|
|
|
|
|
+ AND ( parent.org_name LIKE concat('%', #{searchText}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
</where>
|
|
</where>
|
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
|
|
- <sql id="idsForeach">
|
|
|
|
|
- <!-- 根据主键orgId批量操作 -->
|
|
|
|
|
- WHERE org_id in
|
|
|
|
|
- <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
|
|
|
|
|
- #{item}
|
|
|
|
|
- </foreach>
|
|
|
|
|
- </sql>
|
|
|
|
|
-
|
|
|
|
|
<!-- 查询表t_mst_org,(条件查询+分页)列表 -->
|
|
<!-- 查询表t_mst_org,(条件查询+分页)列表 -->
|
|
|
<select id="selectByCond" resultMap="BaseResultMap">
|
|
<select id="selectByCond" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
SELECT
|
|
|
<include refid="Base_Column_List_view"/>
|
|
<include refid="Base_Column_List_view"/>
|
|
|
FROM
|
|
FROM
|
|
|
dkic_b.t_mst_org AS parent
|
|
dkic_b.t_mst_org AS parent
|
|
|
- <where>
|
|
|
|
|
- <if test="orgName != null and orgName != ''">
|
|
|
|
|
- AND parent.org_name = #{orgName}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="flgValidList != null and flgValidList.size>0">
|
|
|
|
|
- AND parent.flg_valid =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="cpId != null">
|
|
|
|
|
- AND parent.cp_id = #{cpId}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
|
|
- limit #{end} offset #{start}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="searchText !=null">
|
|
|
|
|
- AND ( parent.org_name LIKE concat('%', #{searchText}, '%')
|
|
|
|
|
- </if>
|
|
|
|
|
- </where>
|
|
|
|
|
|
|
+ <include refid="Condition"/>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+
|
|
|
<select id="resetLevelOrg" resultType="java.lang.Boolean">
|
|
<select id="resetLevelOrg" resultType="java.lang.Boolean">
|
|
|
select dkic_b.f_reset_level_org(#{cpId}, #{topId}::uuid)
|
|
select dkic_b.f_reset_level_org(#{cpId}, #{topId}::uuid)
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+
|
|
|
<!-- 查询表t_mst_org,(条件查询)个数 -->
|
|
<!-- 查询表t_mst_org,(条件查询)个数 -->
|
|
|
<select id="countByCond" resultType="Long">
|
|
<select id="countByCond" resultType="Long">
|
|
|
SELECT
|
|
SELECT
|
|
|
count(1)
|
|
count(1)
|
|
|
FROM dkic_b.t_mst_org parent
|
|
FROM dkic_b.t_mst_org parent
|
|
|
- <where>
|
|
|
|
|
- <if test="cpId != null">
|
|
|
|
|
- AND parent.cp_id = #{cpId}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="orgName != null and orgName != ''">
|
|
|
|
|
- AND parent.org_name = #{orgName}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="flgValid != null">
|
|
|
|
|
- AND parent.flg_valid = #{flgValid}
|
|
|
|
|
- </if>
|
|
|
|
|
- </where>
|
|
|
|
|
- </select>
|
|
|
|
|
- <!-- 查询同父级下 最大的 显示顺序 -->
|
|
|
|
|
- <select id="maxDisplayNo" resultType="Integer">
|
|
|
|
|
- SELECT MAX(display_no) AS max_display_no
|
|
|
|
|
- FROM dkic_b.t_mst_org org
|
|
|
|
|
- WHERE org.parent_id = #{parentID} ::uuid;
|
|
|
|
|
|
|
+ <include refid="Condition"/>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+
|
|
|
<!-- 根据主键查询表t_mst_org的一行数据 -->
|
|
<!-- 根据主键查询表t_mst_org的一行数据 -->
|
|
|
<select id="selectById" resultMap="BaseResultMap">
|
|
<select id="selectById" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
SELECT
|
|
@@ -177,64 +95,4 @@
|
|
|
WHERE org_id = #{orgId}::uuid
|
|
WHERE org_id = #{orgId}::uuid
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
- <!-- 根据主键锁定表t_mst_org的一行数据 -->
|
|
|
|
|
- <select id="selectByIdForUpdate" resultMap="BaseResultMap">
|
|
|
|
|
- SELECT
|
|
|
|
|
- <include refid="Base_Column_List"/>
|
|
|
|
|
- FROM t_mst_org
|
|
|
|
|
- WHERE org_id = #{orgId}
|
|
|
|
|
- for update
|
|
|
|
|
- </select>
|
|
|
|
|
-
|
|
|
|
|
- <!-- 根据主键锁定表t_mst_org的多行数据 -->
|
|
|
|
|
- <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
|
|
|
|
|
- SELECT
|
|
|
|
|
- <include refid="Base_Column_List"/>
|
|
|
|
|
- FROM t_mst_org
|
|
|
|
|
- <include refid="idsForeach"/>
|
|
|
|
|
- for update
|
|
|
|
|
- </select>
|
|
|
|
|
-
|
|
|
|
|
- <insert id="insertBatch">
|
|
|
|
|
- insert into t_mst_org
|
|
|
|
|
- (
|
|
|
|
|
- <trim suffixOverrides=",">
|
|
|
|
|
- org_name,
|
|
|
|
|
- parent_id,
|
|
|
|
|
- display_no,
|
|
|
|
|
- top_id,
|
|
|
|
|
- level_upper,
|
|
|
|
|
- level_lower,
|
|
|
|
|
- level_leaf,
|
|
|
|
|
- level_no,
|
|
|
|
|
- level_code,
|
|
|
|
|
- level_name,
|
|
|
|
|
- remarks,
|
|
|
|
|
- cp_id,
|
|
|
|
|
- op_app_code,
|
|
|
|
|
- org_code,
|
|
|
|
|
- </trim>
|
|
|
|
|
- )
|
|
|
|
|
- values
|
|
|
|
|
- <foreach collection="list" index="index" item="item" separator=",">
|
|
|
|
|
- (
|
|
|
|
|
- <trim suffixOverrides=",">
|
|
|
|
|
- #{item.orgName},
|
|
|
|
|
- #{item.parentId}::uuid,
|
|
|
|
|
- #{item.displayNo},
|
|
|
|
|
- #{item.topId}::uuid,
|
|
|
|
|
- #{item.levelUpper},
|
|
|
|
|
- #{item.levelLower},
|
|
|
|
|
- #{item.levelLeaf},
|
|
|
|
|
- #{item.levelNo},
|
|
|
|
|
- #{item.levelCode},
|
|
|
|
|
- #{item.levelName},
|
|
|
|
|
- #{item.remarks},
|
|
|
|
|
- #{item.cpId},
|
|
|
|
|
- #{item.opAppCode},
|
|
|
|
|
- #{item.orgCode},
|
|
|
|
|
- </trim>
|
|
|
|
|
- )
|
|
|
|
|
- </foreach>
|
|
|
|
|
- </insert>
|
|
|
|
|
</mapper>
|
|
</mapper>
|