Your Name 2 年之前
父節點
當前提交
a5371d7e59

+ 15
- 7
src/main/java/com/example/civilizedcity/common/BaseController.java 查看文件

8
 import org.springframework.beans.factory.annotation.Autowired;
8
 import org.springframework.beans.factory.annotation.Autowired;
9
 import org.springframework.stereotype.Component;
9
 import org.springframework.stereotype.Component;
10
 
10
 
11
+import javax.annotation.Resource;
12
+import javax.servlet.http.HttpServletRequest;
13
+
11
 @Component
14
 @Component
12
 public class BaseController {
15
 public class BaseController {
13
 
16
 
17
+    @Resource
18
+    HttpServletRequest request;
19
+
14
     @Autowired
20
     @Autowired
15
     protected SysUserService sysUserService;
21
     protected SysUserService sysUserService;
16
 
22
 
23
             throw new Exception("请先登录");
29
             throw new Exception("请先登录");
24
         }
30
         }
25
 
31
 
26
-        SysUser user = sysUserService.getById(loginId);
32
+        String userId = loginId;
33
+        SysUser user = sysUserService.getById(userId);
27
         if (user == null || user.getStatus() == Constants.STATUS_DELETE) {
34
         if (user == null || user.getStatus() == Constants.STATUS_DELETE) {
28
-            throw new Exception("人员不存在");
35
+            return null;
29
         }
36
         }
30
 
37
 
31
         return user;
38
         return user;
32
     }
39
     }
33
 
40
 
34
     public TaPerson currentPerson() throws Exception {
41
     public TaPerson currentPerson() throws Exception {
35
-        String loginId = StpUtil.getLoginIdAsString();
36
-        if (StringUtils.isEmpty(loginId)) {
37
-            throw new Exception("请先登录");
42
+
43
+        String personId = request.getHeader("x-personId");
44
+        if (StringUtils.isEmpty(personId)) {
45
+            return null;
38
         }
46
         }
39
 
47
 
40
-        TaPerson taPerson = taPersonService.getById(loginId);
48
+        TaPerson taPerson = taPersonService.getById(personId);
41
         if (taPerson == null || taPerson.getStatus() == Constants.STATUS_DELETE) {
49
         if (taPerson == null || taPerson.getStatus() == Constants.STATUS_DELETE) {
42
-            throw new Exception("人员不存在");
50
+            return null;
43
         }
51
         }
44
 
52
 
45
         return taPerson;
53
         return taPerson;

+ 19
- 0
src/main/java/com/example/civilizedcity/controller/SysOrgController.java 查看文件

82
             return ResponseBean.error("名称不能为空");
82
             return ResponseBean.error("名称不能为空");
83
         }
83
         }
84
 
84
 
85
+        if (StringUtils.isEmpty(sysOrg.getOrgPId())) {
86
+            return ResponseBean.error("父级节点不能为空");
87
+        }
88
+
85
         long i = sysOrgService.countBy("name", sysOrg.getName(), false);
89
         long i = sysOrgService.countBy("name", sysOrg.getName(), false);
86
         if (i > 0) {
90
         if (i > 0) {
87
             return ResponseBean.error("名称已存在");
91
             return ResponseBean.error("名称已存在");
88
         }
92
         }
89
 
93
 
94
+        // 构造 org 编码
95
+        long maxCode = sysOrgService.getMaxCodeOfParent(sysOrg.getOrgPId());
96
+        sysOrg.setOrgCode(String.valueOf(maxCode + 1));
97
+
90
         sysOrg.setOrgId(null);
98
         sysOrg.setOrgId(null);
91
         sysOrg.setStatus(Constants.STATUS_NORMAL);
99
         sysOrg.setStatus(Constants.STATUS_NORMAL);
92
         sysOrg.setCreateDate(LocalDateTime.now());
100
         sysOrg.setCreateDate(LocalDateTime.now());
113
             return ResponseBean.error("名称已存在");
121
             return ResponseBean.error("名称已存在");
114
         }
122
         }
115
 
123
 
