Browse Source

Merge branch 'master' of http://app.tjzhxx.cn:3001/chaos/yyky_vue

zhengjie 1 year ago
parent
commit
548f86bee3
21 changed files with 1421 additions and 1254 deletions
  1. 14 14
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
  2. 28 43
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TDeviceListController.java
  3. 0 9
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TElectronicFenceController.java
  4. 2 2
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TRegionController.java
  5. 2 2
      ruoyi-admin/src/main/resources/application.yml
  6. 177 345
      ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
  7. 27 45
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
  8. 14 26
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java
  9. 12 12
      ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java
  10. 347 300
      ruoyi-system/src/main/java/com/ruoyi/system/domain/TUserProfile.java
  11. 16 7
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java
  12. 16 9
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/TFacilityMapper.java
  13. 21 14
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/TUserProfileMapper.java
  14. 124 150
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
  15. 140 7
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDeviceListServiceImpl.java
  16. 69 10
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TUserProfileServiceImpl.java
  17. 11 1
      ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml
  18. 131 75
      ruoyi-system/src/main/resources/mapper/system/TDeviceListMapper.xml
  19. 1 1
      ruoyi-system/src/main/resources/mapper/system/TDeviceSetMapper.xml
  20. 13 0
      ruoyi-system/src/main/resources/mapper/system/TFacilityMapper.xml
  21. 256 182
      ruoyi-system/src/main/resources/mapper/system/TUserProfileMapper.xml

+ 14 - 14
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java

@@ -21,12 +21,11 @@ import com.ruoyi.system.service.ISysMenuService;
 
 /**
  * 登录验证
- * 
+ *
  * @author ruoyi
  */
 @RestController
