张涛 1 年間 前
コミット
18e5b1fd8e

+ 16
- 16
src/main/java/com/example/civilizedcity/controller/TaIssueApplyController.java ファイルの表示

31
 @RequestMapping("/")
31
 @RequestMapping("/")
32
 public class TaIssueApplyController extends BaseController {
32
 public class TaIssueApplyController extends BaseController {
33
 
33
 
34
+    @Autowired
35
+    ApplicationEventPublisher applicationEventPublisher;
34
     @Autowired
36
     @Autowired
35
     private TaIssueApplyService taIssueApplyService;
37
     private TaIssueApplyService taIssueApplyService;
36
-
37
     @Autowired
38
     @Autowired
38
     private TaIssueService taIssueService;
39
     private TaIssueService taIssueService;
39
-
40
     @Autowired
40
     @Autowired
41
     private TaOrgIssueService taOrgIssueService;
41
     private TaOrgIssueService taOrgIssueService;
42
 
42
 
43
-    @Autowired
44
-    ApplicationEventPublisher applicationEventPublisher;
45
-
46
     /**
43
     /**
47
      * 通过ID查询单条数据
44
      * 通过ID查询单条数据
48
      *
45
      *
82
     public ResponseBean countApply(
79
     public ResponseBean countApply(
83
             @ApiParam("申请状态") @RequestParam(value = "state", defaultValue = "0") Integer state,
80
             @ApiParam("申请状态") @RequestParam(value = "state", defaultValue = "0") Integer state,
84
             @ApiParam("是否删除") @RequestParam(value = "status", defaultValue = "-1") Integer status,
81
             @ApiParam("是否删除") @RequestParam(value = "status", defaultValue = "-1") Integer status,
85
-                                   @ApiParam("申请类型") @RequestParam(value = "applyType", required = false) String applyType) throws Exception {
82
+            @ApiParam("duty") @RequestParam(value = "duty", required = false) String duty,
83
+            @ApiParam("申请类型") @RequestParam(value = "applyType", required = false) String applyType) throws Exception {
86
 
84
 
87
         String orgId = getOrgId();
85
         String orgId = getOrgId();
88
-
86
+        String createUserId = currentUser().getUserId();
89
         QueryWrapper<TaIssueApply> queryWrapper = new QueryWrapper<>();
87
         QueryWrapper<TaIssueApply> queryWrapper = new QueryWrapper<>();
90
-        queryWrapper.eq(StringUtils.isNotEmpty(applyType), "apply_type", applyType);
91
-        queryWrapper.eq(StringUtils.isNotEmpty(orgId), "org_id", orgId);
92
-        queryWrapper.gt("status",status);
88
+        queryWrapper.eq(StringUtils.isNotEmpty(applyType), "ta.apply_type", applyType);
89
+        queryWrapper.eq(StringUtils.isNotEmpty(orgId), "ta.org_id", orgId);
90
+        queryWrapper.gt("ta.status", status);
93
 
91
 
94
         if (0 == state) {
92
         if (0 == state) {
95
-            queryWrapper.isNull("verify_date");
93
+            queryWrapper.isNull("ta.verify_date");
96
         } else {
94
         } else {
97
-            queryWrapper.isNotNull("verify_date");
95
+            queryWrapper.isNotNull("ta.verify_date");
98
         }
96
         }
99
 
97
 
100
-        long num = taIssueApplyService.count(queryWrapper);
98
+        long num = taIssueApplyService.counts(queryWrapper,createUserId,duty);
101
 
99
 
102
         return ResponseBean.success(num);
100
         return ResponseBean.success(num);
103
     }
101
     }
105
     /**
103
     /**
106
      * 通过ISSUE_ID查询单条数据
104
      * 通过ISSUE_ID查询单条数据
107
      *
105
      *
108
-     * @param issueId 问题单ID
106
+     * @param issueId   问题单ID
109
      * @param applyType 申请类型
107
      * @param applyType 申请类型
110
      * @return 实例对象
108
      * @return 实例对象
111
      */
109
      */
143
                              @ApiParam("问题单ID") @RequestParam(value = "issueId", required = false) Integer issueId,
141
                              @ApiParam("问题单ID") @RequestParam(value = "issueId", required = false) Integer issueId,
144
                              @ApiParam("申请类型") @RequestParam(value = "applyType", required = false) String applyType,
142
                              @ApiParam("申请类型") @RequestParam(value = "applyType", required = false) String applyType,
145
                              @ApiParam("问题单来源") @RequestParam(value = "sourceType", required = false) String sourceType,
143
                              @ApiParam("问题单来源") @RequestParam(value = "sourceType", required = false) String sourceType,
144
+                             @ApiParam("duty") @RequestParam(value = "duty", required = false) String duty,
146
                              @ApiParam(value = "是否全部") @RequestParam(value = "isAll", defaultValue = "false") Boolean isAll) throws Exception {
145
                              @ApiParam(value = "是否全部") @RequestParam(value = "isAll", defaultValue = "false") Boolean isAll) throws Exception {
147
 
146
 
148
         String orgId = getOrgId();
147
         String orgId = getOrgId();
149
-
148
+        SysUser sysUser = currentUser();
149
+        String createUserId = sysUser.getUserId();
150
         IPage<TaIssueApply> pg = new Page<>(pageNum, pageSize);
150
         IPage<TaIssueApply> pg = new Page<>(pageNum, pageSize);
151
-        IPage<TaIssueApply> result = taIssueApplyService.getPageBy(pg, issueId, applyType, orgId, sourceType, isAll);
151
+        IPage<TaIssueApply> result = taIssueApplyService.getPageBy(pg, issueId, applyType, orgId, sourceType, isAll, duty,createUserId);
152
 
152
 
153
         return ResponseBean.success(result);
153
         return ResponseBean.success(result);
154
     }
154
     }

