소스 검색

添加后线人员管联前线部门的逻辑
添加内部机构
添加后线人员分配内部机构

hxl13994548489 2 년 전
부모
커밋
0e59b323ee

+ 31 - 0
src/main/resources/mapper/modules/admin/SysDeptInternalAgentMapper.xml

@@ -0,0 +1,31 @@
+<?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.ydtech.modules.admin.dao.SysDeptInternalAgentMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.admin.model.po.SysDeptInternalAgent">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="name" column="name" jdbcType="VARCHAR"/>
+            <result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
+            <result property="orderNum" column="order_num" jdbcType="INTEGER"/>
+            <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="lastUpdateBy" column="last_update_by" jdbcType="VARCHAR"/>
+            <result property="lastUpdateTime" column="last_update_time" jdbcType="TIMESTAMP"/>
+            <result property="delFlag" column="del_flag" jdbcType="TINYINT"/>
+            <result property="comtype" column="comtype" jdbcType="VARCHAR"/>
+            <result property="comlevel" column="comlevel" jdbcType="VARCHAR"/>
+            <result property="deptCode" column="dept_code" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,name,parent_id,
+        order_num,create_by,create_time,
+        last_update_by,last_update_time,del_flag,
+        comtype,comlevel,dept_code
+    </sql>
+    <select id="queryDeptList" resultType="com.ydtech.modules.admin.model.po.SysDeptInternalAgent">
+         select * from  sys_dept_internal_agent
+    </select>
+</mapper>

+ 52 - 0
src/main/resources/mapper/modules/admin/SysUserLinkDeptInternalAgentMapper.xml

