张涛 2 年前
父节点
当前提交
3aa854d490

+ 28
- 8
src/main/java/com/example/civilizedcity/controller/TaOrgIssueController.java 查看文件

@@ -20,7 +20,9 @@ import org.springframework.web.bind.annotation.*;
20 20
 import com.example.civilizedcity.entity.TaOrgIssue;
21 21
 import com.example.civilizedcity.service.TaOrgIssueService;
22 22
 
23
- /**
23
+import javax.xml.ws.Response;
24
+
25
+/**
24 26
  * 单位问题单;(ta_org_issue)表控制层
25 27
  * @author : http://njyunzhi.com
26 28
  * @date : 2022-12-28
@@ -124,10 +126,28 @@ public class TaOrgIssueController extends BaseController {
124 126
      * @param orgIssueId 主键
125 127
      * @return 是否成功
126 128
      */
127
-    @ApiOperation("通过主键删除数据")
128
-    @DeleteMapping("/taOrgIssue/{id}")
129
-    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable Integer id){
130
-        taOrgIssueService.removeLogicById(id);
131
-        return ResponseBean.success("success");
132
-    }
133
-}
129
+//    @ApiOperation("通过主键删除数据")
130
+//    @DeleteMapping("/taOrgIssue/{id}")
131
+//    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable Integer id){
132
+//        taOrgIssueService.removeLogicById(id);
133
+//        return ResponseBean.success("success");
134
+//    }
135
+
136
+
137
+/**
138
+ * 通过主键删除数据
139
+ *
140
+ * @param orgIssueId
141
+ * @return 是否成功
142
+ *
143
+ */
144
+
145
+      @ApiOperation(value="通过主键删除数据",httpMethod="DELETE")
146
+      @DeleteMapping("/taOrgIssue/{issueId}")
147
+     public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String issueId){
148
+          taOrgIssueService.removeByIssueId(issueId);
149
+          return ResponseBean.success("success成功删除");
150
+      }
151
+
152
+}
153
+

+ 8
- 10
src/main/java/com/example/civilizedcity/controller/TdLocTypeController.java 查看文件

@@ -6,16 +6,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.example.civilizedcity.common.BaseController;
7 7
 import com.example.civilizedcity.common.Constants;
8 8
 import com.example.civilizedcity.common.ResponseBean;
9
-
10
-import java.util.List;
11
-
9
+import com.example.civilizedcity.entity.TdLocType;
10
+import com.example.civilizedcity.service.TdLocTypeService;
12 11
 import io.swagger.annotations.Api;
13 12
 import io.swagger.annotations.ApiOperation;
14 13
 import io.swagger.annotations.ApiParam;
15 14
 import org.springframework.beans.factory.annotation.Autowired;
16 15
 import org.springframework.web.bind.annotation.*;
17
-import com.example.civilizedcity.entity.TdLocType;
18
-import com.example.civilizedcity.service.TdLocTypeService;
19 16
 
20 17
 /**
21 18
  * 点位分类;(td_loc_type)表控制层
@@ -56,12 +53,13 @@ public class TdLocTypeController extends BaseController {
56 53
                              @ApiParam("单页数据量") @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) throws Exception {
57 54
 
58 55
         IPage<TdLocType> pg = new Page<>(pageNum, pageSize);
59
-        QueryWrapper<TdLocType> queryWrapper = new QueryWrapper<>();
60
-        queryWrapper.gt("status", Constants.STATUS_DELETE);
61
-        queryWrapper.orderByDesc("create_date");
62
-        IPage<TdLocType> result = tdLocTypeService.page(pg, queryWrapper);
56
+//        QueryWrapper<TdLocType> queryWrapper = new QueryWrapper<>();
57
+//        queryWrapper.gt("status", Constants.STATUS_DELETE);
58
+//        queryWrapper.orderByAsc("sort_no");
59
+//        IPage<TdLocType> result = tdLocTypeService.page(pg, queryWrapper);
63 60
 
64
-        return ResponseBean.success(result);
61
+        IPage<TdLocType> result = tdLocTypeService.pageAsc(pg);
62
+        return ResponseBean.success( result );
65 63
     }
66 64
 
67 65
     /**

+ 3
- 0
src/main/java/com/example/civilizedcity/mapper/TaIssueMapper.java 查看文件

@@ -38,4 +38,7 @@ public interface TaIssueMapper  extends BaseMapper<TaIssue>{
38 38
                       @Param("userId") String userId,
39 39
                       @Param("processNode") String processNode,
40 40
                       @Param("processStatus") String processStatus);
41
+
42
+    int removeByIssueId(@Param("issueId") String issueId);
43
+
41 44
 }

+ 3
- 0
src/main/java/com/example/civilizedcity/mapper/TaOrgIssueMapper.java 查看文件

@@ -30,4 +30,7 @@ public interface TaOrgIssueMapper  extends BaseMapper<TaOrgIssue>{
30 30
      Map<String, Object> statMaIndex(@Param("orgId") String orgId);
31 31
 
32 32
     int updateProcess(@Param("issueId") Integer issueId,@Param("orgId") String orgId,@Param("processStatus") String processStatus);
33
+
34
+    int removeByIssueId(@Param("issueId") String issueId);
35
+
33 36
 }

+ 7
- 2
src/main/java/com/example/civilizedcity/mapper/TdLocTypeMapper.java 查看文件

@@ -1,16 +1,21 @@
1 1
 package com.example.civilizedcity.mapper;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3 4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import com.baomidou.mybatisplus.core.metadata.IPage;
4 6
 import org.apache.ibatis.annotations.Mapper;
5 7
 import org.apache.ibatis.annotations.Param;
6 8
 import com.example.civilizedcity.entity.TdLocType;
7 9
 
8
- /**
10
+import java.util.List;
11
+
12
+/**
9 13
  * 点位分类;(td_loc_type)表数据库访问层
10 14
  * @author : http://njyunzhi.com
11 15
  * @date : 2022-12-12
12 16
  */