124
+        // 比较是否更新了父节点
125
+        SysOrg origin = sysOrgService.getById(id);
126
+        if (!origin.getOrgPId().equals(sysOrg.getOrgPId())) {
127
+            // 如果更换了
128
+            long maxCode = sysOrgService.getMaxCodeOfParent(sysOrg.getOrgPId());
129
+            String newCode = String.valueOf(maxCode + 1);
130
+            // 当前节点以及子节点,全部更换
131
+            sysOrgService.changeOrgCode(origin.getOrgCode(), newCode);
132
+            sysOrg.setOrgCode(newCode);
133
+        }
134
+
116
         sysOrg.setOrgId(id);
135
         sysOrg.setOrgId(id);
117
         sysOrgService.updateById(sysOrg);
136
         sysOrgService.updateById(sysOrg);
118
         return ResponseBean.success(sysOrg);
137
         return ResponseBean.success(sysOrg);

+ 3
- 3
src/main/java/com/example/civilizedcity/controller/TaCheckItemQuController.java 查看文件

64
         IPage<TaCheckItemQu> pg = new Page<>(pageNum, pageSize);
64
         IPage<TaCheckItemQu> pg = new Page<>(pageNum, pageSize);
65
         QueryWrapper<TaCheckItemQu> queryWrapper = new QueryWrapper<>();
65
         QueryWrapper<TaCheckItemQu> queryWrapper = new QueryWrapper<>();
66
         queryWrapper.eq("item_id", itemId);
66
         queryWrapper.eq("item_id", itemId);
67
-        queryWrapper.orderByDesc("sort_no");
67
+        queryWrapper.orderByAsc("sort_no");
68
         IPage<TaCheckItemQu> result = taCheckItemQuService.page(pg, queryWrapper);
68
         IPage<TaCheckItemQu> result = taCheckItemQuService.page(pg, queryWrapper);
69
 
69
 
70
         List<TaCheckItemQu> quList = result.getRecords();
70
         List<TaCheckItemQu> quList = result.getRecords();
125
      */
125
      */
126
     @ApiOperation("通过主键删除数据")
126
     @ApiOperation("通过主键删除数据")
127
     @DeleteMapping("/taCheckItemQu/{id}")
127
     @DeleteMapping("/taCheckItemQu/{id}")
128
-    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable Integer id) {
129
-        taCheckItemQuService.removeLogicById(id);
128
+    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id) {
129
+        taCheckItemQuService.removeById(id);
130
         return ResponseBean.success("success");
130
         return ResponseBean.success("success");
131
     }
131
     }
132
 }
132
 }

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

4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.example.civilizedcity.common.BaseController;
6
 import com.example.civilizedcity.common.BaseController;
7
+import com.example.civilizedcity.common.Constants;
7
 import com.example.civilizedcity.common.ResponseBean;
8
 import com.example.civilizedcity.common.ResponseBean;
9
+
8
 import java.util.List;
10
 import java.util.List;
11
+
9
 import io.swagger.annotations.Api;
12
 import io.swagger.annotations.Api;
10
 import io.swagger.annotations.ApiOperation;
13
 import io.swagger.annotations.ApiOperation;
11
 import io.swagger.annotations.ApiParam;
14
 import io.swagger.annotations.ApiParam;
14
 import com.example.civilizedcity.entity.TdLocType;
17
 import com.example.civilizedcity.entity.TdLocType;
15
 import com.example.civilizedcity.service.TdLocTypeService;
18
 import com.example.civilizedcity.service.TdLocTypeService;
16
 
19
 
17
- /**
20
+/**
18
  * 点位分类;(td_loc_type)表控制层
21
  * 点位分类;(td_loc_type)表控制层
22
+ *
19
  * @author : http://njyunzhi.com
23
  * @author : http://njyunzhi.com
20
  * @date : 2022-12-12
24
  * @date : 2022-12-12
21
  */
25
  */
23
 @RestController
27
 @RestController
24
 @RequestMapping("/")
28
 @RequestMapping("/")
