Yansen 2 years ago
parent
commit
2b07d86b6e
19 changed files with 569 additions and 98 deletions
  1. 19
    2
      db/.back_文明创办/文明创办-backup-20221216155916.pdma.json
  2. 36
    2
      db/.back_文明创办/文明创办-backup-20221216202913.pdma.json
  3. 64
    7
      db/.back_文明创办/文明创办-backup-20221216202942.pdma.json
  4. 45
    5
      db/文明创办.pdma.json
  5. 4
    0
      src/main/java/com/example/civilizedcity/common/Constants.java
  6. 1
    1
      src/main/java/com/example/civilizedcity/controller/SysOrgController.java
  7. 1
    1
      src/main/java/com/example/civilizedcity/controller/SysPositionController.java
  8. 101
    0
      src/main/java/com/example/civilizedcity/controller/TaCheckItemAnController.java
  9. 58
    16
      src/main/java/com/example/civilizedcity/controller/TaCheckItemController.java
  10. 57
    35
      src/main/java/com/example/civilizedcity/controller/TaCheckItemQuController.java
  11. 34
    25
      src/main/java/com/example/civilizedcity/entity/TaCheckItem.java
  12. 45
    0
      src/main/java/com/example/civilizedcity/entity/TaCheckItemAn.java
  13. 6
    0
      src/main/java/com/example/civilizedcity/entity/TaCheckItemQu.java
  14. 16
    0
      src/main/java/com/example/civilizedcity/mapper/TaCheckItemAnMapper.java
  15. 16
    0
      src/main/java/com/example/civilizedcity/service/TaCheckItemAnService.java
  16. 3
    2
      src/main/java/com/example/civilizedcity/service/TaCheckItemQuService.java
  17. 43
    0
      src/main/java/com/example/civilizedcity/service/impl/TaCheckItemAnServiceImpl.java
  18. 14
    2
      src/main/java/com/example/civilizedcity/service/impl/TaCheckItemQuServiceImpl.java
  19. 6
    0
      src/main/resources/mapper/TaCheckItemAnMapper.xml

db/.back_文明创办/文明创办-backup-20221215163254.pdma.json → db/.back_文明创办/文明创办-backup-20221216155916.pdma.json View File

@@ -4,7 +4,7 @@
4 4
   "avatar": "",
5 5
   "version": "4.1.4",
6 6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2022-12-15 16:32:52",
7
+  "updatedTime": "2022-12-16 09:30:29",
8 8
   "dbConns": [],
