Yansen 2 years ago
parent
commit
b48cc0a075

db/.back_文明创办/文明创办-backup-202312205100.pdma.json → db/.back_文明创办/文明创办-backup-202314090735.pdma.json View File

@@ -4,7 +4,7 @@
4 4
   "avatar": "",
5 5
   "version": "4.2.0",
6 6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2023-1-2 15:24:42",
7
+  "updatedTime": "2023-1-2 22:36:59",
8 8
   "dbConns": [],
9 9
   "profile": {
10 10
     "default": {
@@ -7985,9 +7985,38 @@
7985 7985
       "id": "430EE745-314D-48CE-A20B-ED2C4D79BC92",
7986 7986
       "env": {
7987 7987
         "base": {
7988
-          "nameSpace": "",
7989
-          "codeRoot": ""
7990
-        }
7988
+          "nameSpace": "com.example.civilizedcity",
7989
+          "codeRoot": "TaMessage"
7990
+        },
7991
+        "template": {
7992
+          "JavaMybatisPlus": {
7993
+            "Controller": {
7994
+              "suffix": "controller/{{=it.codeRoot}}Controller.java",
7995
+              "enable": true
7996
+            },
7997
+            "Service": {
7998
+              "suffix": "service/{{=it.codeRoot}}Service.java",
7999
+              "enable": true
8000
+            },
8001
+            "ServiceImpl": {
8002
+              "suffix": "service/impl/{{=it. codeRoot}}ServiceImpl.java",
8003
+              "enable": true
8004
+            },
8005
+            "Mapper": {
8006
+              "suffix": "mapper/{{=it.codeRoot}}Mapper.java",
8007
+              "enable": true
8008
+            },
8009
+            "Mapper.xml": {
8010
+              "suffix": "mapper/{{=it.codeRoot}}Mapper.xml",
8011
+              "enable": true
8012
+            },
8013
+            "Entity": {
8014
+              "suffix": "entity/{{=it.codeRoot}}.java",
8015
+              "enable": true
8016
+            }
8017
+          }
8018
+        },
8019
+        "custom": {}
7991 8020
       },
7992 8021
       "defKey": "ta_message",
7993 8022
       "defName": "消息通知",
@@ -8063,25 +8092,25 @@
8063 8092
       ],