25
 public class TdLocTypeController extends BaseController {
29
 public class TdLocTypeController extends BaseController {
26
-    
30
+
27
     @Autowired
31
     @Autowired
28
     private TdLocTypeService tdLocTypeService;
32
     private TdLocTypeService tdLocTypeService;
29
-    
30
-    /** 
31
-     * 通过ID查询单条数据 
33
+
34
+    /**
35
+     * 通过ID查询单条数据
32
      *
36
      *
33
      * @param typeId 主键
37
      * @param typeId 主键
34
      * @return 实例对象
38
      * @return 实例对象
38
     public ResponseBean queryById(@ApiParam("对象ID") @PathVariable String id) throws Exception {
42
     public ResponseBean queryById(@ApiParam("对象ID") @PathVariable String id) throws Exception {
39
         return ResponseBean.success(tdLocTypeService.getById(id));
43
         return ResponseBean.success(tdLocTypeService.getById(id));
40
     }
44
     }
41
-    
42
-    /** 
45
+
46
+    /**
43
      * 分页查询
47
      * 分页查询
44
      *
48
      *
45
-     * @param pageNum 当前页码
49
+     * @param pageNum  当前页码
46
      * @param pageSize 每页条数
50
      * @param pageSize 每页条数
47
      * @return 查询结果
51
      * @return 查询结果
48
      */
52
      */
49
     @ApiOperation("分页查询")
53
     @ApiOperation("分页查询")
50
     @GetMapping("/tdLocType")
54
     @GetMapping("/tdLocType")
51
-    public ResponseBean list(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-                            @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception {
53
-        
55
+    public ResponseBean list(@ApiParam("页码") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
56
+                             @ApiParam("单页数据量") @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) throws Exception {
57
+
54
         IPage<TdLocType> pg = new Page<>(pageNum, pageSize);
58
         IPage<TdLocType> pg = new Page<>(pageNum, pageSize);
55
-        // QueryWrapper<TdLocType> queryWrapper = new QueryWrapper<>();
56
-        // queryWrapper.orderByDesc("create_date");
57
-        IPage<TdLocType> result = tdLocTypeService.page(pg);
58
-        
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);
63
+
59
         return ResponseBean.success(result);
64
         return ResponseBean.success(result);
60
     }
65
     }
61
-    
62
-    /** 
66
+
67
+    /**
63
      * 新增数据
68
      * 新增数据
64
      *
69
      *
65
      * @param tdLocType 实例对象
70
      * @param tdLocType 实例对象
72
         tdLocTypeService.save(tdLocType);
77
         tdLocTypeService.save(tdLocType);
73
         return ResponseBean.success(tdLocType);
78
         return ResponseBean.success(tdLocType);
74
     }
79
     }
75
-    
76
-    /** 
80
+
81
+    /**
77
      * 更新数据
82
      * 更新数据
78
      *
83
      *
79
      * @param tdLocType 实例对象
84
      * @param tdLocType 实例对象
82
     @ApiOperation("更新数据")
87
     @ApiOperation("更新数据")
83
     @PutMapping("/tdLocType/{id}")
88
     @PutMapping("/tdLocType/{id}")
84
     public ResponseBean edit(@ApiParam("对象实体") @RequestBody TdLocType tdLocType,
89
     public ResponseBean edit(@ApiParam("对象实体") @RequestBody TdLocType tdLocType,
85
-                            @ApiParam("对象ID") @PathVariable String id ) throws Exception {
90
+                             @ApiParam("对象ID") @PathVariable String id) throws Exception {
86
         tdLocType.setTypeId(id);
91
         tdLocType.setTypeId(id);
87
         tdLocTypeService.updateById(tdLocType);
92
         tdLocTypeService.updateById(tdLocType);
88
         return ResponseBean.success(tdLocType);
93
         return ResponseBean.success(tdLocType);
89
     }
94
     }
90
-    
91
-    /** 
95
+
96
+    /**
92
      * 通过主键删除数据
97
      * 通过主键删除数据
93
      *
98
      *
94
      * @param typeId 主键
99
      * @param typeId 主键
96
      */
101
      */
97
     @ApiOperation("通过主键删除数据")
102
     @ApiOperation("通过主键删除数据")
98
     @DeleteMapping("/tdLocType/{id}")
103
     @DeleteMapping("/tdLocType/{id}")
99
-    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id){
104
+    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id) {
100
         tdLocTypeService.removeLogicById(id);
105
         tdLocTypeService.removeLogicById(id);
101
         return ResponseBean.success("success");
106
         return ResponseBean.success("success");
102
     }
107
     }