9 9
   "profile": {
10 10
     "default": {
@@ -4646,7 +4646,24 @@
4646 4646
           "id": "0EF50BA7-C44F-4D9E-A28D-F94C3D15350F"
4647 4647
         },
4648 4648
         {
4649
-          "defKey": "expire_date",
4649
+          "defKey": "start_date",
4650
+          "defName": "开始日期",
4651
+          "comment": "YYYY-MM-DD",
4652
+          "type": "VARCHAR",
4653
+          "len": 20,
4654
+          "scale": "",
4655
+          "primaryKey": false,
4656
+          "notNull": false,
4657
+          "autoIncrement": false,
4658
+          "defaultValue": "",
4659
+          "hideInGraph": false,
4660
+          "refDict": "",
4661
+          "extProps": {},
4662
+          "domain": "",
4663
+          "id": "79224057-EA94-4244-B887-4A046ACE7B35"
4664
+        },
4665
+        {
4666
+          "defKey": "end_date",
4650 4667
           "defName": "截止时间",
4651 4668
           "comment": "YYYY-MM-DD",
4652 4669
           "type": "VARCHAR",

db/.back_文明创办/文明创办-backup-20221216093029.pdma.json → db/.back_文明创办/文明创办-backup-20221216202913.pdma.json View File

@@ -4,7 +4,7 @@
4 4
   "avatar": "",
5 5
   "version": "4.1.4",
6 6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2022-12-15 16:32:54",
7
+  "updatedTime": "2022-12-16 15:59:16",
8 8
   "dbConns": [],
9 9
   "profile": {
10 10
     "default": {
@@ -4646,7 +4646,24 @@
4646 4646
           "id": "0EF50BA7-C44F-4D9E-A28D-F94C3D15350F"
4647 4647
         },
4648 4648
         {
4649
-          "defKey": "expire_date",
4649
+          "defKey": "start_date",
4650
+          "defName": "开始日期",
4651
+          "comment": "YYYY-MM-DD",
4652
+          "type": "VARCHAR",
4653
+          "len": 20,
4654
+          "scale": "",
4655
+          "primaryKey": false,
4656
+          "notNull": false,
4657
+          "autoIncrement": false,
4658
+          "defaultValue": "",
4659
+          "hideInGraph": false,
4660
+          "refDict": "",
4661
+          "extProps": {},
4662
+          "domain": "",
4663
+          "id": "79224057-EA94-4244-B887-4A046ACE7B35"
4664
+        },
4665
+        {
4666
+          "defKey": "end_date",
4650 4667
           "defName": "截止时间",
4651 4668
           "comment": "YYYY-MM-DD",
4652 4669
           "type": "VARCHAR",
@@ -5063,6 +5080,23 @@
5063 5080
           "domain": "73FD2BAD-2358-4336-B96D-45DC897BD792",
5064 5081
           "id": "3274DF40-5C9F-49E0-8013-A8F8FC5B401A"
5065 5082
         },
5083
+        {
5084
+          "defKey": "type_id",
5085
+          "defName": "点位ID",
5086
+          "comment": "",
5087
+          "type": "",
5088
+          "len": "",
5089
+          "scale": "",
5090
+          "primaryKey": false,
5091
+          "notNull": false,
5092
+          "autoIncrement": false,
5093
+          "defaultValue": "",
5094
+          "hideInGraph": false,
5095
+          "refDict": "",
5096
+          "extProps": {},
5097
+          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
5098
+          "id": "9E210B7C-B1A2-43DB-A734-11B2FA544C96"
5099
+        },
5066 5100
         {
5067 5101
           "defKey": "name",
5068 5102
           "defName": "名称",

db/.back_文明创办/文明创办-backup-20221215163252.pdma.json → db/.back_文明创办/文明创办-backup-20221216202942.pdma.json View File

@@ -4,7 +4,7 @@
4 4
   "avatar": "",
5 5
   "version": "4.1.4",
6 6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2022-12-15 11:04:55",
7
+  "updatedTime": "2022-12-16 20:29:13",
8 8
   "dbConns": [],
9 9
   "profile": {
10 10
     "default": {
@@ -2408,7 +2408,7 @@
2408 2408
           "id": "31357233-866E-45C4-867D-1F11AD8CF851"
2409 2409
         },
2410 2410
         {
2411
-          "defKey": "resource_p_id",
2411
+          "defKey": "parent_id",
2412 2412
           "defName": "上级ID",
2413 2413
           "comment": "",
2414 2414
           "type": "",
@@ -4646,7 +4646,24 @@
4646 4646
           "id": "0EF50BA7-C44F-4D9E-A28D-F94C3D15350F"
4647 4647
         },
4648 4648
         {
4649
-          "defKey": "expire_date",
4649
+          "defKey": "start_date",
4650
+          "defName": "开始日期",
4651
+          "comment": "YYYY-MM-DD",
4652
+          "type": "VARCHAR",
4653
+          "len": 20,
4654
+          "scale": "",
4655
+          "primaryKey": false,
4656
+          "notNull": false,
4657
+          "autoIncrement": false,
4658
+          "defaultValue": "",
4659
+          "hideInGraph": false,
4660
+          "refDict": "",
4661
+          "extProps": {},
4662
+          "domain": "",
4663
+          "id": "79224057-EA94-4244-B887-4A046ACE7B35"
4664
+        },
4665
+        {
4666
+          "defKey": "end_date",
4650 4667
           "defName": "截止时间",
4651 4668
           "comment": "YYYY-MM-DD",
4652 4669
           "type": "VARCHAR",
@@ -5063,6 +5080,23 @@
5063 5080
           "domain": "73FD2BAD-2358-4336-B96D-45DC897BD792",
5064 5081
           "id": "3274DF40-5C9F-49E0-8013-A8F8FC5B401A"
5065 5082
         },
5083
+        {
5084
+          "defKey": "type_id",
5085
+          "defName": "点位ID",
5086
+          "comment": "",
5087
+          "type": "",
5088
+          "len": "",
5089
+          "scale": "",
5090
+          "primaryKey": false,
5091
+          "notNull": false,
5092
+          "autoIncrement": false,
5093
+          "defaultValue": "",
5094
+          "hideInGraph": false,
5095
+          "refDict": "",
5096
+          "extProps": {},
5097
+          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
5098
+          "id": "9E210B7C-B1A2-43DB-A734-11B2FA544C96"
5099
+        },
5066 5100
         {
5067 5101
           "defKey": "name",
5068 5102
           "defName": "名称",
@@ -7004,9 +7038,32 @@
7004 7038
       "id": "507794C4-11E9-4924-AEC5-368BC6E03FD7",
7005 7039
       "env": {
7006 7040
         "base": {
7007
-          "nameSpace": "",
7008
-          "codeRoot": ""
7009
-        }
7041
+          "nameSpace": "com.example.civilizedcity",
7042
+          "codeRoot": "TaCheckItemAn"
7043
+        },
7044
+        "template": {
7045
+          "JavaMybatisPlus": {
7046
+            "Controller": {
7047
+              "suffix": "controller/{{=it.codeRoot}}Controller.java"
7048
+            },
7049
+            "Service": {
7050
+              "suffix": "service/{{=it.codeRoot}}Service.java"
7051
+            },
7052
+            "ServiceImpl": {
7053
+              "suffix": "service/impl/{{=it. codeRoot}}ServiceImpl.java"
7054
+            },
7055
+            "Mapper": {
7056
+              "suffix": "mapper/{{=it.codeRoot}}Mapper.java"
7057
+            },
7058
+            "Mapper.xml": {
7059
+              "suffix": "mapper/{{=it.codeRoot}}Mapper.xml"
7060
+            },
7061
+            "Entity": {
7062
+              "suffix": "entity/{{=it.codeRoot}}.java"
7063
+            }
7064
+          }
7065
+        },
7066
+        "custom": {}
7010 7067
       },
7011 7068
       "defKey": "ta_check_item_an",
7012 7069
       "defName": "项目问题答案",
@@ -7089,7 +7146,7 @@
7089 7146
           "scale": "",
7090 7147
           "primaryKey": true,
7091 7148
           "notNull": true,
7092
-          "autoIncrement": true,
7149
+          "autoIncrement": false,
7093 7150
           "defaultValue": "",
7094 7151
           "hideInGraph": true,
7095 7152
           "domain": "16120F75-6AA7-4483-868D-F07F511BB081",

+ 45
- 5
db/文明创办.pdma.json View File

@@ -4,7 +4,7 @@
4 4
   "avatar": "",
5 5
   "version": "4.1.4",
6 6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2022-12-16 09:30:29",
7
+  "updatedTime": "2022-12-16 20:29:42",
8 8
   "dbConns": [],
9 9
   "profile": {
10 10
     "default": {
@@ -5080,6 +5080,23 @@
5080 5080
           "domain": "73FD2BAD-2358-4336-B96D-45DC897BD792",
5081 5081
           "id": "3274DF40-5C9F-49E0-8013-A8F8FC5B401A"
5082 5082
         },
5083
+        {
5084
+          "defKey": "type_id",
5085
+          "defName": "点位ID",
5086
+          "comment": "",
5087
+          "type": "",
5088
+          "len": "",
5089
+          "scale": "",
5090
+          "primaryKey": false,
5091
+          "notNull": false,
5092
+          "autoIncrement": false,
5093
+          "defaultValue": "",
5094
+          "hideInGraph": false,
5095
+          "refDict": "",
5096
+          "extProps": {},
5097
+          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
5098
+          "id": "9E210B7C-B1A2-43DB-A734-11B2FA544C96"
5099
+        },
5083 5100
         {
5084 5101
           "defKey": "name",
5085 5102
           "defName": "名称",
@@ -7021,9 +7038,32 @@
7021 7038
       "id": "507794C4-11E9-4924-AEC5-368BC6E03FD7",
7022 7039
       "env": {
7023 7040
         "base": {
7024
-          "nameSpace": "",
7025
-          "codeRoot": ""
7026
-        }
7041
+          "nameSpace": "com.example.civilizedcity",
7042
+          "codeRoot": "TaCheckItemAn"
7043
+        },
7044
+        "template": {
7045
+          "JavaMybatisPlus": {
7046
+            "Controller": {
7047
+              "suffix": "controller/{{=it.codeRoot}}Controller.java"
7048
+            },
7049
+            "Service": {
7050
+              "suffix": "service/{{=it.codeRoot}}Service.java"
7051
+            },
7052
+            "ServiceImpl": {
7053
+              "suffix": "service/impl/{{=it. codeRoot}}ServiceImpl.java"
7054
+            },
7055
+            "Mapper": {
7056
+              "suffix": "mapper/{{=it.codeRoot}}Mapper.java"
7057
+            },
7058
+            "Mapper.xml": {
7059
+              "suffix": "mapper/{{=it.codeRoot}}Mapper.xml"
7060
+            },
7061
+            "Entity": {
7062
+              "suffix": "entity/{{=it.codeRoot}}.java"
7063
+            }
7064
+          }
7065
+        },
7066
+        "custom": {}
7027 7067
       },
7028 7068
       "defKey": "ta_check_item_an",
7029 7069
       "defName": "项目问题答案",
@@ -7106,7 +7146,7 @@
7106 7146
           "scale": "",
7107 7147
           "primaryKey": true,
7108 7148
           "notNull": true,
7109
-          "autoIncrement": true,
7149
+          "autoIncrement": false,
7110 7150
           "defaultValue": "",
7111 7151
           "hideInGraph": true,
7112 7152
           "domain": "16120F75-6AA7-4483-868D-F07F511BB081",

+ 4
- 0
src/main/java/com/example/civilizedcity/common/Constants.java View File

@@ -6,4 +6,8 @@ public class Constants {
6 6
     public final static int STATUS_DELETE = -1;
7 7
     public final static int STATUS_READY = 0;
8 8
     public final static int STATUS_NORMAL = 1;
9
+
10
+
11
+    public final static String CHECK_ITEM_LOC = "loc";  // 实例调研
12
+    public final static String CHECK_ITEM_SURVEY = "survey";  // 问卷调研
9 13
 }

+ 1
- 1
src/main/java/com/example/civilizedcity/controller/SysOrgController.java View File

@@ -61,7 +61,7 @@ public class SysOrgController extends BaseController {
61 61
 
62 62
         IPage<SysOrg> pg = new Page<>(pageNum, pageSize);
63 63
         QueryWrapper<SysOrg> queryWrapper = new QueryWrapper<>();
64
-        queryWrapper.like(StringUtils.isEmpty(name), "name", name);
64
+        queryWrapper.like(!StringUtils.isEmpty(name), "name", name);
65 65
         queryWrapper.gt("status", Constants.STATUS_DELETE);
66 66
         queryWrapper.orderByDesc("create_date");
67 67
         IPage<SysOrg> result = sysOrgService.page(pg, queryWrapper);

+ 1
- 1
src/main/java/com/example/civilizedcity/controller/SysPositionController.java View File

@@ -120,7 +120,7 @@ public class SysPositionController extends BaseController {
120 120
             return ResponseBean.error("名称已存在");
121 121
         }
122 122
 
123
-        sysPosition.setPositionPId(id);
123
+        sysPosition.setPositionId(id);
124 124
         sysPositionService.updateById(sysPosition);
125 125
         return ResponseBean.success(sysPosition);
126 126
     }

+ 101
- 0
src/main/java/com/example/civilizedcity/controller/TaCheckItemAnController.java View File

@@ -0,0 +1,101 @@
1
+package com.example.civilizedcity.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.example.civilizedcity.common.BaseController;
7
+import com.example.civilizedcity.common.ResponseBean;
8
+import java.util.List;
9
+import io.swagger.annotations.Api;
10
+import io.swagger.annotations.ApiOperation;
11
+import io.swagger.annotations.ApiParam;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.web.bind.annotation.*;
14
+import com.example.civilizedcity.entity.TaCheckItemAn;
15
+import com.example.civilizedcity.service.TaCheckItemAnService;
16
+
17
+ /**
18
+ * 项目问题答案;(ta_check_item_an)表控制层
19
+ * @author : http://njyunzhi.com
20
+ * @date : 2022-12-16
21
+ */
22
+@Api(tags = "项目问题答案对象功能接口")
23
+@RestController
24
+@RequestMapping("/")
25
+public class TaCheckItemAnController extends BaseController {
26
+    
27
+    @Autowired
28
+    private TaCheckItemAnService taCheckItemAnService;
29
+    
30
+    /** 
31
+     * 通过ID查询单条数据 
32
+     *
33
+     * @param answerId 主键
34
+     * @return 实例对象
35
+     */
36
+    @ApiOperation("通过ID查询单条数据")
37
+    @GetMapping("/taCheckItemAn/{id}")
38
+    public ResponseBean queryById(@ApiParam("对象ID") @PathVariable String id) throws Exception {
39
+        return ResponseBean.success(taCheckItemAnService.getById(id));
40
+    }
41
+    
42
+    /** 
43
+     * 分页查询
44
+     *
45
+     * @param pageNum 当前页码
46
+     * @param pageSize 每页条数
47
+     * @return 查询结果
48
+     */
49
+    @ApiOperation("分页查询")
50
+    @GetMapping("/taCheckItemAn")
51
+    public ResponseBean list(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
+                            @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception {
53
+        
54
+        IPage<TaCheckItemAn> pg = new Page<>(pageNum, pageSize);
55
+        // QueryWrapper<TaCheckItemAn> queryWrapper = new QueryWrapper<>();
56
+        // queryWrapper.orderByDesc("create_date");
57
+        IPage<TaCheckItemAn> result = taCheckItemAnService.page(pg);
58
+        
59
+        return ResponseBean.success(result);
60
+    }
61
+    
62
+    /** 
63
+     * 新增数据
64
+     *
65
+     * @param taCheckItemAn 实例对象
66
+     * @return 实例对象
67
+     */
68
+    @ApiOperation("新增数据")
69
+    @PostMapping("/taCheckItemAn")
70
+    public ResponseBean add(@ApiParam("对象实体") @RequestBody TaCheckItemAn taCheckItemAn) throws Exception {
71
+        taCheckItemAnService.save(taCheckItemAn);
72
+        return ResponseBean.success(taCheckItemAn);
73
+    }
74
+    
75
+    /** 
76
+     * 更新数据
77
+     *
78
+     * @param taCheckItemAn 实例对象
79
+     * @return 实例对象
80
+     */
81
+    @ApiOperation("更新数据")
82
+    @PutMapping("/taCheckItemAn/{id}")
83
+    public ResponseBean edit(@ApiParam("对象实体") @RequestBody TaCheckItemAn taCheckItemAn,
84
+                            @ApiParam("对象ID") @PathVariable String id ) throws Exception {
85
+        taCheckItemAnService.updateById(taCheckItemAn);
86
+        return ResponseBean.success(taCheckItemAn);
87
+    }
88
+    
89
+    /** 
90
+     * 通过主键删除数据
91
+     *
92
+     * @param answerId 主键
93
+     * @return 是否成功
94
+     */
95
+    @ApiOperation("通过主键删除数据")
96
+    @DeleteMapping("/taCheckItemAn/{id}")
97
+    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id){
98
+        taCheckItemAnService.removeLogicById(id);
99
+        return ResponseBean.success("success");
100
+    }
101
+}

+ 58
- 16
src/main/java/com/example/civilizedcity/controller/TaCheckItemController.java View File

@@ -4,8 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.example.civilizedcity.common.BaseController;
7
+import com.example.civilizedcity.common.Constants;
7 8
 import com.example.civilizedcity.common.ResponseBean;
9
+
10
+import java.time.LocalDateTime;
8 11
 import java.util.List;
12
+
13
+import com.example.civilizedcity.common.StringUtils;
9 14
 import io.swagger.annotations.Api;
10 15
 import io.swagger.annotations.ApiOperation;
11 16
 import io.swagger.annotations.ApiParam;
@@ -27,8 +32,8 @@ public class TaCheckItemController extends BaseController {
27 32
     @Autowired
28 33
     private TaCheckItemService taCheckItemService;
29 34
     
30
-    /** 
31
-     * 通过ID查询单条数据 
35
+    /**
36
+     * 通过ID查询单条数据
32 37
      *
33 38
      * @param itemId 主键
34 39
      * @return 实例对象
@@ -38,6 +43,31 @@ public class TaCheckItemController extends BaseController {
38 43
     public ResponseBean queryById(@ApiParam("对象ID") @PathVariable String id) throws Exception {
39 44
         return ResponseBean.success(taCheckItemService.getById(id));
40 45
     }
46
+
47
+     /**
48
+      * 通过测评以及点位查询数据
49
+      *
50
+      * @param checkId 测评ID
51
+      * @param typeId 点位ID
52
+      * @return 实例对象
53
+      */
54
+     @ApiOperation("通过测评以及点位查询数据")
55
+     @GetMapping("/taCheck/{checkId}/item/{typeId}")
56
+     public ResponseBean queryByCheckId(@ApiParam("测评ID") @PathVariable String checkId,
57
+                                        @ApiParam("点位ID") @PathVariable String typeId) throws Exception {
58
+
59
+         return ResponseBean.success(getByCheckAndType(checkId, typeId));
60
+     }
61
+
62
+     private TaCheckItem getByCheckAndType(String checkId, String typeId) {
63
+         QueryWrapper<TaCheckItem> queryWrapper = new QueryWrapper<>();
64
+         queryWrapper.eq("check_id", checkId);
65
+         queryWrapper.eq("item_type", Constants.CHECK_ITEM_LOC); // 只查点位
66
+         queryWrapper.eq("type_id", typeId);
67
+         queryWrapper.gt("status", Constants.STATUS_DELETE);
68
+
69
+        return taCheckItemService.getOne(queryWrapper);
70
+     }
41 71
     
42 72
     /** 
43 73
      * 分页查询
@@ -68,23 +98,35 @@ public class TaCheckItemController extends BaseController {
68 98
     @ApiOperation("新增数据")
69 99
     @PostMapping("/taCheckItem")
70 100
     public ResponseBean add(@ApiParam("对象实体") @RequestBody TaCheckItem taCheckItem) throws Exception {
71
-        taCheckItemService.save(taCheckItem);
101
+
102
+        TaCheckItem origin = getByCheckAndType(taCheckItem.getCheckId(), taCheckItem.getItemId());
103
+        if (null == origin) {
104
+            // 新增
105
+            taCheckItem.setStatus(Constants.STATUS_NORMAL);
106
+            taCheckItem.setCreateDate(LocalDateTime.now());
107
+            taCheckItemService.save(taCheckItem);
108
+        } else {
109
+            // 更新
110
+            taCheckItem.setItemId((origin.getItemId()));
111
+            taCheckItemService.updateById(taCheckItem);
112
+        }
113
+
72 114
         return ResponseBean.success(taCheckItem);
73 115
     }
74 116
     
75
-    /** 
76
-     * 更新数据
77
-     *
78
-     * @param taCheckItem 实例对象
79
-     * @return 实例对象
80
-     */
81
-    @ApiOperation("更新数据")
82
-    @PutMapping("/taCheckItem/{id}")
83
-    public ResponseBean edit(@ApiParam("对象实体") @RequestBody TaCheckItem taCheckItem,
84
-                            @ApiParam("对象ID") @PathVariable String id ) throws Exception {
85
-        taCheckItemService.updateById(taCheckItem);
86
-        return ResponseBean.success(taCheckItem);
87
-    }
117
+//    /**
118
+//     * 更新数据
119
+//     *
120
+//     * @param taCheckItem 实例对象
121
+//     * @return 实例对象
122
+//     */
123
+//    @ApiOperation("更新数据")
124
+//    @PutMapping("/taCheckItem/{id}")
125
+//    public ResponseBean edit(@ApiParam("对象实体") @RequestBody TaCheckItem taCheckItem,
126
+//                            @ApiParam("对象ID") @PathVariable String id ) throws Exception {
127
+//        taCheckItemService.updateById(taCheckItem);
128
+//        return ResponseBean.success(taCheckItem);
129
+//    }
88 130
     
89 131
     /** 
90 132
      * 通过主键删除数据

+ 57
- 35
src/main/java/com/example/civilizedcity/controller/TaCheckItemQuController.java View File

@@ -5,7 +5,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.example.civilizedcity.common.BaseController;
7 7
 import com.example.civilizedcity.common.ResponseBean;
8
+
8 9
 import java.util.List;
10
+
11
+import com.example.civilizedcity.common.StringUtils;
12
+import com.example.civilizedcity.service.TaCheckItemAnService;
9 13
 import io.swagger.annotations.Api;
10 14
 import io.swagger.annotations.ApiOperation;
11 15
 import io.swagger.annotations.ApiParam;
@@ -14,8 +18,9 @@ import org.springframework.web.bind.annotation.*;
14 18
 import com.example.civilizedcity.entity.TaCheckItemQu;
15 19
 import com.example.civilizedcity.service.TaCheckItemQuService;
16 20
 
17
- /**
21
+/**
18 22
  * 点位问题;(ta_check_item_qu)表控制层
23
+ *
19 24
  * @author : http://njyunzhi.com
20 25
  * @date : 2022-12-13
21 26
  */
@@ -23,12 +28,15 @@ import com.example.civilizedcity.service.TaCheckItemQuService;
23 28
 @RestController
24 29
 @RequestMapping("/")
25 30
 public class TaCheckItemQuController extends BaseController {
26
-    
31
+
27 32
     @Autowired
28 33
     private TaCheckItemQuService taCheckItemQuService;
29
-    
30
-    /** 
31
-     * 通过ID查询单条数据 
34
+
35
+    @Autowired
36
+    private TaCheckItemAnService taCheckItemAnService;
37
+
38
+    /**
39
+     * 通过ID查询单条数据
32 40
      *
33 41
      * @param id 主键
34 42
      * @return 实例对象
@@ -38,28 +46,30 @@ public class TaCheckItemQuController extends BaseController {
38 46
     public ResponseBean queryById(@ApiParam("对象ID") @PathVariable Integer id) throws Exception {
39 47
         return ResponseBean.success(taCheckItemQuService.getById(id));
40 48
     }
41
-    
42
-    /** 
49
+
50
+    /**
43 51
      * 分页查询
44 52
      *
45
-     * @param pageNum 当前页码
53
+     * @param pageNum  当前页码
46 54
      * @param pageSize 每页条数
47 55
      * @return 查询结果
48 56
      */
49 57
     @ApiOperation("分页查询")
50 58
     @GetMapping("/taCheckItemQu")
51
-    public ResponseBean list(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-                            @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception {
53
-        
59
+    public ResponseBean list(@ApiParam("页码") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
60
+                             @ApiParam("单页数据量") @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
61
+                             @ApiParam("点位ID") @RequestParam(value = "itemId") String itemId) throws Exception {
62
+
54 63
         IPage<TaCheckItemQu> pg = new Page<>(pageNum, pageSize);
55
-        // QueryWrapper<TaCheckItemQu> queryWrapper = new QueryWrapper<>();
56
-        // queryWrapper.orderByDesc("create_date");
57
-        IPage<TaCheckItemQu> result = taCheckItemQuService.page(pg);
58
-        
64
+        QueryWrapper<TaCheckItemQu> queryWrapper = new QueryWrapper<>();
65
+        queryWrapper.eq("item_id", itemId);
66
+        queryWrapper.orderByDesc("sort_no");
67
+        IPage<TaCheckItemQu> result = taCheckItemQuService.page(pg, queryWrapper);
68
+
59 69
         return ResponseBean.success(result);
60 70
     }
61
-    
62
-    /** 
71
+
72
+    /**
63 73
      * 新增数据
64 74
      *
65 75
      * @param taCheckItemQu 实例对象
@@ -68,25 +78,37 @@ public class TaCheckItemQuController extends BaseController {
68 78
     @ApiOperation("新增数据")
69 79
     @PostMapping("/taCheckItemQu")
70 80
     public ResponseBean add(@ApiParam("对象实体") @RequestBody TaCheckItemQu taCheckItemQu) throws Exception {
71
-        taCheckItemQuService.save(taCheckItemQu);
72
-        return ResponseBean.success(taCheckItemQu);
73
-    }
74
-    
75
-    /** 
76
-     * 更新数据
77
-     *
78
-     * @param taCheckItemQu 实例对象
79
-     * @return 实例对象
80
-     */
81
-    @ApiOperation("更新数据")
82
-    @PutMapping("/taCheckItemQu/{id}")
83
-    public ResponseBean edit(@ApiParam("对象实体") @RequestBody TaCheckItemQu taCheckItemQu,
84
-                            @ApiParam("对象ID") @PathVariable Integer id ) throws Exception {
85
-        taCheckItemQuService.updateById(taCheckItemQu);
81
+        String quId = taCheckItemQu.getQuId();
82
+
83
+        if (StringUtils.isEmpty(quId)) {
84
+            // 新增
85
+            int maxNo = taCheckItemQuService.getMaxNoBy(taCheckItemQu.getItemId());
86
+            taCheckItemQu.setSortNo(maxNo + 1);
87
+            taCheckItemQuService.save(taCheckItemQu);
88
+        } else {
89
+            taCheckItemQuService.updateById(taCheckItemQu);
90
+        }
91
+
92
+        taCheckItemAnService.mergeData(taCheckItemQu.getQuId(), taCheckItemQu.getAnswerList());
93
+
86 94
         return ResponseBean.success(taCheckItemQu);
87 95
     }
88
-    
89
-    /** 
96
+
97
+//    /**
98
+//     * 更新数据
99
+//     *
100
+//     * @param taCheckItemQu 实例对象
101
+//     * @return 实例对象
102
+//     */
103
+//    @ApiOperation("更新数据")
104
+//    @PutMapping("/taCheckItemQu/{id}")
105
+//    public ResponseBean edit(@ApiParam("对象实体") @RequestBody TaCheckItemQu taCheckItemQu,
106
+//                            @ApiParam("对象ID") @PathVariable Integer id ) throws Exception {
107
+//        taCheckItemQuService.updateById(taCheckItemQu);
108
+//        return ResponseBean.success(taCheckItemQu);
109
+//    }
110
+
111
+    /**
90 112
      * 通过主键删除数据
91 113
      *
92 114
      * @param id 主键
@@ -94,7 +116,7 @@ public class TaCheckItemQuController extends BaseController {
94 116
      */
95 117
     @ApiOperation("通过主键删除数据")
96 118
     @DeleteMapping("/taCheckItemQu/{id}")
97
-    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable Integer id){
119
+    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable Integer id) {
98 120
         taCheckItemQuService.removeLogicById(id);
99 121
         return ResponseBean.success("success");
100 122
     }

+ 34
- 25
src/main/java/com/example/civilizedcity/entity/TaCheckItem.java View File

@@ -22,30 +22,39 @@ import lombok.experimental.Accessors;
22 22
 @ApiModel(value = "测评点位",description = "")
23 23
 @TableName("ta_check_item")
24 24
 public class TaCheckItem implements Serializable,Cloneable{
25
-      /** 点位ID */
26
-      @ApiModelProperty(name = "点位ID",notes = "")
27
-      @TableId(value = "item_id", type = IdType.INPUT)
28
-      private String itemId ;
29
-      /** 所属测评 */
30
-      @ApiModelProperty(name = "所属测评",notes = "")
31
-      private String checkId ;
32
-      /** 名称 */
33
-      @ApiModelProperty(name = "名称",notes = "")
34
-      private String name ;
35
-      /** 满分 */
36
-      @ApiModelProperty(name = "满分",notes = "")
37
-      private Double score ;
38
-      /** 事件份数 */
39
-      @ApiModelProperty(name = "事件份数",notes = "")
40
-      private Integer examinationNum ;
41
-      /** 状态 */
42
-      @ApiModelProperty(name = "状态",notes = "")
43
-      private Integer status ;
44
-      /** 创建人 */
45
-      @ApiModelProperty(name = "创建人",notes = "")
46
-      private String createUser ;
47
-      /** 创建时间 */
48
-      @ApiModelProperty(name = "创建时间",notes = "")
49
-      private LocalDateTime createDate ;
25
+       /** 点位ID */
26
+       @ApiModelProperty(name = "点位ID",notes = "")
27
+       @TableId(value = "item_id", type = IdType.ASSIGN_UUID)
28
+       private String itemId ;
29
+       /** 所属测评 */
30
+       @ApiModelProperty(name = "所属测评",notes = "")
31
+       private String checkId ;
32
+       /** 项目类型;loc点位,survey问卷调查 */
33
+       @ApiModelProperty(name = "项目类型",notes = "loc点位,survey问卷调查")
34
+       private String itemType ;
35
+        /** 点位ID */
36
+        @ApiModelProperty(name = "点位ID",notes = "")
37
+        private String typeId ;
38
+       /** 名称 */
39
+       @ApiModelProperty(name = "名称",notes = "")
40
+       private String name ;
41
+       /** 满分 */
42
+       @ApiModelProperty(name = "满分",notes = "")
43
+       private Double fullScore ;
44
+       /** 得分 */
45
+       @ApiModelProperty(name = "得分",notes = "")
46
+       private Double score ;
47
+       /** 数量 */
48
+       @ApiModelProperty(name = "数量",notes = "")
49
+       private Integer num ;
50
+       /** 状态 */
51
+       @ApiModelProperty(name = "状态",notes = "")
52
+       private Integer status ;
53
+       /** 创建人 */
54
+       @ApiModelProperty(name = "创建人",notes = "")
55
+       private String createUser ;
56
+       /** 创建时间 */
57
+       @ApiModelProperty(name = "创建时间",notes = "")
58
+       private LocalDateTime createDate ;
50 59
 
51 60
 }

+ 45
- 0
src/main/java/com/example/civilizedcity/entity/TaCheckItemAn.java View File

@@ -0,0 +1,45 @@
1
+package com.example.civilizedcity.entity;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import com.baomidou.mybatisplus.annotation.IdType;
6
+import com.baomidou.mybatisplus.annotation.TableName;
7
+import com.baomidou.mybatisplus.annotation.TableId;
8
+import java.io.Serializable;
9
+import java.time.LocalDateTime;
10
+import lombok.Data;
11
+import lombok.EqualsAndHashCode;
12
+import lombok.experimental.Accessors;
13
+
14
+ /**
15
+ * 项目问题答案;
16
+ * @author : http://www.chiner.pro
17
+ * @date : 2022-12-16
18
+ */
19
+@Data
20
+@EqualsAndHashCode(callSuper = false)
21
+@Accessors(chain = true)
22
+@ApiModel(value = "项目问题答案",description = "")
23
+@TableName("ta_check_item_an")
24
+public class TaCheckItemAn implements Serializable,Cloneable{
25
+    /** 答案ID */
26
+    @ApiModelProperty(name = "答案ID",notes = "")
27
+    @TableId(value = "answer_id", type = IdType.ASSIGN_UUID)
28
+    private String answerId ;
29
+    /** 问题ID */
30
+    @ApiModelProperty(name = "问题ID",notes = "")
31
+    private String quId ;
32
+    /** 答案选项;ABCD等 */
33
+    @ApiModelProperty(name = "答案选项",notes = "ABCD等")
34
+    private String answerCode ;
35
+    /** 答案 */
36
+    @ApiModelProperty(name = "答案",notes = "")
37
+    private String answer ;
38
+    /** 分值 */
39
+    @ApiModelProperty(name = "分值",notes = "")
40
+    private Double score ;
41
+    /** 排序 */
42
+    @ApiModelProperty(name = "排序",notes = "")
43
+    private Integer sortNo ;
44
+
45
+}

+ 6
- 0
src/main/java/com/example/civilizedcity/entity/TaCheckItemQu.java View File

@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
7 7
 import com.baomidou.mybatisplus.annotation.TableId;
8 8
 import java.io.Serializable;
9 9
 import java.time.LocalDateTime;
10
+import java.util.List;
11
+
10 12
 import lombok.Data;
11 13
 import lombok.EqualsAndHashCode;
12 14
 import lombok.experimental.Accessors;
@@ -51,4 +53,8 @@ public class TaCheckItemQu implements Serializable,Cloneable{
51 53
      @ApiModelProperty(name = "序号",notes = "")
52 54
      private Integer sortNo ;
53 55
 
56
+      /**
57
+       * 答案列表
58
+       */
59
+     List<TaCheckItemAn> answerList;
54 60
 }

+ 16
- 0
src/main/java/com/example/civilizedcity/mapper/TaCheckItemAnMapper.java View File

@@ -0,0 +1,16 @@
1
+package com.example.civilizedcity.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+import com.example.civilizedcity.entity.TaCheckItemAn;
7
+
8
+ /**
9
+ * 项目问题答案;(ta_check_item_an)表数据库访问层
10
+ * @author : http://njyunzhi.com
11
+ * @date : 2022-12-16
12
+ */
13
+@Mapper
14
+public interface TaCheckItemAnMapper  extends BaseMapper<TaCheckItemAn>{
15
+    
16
+}

+ 16
- 0
src/main/java/com/example/civilizedcity/service/TaCheckItemAnService.java View File

@@ -0,0 +1,16 @@
1
+package com.example.civilizedcity.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.example.civilizedcity.entity.TaCheckItemAn;
5
+
6
+import java.util.List;
7
+
8
+/**
9
+ * 项目问题答案;(ta_check_item_an)表服务接口
10
+ * @author : http://njyunzhi.com
11
+ * @date : 2022-12-16
12
+ */
13
+public interface TaCheckItemAnService extends IBaseService<TaCheckItemAn> {
14
+
15
+     boolean mergeData(String quId, List<TaCheckItemAn> answerList);
16
+ }

+ 3
- 2
src/main/java/com/example/civilizedcity/service/TaCheckItemQuService.java View File

@@ -9,5 +9,6 @@ import com.example.civilizedcity.entity.TaCheckItemQu;
9 9
  * @date : 2022-12-13
10 10
  */
11 11
 public interface TaCheckItemQuService extends IBaseService<TaCheckItemQu> {
12
-    
13
-}
12
+
13
+     int getMaxNoBy(String itemId);
14
+ }

+ 43
- 0
src/main/java/com/example/civilizedcity/service/impl/TaCheckItemAnServiceImpl.java View File

@@ -0,0 +1,43 @@
1
+package com.example.civilizedcity.service.impl;
2
+
3
+import com.example.civilizedcity.common.StringUtils;
4
+import com.example.civilizedcity.entity.SysRole;
5
+import com.example.civilizedcity.entity.SysUserRole;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.stereotype.Service;
8
+import com.example.civilizedcity.entity.TaCheckItemAn;
9
+import com.example.civilizedcity.mapper.TaCheckItemAnMapper;
10
+import com.example.civilizedcity.service.TaCheckItemAnService;
11
+
12
+import java.util.ArrayList;
13
+import java.util.HashMap;
14
+import java.util.List;
15
+
16
+/**
17
+ * 项目问题答案;(ta_check_item_an)表服务实现类
18
+ *
19
+ * @author : http://www.chiner.pro
20
+ * @date : 2022-12-16
21
+ */
22
+@Service
23
+public class TaCheckItemAnServiceImpl extends BaseServiceImpl<TaCheckItemAnMapper, TaCheckItemAn> implements TaCheckItemAnService {
24
+
25
+    @Override
26
+    public boolean mergeData(String quId, List<TaCheckItemAn> answerList) {
27
+        if (StringUtils.isEmpty(quId)) return false;
28
+
29
+        // 先删除所有
30
+        baseMapper.deleteByMap(new HashMap<String, Object>() {{
31
+            put("qu_id", quId);
32
+        }});
33
+
34
+        for (int i = 0; i < answerList.size(); i ++) {
35
+            TaCheckItemAn item = answerList.get(i);
36
+            // 重新排序
37
+            item.setSortNo(i + 1);
38
+            save(item);
39
+        }
40
+
41
+        return true;
42
+    }
43
+}

+ 14
- 2
src/main/java/com/example/civilizedcity/service/impl/TaCheckItemQuServiceImpl.java View File

@@ -1,16 +1,28 @@
1 1
 package com.example.civilizedcity.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3 4
 import org.springframework.beans.factory.annotation.Autowired;
4 5
 import org.springframework.stereotype.Service;
5 6
 import com.example.civilizedcity.entity.TaCheckItemQu;
6 7
 import com.example.civilizedcity.mapper.TaCheckItemQuMapper;
7 8
 import com.example.civilizedcity.service.TaCheckItemQuService;
8
- /**
9
+
10
+/**
9 11
  * 点位问题;(ta_check_item_qu)表服务实现类
12
+ *
10 13
  * @author : http://www.chiner.pro
11 14
  * @date : 2022-12-13
12 15
  */
13 16
 @Service
14 17
 public class TaCheckItemQuServiceImpl extends BaseServiceImpl<TaCheckItemQuMapper, TaCheckItemQu> implements TaCheckItemQuService {
15
-    
18
+
19
+    @Override
20
+    public int getMaxNoBy(String itemId) {
21
+        QueryWrapper<TaCheckItemQu> queryWrapper = new QueryWrapper<>();
22
+        queryWrapper.eq("item_id", itemId);
23
+        queryWrapper.orderByDesc("sort_no");
24
+
25
+        TaCheckItemQu one = getOne(queryWrapper);
26
+        return null == one ? 0 : one.getSortNo();
27
+    }
16 28
 }

+ 6
- 0
src/main/resources/mapper/TaCheckItemAnMapper.xml View File

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+
4
+<mapper namespace="com.example.civilizedcity.mapper.TaCheckItemAnMapper">
5
+    
6
+</mapper>