Yansen 2 лет назад
Родитель
Сommit
07c1c813a8

+ 2
- 1
src/main/java/com/example/civilizedcity/common/Constants.java Просмотреть файл

@@ -57,7 +57,8 @@ public class Constants {
57 57
 
58 58
     // 流程起始: 待交办
59 59
     public final static String PROCESS_START = "start";
60
-    public final static String PROCESS_RESTART = "restart";
60
+    // 流程: 被打回 - 市民提交
61
+    public final static String PROCESS_REJECT = "reject";
61 62
 
62 63
     // 审核
63 64
     public final static String PROCESS_VERIFY = "verify";

+ 48
- 0
src/main/java/com/example/civilizedcity/controller/StatController.java Просмотреть файл

@@ -0,0 +1,48 @@
1
+package com.example.civilizedcity.controller;
2
+
3
+import com.example.civilizedcity.common.BaseController;
4
+import com.example.civilizedcity.common.ResponseBean;
5
+import com.example.civilizedcity.entity.SysUser;
6
+import com.example.civilizedcity.entity.TaPerson;
7
+import com.example.civilizedcity.service.TaIssueService;
8
+import com.example.civilizedcity.vo.StatVo;
9
+import io.swagger.annotations.ApiOperation;
10
+import io.swagger.annotations.ApiParam;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.web.bind.annotation.GetMapping;
13
+import org.springframework.web.bind.annotation.RequestParam;
14
+import org.springframework.web.bind.annotation.RestController;
15
+
16
+import java.util.List;
17
+
18
+/**
19
+ * 查询统计
20
+ */
21
+@RestController
22
+public class StatController extends BaseController {
23
+
24
+    @Autowired
25
+    TaIssueService taIssueService;
26
+
27
+    @ApiOperation("小程序首页查询统计")
28
+    @GetMapping("/ma/index-stat")
29
+    public ResponseBean getMaIndex(@ApiParam("身份") @RequestParam(value = "duty", required = false) String duty) throws Exception {
30
+        SysUser user = null;
31
+        TaPerson person = null;
32
+
33
+        try {
34
+            user = currentUser();
35
+        } catch (Exception e) {
36
+            //
37
+        }
38
+        try {
39
+            person = currentPerson();
40
+        } catch (Exception e) {
41
+            //
42
+        }
43
+
44
+        List<StatVo> result = taIssueService.statMaIndex(user, duty);
45
+
46
+        return ResponseBean.success(result);
47
+    }
48
+}

+ 62
- 55
src/main/java/com/example/civilizedcity/controller/SysUserController.java Просмотреть файл

@@ -16,6 +16,7 @@ import com.example.civilizedcity.entity.SysResource;
16 16
 import com.example.civilizedcity.entity.SysRole;
17 17
 import com.example.civilizedcity.service.SysResourceService;
18 18
 import com.example.civilizedcity.service.SysRoleService;
19
+import com.example.civilizedcity.service.SysUserDutyService;
19 20
 import io.swagger.annotations.Api;
20 21
 import io.swagger.annotations.ApiOperation;
21 22
 import io.swagger.annotations.ApiParam;
@@ -24,8 +25,9 @@ import org.springframework.web.bind.annotation.*;
24 25
 import com.example.civilizedcity.entity.SysUser;
25 26
 import com.example.civilizedcity.service.SysUserService;
26 27
 
27
- /**
28
+/**
28 29
  * 用户表;(sys_user)表控制层
30
+ *
29 31
  * @author : http://njyunzhi.com
30 32
  * @date : 2022-12-12
31 33
  */
@@ -35,13 +37,16 @@ import com.example.civilizedcity.service.SysUserService;
35 37
 public class SysUserController extends BaseController {
36 38
 
37 39
     @Autowired
38
-     SysRoleService sysRoleService;
40
+    SysRoleService sysRoleService;
39 41
 
40 42
     @Autowired
41
-     SysResourceService sysResourceService;
43
+    SysResourceService sysResourceService;
42 44
 
43
-    /** 
44
-     * 通过ID查询单条数据 
45
+    @Autowired
46
+    SysUserDutyService sysUserDutyService;
47
+
48
+    /**
49
+     * 通过ID查询单条数据
45 50
      *
46 51
      * @param userId 主键
47 52
      * @return 实例对象
@@ -57,33 +62,35 @@ public class SysUserController extends BaseController {
57 62
         return ResponseBean.success(getPermissions(sysUser));
58 63
     }
59 64
 
60
-     /**
61
-      * 查询当前人员
62
-      *
63
-      * @param
64
-      * @return 实例对象
65
-      */
66
-     @ApiOperation("查询当前人员")
67
-     @GetMapping("/sysUser/current")
68
-     public ResponseBean current() throws Exception {
69
-         SysUser sysUser = currentUser();
70
-         return ResponseBean.success(getPermissions(sysUser));
71
-     }
72
-
73
-     private SysUser getPermissions(SysUser sysUser) {
74
-         List<SysRole> rolesList = sysRoleService.getByUser(sysUser.getUserId());
75
-         List<SysResource> resourcesList = sysResourceService.getByUser(sysUser.getUserId());
76
-
77
-         sysUser.setRolesList(rolesList);
78
-         sysUser.setResourcesList(resourcesList);
79
-
80
-         return sysUser;
81
-     }
82
-    
83
-    /** 
65
+    /**
66
+     * 查询当前人员
67
+     *
68
+     * @param
69
+     * @return 实例对象
70
+     */
71
+    @ApiOperation("查询当前人员")
72
+    @GetMapping("/sysUser/current")
73
+    public ResponseBean current() throws Exception {
74
+        SysUser sysUser = currentUser();
75
+        return ResponseBean.success(getPermissions(sysUser));
76
+    }
77
+
78
+    private SysUser getPermissions(SysUser sysUser) {
79
+        List<SysRole> rolesList = sysRoleService.getByUser(sysUser.getUserId());
80
+        List<SysResource> resourcesList = sysResourceService.getByUser(sysUser.getUserId());
81
+        List<String> dutyList = sysUserDutyService.getListByUser(sysUser.getUserId());
82
+
83
+        sysUser.setRolesList(rolesList);
84
+        sysUser.setResourcesList(resourcesList);
85
+        sysUser.setDutyList(dutyList);
86
+
87
+        return sysUser;
88
+    }
89
+
90
+    /**
84 91
      * 分页查询
85 92
      *
86
-     * @param pageNum 当前页码
93
+     * @param pageNum  当前页码
87 94
      * @param pageSize 每页条数
88 95
      * @return 查询结果
89 96
      */
@@ -94,7 +101,7 @@ public class SysUserController extends BaseController {
94 101
                              @ApiParam("姓名") @RequestParam(value = "name", required = false) String name,
95 102
                              @ApiParam("机构") @RequestParam(value = "orgId", required = false) String orgId,
96 103
                              @ApiParam("手机号") @RequestParam(value = "phone", required = false) String phone) throws Exception {
97
-        
104
+
98 105
         IPage<SysUser> pg = new Page<>(pageNum, pageSize);
99 106
         QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
100 107
         queryWrapper.like(!StringUtils.isEmpty(name), "name", name);
@@ -104,11 +111,11 @@ public class SysUserController extends BaseController {
104 111
         queryWrapper.ne("user_id", Constants.ROOT_ID);
105 112
         queryWrapper.orderByDesc("create_date");
106 113
         IPage<SysUser> result = sysUserService.page(pg, queryWrapper);
107
-        
114
+
108 115
         return ResponseBean.success(result);
109 116
     }
110
-    
111
-    /** 
117
+
118
+    /**
112 119
      * 新增数据
113 120
      *
114 121
      * @param sysUser 实例对象
@@ -125,24 +132,24 @@ public class SysUserController extends BaseController {
125 132
         return ResponseBean.success(sysUser);
126 133
     }
127 134
 
128
-     /**
129
-      * 更新数据
130
-      *
131
-      * @param id 实例ID
132
-      * @return 实例对象
133
-      */
134
-     @ApiOperation("更新数据")
135
-     @PutMapping("/sysUser/{id}/status")
136
-     public ResponseBean edit(@ApiParam("对象ID") @PathVariable String id,
137
-                              @ApiParam("页码") @RequestParam(value = "status") Integer status) throws Exception {
138
-
139
-         SysUser sysUser = sysUserService.getById(id);
140
-         sysUser.setStatus(status);
141
-
142
-         sysUserService.updateById(sysUser);
143
-         return ResponseBean.success(sysUser);
144
-     }
145
-    
135
+    /**
136
+     * 更新数据
137
+     *
138
+     * @param id 实例ID
139
+     * @return 实例对象
140
+     */
141
+    @ApiOperation("更新数据")
142
+    @PutMapping("/sysUser/{id}/status")
143
+    public ResponseBean edit(@ApiParam("对象ID") @PathVariable String id,
144
+                             @ApiParam("页码") @RequestParam(value = "status") Integer status) throws Exception {
145
+
146
+        SysUser sysUser = sysUserService.getById(id);
147
+        sysUser.setStatus(status);
148
+
149
+        sysUserService.updateById(sysUser);
150
+        return ResponseBean.success(sysUser);
151
+    }
152
+
146 153
 //    /**
147 154
 //     * 更新数据
148 155
 //     *
@@ -156,8 +163,8 @@ public class SysUserController extends BaseController {
156 163
 //        sysUserService.updateById(sysUser);
157 164
 //        return ResponseBean.success(sysUser);
158 165
 //    }
159
-    
160
-    /** 
166
+
167
+    /**
161 168
      * 通过主键删除数据
162 169
      *
163 170
      * @param userId 主键
@@ -165,7 +172,7 @@ public class SysUserController extends BaseController {
165 172
      */
166 173
     @ApiOperation("通过主键删除数据")
167 174
     @DeleteMapping("/sysUser/{id}")
168
-    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id){
175
+    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id) {
169 176
         sysUserService.removeLogicById(id);
170 177
         return ResponseBean.success("success");
171 178
     }

+ 1
- 1
src/main/java/com/example/civilizedcity/entity/SysUserDuty.java Просмотреть файл

@@ -25,7 +25,7 @@ public class SysUserDuty implements Serializable,Cloneable{
25 25
      /** 用户ID */
26 26
      @ApiModelProperty(name = "ID",notes = "")
27 27
      @TableId(value = "id", type = IdType.AUTO)
28
-     private String id ;
28
+     private Integer id ;
29 29
     /** 用户ID */
30 30
     @ApiModelProperty(name = "用户ID",notes = "")
31 31
     private String userId ;

+ 3
- 0
src/main/java/com/example/civilizedcity/mapper/SysUserDutyMapper.java Просмотреть файл

@@ -17,4 +17,7 @@ public interface SysUserDutyMapper  extends BaseMapper<SysUserDuty>{
17 17
 
18 18
      List<String> getListByUser(@Param("userId") String userId);
19 19
 
20
+    SysUserDuty getByUserAndDuty(@Param("userId") String userId, @Param("duty") String duty);
21
+
22
+    int deleteNotIn(@Param("userId") String userId, @Param("idList") List<Integer> idList);
20 23
 }

+ 7
- 1
src/main/java/com/example/civilizedcity/mapper/TaIssueMapper.java Просмотреть файл

@@ -2,11 +2,14 @@ package com.example.civilizedcity.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import org.apache.ibatis.annotations.MapKey;
5 6
 import org.apache.ibatis.annotations.Mapper;
6 7
 import org.apache.ibatis.annotations.Param;
7 8
 import com.example.civilizedcity.entity.TaIssue;
8 9
 
9
- /**
10
+import java.util.Map;
11
+
12
+/**
10 13
  * 问题表;(ta_issue)表数据库访问层
11 14
  * @author : http://njyunzhi.com
12 15
  * @date : 2022-12-12
@@ -23,4 +26,7 @@ public interface TaIssueMapper  extends BaseMapper<TaIssue>{
23 26
                      @Param("applyId") Integer applyId);
24 27
 
25 28
      int updateValidateStatus(@Param("issueId") Integer issueId, @Param("validateStatus") int validateStatus);
29
+
30
+     @MapKey("id")
31
+     Map<String, Object> statMaIndex(@Param("userId") String userId);
26 32
  }

+ 7
- 1
src/main/java/com/example/civilizedcity/mapper/TaOrgIssueMapper.java Просмотреть файл

@@ -3,11 +3,14 @@ package com.example.civilizedcity.mapper;
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.example.civilizedcity.entity.TaIssue;
6
+import org.apache.ibatis.annotations.MapKey;
6 7
 import org.apache.ibatis.annotations.Mapper;
7 8
 import org.apache.ibatis.annotations.Param;
8 9
 import com.example.civilizedcity.entity.TaOrgIssue;
9 10
 
10
- /**
11
+import java.util.Map;
12
+
13
+/**
11 14
  * 单位问题单;(ta_org_issue)表数据库访问层
12 15
  * @author : http://njyunzhi.com
13 16
  * @date : 2022-12-28
@@ -23,4 +26,7 @@ public interface TaOrgIssueMapper  extends BaseMapper<TaOrgIssue>{
23 26
      );
24 27
 
25 28
      TaOrgIssue getByIssueAndOrg(@Param("issueId") Integer issueId, @Param("orgId") String orgId);
29
+
30
+     @MapKey("id")
31
+     Map<String, Object> statMaIndex(@Param("orgId") String orgId);
26 32
  }

+ 7
- 1
src/main/java/com/example/civilizedcity/service/TaIssueService.java Просмотреть файл

@@ -2,9 +2,13 @@ package com.example.civilizedcity.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.baomidou.mybatisplus.extension.service.IService;
5
+import com.example.civilizedcity.entity.SysUser;
5 6
 import com.example.civilizedcity.entity.TaIssue;
7
+import com.example.civilizedcity.vo.StatVo;
6 8
 
7
- /**
9
+import java.util.List;
10
+
11
+/**
8 12
  * 问题表;(ta_issue)表服务接口
9 13
  * @author : http://njyunzhi.com
10 14
  * @date : 2022-12-12
@@ -16,4 +20,6 @@ public interface TaIssueService extends IBaseService<TaIssue> {
16 20
      void updateValidateStatus(Integer issueId, int validateStatus);
17 21
 
18 22
      void updateApply(Integer issueId, String applyType, Integer applyId);
23
+
24
+     List<StatVo> statMaIndex(SysUser user, String duty);
19 25
  }

+ 28
- 4
src/main/java/com/example/civilizedcity/service/impl/SysUserServiceImpl.java Просмотреть файл

@@ -3,9 +3,7 @@ package com.example.civilizedcity.service.impl;
3 3
 import com.example.civilizedcity.common.Constants;
4 4
 import com.example.civilizedcity.common.EncryptUtils;
5 5
 import com.example.civilizedcity.common.StringUtils;
6
-import com.example.civilizedcity.entity.SysLogin;
7
-import com.example.civilizedcity.entity.SysRole;
8
-import com.example.civilizedcity.entity.SysUserRole;
6
+import com.example.civilizedcity.entity.*;
9 7
 import com.example.civilizedcity.mapper.SysLoginMapper;
10 8
 import com.example.civilizedcity.mapper.SysUserDutyMapper;
11 9
 import com.example.civilizedcity.mapper.SysUserRoleMapper;
@@ -13,7 +11,6 @@ import com.example.civilizedcity.vo.ChangePassword;
13 11
 import com.example.civilizedcity.vo.LoginParam;
14 12
 import org.springframework.beans.factory.annotation.Autowired;
15 13
 import org.springframework.stereotype.Service;
16
-import com.example.civilizedcity.entity.SysUser;
17 14
 import com.example.civilizedcity.mapper.SysUserMapper;
18 15
 import com.example.civilizedcity.service.SysUserService;
19 16
 
@@ -148,6 +145,33 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
148 145
             sysUserRoleMapper.deleteNotIn(sysUser.getUserId(), idList);
149 146
         }
150 147
 
148
+        // 身份表
149
+        List<String> dutyList = sysUser.getDutyList();
150
+        if (null == dutyList || dutyList.size() == 0) {
151
+            sysUserDutyMapper.deleteByMap(new HashMap<String, Object>() {{
152
+                put("user_id", sysUser.getUserId());
153
+            }});
154
+        } else {
155
+            List<Integer> idList = new ArrayList<>();
156
+            for (String duty : dutyList) {
157
+                SysUserDuty item = new SysUserDuty();
158
+                item.setUserId(sysUser.getUserId());
159
+                item.setDuty(duty);
160
+
161
+                SysUserDuty exists = sysUserDutyMapper.getByUserAndDuty(sysUser.getUserId(), duty);
162
+                if (null != exists) {
163
+                    item.setId(exists.getId());
164
+                } else {
165
+                    sysUserDutyMapper.insert(item);
166
+                }
167
+
168
+                idList.add(item.getId());
169
+            }
170
+
171
+            // 去除垃圾数据
172
+            sysUserDutyMapper.deleteNotIn(sysUser.getUserId(), idList);
173
+        }
174
+
151 175
         return true;
152 176
     }
153 177
 

+ 61
- 0
src/main/java/com/example/civilizedcity/service/impl/TaIssueServiceImpl.java Просмотреть файл

@@ -1,12 +1,21 @@
1 1
 package com.example.civilizedcity.service.impl;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.example.civilizedcity.common.Constants;
5
+import com.example.civilizedcity.common.StringUtils;
6
+import com.example.civilizedcity.entity.SysUser;
7
+import com.example.civilizedcity.mapper.TaOrgIssueMapper;
8
+import com.example.civilizedcity.vo.StatVo;
4 9
 import org.springframework.beans.factory.annotation.Autowired;
5 10
 import org.springframework.stereotype.Service;
6 11
 import com.example.civilizedcity.entity.TaIssue;
7 12
 import com.example.civilizedcity.mapper.TaIssueMapper;
8 13
 import com.example.civilizedcity.service.TaIssueService;
9 14
 
15
+import java.util.ArrayList;
16
+import java.util.List;
17
+import java.util.Map;
18
+
10 19
 /**
11 20
  * 问题表;(ta_issue)表服务实现类
12 21
  *
@@ -16,6 +25,9 @@ import com.example.civilizedcity.service.TaIssueService;
16 25
 @Service
17 26
 public class TaIssueServiceImpl extends BaseServiceImpl<TaIssueMapper, TaIssue> implements TaIssueService {
18 27
 
28
+    @Autowired
29
+    TaOrgIssueMapper taOrgIssueMapper;
30
+
19 31
     @Override
20 32
     public IPage<TaIssue> getPageBy(IPage<TaIssue> pg, String orgId) {
21 33
         if (null == orgId) {
@@ -35,4 +47,53 @@ public class TaIssueServiceImpl extends BaseServiceImpl<TaIssueMapper, TaIssue>
35 47
     public void updateApply(Integer issueId, String applyType, Integer applyId) {
36 48
         baseMapper.updateApply(issueId, applyType, applyId);
37 49
     }
50
+
51
+    @Override
52
+    public List<StatVo> statMaIndex(SysUser user, String duty) {
53
+        List<StatVo> result = new ArrayList<>();
54
+
55
+        // 督察员
56
+        if (Constants.DUTY_INSPECTOR.equals(duty)) {
57
+            Map<String, Object> res = baseMapper.statMaIndex(user.getUserId());
58
+            result.add(new StatVo().setName("已上报").setValue(getStatValueBy(res.get("published_num"), 0)));
59
+            result.add(new StatVo().setName("已交办").setValue(getStatValueBy(res.get("assigned_num"), 0)));
60
+            result.add(new StatVo().setName("未交办").setValue(getStatValueBy(res.get("unassigned_num"), 0)));
61
+        }
62
+
63
+        // 管理员
64
+        else if (Constants.DUTY_MANAGER.equals(duty)) {
65
+            Map<String, Object> res = baseMapper.statMaIndex(null);
66
+            result.add(new StatVo().setName("未处理").setValue(getStatValueBy(res.get("unassigned_num"), 0)));
67
+            result.add(new StatVo().setName("已交办").setValue(getStatValueBy(res.get("assigned_num"), 0)));
68
+            result.add(new StatVo().setName("已办结").setValue(getStatValueBy(res.get("end_num"), 0)));
69
+        }
70
+
71
+        // 单位人员 或者 单位管理员
72
+        else if (Constants.DUTY_ORG_USER.equals(duty) || Constants.DUTY_ORG_MANAGER.equals(duty)) {
73
+            Map<String, Object> res = taOrgIssueMapper.statMaIndex(user.getOrgId());
74
+            result.add(new StatVo().setName("处理中").setValue(getStatValueBy(res.get("doing_num"), 0)));
75
+            result.add(new StatVo().setName("已办结").setValue(getStatValueBy(res.get("end_num"), 0)));
76
+            result.add(new StatVo().setName("已逾期").setValue(getStatValueBy(res.get("delay_num"), 0)));
77
+        }
78
+
79
+        // 查询人员
80
+        else if (Constants.DUTY_QUERY_PERSON.equals(duty)) {
81
+            Map<String, Object> res = baseMapper.statMaIndex(null);
82
+            result.add(new StatVo().setName("未处理").setValue(getStatValueBy(res.get("unassigned_num"), 0)));
83
+            result.add(new StatVo().setName("处理中").setValue(getStatValueBy(res.get("assigned_num"), 0)));
84
+            result.add(new StatVo().setName("已办结").setValue(getStatValueBy(res.get("end_num"), 0)));
85
+        }
86
+
87
+        // 市民
88
+        else {
89
+
90
+        }
91
+
92
+        return result;
93
+    }
94
+
95
+    Integer getStatValueBy(Object v, Integer def) {
96
+        if (null == v) return def;
97
+        return Integer.valueOf(v.toString());
98
+    }
38 99
 }

+ 17
- 0
src/main/java/com/example/civilizedcity/vo/StatVo.java Просмотреть файл

@@ -0,0 +1,17 @@
1
+package com.example.civilizedcity.vo;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+import lombok.experimental.Accessors;
7
+
8
+@Data
9
+@Accessors(chain = true)
10
+@ApiModel("统计参数")
11
+public class StatVo {
12
+    @ApiModelProperty("统计指标")
13
+    String name;
14
+
15
+    @ApiModelProperty("统计结果")
16
+    Object value;
17
+}

+ 20
- 0
src/main/resources/mapper/SysUserDutyMapper.xml Просмотреть файл

@@ -2,6 +2,17 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 
4 4
 <mapper namespace="com.example.civilizedcity.mapper.SysUserDutyMapper">
5
+    <delete id="deleteNotIn">
6
+        DELETE t
7
+        FROM
8
+            sys_user_duty t
9
+        WHERE
10
+            t.user_id = #{userId}
11
+        AND t.id NOT IN
12
+        <foreach item="item" collection="idList" separator="," open="(" close=")" index="">
13
+            #{item}
14
+        </foreach>
15
+    </delete>
5 16
 
6 17
     <select id="getListByUser" resultType="java.lang.String">
7 18
         SELECT
@@ -11,4 +22,13 @@
11 22
         WHERE
12 23
             t.user_id = #{userId}
13 24
     </select>
25
+    <select id="getByUserAndDuty" resultType="com.example.civilizedcity.entity.SysUserDuty">
26
+        SELECT
27
+            t.*
28
+        FROM
29
+            sys_user_duty t
30
+        WHERE
31
+            t.user_id = #{userId}
32
+            AND t.duty = #{duty}
33
+    </select>
14 34
 </mapper>

+ 16
- 0
src/main/resources/mapper/TaIssueMapper.xml Просмотреть файл

@@ -45,4 +45,20 @@
45 45
         ORDER BY
46 46
             t.create_date DESC
47 47
     </select>
48
+    <select id="statMaIndex" resultType="java.util.Map">
49
+        SELECT
50
+            UUID_SHORT() as id,
51
+            count(*) as published_num,
52
+            sum(IF(t.process_node = 'start', 1, 0)) as unassigned_num,
53
+            sum(IF(t.process_node = 'assigned', 1, 0)) as assigned_num,
54
+            sum(IF(t.process_node = 'reject', 1, 0)) as reject_num,
55
+            sum(IF(t.process_node = 'end', 1, 0)) as end_num
56
+        FROM
57
+            ta_issue t
58
+        WHERE 1 = 1
59
+          <if test="null != userId and userId != ''">
60
+              AND t.create_user = #{userId}
61
+          </if>
62
+          AND t.`status` > - 1
63
+    </select>
48 64
 </mapper>

+ 12
- 0
src/main/resources/mapper/TaOrgIssueMapper.xml Просмотреть файл

@@ -46,4 +46,16 @@
46 46
           AND t.org_id = #{orgId}
47 47
           AND t.`status` = 1
48 48
     </select>
49
+    <select id="statMaIndex" resultType="java.util.Map">
50
+        select
51
+            UUID_SHORT() as id,
52
+            SUM(IF(TO_DAYS(now()) > TO_DAYS(s.expire_date), 1, 0)) as delay_num,
53
+            SUM(s.process_node == 'end', 1, 0) as end_num,
54
+            SUM(s.process_node != 'end', 1, 0) as doing_num
55
+        from ta_org_issue t
56
+                 INNER JOIN ta_issue s on t.issue_id = s.issue_id
57
+        where t.org_id = #{orgId}
58
+          and t.`status` &gt; -1
59
+          and s.`status` &gt; -1
60
+    </select>
49 61
 </mapper>