+ 31
- 18
src/main/java/com/example/civilizedcity/controller/WxMaController.java 查看文件

12
 import com.example.civilizedcity.entity.SysUser;
12
 import com.example.civilizedcity.entity.SysUser;
13
 import com.example.civilizedcity.entity.TaPerson;
13
 import com.example.civilizedcity.entity.TaPerson;
14
 import com.example.civilizedcity.entity.TaPersonReflect;
14
 import com.example.civilizedcity.entity.TaPersonReflect;
15
+import com.example.civilizedcity.service.SysUserDutyService;
15
 import com.example.civilizedcity.service.TaPersonReflectService;
16
 import com.example.civilizedcity.service.TaPersonReflectService;
16
 import com.example.civilizedcity.vo.LoginParam;
17
 import com.example.civilizedcity.vo.LoginParam;
17
 import io.swagger.annotations.Api;
18
 import io.swagger.annotations.Api;
22
 
23
 
23
 import java.time.LocalDateTime;
24
 import java.time.LocalDateTime;
24
 import java.util.HashMap;
25
 import java.util.HashMap;
26
+import java.util.List;
25
 import java.util.Map;
27
 import java.util.Map;
26
 
28
 
27
 @Api(tags = "小程序登入/登出")
29
 @Api(tags = "小程序登入/登出")
35
     @Autowired
37
     @Autowired
36
     TaPersonReflectService taPersonReflectService;
38
     TaPersonReflectService taPersonReflectService;
37
 
39
 
40
+    @Autowired
41
+    SysUserDutyService sysUserDutyService;
42
+
38
 
43
 
39
 //    private boolean checkLoginParam(LoginParam loginParam) {
44
 //    private boolean checkLoginParam(LoginParam loginParam) {
40
 //        return !StringUtils.isEmpty(loginParam.getCode())
45
 //        return !StringUtils.isEmpty(loginParam.getCode())
84
             taPersonService.save(taPerson);
89
             taPersonService.save(taPerson);
85
         }
90
         }
86
 
91
 
87
-//        SysUser user = taPersonService.getReflectUser(taPerson);
88
-
89
-        StpUtil.login(taPerson.getPersonId(), "miniapp");
90
         Map<String, Object> res = new HashMap<>();
92
         Map<String, Object> res = new HashMap<>();
91
         res.put("person", taPerson);
93
         res.put("person", taPerson);
92
-//        res.put("user", user);
93
-        res.put("token", StpUtil.getTokenValue());
94
         res.put("sessionKey", sessionKey);
94
         res.put("sessionKey", sessionKey);
95
 
95
 
96
         return ResponseBean.success(res);
96
         return ResponseBean.success(res);
102
      * @return
102
      * @return
103
      * @throws Exception
103
      * @throws Exception
104
      */
104
      */