13 17
 @Mapper
14 18
 public interface TdLocTypeMapper  extends BaseMapper<TdLocType>{
15
-    
19
+
20
+    IPage<TdLocType> sortAsc(IPage<TdLocType> pg);
16 21
 }

+ 1
- 0
src/main/java/com/example/civilizedcity/service/TaOrgIssueService.java 查看文件

@@ -14,6 +14,7 @@ import com.example.civilizedcity.entity.TaOrgIssue;
14 14
 public interface TaOrgIssueService extends IBaseService<TaOrgIssue> {
15 15
 
16 16
      IPage<TaIssue> getIssuePageBy(IPage<TaIssue> pg, String orgId, String sourceType, String bizStatus);
17
+     void removeByIssueId(String issueId);
17 18
 
18 19
      void createNewIssue(TaIssue taIssue, SysUser sysUser);
19 20
  }

+ 12
- 4
src/main/java/com/example/civilizedcity/service/TdLocTypeService.java 查看文件

@@ -1,13 +1,21 @@
1 1
 package com.example.civilizedcity.service;
2 2
 
3
-import com.baomidou.mybatisplus.extension.service.IService;
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.example.civilizedcity.entity.TdLocType;
5 6
 
6
- /**
7
+import java.util.List;
8
+
9
+/**
7 10
  * 点位分类;(td_loc_type)表服务接口
8 11
  * @author : http://njyunzhi.com
9 12
  * @date : 2022-12-12
10 13
  */
11 14
 public interface TdLocTypeService extends IBaseService<TdLocType> {
12
-    
13
-}
15
+
16
+
17
+    IPage<TdLocType> pageAsc(IPage<TdLocType> pg);
18
+
19
+
20
+
21
+ }

+ 12
- 0
src/main/java/com/example/civilizedcity/service/impl/TaOrgIssueServiceImpl.java 查看文件

@@ -6,6 +6,8 @@ import com.example.civilizedcity.common.StringUtils;
6 6
 import com.example.civilizedcity.entity.SysUser;
7 7
 import com.example.civilizedcity.entity.TaIssue;
8 8
 import com.example.civilizedcity.entity.TaIssueProcess;
9
+import com.example.civilizedcity.mapper.TaIssueMapper;
10
+import org.springframework.beans.factory.annotation.Autowired;
9 11
 import org.springframework.stereotype.Service;
10 12
 import com.example.civilizedcity.entity.TaOrgIssue;
11 13
 import com.example.civilizedcity.mapper.TaOrgIssueMapper;
@@ -22,6 +24,9 @@ import java.time.LocalDateTime;
22 24
 @Service
23 25
 public class TaOrgIssueServiceImpl extends BaseServiceImpl<TaOrgIssueMapper, TaOrgIssue> implements TaOrgIssueService {
24 26
 
27
+    @Autowired
28
+    TaIssueMapper taIssueMapper;
29
+
25 30
     @Override
26 31
     public IPage<TaIssue> getIssuePageBy(IPage<TaIssue> pg, String orgId, String sourceType, String bizStatus) {
27 32
 
@@ -51,4 +56,11 @@ public class TaOrgIssueServiceImpl extends BaseServiceImpl<TaOrgIssueMapper, TaO
51 56
 
52 57
         save(taOrgIssue);
53 58
     }
59
+
60
+    @Override
61
+    public void removeByIssueId(String issueId){
62
+       baseMapper.removeByIssueId(issueId);
63
+        taIssueMapper.removeByIssueId(issueId);
64
+    }
65
+
54 66
 }

