bihuisong hai 2 meses
pai
achega
4e598a656e

+ 32 - 54
src/main/java/com/ruoyi/system/controller/SysProfileController.java

@@ -20,7 +20,6 @@ import com.ruoyi.system.service.ISysDeptService;
 import com.ruoyi.system.service.ISysUserService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -35,8 +34,7 @@ import java.util.Arrays;
 @Api(tags = "个人信息控制器")
 @RestController
 @RequestMapping("/user/profile")
-public class SysProfileController extends BaseController
-{
+public class SysProfileController extends BaseController {
     private final ISysUserService userService;
 
     private final TokenService tokenService;
@@ -61,34 +59,31 @@ public class SysProfileController extends BaseController
      */
     @ApiOperation(value = "获取用户个人信息", notes = "获取用户个人信息")
     @GetMapping
-    public AjaxResult profile()
-    {
-        Long[] deptIds = {369L,370L,371L,372L,373L};
+    public AjaxResult profile() {
+        Long[] deptIds = {314391L, 314392L, 314393L, 314394L};
         String username = SecurityUtils.getUsername();
         Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
         SysUser user = userService.selectUserByUserName(username);
         /**图片前缀**/
         String uri = configService.selectConfigByKey("fileUrl");
-        if(StringUtils.isNotEmpty(user.getAvatar())){
-            user.setAvatar(uri+user.getAvatar());
+        if (StringUtils.isNotEmpty(user.getAvatar())) {
+            user.setAvatar(uri + user.getAvatar());
         }
         AjaxResult ajax = AjaxResult.success(user);
         ajax.put("roleGroup", userService.selectUserRoleGroup(username));
         ajax.put("postGroup", userService.selectUserPostGroup(username));
         boolean isItSelf = Arrays.asList(deptIds).contains(deptId);
-        if(isItSelf) {//如果是三县两区本身
+        if (isItSelf) {
             ajax.put("mapDeptId", deptId);
-        } else if (deptService.thisDeptIdIsParentIdChild(deptId, 369L) > 0){//双辽
-            ajax.put("mapDeptId", 369L);
-        } else if (deptService.thisDeptIdIsParentIdChild(deptId, 370L) > 0) {//伊通
-            ajax.put("mapDeptId", 370L);
-        } else if (deptService.thisDeptIdIsParentIdChild(deptId, 371L) > 0) {//梨树
-            ajax.put("mapDeptId", 371L);
-        } else if (deptService.thisDeptIdIsParentIdChild(deptId, 372L) > 0) {//铁东
-            ajax.put("mapDeptId", 372L);
-        } else if (deptService.thisDeptIdIsParentIdChild(deptId, 373L) > 0) {//铁西
-            ajax.put("mapDeptId", 373L);
-        }else{//四平
+        } else if (deptService.thisDeptIdIsParentIdChild(deptId, 314391L) > 0) {//敖勒召其镇
+            ajax.put("mapDeptId", 314391L);
+        } else if (deptService.thisDeptIdIsParentIdChild(deptId, 314392L) > 0) {//城川镇
+            ajax.put("mapDeptId", 314392L);
+        } else if (deptService.thisDeptIdIsParentIdChild(deptId, 314393L) > 0) {//昂素镇
+            ajax.put("mapDeptId", 314393L);
+        } else if (deptService.thisDeptIdIsParentIdChild(deptId, 314394L) > 0) {//上海庙镇
+            ajax.put("mapDeptId", 314394L);
+        } {//鄂托克前旗
             ajax.put("mapDeptId", 365L);
         }
         return ajax;
@@ -100,25 +95,20 @@ public class SysProfileController extends BaseController
     @ApiOperation(value = "修改用户个人信息", notes = "修改用户个人信息")
     @Log(title = "个人信息", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult updateProfile(@RequestBody SysUser user)
-    {
+    public AjaxResult updateProfile(@RequestBody SysUser user) {
         LoginUser loginUser = SecurityUtils.getLoginUser();
         SysUser sysUser = loginUser.getSysUser();
         user.setUserName(sysUser.getUserName());
         if (StringUtils.isNotEmpty(user.getPhonenumber())
-                && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
-        {
+                && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
             return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
-        }
-        else if (StringUtils.isNotEmpty(user.getEmail())
-                && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
-        {
+        } else if (StringUtils.isNotEmpty(user.getEmail())
+                && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
             return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
         }
         user.setUserId(sysUser.getUserId());
         user.setPassword(null);
-        if (userService.updateUserProfile(user) > 0)
-        {
+        if (userService.updateUserProfile(user) > 0) {
             // 更新缓存用户信息
             loginUser.getSysUser().setNickName(user.getNickName());
             loginUser.getSysUser().setPhonenumber(user.getPhonenumber());
@@ -136,24 +126,20 @@ public class SysProfileController extends BaseController
     @ApiOperation(value = "重置密码", notes = "重置密码")
     @Log(title = "个人信息", businessType = BusinessType.UPDATE)
     @PutMapping("/updatePwd")
-    public AjaxResult updatePwd(String oldPassword, String newPassword)
-    {
+    public AjaxResult updatePwd(String oldPassword, String newPassword) {
         String username = SecurityUtils.getUsername();
         SysUser user = userService.selectUserByUserName(username);
         String password = user.getPassword();
-        if (!SecurityUtils.matchesPassword(oldPassword, password))
-        {
+        if (!SecurityUtils.matchesPassword(oldPassword, password)) {
             return AjaxResult.error("修改密码失败,旧密码错误");
         }
-        if (SecurityUtils.matchesPassword(newPassword, password))
-        {
+        if (SecurityUtils.matchesPassword(newPassword, password)) {
             return AjaxResult.error("新密码不能与旧密码相同");
         }
         if (PassUtil.isStringPwd(newPassword).equals("0")) {
             return AjaxResult.error("密码必须大于等于8位,包含特殊字符,数字,大小写字母");
         }
-        if (userService.resetUserPwd(username, SecurityUtils.encryptPassword(newPassword)) > 0)
-        {
+        if (userService.resetUserPwd(username, SecurityUtils.encryptPassword(newPassword)) > 0) {
             // 更新缓存用户密码
             LoginUser loginUser = SecurityUtils.getLoginUser();
             loginUser.getSysUser().setPassword(SecurityUtils.encryptPassword(newPassword));
@@ -169,19 +155,15 @@ public class SysProfileController extends BaseController
     @ApiOperation(value = "头像上传", notes = "头像上传")
     @Log(title = "用户头像", businessType = BusinessType.UPDATE)
     @PostMapping("/avatar")
-    public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file)
-    {
-        if (!file.isEmpty())
-        {
+    public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) {
+        if (!file.isEmpty()) {
             LoginUser loginUser = SecurityUtils.getLoginUser();
             R<SysFile> fileResult = remoteFileService.upload(file);
-            if (StringUtils.isNull(fileResult) || StringUtils.isNull(fileResult.getData()))
-            {
+            if (StringUtils.isNull(fileResult) || StringUtils.isNull(fileResult.getData())) {
                 return AjaxResult.error("文件服务异常,请联系管理员");
             }
             String url = fileResult.getData().getUrl();
-            if (userService.updateUserAvatar(loginUser.getUsername(), url))
-            {
+            if (userService.updateUserAvatar(loginUser.getUsername(), url)) {
                 AjaxResult ajax = AjaxResult.success();
                 /**图片前缀**/
                 String uri = configService.selectConfigByKey("fileUrl");
@@ -202,23 +184,19 @@ public class SysProfileController extends BaseController
     @ApiOperation(value = "app重置密码", notes = "app重置密码")
     @Log(title = "个人信息", businessType = BusinessType.UPDATE)
     @PutMapping("/updateAppPwd")
-    public AjaxResult updateAppPwd(@RequestBody AppResetPwd appResetPwd)
-    {
+    public AjaxResult updateAppPwd(@RequestBody AppResetPwd appResetPwd) {
         SysUser user = userService.selectUserByUserName(appResetPwd.getUn());
         String password = user.getPassword();
-        if (!SecurityUtils.matchesPassword(appResetPwd.getOp(), password))
-        {
+        if (!SecurityUtils.matchesPassword(appResetPwd.getOp(), password)) {
             return AjaxResult.error("修改密码失败,旧密码错误");
         }
-        if (SecurityUtils.matchesPassword(appResetPwd.getNp(), password))
-        {
+        if (SecurityUtils.matchesPassword(appResetPwd.getNp(), password)) {
             return AjaxResult.error("新密码不能与旧密码相同");
         }
         if (PassUtil.isStringPwd(appResetPwd.getNp()).equals("0")) {
             return AjaxResult.error("密码必须大于等于8位,包含特殊字符,数字,大小写字母");
         }
-        if (userService.resetUserPwd(appResetPwd.getUn(), SecurityUtils.encryptPassword(appResetPwd.getNp())) > 0)
-        {
+        if (userService.resetUserPwd(appResetPwd.getUn(), SecurityUtils.encryptPassword(appResetPwd.getNp())) > 0) {
             // 更新缓存用户密码
             LoginUser loginUser = SecurityUtils.getLoginUser();
             loginUser.getSysUser().setPassword(SecurityUtils.encryptPassword(appResetPwd.getNp()));

+ 4 - 1
src/main/java/com/ruoyi/system/service/impl/SysReportServiceImpl.java

@@ -281,7 +281,10 @@ public class SysReportServiceImpl implements ISysReportService {
 
     }
 
-
+    /**
+     * 弃用
+     * @param doc
+     */
     private void renderLeaderAccountCount(Document doc) {
         Map leaderAccountCount = sysReportMapper.selectLeaderAccountCount();
         doc.replace("${account.leader.sx}", leaderAccountCount.get("sx").toString(), false, true);

+ 13 - 51
src/main/resources/mapper/system/SysDahuaOperLogCountMapper.xml

@@ -32,15 +32,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectSysDahuaOperLogCount" parameterType="SysDahuaOperLogCount" resultMap="SysDahuaOperLogCountResult">
         select * from (
         SELECT
-        '双辽市' dept_name,
+        '敖勒召其镇' dept_name,
         SUM(sys_oper_count) sys_oper_count,
         SUM(dh_oper_count) dh_oper_count,
         time
         FROM
         sys_dahua_oper_log_count
         WHERE
-        dept_id = 369
-        OR FIND_IN_SET(369, ancestors)
+        dept_id = 314391
+        OR FIND_IN_SET(314391, ancestors)
         <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
             and date_format(STR_TO_DATE(time, '%Y-%m'),'%Y-%m') &gt;= date_format(#{beginTime},'%Y-%m')
         </if>
@@ -49,15 +49,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
         UNION all
         SELECT
-        '伊通县' dept_name,
+        '城川镇' dept_name,
         SUM(sys_oper_count) sys_oper_count,
         SUM(dh_oper_count) dh_oper_count,
         time
         FROM
         sys_dahua_oper_log_count
         WHERE
-        dept_id = 370
-        OR FIND_IN_SET(370, ancestors)
+        dept_id = 314392
+        OR FIND_IN_SET(314392, ancestors)
         <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
             and date_format(STR_TO_DATE(time, '%Y-%m'),'%Y-%m') &gt;= date_format(#{beginTime},'%Y-%m')
         </if>
@@ -66,15 +66,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
         UNION all
         SELECT
-        '梨树县' dept_name,
+        '昂素镇' dept_name,
         SUM(sys_oper_count) sys_oper_count,
         SUM(dh_oper_count) dh_oper_count,
         time
         FROM
         sys_dahua_oper_log_count
         WHERE
-        dept_id = 371
-        OR FIND_IN_SET(371, ancestors)
+        dept_id = 314393
+        OR FIND_IN_SET(314393, ancestors)
         <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
             and date_format(STR_TO_DATE(time, '%Y-%m'),'%Y-%m') &gt;= date_format(#{beginTime},'%Y-%m')
         </if>
@@ -83,59 +83,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
         UNION all
         SELECT
-        '铁东区' dept_name,
+        '上海庙镇' dept_name,
         SUM(sys_oper_count) sys_oper_count,
         SUM(dh_oper_count) dh_oper_count,
         time
         FROM
         sys_dahua_oper_log_count
         WHERE
-        dept_id = 372
-        OR FIND_IN_SET(372, ancestors)
+        dept_id = 314394
+        OR FIND_IN_SET(314394, ancestors)
         <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
             and date_format(STR_TO_DATE(time, '%Y-%m'),'%Y-%m') &gt;= date_format(#{beginTime},'%Y-%m')
         </if>
         <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
             and date_format(STR_TO_DATE(time, '%Y-%m'),'%Y-%m') &lt;= date_format(#{endTime},'%Y-%m')
         </if>
-        UNION all
-        SELECT
-        '铁西区' dept_name,
-        SUM(sys_oper_count) sys_oper_count,
-        SUM(dh_oper_count) dh_oper_count,
-        time
-        FROM
-        sys_dahua_oper_log_count
-        WHERE
-        dept_id = 373
-        OR FIND_IN_SET(373, ancestors)
-        <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
-            and date_format(STR_TO_DATE(time, '%Y-%m'),'%Y-%m') &gt;= date_format(#{beginTime},'%Y-%m')
-        </if>
-        <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
-            and date_format(STR_TO_DATE(time, '%Y-%m'),'%Y-%m') &lt;= date_format(#{endTime},'%Y-%m')
-        </if>
-        <if test="list.size() > 0">
-            <foreach collection="list" item="item">
-                UNION all
-                SELECT
-                (SELECT DISTINCT dept_name from sys_dahua_oper_log_count where dept_id = #{item}) dept_name,
-                SUM(sys_oper_count) sys_oper_count,
-                SUM(dh_oper_count) dh_oper_count,
-                time
-                FROM
-                sys_dahua_oper_log_count
-                WHERE
-                dept_id = #{item}
-                OR FIND_IN_SET(#{item}, ancestors)
-                <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
-                    and date_format(STR_TO_DATE(time, '%Y-%m'),'%Y-%m') &gt;= date_format(#{beginTime},'%Y-%m')
-                </if>
-                <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
-                    and date_format(STR_TO_DATE(time, '%Y-%m'),'%Y-%m') &lt;= date_format(#{endTime},'%Y-%m')
-                </if>
-            </foreach>
-        </if>
         )tab
     </select>
     <select id="selectSysDahuaOperLogCountDeptId" resultType="java.lang.Long">
@@ -144,7 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM
         `sys_dahua_oper_log_count`
         WHERE
-        parent_id = 365 and dept_id not in (369, 370, 371, 372, 373)
+        parent_id = 365 and dept_id not in (314391, 314392, 31439, 314394)
         <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
             and date_format(STR_TO_DATE(time, '%Y-%m'),'%Y-%m') &gt;= date_format(#{beginTime},'%Y-%m')
         </if>

+ 280 - 401
src/main/resources/mapper/system/SysUserMapper.xml

@@ -897,7 +897,7 @@
             FROM sys_user u
             LEFT JOIN sys_user_dept ud ON u.user_id = ud.user_id
             LEFT JOIN sys_dept d ON ud.dept_id = d.dept_id
-            WHERE d.dept_id IN (365,367,3772,3773,3774,3775,3776,3777,3778,369,371,370,372,373,14450,14449,144451)
+            WHERE d.dept_id IN (365,314391,314392,314393,314394)
                  AND u.del_flag = 0
             GROUP BY u.user_id
         ) s
@@ -923,7 +923,7 @@
             FROM sys_user u
             LEFT JOIN sys_user_dept ud ON u.user_id = ud.user_id
             LEFT JOIN sys_dept d ON ud.dept_id = d.dept_id
-            WHERE d.dept_id IN (369, 370, 371, 372, 373)
+            WHERE d.dept_id IN (314391,314392,314393,314394)
                  AND u.del_flag = 0
             GROUP BY u.user_id
         ) s
@@ -931,242 +931,261 @@
 
     <select id="selectMaintenanceCenterHomepageList" resultMap="SysUserResult">
         SELECT
-          a.NAME,
-          a.count,
-          b.count AS active_count
-        FROM (
-            SELECT
-                "市直部门" AS NAME,
-                a.count AS count
-            FROM (
-                SELECT (
-                    count(((a.dept_id = 365) OR NULL))  +
-                    count(((a.dept_id = 367) OR FIND_IN_SET(367,a.ancestors) OR NULL))  +
-                    count(((a.dept_id = 3776) OR FIND_IN_SET(3776,a.ancestors) OR NULL))  +
-                    count(((a.dept_id = 3778) OR FIND_IN_SET(3778,a.ancestors) OR NULL))  +
-                    count(((a.dept_id = 3773) OR FIND_IN_SET(3773,a.ancestors) OR NULL))  +
-					count(((a.dept_id = 14450)OR FIND_IN_SET(14450, a.ancestors)OR NULL)) +
-					count(((a.dept_id = 14449)OR FIND_IN_SET(14449, a.ancestors)OR NULL)) +
-					count(((a.dept_id = 14451)OR FIND_IN_SET(14451, a.ancestors)OR NULL)) +
-                    count(((a.dept_id = 3774) OR FIND_IN_SET(3774,a.ancestors) OR NULL))  +
-                    count(((a.dept_id = 3775) OR FIND_IN_SET(3775,a.ancestors) OR NULL))  +
-                    count(((a.dept_id = 3772) OR FIND_IN_SET(3772,a.ancestors) OR NULL))  +
-                    count(((a.dept_id = 3777) OR FIND_IN_SET(3777,a.ancestors) OR NULL))
-                ) as count
-                FROM sys_user AS u
-                LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
-                LEFT JOIN sys_dept AS a ON ud.dept_id = a.dept_id
-                WHERE u.del_flag = 0
-            ) a
-                UNION
-            SELECT
-                "铁东区" AS NAME,
-                a.count AS count
-            FROM (
-                SELECT
-                    (count(((a.dept_id = 372) OR FIND_IN_SET(372,a.ancestors) OR NULL)))as count
-                FROM sys_user AS u
-                LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
-                LEFT JOIN sys_dept AS a ON ud.dept_id = a.dept_id
-                WHERE u.del_flag = 0
-            )a
-                UNION
-            SELECT
-                "铁西区" AS NAME,
-                a.count AS count
-            FROM (
-                SELECT
-                    (count(((a.dept_id = 373) OR FIND_IN_SET(373,a.ancestors) OR NULL)))as count
-                FROM sys_user AS u
-                LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
-                LEFT JOIN sys_dept AS a ON ud.dept_id = a.dept_id
-                WHERE
-                   u.del_flag = 0
-            )a
-                UNION
-            SELECT
-                "梨树县" AS NAME,
-                a.count AS count
-            FROM (
-                SELECT
-                    (count(((a.dept_id = 371) OR FIND_IN_SET(371,a.ancestors) OR NULL)))as count
-                FROM sys_user AS u
-                LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
-                LEFT JOIN sys_dept AS a ON ud.dept_id = a.dept_id
-                WHERE u.del_flag = 0
-            )a
-                UNION
-            SELECT
-                "双辽市" AS NAME,
-                a.count AS count
-            FROM (
-                SELECT
-                    (count(((a.dept_id = 369) OR FIND_IN_SET(369,a.ancestors) OR NULL)))as count
-                FROM sys_user AS u
-                LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
-                LEFT JOIN sys_dept AS a ON ud.dept_id = a.dept_id
-                WHERE u.del_flag = 0
-            )a
-                UNION
-            SELECT
-                "伊通县" AS NAME,
-                sum(a.count) AS count
-            FROM (
+            a.NAME,
+            a.count,
+            b.count AS active_count
+        FROM
+            (
                 SELECT
-                    (count(((a.dept_id = 370) OR FIND_IN_SET(370,a.ancestors) OR NULL)))as count
-                FROM sys_user AS u
-                LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
-                LEFT JOIN sys_dept AS a ON ud.dept_id = a.dept_id
-                WHERE  u.del_flag = 0
-                GROUP BY u.user_id
-            )a
-        ) a
-        LEFT JOIN (
-            SELECT
-                "市直部门" AS NAME,
-                a.count AS count
-            FROM (
-                SELECT (
-                    count(((a.dept_id = 365) OR NULL)) + count(((a.dept_id = 367)OR FIND_IN_SET(367, a.ancestors)OR NULL)) +
-                    count(((a.dept_id = 3776)OR FIND_IN_SET(3776, a.ancestors)OR NULL)) +
-                    count(((a.dept_id = 3778)OR FIND_IN_SET(3778, a.ancestors)OR NULL)) +
-                    count(((a.dept_id = 3773)OR FIND_IN_SET(3773, a.ancestors)OR NULL)) +
-					count(((a.dept_id = 14450)OR FIND_IN_SET(14450, a.ancestors)OR NULL)) +
-					count(((a.dept_id = 14449)OR FIND_IN_SET(14449, a.ancestors)OR NULL)) +
-					count(((a.dept_id = 14451)OR FIND_IN_SET(14451, a.ancestors)OR NULL)) +
-                    count(((a.dept_id = 3774)OR FIND_IN_SET(3774, a.ancestors)OR NULL)) +
-                    count(((a.dept_id = 3775)OR FIND_IN_SET(3775, a.ancestors)OR NULL)) +
-                    count(((a.dept_id = 3772)OR FIND_IN_SET(3772, a.ancestors)OR NULL)) +
-                    count(((a.dept_id = 3777)OR FIND_IN_SET(3777, a.ancestors)OR NULL))
-                    ) as count
-                FROM (
+                    "旗直部门" AS NAME,
+                    a.count AS count
+                FROM
+                    (
                     SELECT
-                        u.user_id,
-                        d.dept_id,
-                        d.parent_id,
-                        d.ancestors
-                    FROM (
-                        SELECT DISTINCT
-                            user_name
-                        FROM
-                            sys_logininfor
-                        ) l
+                    (
+                    count(((
+                    a.dept_id = 365
+                    )
+                    OR NULL
+                    )) + count(((
+                    a.dept_id = 314391
+                    )
+                    OR FIND_IN_SET( 314391, a.ancestors )
+                    OR NULL
+                    )) + count(((
+                    a.dept_id = 314392
+                    )
+                    OR FIND_IN_SET( 314392, a.ancestors )
+                    OR NULL
+                    )) + count(((
+                    a.dept_id = 314393
+                    )
+                    OR FIND_IN_SET( 314393, a.ancestors )
+                    OR NULL
+                    )) + count(((
+                    a.dept_id = 314394
+                    )
+                    OR FIND_IN_SET( 314394, a.ancestors )
+                    OR NULL
+                    ))
+                    ) AS count
+                    FROM
+                    (
+                    SELECT
+                    u.user_id,
+                    d.dept_id,
+                    d.parent_id,
+                    d.ancestors
+                    FROM
+                    ( SELECT DISTINCT user_name FROM sys_logininfor ) l
                     LEFT JOIN sys_user u ON l.user_name = u.user_name
                     LEFT JOIN sys_user_dept ud ON u.user_id = ud.user_id
                     LEFT JOIN sys_dept d ON ud.dept_id = d.dept_id
                     WHERE
-                        u.del_flag = 0
+                    u.del_flag = 0
                     GROUP BY
-                        u.user_id
-                ) a
-            ) a
-                UNION
-            SELECT
-                "铁东区" AS NAME,
-                count(user_name) AS count
-            FROM (
+                    u.user_id
+                    ) a
+                    ) a UNION
                 SELECT
+                    "敖勒召其镇" AS NAME,
+                    count( user_name ) AS count
+                FROM
+                    (
+                    SELECT
                     a.user_name
-                FROM (
+                    FROM
+                    ( SELECT user_name FROM sys_logininfor WHERE 1 = 1 AND STATUS = 0 GROUP BY user_name ) a
+                    LEFT JOIN sys_user AS u ON a.user_name = u.user_name
+                    LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
+                    LEFT JOIN sys_dept AS d ON ud.dept_id = d.dept_id
+                    WHERE
+                    d.dept_id = 314391
+                    OR FIND_IN_SET( 314391, d.ancestors )
+                    AND u.del_flag = 0
+                    GROUP BY
+                    u.user_id
+                    ) a UNION
+                SELECT
+                    "城川镇" AS NAME,
+                    count( user_name ) AS count
+                FROM
+                    (
                     SELECT
-                        user_name
-                    FROM sys_logininfor
-                    WHERE 1 = 1 AND status = 0
-                    GROUP BY user_name
-                ) a
-                LEFT JOIN sys_user AS u ON a.user_name = u.user_name
-                LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
-                LEFT JOIN sys_dept AS d ON ud.dept_id = d.dept_id
-                WHERE d.dept_id = 372 OR FIND_IN_SET(372, d.ancestors)
-                AND u.del_flag = 0
-                GROUP BY u.user_id
-            ) a
-                UNION
-            SELECT
-                "铁西区" AS NAME,
-                count(user_name) AS count
-            FROM (
+                    a.user_name
+                    FROM
+                    ( SELECT user_name FROM sys_logininfor WHERE 1 = 1 AND STATUS = 0 GROUP BY user_name ) a
+                    LEFT JOIN sys_user AS u ON a.user_name = u.user_name
+                    LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
+                    LEFT JOIN sys_dept AS d ON ud.dept_id = d.dept_id
+                    WHERE
+                    d.dept_id = 314392
+                    OR FIND_IN_SET( 314392, d.ancestors )
+                    AND u.del_flag = 0
+                    GROUP BY
+                    u.user_id
+                    ) a UNION
                 SELECT
+                    "昂素镇" AS NAME,
+                    count( user_name ) AS count
+                FROM
+                    (
+                    SELECT
                     a.user_name
-                FROM (
+                    FROM
+                    ( SELECT user_name FROM sys_logininfor WHERE 1 = 1 AND STATUS = 0 GROUP BY user_name ) a
+                    LEFT JOIN sys_user AS u ON a.user_name = u.user_name
+                    LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
+                    LEFT JOIN sys_dept AS d ON ud.dept_id = d.dept_id
+                    WHERE
+                    d.dept_id = 314393
+                    OR FIND_IN_SET( 314393, d.ancestors )
+                    AND u.del_flag = 0
+                    GROUP BY
+                    u.user_id
+                    ) a UNION
+                SELECT
+                    "上海庙镇" AS NAME,
+                    count( user_name ) AS count
+                FROM
+                    (
                     SELECT
-                        user_name
-                    FROM sys_logininfor
-                    WHERE 1 = 1 AND status = 0
-                    GROUP BY user_name
-                ) a
-                LEFT JOIN sys_user AS u ON a.user_name = u.user_name
-                LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
-                LEFT JOIN sys_dept AS d ON ud.dept_id = d.dept_id
-                WHERE d.dept_id = 373 OR FIND_IN_SET(373, d.ancestors)
-                AND u.del_flag = 0
-                GROUP BY u.user_id
+                    a.user_name
+                    FROM
+                    ( SELECT user_name FROM sys_logininfor WHERE 1 = 1 AND STATUS = 0 GROUP BY user_name ) a
+                    LEFT JOIN sys_user AS u ON a.user_name = u.user_name
+                    LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
+                    LEFT JOIN sys_dept AS d ON ud.dept_id = d.dept_id
+                    WHERE
+                    d.dept_id = 314394
+                    OR FIND_IN_SET( 314394, d.ancestors )
+                    AND u.del_flag = 0
+                    GROUP BY
+                    u.user_id
+                    ) a
             ) a
-                UNION
-            SELECT
-                "梨树县" AS NAME,
-                count(user_name) AS count
-            FROM (
+                LEFT JOIN (
                 SELECT
-                    a.user_name
-                FROM (
+                    "旗直部门" AS NAME,
+                    a.count AS count
+                FROM
+                    (
                     SELECT
-                        user_name
-                    FROM sys_logininfor
-                    WHERE 1 = 1 AND status = 0
-                    GROUP BY user_name
-                ) a
-                LEFT JOIN sys_user AS u ON a.user_name = u.user_name
-                LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
-                LEFT JOIN sys_dept AS d ON ud.dept_id = d.dept_id
-                WHERE d.dept_id = 371 OR FIND_IN_SET(371, d.ancestors)
-                AND u.del_flag = 0
-                GROUP BY u.user_id
-            ) a
-                UNION
-            SELECT
-                "双辽市" AS NAME,
-                count(user_name) AS count
-            FROM (
+                    (
+                    count(((
+                    a.dept_id = 365
+                    )
+                    OR NULL
+                    )) + count(((
+                    a.dept_id = 314391
+                    )
+                    OR FIND_IN_SET( 367, a.ancestors )
+                    OR NULL
+                    )) + count(((
+                    a.dept_id = 314392
+                    )
+                    OR FIND_IN_SET( 3776, a.ancestors )
+                    OR NULL
+                    )) + count(((
+                    a.dept_id = 314393
+                    )
+                    OR FIND_IN_SET( 3778, a.ancestors )
+                    OR NULL
+                    )) + count(((
+                    a.dept_id = 314394
+                    )
+                    OR FIND_IN_SET( 3777, a.ancestors )
+                    OR NULL
+                    ))
+                    ) AS count
+                    FROM
+                    sys_user AS u
+                    LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
+                    LEFT JOIN sys_dept AS a ON ud.dept_id = a.dept_id
+                    WHERE
+                    u.del_flag = 0
+                    ) a UNION
                 SELECT
-                    a.user_name
-                FROM (
+                    "敖勒召其镇" AS NAME,
+                    a.count AS count
+                FROM
+                    (
                     SELECT
-                        user_name
-                    FROM sys_logininfor
-                    WHERE 1 = 1 AND status = 0
-                    GROUP BY user_name
-                ) a
-                LEFT JOIN sys_user AS u ON a.user_name = u.user_name
-                LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
-                LEFT JOIN sys_dept AS d ON ud.dept_id = d.dept_id
-                WHERE d.dept_id = 369 OR FIND_IN_SET(369, d.ancestors)
-                AND u.del_flag = 0
-                GROUP BY u.user_id
-            ) a
-                UNION
-            SELECT
-                "伊通县" AS NAME,
-                count(a.user_name) AS count
-            FROM(
+                    (
+                    count(((
+                    a.dept_id = 314391
+                    )
+                    OR FIND_IN_SET( 314391, a.ancestors )
+                    OR NULL
+                    ))) AS count
+                    FROM
+                    sys_user AS u
+                    LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
+                    LEFT JOIN sys_dept AS a ON ud.dept_id = a.dept_id
+                    WHERE
+                    u.del_flag = 0
+                    ) a UNION
                 SELECT
-                    a.user_name
-                FROM (
+                    "城川镇" AS NAME,
+                    a.count AS count
+                FROM
+                    (
                     SELECT
-                        user_name
-                    FROM sys_logininfor
-                    WHERE 1 = 1 AND status = 0
-                    GROUP BY user_name
-                ) a
-                LEFT JOIN sys_user AS u ON a.user_name = u.user_name
-                LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
-                LEFT JOIN sys_dept AS d ON ud.dept_id = d.dept_id
-                WHERE d.dept_id = 370 OR FIND_IN_SET(370, d.ancestors)
-                AND u.del_flag = 0
-                GROUP BY u.user_id
-            )a
-        ) b
-        ON a.NAME = b.NAME
+                    (
+                    count(((
+                    a.dept_id = 314392
+                    )
+                    OR FIND_IN_SET( 314392, a.ancestors )
+                    OR NULL
+                    ))) AS count
+                    FROM
+                    sys_user AS u
+                    LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
+                    LEFT JOIN sys_dept AS a ON ud.dept_id = a.dept_id
+                    WHERE
+                    u.del_flag = 0
+                    ) a UNION
+                SELECT
+                    "昂素镇" AS NAME,
+                    a.count AS count
+                FROM
+                    (
+                    SELECT
+                    (
+                    count(((
+                    a.dept_id = 314393
+                    )
+                    OR FIND_IN_SET( 314393, a.ancestors )
+                    OR NULL
+                    ))) AS count
+                    FROM
+                    sys_user AS u
+                    LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
+                    LEFT JOIN sys_dept AS a ON ud.dept_id = a.dept_id
+                    WHERE
+                    u.del_flag = 0
+                    ) a UNION
+                SELECT
+                    "上海庙镇" AS NAME,
+                    a.count AS count
+                FROM
+                    (
+                    SELECT
+                    (
+                    count(((
+                    a.dept_id = 314394
+                    )
+                    OR FIND_IN_SET( 314394, a.ancestors )
+                    OR NULL
+                    ))) AS count
+                    FROM
+                    sys_user AS u
+                    LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
+                    LEFT JOIN sys_dept AS a ON ud.dept_id = a.dept_id
+                    WHERE
+                    u.del_flag = 0
+                    ) a
+            ) b ON a.NAME = b.NAME
     </select>
 
 
@@ -1224,7 +1243,7 @@
         FROM
             (
                 SELECT
-                    "直部门" AS NAME,
+                    "直部门" AS NAME,
                     a.count AS count
                 FROM
                     (
@@ -1232,68 +1251,26 @@
                             (
                                 count(((a.dept_id = 365) OR NULL)) + count(
                                     (
-                                        (a.dept_id = 367)
-                                        OR FIND_IN_SET(367, a.ancestors)
-                                        OR NULL
-                                    )
-                                ) + count(
-                                    (
-                                        (a.dept_id = 3776)
-                                        OR FIND_IN_SET(3776, a.ancestors)
+                                        (a.dept_id = 314391)
+                                        OR FIND_IN_SET(314391, a.ancestors)
                                         OR NULL
                                     )
                                 ) + count(
                                     (
-                                        (a.dept_id = 3778)
-                                        OR FIND_IN_SET(3778, a.ancestors)
+                                        (a.dept_id = 314392)
+                                        OR FIND_IN_SET(314392, a.ancestors)
                                         OR NULL
                                     )
                                 ) + count(
                                     (
-                                        (a.dept_id = 3773)
-                                        OR FIND_IN_SET(3773, a.ancestors)
+                                        (a.dept_id = 314393)
+                                        OR FIND_IN_SET(314393, a.ancestors)
                                         OR NULL
                                     )
                                 ) + count(
                                     (
-                                        (a.dept_id = 3774)
-                                        OR FIND_IN_SET(3774, a.ancestors)
-                                        OR NULL
-                                    )
-                                ) + count(
-                                    (
-                                        (a.dept_id = 3775)
-                                        OR FIND_IN_SET(3775, a.ancestors)
-                                        OR NULL
-                                    )
-                                ) + count(
-                                    (
-                                        (a.dept_id = 3772)
-                                        OR FIND_IN_SET(3772, a.ancestors)
-                                        OR NULL
-                                    )
-                                ) + count(
-                                    (
-                                        (a.dept_id = 3777)
-                                        OR FIND_IN_SET(3777, a.ancestors)
-                                        OR NULL
-                                    )
-                                )+ count(
-                                    (
-                                        (a.dept_id = 14450)
-                                        OR FIND_IN_SET(14450, a.ancestors)
-                                        OR NULL
-                                    )
-                                )+ count(
-                                    (
-                                        (a.dept_id = 14449)
-                                        OR FIND_IN_SET(14449, a.ancestors)
-                                        OR NULL
-                                    )
-                                )+ count(
-                                    (
-                                        (a.dept_id = 14451)
-                                        OR FIND_IN_SET(14451, a.ancestors)
+                                        (a.dept_id = 314394)
+                                        OR FIND_IN_SET(314394, a.ancestors)
                                         OR NULL
                                     )
                                 )
@@ -1307,7 +1284,7 @@
                     ) a
                 UNION
                     SELECT
-                        "铁东区" AS NAME,
+                        "敖勒召其镇" AS NAME,
                         a.count AS count
                     FROM
                         (
@@ -1315,8 +1292,8 @@
                                 (
                                     count(
                                         (
-                                            (a.dept_id = 372)
-                                            OR FIND_IN_SET(372, a.ancestors)
+                                            (a.dept_id = 314391)
+                                            OR FIND_IN_SET(314391, a.ancestors)
                                             OR NULL
                                         )
                                     )
@@ -1330,7 +1307,7 @@
                         ) a
                     UNION
                         SELECT
-                            "铁西区" AS NAME,
+                            "城川镇" AS NAME,
                             a.count AS count
                         FROM
                             (
@@ -1338,8 +1315,8 @@
                                     (
                                         count(
                                             (
-                                                (a.dept_id = 373)
-                                                OR FIND_IN_SET(373, a.ancestors)
+                                                (a.dept_id = 314392)
+                                                OR FIND_IN_SET(314392, a.ancestors)
                                                 OR NULL
                                             )
                                         )
@@ -1353,7 +1330,7 @@
                             ) a
                         UNION
                             SELECT
-                                "梨树县" AS NAME,
+                                "昂素镇" AS NAME,
                                 a.count AS count
                             FROM
                                 (
@@ -1361,8 +1338,8 @@
                                         (
                                             count(
                                                 (
-                                                    (a.dept_id = 371)
-                                                    OR FIND_IN_SET(371, a.ancestors)
+                                                    (a.dept_id = 314393)
+                                                    OR FIND_IN_SET(314393, a.ancestors)
                                                     OR NULL
                                                 )
                                             )
@@ -1376,7 +1353,7 @@
                                 ) a
                             UNION
                                 SELECT
-                                    "双辽市" AS NAME,
+                                    "上海庙镇" AS NAME,
                                     a.count AS count
                                 FROM
                                     (
@@ -1384,8 +1361,8 @@
                                             (
                                                 count(
                                                     (
-                                                        (a.dept_id = 369)
-                                                        OR FIND_IN_SET(369, a.ancestors)
+                                                        (a.dept_id = 314394)
+                                                        OR FIND_IN_SET(314394, a.ancestors)
                                                         OR NULL
                                                     )
                                                 )
@@ -1397,35 +1374,11 @@
                                         WHERE
                                             u.del_flag = 0
                                     ) a
-                                UNION
-                                    SELECT
-                                        "伊通县" AS NAME,
-                                        sum(a.count) AS count
-                                    FROM
-                                        (
-                                            SELECT
-                                                (
-                                                    --         count(((a.dept_id = 370) OR FIND_IN_SET(370,a.ancestors) OR NULL))
-                                                    count(*)
-                                                ) AS count
-                                            FROM
-                                                sys_user AS u
-                                            LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
-                                            LEFT JOIN sys_dept AS a ON ud.dept_id = a.dept_id
-                                            WHERE
-                                                u.del_flag = 0
-                                            AND (
-                                                (a.dept_id = 370)
-                                                OR FIND_IN_SET(370, a.ancestors)
-                                                OR NULL
-                                            )
-                                            GROUP BY
-                                                u.user_id
-                                        ) a
+
             ) a
         LEFT JOIN (
             SELECT
-                "直部门" AS NAME,
+                "旗直部门" AS NAME,
                 a.count AS count
             FROM
                 (
@@ -1433,68 +1386,26 @@
                         (
                             count(((a.dept_id = 365) OR NULL)) + count(
                                 (
-                                    (a.dept_id = 367)
-                                    OR FIND_IN_SET(367, a.ancestors)
-                                    OR NULL
-                                )
-                            ) + count(
-                                (
-                                    (a.dept_id = 3776)
-                                    OR FIND_IN_SET(3776, a.ancestors)
-                                    OR NULL
-                                )
-                            ) + count(
-                                (
-                                    (a.dept_id = 3778)
-                                    OR FIND_IN_SET(3778, a.ancestors)
-                                    OR NULL
-                                )
-                            ) + count(
-                                (
-                                    (a.dept_id = 3773)
-                                    OR FIND_IN_SET(3773, a.ancestors)
-                                    OR NULL
-                                )
-                            ) + count(
-                                (
-                                    (a.dept_id = 3774)
-                                    OR FIND_IN_SET(3774, a.ancestors)
+                                    (a.dept_id = 314391)
+                                    OR FIND_IN_SET(314391, a.ancestors)
                                     OR NULL
                                 )
                             ) + count(
                                 (
-                                    (a.dept_id = 3775)
-                                    OR FIND_IN_SET(3775, a.ancestors)
+                                    (a.dept_id = 314392)
+                                    OR FIND_IN_SET(314392, a.ancestors)
                                     OR NULL
                                 )
                             ) + count(
                                 (
-                                    (a.dept_id = 3772)
-                                    OR FIND_IN_SET(3772, a.ancestors)
-                                    OR NULL
-                                )
-                            ) + count(
-                                (
-                                    (a.dept_id = 3777)
-                                    OR FIND_IN_SET(3777, a.ancestors)
-                                    OR NULL
-                                )
-                            )+ count(
-                                (
-                                    (a.dept_id = 14450)
-                                    OR FIND_IN_SET(14450, a.ancestors)
-                                    OR NULL
-                                )
-                            )+ count(
-                                (
-                                    (a.dept_id = 14449)
-                                    OR FIND_IN_SET(14449, a.ancestors)
+                                    (a.dept_id = 314393)
+                                    OR FIND_IN_SET(314393, a.ancestors)
                                     OR NULL
                                 )
                             )+ count(
                                 (
-                                    (a.dept_id = 14451)
-                                    OR FIND_IN_SET(14451, a.ancestors)
+                                    (a.dept_id = 314394)
+                                    OR FIND_IN_SET(314394, a.ancestors)
                                     OR NULL
                                 )
                             )
@@ -1524,7 +1435,7 @@
                 ) a
             UNION
                 SELECT
-                    "铁东区" AS NAME,
+                    "敖勒召其镇" AS NAME,
                     count(user_name) AS count
                 FROM
                     (
@@ -1547,8 +1458,8 @@
                         LEFT JOIN sys_dept AS d ON ud.dept_id = d.dept_id
                         WHERE
                             (
-                                d.dept_id = 372
-                                OR FIND_IN_SET(372, d.ancestors)
+                                d.dept_id = 314391
+                                OR FIND_IN_SET(314391, d.ancestors)
                             )
                         AND u.del_flag = 0
                         GROUP BY
@@ -1556,7 +1467,7 @@
                     ) a
                 UNION
                     SELECT
-                        "铁西区" AS NAME,
+                        "城川镇" AS NAME,
                         count(user_name) AS count
                     FROM
                         (
@@ -1579,8 +1490,8 @@
                             LEFT JOIN sys_dept AS d ON ud.dept_id = d.dept_id
                             WHERE
                                 (
-                                    d.dept_id = 373
-                                    OR FIND_IN_SET(373, d.ancestors)
+                                    d.dept_id = 314392
+                                    OR FIND_IN_SET(314392, d.ancestors)
                                 )
                             AND u.del_flag = 0
                             GROUP BY
@@ -1588,7 +1499,7 @@
                         ) a
                     UNION
                         SELECT
-                            "梨树县" AS NAME,
+                            "昂素镇" AS NAME,
                             count(user_name) AS count
                         FROM
                             (
@@ -1611,8 +1522,8 @@
                                 LEFT JOIN sys_dept AS d ON ud.dept_id = d.dept_id
                                 WHERE
                                     (
-                                        d.dept_id = 371
-                                        OR FIND_IN_SET(371, d.ancestors)
+                                        d.dept_id = 314393
+                                        OR FIND_IN_SET(314393, d.ancestors)
                                     )
                                 AND u.del_flag = 0
                                 GROUP BY
@@ -1620,7 +1531,7 @@
                             ) a
                         UNION
                             SELECT
-                                "双辽市" AS NAME,
+                                "上海庙镇" AS NAME,
                                 count(user_name) AS count
                             FROM
                                 (
@@ -1643,45 +1554,13 @@
                                     LEFT JOIN sys_dept AS d ON ud.dept_id = d.dept_id
                                     WHERE
                                         (
-                                            d.dept_id = 369
-                                            OR FIND_IN_SET(369, d.ancestors)
+                                            d.dept_id = 314394
+                                            OR FIND_IN_SET(314394, d.ancestors)
                                         )
                                     AND u.del_flag = 0
                                     GROUP BY
                                         u.user_id
                                 ) a
-                            UNION
-                                SELECT
-                                    "伊通县" AS NAME,
-                                    count(a.user_name) AS count
-                                FROM
-                                    (
-                                        SELECT
-                                            a.user_name
-                                        FROM
-                                            (
-                                                SELECT
-                                                    user_name
-                                                FROM
-                                                    sys_logininfor
-                                                WHERE
-                                                    1 = 1
-                                                AND STATUS = 0
-                                                GROUP BY
-                                                    user_name
-                                            ) a
-                                        LEFT JOIN sys_user AS u ON a.user_name = u.user_name
-                                        LEFT JOIN sys_user_dept AS ud ON u.user_id = ud.user_id
-                                        LEFT JOIN sys_dept AS d ON ud.dept_id = d.dept_id
-                                        WHERE
-                                            (
-                                                d.dept_id = 370
-                                                OR FIND_IN_SET(370, d.ancestors)
-                                            )
-                                        AND u.del_flag = 0
-                                        GROUP BY
-                                            u.user_id
-                                    ) a
         ) b ON a. NAME = b. NAME
 
     </select>

+ 3 - 3
system_ui/src/views/index.vue

@@ -25,13 +25,13 @@
             <span class="button-text">活跃用户数 {{countData[1].count}}</span>
           </el-card>
           <el-card class="box-card" style="margin-top: 9px;height: 85px;text-align: center;line-height: 45px;">
-            <a class="button-text">县级领导账号数 {{countData[2].count}}</a>
+            <a class="button-text">县级领导账号数 {{countData[2].count}}</a>
           </el-card>
           <el-card class="box-card" style="margin-top: 9px;height: 85px;text-align: center;line-height: 45px;">
-            <a class="button-text" >本级领导账号数 {{countData[3].count}}</a>
+            <a class="button-text" >本级领导账号数 {{countData[3].count}}</a>
           </el-card>
           <el-card class="box-card" style="margin-top: 9px;height: 85px;text-align: center;line-height: 45px;">
-            <a class="button-text">县()区领导账号数 {{countData[4].count}}</a>
+            <a class="button-text">县()区领导账号数 {{countData[4].count}}</a>
           </el-card>
 
       </el-col>