105
-    public ResponseBean signin(@ApiParam("登录参数") LoginParam param) throws Exception {
105
+    @PostMapping("/signin")
106
+    @ApiOperation(value="用户登录", notes = "用户登录", httpMethod = "POST", response = ResponseBean.class)
107
+    public ResponseBean signin(@ApiParam("登录参数") @RequestBody LoginParam param) throws Exception {
106
 
108
 
107
         if (StringUtils.isEmpty(param.getAccount()) || StringUtils.isEmpty(param.getPassword())) {
109
         if (StringUtils.isEmpty(param.getAccount()) || StringUtils.isEmpty(param.getPassword())) {
108
             return ResponseBean.error("登录用户或者密码不能为空");
110
             return ResponseBean.error("登录用户或者密码不能为空");
109
         }
111
         }
110
 
112
 
111
         SysUser user = sysUserService.login(param);
113
         SysUser user = sysUserService.login(param);
114
+        List<String> dutyList = sysUserDutyService.getListByUser(user.getUserId());
115
+        user.setDutyList(dutyList);
112
 
116
 
113
-        TaPerson taPerson = currentPerson();
114
-        TaPerson reflectd = taPersonService.getByUser(user);
117
+        // 登录新用户
118
+        StpUtil.login(user.getUserId(), "miniapp");
115
 
119
 
116
-        // 如果未绑定
117
-        if (null == reflectd) {
118
-            TaPersonReflect personReflect = new TaPersonReflect();
119
-            taPersonReflectService.save(personReflect);
120
-            reflectd = taPerson;
121
-        }
120
+        Map<String, Object> res = new HashMap<>();
121
+        res.put("user", user);
122
+        res.put("token", StpUtil.getTokenValue());
123
+
124
+        return ResponseBean.success(res);
125
+    }
126
+
127
+    /**
128
+     * 获取当前用户
129
+     * @return
130
+     * @throws Exception
131
+     */
132
+    @GetMapping("/current")
133
+    @ApiOperation(value="获取当前用户", notes = "获取当前用户", httpMethod = "GET", response = ResponseBean.class)
134
+    public ResponseBean current() throws Exception {
135
+        SysUser user = currentUser();
136
+        List<String> dutyList = sysUserDutyService.getListByUser(user.getUserId());
137
+        user.setDutyList(dutyList);
122
 
138
 
123
-        // 退出原用户
124
-        StpUtil.logout(taPerson.getPersonId(), "miniapp");
125
         // 登录新用户
139
         // 登录新用户
126
-        StpUtil.login(reflectd.getPersonId(), "miniapp");
140
+        StpUtil.login(user.getUserId(), "miniapp");
127
 
141
 
128
         Map<String, Object> res = new HashMap<>();
142
         Map<String, Object> res = new HashMap<>();
129
-        res.put("person", reflectd);
130
         res.put("user", user);
143
         res.put("user", user);
131
         res.put("token", StpUtil.getTokenValue());
144
         res.put("token", StpUtil.getTokenValue());
132
 
145
 

+ 4
- 0
src/main/java/com/example/civilizedcity/entity/SysUser.java 查看文件

62
      @ApiModelProperty(name = "资源列表", notes = "")
62
      @ApiModelProperty(name = "资源列表", notes = "")
63
      @TableField(exist = false)
63
      @TableField(exist = false)
64
      List<SysResource> resourcesList;
64
      List<SysResource> resourcesList;
65
+
66
+     @ApiModelProperty(name = "职责列表", notes = "")
67
+     @TableField(exist = false)
68
+     List<String> dutyList;
65
 }
69
 }

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

12
  */
12
  */
13
 @Mapper
13
 @Mapper
14
 public interface SysOrgMapper  extends BaseMapper<SysOrg>{
14
 public interface SysOrgMapper  extends BaseMapper<SysOrg>{
15
-    
16
-}
15
+
16
+     String sysOrgService(@Param("orgPId") String orgPId);
17
+
18
+     long changeOrgCode(@Param("from") String from, @Param("to") String to);
19
+ }

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

5
 import org.apache.ibatis.annotations.Param;
5
 import org.apache.ibatis.annotations.Param;
6
 import com.example.civilizedcity.entity.SysUserDuty;
6
 import com.example.civilizedcity.entity.SysUserDuty;
7
 
7
 
8
- /**
8
+import java.util.List;
9
+
10
+/**
9
  * 用户身份;(sys_user_duty)表数据库访问层
11
  * 用户身份;(sys_user_duty)表数据库访问层
10
  * @author : http://njyunzhi.com
12
  * @author : http://njyunzhi.com
11
  * @date : 2022-12-12
13
  * @date : 2022-12-12
12
  */
14
  */
13
 @Mapper
15
 @Mapper
14
 public interface SysUserDutyMapper  extends BaseMapper<SysUserDuty>{
16
 public interface SysUserDutyMapper  extends BaseMapper<SysUserDuty>{
15
-    
16
-}
17
+
18
+     List<String> getListByUser(@Param("userId") String userId);
19
+ }

+ 5
- 2
src/main/java/com/example/civilizedcity/service/SysOrgService.java 查看文件

9
  * @date : 2022-12-12
9
  * @date : 2022-12-12
10
  */
10
  */
11
 public interface SysOrgService extends IBaseService<SysOrg> {
11
 public interface SysOrgService extends IBaseService<SysOrg> {
12
-    
13
-}
12
+
13
+     long getMaxCodeOfParent(String orgPId);
14
+
15
+     boolean changeOrgCode(String from, String to);
16
+ }

