mobilebroken/nflg-mobilebroken-repository/src/main/resources/mapper/TBaseDepartmentMapper.xml

39 lines
1.7 KiB
XML
Raw Normal View History

2025-01-20 17:26:20 +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.nflg.mobilebroken.repository.mapper.TBaseDepartmentMapper">
<sql id="whr">
<if test="query.deptCodeOrName!=null and query.deptCodeOrName!=''">
2025-02-25 14:08:07 +08:00
and (dept_code like concat('%', #{query.deptCodeOrName},'%') or dept_name like concat('%', #{query.deptCodeOrName},'%'))
2025-01-20 17:26:20 +08:00
</if>
2025-02-09 11:30:01 +08:00
<if test="query.deptStatus!=null">
and dept_status=#{query.deptStatus}
2025-01-20 17:26:20 +08:00
</if>
</sql>
<select id="selectListByPage" resultType="com.nflg.mobilebroken.repository.entity.TBaseDepartment">
select *
from t_base_department
2025-02-06 10:36:08 +08:00
where data_valid_status=1
2025-02-25 20:54:11 +08:00
<if test="query.deptStatus==null and (query.deptCodeOrName==null || query.deptCodeOrName=='')">
and dept_parent_id=0
</if>
2025-01-20 17:26:20 +08:00
<include refid="whr"/>
</select>
<select id="getUsers" resultType="com.nflg.mobilebroken.common.pojo.vo.DepartmentChildItemVO">
2026-01-21 09:23:18 +08:00
SELECT id,user_name as 'name',1 as 'type',type as 'userType',state,create_by,create_time,update_by,update_time
FROM v_all_user
WHERE department_id = #{id}
</select>
2025-01-20 17:26:20 +08:00
2025-02-15 19:06:06 +08:00
<delete id="del">
delete from t_base_department where id in
2025-01-20 17:26:20 +08:00
<foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
2025-02-15 19:06:06 +08:00
</delete>
<update id="updateHasManager">
UPDATE t_base_department p
SET has_manager=EXISTS(SELECT * FROM v_all_user WHERE department_id = p.id)
WHERE id = #{departmentId}
</update>
2025-01-20 17:26:20 +08:00
</mapper>