+ 8
- 2
src/main/java/com/example/civilizedcity/mapper/TaIssueApplyMapper.java ファイルの表示

1
 package com.example.civilizedcity.mapper;
1
 package com.example.civilizedcity.mapper;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
4
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
6
 import com.baomidou.mybatisplus.core.metadata.IPage;
7
+import com.baomidou.mybatisplus.core.toolkit.Constants;
5
 import org.apache.ibatis.annotations.Mapper;
8
 import org.apache.ibatis.annotations.Mapper;
6
 import org.apache.ibatis.annotations.Param;
9
 import org.apache.ibatis.annotations.Param;
7
 import com.example.civilizedcity.entity.TaIssueApply;
10
 import com.example.civilizedcity.entity.TaIssueApply;
11
+import org.apache.ibatis.annotations.Select;
8
 
12
 
9
- /**
13
+/**
10
  * 问题处理申请;(ta_issue_apply)表数据库访问层
14
  * 问题处理申请;(ta_issue_apply)表数据库访问层
11
  * @author : http://njyunzhi.com
15
  * @author : http://njyunzhi.com
12
  * @date : 2022-12-27
16
  * @date : 2022-12-27
19
                                    @Param("applyType") String applyType,
23
                                    @Param("applyType") String applyType,
20
                                    @Param("orgId") String orgId,
24
                                    @Param("orgId") String orgId,
21
                                    @Param("sourceType") String sourceType,
25
                                    @Param("sourceType") String sourceType,
22
-                                   @Param("isAll") Boolean isAll);
26
+                                   @Param("isAll") Boolean isAll,
27
+                                   @Param("duty") String duty,@Param("createUserId") String createUserId);
23
 
28
 
24
      int removeByIssueId(@Param("issueId") String issueId);
29
      int removeByIssueId(@Param("issueId") String issueId);
25
 
30
 
31
+     long counts(@Param("ew")QueryWrapper<TaIssueApply> queryWrapper, @Param("createUserId") String createUserId,@Param("duty") String duty);
26
  }
32
  }

+ 4
- 1
src/main/java/com/example/civilizedcity/service/TaIssueApplyService.java ファイルの表示

1
 package com.example.civilizedcity.service;
1
 package com.example.civilizedcity.service;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.example.civilizedcity.entity.SysUser;
5
 import com.example.civilizedcity.entity.SysUser;
5
 import com.example.civilizedcity.entity.TaIssueApply;
6
 import com.example.civilizedcity.entity.TaIssueApply;
13
 
14
 
14
      void createNewApply(TaIssueApply taIssueApply, SysUser sysUser) throws Exception;
15
      void createNewApply(TaIssueApply taIssueApply, SysUser sysUser) throws Exception;
15
 
16
 
16
-     IPage<TaIssueApply> getPageBy(IPage<TaIssueApply> pg, Integer issueId, String applyType, String orgId, String sourceType, Boolean isAll);
17
+     IPage<TaIssueApply> getPageBy(IPage<TaIssueApply> pg, Integer issueId, String applyType, String orgId, String sourceType, Boolean isAll,String duty,String createUser);
17
 
18
 
18
      void verify(TaIssueApply taIssueApply, SysUser sysUser, TaIssueApply origin) throws Exception;
19
      void verify(TaIssueApply taIssueApply, SysUser sysUser, TaIssueApply origin) throws Exception;
20
+
21
+     long counts(QueryWrapper<TaIssueApply> queryWrapper, String createUserId,String duty);
19
  }
22
  }

+ 8
- 2
src/main/java/com/example/civilizedcity/service/impl/TaIssueApplyServiceImpl.java ファイルの表示

1
 package com.example.civilizedcity.service.impl;
1
 package com.example.civilizedcity.service.impl;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.example.civilizedcity.common.Constants;
5
 import com.example.civilizedcity.common.Constants;
5
 import com.example.civilizedcity.entity.*;
6
 import com.example.civilizedcity.entity.*;
77
     }
78
     }
78
 
79
 
79
     @Override
80
     @Override
80
-    public IPage<TaIssueApply> getPageBy(IPage<TaIssueApply> pg, Integer issueId, String applyType, String orgId, String sourceType, Boolean isAll) {
81
+    public IPage<TaIssueApply> getPageBy(IPage<TaIssueApply> pg, Integer issueId, String applyType, String orgId, String sourceType, Boolean isAll,String duty,String createUserId) {
81
 
82
 
82
         // 如果 isAll 是 false
83
         // 如果 isAll 是 false
83
         // 那么只查询还未审核的
84
         // 那么只查询还未审核的
84
 
85
 
85
-        return baseMapper.getPageBy(pg, issueId, applyType, orgId, sourceType, isAll);
86
+        return baseMapper.getPageBy(pg, issueId, applyType, orgId, sourceType, isAll,duty,createUserId);
86
     }
87
     }
87
 
88
 
88
     @Transactional(rollbackFor = Exception.class)
89
     @Transactional(rollbackFor = Exception.class)
156
         applicationEventPublisher.publishEvent(new MessagEvent(this, origin));
157
         applicationEventPublisher.publishEvent(new MessagEvent(this, origin));
157
     }
158
     }
158
 
159
 
160
+    @Override
161
+    public long counts(QueryWrapper<TaIssueApply> queryWrapper, String createUserId,String duty) {
162
+        return baseMapper.counts(queryWrapper, createUserId, duty);
163
+    }
164
+
159
     private void createProcessByIssue(TaIssue taIssue, SysUser sysUser, TaIssueApply taIssueApply) {
165
     private void createProcessByIssue(TaIssue taIssue, SysUser sysUser, TaIssueApply taIssueApply) {
160
         TaIssueProcess taIssueProcess = new TaIssueProcess();
166
         TaIssueProcess taIssueProcess = new TaIssueProcess();
161
         taIssueProcess.setIssueId(taIssue.getIssueId());
167
         taIssueProcess.setIssueId(taIssue.getIssueId());

+ 15
- 0
src/main/resources/mapper/TaIssueApplyMapper.xml ファイルの表示

17
         FROM
17
         FROM
18
         ta_issue_apply t
18
         ta_issue_apply t
19
         INNER JOIN ta_issue s ON t.issue_id = s.issue_id
19
         INNER JOIN ta_issue s ON t.issue_id = s.issue_id
20
+        <if test="duty != null and duty == 'inspector'">
21
+            and s.create_user = #{createUserId}
22
+        </if>
23
+
20
         WHERE
24
         WHERE
21
         t.`status` &gt; -1
25
         t.`status` &gt; -1
22
         AND s.`status` &gt; -1
26
         AND s.`status` &gt; -1
42
         IFNULL(t.verify_status, -1) ASC,
46
         IFNULL(t.verify_status, -1) ASC,
43
         t.create_date DESC
47
         t.create_date DESC
44
     </select>
48
     </select>
49
+    <select id="counts" resultType="java.lang.Long">
50
+        SELECT DISTINCT
51
+        COUNT( * )
52
+        FROM
53
+        ta_issue_apply ta
54
+        INNER JOIN ta_issue ti ON ta.issue_id = ti.issue_id
55
+        <if test="duty != null and duty == 'inspector'">
56
+            AND ti.create_user = #{createUserId}
57
+        </if>
58
+        ${ew.customSqlSegment}
59
+    </select>
45
 </mapper>
60
 </mapper>

+ 2
- 2
src/main/resources/mapper/TaOrgIssueMapper.xml ファイルの表示

121
         INNER JOIN sys_org so on oi.org_id=so.org_id and so.`status`= 1
121
         INNER JOIN sys_org so on oi.org_id=so.org_id and so.`status`= 1
122
         WHERE
122
         WHERE
123
         oi.issue_id = #{issueId}
123
         oi.issue_id = #{issueId}
124
-        and oi.`status` = -2
124
+        and oi.`status` != -1
125
         ORDER BY
125
         ORDER BY
126
-        oi.create_date DESC
126
+        oi.create_date ASC
127
     </select>
127
     </select>
128
 
128
 
129
 
129