+ 6
- 3
src/main/java/com/example/civilizedcity/service/SysUserDutyService.java 查看文件

3
 import com.baomidou.mybatisplus.extension.service.IService;
3
 import com.baomidou.mybatisplus.extension.service.IService;
4
 import com.example.civilizedcity.entity.SysUserDuty;
4
 import com.example.civilizedcity.entity.SysUserDuty;
5
 
5
 
6
- /**
6
+import java.util.List;
7
+
8
+/**
7
  * 用户身份;(sys_user_duty)表服务接口
9
  * 用户身份;(sys_user_duty)表服务接口
8
  * @author : http://njyunzhi.com
10
  * @author : http://njyunzhi.com
9
  * @date : 2022-12-12
11
  * @date : 2022-12-12
10
  */
12
  */
11
 public interface SysUserDutyService extends IBaseService<SysUserDuty> {
13
 public interface SysUserDutyService extends IBaseService<SysUserDuty> {
12
-    
13
-}
14
+
15
+     List<String> getListByUser(String userId);
16
+ }

+ 27
- 2
src/main/java/com/example/civilizedcity/service/impl/SysOrgServiceImpl.java 查看文件

1
 package com.example.civilizedcity.service.impl;
1
 package com.example.civilizedcity.service.impl;
2
 
2
 
3
+import com.example.civilizedcity.common.StringUtils;
3
 import org.springframework.beans.factory.annotation.Autowired;
4
 import org.springframework.beans.factory.annotation.Autowired;
4
 import org.springframework.stereotype.Service;
5
 import org.springframework.stereotype.Service;
5
 import com.example.civilizedcity.entity.SysOrg;
6
 import com.example.civilizedcity.entity.SysOrg;
6
 import com.example.civilizedcity.mapper.SysOrgMapper;
7
 import com.example.civilizedcity.mapper.SysOrgMapper;
7
 import com.example.civilizedcity.service.SysOrgService;
8
 import com.example.civilizedcity.service.SysOrgService;
8
- /**
9
+
10
+/**
9
  * 单位表;(sys_org)表服务实现类
11
  * 单位表;(sys_org)表服务实现类
12
+ *
10
  * @author : http://www.chiner.pro
13
  * @author : http://www.chiner.pro
11
  * @date : 2022-12-12
14
  * @date : 2022-12-12
12
  */
15
  */
13
 @Service
16
 @Service
14
 public class SysOrgServiceImpl extends BaseServiceImpl<SysOrgMapper, SysOrg> implements SysOrgService {
17
 public class SysOrgServiceImpl extends BaseServiceImpl<SysOrgMapper, SysOrg> implements SysOrgService {
15
-    
18
+
19
+    final static String ROOT_ID = "-1";
20
+
21
+    @Override
22
+    public long getMaxCodeOfParent(String orgPId) {
23
+        String maxCode = baseMapper.sysOrgService(orgPId);
24
+        if (StringUtils.isEmpty(maxCode)) {
25
+            if (ROOT_ID.equals(orgPId)) {
26
+                return 100;
27
+            } else {
28
+                SysOrg org = getById(orgPId);
29
+                String childCode = org.getOrgCode() + "000";
30
+                return Long.parseLong(childCode);
31
+            }
32
+        }
33
+
34
+        return Long.parseLong(maxCode);
35
+    }
36
+
37
+    @Override
38
+    public boolean changeOrgCode(String from, String to) {
39
+        return baseMapper.changeOrgCode(from, to) > 0;
40
+    }
16
 }
41
 }

+ 10
- 2
src/main/java/com/example/civilizedcity/service/impl/SysUserDutyServiceImpl.java 查看文件

5
 import com.example.civilizedcity.entity.SysUserDuty;
5
 import com.example.civilizedcity.entity.SysUserDuty;
6
 import com.example.civilizedcity.mapper.SysUserDutyMapper;
6
 import com.example.civilizedcity.mapper.SysUserDutyMapper;
7
 import com.example.civilizedcity.service.SysUserDutyService;
7
 import com.example.civilizedcity.service.SysUserDutyService;