+ 13
- 4
src/main/java/com/example/civilizedcity/service/impl/TdLocTypeServiceImpl.java 查看文件

@@ -1,16 +1,25 @@
1 1
 package com.example.civilizedcity.service.impl;
2 2
 
3
-import org.springframework.beans.factory.annotation.Autowired;
4
-import org.springframework.stereotype.Service;
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.example.civilizedcity.entity.TdLocType;
6 6
 import com.example.civilizedcity.mapper.TdLocTypeMapper;
7 7
 import com.example.civilizedcity.service.TdLocTypeService;
8
- /**
8
+import org.springframework.stereotype.Service;
9
+
10
+/**
9 11
  * 点位分类;(td_loc_type)表服务实现类
12
+ *
10 13
  * @author : http://www.chiner.pro
11 14
  * @date : 2022-12-12
12 15
  */
13 16
 @Service
14 17
 public class TdLocTypeServiceImpl extends BaseServiceImpl<TdLocTypeMapper, TdLocType> implements TdLocTypeService {
15
-    
18
+
19
+
20
+    @Override
21
+    public IPage<TdLocType> pageAsc(IPage<TdLocType> pg) {
22
+        IPage<TdLocType> result = (IPage<TdLocType>) baseMapper.sortAsc(pg);
23
+        return result;
24
+    }
16 25
 }

+ 59
- 53
src/main/resources/mapper/TaIssueMapper.xml 查看文件

@@ -5,97 +5,103 @@
5 5
     <update id="updateApply">
6 6
         UPDATE ta_issue t
7 7
         SET t.apply_type = #{applyType},
8
-            t.apply_id = #{applyId}
8
+        t.apply_id = #{applyId}
9 9
         WHERE
10
-            t.issue_id = #{issueId}
10
+        t.issue_id = #{issueId}
11 11
     </update>
12 12
     <update id="updateValidateStatus">
13 13
         UPDATE ta_issue t
14 14
         SET t.validate_status = #{validateStatus}
15 15
         WHERE
16
-            t.issue_id = #{issueId}
16
+        t.issue_id = #{issueId}
17 17
     </update>
18 18
     <update id="updateProcess">
19 19
         UPDATE ta_issue t
20 20
         SET t.process_node = #{processNode},
21
-            t.process_status = #{processStatus},
22
-            t.update_user = #{userId},
23
-            t.update_date = now( )
21
+        t.process_status = #{processStatus},
22
+        t.update_user = #{userId},
23
+        t.update_date = now( )
24 24
         WHERE
25
-            t.issue_id = #{issueId}
25
+        t.issue_id = #{issueId}
26
+    </update>
27
+    <update id="removeByIssueId">
28
+        UPDATE ta_issue t
29
+        SET t.status =-1
30
+        WHERE
31
+        t.issue_id = #{issueId};
26 32
     </update>
27 33
 
28 34
     <select id="getPageBy" resultType="com.example.civilizedcity.entity.TaIssue">
29 35
         SELECT
