2022-09-30 09:41:48 +08:00
|
|
|
<?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.rzyc.mapper.ent.EntPostMapper">
|
|
|
|
|
|
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
|
|
|
<resultMap id="BaseResultMap" type="com.rzyc.model.ent.EntPost">
|
|
|
|
|
<id column="post_id" property="postId" />
|
|
|
|
|
<result column="enterprise_id" property="enterpriseId" />
|
|
|
|
|
<result column="name" property="name" />
|
|
|
|
|
<result column="parent_id" property="parentId" />
|
|
|
|
|
<result column="post_path" property="postPath" />
|
|
|
|
|
<result column="parent_name" property="parentName" />
|
|
|
|
|
<result column="post_level" property="postLevel" />
|
|
|
|
|
<result column="completion_rate" property="completionRate" />
|
|
|
|
|
<result column="create_time" property="createTime" />
|
|
|
|
|
<result column="create_by" property="createBy" />
|
|
|
|
|
<result column="modify_time" property="modifyTime" />
|
|
|
|
|
<result column="modify_by" property="modifyBy" />
|
|
|
|
|
<result column="subordinates" property="subordinates"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<!-- 通用查询结果列 -->
|
|
|
|
|
<sql id="Base_Column_List">
|
|
|
|
|
post_id, enterprise_id, name, parent_id, post_path, parent_name, post_level, completion_rate, create_time, create_by, modify_time, modify_by
|
|
|
|
|
</sql>
|
|
|
|
|
|
2022-12-21 18:17:12 +08:00
|
|
|
|
2022-09-30 09:41:48 +08:00
|
|
|
<select id="selectEntUserTree" resultMap="BaseResultMap">
|
|
|
|
|
select * from ent_post
|
2023-03-07 09:26:58 +08:00
|
|
|
where enterprise_id = #{enterpriseId} and del_state = 1
|
2022-09-30 09:41:48 +08:00
|
|
|
<if test="null != postId and '' != postId">
|
|
|
|
|
and post_path like concat('%',#{postId},'%')
|
|
|
|
|
</if>
|
2022-11-07 17:47:41 +08:00
|
|
|
order by post_level,sort asc
|
2022-09-30 09:41:48 +08:00
|
|
|
</select>
|
|
|
|
|
|
2022-10-19 17:37:21 +08:00
|
|
|
<update id="updateEntPost">
|
2022-11-07 17:47:41 +08:00
|
|
|
update ent_post set name = #{data.name},parent_id = #{data.parentId},post_path = #{data.postPath},parent_name = #{data.parentName},post_level = #{data.postLevel},
|
|
|
|
|
modify_time = #{data.modifyTime} , modify_by = #{data.modifyBy}
|
|
|
|
|
where post_id = #{data.postId} and enterprise_id = #{data.enterpriseId}
|
2022-10-19 17:37:21 +08:00
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<insert id="insertEntPost">
|
|
|
|
|
insert into ent_post (post_id,enterprise_id,name,parent_id,post_path,parent_name,post_level,completion_rate,subordinates,create_time,create_by)
|
|
|
|
|
values(#{data.postId},#{data.enterpriseId},#{data.name},#{data.parentId},#{data.postPath},#{data.parentName},#{data.postLevel},#{data.completionRate},#{data.subordinates},
|
2022-11-07 17:47:41 +08:00
|
|
|
#{data.createTime},#{data.createBy})
|
2022-10-19 17:37:21 +08:00
|
|
|
</insert>
|
|
|
|
|
|
2023-02-02 17:39:18 +08:00
|
|
|
|
2022-11-08 18:09:46 +08:00
|
|
|
<select id="getParentPost" resultMap="BaseResultMap">
|
2023-03-07 09:26:58 +08:00
|
|
|
select ep2.* from ent_post ep inner join ent_post ep2 on ep2.post_id = ep.parent_id where ep.post_id = #{postId} and ep.del_state = 1
|
2022-11-08 18:09:46 +08:00
|
|
|
</select>
|
|
|
|
|
|
2022-12-29 18:02:27 +08:00
|
|
|
|
2022-12-21 18:17:12 +08:00
|
|
|
<delete id="deletePostOfLegalPerson">
|
|
|
|
|
delete from ent_post where `name` = #{legalPerson} and enterprise_id = #{enterpriseId}
|
|
|
|
|
</delete>
|
|
|
|
|
|
2023-03-07 09:26:58 +08:00
|
|
|
<update id="deleteEntPost">
|
|
|
|
|
update ent_post set del_state = #{delState} where post_id = #{postId}
|
|
|
|
|
</update>
|
|
|
|
|
|
2022-12-29 18:02:27 +08:00
|
|
|
<select id="selectNoDutyPost" resultType="com.rzyc.model.ent.EntPost">
|
|
|
|
|
select ep.* from ent_post ep left join ent_post_duty epd on epd.post_id = ep.post_id where epd.duty_id is null
|
|
|
|
|
</select>
|
|
|
|
|
|
2023-02-02 17:39:18 +08:00
|
|
|
<insert id="insertEntPostBatch">
|
|
|
|
|
insert into ent_post (post_id,enterprise_id,`name`,post_path,create_time,public_post_id)values
|
|
|
|
|
<foreach collection="list" item="list" separator=",">
|
|
|
|
|
(#{list.uuid},
|
|
|
|
|
#{sysEnterpriseId},
|
|
|
|
|
#{list.publicPostName},
|
|
|
|
|
#{list.publicPostPath},
|
|
|
|
|
#{list.createTime},
|
|
|
|
|
#{list.publicPostId})
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
|
2022-09-30 09:41:48 +08:00
|
|
|
</mapper>
|