@@ -0,0 +1,52 @@
+<?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.ydtech.modules.admin.dao.SysUserLinkDeptInternalAgentMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.admin.model.po.SysUserLinkDeptInternalAgent">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="userId" column="user_id" jdbcType="VARCHAR"/>
+            <result property="sysDeptInternalAgentId" column="sys_dept_internal_agent_id" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="createUser" column="create_user" jdbcType="VARCHAR"/>
+            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+            <result property="updateUser" column="update_user" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,user_id,sys_dept_internal_agent_id,
+        create_time,create_user,update_time,
+        update_user
+    </sql>
+    <delete id="deleteByDeptId">
+        delete from  sys_user_link_dept_internal_agent
+        where dept_id =#{deptId}
+    </delete>
+
+    <select id="queryPage" resultType="com.ydtech.modules.admin.model.dto.SysUserLinkDeptInternalAgentDto">
+            SELECT
+            link.id AS id,
+            su.id AS userId,
+            su.NAME AS userName,
+            sd.id AS deptId,
+            sd.NAME AS deptName,
+            link.create_time AS createTime
+            FROM
+            sys_user_link_dept_internal_agent link
+            LEFT JOIN sys_user su ON link.user_id = su.id
+            LEFT JOIN sys_dept_internal_agent sd ON link.sys_dept_internal_agent_id = sd.id
+            <where>
+                <if test="vo.userId != null and vo.userId != ''">
+                    and  link.user_id =  #{vo.userId}
+                </if>
+                <if test="vo.userName != null and vo.userName != ''">
+                    and  su.name  like CONCAT('%', #{vo.userName}, '%')
+                </if>
+                <if test="vo.deptId != null and vo.deptId != ''">
+                    and  sd.id  =  #{vo.deptId}
+                </if>
+            </where>
+            order by link.create_time desc
+    </select>
+</mapper>

+ 110 - 0
src/main/resources/mapper/modules/admin/SysUserLinkFrontLineDeptMapper.xml

@@ -0,0 +1,110 @@
+<?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.ydtech.modules.admin.dao.SysUserLinkFrontLineDeptMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.admin.model.po.SysUserLinkFrontLineDept">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="userId" column="user_id" jdbcType="VARCHAR"/>
+            <result property="frontLineDeptId" column="front_line_dept_id" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="createUser" column="create_user" jdbcType="VARCHAR"/>
+            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+            <result property="updateUser" column="update_user" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,user_id,front_line_dept_id,
+        create_time,create_user,update_time,
+        update_user
+    </sql>
+
+    <delete id="deleteByUserId">
+          delete from  sys_user_link_front_line_dept
+              where user_id =#{userId}
+    </delete>
+
+    <select id="queryPage" resultType="com.ydtech.modules.admin.model.dto.SysUserLinkFrontLineDeptDto">
+        SELECT
+            link.id AS id,
+            su.id AS userId,
+            su.NAME AS userName,
+            sd.id AS deptId,
+            sd.NAME AS deptName,
+            link.create_time AS createTime
+        FROM
+            sys_user_link_front_line_dept link
+                LEFT JOIN sys_user su ON link.user_id = su.id
+                LEFT JOIN sys_dept sd ON link.front_line_dept_id = sd.id
+        <where>
+            <if test="vo.userId != null and vo.userId != ''">
+                and  link.user_id =  #{vo.userId}
+            </if>
+            <if test="vo.userName != null and vo.userName != ''">
+                and  su.name  like CONCAT('%', #{vo.userName}, '%')
+            </if>
+            <if test="vo.orgId != null and vo.orgId != ''">
+                and  sd.id  =  #{vo.orgId}
+            </if>
+        </where>
+        order by link.create_time desc
+    </select>
+    <select id="findDeptListByUserId" resultType="com.ydtech.modules.admin.model.SysDept">
+        SELECT
+            sd.id as id,
+            sd.name as name,
+            sd.parent_id as parentId,
+            sd.comlevel as comlevel,
+            CASE WHEN ( SELECT count( 0 ) FROM sys_user_link_front_line_dept link WHERE link.front_line_dept_id=sd.id   and  link.user_id = #{userId}) > 0 THEN
+            true ELSE false
+            END AS flag
+        FROM
+            sys_dept sd
+        WHERE
+            ( sd.comlevel = 3 )
+           OR  ( sd.comlevel = 4 )
+           OR ( sd.comlevel > 4 AND id LIKE '%M%' )
+           OR ( sd.comlevel > 4 AND id LIKE '%D%' )
+        ORDER BY comlevel
+    </select>
+
+
+    <select id="findUserListByDeptPage" resultType="com.ydtech.modules.admin.model.vo.SysUserBaseVO">
+        SELECT
+        t1.id AS userId,
+        t1.NAME AS NAME,
+        t1.mobile AS mobile,
+        t1.`status` AS `status`,
+        t2.id AS deptId,
+        t2.`name` AS deptName,
+        sd2.id AS pDeptId,
+        sd2.`name` AS pDeptName,
+        CASE
+        WHEN ( SELECT count( 0 ) FROM sys_user_link_front_line_dept link WHERE link.user_id = t1.id) > 0 THEN
+        true ELSE false
+        END AS flag
+        FROM
+        sys_user t1
+        LEFT JOIN sys_dept t2 ON t1.dept_id = t2.id
+        LEFT JOIN sys_dept sd2 ON sd2.id = t2.parent_id
+        WHERE
+        t1.`status` = 1
+        AND t1.id NOT LIKE '%M%'
+        <if test='user !=null  '>
+            <if test='user.name !=null and user.name!="" '>
+                and t1.name like CONCAT('%', #{user.name}, '%')
+            </if>
+            <if test='user.userId !=null and user.userId!="" '>
+                and t1.id = #{user.userId}
+            </if>
+            <if test='user.mobile !=null and user.mobile!=""  '>
+                and t1.mobile = #{user.mobile}
+            </if>
+            <if test='user.deptId !=null and user.deptId!=""  '>
+                and t2.id like CONCAT('', #{user.deptId}, '%')
+            </if>
+        </if>
+        order by flag desc
+    </select>
+</mapper>