-public class SysLoginController
-{
+public class SysLoginController {
     @Autowired
     private SysLoginService loginService;
 
@@ -41,17 +40,20 @@ public class SysLoginController
 
     /**
      * 登录方法
-     * 
+     *
      * @param loginBody 登录信息
      * @return 结果
      */
     @PostMapping("/login")
-    public AjaxResult login(@RequestBody LoginBody loginBody)
-    {
+    public AjaxResult login(@RequestBody LoginBody loginBody) {
         AjaxResult ajax = AjaxResult.success();
         // 生成令牌
-        String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
-                loginBody.getUuid());
+        String token = loginService.login(
+                loginBody.getUsername(),
+                loginBody.getPassword(),
+                loginBody.getCode(),
+                loginBody.getUuid()
+        );
         SysUser sysUser = sysUserService.selectUserByUserName(loginBody.getUsername());
         sysUser.setToken(token);
         sysUserService.updateUser(sysUser);
@@ -61,12 +63,11 @@ public class SysLoginController
 
     /**
      * 获取用户信息
-     * 
+     *
      * @return 用户信息
      */
     @GetMapping("getInfo")
-    public AjaxResult getInfo()
-    {
+    public AjaxResult getInfo() {
         SysUser user = SecurityUtils.getLoginUser().getUser();
         // 角色集合
         Set<String> roles = permissionService.getRolePermission(user);
@@ -81,12 +82,11 @@ public class SysLoginController
 
     /**
      * 获取路由信息
-     * 
+     *
      * @return 路由信息
      */
     @GetMapping("getRouters")
-    public AjaxResult getRouters()
-    {
+    public AjaxResult getRouters() {
         Long userId = SecurityUtils.getUserId();
         List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
         return AjaxResult.success(menuService.buildMenus(menus));

+ 28 - 43
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TDeviceListController.java

@@ -23,14 +23,13 @@ import org.springframework.web.multipart.MultipartFile;
 
 /**
  * 设备列Controller
- * 
+ *
  * @author zhengjie
  * @date 2023-08-30
  */
 @RestController
 @RequestMapping("/system/device")
-public class TDeviceListController extends BaseController
-{
+public class TDeviceListController extends BaseController {
     @Autowired
     private ITDeviceListService tDeviceListService;
 
@@ -39,8 +38,7 @@ public class TDeviceListController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:device:list')")
     @GetMapping("/list")
-    public TableDataInfo list(TDeviceList tDeviceList)
-    {
+    public TableDataInfo list(TDeviceList tDeviceList) {
         startPage();
         List<TDeviceList> list = tDeviceListService.selectTDeviceListList(tDeviceList);
         return getDataTable(list);
@@ -52,8 +50,7 @@ public class TDeviceListController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:device:export')")
     @Log(title = "设备列", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, TDeviceList tDeviceList)
-    {
+    public void export(HttpServletResponse response, TDeviceList tDeviceList) {
         List<TDeviceList> list = tDeviceListService.selectTDeviceListList(tDeviceList);
         ExcelUtil<TDeviceList> util = new ExcelUtil<TDeviceList>(TDeviceList.class);
         util.exportExcel(response, list, "设备列数据");
@@ -64,8 +61,7 @@ public class TDeviceListController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:device:query')")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Integer id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Integer id) {
         return success(tDeviceListService.selectTDeviceListById(id));
     }
 
@@ -75,8 +71,7 @@ public class TDeviceListController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:device:add')")
     @Log(title = "设备列", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TDeviceList tDeviceList)
-    {
+    public AjaxResult add(@RequestBody TDeviceList tDeviceList) {
         return toAjax(tDeviceListService.insertTDeviceList(tDeviceList));
     }
 
@@ -86,8 +81,7 @@ public class TDeviceListController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:device:edit')")
     @Log(title = "设备列", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody TDeviceList tDeviceList)
-    {
+    public AjaxResult edit(@RequestBody TDeviceList tDeviceList) {
         return toAjax(tDeviceListService.updateTDeviceList(tDeviceList));
     }
 
@@ -96,9 +90,8 @@ public class TDeviceListController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:device:remove')")
     @Log(title = "设备列", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Integer[] ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Integer[] ids) {
         return toAjax(tDeviceListService.deleteTDeviceListByIds(ids));
     }
 
@@ -106,8 +99,7 @@ public class TDeviceListController extends BaseController
      * 下载模板
      */
     @PostMapping("/importTemplate")
-    public void importTemplate(HttpServletResponse response)
-    {
+    public void importTemplate(HttpServletResponse response) {
         ExcelUtil<TDeviceList> util = new ExcelUtil<TDeviceList>(TDeviceList.class);
         util.importTemplateExcel(response, "设备列表模板");
     }
@@ -125,6 +117,7 @@ public class TDeviceListController extends BaseController
 //        String message = tDeviceListService.importTDeviceList(tDeviceLists);
 //        return AjaxResult.success(message);
 //    }
+
     /**
      * 导入
      */
@@ -137,15 +130,15 @@ public class TDeviceListController extends BaseController
         String message = tDeviceListService.importTDeviceListV2(tDeviceLists);
         return AjaxResult.success(message);
     }
+
     /**
      * 查询心率列表
      */
     @GetMapping("/heartRate")
-    public TableDataInfo heartRate(String device_id_code)
-    {
+    public TableDataInfo heartRate(String device_id_code) {
         startPage();
         List<RateDto> list = tDeviceListService.selectTDeviceByDeviceId(device_id_code);
-        for(RateDto dto : list){
+        for (RateDto dto : list) {
             HeartRateDto heartRateDto = JSONObject.parseObject(dto.getContent(), HeartRateDto.class);
             dto.setContent(heartRateDto.getHeart_rate());
         }
@@ -156,11 +149,10 @@ public class TDeviceListController extends BaseController
      * 查询血氧列表
      */
     @GetMapping("/oxygenRate")
-    public TableDataInfo oxygenRate(String device_id_code)
-    {
+    public TableDataInfo oxygenRate(String device_id_code) {
         startPage();
         List<RateDto> list = tDeviceListService.selectTDeviceByOxygen(device_id_code);
-        for(RateDto dto : list){
+        for (RateDto dto : list) {
             OxygenRateDto oxygenRateDto = JSONObject.parseObject(dto.getContent(), OxygenRateDto.class);
             dto.setContent(oxygenRateDto.getOxygen());
         }
@@ -171,11 +163,10 @@ public class TDeviceListController extends BaseController
      * 查询体温列表
      */
     @GetMapping("/tempRate")
-    public TableDataInfo tempRate(String device_id_code)
-    {
+    public TableDataInfo tempRate(String device_id_code) {
         startPage();
         List<RateDto> list = tDeviceListService.selectTDeviceByTemp(device_id_code);
-        for(RateDto dto : list){
+        for (RateDto dto : list) {
             TempRateDto tempRateDto = JSONObject.parseObject(dto.getContent(), TempRateDto.class);
             dto.setContent(tempRateDto.getTemp());
         }
@@ -186,12 +177,11 @@ public class TDeviceListController extends BaseController
      * 查询血压列表
      */
     @GetMapping("/bloodRate")
-    public TableDataInfo bloodRate(String device_id_code)
-    {
+    public TableDataInfo bloodRate(String device_id_code) {
         startPage();
         List<RateDto> list = tDeviceListService.selectTDeviceByBlood(device_id_code);
         List<BloodRateDto> list1 = new ArrayList<>();
-        for(RateDto dto : list){
+        for (RateDto dto : list) {
             BloodRateDto bloodRateDto = JSONObject.parseObject(dto.getContent(), BloodRateDto.class);
             bloodRateDto.setCreatetime(dto.getCreatetime());
             list1.add(bloodRateDto);
@@ -203,12 +193,11 @@ public class TDeviceListController extends BaseController
      * 查询步数列表
      */
     @GetMapping("/stepRate")
-    public TableDataInfo stepRate(String device_id_code)
-    {
+    public TableDataInfo stepRate(String device_id_code) {
         startPage();
         List<RateDto> list = tDeviceListService.selectTDeviceByStep(device_id_code);
         List<StepRateDto> list1 = new ArrayList<>();
-        for(RateDto dto : list){
+        for (RateDto dto : list) {
             StepRateDto stepRateDto = JSONObject.parseObject(dto.getContent(), StepRateDto.class);
             stepRateDto.setCreatetime(dto.getCreatetime());
             list1.add(stepRateDto);
@@ -220,12 +209,11 @@ public class TDeviceListController extends BaseController
      * 查询翻滚列表
      */
     @GetMapping("/rollRate")
-    public TableDataInfo rollRate(String device_id_code)
-    {
+    public TableDataInfo rollRate(String device_id_code) {
         startPage();
         List<RateDto> list = tDeviceListService.selectTDeviceByStep(device_id_code);
         List<RollRateDto> list1 = new ArrayList<>();
-        for(RateDto dto : list){
+        for (RateDto dto : list) {
             RollRateDto rollRateDto = JSONObject.parseObject(dto.getContent(), RollRateDto.class);
             rollRateDto.setCreatetime(dto.getCreatetime());
             list1.add(rollRateDto);
@@ -237,12 +225,11 @@ public class TDeviceListController extends BaseController
      * 查询步数列表
      */
     @GetMapping("/messageRate")
-    public TableDataInfo messageRate(String device_id_code)
-    {
+    public TableDataInfo messageRate(String device_id_code) {
         startPage();
         List<MessageDto> list = tDeviceListService.selectTDeviceByMessage(device_id_code);
         List<RateDto> list1 = new ArrayList<>();
-        for(MessageDto dto : list){
+        for (MessageDto dto : list) {
             RateDto rateDto = new RateDto();
             rateDto.setContent(tDeviceListService.checkMessage(dto.getAlarm_type()));
             rateDto.setCreatetime(dto.getCreatetime());
@@ -255,8 +242,7 @@ public class TDeviceListController extends BaseController
      * 查询设备消息日志
      */
     @GetMapping("/messageLogRate")
-    public TableDataInfo messageLogRate(MessageLogDto messageLogDto)
-    {
+    public TableDataInfo messageLogRate(MessageLogDto messageLogDto) {
         startPage();
         List<MessageLogDto> list = tDeviceListService.selectTDeviceByMessageLog(messageLogDto);
         return getDataTable(list);
@@ -267,8 +253,7 @@ public class TDeviceListController extends BaseController
      */
     @Log(title = "设备阈值", businessType = BusinessType.UPDATE)
     @PostMapping("/deviceValue")
-    public AjaxResult deviceValue(@RequestBody CallPoliceDto callPoliceDto)
-    {
+    public AjaxResult deviceValue(@RequestBody CallPoliceDto callPoliceDto) {
         return toAjax(tDeviceListService.deviceValue(callPoliceDto));
     }
 }

+ 0 - 9
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TElectronicFenceController.java

@@ -1,21 +1,12 @@
 package com.ruoyi.web.controller.system;
 
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 
-import com.ruoyi.system.domain.to.AMapBaseTo;
 import com.ruoyi.system.domain.vo.AMapFenceVo;
 import com.ruoyi.system.domain.vo.ElectronicFenceVo;
-import org.junit.Test;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.ResourceLoader;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.ResourceUtils;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;

+ 2 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TRegionController.java

@@ -41,8 +41,8 @@ public class TRegionController extends BaseController {
     @GetMapping("/list")
     public TableDataInfo list(TRegion tRegion) {
         startPage();
-//        List<TRegion> list = tRegionService.selectTRegionList(tRegion);
-        List<TRegion> list = tRegionService.selectTRegionListV2(tRegion);
+        List<TRegion> list = tRegionService.selectTRegionList(tRegion);
+//        List<TRegion> list = tRegionService.selectTRegionListV2(tRegion);
         return getDataTable(list);
     }
 

+ 2 - 2
ruoyi-admin/src/main/resources/application.yml

@@ -56,9 +56,9 @@ spring:
     # 测试环境
 #        active: test
     # 开发环境
-    active: dev
+#    active: dev
     # 生产环境
-#    active: druid
+    active: druid
 
   # 文件上传
   servlet:

File diff suppressed because it is too large
+ 177 - 345
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java


+ 27 - 45
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java

@@ -1,6 +1,7 @@
 package com.ruoyi.framework.web.service;
 
 import javax.annotation.Resource;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.authentication.AuthenticationManager;
 import org.springframework.security.authentication.BadCredentialsException;
@@ -31,12 +32,11 @@ import com.ruoyi.system.service.ISysUserService;
 
 /**
  * 登录校验方法
- * 
+ *
  * @author ruoyi
  */
 @Component
-public class SysLoginService
-{
+public class SysLoginService {
     @Autowired
     private TokenService tokenService;
 
@@ -45,7 +45,7 @@ public class SysLoginService
 
     @Autowired
     private RedisCache redisCache;
-    
+
     @Autowired
     private ISysUserService userService;
 
@@ -54,43 +54,34 @@ public class SysLoginService
 
     /**
      * 登录验证
-     * 
+     *
      * @param username 用户名
      * @param password 密码
-     * @param code 验证码
-     * @param uuid 唯一标识
+     * @param code     验证码
+     * @param uuid     唯一标识
      * @return 结果
      */
-    public String login(String username, String password, String code, String uuid)
-    {
+    public String login(String username, String password, String code, String uuid) {
         // 验证码校验
         validateCaptcha(username, code, uuid);
         // 登录前置校验
         loginPreCheck(username, password);
         // 用户验证
         Authentication authentication = null;
-        try
-        {
+        try {
             UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
             AuthenticationContextHolder.setContext(authenticationToken);
             // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
             authentication = authenticationManager.authenticate(authenticationToken);
-        }
-        catch (Exception e)
-        {
-            if (e instanceof BadCredentialsException)
-            {
+        } catch (Exception e) {
+            if (e instanceof BadCredentialsException) {
                 AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
                 throw new UserPasswordNotMatchException();
-            }
-            else
-            {
+            } else {
                 AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
                 throw new ServiceException(e.getMessage());
             }
-        }
-        finally
-        {
+        } finally {
             AuthenticationContextHolder.clearContext();
         }
         AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
@@ -102,27 +93,23 @@ public class SysLoginService
 
     /**
      * 校验验证码
-     * 
+     *
      * @param username 用户名
-     * @param code 验证码
-     * @param uuid 唯一标识
+     * @param code     验证码
+     * @param uuid     唯一标识
      * @return 结果
      */
-    public void validateCaptcha(String username, String code, String uuid)
-    {
+    public void validateCaptcha(String username, String code, String uuid) {
         boolean captchaEnabled = configService.selectCaptchaEnabled();
-        if (captchaEnabled)
-        {
+        if (captchaEnabled) {
             String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, "");
             String captcha = redisCache.getCacheObject(verifyKey);
             redisCache.deleteObject(verifyKey);
-            if (captcha == null)
-            {
+            if (captcha == null) {
                 AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")));
                 throw new CaptchaExpireException();
             }
-            if (!code.equalsIgnoreCase(captcha))
-            {
+            if (!code.equalsIgnoreCase(captcha)) {
                 AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
                 throw new CaptchaException();
             }
@@ -131,35 +118,31 @@ public class SysLoginService
 
     /**
      * 登录前置校验
+     *
      * @param username 用户名
      * @param password 用户密码
      */
-    public void loginPreCheck(String username, String password)
-    {
+    public void loginPreCheck(String username, String password) {
         // 用户名或密码为空 错误
-        if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password))
-        {
+        if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
             AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("not.null")));
             throw new UserNotExistsException();
         }
         // 密码如果不在指定范围内 错误
         if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
-                || password.length() > UserConstants.PASSWORD_MAX_LENGTH)
-        {
+                || password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
             AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
             throw new UserPasswordNotMatchException();
         }
         // 用户名不在指定范围内 错误
         if (username.length() < UserConstants.USERNAME_MIN_LENGTH
-                || username.length() > UserConstants.USERNAME_MAX_LENGTH)
-        {
+                || username.length() > UserConstants.USERNAME_MAX_LENGTH) {
             AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
             throw new UserPasswordNotMatchException();
         }
         // IP黑名单校验
         String blackStr = configService.selectConfigByKey("sys.login.blackIPList");
-        if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr()))
-        {
+        if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) {
             AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("login.blocked")));
             throw new BlackListException();
         }
@@ -170,8 +153,7 @@ public class SysLoginService
      *
      * @param userId 用户ID
      */
-    public void recordLoginInfo(Long userId)
-    {
+    public void recordLoginInfo(Long userId) {
         SysUser sysUser = new SysUser();
         sysUser.setUserId(userId);
         sysUser.setLoginIp(IpUtils.getIpAddr());

+ 14 - 26
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java

@@ -3,6 +3,7 @@ package com.ruoyi.framework.web.service;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
@@ -13,12 +14,11 @@ import com.ruoyi.system.service.ISysRoleService;
 
 /**
  * 用户权限处理
- * 
+ *
  * @author ruoyi
  */
 @Component
-public class SysPermissionService
-{
+public class SysPermissionService {
     @Autowired
     private ISysRoleService roleService;
 
@@ -27,20 +27,16 @@ public class SysPermissionService
 
     /**
      * 获取角色数据权限
-     * 
+     *
      * @param user 用户信息
      * @return 角色权限信息
      */
-    public Set<String> getRolePermission(SysUser user)
-    {
+    public Set<String> getRolePermission(SysUser user) {
         Set<String> roles = new HashSet<String>();
         // 管理员拥有所有权限
-        if (user.isAdmin())
-        {
+        if (user.isAdmin()) {
             roles.add("admin");
-        }
-        else
-        {
+        } else {
             roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId()));
         }
         return roles;
@@ -48,33 +44,25 @@ public class SysPermissionService
 
     /**
      * 获取菜单数据权限
-     * 
+     *
      * @param user 用户信息
      * @return 菜单权限信息
      */
-    public Set<String> getMenuPermission(SysUser user)
-    {
+    public Set<String> getMenuPermission(SysUser user) {
         Set<String> perms = new HashSet<String>();
         // 管理员拥有所有权限
-        if (user.isAdmin())
-        {
+        if (user.isAdmin()) {
             perms.add("*:*:*");
-        }
-        else
-        {
+        } else {
             List<SysRole> roles = user.getRoles();
-            if (!CollectionUtils.isEmpty(roles))
-            {
+            if (!CollectionUtils.isEmpty(roles)) {
                 // 多角色设置permissions属性,以便数据权限匹配权限
-                for (SysRole role : roles)
-                {
+                for (SysRole role : roles) {
                     Set<String> rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId());
                     role.setPermissions(rolePerms);
                     perms.addAll(rolePerms);
                 }
-            }
-            else
-            {
+            } else {
                 perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId()));
             }
         }

+ 12 - 12
ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java

@@ -1,18 +1,18 @@
 package com.ruoyi.generator.mapper;
 
 import java.util.List;
+
 import com.ruoyi.generator.domain.GenTable;
 
 /**
  * 业务 数据层
- * 
+ *
  * @author ruoyi
  */
-public interface GenTableMapper
-{
+public interface GenTableMapper {
     /**
      * 查询业务列表
-     * 
+     *
      * @param genTable 业务信息
      * @return 业务集合
      */
@@ -20,7 +20,7 @@ public interface GenTableMapper
 
     /**
      * 查询据库列表
-     * 
+     *
      * @param genTable 业务信息
      * @return 数据库表集合
      */
@@ -28,7 +28,7 @@ public interface GenTableMapper
 
     /**
      * 查询据库列表
-     * 
+     *
      * @param tableNames 表名称组
      * @return 数据库表集合
      */
@@ -36,14 +36,14 @@ public interface GenTableMapper
 
     /**
      * 查询所有表信息
-     * 
+     *
      * @return 表信息集合
      */
     public List<GenTable> selectGenTableAll();
 
     /**
      * 查询表ID业务信息
-     * 
+     *
      * @param id 业务ID
      * @return 业务信息
      */
@@ -51,7 +51,7 @@ public interface GenTableMapper
 
     /**
      * 查询表名称业务信息
-     * 
+     *
      * @param tableName 表名称
      * @return 业务信息
      */
@@ -59,7 +59,7 @@ public interface GenTableMapper
 
     /**
      * 新增业务
-     * 
+     *
      * @param genTable 业务信息
      * @return 结果
      */
@@ -67,7 +67,7 @@ public interface GenTableMapper
 
     /**
      * 修改业务
-     * 
+     *
      * @param genTable 业务信息
      * @return 结果
      */
@@ -75,7 +75,7 @@ public interface GenTableMapper
 
     /**
      * 批量删除业务
-     * 
+     *
      * @param ids 需要删除的数据ID
      * @return 结果
      */

+ 347 - 300
ruoyi-system/src/main/java/com/ruoyi/system/domain/TUserProfile.java

@@ -1,6 +1,9 @@
 package com.ruoyi.system.domain;
 
+import java.util.Date;
 import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
@@ -8,662 +11,706 @@ import com.ruoyi.common.core.domain.BaseEntity;
 
 /**
  * 用户档案对象 t_user_profile
- * 
+ *
  * @author zhengjie
  * @date 2023-08-25
  */
-public class TUserProfile extends BaseEntity
-{
+public class TUserProfile extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** id */
+    /**
+     * id
+     */
     private Integer id;
 
-    /** 姓名 */
+    /**
+     * 姓名
+     */
     @Excel(name = "姓名")
     private String name;
 
-    /** 性别 */
-    @Excel(name = "性别")
+    /**
+     * 性别
+     */
+    @Excel(name = "性别", comboDictType = "sys_user_sex")
     private Integer gender;
 
-    /** 身份证号 */
+    /**
+     * 身份证号
+     */
     @Excel(name = "身份证号")
     private String sfzid;
 
-    /** 电话1 */
+    /**
+     * 电话1
+     */
     @Excel(name = "电话1")
     private String telOne;
 
-    /** 电话2 */
+    /**
+     * 电话2
+     */
     @Excel(name = "电话2")
     private String telTwo;
 
-    /** 电话3 */
+    /**
+     * 电话3
+     */
     @Excel(name = "电话3")
     private String telThree;
 
-    /** 出生年月 */
-    @Excel(name = "出生年月")
-    private String birthday;
+    /**
+     * 出生年月
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "出生年月", dateFormat = "yyyy-MM-dd")
+    private Date birthday;
 
-    /** 年龄 */
+    /**
+     * 年龄
+     */
     @Excel(name = "年龄")
     private Integer age;
 
-    /** 结婚状态 */
-    @Excel(name = "结婚状态")
+    /**
+     * 结婚状态
+     */
+    @Excel(name = "结婚状态", comboDictType = "sys_marry_status")
     private Integer marrStatus;
 
-    /** 民族 */
-    @Excel(name = "民族",comboDictType = "sys_national")
+    /**
+     * 民族
+     */
+    @Excel(name = "民族", comboDictType = "sys_national")
     private Integer national;
 
-    /** 当地户口 */
+    /**
+     * 当地户口
+     */
     @Excel(name = "当地户口")
     private Integer local;
 
-    /** 客户类别 */
-    @Excel(name = "客户类别")
+    /**
+     * 客户类别
+     */
+    @Excel(name = "客户类别", comboDictType = "sys_user_type")
     private Integer clientType;
 
-    /** 居住情况 */
-    @Excel(name = "居住情况")
+    /**
+     * 居住情况
+     */
+    @Excel(name = "居住情况", comboDictType = "sys_live_status")
     private Integer liveStatus;
 
-    /** 家庭地址 */
+    /**
+     * 家庭地址
+     */
     @Excel(name = "家庭地址")
     private String familyAddress;
 
-    /** 详细地址 */
+    /**
+     * 详细地址
+     */
     @Excel(name = "详细地址")
     private String detailAddress;
 
-    /** 户籍地址 */
+    /**
+     * 户籍地址
+     */
     @Excel(name = "户籍地址")
     private String houseAddress;
 
-    /** 户籍详细地址 */
+    /**
+     * 户籍详细地址
+     */
     @Excel(name = "户籍详细地址")
     private String houseDetailAddress;
 
-    /** 所属服务机构 */
+    /**
+     * 所属服务机构
+     */
     @Excel(name = "所属服务机构")
     private Integer serviceid;
 
-    /** 老人身体特征和状态 */
+    /**
+     * 老人身体特征和状态
+     */
     @Excel(name = "老人身体特征和状态")
     private String oldmenStatus;
 
-    /** 主要改造内容字段 */
+    /**
+     * 主要改造内容字段
+     */
     @Excel(name = "主要改造内容字段")
     private String changeContent;
 
-    /** 失能月数 */
+    /**
+     * 失能月数
+     */
     @Excel(name = "失能月数")
     private String loseMonth;
 
-    /** 治疗月数 */
+    /**
+     * 治疗月数
+     */
     @Excel(name = "治疗月数")
     private String treatMonth;
 
-    /** 是否通过康复治疗 */
+    /**
+     * 是否通过康复治疗
+     */
     @Excel(name = "是否通过康复治疗")
     private Integer isTreat;
 
-    /** 服务状态 */
-    @Excel(name = "服务状态")
+    /**
+     * 服务状态
+     */
+    @Excel(name = "服务状态", comboDictType = "sys_service_type")
     private Integer serviceType;
 
-    /** 医疗保障 */
-    @Excel(name = "医疗保障")
+    /**
+     * 医疗保障
+     */
+    @Excel(name = "医疗保障", comboDictType = "sys_treate_sure")
     private Integer treateSure;
 
-    /** 经济来源 */
-    @Excel(name = "经济来源")
+    /**
+     * 经济来源
+     */
+    @Excel(name = "经济来源", comboDictType = "sys_money_come")
     private Integer moneyCome;
 
-    /** 月收入 */
+    /**
+     * 月收入
+     */
     @Excel(name = "月收入")
     private String moneyMonth;
 
-    /** 社保卡号 */
+    /**
+     * 社保卡号
+     */
     @Excel(name = "社保卡号")
     private String cardCode;
 
-    /** 慢性疾病 */
-    @Excel(name = "慢性疾病")
+    /**
+     * 慢性疾病
+     */
+    @Excel(name = "慢性疾病", comboDictType = "sys_slow_illness")
     private String slowIllness;
 
-    /** 血型 */
-    @Excel(name = "血型")
+    /**
+     * 血型
+     */
+    @Excel(name = "血型", comboDictType = "sys_blood_type")
     private Integer bloodType;
 
-    /** 失能状态 */
-    @Excel(name = "失能状态")
+    /**
+     * 失能状态
+     */
+    @Excel(name = "失能状态", comboDictType = "sys_shi_status")
     private Integer shiStatus;
 
-    /** 残疾情况 */
-    @Excel(name = "残疾情况")
+    /**
+     * 残疾情况
+     */
+    @Excel(name = "残疾情况", comboDictType = "sys_disablity_status")
     private Integer disablityStatus;
 
-    /** 残疾登记 */
-    @Excel(name = "残疾登记")
+    /**
+     * 残疾登记
+     */
+    @Excel(name = "残疾登记", comboDictType = "sys_disablity_entry")
     private Integer disablityEntry;
 
-    /** 文化程度 */
-    @Excel(name = "文化程度")
+    /**
+     * 文化程度
+     */
+    @Excel(name = "文化程度", comboDictType = "sys_educa_level")
     private Integer educaLevel;
 
-    /** 专业 */
+    /**
+     * 专业
+     */
     @Excel(name = "专业")
     private String special;
 
-    /** 职称 */
+    /**
+     * 职称
+     */
     @Excel(name = "职称")
     private String title;
 
-    /** 原单位 */
+    /**
+     * 原单位
+     */
     @Excel(name = "原单位")
     private String unity;
 
-    /** 性格心理 */
+    /**
+     * 性格心理
+     */
     @Excel(name = "性格心理")
     private String natureHeart;
 
-    /** 饮食特点 */
+    /**
+     * 饮食特点
+     */
     @Excel(name = "饮食特点")
     private String eatPoint;
 
-    /** 特长 */
-    @Excel(name = "特长")
+    /**
+     * 特长
+     */
+    @Excel(name = "特长", comboDictType = "sys_speciality")
     private String speciality;
 
-    /** 爱好 */
-    @Excel(name = "爱好")
+    /**
+     * 爱好
+     */
+    @Excel(name = "爱好", comboDictType = "sys_hobby")
     private String hobby;
 
-    /** 照片 */
+    /**
+     * 照片
+     */
     @Excel(name = "照片")
     private String photo;
 
-    /** 其他照片 */
+    /**
+     * 其他照片
+     */
     @Excel(name = "其他照片")
     private String otherPhoto;
 
-    /** 备注 */
+    /**
+     * 备注
+     */
     @Excel(name = "备注")
     private String remarks;
 
-    /** 紧急联系人信息 */
+    /**
+     * 紧急联系人信息
+     */
     private List<TEmergentPeople> tEmergentPeopleList;
 
-    public void setId(Integer id) 
-    {
+    public void setId(Integer id) {
         this.id = id;
     }
 
-    public Integer getId() 
-    {
+    public Integer getId() {
         return id;
     }
-    public void setName(String name) 
-    {
+
+    public void setName(String name) {
         this.name = name;
     }
 
-    public String getName() 
-    {
+    public String getName() {
         return name;
     }
-    public void setGender(Integer gender) 
-    {
+
+    public void setGender(Integer gender) {
         this.gender = gender;
     }
 
-    public Integer getGender() 
-    {
+    public Integer getGender() {
         return gender;
     }
-    public void setSfzid(String sfzid) 
-    {
+
+    public void setSfzid(String sfzid) {
         this.sfzid = sfzid;
     }
 
-    public String getSfzid() 
-    {
+    public String getSfzid() {
         return sfzid;
     }
-    public void setTelOne(String telOne) 
-    {
+
+    public void setTelOne(String telOne) {
         this.telOne = telOne;
     }
 
-    public String getTelOne() 
-    {
+    public String getTelOne() {
         return telOne;
     }
-    public void setTelTwo(String telTwo) 
-    {
+
+    public void setTelTwo(String telTwo) {
         this.telTwo = telTwo;
     }
 
-    public String getTelTwo() 
-    {
+    public String getTelTwo() {
         return telTwo;
     }
-    public void setTelThree(String telThree) 
-    {
+
+    public void setTelThree(String telThree) {
         this.telThree = telThree;
     }
 
-    public String getTelThree() 
-    {
+    public String getTelThree() {
         return telThree;
     }
-    public void setBirthday(String birthday) 
-    {
+
+    public void setBirthday(Date birthday) {
         this.birthday = birthday;
     }
 
-    public String getBirthday() 
-    {
+    public Date getBirthday() {
         return birthday;
     }
-    public void setAge(Integer age) 
-    {
+
+    public void setAge(Integer age) {
         this.age = age;
     }
 
-    public Integer getAge() 
-    {
+    public Integer getAge() {
         return age;
     }
-    public void setMarrStatus(Integer marrStatus) 
-    {
+
+    public void setMarrStatus(Integer marrStatus) {
         this.marrStatus = marrStatus;
     }
 
-    public Integer getMarrStatus() 
-    {
+    public Integer getMarrStatus() {
         return marrStatus;
     }
-    public void setNational(Integer national) 
-    {
+
+    public void setNational(Integer national) {
         this.national = national;
     }
 
-    public Integer getNational() 
-    {
+    public Integer getNational() {
         return national;
     }
-    public void setLocal(Integer local) 
-    {
+
+    public void setLocal(Integer local) {
         this.local = local;
     }
 
-    public Integer getLocal() 
-    {
+    public Integer getLocal() {
         return local;
     }
-    public void setClientType(Integer clientType) 
-    {
+
+    public void setClientType(Integer clientType) {
         this.clientType = clientType;
     }
 
-    public Integer getClientType() 
-    {
+    public Integer getClientType() {
         return clientType;
     }
-    public void setLiveStatus(Integer liveStatus) 
-    {
+
+    public void setLiveStatus(Integer liveStatus) {
         this.liveStatus = liveStatus;
     }
 
-    public Integer getLiveStatus() 
-    {
+    public Integer getLiveStatus() {
         return liveStatus;
     }
-    public void setFamilyAddress(String familyAddress) 
-    {
+
+    public void setFamilyAddress(String familyAddress) {
         this.familyAddress = familyAddress;
     }
 
-    public String getFamilyAddress() 
-    {
+    public String getFamilyAddress() {
         return familyAddress;
     }
-    public void setDetailAddress(String detailAddress) 
-    {
+
+    public void setDetailAddress(String detailAddress) {
         this.detailAddress = detailAddress;
     }
 
-    public String getDetailAddress() 
-    {
+    public String getDetailAddress() {
         return detailAddress;
     }
-    public void setHouseAddress(String houseAddress) 
-    {
+
+    public void setHouseAddress(String houseAddress) {
         this.houseAddress = houseAddress;
     }
 
-    public String getHouseAddress() 
-    {
+    public String getHouseAddress() {
         return houseAddress;
     }
-    public void setHouseDetailAddress(String houseDetailAddress) 
-    {
+
+    public void setHouseDetailAddress(String houseDetailAddress) {
         this.houseDetailAddress = houseDetailAddress;
     }
 
-    public String getHouseDetailAddress() 
-    {
+    public String getHouseDetailAddress() {
         return houseDetailAddress;
     }
-    public void setServiceid(Integer serviceid) 
-    {
+
+    public void setServiceid(Integer serviceid) {
         this.serviceid = serviceid;
     }
 
-    public Integer getServiceid() 
-    {
+    public Integer getServiceid() {
         return serviceid;
     }
-    public void setOldmenStatus(String oldmenStatus) 
-    {
+
+    public void setOldmenStatus(String oldmenStatus) {
         this.oldmenStatus = oldmenStatus;
     }
 
-    public String getOldmenStatus() 
-    {
+    public String getOldmenStatus() {
         return oldmenStatus;
     }
-    public void setChangeContent(String changeContent) 
-    {
+
+    public void setChangeContent(String changeContent) {
         this.changeContent = changeContent;
     }
 
-    public String getChangeContent() 
-    {
+    public String getChangeContent() {
         return changeContent;
     }
-    public void setLoseMonth(String loseMonth) 
-    {
+
+    public void setLoseMonth(String loseMonth) {
         this.loseMonth = loseMonth;
     }
 
-    public String getLoseMonth() 
-    {
+    public String getLoseMonth() {
         return loseMonth;
     }
-    public void setTreatMonth(String treatMonth) 
-    {
+
+    public void setTreatMonth(String treatMonth) {
         this.treatMonth = treatMonth;
     }
 
-    public String getTreatMonth() 
-    {
+    public String getTreatMonth() {
         return treatMonth;
     }
-    public void setIsTreat(Integer isTreat) 
-    {
+
+    public void setIsTreat(Integer isTreat) {
         this.isTreat = isTreat;
     }
 
-    public Integer getIsTreat() 
-    {
+    public Integer getIsTreat() {
         return isTreat;
     }
-    public void setServiceType(Integer serviceType) 
-    {
+
+    public void setServiceType(Integer serviceType) {
         this.serviceType = serviceType;
     }
 
-    public Integer getServiceType() 
-    {
+    public Integer getServiceType() {
         return serviceType;
     }
-    public void setTreateSure(Integer treateSure) 
-    {
+
+    public void setTreateSure(Integer treateSure) {
         this.treateSure = treateSure;
     }
 
-    public Integer getTreateSure() 
-    {
+    public Integer getTreateSure() {
         return treateSure;
     }
-    public void setMoneyCome(Integer moneyCome) 
-    {
+
+    public void setMoneyCome(Integer moneyCome) {
         this.moneyCome = moneyCome;
     }
 
-    public Integer getMoneyCome() 
-    {
+    public Integer getMoneyCome() {
         return moneyCome;
     }
-    public void setMoneyMonth(String moneyMonth) 
-    {
+
+    public void setMoneyMonth(String moneyMonth) {
         this.moneyMonth = moneyMonth;
     }
 
-    public String getMoneyMonth() 
-    {
+    public String getMoneyMonth() {
         return moneyMonth;
     }
-    public void setCardCode(String cardCode) 
-    {
+
+    public void setCardCode(String cardCode) {
         this.cardCode = cardCode;
     }
 
-    public String getCardCode() 
-    {
+    public String getCardCode() {
         return cardCode;
     }
-    public void setSlowIllness(String slowIllness) 
-    {
+
+    public void setSlowIllness(String slowIllness) {
         this.slowIllness = slowIllness;
     }
 
-    public String getSlowIllness() 
-    {
+    public String getSlowIllness() {
         return slowIllness;
     }
-    public void setBloodType(Integer bloodType) 
-    {
+
+    public void setBloodType(Integer bloodType) {
         this.bloodType = bloodType;
     }
 
-    public Integer getBloodType() 
-    {
+    public Integer getBloodType() {
         return bloodType;
     }
-    public void setShiStatus(Integer shiStatus) 
-    {
+
+    public void setShiStatus(Integer shiStatus) {
         this.shiStatus = shiStatus;
     }
 
-    public Integer getShiStatus() 
-    {
+    public Integer getShiStatus() {
         return shiStatus;
     }
-    public void setDisablityStatus(Integer disablityStatus) 
-    {
+
+    public void setDisablityStatus(Integer disablityStatus) {
         this.disablityStatus = disablityStatus;
     }
 
-    public Integer getDisablityStatus() 
-    {
+    public Integer getDisablityStatus() {
         return disablityStatus;
     }
-    public void setDisablityEntry(Integer disablityEntry) 
-    {
+
+    public void setDisablityEntry(Integer disablityEntry) {
         this.disablityEntry = disablityEntry;
     }
 
-    public Integer getDisablityEntry() 
-    {
+    public Integer getDisablityEntry() {
         return disablityEntry;
     }
-    public void setEducaLevel(Integer educaLevel) 
-    {
+
+    public void setEducaLevel(Integer educaLevel) {
         this.educaLevel = educaLevel;
     }
 
-    public Integer getEducaLevel() 
-    {
+    public Integer getEducaLevel() {
         return educaLevel;
     }
-    public void setSpecial(String special) 
-    {
+
+    public void setSpecial(String special) {
         this.special = special;
     }
 
-    public String getSpecial() 
-    {
+    public String getSpecial() {
         return special;
     }
-    public void setTitle(String title) 
-    {
+
+    public void setTitle(String title) {
         this.title = title;
     }
 
-    public String getTitle() 
-    {
+    public String getTitle() {
         return title;
     }
-    public void setUnity(String unity) 
-    {
+
+    public void setUnity(String unity) {
         this.unity = unity;
     }
 
-    public String getUnity() 
-    {
+    public String getUnity() {
         return unity;
     }
-    public void setNatureHeart(String natureHeart) 
-    {
+
+    public void setNatureHeart(String natureHeart) {
         this.natureHeart = natureHeart;
     }
 
-    public String getNatureHeart() 
-    {
+    public String getNatureHeart() {
         return natureHeart;
     }
-    public void setEatPoint(String eatPoint) 
-    {
+
+    public void setEatPoint(String eatPoint) {
         this.eatPoint = eatPoint;
     }
 
-    public String getEatPoint() 
-    {
+    public String getEatPoint() {
         return eatPoint;
     }
-    public void setSpeciality(String speciality) 
-    {
+
+    public void setSpeciality(String speciality) {
         this.speciality = speciality;
     }
 
-    public String getSpeciality() 
-    {
+    public String getSpeciality() {
         return speciality;
     }
-    public void setHobby(String hobby) 
-    {
+
+    public void setHobby(String hobby) {
         this.hobby = hobby;
     }
 
-    public String getHobby() 
-    {
+    public String getHobby() {
         return hobby;
     }
-    public void setPhoto(String photo) 
-    {
+
+    public void setPhoto(String photo) {
         this.photo = photo;
     }
 
-    public String getPhoto() 
-    {
+    public String getPhoto() {
         return photo;
     }
-    public void setOtherPhoto(String otherPhoto) 
-    {
+
+    public void setOtherPhoto(String otherPhoto) {
         this.otherPhoto = otherPhoto;
     }
 
-    public String getOtherPhoto() 
-    {
+    public String getOtherPhoto() {
         return otherPhoto;
     }
-    public void setRemarks(String remarks) 
-    {
+
+    public void setRemarks(String remarks) {
         this.remarks = remarks;
     }
 
-    public String getRemarks() 
-    {
+    public String getRemarks() {
         return remarks;
     }
 
-    public List<TEmergentPeople> getTEmergentPeopleList()
-    {
+    public List<TEmergentPeople> getTEmergentPeopleList() {
         return tEmergentPeopleList;
     }
 
-    public void setTEmergentPeopleList(List<TEmergentPeople> tEmergentPeopleList)
-    {
+    public void setTEmergentPeopleList(List<TEmergentPeople> tEmergentPeopleList) {
         this.tEmergentPeopleList = tEmergentPeopleList;
     }
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("name", getName())
-            .append("gender", getGender())
-            .append("sfzid", getSfzid())
-            .append("telOne", getTelOne())
-            .append("telTwo", getTelTwo())
-            .append("telThree", getTelThree())
-            .append("birthday", getBirthday())
-            .append("age", getAge())
-            .append("marrStatus", getMarrStatus())
-            .append("national", getNational())
-            .append("local", getLocal())
-            .append("clientType", getClientType())
-            .append("liveStatus", getLiveStatus())
-            .append("familyAddress", getFamilyAddress())
-            .append("detailAddress", getDetailAddress())
-            .append("houseAddress", getHouseAddress())
-            .append("houseDetailAddress", getHouseDetailAddress())
-            .append("serviceid", getServiceid())
-            .append("oldmenStatus", getOldmenStatus())
-            .append("changeContent", getChangeContent())
-            .append("loseMonth", getLoseMonth())
-            .append("treatMonth", getTreatMonth())
-            .append("isTreat", getIsTreat())
-            .append("serviceType", getServiceType())
-            .append("treateSure", getTreateSure())
-            .append("moneyCome", getMoneyCome())
-            .append("moneyMonth", getMoneyMonth())
-            .append("cardCode", getCardCode())
-            .append("slowIllness", getSlowIllness())
-            .append("bloodType", getBloodType())
-            .append("shiStatus", getShiStatus())
-            .append("disablityStatus", getDisablityStatus())
-            .append("disablityEntry", getDisablityEntry())
-            .append("educaLevel", getEducaLevel())
-            .append("special", getSpecial())
-            .append("title", getTitle())
-            .append("unity", getUnity())
-            .append("natureHeart", getNatureHeart())
-            .append("eatPoint", getEatPoint())
-            .append("speciality", getSpeciality())
-            .append("hobby", getHobby())
-            .append("photo", getPhoto())
-            .append("otherPhoto", getOtherPhoto())
-            .append("remarks", getRemarks())
-            .append("createTime", getCreateTime())
-            .append("tEmergentPeopleList", getTEmergentPeopleList())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("name", getName())
+                .append("gender", getGender())
+                .append("sfzid", getSfzid())
+                .append("telOne", getTelOne())
+                .append("telTwo", getTelTwo())
+                .append("telThree", getTelThree())
+                .append("birthday", getBirthday())
+                .append("age", getAge())
+                .append("marrStatus", getMarrStatus())
+                .append("national", getNational())
+                .append("local", getLocal())
+                .append("clientType", getClientType())
+                .append("liveStatus", getLiveStatus())
+                .append("familyAddress", getFamilyAddress())
+                .append("detailAddress", getDetailAddress())
+                .append("houseAddress", getHouseAddress())
+                .append("houseDetailAddress", getHouseDetailAddress())
+                .append("serviceid", getServiceid())
+                .append("oldmenStatus", getOldmenStatus())
+                .append("changeContent", getChangeContent())
+                .append("loseMonth", getLoseMonth())
+                .append("treatMonth", getTreatMonth())
+                .append("isTreat", getIsTreat())
+                .append("serviceType", getServiceType())
+                .append("treateSure", getTreateSure())
+                .append("moneyCome", getMoneyCome())
+                .append("moneyMonth", getMoneyMonth())
+                .append("cardCode", getCardCode())
+                .append("slowIllness", getSlowIllness())
+                .append("bloodType", getBloodType())
+                .append("shiStatus", getShiStatus())
+                .append("disablityStatus", getDisablityStatus())
+                .append("disablityEntry", getDisablityEntry())
+                .append("educaLevel", getEducaLevel())
+                .append("special", getSpecial())
+                .append("title", getTitle())
+                .append("unity", getUnity())
+                .append("natureHeart", getNatureHeart())
+                .append("eatPoint", getEatPoint())
+                .append("speciality", getSpeciality())
+                .append("hobby", getHobby())
+                .append("photo", getPhoto())
+                .append("otherPhoto", getOtherPhoto())
+                .append("remarks", getRemarks())
+                .append("createTime", getCreateTime())
+                .append("tEmergentPeopleList", getTEmergentPeopleList())
+                .toString();
     }
 }

+ 16 - 7
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java

@@ -1,18 +1,19 @@
 package com.ruoyi.system.mapper;
 
 import java.util.List;
+
+import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.system.domain.SysUserPost;
 
 /**
  * 用户与岗位关联表 数据层
- * 
+ *
  * @author ruoyi
  */
-public interface SysUserPostMapper
-{
+public interface SysUserPostMapper {
     /**
      * 通过用户ID删除用户和岗位关联
-     * 
+     *
      * @param userId 用户ID
      * @return 结果
      */
@@ -20,7 +21,7 @@ public interface SysUserPostMapper
 
     /**
      * 通过岗位ID查询岗位使用数量
-     * 
+     *
      * @param postId 岗位ID
      * @return 结果
      */
@@ -28,7 +29,7 @@ public interface SysUserPostMapper
 
     /**
      * 批量删除用户和岗位关联
-     * 
+     *
      * @param ids 需要删除的数据ID
      * @return 结果
      */
@@ -36,9 +37,17 @@ public interface SysUserPostMapper
 
     /**
      * 批量新增用户岗位信息
-     * 
+     *
      * @param userPostList 用户角色列表
      * @return 结果
      */
     public int batchUserPost(List<SysUserPost> userPostList);
+
+    /**
+     * 通过用户ID查询部门
+     *
+     * @param userId
+     * @return
+     */
+    public List<SysUserPost> selectUserPostByUserId(Long userId);
 }

+ 16 - 9
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TFacilityMapper.java

@@ -8,15 +8,14 @@ import com.ruoyi.system.domain.TFacility;
 
 /**
  * 手环设备Mapper接口
- * 
+ *
  * @author zhengjie
  * @date 2023-08-12
  */
-public interface TFacilityMapper 
-{
+public interface TFacilityMapper {
     /**
      * 查询手环设备
-     * 
+     *
      * @param id 手环设备主键
      * @return 手环设备
      */
@@ -38,7 +37,7 @@ public interface TFacilityMapper
 
     /**
      * 查询手环设备列表
-     * 
+     *
      * @param tFacility 手环设备
      * @return 手环设备集合
      */
@@ -46,7 +45,7 @@ public interface TFacilityMapper
 
     /**
      * 新增手环设备
-     * 
+     *
      * @param tFacility 手环设备
      * @return 结果
      */
@@ -54,15 +53,23 @@ public interface TFacilityMapper
 
     /**
      * 修改手环设备
-     * 
+     *
      * @param tFacility 手环设备
      * @return 结果
      */
     public int updateTFacility(TFacility tFacility);
 
+    /**
+     * 修改手环设备
+     *
+     * @param tFacility 手环设备
+     * @return 结果
+     */
+    public int updateTFacilityByDeviceCode(TFacility tFacility);
+
     /**
      * 删除手环设备
-     * 
+     *
      * @param id 手环设备主键
      * @return 结果
      */
@@ -70,7 +77,7 @@ public interface TFacilityMapper
 
     /**
      * 批量删除手环设备
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */

+ 21 - 14
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TUserProfileMapper.java

@@ -13,15 +13,14 @@ import com.ruoyi.system.domain.dto.UserAgeDto;
 
 /**
  * 用户档案Mapper接口
- * 
+ *
  * @author zhengjie
  * @date 2023-08-25
  */
-public interface TUserProfileMapper 
-{
+public interface TUserProfileMapper {
     /**
      * 查询用户档案
-     * 
+     *
      * @param id 用户档案主键
      * @return 用户档案
      */
@@ -35,9 +34,17 @@ public interface TUserProfileMapper
      */
     public TUserProfile selectTUserProfileBySfzId(String sfzid);
 
+    /**
+     * 查询用户档案
+     *
+     * @param sfzid 身份证
+     * @return 用户档案
+     */
+    public List<TUserProfile> selectTUserProfileBySfzIdV2(String sfzid);
+
     /**
      * 查询用户档案列表
-     * 
+     *
      * @param tUserProfile 用户档案
      * @return 用户档案集合
      */
@@ -53,7 +60,7 @@ public interface TUserProfileMapper
 
     /**
      * 新增用户档案
-     * 
+     *
      * @param tUserProfile 用户档案
      * @return 结果
      */
@@ -61,7 +68,7 @@ public interface TUserProfileMapper
 
     /**
      * 修改用户档案
-     * 
+     *
      * @param tUserProfile 用户档案
      * @return 结果
      */
@@ -69,7 +76,7 @@ public interface TUserProfileMapper
 
     /**
      * 删除用户档案
-     * 
+     *
      * @param id 用户档案主键
      * @return 结果
      */
@@ -77,7 +84,7 @@ public interface TUserProfileMapper
 
     /**
      * 批量删除用户档案
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
@@ -85,24 +92,24 @@ public interface TUserProfileMapper
 
     /**
      * 批量删除紧急联系人
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
     public int deleteTEmergentPeopleByProfileIds(Integer[] ids);
-    
+
     /**
      * 批量新增紧急联系人
-     * 
+     *
      * @param tEmergentPeopleList 紧急联系人列表
      * @return 结果
      */
     public int batchTEmergentPeople(List<TEmergentPeople> tEmergentPeopleList);
-    
+
 
     /**
      * 通过用户档案主键删除紧急联系人信息
-     * 
+     *
      * @param id 用户档案ID
      * @return 结果
      */

+ 124 - 150
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -1,9 +1,11 @@
 package com.ruoyi.system.service.impl;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
 import javax.validation.Validator;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,12 +34,11 @@ import com.ruoyi.system.service.ISysUserService;
 
 /**
  * 用户 业务层处理
- * 
+ *
  * @author ruoyi
  */
 @Service
-public class SysUserServiceImpl implements ISysUserService
-{
+public class SysUserServiceImpl implements ISysUserService {
     private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
 
     @Autowired
@@ -63,79 +64,96 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 根据条件分页查询用户列表
-     * 
+     *
      * @param user 用户信息
      * @return 用户信息集合信息
      */
     @Override
     @DataScope(deptAlias = "d", userAlias = "u")
-    public List<SysUser> selectUserList(SysUser user)
-    {
+    public List<SysUser> selectUserList(SysUser user) {
         return userMapper.selectUserList(user);
     }
 
     /**
      * 根据条件分页查询已分配用户角色列表
-     * 
+     *
      * @param user 用户信息
      * @return 用户信息集合信息
      */
     @Override
     @DataScope(deptAlias = "d", userAlias = "u")
-    public List<SysUser> selectAllocatedList(SysUser user)
-    {
+    public List<SysUser> selectAllocatedList(SysUser user) {
         return userMapper.selectAllocatedList(user);
     }
 
     /**
      * 根据条件分页查询未分配用户角色列表
-     * 
+     *
      * @param user 用户信息
      * @return 用户信息集合信息
      */
     @Override
     @DataScope(deptAlias = "d", userAlias = "u")
-    public List<SysUser> selectUnallocatedList(SysUser user)
-    {
+    public List<SysUser> selectUnallocatedList(SysUser user) {
         return userMapper.selectUnallocatedList(user);
     }
 
     /**
      * 通过用户名查询用户
-     * 
+     *
      * @param userName 用户名
      * @return 用户对象信息
      */
     @Override
-    public SysUser selectUserByUserName(String userName)
-    {
-        return userMapper.selectUserByUserName(userName);
+    public SysUser selectUserByUserName(String userName) {
+        SysUser sysUser = userMapper.selectUserByUserName(userName);
+        if (sysUser != null) {
+            //手动添加权限
+            if (sysUser.getRoles() != null && !sysUser.getRoles().isEmpty() && sysUser.getRoleIds() == null) {
+                sysUser.setRoleIds(
+                        sysUser.getRoles().stream()
+                                .map(mapper -> {
+                                    return mapper.getRoleId();
+                                }).toArray(generator -> new Long[generator])
+                );
+            }
+            //手动添加部门
+            List<SysUserPost> sysUserPosts = userPostMapper.selectUserPostByUserId(sysUser.getUserId());
+            if (sysUserPosts != null && !sysUserPosts.isEmpty()) {
+                sysUser.setPostIds(
+                        sysUserPosts.stream().map(
+                                mapper -> {
+                                    return mapper.getPostId();
+                                }
+                        ).toArray(generator -> new Long[generator])
+                );
+            }
+        }
+
+        return sysUser;
     }
 
     /**
      * 通过用户ID查询用户
-     * 
+     *
      * @param userId 用户ID
      * @return 用户对象信息
      */
     @Override
-    public SysUser selectUserById(Long userId)
-    {
+    public SysUser selectUserById(Long userId) {
         return userMapper.selectUserById(userId);
     }
 
     /**
      * 查询用户所属角色组
-     * 
+     *
      * @param userName 用户名
      * @return 结果
      */
     @Override
-    public String selectUserRoleGroup(String userName)
-    {
+    public String selectUserRoleGroup(String userName) {
         List<SysRole> list = roleMapper.selectRolesByUserName(userName);
-        if (CollectionUtils.isEmpty(list))
-        {
+        if (CollectionUtils.isEmpty(list)) {
             return StringUtils.EMPTY;
         }
         return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(","));
@@ -143,16 +161,14 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 查询用户所属岗位组
-     * 
+     *
      * @param userName 用户名
      * @return 结果
      */
     @Override
-    public String selectUserPostGroup(String userName)
-    {
+    public String selectUserPostGroup(String userName) {
         List<SysPost> list = postMapper.selectPostsByUserName(userName);
-        if (CollectionUtils.isEmpty(list))
-        {
+        if (CollectionUtils.isEmpty(list)) {
             return StringUtils.EMPTY;
         }
         return list.stream().map(SysPost::getPostName).collect(Collectors.joining(","));
@@ -160,17 +176,15 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 校验用户名称是否唯一
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
     @Override
-    public boolean checkUserNameUnique(SysUser user)
-    {
+    public boolean checkUserNameUnique(SysUser user) {
         Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
         SysUser info = userMapper.checkUserNameUnique(user.getUserName());
-        if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
-        {
+        if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
             return UserConstants.NOT_UNIQUE;
         }
         return UserConstants.UNIQUE;
@@ -183,12 +197,10 @@ public class SysUserServiceImpl implements ISysUserService
      * @return
      */
     @Override
-    public boolean checkPhoneUnique(SysUser user)
-    {
+    public boolean checkPhoneUnique(SysUser user) {
         Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
         SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
-        if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
-        {
+        if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
             return UserConstants.NOT_UNIQUE;
         }
         return UserConstants.UNIQUE;
@@ -201,12 +213,10 @@ public class SysUserServiceImpl implements ISysUserService
      * @return
      */
     @Override
-    public boolean checkEmailUnique(SysUser user)
-    {
+    public boolean checkEmailUnique(SysUser user) {
         Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
         SysUser info = userMapper.checkEmailUnique(user.getEmail());
-        if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
-        {
+        if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
             return UserConstants.NOT_UNIQUE;
         }
         return UserConstants.UNIQUE;
@@ -214,33 +224,28 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 校验用户是否允许操作
-     * 
+     *
      * @param user 用户信息
      */
     @Override
-    public void checkUserAllowed(SysUser user)
-    {
-        if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin())
-        {
+    public void checkUserAllowed(SysUser user) {
+        if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) {
             throw new ServiceException("不允许操作超级管理员用户");
         }
     }
 
     /**
      * 校验用户是否有数据权限
-     * 
+     *
      * @param userId 用户id
      */
     @Override
-    public void checkUserDataScope(Long userId)
-    {
-        if (!SysUser.isAdmin(SecurityUtils.getUserId()))
-        {
+    public void checkUserDataScope(Long userId) {
+        if (!SysUser.isAdmin(SecurityUtils.getUserId())) {
             SysUser user = new SysUser();
             user.setUserId(userId);
             List<SysUser> users = SpringUtils.getAopProxy(this).selectUserList(user);
-            if (StringUtils.isEmpty(users))
-            {
+            if (StringUtils.isEmpty(users)) {
                 throw new ServiceException("没有权限访问用户数据!");
             }
         }
@@ -248,14 +253,13 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 新增保存用户信息
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
     @Override
     @Transactional
-    public int insertUser(SysUser user)
-    {
+    public int insertUser(SysUser user) {
         // 新增用户信息
         int rows = userMapper.insertUser(user);
         // 新增用户岗位关联
@@ -267,26 +271,24 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 注册用户信息
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
     @Override
-    public boolean registerUser(SysUser user)
-    {
+    public boolean registerUser(SysUser user) {
         return userMapper.insertUser(user) > 0;
     }
 
     /**
      * 修改保存用户信息
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
     @Override
     @Transactional
-    public int updateUser(SysUser user)
-    {
+    public int updateUser(SysUser user) {
         Long userId = user.getUserId();
         // 删除用户与角色关联
         userRoleMapper.deleteUserRoleByUserId(userId);
@@ -301,146 +303,134 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 用户授权角色
-     * 
-     * @param userId 用户ID
+     *
+     * @param userId  用户ID
      * @param roleIds 角色组
      */
     @Override
     @Transactional
-    public void insertUserAuth(Long userId, Long[] roleIds)
-    {
+    public void insertUserAuth(Long userId, Long[] roleIds) {
         userRoleMapper.deleteUserRoleByUserId(userId);
         insertUserRole(userId, roleIds);
     }
 
     /**
      * 修改用户状态
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
     @Override
-    public int updateUserStatus(SysUser user)
-    {
+    public int updateUserStatus(SysUser user) {
         return userMapper.updateUser(user);
     }
 
     /**
      * 修改用户基本信息
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
     @Override
-    public int updateUserProfile(SysUser user)
-    {
+    public int updateUserProfile(SysUser user) {
         return userMapper.updateUser(user);
     }
 
     /**
      * 修改用户头像
-     * 
+     *
      * @param userName 用户名
-     * @param avatar 头像地址
+     * @param avatar   头像地址
      * @return 结果
      */
     @Override
-    public boolean updateUserAvatar(String userName, String avatar)
-    {
+    public boolean updateUserAvatar(String userName, String avatar) {
         return userMapper.updateUserAvatar(userName, avatar) > 0;
     }
 
     /**
      * 重置用户密码
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
     @Override
-    public int resetPwd(SysUser user)
-    {
+    public int resetPwd(SysUser user) {
         return userMapper.updateUser(user);
     }
 
     /**
      * 重置用户密码
-     * 
+     *
      * @param userName 用户名
      * @param password 密码
      * @return 结果
      */
     @Override
-    public int resetUserPwd(String userName, String password)
-    {
+    public int resetUserPwd(String userName, String password) {
         return userMapper.resetUserPwd(userName, password);
     }
 
     /**
      * 新增用户角色信息
-     * 
+     *
      * @param user 用户对象
      */
-    public void insertUserRole(SysUser user)
-    {
+    public void insertUserRole(SysUser user) {
         this.insertUserRole(user.getUserId(), user.getRoleIds());
     }
 
     /**
      * 新增用户岗位信息
-     * 
+     *
      * @param user 用户对象
      */
-    public void insertUserPost(SysUser user)
-    {
+    public void insertUserPost(SysUser user) {
         Long[] posts = user.getPostIds();
-        if (StringUtils.isNotEmpty(posts))
-        {
+        if (StringUtils.isNotEmpty(posts)) {
             // 新增用户与岗位管理
-            List<SysUserPost> list = new ArrayList<SysUserPost>(posts.length);
-            for (Long postId : posts)
-            {
-                SysUserPost up = new SysUserPost();
-                up.setUserId(user.getUserId());
-                up.setPostId(postId);
-                list.add(up);
-            }
-            userPostMapper.batchUserPost(list);
+            List<SysUserPost> sysUserRoles = Arrays.stream(posts).map(
+                    mapper -> {
+                        SysUserPost sysUserPost = new SysUserPost();
+                        sysUserPost.setUserId(user.getUserId());
+                        sysUserPost.setPostId(mapper);
+                        return sysUserPost;
+                    }
+            ).collect(Collectors.toList());
+            userPostMapper.batchUserPost(sysUserRoles);
         }
     }
 
     /**
      * 新增用户角色信息
-     * 
-     * @param userId 用户ID
+     *
+     * @param userId  用户ID
      * @param roleIds 角色组
      */
-    public void insertUserRole(Long userId, Long[] roleIds)
-    {
-        if (StringUtils.isNotEmpty(roleIds))
-        {
+    public void insertUserRole(Long userId, Long[] roleIds) {
+        if (StringUtils.isNotEmpty(roleIds)) {
             // 新增用户与角色管理
-            List<SysUserRole> list = new ArrayList<SysUserRole>(roleIds.length);
-            for (Long roleId : roleIds)
-            {
-                SysUserRole ur = new SysUserRole();
-                ur.setUserId(userId);
-                ur.setRoleId(roleId);
-                list.add(ur);
-            }
-            userRoleMapper.batchUserRole(list);
+            List<SysUserRole> sysUserRoles = Arrays.stream(roleIds).map(
+                    mapper -> {
+                        SysUserRole sysUserRole = new SysUserRole();
+                        sysUserRole.setUserId(userId);
+                        sysUserRole.setRoleId(mapper);
+                        return sysUserRole;
+                    }
+            ).collect(Collectors.toList());
+            userRoleMapper.batchUserRole(sysUserRoles);
         }
     }
 
     /**
      * 通过用户ID删除用户
-     * 
+     *
      * @param userId 用户ID
      * @return 结果
      */
     @Override
     @Transactional
-    public int deleteUserById(Long userId)
-    {
+    public int deleteUserById(Long userId) {
         // 删除用户与角色关联
         userRoleMapper.deleteUserRoleByUserId(userId);
         // 删除用户与岗位表
@@ -450,16 +440,14 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 批量删除用户信息
-     * 
+     *
      * @param userIds 需要删除的用户ID
      * @return 结果
      */
     @Override
     @Transactional
-    public int deleteUserByIds(Long[] userIds)
-    {
-        for (Long userId : userIds)
-        {
+    public int deleteUserByIds(Long[] userIds) {
+        for (Long userId : userIds) {
             checkUserAllowed(new SysUser(userId));
             checkUserDataScope(userId);
         }
@@ -472,17 +460,15 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 导入用户数据
-     * 
-     * @param userList 用户数据列表
+     *
+     * @param userList        用户数据列表
      * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
-     * @param operName 操作用户
+     * @param operName        操作用户
      * @return 结果
      */
     @Override
-    public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName)
-    {
-        if (StringUtils.isNull(userList) || userList.size() == 0)
-        {
+    public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName) {
+        if (StringUtils.isNull(userList) || userList.size() == 0) {
             throw new ServiceException("导入用户数据不能为空!");
         }
         int successNum = 0;
@@ -490,23 +476,18 @@ public class SysUserServiceImpl implements ISysUserService
         StringBuilder successMsg = new StringBuilder();
         StringBuilder failureMsg = new StringBuilder();
         String password = configService.selectConfigByKey("sys.user.initPassword");
-        for (SysUser user : userList)
-        {
-            try
-            {
+        for (SysUser user : userList) {
+            try {
                 // 验证是否存在这个用户
                 SysUser u = userMapper.selectUserByUserName(user.getUserName());
-                if (StringUtils.isNull(u))
-                {
+                if (StringUtils.isNull(u)) {
                     BeanValidators.validateWithException(validator, user);
                     user.setPassword(SecurityUtils.encryptPassword(password));
                     user.setCreateBy(operName);
                     userMapper.insertUser(user);
                     successNum++;
                     successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
-                }
-                else if (isUpdateSupport)
-                {
+                } else if (isUpdateSupport) {
                     BeanValidators.validateWithException(validator, user);
                     checkUserAllowed(u);
                     checkUserDataScope(u.getUserId());
@@ -515,28 +496,21 @@ public class SysUserServiceImpl implements ISysUserService
                     userMapper.updateUser(user);
                     successNum++;
                     successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");
-                }
-                else
-                {
+                } else {
                     failureNum++;
                     failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 已存在");
                 }
-            }
-            catch (Exception e)
-            {
+            } catch (Exception e) {
                 failureNum++;
                 String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
                 failureMsg.append(msg + e.getMessage());
                 log.error(msg, e);
             }
         }
-        if (failureNum > 0)
-        {
+        if (failureNum > 0) {
             failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
             throw new ServiceException(failureMsg.toString());
-        }
-        else
-        {
+        } else {
             successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
         }
         return successMsg.toString();

+ 140 - 7
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDeviceListServiceImpl.java

@@ -100,18 +100,79 @@ public class TDeviceListServiceImpl implements ITDeviceListService {
     @Transactional
     @Override
     public int insertTDeviceList(TDeviceList tDeviceList) {
+        /**
+         * TODO 后期在bean中校验字段是否为空
+         */
+        //新增设备
+        if (tDeviceList == null) {
+            throw new ServiceException("新增设备数据不能为空!");
+        }
+        //设备是否绑定用户
+        if (tDeviceList.getUserid() == null) {
+            throw new ServiceException("新增设备未绑定用户!");
+        }
+        //工厂
+        if (tDeviceList.getFactory() == null) {
+            throw new ServiceException("新增设备未选择工厂!");
+        }
+        //设备型号
+        if (tDeviceList.getDeviceModel() == null) {
+            throw new ServiceException("新增设备未选择设备型号!");
+        }
+        //设备标识ID
+        if (tDeviceList.getDeviceId() == null || StringUtils.isEmpty(tDeviceList.getDeviceId())) {
+            throw new ServiceException("新增设备未填写设备标识ID!");
+        }
+        //发放方式
+        if (tDeviceList.getGrantType() == null) {
+            throw new ServiceException("新增设备未选择发放方式!");
+        }
+        //如果是购买方式
+        if (tDeviceList.getGrantType() == 1) {
+            //设备标识ID
+            if (tDeviceList.getPrice() == null || StringUtils.isEmpty(tDeviceList.getPrice())) {
+                throw new ServiceException("新增设备未填写销售价格!");
+            }
+//            //服务费用
+//            if (tDeviceList.getCost() == null || StringUtils.isEmpty(tDeviceList.getCost())) {
+//                throw new ServiceException("新增设备未填写服务费用!");
+//            }
+            //支付方式
+            if (tDeviceList.getPayment() == null) {
+                throw new ServiceException("新增设备未选择支付方式!");
+            }
+        }
+        //根据设备表示ID查询数据库中的设备信息
+        List<RateDto> rateDtoList = tDeviceListMapper.selectTDeviceByDeviceId(tDeviceList.getDeviceId());
+        if (rateDtoList != null && !rateDtoList.isEmpty()) {
+            //如果表中有该设备则提示
+            StringBuilder stringBuilder = new StringBuilder();
+            stringBuilder.append("新增设备信息已存在");
+            //如果有设备标识ID,则提示
+            if (!StringUtils.isEmpty(tDeviceList.getDeviceId())) {
+                stringBuilder.append(", 设备标识ID:" + tDeviceList.getDeviceId());
+            }
+            stringBuilder.append("!");
+            throw new ServiceException(stringBuilder.toString());
+        }
+        //新增时间
+        tDeviceList.setCreateTime(DateUtils.getNowDate());
+        int rows = tDeviceListMapper.insertTDeviceList(tDeviceList);
         TFacility tFacility = new TFacility();
-        if (StringUtils.isNotNull(tDeviceList.getDeviceId())) {
+        //设备编号
+        if (tDeviceList.getDeviceId() != null && !StringUtils.isEmpty(tDeviceList.getDeviceId())) {
             tFacility.setCode(tDeviceList.getDeviceId());
-        } else if (StringUtils.isNotNull(tDeviceList.getSimCode())) {
+        }
+        //设备SIM卡号
+        if (tDeviceList.getSimCode() != null && !StringUtils.isEmpty(tDeviceList.getSimCode())) {
             tFacility.setTelno(tDeviceList.getSimCode());
-        } else if (StringUtils.isNotNull(tDeviceList.getSerialNumber())) {
+        }
+        //设备序列号
+        if (tDeviceList.getSerialNumber() != null && !StringUtils.isEmpty(tDeviceList.getSerialNumber())) {
             tFacility.setIccid(tDeviceList.getSerialNumber());
         }
-        tFacility.setCreateTime(DateUtils.getNowDate());
         tFacilityMapper.insertTFacility(tFacility);
-        tDeviceList.setCreateTime(DateUtils.getNowDate());
-        return tDeviceListMapper.insertTDeviceList(tDeviceList);
+        return rows;
     }
 
     /**
@@ -122,7 +183,79 @@ public class TDeviceListServiceImpl implements ITDeviceListService {
      */
     @Override
     public int updateTDeviceList(TDeviceList tDeviceList) {
-        return tDeviceListMapper.updateTDeviceList(tDeviceList);
+        /**
+         * TODO 后期在bean中校验字段是否为空
+         */
+        //修改设备
+        if (tDeviceList == null) {
+            throw new ServiceException("修改设备数据不能为空!");
+        }
+        //设备是否绑定用户
+        if (tDeviceList.getUserid() == null) {
+            throw new ServiceException("修改设备未绑定用户!");
+        }
+        //工厂
+        if (tDeviceList.getFactory() == null) {
+            throw new ServiceException("修改设备未选择工厂!");
+        }
+        //设备型号
+        if (tDeviceList.getDeviceModel() == null) {
+            throw new ServiceException("修改设备未选择设备型号!");
+        }
+        //设备标识ID
+        if (tDeviceList.getDeviceId() == null || StringUtils.isEmpty(tDeviceList.getDeviceId())) {
+            throw new ServiceException("修改设备未填写设备标识ID!");
+        }
+        //发放方式
+        if (tDeviceList.getGrantType() == null) {
+            throw new ServiceException("修改设备未选择发放方式!");
+        }
+        //如果是购买方式
+        if (tDeviceList.getGrantType() == 1) {
+            //设备标识ID
+            if (tDeviceList.getPrice() == null || StringUtils.isEmpty(tDeviceList.getPrice())) {
+                throw new ServiceException("修改设备未填写销售价格!");
+            }
+//            //服务费用
+//            if (tDeviceList.getCost() == null || StringUtils.isEmpty(tDeviceList.getCost())) {
+//                throw new ServiceException("修改设备未填写服务费用!");
+//            }
+            //支付方式
+            if (tDeviceList.getPayment() == null) {
+                throw new ServiceException("修改设备未选择支付方式!");
+            }
+        }
+
+        //根据设备表示ID查询数据库中的设备信息
+        TDeviceList deviceListBean = tDeviceListMapper.selectTDeviceListById(tDeviceList.getId());
+        if (deviceListBean == null) {
+            //如果表中没有该设备则提示
+            StringBuilder stringBuilder = new StringBuilder();
+            stringBuilder.append("修改设备信息不存在!");
+            throw new ServiceException(stringBuilder.toString());
+        }
+        //判断用户是否修改设备标识ID
+        if (!StringUtils.equals(deviceListBean.getDeviceId(), tDeviceList.getDeviceId())) {
+            throw new ServiceException("修改设备信息禁止修改设备标识ID!");
+        }
+        //修改时间
+        tDeviceList.setUpdateTime(DateUtils.getNowDate());
+        int rows = tDeviceListMapper.updateTDeviceList(tDeviceList);
+        TFacility tFacility = new TFacility();
+        //设备编号
+        if (tDeviceList.getDeviceId() != null && !StringUtils.isEmpty(tDeviceList.getDeviceId())) {
+            tFacility.setCode(tDeviceList.getDeviceId());
+        }
+        //设备SIM卡号
+        if (tDeviceList.getSimCode() != null && !StringUtils.isEmpty(tDeviceList.getSimCode())) {
+            tFacility.setTelno(tDeviceList.getSimCode());
+        }
+        //设备序列号
+        if (tDeviceList.getSerialNumber() != null && !StringUtils.isEmpty(tDeviceList.getSerialNumber())) {
+            tFacility.setIccid(tDeviceList.getSerialNumber());
+        }
+        tFacilityMapper.updateTFacilityByDeviceCode(tFacility);
+        return rows;
     }
 
     /**

+ 69 - 10
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TUserProfileServiceImpl.java

@@ -6,6 +6,7 @@ import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
+import java.util.Comparator;
 import java.util.List;
 
 import com.ruoyi.common.exception.ServiceException;
@@ -22,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
+import java.util.stream.Collectors;
 
 import com.ruoyi.common.utils.StringUtils;
 import org.springframework.transaction.annotation.Transactional;
@@ -64,10 +66,16 @@ public class TUserProfileServiceImpl implements ITUserProfileService {
     @Override
     public List<TUserProfile> selectTUserProfileList(TUserProfile tUserProfile) {
         List<TUserProfile> tUserProfileList = tUserProfileMapper.selectTUserProfileList(tUserProfile);
-        for (TUserProfile list : tUserProfileList) {
-            list.setTEmergentPeopleList(tEmergentPeopleMapper.selectTEmergentPeopleByProfileId(list.getId()));
+        List<TUserProfile> userProfiles = new ArrayList<>();
+        if (tUserProfileList != null && !tUserProfileList.isEmpty()) {
+            userProfiles = tUserProfileList.stream().map(
+                    mapper -> {
+                        mapper.setTEmergentPeopleList(tEmergentPeopleMapper.selectTEmergentPeopleByProfileId(mapper.getId()));
+                        return mapper;
+                    }
+            ).collect(Collectors.toList());
         }
-        return tUserProfileList;
+        return userProfiles;
     }
 
     /**
@@ -90,7 +98,32 @@ public class TUserProfileServiceImpl implements ITUserProfileService {
     @Transactional
     @Override
     public int insertTUserProfile(TUserProfile tUserProfile) {
+        if (tUserProfile == null) {
+            throw new ServiceException("新增用户信息数据不能为空!");
+        }
+        //新增用户创建时间
         tUserProfile.setCreateTime(DateUtils.getNowDate());
+        //判断提交数据格式是否正确
+        if (tUserProfile.getSfzid() == null || tUserProfile.getSfzid().isEmpty()) {
+            throw new ServiceException("新增用户信息数据身份证号格式异常!");
+        }
+        //根据身份证号查询数据库中的用户信息
+        TUserProfile user = tUserProfileMapper.selectTUserProfileBySfzId(tUserProfile.getSfzid());
+        if (user != null) {
+            //如果表中有该用户则提示
+            StringBuilder stringBuilder = new StringBuilder();
+            stringBuilder.append("新增用户信息已存在");
+            //如果有用户名,则提示
+            if (!StringUtils.isEmpty(tUserProfile.getName())) {
+                stringBuilder.append(", 用户名:" + tUserProfile.getName());
+            }
+            //如果有身份证号,则提示
+            if (!StringUtils.isEmpty(tUserProfile.getSfzid())) {
+                stringBuilder.append(", 身份证号:" + tUserProfile.getSfzid());
+            }
+            stringBuilder.append("!");
+            throw new ServiceException(stringBuilder.toString());
+        }
         int rows = tUserProfileMapper.insertTUserProfile(tUserProfile);
         insertTEmergentPeople(tUserProfile);
         return rows;
@@ -105,9 +138,36 @@ public class TUserProfileServiceImpl implements ITUserProfileService {
     @Transactional
     @Override
     public int updateTUserProfile(TUserProfile tUserProfile) {
+        if (tUserProfile == null) {
+            throw new ServiceException("修改用户信息数据不能为空!");
+        }
+        //修改用户信息更新时间
+        tUserProfile.setUpdateTime(DateUtils.getNowDate());
+        //判断提交数据格式是否正确
+        if (tUserProfile.getSfzid() == null || tUserProfile.getSfzid().isEmpty()) {
+            throw new ServiceException("修改用户信息数据身份证号格式异常!");
+        }
+        //根据身份证号查询数据库中的用户信息
+        List<TUserProfile> userList = tUserProfileMapper.selectTUserProfileBySfzIdV2(tUserProfile.getSfzid());
+        if (userList != null && !userList.isEmpty()) {
+            //如果表中有该用户则提示
+            StringBuilder stringBuilder = new StringBuilder();
+            stringBuilder.append("修改用户信息已存在");
+            //如果有用户名,则提示
+            if (!StringUtils.isEmpty(tUserProfile.getName())) {
+                stringBuilder.append(", 用户名:" + tUserProfile.getName());
+            }
+            //如果有身份证号,则提示
+            if (!StringUtils.isEmpty(tUserProfile.getSfzid())) {
+                stringBuilder.append(", 身份证号:" + tUserProfile.getSfzid());
+            }
+            stringBuilder.append("!");
+            throw new ServiceException(stringBuilder.toString());
+        }
         tUserProfileMapper.deleteTEmergentPeopleByProfileId(tUserProfile.getId());
         insertTEmergentPeople(tUserProfile);
-        return tUserProfileMapper.updateTUserProfile(tUserProfile);
+        int rows = tUserProfileMapper.updateTUserProfile(tUserProfile);
+        return rows;
     }
 
     /**
@@ -232,13 +292,12 @@ public class TUserProfileServiceImpl implements ITUserProfileService {
      */
     public void insertTEmergentPeople(TUserProfile tUserProfile) {
         List<TEmergentPeople> tEmergentPeopleList = tUserProfile.getTEmergentPeopleList();
-        Integer id = tUserProfile.getId();
         if (StringUtils.isNotNull(tEmergentPeopleList)) {
-            List<TEmergentPeople> list = new ArrayList<TEmergentPeople>();
-            for (TEmergentPeople tEmergentPeople : tEmergentPeopleList) {
-                tEmergentPeople.setProfileId(id);
-                list.add(tEmergentPeople);
-            }
+            List<TEmergentPeople> list = tEmergentPeopleList.stream()
+                    .map(mapper -> {
+                        mapper.setProfileId(tUserProfile.getId());
+                        return mapper;
+                    }).collect(Collectors.toList());
             if (list.size() > 0) {
                 tUserProfileMapper.batchTEmergentPeople(list);
             }

+ 11 - 1
ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml

@@ -9,6 +9,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="postId"     column="post_id"      />
 	</resultMap>
 
+	<sql id="selectSysUserPost">
+		select user_id, post_id
+		from sys_user_post
+	</sql>
+
 	<delete id="deleteUserPostByUserId" parameterType="Long">
 		delete from sys_user_post where user_id=#{userId}
 	</delete>
@@ -16,7 +21,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	<select id="countUserPostById" resultType="Integer">
 	    select count(1) from sys_user_post where post_id=#{postId}  
 	</select>
-	
+
+	<select id="selectUserPostByUserId" parameterType="Long" resultMap="SysUserPostResult">
+        <include refid="selectSysUserPost"/>
+        where user_id = #{userId}
+    </select>
+
 	<delete id="deleteUserPost" parameterType="Long">
  		delete from sys_user_post where user_id in
  		<foreach collection="array" item="userId" open="(" separator="," close=")">

+ 131 - 75
ruoyi-system/src/main/resources/mapper/system/TDeviceListMapper.xml

@@ -1,126 +1,180 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.system.mapper.TDeviceListMapper">
-    
+
     <resultMap type="TDeviceList" id="TDeviceListResult">
-        <result property="id"    column="id"    />
-        <result property="fid"    column="fid"    />
-        <result property="deviceProper"    column="device_proper"    />
-        <result property="userid"    column="userid"    />
-        <result property="sfzid"    column="sfzid"    />
-        <result property="telno"    column="telno"    />
-        <result property="factory"    column="factory"    />
-        <result property="deviceModel"    column="device_model"    />
-        <result property="deviceId"    column="device_id"    />
-        <result property="simCode"    column="sim_code"    />
-        <result property="serialNumber"    column="serial_number"    />
-        <result property="grantType"    column="grant_type"    />
-        <result property="price"    column="price"    />
-        <result property="cost"    column="cost"    />
-        <result property="payment"    column="payment"    />
-        <result property="status"    column="status"    />
-        <result property="name"    column="name"    />
-        <result property="tel_one"    column="tel_one"    />
-        <result property="online_statis"    column="online_statis"    />
-        <result property="electric_quantity"    column="electric_quantity"    />
-        <result property="offlinetime"    column="offlinetime"    />
+        <result property="id" column="id"/>
+        <result property="fid" column="fid"/>
+        <result property="deviceProper" column="device_proper"/>
+        <result property="userid" column="userid"/>
+        <result property="sfzid" column="sfzid"/>
+        <result property="telno" column="telno"/>
+        <result property="factory" column="factory"/>
+        <result property="deviceModel" column="device_model"/>
+        <result property="deviceId" column="device_id"/>
+        <result property="simCode" column="sim_code"/>
+        <result property="serialNumber" column="serial_number"/>
+        <result property="grantType" column="grant_type"/>
+        <result property="price" column="price"/>
+        <result property="cost" column="cost"/>
+        <result property="payment" column="payment"/>
+        <result property="status" column="status"/>
+        <result property="name" column="name"/>
+        <result property="tel_one" column="tel_one"/>
+        <result property="online_statis" column="online_statis"/>
+        <result property="electric_quantity" column="electric_quantity"/>
+        <result property="offlinetime" column="offlinetime"/>
     </resultMap>
 
     <sql id="selectTDeviceListVo">
-        select id, device_proper, userid, sfzid, telno, factory, device_model, device_id, sim_code, serial_number, grant_type, price, cost, payment, createtime from t_device_list
+        select id,
+               device_proper,
+               userid,
+               sfzid,
+               telno,
+               factory,
+               device_model,
+               device_id,
+               sim_code,
+               serial_number,
+               grant_type,
+               price,
+               cost,
+               payment,
+               createtime
+        from t_device_list
     </sql>
 
     <select id="selectTDeviceListList" parameterType="TDeviceList" resultMap="TDeviceListResult">
-        select a.id, a.device_proper, a.userid, a.factory, a.device_model, a.device_id, a.sim_code, a.serial_number, a.grant_type, a.price, a.cost, a.payment, a.createtime, b.status, b.id as fid, c.name,c.sfzid,c.tel_one,d.online_statis,d.electric_quantity,d.offlinetime from t_device_list a
+        select a.id, a.device_proper, a.userid, a.factory, a.device_model, a.device_id, a.sim_code, a.serial_number,
+        a.grant_type, a.price, a.cost, a.payment, a.createtime, b.status, b.id as fid,
+        c.name,c.sfzid,c.tel_one,d.online_statis,d.electric_quantity,d.offlinetime from t_device_list a
         left join t_facility b on a.device_id=b.code
         left join t_user_profile c on a.userid=c.id
         left join t_shouhuan_info d on a.device_id=d.device_id_code
-        <where>  
-            <if test="deviceProper != null "> and a.device_proper = #{deviceProper}</if>
-            <if test="userid != null "> and a.userid = #{userid}</if>
-            <if test="sfzid != null  and sfzid != ''"> and a.sfzid = #{sfzid}</if>
-            <if test="telno != null  and telno != ''"> and a.telno = #{telno}</if>
-            <if test="factory != null "> and a.factory = #{factory}</if>
-            <if test="deviceModel != null "> and a.device_model = #{deviceModel}</if>
-            <if test="deviceId != null  and deviceId != ''"> and a.device_id = #{deviceId}</if>
-            <if test="simCode != null  and simCode != ''"> and a.sim_code = #{simCode}</if>
-            <if test="serialNumber != null  and serialNumber != ''"> and a.serial_number = #{serialNumber}</if>
-            <if test="grantType != null "> and a.grant_type = #{grantType}</if>
-            <if test="price != null  and price != ''"> and a.price = #{price}</if>
-            <if test="cost != null  and cost != ''"> and a.cost = #{cost}</if>
-            <if test="payment != null "> and a.payment = #{payment}</if>
-            <if test="createTime != null "> and a.createtime = #{createTime}</if>
+        <where>
+            <if test="deviceProper != null ">and a.device_proper = #{deviceProper}</if>
+            <if test="userid != null ">and a.userid = #{userid}</if>
+            <if test="sfzid != null  and sfzid != ''">and a.sfzid = #{sfzid}</if>
+            <if test="telno != null  and telno != ''">and a.telno = #{telno}</if>
+            <if test="factory != null ">and a.factory = #{factory}</if>
+            <if test="deviceModel != null ">and a.device_model = #{deviceModel}</if>
+            <if test="deviceId != null  and deviceId != ''">and a.device_id = #{deviceId}</if>
+            <if test="simCode != null  and simCode != ''">and a.sim_code = #{simCode}</if>
+            <if test="serialNumber != null  and serialNumber != ''">and a.serial_number = #{serialNumber}</if>
+            <if test="grantType != null ">and a.grant_type = #{grantType}</if>
+            <if test="price != null  and price != ''">and a.price = #{price}</if>
+            <if test="cost != null  and cost != ''">and a.cost = #{cost}</if>
+            <if test="payment != null ">and a.payment = #{payment}</if>
+            <if test="createTime != null ">and a.createtime = #{createTime}</if>
         </where>
     </select>
-    
+
     <select id="selectTDeviceListById" parameterType="Integer" resultMap="TDeviceListResult">
         <include refid="selectTDeviceListVo"/>
         where id = #{id}
     </select>
     <select id="selectTDeviceByDeviceId" resultType="com.ruoyi.system.domain.dto.RateDto">
-        select b.content,b.createtime from t_device_list a
-        left join t_shouhuan_receive_redocde b on a.device_id=b.device_id_code
-        where b.command='heart' and device_id_code = #{device_id_code}
+        select b.content, b.createtime
+        from t_device_list a
+                 left join t_shouhuan_receive_redocde b on a.device_id = b.device_id_code
+        where b.command = 'heart'
+          and device_id_code = #{device_id_code}
     </select>
     <select id="selectTDeviceByBlood" resultType="com.ruoyi.system.domain.dto.RateDto">
-        select b.content,b.createtime from t_device_list a
-        left join t_shouhuan_receive_redocde b on a.device_id=b.device_id_code
-        where b.command='blood' and device_id_code = #{device_id_code}
+        select b.content, b.createtime
+        from t_device_list a
+                 left join t_shouhuan_receive_redocde b on a.device_id = b.device_id_code
+        where b.command = 'blood'
+          and device_id_code = #{device_id_code}
     </select>
     <select id="selectTDeviceByOxygen" resultType="com.ruoyi.system.domain.dto.RateDto">
-        select b.content,b.createtime from t_device_list a
-        left join t_shouhuan_receive_redocde b on a.device_id=b.device_id_code
-        where b.command='oxygen' and device_id_code = #{device_id_code}
+        select b.content, b.createtime
+        from t_device_list a
+                 left join t_shouhuan_receive_redocde b on a.device_id = b.device_id_code
+        where b.command = 'oxygen'
+          and device_id_code = #{device_id_code}
     </select>
     <select id="selectTDeviceByTemp" resultType="com.ruoyi.system.domain.dto.RateDto">
-        select b.content,b.createtime from t_device_list a
-        left join t_shouhuan_receive_redocde b on a.device_id=b.device_id_code
-        where b.command='temp' and device_id_code = #{device_id_code}
+        select b.content, b.createtime
+        from t_device_list a
+                 left join t_shouhuan_receive_redocde b on a.device_id = b.device_id_code
+        where b.command = 'temp'
+          and device_id_code = #{device_id_code}
     </select>
     <select id="selectTDeviceByStep" resultType="com.ruoyi.system.domain.dto.RateDto">
-        select b.content,b.createtime from t_device_list a
-        left join t_shouhuan_receive_redocde b on a.device_id=b.device_id_code
-        where b.command='KA' and device_id_code = #{device_id_code}
+        select b.content, b.createtime
+        from t_device_list a
+                 left join t_shouhuan_receive_redocde b on a.device_id = b.device_id_code
+        where b.command = 'KA'
+          and device_id_code = #{device_id_code}
     </select>
     <select id="selectTDeviceByMessage" resultType="com.ruoyi.system.domain.dto.MessageDto">
-        select alarm_type,createtime from t_shouhuan_alarm_list
+        select alarm_type, createtime
+        from t_shouhuan_alarm_list
         where device_id_code = #{device_id_code}
     </select>
     <select id="selectTDeviceByMessageLog" resultType="com.ruoyi.system.domain.dto.MessageLogDto">
         SELECT a.device_id,c.name,b.alarm_type,b.createtime FROM t_device_list a
-       left join t_shouhuan_alarm_list b on a.device_id=b.device_id_code
-       left join t_user_profile c on a.userid=c.id
+        left join t_shouhuan_alarm_list b on a.device_id=b.device_id_code
+        left join t_user_profile c on a.userid=c.id
         <where>
-            <if test="device_id != null "> and a.device_id = #{device_id}</if>
-            <if test="alarm_type != null "> and b.alarm_type = #{alarm_type}</if>
+            <if test="device_id != null ">and a.device_id = #{device_id}</if>
+            <if test="alarm_type != null ">and b.alarm_type = #{alarm_type}</if>
         </where>
     </select>
     <select id="selectshouhuan" resultType="java.lang.String">
-        select use_value from t_setting
+        select use_value
+        from t_setting
         where use_key = #{use_key}
     </select>
     <select id="selectDeviceListDto" resultType="com.ruoyi.system.domain.dto.DeviceTypeDto">
-        select device_model,count(device_model) as count from t_device_list
+        select device_model, count(device_model) as count
+        from t_device_list
         group by device_model
     </select>
     <select id="selectDeviceListCount" resultType="java.lang.Integer">
-        select IFNULL(count(*),0) from t_device_list
+        select IFNULL(count(*), 0)
+        from t_device_list
     </select>
     <select id="selectAddDevice" resultType="com.ruoyi.system.domain.dto.AddDeviceDto">
-        SELECT DATE_FORMAT(createtime, '%Y-%m') AS month, COUNT(*) AS count FROM t_device_list
+        SELECT DATE_FORMAT(createtime, '%Y-%m') AS month, COUNT(*) AS count
+        FROM t_device_list
         WHERE createtime > DATE_SUB(NOW(), INTERVAL 3 MONTH)
         GROUP BY month;
     </select>
     <select id="selectTDeviceListBandUser" resultType="java.lang.Integer">
-        select count(distinct userid) from t_device_list
+        select count(distinct userid)
+        from t_device_list
     </select>
     <select id="selectTDeviceListListByDeviceId" resultMap="TDeviceListResult">
-        select a.id, a.device_proper, a.userid, a.factory, a.device_model, a.device_id, a.sim_code, a.serial_number, a.grant_type, a.price, a.cost, a.payment, a.createtime, b.status, b.id as fid, c.name,c.sfzid,c.tel_one,d.online_statis,d.electric_quantity,d.offlinetime from t_device_list a
-        left join t_facility b on a.device_id=b.code
-        left join t_user_profile c on a.userid=c.id
-        left join t_shouhuan_info d on a.device_id=d.device_id_code
+        select a.id,
+               a.device_proper,
+               a.userid,
+               a.factory,
+               a.device_model,
+               a.device_id,
+               a.sim_code,
+               a.serial_number,
+               a.grant_type,
+               a.price,
+               a.cost,
+               a.payment,
+               a.createtime,
+               b.status,
+               b.id as fid,
+               c.name,
+               c.sfzid,
+               c.tel_one,
+               d.online_statis,
+               d.electric_quantity,
+               d.offlinetime
+        from t_device_list a
+                 left join t_facility b on a.device_id = b.code
+                 left join t_user_profile c on a.userid = c.id
+                 left join t_shouhuan_info d on a.device_id = d.device_id_code
         where a.device_id = #{deviceId}
     </select>
     <select id="selectTDeviceList" parameterType="TDeviceList" resultMap="TDeviceListResult">
@@ -145,7 +199,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="cost != null">cost,</if>
             <if test="payment != null">payment,</if>
             <if test="createTime != null">createtime,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="deviceProper != null">#{deviceProper},</if>
             <if test="userid != null">#{userid},</if>
@@ -161,7 +215,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="cost != null">#{cost},</if>
             <if test="payment != null">#{payment},</if>
             <if test="createTime != null">#{createTime},</if>
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateTDeviceList" parameterType="TDeviceList">
@@ -256,11 +310,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteTDeviceListById" parameterType="Integer">
-        delete from t_device_list where id = #{id}
+        delete
+        from t_device_list
+        where id = #{id}
     </delete>
 
     <delete id="deleteTDeviceListByIds" parameterType="String">
-        delete from t_device_list where id in 
+        delete from t_device_list where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>

+ 1 - 1
ruoyi-system/src/main/resources/mapper/system/TDeviceSetMapper.xml

@@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
     <select id="selectTDeviceSetByCode" resultMap="TDeviceSetResult">
         <include refid="selectTDeviceSetVo"/>
-        where device_id_code = #{deviceIdCode}
+        where device_id_code = #{device_id_code}
     </select>
 
     <insert id="insertTDeviceSet" parameterType="TDeviceSet" useGeneratedKeys="true" keyProperty="id">

+ 13 - 0
ruoyi-system/src/main/resources/mapper/system/TFacilityMapper.xml

@@ -85,6 +85,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </trim>
         where id = #{id}
     </update>
+    <update id="updateTFacilityByDeviceCode" parameterType="TFacility">
+        update t_facility
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="kind != null">kind = #{kind},</if>
+            <if test="telno != null">telno = #{telno},</if>
+            <if test="comCode != null">com_code = #{comCode},</if>
+            <if test="createTime != null">createtime = #{createTime},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="iccid != null">iccid = #{iccid},</if>
+            <if test="puk != null">puk = #{puk},</if>
+        </trim>
+        where code = #{code}
+    </update>
 
     <delete id="deleteTFacilityById" parameterType="Long">
         delete from t_facility where id = #{id}

+ 256 - 182
ruoyi-system/src/main/resources/mapper/system/TUserProfileMapper.xml

@@ -1,216 +1,286 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.system.mapper.TUserProfileMapper">
-    
+
     <resultMap type="TUserProfile" id="TUserProfileResult">
-        <result property="id"    column="id"    />
-        <result property="name"    column="name"    />
-        <result property="gender"    column="gender"    />
-        <result property="sfzid"    column="sfzid"    />
-        <result property="telOne"    column="tel_one"    />
-        <result property="telTwo"    column="tel_two"    />
-        <result property="telThree"    column="tel_three"    />
-        <result property="birthday"    column="birthday"    />
-        <result property="age"    column="age"    />
-        <result property="marrStatus"    column="marr_status"    />
-        <result property="national"    column="national"    />
-        <result property="local"    column="local"    />
-        <result property="clientType"    column="client_type"    />
-        <result property="liveStatus"    column="live_status"    />
-        <result property="familyAddress"    column="family_address"    />
-        <result property="detailAddress"    column="detail_address"    />
-        <result property="houseAddress"    column="house_address"    />
-        <result property="houseDetailAddress"    column="house_detail_address"    />
-        <result property="serviceid"    column="serviceid"    />
-        <result property="oldmenStatus"    column="oldmen_status"    />
-        <result property="changeContent"    column="change_content"    />
-        <result property="loseMonth"    column="lose_month"    />
-        <result property="treatMonth"    column="treat_month"    />
-        <result property="isTreat"    column="is_treat"    />
-        <result property="serviceType"    column="service_type"    />
-        <result property="treateSure"    column="treate_sure"    />
-        <result property="moneyCome"    column="money_come"    />
-        <result property="moneyMonth"    column="money_month"    />
-        <result property="cardCode"    column="card_code"    />
-        <result property="slowIllness"    column="slow_illness"    />
-        <result property="bloodType"    column="blood_type"    />
-        <result property="shiStatus"    column="shi_status"    />
-        <result property="disablityStatus"    column="disablity_status"    />
-        <result property="disablityEntry"    column="disablity_entry"    />
-        <result property="educaLevel"    column="educa_level"    />
-        <result property="special"    column="special"    />
-        <result property="title"    column="title"    />
-        <result property="unity"    column="unity"    />
-        <result property="natureHeart"    column="nature_heart"    />
-        <result property="eatPoint"    column="eat_point"    />
-        <result property="speciality"    column="speciality"    />
-        <result property="hobby"    column="hobby"    />
-        <result property="photo"    column="photo"    />
-        <result property="otherPhoto"    column="other_photo"    />
-        <result property="remarks"    column="remarks"    />
-        <result property="createTime"    column="createtime"    />
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="gender" column="gender"/>
+        <result property="sfzid" column="sfzid"/>
+        <result property="telOne" column="tel_one"/>
+        <result property="telTwo" column="tel_two"/>
+        <result property="telThree" column="tel_three"/>
+        <result property="birthday" column="birthday"/>
+        <result property="age" column="age"/>
+        <result property="marrStatus" column="marr_status"/>
+        <result property="national" column="national"/>
+        <result property="local" column="local"/>
+        <result property="clientType" column="client_type"/>
+        <result property="liveStatus" column="live_status"/>
+        <result property="familyAddress" column="family_address"/>
+        <result property="detailAddress" column="detail_address"/>
+        <result property="houseAddress" column="house_address"/>
+        <result property="houseDetailAddress" column="house_detail_address"/>
+        <result property="serviceid" column="serviceid"/>
+        <result property="oldmenStatus" column="oldmen_status"/>
+        <result property="changeContent" column="change_content"/>
+        <result property="loseMonth" column="lose_month"/>
+        <result property="treatMonth" column="treat_month"/>
+        <result property="isTreat" column="is_treat"/>
+        <result property="serviceType" column="service_type"/>
+        <result property="treateSure" column="treate_sure"/>
+        <result property="moneyCome" column="money_come"/>
+        <result property="moneyMonth" column="money_month"/>
+        <result property="cardCode" column="card_code"/>
+        <result property="slowIllness" column="slow_illness"/>
+        <result property="bloodType" column="blood_type"/>
+        <result property="shiStatus" column="shi_status"/>
+        <result property="disablityStatus" column="disablity_status"/>
+        <result property="disablityEntry" column="disablity_entry"/>
+        <result property="educaLevel" column="educa_level"/>
+        <result property="special" column="special"/>
+        <result property="title" column="title"/>
+        <result property="unity" column="unity"/>
+        <result property="natureHeart" column="nature_heart"/>
+        <result property="eatPoint" column="eat_point"/>
+        <result property="speciality" column="speciality"/>
+        <result property="hobby" column="hobby"/>
+        <result property="photo" column="photo"/>
+        <result property="otherPhoto" column="other_photo"/>
+        <result property="remarks" column="remarks"/>
+        <result property="createTime" column="createtime"/>
     </resultMap>
 
     <resultMap id="TUserProfileTEmergentPeopleResult" type="TUserProfile" extends="TUserProfileResult">
-        <collection property="tEmergentPeopleList" notNullColumn="sub_id" javaType="java.util.List" resultMap="TEmergentPeopleResult" />
+        <collection property="tEmergentPeopleList" notNullColumn="sub_id" javaType="java.util.List"
+                    resultMap="TEmergentPeopleResult"/>
     </resultMap>
 
     <resultMap type="TEmergentPeople" id="TEmergentPeopleResult">
-        <result property="id"    column="sub_id"    />
-        <result property="profileId"    column="sub_profile_id"    />
-        <result property="name"    column="sub_name"    />
-        <result property="telno"    column="sub_telno"    />
-        <result property="relation"    column="sub_relation"    />
-        <result property="isConn"    column="sub_is_conn"    />
+        <result property="id" column="sub_id"/>
+        <result property="profileId" column="sub_profile_id"/>
+        <result property="name" column="sub_name"/>
+        <result property="telno" column="sub_telno"/>
+        <result property="relation" column="sub_relation"/>
+        <result property="isConn" column="sub_is_conn"/>
     </resultMap>
 
     <sql id="selectTUserProfileVo">
-        select id, name, gender, sfzid, tel_one, tel_two, tel_three, birthday, age, marr_status, national, local, client_type, live_status, family_address, detail_address, house_address, house_detail_address, serviceid, oldmen_status, change_content, lose_month, treat_month, is_treat, service_type, treate_sure, money_come, money_month, card_code, slow_illness, blood_type, shi_status, disablity_status, disablity_entry, educa_level, special, title, unity, nature_heart, eat_point, speciality, hobby, photo, other_photo, remarks, createtime from t_user_profile
+        select id,
+               name,
+               gender,
+               sfzid,
+               tel_one,
+               tel_two,
+               tel_three,
+               birthday,
+               age,
+               marr_status, national, local, client_type, live_status, family_address, detail_address, house_address, house_detail_address, serviceid, oldmen_status, change_content, lose_month, treat_month, is_treat, service_type, treate_sure, money_come, money_month, card_code, slow_illness, blood_type, shi_status, disablity_status, disablity_entry, educa_level, special, title, unity, nature_heart, eat_point, speciality, hobby, photo, other_photo, remarks, createtime
+        from t_user_profile
     </sql>
 
     <select id="selectTUserProfileList" parameterType="TUserProfile" resultMap="TUserProfileResult">
         <include refid="selectTUserProfileVo"/>
-        <where>  
-            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
-            <if test="gender != null "> and gender = #{gender}</if>
-            <if test="sfzid != null  and sfzid != ''"> and sfzid = #{sfzid}</if>
-            <if test="telOne != null  and telOne != ''"> and tel_one = #{telOne}</if>
-            <if test="telTwo != null  and telTwo != ''"> and tel_two = #{telTwo}</if>
-            <if test="telThree != null  and telThree != ''"> and tel_three = #{telThree}</if>
-            <if test="birthday != null  and birthday != ''"> and birthday = #{birthday}</if>
-            <if test="age != null "> and age = #{age}</if>
-            <if test="marrStatus != null "> and marr_status = #{marrStatus}</if>
-            <if test="national != null "> and national = #{national}</if>
-            <if test="local != null "> and local = #{local}</if>
-            <if test="clientType != null "> and client_type = #{clientType}</if>
-            <if test="liveStatus != null "> and live_status = #{liveStatus}</if>
-            <if test="familyAddress != null  and familyAddress != ''"> and family_address = #{familyAddress}</if>
-            <if test="detailAddress != null  and detailAddress != ''"> and detail_address = #{detailAddress}</if>
-            <if test="houseAddress != null  and houseAddress != ''"> and house_address = #{houseAddress}</if>
-            <if test="houseDetailAddress != null  and houseDetailAddress != ''"> and house_detail_address = #{houseDetailAddress}</if>
-            <if test="serviceid != null "> and serviceid = #{serviceid}</if>
-            <if test="oldmenStatus != null  and oldmenStatus != ''"> and oldmen_status = #{oldmenStatus}</if>
-            <if test="changeContent != null  and changeContent != ''"> and change_content = #{changeContent}</if>
-            <if test="loseMonth != null  and loseMonth != ''"> and lose_month = #{loseMonth}</if>
-            <if test="treatMonth != null  and treatMonth != ''"> and treat_month = #{treatMonth}</if>
-            <if test="isTreat != null "> and is_treat = #{isTreat}</if>
-            <if test="serviceType != null "> and service_type = #{serviceType}</if>
-            <if test="treateSure != null "> and treate_sure = #{treateSure}</if>
-            <if test="moneyCome != null "> and money_come = #{moneyCome}</if>
-            <if test="moneyMonth != null  and moneyMonth != ''"> and money_month = #{moneyMonth}</if>
-            <if test="cardCode != null  and cardCode != ''"> and card_code = #{cardCode}</if>
-            <if test="slowIllness != null  and slowIllness != ''"> and slow_illness = #{slowIllness}</if>
-            <if test="bloodType != null "> and blood_type = #{bloodType}</if>
-            <if test="shiStatus != null "> and shi_status = #{shiStatus}</if>
-            <if test="disablityStatus != null "> and disablity_status = #{disablityStatus}</if>
-            <if test="disablityEntry != null "> and disablity_entry = #{disablityEntry}</if>
-            <if test="educaLevel != null "> and educa_level = #{educaLevel}</if>
-            <if test="special != null  and special != ''"> and special = #{special}</if>
-            <if test="title != null  and title != ''"> and title = #{title}</if>
-            <if test="unity != null  and unity != ''"> and unity = #{unity}</if>
-            <if test="natureHeart != null  and natureHeart != ''"> and nature_heart = #{natureHeart}</if>
-            <if test="eatPoint != null  and eatPoint != ''"> and eat_point = #{eatPoint}</if>
-            <if test="speciality != null  and speciality != ''"> and speciality = #{speciality}</if>
-            <if test="hobby != null  and hobby != ''"> and hobby = #{hobby}</if>
-            <if test="photo != null  and photo != ''"> and photo = #{photo}</if>
-            <if test="otherPhoto != null  and otherPhoto != ''"> and other_photo = #{otherPhoto}</if>
-            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
-            <if test="createTime != null "> and createtime = #{createTime}</if>
+        <where>
+            <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
+            <if test="gender != null ">and gender = #{gender}</if>
+            <if test="sfzid != null  and sfzid != ''">and sfzid = #{sfzid}</if>
+            <if test="telOne != null  and telOne != ''">and tel_one = #{telOne}</if>
+            <if test="telTwo != null  and telTwo != ''">and tel_two = #{telTwo}</if>
+            <if test="telThree != null  and telThree != ''">and tel_three = #{telThree}</if>
+            <if test="birthday != null  and birthday != ''">and birthday = #{birthday}</if>
+            <if test="age != null ">and age = #{age}</if>
+            <if test="marrStatus != null ">and marr_status = #{marrStatus}</if>
+            <if test="national != null ">and national = #{national}</if>
+            <if test="local != null ">and local = #{local}</if>
+            <if test="clientType != null ">and client_type = #{clientType}</if>
+            <if test="liveStatus != null ">and live_status = #{liveStatus}</if>
+            <if test="familyAddress != null  and familyAddress != ''">and family_address = #{familyAddress}</if>
+            <if test="detailAddress != null  and detailAddress != ''">and detail_address = #{detailAddress}</if>
+            <if test="houseAddress != null  and houseAddress != ''">and house_address = #{houseAddress}</if>
+            <if test="houseDetailAddress != null  and houseDetailAddress != ''">and house_detail_address =
+                #{houseDetailAddress}
+            </if>
+            <if test="serviceid != null ">and serviceid = #{serviceid}</if>
+            <if test="oldmenStatus != null  and oldmenStatus != ''">and oldmen_status = #{oldmenStatus}</if>
+            <if test="changeContent != null  and changeContent != ''">and change_content = #{changeContent}</if>
+            <if test="loseMonth != null  and loseMonth != ''">and lose_month = #{loseMonth}</if>
+            <if test="treatMonth != null  and treatMonth != ''">and treat_month = #{treatMonth}</if>
+            <if test="isTreat != null ">and is_treat = #{isTreat}</if>
+            <if test="serviceType != null ">and service_type = #{serviceType}</if>
+            <if test="treateSure != null ">and treate_sure = #{treateSure}</if>
+            <if test="moneyCome != null ">and money_come = #{moneyCome}</if>
+            <if test="moneyMonth != null  and moneyMonth != ''">and money_month = #{moneyMonth}</if>
+            <if test="cardCode != null  and cardCode != ''">and card_code = #{cardCode}</if>
+            <if test="slowIllness != null  and slowIllness != ''">and slow_illness = #{slowIllness}</if>
+            <if test="bloodType != null ">and blood_type = #{bloodType}</if>
+            <if test="shiStatus != null ">and shi_status = #{shiStatus}</if>
+            <if test="disablityStatus != null ">and disablity_status = #{disablityStatus}</if>
+            <if test="disablityEntry != null ">and disablity_entry = #{disablityEntry}</if>
+            <if test="educaLevel != null ">and educa_level = #{educaLevel}</if>
+            <if test="special != null  and special != ''">and special = #{special}</if>
+            <if test="title != null  and title != ''">and title = #{title}</if>
+            <if test="unity != null  and unity != ''">and unity = #{unity}</if>
+            <if test="natureHeart != null  and natureHeart != ''">and nature_heart = #{natureHeart}</if>
+            <if test="eatPoint != null  and eatPoint != ''">and eat_point = #{eatPoint}</if>
+            <if test="speciality != null  and speciality != ''">and speciality = #{speciality}</if>
+            <if test="hobby != null  and hobby != ''">and hobby = #{hobby}</if>
+            <if test="photo != null  and photo != ''">and photo = #{photo}</if>
+            <if test="otherPhoto != null  and otherPhoto != ''">and other_photo = #{otherPhoto}</if>
+            <if test="remarks != null  and remarks != ''">and remarks = #{remarks}</if>
+            <if test="createTime != null ">and createtime = #{createTime}</if>
         </where>
     </select>
-    
+
     <select id="selectTUserProfileById" parameterType="Integer" resultMap="TUserProfileTEmergentPeopleResult">
-        select a.id, a.name, a.gender, a.sfzid, a.tel_one, a.tel_two, a.tel_three, a.birthday, a.age, a.marr_status, a.national, a.local, a.client_type, a.live_status, a.family_address, a.detail_address, a.house_address, a.house_detail_address, a.serviceid, a.oldmen_status, a.change_content, a.lose_month, a.treat_month, a.is_treat, a.service_type, a.treate_sure, a.money_come, a.money_month, a.card_code, a.slow_illness, a.blood_type, a.shi_status, a.disablity_status, a.disablity_entry, a.educa_level, a.special, a.title, a.unity, a.nature_heart, a.eat_point, a.speciality, a.hobby, a.photo, a.other_photo, a.remarks, a.createtime,
- b.id as sub_id, b.profile_id as sub_profile_id, b.name as sub_name, b.telno as sub_telno, b.relation as sub_relation, b.is_conn as sub_is_conn
+        select a.id,
+               a.name,
+               a.gender,
+               a.sfzid,
+               a.tel_one,
+               a.tel_two,
+               a.tel_three,
+               a.birthday,
+               a.age,
+               a.marr_status,
+               a.national,
+               a.local,
+               a.client_type,
+               a.live_status,
+               a.family_address,
+               a.detail_address,
+               a.house_address,
+               a.house_detail_address,
+               a.serviceid,
+               a.oldmen_status,
+               a.change_content,
+               a.lose_month,
+               a.treat_month,
+               a.is_treat,
+               a.service_type,
+               a.treate_sure,
+               a.money_come,
+               a.money_month,
+               a.card_code,
+               a.slow_illness,
+               a.blood_type,
+               a.shi_status,
+               a.disablity_status,
+               a.disablity_entry,
+               a.educa_level,
+               a.special,
+               a.title,
+               a.unity,
+               a.nature_heart,
+               a.eat_point,
+               a.speciality,
+               a.hobby,
+               a.photo,
+               a.other_photo,
+               a.remarks,
+               a.createtime,
+               b.id         as sub_id,
+               b.profile_id as sub_profile_id,
+               b.name       as sub_name,
+               b.telno      as sub_telno,
+               b.relation   as sub_relation,
+               b.is_conn    as sub_is_conn
         from t_user_profile a
-        left join t_emergent_people b on b.profile_id = a.id
+                 left join t_emergent_people b on b.profile_id = a.id
         where a.id = #{id}
     </select>
     <select id="selectTUserProfileListByDevice" resultType="com.ruoyi.system.domain.dto.TUserProfileDto">
         select id, name, gender, sfzid, tel_one, age, family_address from t_user_profile
         <where>
-            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
-            <if test="gender != null "> and gender = #{gender}</if>
-            <if test="sfzid != null  and sfzid != ''"> and sfzid = #{sfzid}</if>
-            <if test="telOne != null  and telOne != ''"> and tel_one = #{telOne}</if>
-            <if test="age != null "> and age = #{age}</if>
-            <if test="familyAddress != null  and familyAddress != ''"> and family_address = #{familyAddress}</if>
+            <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
+            <if test="gender != null ">and gender = #{gender}</if>
+            <if test="sfzid != null  and sfzid != ''">and sfzid = #{sfzid}</if>
+            <if test="telOne != null  and telOne != ''">and tel_one = #{telOne}</if>
+            <if test="age != null ">and age = #{age}</if>
+            <if test="familyAddress != null  and familyAddress != ''">and family_address = #{familyAddress}</if>
         </where>
     </select>
     <select id="selectTUserProfileBySfzId" resultType="com.ruoyi.system.domain.TUserProfile">
-        select * from t_user_profile
+        select *
+        from t_user_profile
+        where sfzid = #{sfzid}
+    </select>
+    <select id="selectTUserProfileBySfzIdV2" resultType="com.ruoyi.system.domain.TUserProfile">
+        <include refid="selectTUserProfileVo"/>
         where sfzid = #{sfzid}
     </select>
     <select id="selectuserAgeDto" resultType="com.ruoyi.system.domain.dto.UserAgeDto">
-        SELECT
-        CASE
-        WHEN age &lt; 20
-        THEN
-        '10'
-        WHEN age &gt;= 20
-        AND age &lt; 30 THEN
-        '20'
-        WHEN age &gt;= 30
-        AND age &lt; 40 THEN
-        '30'
-        WHEN age &gt;= 40
-        AND age &lt; 50 THEN
-        '40'
-        WHEN age &gt;= 50
-        AND age &lt; 60 THEN
-        '50'
-        WHEN age &gt;= 60
-        AND age &lt; 70 THEN
-        '60'
-        WHEN age &gt;= 70
-        AND age &lt; 80 THEN
-        '70'
-        WHEN age &gt;= 80
-        AND age &lt; 90 THEN
-        '80'
-        WHEN age &gt; 90 THEN
-        '100以上'
-        END AS age,
-        count(*) AS count
+        SELECT CASE
+                   WHEN age &lt; 20
+                       THEN
+                       '10'
+                   WHEN age &gt;= 20
+                       AND age &lt; 30 THEN
+                       '20'
+                   WHEN age &gt;= 30
+                       AND age &lt; 40 THEN
+                       '30'
+                   WHEN age &gt;= 40
+                       AND age &lt; 50 THEN
+                       '40'
+                   WHEN age &gt;= 50
+                       AND age &lt; 60 THEN
+                       '50'
+                   WHEN age &gt;= 60
+                       AND age &lt; 70 THEN
+                       '60'
+                   WHEN age &gt;= 70
+                       AND age &lt; 80 THEN
+                       '70'
+                   WHEN age &gt;= 80
+                       AND age &lt; 90 THEN
+                       '80'
+                   WHEN age &gt; 90 THEN
+                       '100以上'
+                   END AS age,
+               count(*) AS count
         FROM
-        t_user_profile
+            t_user_profile
         GROUP BY
-        CASE
-        WHEN age &lt; 20
-        THEN
-        '10'
-        WHEN age &gt;= 20
-        AND age &lt; 30 THEN
-        '20'
-        WHEN age &gt;= 30
-        AND age &lt; 40 THEN
-        '30'
-        WHEN age &gt;= 40
-        AND age &lt; 50 THEN
-        '40'
-        WHEN age &gt;= 50
-        AND age &lt; 60 THEN
-        '50'
-        WHEN age &gt;= 60
-        AND age &lt; 70 THEN
-        '60'
-        WHEN age &gt;= 70
-        AND age &lt; 80 THEN
-        '70'
-        WHEN age &gt;= 80
-        AND age &lt; 90 THEN
-        '80'
-        WHEN age &gt; 90 THEN
-        '100以上'
+            CASE
+            WHEN age &lt; 20
+            THEN
+            '10'
+            WHEN age &gt;= 20
+            AND age &lt; 30 THEN
+            '20'
+            WHEN age &gt;= 30
+            AND age &lt; 40 THEN
+            '30'
+            WHEN age &gt;= 40
+            AND age &lt; 50 THEN
+            '40'
+            WHEN age &gt;= 50
+            AND age &lt; 60 THEN
+            '50'
+            WHEN age &gt;= 60
+            AND age &lt; 70 THEN
+            '60'
+            WHEN age &gt;= 70
+            AND age &lt; 80 THEN
+            '70'
+            WHEN age &gt;= 80
+            AND age &lt; 90 THEN
+            '80'
+            WHEN age &gt; 90 THEN
+            '100以上'
         END;
     </select>
     <select id="selectuserAgeCount" resultType="java.lang.Integer">
-        select IFNULL(count(*),0) from t_user_profile
+        select IFNULL(count(*), 0)
+        from t_user_profile
     </select>
     <select id="selectAddUser" resultType="com.ruoyi.system.domain.dto.AddUserDto">
-        SELECT DATE_FORMAT(createtime, '%Y-%m') AS month, COUNT(*) AS count FROM t_user_profile GROUP BY month;
+        SELECT DATE_FORMAT(createtime, '%Y-%m') AS month, COUNT(*) AS count
+        FROM t_user_profile
+        GROUP BY month;
     </select>
 
     <insert id="insertTUserProfile" parameterType="TUserProfile" useGeneratedKeys="true" keyProperty="id">
@@ -261,7 +331,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="otherPhoto != null">other_photo,</if>
             <if test="remarks != null">remarks,</if>
             <if test="createTime != null">createtime,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="name != null">#{name},</if>
             <if test="gender != null">#{gender},</if>
@@ -308,7 +378,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="otherPhoto != null">#{otherPhoto},</if>
             <if test="remarks != null">#{remarks},</if>
             <if test="createTime != null">#{createTime},</if>
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateTUserProfile" parameterType="TUserProfile">
@@ -364,30 +434,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteTUserProfileById" parameterType="Integer">
-        delete from t_user_profile where id = #{id}
+        delete
+        from t_user_profile
+        where id = #{id}
     </delete>
 
     <delete id="deleteTUserProfileByIds" parameterType="String">
-        delete from t_user_profile where id in 
+        delete from t_user_profile where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
     </delete>
-    
+
     <delete id="deleteTEmergentPeopleByProfileIds" parameterType="String">
-        delete from t_emergent_people where profile_id in 
+        delete from t_emergent_people where profile_id in
         <foreach item="profileId" collection="array" open="(" separator="," close=")">
             #{profileId}
         </foreach>
     </delete>
 
     <delete id="deleteTEmergentPeopleByProfileId" parameterType="Integer">
-        delete from t_emergent_people where profile_id = #{profileId}
+        delete
+        from t_emergent_people
+        where profile_id = #{profileId}
     </delete>
 
     <insert id="batchTEmergentPeople">
         insert into t_emergent_people( id, profile_id, name, telno, relation, is_conn) values
-		<foreach item="item" index="index" collection="list" separator=",">
+        <foreach item="item" index="index" collection="list" separator=",">
             ( #{item.id}, #{item.profileId}, #{item.name}, #{item.telno}, #{item.relation}, #{item.isConn})
         </foreach>
     </insert>

Some files were not shown because too many files changed in this diff