8064 8093
       "fields": [
8065 8094
         {
8066
-          "defKey": "id",
8095
+          "defKey": "msg_id",
8067 8096
           "defName": "ID",
8068 8097
           "comment": "",
8069 8098
           "type": "",
8070
-          "len": 32,
8099
+          "len": "",
8071 8100
           "scale": "",
8072 8101
           "primaryKey": true,
8073 8102
           "notNull": true,
8074
-          "autoIncrement": false,
8103
+          "autoIncrement": true,
8075 8104
           "defaultValue": "",
8076 8105
           "hideInGraph": true,
8077
-          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
8106
+          "domain": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E",
8078 8107
           "refDict": "",
8079 8108
           "uiHint": "",
8080 8109
           "id": "FC7B9B05-7D57-4818-8266-F8A4D62DB212"
8081 8110
         },
8082 8111
         {
8083
-          "defKey": "org_id",
8084
-          "defName": "机构ID",
8112
+          "defKey": "msg_type",
8113
+          "defName": "消息类型",
8085 8114
           "comment": "",
8086 8115
           "type": "",
8087 8116
           "len": "",
@@ -8092,32 +8121,82 @@
8092 8121
           "defaultValue": "",
8093 8122
           "hideInGraph": false,
8094 8123
           "refDict": "",
8095
-          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
8096
-          "id": "FBCA3E18-1ABB-4B48-8370-9A9FB679B5A7",
8097
-          "uiHint": ""
8124
+          "extProps": {},
8125
+          "domain": "73FD2BAD-2358-4336-B96D-45DC897BD792",
8126
+          "id": "92ACF22A-5638-4B62-9656-71D9089F7D7E"
8098 8127
         },
8099 8128
         {
8100
-          "defKey": "status",
8101
-          "defName": "状态",
8129
+          "defKey": "title",
8130
+          "defName": "消息标题",
8102 8131
           "comment": "",
8103
-          "domain": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E",
8104 8132
           "type": "",
8105 8133
           "len": "",
8106 8134
           "scale": "",
8107 8135
           "primaryKey": false,
8108 8136
           "notNull": false,
8109 8137
           "autoIncrement": false,
8110
-          "defaultValue": "1",
8111
-          "hideInGraph": true,
8138
+          "defaultValue": "",
8139
+          "hideInGraph": false,
8112 8140
           "refDict": "",
8113
-          "uiHint": "",
8114
-          "id": "E1646EEB-D7B3-4C90-91B1-C5D45348549C"
8141
+          "extProps": {},
8142
+          "domain": "9092C4E0-1A54-4859-ABBB-5B62DBC27573",
8143
+          "id": "CBA249ED-8EBD-4352-843D-7F6593CFE0CA"
8115 8144
         },
8116 8145
         {
8117
-          "defKey": "create_user",
8118
-          "defName": "创建人",
8146
+          "defKey": "content",
8147
+          "defName": "消息内容",
8119 8148
           "comment": "",
8149
+          "type": "TEXT",
8150
+          "len": 0,
8151
+          "scale": "",
8152
+          "primaryKey": false,
8153
+          "notNull": false,
8154
+          "autoIncrement": false,
8155
+          "defaultValue": "",
8156
+          "hideInGraph": false,
8157
+          "refDict": "",
8158
+          "extProps": {},
8159
+          "domain": "",
8160
+          "id": "C333DA5B-4402-4455-BC1A-156E0F7171CE"
8161
+        },
8162
+        {
8163
+          "defKey": "target_type",
8164
+          "defName": "关联内容",
8165
+          "comment": "",
8166
+          "type": "",
8167
+          "len": "",
8168
+          "scale": "",
8169
+          "primaryKey": false,
8170
+          "notNull": false,
8171
+          "autoIncrement": false,
8172
+          "defaultValue": "",
8173
+          "hideInGraph": false,
8174
+          "refDict": "",
8175
+          "extProps": {},
8176
+          "domain": "73FD2BAD-2358-4336-B96D-45DC897BD792",
8177
+          "id": "402577E1-743E-42F4-976B-984FEEBAF594"
8178
+        },
8179
+        {
8180
+          "defKey": "target_id",
8181
+          "defName": "关联内容ID",
8182
+          "comment": "",
8183
+          "type": "",
8184
+          "len": "",
8185
+          "scale": "",
8186
+          "primaryKey": false,
8187
+          "notNull": false,
8188
+          "autoIncrement": false,
8189
+          "defaultValue": "",
8190
+          "hideInGraph": false,
8191
+          "refDict": "",
8192
+          "extProps": {},
8120 8193
           "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
8194
+          "id": "D67DAC89-0B94-42B6-AB35-C048092E53BC"
8195
+        },
8196
+        {
8197
+          "defKey": "receive_user",
8198
+          "defName": "接收人员",
8199
+          "comment": "",
8121 8200
           "type": "",
8122 8201
           "len": "",
8123 8202
           "scale": "",
@@ -8125,35 +8204,53 @@
8125 8204
           "notNull": false,
8126 8205
           "autoIncrement": false,
8127 8206
           "defaultValue": "",
8128
-          "hideInGraph": true,
8207
+          "hideInGraph": false,
8129 8208
           "refDict": "",
8130
-          "uiHint": "",
8131
-          "id": "210ABBCB-0350-4D79-B4E4-92543A825036"
8209
+          "extProps": {},
8210
+          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
8211
+          "id": "BA7C44C3-6332-4808-B8A1-9CA4A0230B8C"
8132 8212
         },
8133 8213
         {
8134
-          "defKey": "create_date",
8135
-          "defName": "创建时间",
8214
+          "defKey": "org_id",
8215
+          "defName": "机构ID",
8136 8216
           "comment": "",
8137
-          "domain": "7CFFA0D3-6A93-4DDC-BC10-DF21211064DC",
8138 8217
           "type": "",
8139 8218
           "len": "",
8140 8219
           "scale": "",
8141 8220
           "primaryKey": false,
8142 8221
           "notNull": false,
8143 8222
           "autoIncrement": false,
8144
-          "defaultValue": "CURRENT_TIMESTAMP",
8223
+          "defaultValue": "",
8224
+          "hideInGraph": false,
8225
+          "refDict": "",
8226
+          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
8227
+          "id": "FBCA3E18-1ABB-4B48-8370-9A9FB679B5A7",
8228
+          "uiHint": ""
8229
+        },
8230
+        {
8231
+          "defKey": "status",
8232
+          "defName": "状态",
8233
+          "comment": "",
8234
+          "domain": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E",
8235
+          "type": "",
8236
+          "len": "",
8237
+          "scale": "",
8238
+          "primaryKey": false,
8239
+          "notNull": false,
8240
+          "autoIncrement": false,
8241
+          "defaultValue": "1",
8145 8242
           "hideInGraph": true,
8146 8243
           "refDict": "",
8147 8244
           "uiHint": "",
8148
-          "id": "5BCAB4B5-D041-4F14-8AC8-991595EB1EA5"
8245
+          "id": "E1646EEB-D7B3-4C90-91B1-C5D45348549C"
8149 8246
         },
8150 8247
         {
8151
-          "defKey": "update_user",
8152
-          "defName": "更新人",
8248
+          "defKey": "create_user",
8249
+          "defName": "创建人",
8153 8250
           "comment": "",
8154 8251
           "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
8155 8252
           "type": "",
8156
-          "len": 32,
8253
+          "len": "",
8157 8254
           "scale": "",
8158 8255
           "primaryKey": false,
8159 8256
           "notNull": false,
@@ -8162,11 +8259,11 @@
8162 8259
           "hideInGraph": true,
8163 8260
           "refDict": "",
8164 8261
           "uiHint": "",
8165
-          "id": "35545F9B-03E1-4DB3-998C-596AB7F8820F"
8262
+          "id": "210ABBCB-0350-4D79-B4E4-92543A825036"
8166 8263
         },
8167 8264
         {
8168
-          "defKey": "update_date",
8169
-          "defName": "更新时间",
8265
+          "defKey": "create_date",
8266
+          "defName": "创建时间",
8170 8267
           "comment": "",
8171 8268
           "domain": "7CFFA0D3-6A93-4DDC-BC10-DF21211064DC",
8172 8269
           "type": "",
@@ -8175,11 +8272,11 @@
8175 8272
           "primaryKey": false,
8176 8273
           "notNull": false,
8177 8274
           "autoIncrement": false,
8178
-          "defaultValue": "",
8275
+          "defaultValue": "CURRENT_TIMESTAMP",
8179 8276
           "hideInGraph": true,
8180 8277
           "refDict": "",
8181 8278
           "uiHint": "",
8182
-          "id": "14C5219E-6E5E-4B54-A7E6-429EFA934950"
8279
+          "id": "5BCAB4B5-D041-4F14-8AC8-991595EB1EA5"
8183 8280
         }
8184 8281
       ],