30
-            *
36
+        *
37
+        FROM
38
+        ta_issue t
39
+        WHERE
40
+        EXISTS (
41
+        SELECT
42
+        *
31 43
         FROM
32
-            ta_issue t
44
+        ta_issue_process s ON s.issue_id = t.issue_id
33 45
         WHERE
34
-            EXISTS (
35
-                    SELECT
36
-                        *
37
-                    FROM
38
-                        ta_issue_process s ON s.issue_id = t.issue_id
39
-                    WHERE
40
-                    ( s.org_id = #{orgId} OR s.next_org = #{orgId} )
41
-                        AND s.`status` &gt; -1
42
-                )
43
-          AND t.`status` &gt; -1
46
+        ( s.org_id = #{orgId} OR s.next_org = #{orgId} )
47
+        AND s.`status` &gt; -1
48
+        )
49
+        AND t.`status` &gt; -1
44 50
         ORDER BY
45
-            t.create_date DESC
51
+        t.create_date DESC
46 52
     </select>
47 53
     <select id="getAllBy" resultType="com.example.civilizedcity.entity.TaIssue">
48 54
         SELECT
49
-            *
55
+        *
50 56
         FROM
51
-            ta_issue t
57
+        ta_issue t
52 58
         WHERE
53
-            t.`status` &gt; -1
59
+        t.`status` &gt; -1
54 60
         ORDER BY
55
-            t.create_date DESC
61
+        t.create_date DESC
56 62
     </select>
57 63
     <select id="statMaIndex" resultType="java.util.Map">
58 64
         SELECT
59
-            count(*) as published_num,
60
-            sum(IF(t.process_node = 'start', 1, 0)) as unassigned_num,
61
-            sum(IF(t.process_node = 'assigned', 1, 0)) as assigned_num,
62
-            sum(IF(t.process_node = 'end', 1, 0)) as end_num
65
+        count(*) as published_num,
66
+        sum(IF(t.process_node = 'start', 1, 0)) as unassigned_num,
67
+        sum(IF(t.process_node = 'assigned', 1, 0)) as assigned_num,
68
+        sum(IF(t.process_node = 'end', 1, 0)) as end_num
63 69
         FROM
64
-            ta_issue t
70
+        ta_issue t
65 71
         WHERE 1 = 1
66
-          <if test="null != userId and userId != ''">
67
-              AND t.create_user = #{userId}
68
-          </if>
69
-          AND t.`status` > - 1
72
+        <if test="null != userId and userId != ''">
73
+            AND t.create_user = #{userId}
74
+        </if>
75
+        AND t.`status` > - 1
70 76
     </select>
71 77
     <select id="statIssueOrg" resultType="java.util.Map">
72 78
         SELECT
73
-            UUID_SHORT( ) AS id,
74
-            IFNULL( SUM( IF ( t.process_node = 'end', t.process_num, 0 ) ), 0 ) AS endNum,
75
-            IFNULL( SUM( IF ( t.process_node = 'assigned', t.process_num, 0 ) ), 0 ) AS assignedNum,
76
-            IFNULL( SUM( IF ( t.expire_date &lt;= NOW( ), t.process_num, 0 ) ), 0 ) AS expireNum
79
+        UUID_SHORT( ) AS id,
80
+        IFNULL( SUM( IF ( t.process_node = 'end', t.process_num, 0 ) ), 0 ) AS endNum,
81
+        IFNULL( SUM( IF ( t.process_node = 'assigned', t.process_num, 0 ) ), 0 ) AS assignedNum,
82
+        IFNULL( SUM( IF ( t.expire_date &lt;= NOW( ), t.process_num, 0 ) ), 0 ) AS expireNum
77 83
         FROM
78
-            ta_issue t
84
+        ta_issue t
79 85
         WHERE
80
-            t.org_id = #{orgId}
81
-            AND t.`status` &gt; -1
86
+        t.org_id = #{orgId}
87
+        AND t.`status` &gt; -1
82 88
     </select>
83 89
     <select id="statIssueType" resultType="com.example.civilizedcity.vo.StatVo">
84 90
         SELECT
85
-            *
91
+        *
92
+        FROM
93
+        (
94
+        SELECT
95
+        t.`name`,
96
+        sum( IF ( s.issue_id IS NULL, 0, 1 ) ) AS `value`
86 97
         FROM
87
-            (
88
-                SELECT
89
-                    t.`name`,
90
-                    sum( IF ( s.issue_id IS NULL, 0, 1 ) ) AS `value`
91
-                FROM
92
-                    td_issue_type t
93
-                        LEFT JOIN ta_issue s ON s.type_id = t.type_id
94
-                        AND s.`status` &gt; - 1
95
-                GROUP BY
96
-                    t.type_id
97
-            ) a
98
+        td_issue_type t
99
+        LEFT JOIN ta_issue s ON s.type_id = t.type_id
100
+        AND s.`status` &gt; - 1
101
+        GROUP BY
102
+        t.type_id
103
+        ) a
98 104
         ORDER BY
99
-            a.`value` DESC
105
+        a.`value` DESC
100 106
     </select>
101 107
 </mapper>

+ 45
- 37
src/main/resources/mapper/TaOrgIssueMapper.xml 查看文件

@@ -6,62 +6,70 @@
6 6
         UPDATE ta_org_issue t
7 7
         SET t.process_status = #{processStatus}
8 8
         WHERE
9
-            t.org_id = #{orgId}
10
-          AND t.issue_id = #{issueId}
9
+        t.org_id = #{orgId}
10
+        AND t.issue_id = #{issueId}
11
+    </update>
12
+    <update id="removeByIssueId">
13
+        UPDATE ta_org_issue t
14
+        SET t.status =-1
15
+        WHERE
16
+        t.issue_id = #{issueId};
11 17
     </update>
12 18
 
13 19
     <select id="getIssuePageBy" resultType="com.example.civilizedcity.entity.TaIssue">
14 20
         SELECT
15
-            *
21
+        *
22
+        FROM
23
+        ta_issue t
24
+        WHERE
25
+        EXISTS (
26
+        SELECT
27
+        *
16 28
         FROM
17
-            ta_issue t
29
+        ta_org_issue s
18 30
         WHERE
19
-            EXISTS (
20
-                SELECT
21
-                *
22
-                FROM
23
-                ta_org_issue s
24
-                WHERE
25
-                s.issue_id = t.issue_id
26
-                AND s.org_id = #{orgId}
27
-                AND s.`status` &gt; -1
28
-            )
29
-          <if test="sourceType != null and sourceType == 'feedback'">
30
-              AND t.source_type = 'feedback'
31
-          </if>
32
-          <if test="sourceType != null and sourceType != 'feedback'">
33
-              AND t.source_type in ('check', 'inspector')
34
-          </if>
35
-          <if test="processNode != null and processNode != ''">
31
+        s.issue_id = t.issue_id
32
+        AND s.org_id = #{orgId}
33
+        AND s.`status` &gt; -1
34
+        )
35
+        <if test="sourceType != null and sourceType == 'feedback'">
36
+            AND t.source_type = 'feedback'
37
+        </if>
38
+        <if test="sourceType != null and sourceType != 'feedback'">
39
+            AND t.source_type in ('check', 'inspector')
40
+        </if>
41
+        <if test="processNode != null and processNode != ''">
36 42
             AND t.process_node = #{processNode}
37
-          </if>
38
-          <if test="isExpire != null and isExpire">
43
+        </if>
44
+        <if test="isExpire != null and isExpire">
39 45
             AND t.process_node != 'end'
40 46
             AND t.expire_date &lt;= now( )
41
-          </if>
42
-            AND t.`status` &gt; -1
47
+        </if>
48
+        AND t.`status` &gt; -1
43 49
         ORDER BY
44
-            t.create_date DESC
50
+        t.create_date DESC
45 51
     </select>
46 52
     <select id="getByIssueAndOrg" resultType="com.example.civilizedcity.entity.TaOrgIssue">
47 53
         SELECT
48
-            *
54
+        *
49 55
         FROM
50
-            ta_org_issue t
56
+        ta_org_issue t
51 57
         WHERE
52
-            t.issue_id = #{issueId}
53
-          AND t.org_id = #{orgId}
54
-          AND t.`status` = 1
58
+        t.issue_id = #{issueId}
59
+        AND t.org_id = #{orgId}
60
+        AND t.`status` = 1
55 61
     </select>
56 62
     <select id="statMaIndex" resultType="java.util.Map">
57 63
         select
58
-            SUM(IF(TO_DAYS(now()) > TO_DAYS(s.expire_date), 1, 0)) as delay_num,
59
-            SUM(s.process_node == 'end', 1, 0) as end_num,
60
-            SUM(s.process_node != 'end', 1, 0) as doing_num
64
+        SUM(IF(TO_DAYS(now()) > TO_DAYS(s.expire_date), 1, 0)) as delay_num,
65
+        SUM(s.process_node == 'end', 1, 0) as end_num,
66
+        SUM(s.process_node != 'end', 1, 0) as doing_num
61 67
         from ta_org_issue t
62
-                 INNER JOIN ta_issue s on t.issue_id = s.issue_id AND t.org_id = s.org_id
68
+        INNER JOIN ta_issue s on t.issue_id = s.issue_id AND t.org_id = s.org_id
63 69
         where t.org_id = #{orgId}
64
-          and t.`status` &gt; -1
65
-          and s.`status` &gt; -1
70
+        and t.`status` &gt; -1
71
+        and s.`status` &gt; -1
66 72
     </select>
73
+
74
+
67 75
 </mapper>

+ 10
- 1
src/main/resources/mapper/TdLocTypeMapper.xml 查看文件

@@ -2,5 +2,14 @@
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.TdLocTypeMapper">
5
-    
5
+
6
+    <select id="sortAsc" resultType="com.example.civilizedcity.entity.TdLocType">
7
+        SELECT
8
+        * FROM td_loc_type t
9
+        WHERE
10
+        t.STATUS !=- 1
11
+        order by t.sort_no ASC
12
+    </select>
13
+
14
+
6 15
 </mapper>