8
- /**
8
+
9
+import java.util.List;
10
+
11
+/**
9
  * 用户身份;(sys_user_duty)表服务实现类
12
  * 用户身份;(sys_user_duty)表服务实现类
13
+ *
10
  * @author : http://www.chiner.pro
14
  * @author : http://www.chiner.pro
11
  * @date : 2022-12-12
15
  * @date : 2022-12-12
12
  */
16
  */
13
 @Service
17
 @Service
14
 public class SysUserDutyServiceImpl extends BaseServiceImpl<SysUserDutyMapper, SysUserDuty> implements SysUserDutyService {
18
 public class SysUserDutyServiceImpl extends BaseServiceImpl<SysUserDutyMapper, SysUserDuty> implements SysUserDutyService {
15
-    
19
+
20
+    @Override
21
+    public List<String> getListByUser(String userId) {
22
+        return baseMapper.getListByUser(userId);
23
+    }
16
 }
24
 }

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

32
             put("qu_id", quId);
32
             put("qu_id", quId);
33
         }});
33
         }});
34
 
34
 
35
+        if (null == answerList || answerList.isEmpty()) {
36
+            return true;
37
+        }
38
+
35
         for (int i = 0; i < answerList.size(); i ++) {
39
         for (int i = 0; i < answerList.size(); i ++) {
36
             TaCheckItemAn item = answerList.get(i);
40
             TaCheckItemAn item = answerList.get(i);
37
             item.setQuId(quId);
41
             item.setQuId(quId);

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

21
         QueryWrapper<TaCheckItemQu> queryWrapper = new QueryWrapper<>();
21
         QueryWrapper<TaCheckItemQu> queryWrapper = new QueryWrapper<>();
22
         queryWrapper.eq("item_id", itemId);
22
         queryWrapper.eq("item_id", itemId);
23
         queryWrapper.orderByDesc("sort_no");
23
         queryWrapper.orderByDesc("sort_no");
24
+        queryWrapper.last("limit 1");
24
 
25
 
25
         TaCheckItemQu one = getOne(queryWrapper);
26
         TaCheckItemQu one = getOne(queryWrapper);
26
         return null == one ? 0 : one.getSortNo();
27
         return null == one ? 0 : one.getSortNo();

+ 1
- 0
src/main/resources/application.yml 查看文件

27
       - "/v2/**"
27
       - "/v2/**"
28
       - "/static/**"
28
       - "/static/**"
29
       - "/**/login"
29
       - "/**/login"
30
+      - "/**/signin"
30
 
31
 
31
 wx:
32
 wx:
32
   miniapp:
33
   miniapp:

+ 19
- 1
src/main/resources/mapper/SysOrgMapper.xml 查看文件

2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 
3
 
4
 <mapper namespace="com.example.civilizedcity.mapper.SysOrgMapper">
4
 <mapper namespace="com.example.civilizedcity.mapper.SysOrgMapper">
5
-    
5
+    <update id="changeOrgCode">
6
+        UPDATE sys_org t
7
+        SET t.org_code = INSERT ( t.org_code, 1, LENGTH( #{from} ), #{to} )
8
+        WHERE
9
+            t.org_code LIKE CONCAT(#{from}, '%')
10
+    </update>
11
+
12
+    <select id="sysOrgService" resultType="java.lang.String">
13
+        SELECT
14
+            t.org_code
15
+        FROM
16
+            sys_org t
17
+        WHERE
18
+            t.org_p_id = #{orgPId}
19
+          AND t.`status` &gt; - 1
20
+        ORDER BY
21
+            t.org_code DESC
22
+            LIMIT 1
23
+    </select>
6
 </mapper>
24
 </mapper>

+ 9
- 1
src/main/resources/mapper/SysUserDutyMapper.xml 查看文件

2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 
3
 
4
 <mapper namespace="com.example.civilizedcity.mapper.SysUserDutyMapper">
4
 <mapper namespace="com.example.civilizedcity.mapper.SysUserDutyMapper">
5
-    
5
+
6
+    <select id="getListByUser" resultType="java.lang.String">
7
+        SELECT
8
+            t.duty
9
+        FROM
10
+            sys_user_duty t
11
+        WHERE
12
+            t.user_id = #{userId}
13
+    </select>
6
 </mapper>
14
 </mapper>