8185 8282
       "correlations": [],

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

@@ -2,9 +2,9 @@
2 2
   "name": "文明创办",
3 3
   "describe": "文明创办",
4 4
   "avatar": "",
5
-  "version": "4.2.0",
5
+  "version": "4.1.4",
6 6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2023-1-2 22:36:59",
7
+  "updatedTime": "2023-1-4 09:07:35",
8 8
   "dbConns": [],
9 9
   "profile": {
10 10
     "default": {

+ 47
- 23
src/main/java/com/example/civilizedcity/controller/TaCheckController.java View File

@@ -1,9 +1,13 @@
1 1
 package com.example.civilizedcity.controller;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 6
 import com.example.civilizedcity.common.BaseController;
7
+import com.example.civilizedcity.common.Constants;
6 8
 import com.example.civilizedcity.common.ResponseBean;
9
+import com.example.civilizedcity.common.StringUtils;
10
+import com.example.civilizedcity.service.TaCheckItemService;
7 11
 import io.swagger.annotations.Api;
8 12
 import io.swagger.annotations.ApiOperation;
9 13
 import io.swagger.annotations.ApiParam;
@@ -12,8 +16,9 @@ import org.springframework.web.bind.annotation.*;
12 16
 import com.example.civilizedcity.entity.TaCheck;
13 17
 import com.example.civilizedcity.service.TaCheckService;
14 18
 
15
- /**
19
+/**
16 20
  * 模拟测评;(ta_check)表控制层
21
+ *
17 22
  * @author : http://njyunzhi.com
18 23
  * @date : 2022-12-12
19 24
  */
@@ -21,12 +26,15 @@ import com.example.civilizedcity.service.TaCheckService;
21 26
 @RestController
22 27
 @RequestMapping("/")
23 28
 public class TaCheckController extends BaseController {
24
-    
29
+
25 30
     @Autowired
26 31
     private TaCheckService taCheckService;
27
-    
28
-    /** 
29
-     * 通过ID查询单条数据 
32
+
33
+    @Autowired
34
+    private TaCheckItemService taCheckItemService;
35
+
36
+    /**
37
+     * 通过ID查询单条数据
30 38
      *
31 39
      * @param checkId 主键
32 40
      * @return 实例对象
@@ -36,28 +44,39 @@ public class TaCheckController extends BaseController {
36 44
     public ResponseBean queryById(@ApiParam("对象ID") @PathVariable String id) throws Exception {
37 45
         return ResponseBean.success(taCheckService.getById(id));
38 46
     }
39
-    
40
-    /** 
47
+
48
+    /**
41 49
      * 分页查询
42 50
      *
43
-     * @param pageNum 当前页码
51
+     * @param pageNum  当前页码
44 52
      * @param pageSize 每页条数
45 53
      * @return 查询结果
46 54
      */
47 55
     @ApiOperation("分页查询")
48 56
     @GetMapping("/taCheck")
49
-    public ResponseBean list(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
50
-                            @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception {
51
-        
57
+    public ResponseBean list(@ApiParam("页码") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
58
+                             @ApiParam("单页数据量") @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
59
+                             @ApiParam("测评名称") @RequestParam(value = "title", required = false) String title,
60
+                             @ApiParam("开始日期") @RequestParam(value = "startDate", required = false) String startDate,
61
+                             @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate) throws Exception {
62
+
52 63
         IPage<TaCheck> pg = new Page<>(pageNum, pageSize);
53
-        // QueryWrapper<taCheck> queryWrapper = new QueryWrapper<>();
54
-        // queryWrapper.orderByDesc("create_date");
55
-        IPage<TaCheck> result = taCheckService.page(pg);
56
-        
64
+        QueryWrapper<TaCheck> queryWrapper = new QueryWrapper<>();
65
+        queryWrapper.like(!StringUtils.isEmpty(title), "title", title);
66
+
67
+        if (!StringUtils.isEmpty(startDate)) {
68
+            queryWrapper.le("start_date", endDate);
69
+            queryWrapper.ge("end_date", startDate);
70
+        }
71
+
72
+        queryWrapper.gt("status", Constants.STATUS_DELETE);
73
+        queryWrapper.orderByDesc("create_date");
74
+        IPage<TaCheck> result = taCheckService.page(pg, queryWrapper);
75
+
57 76
         return ResponseBean.success(result);
58 77
     }
59
-    
60
-    /** 
78
+
79
+    /**
61 80
      * 新增数据
62 81
      *
63 82
      * @param taCheck 实例对象
@@ -67,10 +86,14 @@ public class TaCheckController extends BaseController {
67 86
     @PostMapping("/taCheck")
68 87
     public ResponseBean add(@ApiParam("对象实体") @RequestBody TaCheck taCheck) throws Exception {
69 88
         taCheckService.save(taCheck);
89
+
90
+        // 创建成功之后, 再创建
91
+        taCheckItemService.createNewItems(taCheck);
92
+
70 93
         return ResponseBean.success(taCheck);
71 94
     }
72
-    
73
-    /** 
95
+
96
+    /**
74 97
      * 更新数据
75 98
      *
76 99
      * @param taCheck 实例对象
@@ -79,12 +102,13 @@ public class TaCheckController extends BaseController {
79 102
     @ApiOperation("更新数据")
80 103
     @PutMapping("/taCheck/{id}")
81 104
     public ResponseBean edit(@ApiParam("对象实体") @RequestBody TaCheck taCheck,
82
-                            @ApiParam("对象ID") @PathVariable String id ) throws Exception {
105
+                             @ApiParam("对象ID") @PathVariable String id) throws Exception {
106
+        taCheck.setCheckId(id);
83 107
         taCheckService.updateById(taCheck);
84 108
         return ResponseBean.success(taCheck);
85 109
     }
86
-    
87
-    /** 
110
+
111
+    /**
88 112
      * 通过主键删除数据
89 113
      *
90 114
      * @param checkId 主键
@@ -92,7 +116,7 @@ public class TaCheckController extends BaseController {
92 116
      */
93 117
     @ApiOperation("通过主键删除数据")
94 118
     @DeleteMapping("/taCheck/{id}")
95
-    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id){
119
+    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id) {
96 120
         taCheckService.removeLogicById(id);
97 121
         return ResponseBean.success("success");
98 122
     }

+ 27
- 5
src/main/java/com/example/civilizedcity/controller/TaCheckItemController.java View File

@@ -11,6 +11,8 @@ import java.time.LocalDateTime;
11 11
 import java.util.List;
12 12
 
13 13
 import com.example.civilizedcity.common.StringUtils;
14
+import com.example.civilizedcity.entity.TdLocType;
15
+import com.example.civilizedcity.service.TdLocTypeService;
14 16
 import io.swagger.annotations.Api;
15 17
 import io.swagger.annotations.ApiOperation;
16 18
 import io.swagger.annotations.ApiParam;
@@ -31,6 +33,9 @@ public class TaCheckItemController extends BaseController {
31 33
     
32 34
     @Autowired
33 35
     private TaCheckItemService taCheckItemService;
36
+
37
+    @Autowired
38
+    private TdLocTypeService tdLocTypeService;
34 39
     
35 40
     /**
36 41
      * 通过ID查询单条数据
@@ -79,12 +84,12 @@ public class TaCheckItemController extends BaseController {
79 84
     @ApiOperation("分页查询")
80 85
     @GetMapping("/taCheckItem")
81 86
     public ResponseBean list(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
82
-                            @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception {
87
+                             @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
88
+                             @ApiParam("模拟测评ID") @RequestParam(value ="checkId") String checkId,
89
+                             @ApiParam("项目类型") @RequestParam(value ="itemType") String itemType) throws Exception {
83 90
         
84 91
         IPage<TaCheckItem> pg = new Page<>(pageNum, pageSize);
85
-        // QueryWrapper<TaCheckItem> queryWrapper = new QueryWrapper<>();
86
-        // queryWrapper.orderByDesc("create_date");
87
-        IPage<TaCheckItem> result = taCheckItemService.page(pg);
92
+        IPage<TaCheckItem> result = taCheckItemService.getPageBy(pg, checkId, itemType);
88 93
         
89 94
         return ResponseBean.success(result);
90 95
     }
@@ -99,7 +104,24 @@ public class TaCheckItemController extends BaseController {
99 104
     @PostMapping("/taCheckItem")
100 105
     public ResponseBean add(@ApiParam("对象实体") @RequestBody TaCheckItem taCheckItem) throws Exception {
101 106
 
102
-        TaCheckItem origin = getByCheckAndType(taCheckItem.getCheckId(), taCheckItem.getItemId());
107
+        if (StringUtils.isEmpty(taCheckItem.getItemType())) {
108
+            return ResponseBean.error("测评类型不能为空");
109
+        }
110
+
111
+        if ("loc".equals(taCheckItem.getItemType()) && StringUtils.isEmpty(taCheckItem.getTypeId())) {
112
+            return ResponseBean.error("测评点位不能为空");
113
+        }
114
+
115
+        if (!StringUtils.isEmpty(taCheckItem.getTypeId())) {
116
+            TdLocType tdLocType = tdLocTypeService.getById(taCheckItem.getTypeId());
117
+            if (null != tdLocType) {
118
+                taCheckItem.setName(tdLocType.getName());
119
+            } else {
120
+                return ResponseBean.error("测评点位选择不正确");
121
+            }
122
+        }
123
+
124
+        TaCheckItem origin = getByCheckAndType(taCheckItem.getCheckId(), taCheckItem.getTypeId());
103 125
         if (null == origin) {
104 126
             // 新增
105 127
             taCheckItem.setStatus(Constants.STATUS_NORMAL);

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

@@ -91,8 +91,8 @@ public class TaCheckItemQuController extends BaseController {
91 91
 
92 92
         if (StringUtils.isEmpty(quId)) {
93 93
             // 新增
94
-            int maxNo = taCheckItemQuService.getMaxNoBy(taCheckItemQu.getItemId());
95
-            taCheckItemQu.setSortNo(maxNo + 1);
94
+//            int maxNo = taCheckItemQuService.getMaxNoBy(taCheckItemQu.getItemId());
95
+//            taCheckItemQu.setSortNo(maxNo + 1);
96 96
             taCheckItemQuService.save(taCheckItemQu);
97 97
         } else {
98 98
             taCheckItemQuService.updateById(taCheckItemQu);

+ 1
- 1
src/main/java/com/example/civilizedcity/entity/TdQuAnswer.java View File

@@ -20,7 +20,7 @@ import lombok.experimental.Accessors;
20 20
 @EqualsAndHashCode(callSuper = false)
21 21
 @Accessors(chain = true)
22 22
 @ApiModel(value = "点位问题答案",description = "")
23
-@TableName("td_loc_qu_answer")
23
+@TableName("td_qu_answer")
24 24
 public class TdQuAnswer implements Serializable,Cloneable{
25 25
     /** 答案ID */
26 26
     @ApiModelProperty(name = "答案ID",notes = "")

+ 2
- 2
src/main/java/com/example/civilizedcity/entity/TdQuestion.java View File

@@ -20,11 +20,11 @@ import lombok.experimental.Accessors;
20 20
 @EqualsAndHashCode(callSuper = false)
21 21
 @Accessors(chain = true)
22 22
 @ApiModel(value = "点位问题",description = "")
23
-@TableName("td_loc_question")
23
+@TableName("td_question")
24 24
 public class TdQuestion implements Serializable,Cloneable{
25 25
     /** 问题ID */
26 26
     @ApiModelProperty(name = "问题ID",notes = "")
27
-    @TableId(value = "qu_id", type = IdType.INPUT)
27
+    @TableId(value = "qu_id", type = IdType.ASSIGN_UUID)
28 28
     private String quId ;
29 29
     /** 点位ID */
30 30
     @ApiModelProperty(name = "点位ID",notes = "")

+ 6
- 2
src/main/java/com/example/civilizedcity/mapper/TaCheckItemMapper.java View File

@@ -1,6 +1,7 @@
1 1
 package com.example.civilizedcity.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import org.apache.ibatis.annotations.Mapper;
5 6
 import org.apache.ibatis.annotations.Param;
6 7
 import com.example.civilizedcity.entity.TaCheckItem;
@@ -12,5 +13,8 @@ import com.example.civilizedcity.entity.TaCheckItem;
12 13
  */
13 14
 @Mapper
14 15
 public interface TaCheckItemMapper  extends BaseMapper<TaCheckItem>{
15
-    
16
-}
16
+
17
+     IPage<TaCheckItem> getPageBy(IPage<TaCheckItem> pg, @Param("checkId") String checkId, @Param("itemType") String itemType);
18
+
19
+     int createNewLocItems(@Param("checkId") String checkId);
20
+ }

+ 7
- 3
src/main/java/com/example/civilizedcity/service/TaCheckItemService.java View File

@@ -1,6 +1,7 @@
1 1
 package com.example.civilizedcity.service;
2 2
 
3
-import com.baomidou.mybatisplus.extension.service.IService;
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.example.civilizedcity.entity.TaCheck;
4 5
 import com.example.civilizedcity.entity.TaCheckItem;
5 6
 
6 7
  /**
@@ -9,5 +10,8 @@ import com.example.civilizedcity.entity.TaCheckItem;
9 10
  * @date : 2022-12-13
10 11
  */
11 12
 public interface TaCheckItemService extends IBaseService<TaCheckItem> {
12
-    
13
-}
13
+
14
+     IPage<TaCheckItem> getPageBy(IPage<TaCheckItem> pg, String checkId, String itemType);
15
+
16
+     void createNewItems(TaCheck taCheck);
17
+ }

+ 22
- 2
src/main/java/com/example/civilizedcity/service/impl/TaCheckItemServiceImpl.java View File

@@ -1,16 +1,36 @@
1 1
 package com.example.civilizedcity.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.example.civilizedcity.entity.TaCheck;
3 5
 import org.springframework.beans.factory.annotation.Autowired;
4 6
 import org.springframework.stereotype.Service;
5 7
 import com.example.civilizedcity.entity.TaCheckItem;
6 8
 import com.example.civilizedcity.mapper.TaCheckItemMapper;
7 9
 import com.example.civilizedcity.service.TaCheckItemService;
8
- /**
10
+
11
+/**
9 12
  * 测评点位;(ta_check_item)表服务实现类
13
+ *
10 14
  * @author : http://www.chiner.pro
11 15
  * @date : 2022-12-13
12 16
  */
13 17
 @Service
14 18
 public class TaCheckItemServiceImpl extends BaseServiceImpl<TaCheckItemMapper, TaCheckItem> implements TaCheckItemService {
15
-    
19
+
20
+    @Override
21
+    public IPage<TaCheckItem> getPageBy(IPage<TaCheckItem> pg, String checkId, String itemType) {
22
+        return baseMapper.getPageBy(pg, checkId, itemType);
23
+    }
24
+
25
+    @Override
26
+    public void createNewItems(TaCheck taCheck) {
27
+        // 先创建实地测试
28
+        baseMapper.createNewLocItems(taCheck.getCheckId());
29
+        // 再创建调查问卷
30
+        TaCheckItem taCheckItem = new TaCheckItem();
31
+        taCheckItem.setCheckId(taCheck.getCheckId());
32
+        taCheckItem.setItemType("survey");
33
+        taCheckItem.setName("调查问卷");
34
+        save(taCheckItem);
35
+    }
16 36
 }

+ 35
- 1
src/main/resources/mapper/TaCheckItemMapper.xml View File

@@ -2,5 +2,39 @@
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.TaCheckItemMapper">
5
-    
5
+    <insert id="createNewLocItems">
6
+        INSERT INTO ta_check_item (item_id, check_id, item_type, type_id, `name`)
7
+        SELECT
8
+            UUID_SHORT(),
9
+            #{checkId},
10
+            'loc',
11
+            t.type_id,
12
+            t.`name`
13
+        FROM
14
+            td_loc_type t
15
+        WHERE
16
+            t.`status` &gt; -1
17
+        ORDER BY
18
+            t.sort_no ASC
19
+    </insert>
20
+
21
+    <select id="getPageBy" resultType="com.example.civilizedcity.entity.TaCheckItem">
22
+        SELECT
23
+            t.*
24
+        FROM
25
+            ta_check_item t
26
+            <if test="itemType != null and itemType == 'loc'">
27
+                INNER JOIN td_loc_type s ON t.type_id = s.type_id
28
+            </if>
29
+        WHERE
30
+            t.check_id = #{checkId}
31
+          AND t.item_type = #{itemType}
32
+        ORDER BY
33
+        <if test="itemType != null and itemType == 'loc'">
34
+            s.sort_no ASC
35
+        </if>
36
+        <if test="itemType != null and itemType != 'loc'">
37
+            t.create_date ASC
38
+        </if>
39
+    </select>
6 40
 </mapper>