74 lines
3.4 KiB
XML
74 lines
3.4 KiB
XML
<?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.lz.modules.app.dao.DepartmentsDao">
|
|
|
|
<!-- 可根据自己的需求,是否要使用 -->
|
|
<resultMap type="com.lz.modules.app.entity.DepartmentsEntity" id="departmentsMap">
|
|
<result property="id" column="id"/>
|
|
<result property="isDelete" column="is_delete"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="departmentId" column="department_id"/>
|
|
<result property="departmentParentId" column="department_parent_id"/>
|
|
<result property="memberCount" column="member_count"/>
|
|
<result property="departmentName" column="department_name"/>
|
|
<result property="chatId" column="chat_id"/>
|
|
<result property="leaderEmployeeId" column="leader_employee_id"/>
|
|
<result property="leaderOpenId" column="leader_open_id"/>
|
|
<result property="status" column="status"/>
|
|
</resultMap>
|
|
|
|
<select id="getDepartmentByDepartmentId" resultType="com.lz.modules.app.entity.DepartmentsEntity">
|
|
select * from lz_departments where is_delete=0 and department_id = #{departmentId}
|
|
</select>
|
|
|
|
<select id="getDepartmentsByparentId" resultType="com.lz.modules.app.Dto.DepartmentsDto">
|
|
select department_id,department_parent_id,member_count,department_name from lz_departments where department_parent_id=#{parentId}
|
|
</select>
|
|
|
|
<update id="updateDepartment">
|
|
UPDATE lz_departments
|
|
<set>
|
|
update_time = now(),
|
|
<if test="departmentParentId != null and departmentParentId != '' ">
|
|
department_parent_id = #{departmentParentId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="memberCount != null">
|
|
member_count = #{memberCount,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="departmentName != null and departmentName != '' ">
|
|
department_name = #{departmentName,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="chatId != null and chatId != '' ">
|
|
chat_id = #{chatId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="leaderEmployeeId != null and leaderEmployeeId != '' ">
|
|
leader_employee_id = #{leaderEmployeeId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="leaderOpenId != null and leaderOpenId != '' ">
|
|
leader_open_id = #{leaderOpenId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="status != null">
|
|
status = #{status,jdbcType=INTEGER},
|
|
</if>
|
|
</set>
|
|
WHERE is_delete = 0 AND department_id = #{departmentId ,jdbcType=BIGINT}
|
|
</update>
|
|
|
|
<update id="updateDepartmentStatus">
|
|
UPDATE lz_departments set status = 0 WHERE is_delete = 0
|
|
</update>
|
|
|
|
<insert id="addDepartmentBatch">
|
|
INSERT INTO
|
|
lz_departments(department_id,department_parent_id,member_count,department_name,chat_id,leader_employee_id,leader_open_id,status)
|
|
VALUES
|
|
<foreach collection="departments" item="department" separator=",">
|
|
(#{department.departmentId},#{department.departmentParentId},#{department.memberCount},#{department.departmentName},#{department.chatId},#{department.leaderEmployeeId},#{department.leaderOpenId},#{department.status})
|
|
</foreach>
|
|
</insert>
|
|
|
|
|
|
</mapper>
|