作者 钟来

初始提交

正在显示 25 个修改的文件 包含 1597 行增加17 行删除
@@ -86,7 +86,6 @@ public class IotDeviceControlController { @@ -86,7 +86,6 @@ public class IotDeviceControlController {
86 { 86 {
87 return null; 87 return null;
88 } 88 }
89 - Map<String,Object> map = new HashMap<>();  
90 Map<String,Object> valueMap = new HashMap<>(); 89 Map<String,Object> valueMap = new HashMap<>();
91 valueMap.put("restart",restart); 90 valueMap.put("restart",restart);
92 Response response1 = HttpUtils.postJsonBody(url, formBody -> { 91 Response response1 = HttpUtils.postJsonBody(url, formBody -> {
  1 +package com.zhonglai.luhui.admin.controller.user;
  2 +
  3 +import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
  5 +
  6 +import io.swagger.annotations.Api;
  7 +import io.swagger.annotations.ApiOperation;
  8 +import org.springframework.security.access.prepost.PreAuthorize;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.GetMapping;
  11 +import org.springframework.web.bind.annotation.PostMapping;
  12 +import org.springframework.web.bind.annotation.PutMapping;
  13 +import org.springframework.web.bind.annotation.DeleteMapping;
  14 +import org.springframework.web.bind.annotation.PathVariable;
  15 +import org.springframework.web.bind.annotation.RequestBody;
  16 +import org.springframework.web.bind.annotation.RequestMapping;
  17 +import org.springframework.web.bind.annotation.RestController;
  18 +import com.ruoyi.common.annotation.Log;
  19 +import com.ruoyi.common.core.controller.BaseController;
  20 +import com.ruoyi.common.core.domain.AjaxResult;
  21 +import com.ruoyi.common.enums.BusinessType;
  22 +import com.ruoyi.system.domain.UserTerminalGroup;
  23 +import com.ruoyi.system.service.IUserTerminalGroupService;
  24 +import com.ruoyi.common.utils.poi.ExcelUtil;
  25 +import com.ruoyi.common.core.page.TableDataInfo;
  26 +
  27 +/**
  28 + * 终端分组Controller
  29 + *
  30 + * @author 钟来
  31 + * @date 2022-11-22
  32 + */
  33 +@Api(tags = "终端分组")
  34 +@RestController
  35 +@RequestMapping("/user/UserTerminalGroup")
  36 +public class UserTerminalGroupController extends BaseController
  37 +{
  38 + @Autowired
  39 + private IUserTerminalGroupService userTerminalGroupService;
  40 +
  41 + /**
  42 + * 查询终端分组列表
  43 + */
  44 + @ApiOperation("查询终端分组列表")
  45 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:list')")
  46 + @GetMapping("/list")
  47 + public TableDataInfo list(UserTerminalGroup userTerminalGroup)
  48 + {
  49 + startPage();
  50 + List<UserTerminalGroup> list = userTerminalGroupService.selectUserTerminalGroupList(userTerminalGroup);
  51 + return getDataTable(list);
  52 + }
  53 +
  54 + /**
  55 + * 导出终端分组列表
  56 + */
  57 + @ApiOperation("导出终端分组列表")
  58 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:export')")
  59 + @Log(title = "终端分组", businessType = BusinessType.EXPORT)
  60 + @PostMapping("/export")
  61 + public void export(HttpServletResponse response, UserTerminalGroup userTerminalGroup)
  62 + {
  63 + List<UserTerminalGroup> list = userTerminalGroupService.selectUserTerminalGroupList(userTerminalGroup);
  64 + ExcelUtil<UserTerminalGroup> util = new ExcelUtil<UserTerminalGroup>(UserTerminalGroup.class);
  65 + util.exportExcel(response, list, "终端分组数据");
  66 + }
  67 +
  68 + /**
  69 + * 获取终端分组详细信息
  70 + */
  71 + @ApiOperation("获取终端分组详细信息")
  72 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:query')")
  73 + @GetMapping(value = "/{id}")
  74 + public AjaxResult getInfo(@PathVariable("id") Integer id)
  75 + {
  76 + return AjaxResult.success(userTerminalGroupService.selectUserTerminalGroupById(id));
  77 + }
  78 +
  79 + /**
  80 + * 新增终端分组
  81 + */
  82 + @ApiOperation("新增终端分组")
  83 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:add')")
  84 + @Log(title = "终端分组", businessType = BusinessType.INSERT)
  85 + @PostMapping
  86 + public AjaxResult add(@RequestBody UserTerminalGroup userTerminalGroup)
  87 + {
  88 + return toAjax(userTerminalGroupService.insertUserTerminalGroup(userTerminalGroup));
  89 + }
  90 +
  91 + /**
  92 + * 修改终端分组
  93 + */
  94 + @ApiOperation("修改终端分组")
  95 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:edit')")
  96 + @Log(title = "终端分组", businessType = BusinessType.UPDATE)
  97 + @PutMapping
  98 + public AjaxResult edit(@RequestBody UserTerminalGroup userTerminalGroup)
  99 + {
  100 + return toAjax(userTerminalGroupService.updateUserTerminalGroup(userTerminalGroup));
  101 + }
  102 +
  103 + /**
  104 + * 删除终端分组
  105 + */
  106 + @ApiOperation("删除终端分组")
  107 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:remove')")
  108 + @Log(title = "终端分组", businessType = BusinessType.DELETE)
  109 + @DeleteMapping("/{ids}")
  110 + public AjaxResult remove(@PathVariable Integer[] ids)
  111 + {
  112 + return toAjax(userTerminalGroupService.deleteUserTerminalGroupByIds(ids));
  113 + }
  114 +}
  1 +package com.zhonglai.luhui.admin.controller.user;
  2 +
  3 +import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
  5 +
  6 +import io.swagger.annotations.Api;
  7 +import io.swagger.annotations.ApiOperation;
  8 +import org.springframework.security.access.prepost.PreAuthorize;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.GetMapping;
  11 +import org.springframework.web.bind.annotation.PostMapping;
  12 +import org.springframework.web.bind.annotation.PutMapping;
  13 +import org.springframework.web.bind.annotation.DeleteMapping;
  14 +import org.springframework.web.bind.annotation.PathVariable;
  15 +import org.springframework.web.bind.annotation.RequestBody;
  16 +import org.springframework.web.bind.annotation.RequestMapping;
  17 +import org.springframework.web.bind.annotation.RestController;
  18 +import com.ruoyi.common.annotation.Log;
  19 +import com.ruoyi.common.core.controller.BaseController;
  20 +import com.ruoyi.common.core.domain.AjaxResult;
  21 +import com.ruoyi.common.enums.BusinessType;
  22 +import com.ruoyi.system.domain.UserTerminalGroupRelation;
  23 +import com.ruoyi.system.service.IUserTerminalGroupRelationService;
  24 +import com.ruoyi.common.utils.poi.ExcelUtil;
  25 +import com.ruoyi.common.core.page.TableDataInfo;
  26 +
  27 +/**
  28 + * 终端分组关系Controller
  29 + *
  30 + * @author 钟来
  31 + * @date 2022-11-22
  32 + */
  33 +@Api(tags = "终端分组关系")
  34 +@RestController
  35 +@RequestMapping("/user/UserTerminalGroupRelation")
  36 +public class UserTerminalGroupRelationController extends BaseController
  37 +{
  38 + @Autowired
  39 + private IUserTerminalGroupRelationService userTerminalGroupRelationService;
  40 +
  41 + /**
  42 + * 查询终端分组关系列表
  43 + */
  44 + @ApiOperation("查询终端分组关系列表")
  45 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroupRelation:list')")
  46 + @GetMapping("/list")
  47 + public TableDataInfo list(UserTerminalGroupRelation userTerminalGroupRelation)
  48 + {
  49 + startPage();
  50 + List<UserTerminalGroupRelation> list = userTerminalGroupRelationService.selectUserTerminalGroupRelationList(userTerminalGroupRelation);
  51 + return getDataTable(list);
  52 + }
  53 +
  54 + /**
  55 + * 导出终端分组关系列表
  56 + */
  57 + @ApiOperation("导出终端分组关系列表")
  58 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroupRelation:export')")
  59 + @Log(title = "终端分组关系", businessType = BusinessType.EXPORT)
  60 + @PostMapping("/export")
  61 + public void export(HttpServletResponse response, UserTerminalGroupRelation userTerminalGroupRelation)
  62 + {
  63 + List<UserTerminalGroupRelation> list = userTerminalGroupRelationService.selectUserTerminalGroupRelationList(userTerminalGroupRelation);
  64 + ExcelUtil<UserTerminalGroupRelation> util = new ExcelUtil<UserTerminalGroupRelation>(UserTerminalGroupRelation.class);
  65 + util.exportExcel(response, list, "终端分组关系数据");
  66 + }
  67 +
  68 + /**
  69 + * 获取终端分组关系详细信息
  70 + */
  71 + @ApiOperation("获取终端分组关系详细信息")
  72 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroupRelation:query')")
  73 + @GetMapping(value = "/{id}")
  74 + public AjaxResult getInfo(@PathVariable("id") Integer id)
  75 + {
  76 + return AjaxResult.success(userTerminalGroupRelationService.selectUserTerminalGroupRelationById(id));
  77 + }
  78 +
  79 + /**
  80 + * 新增终端分组关系
  81 + */
  82 + @ApiOperation("新增终端分组关系")
  83 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroupRelation:add')")
  84 + @Log(title = "终端分组关系", businessType = BusinessType.INSERT)
  85 + @PostMapping
  86 + public AjaxResult add(@RequestBody UserTerminalGroupRelation userTerminalGroupRelation)
  87 + {
  88 + return toAjax(userTerminalGroupRelationService.insertUserTerminalGroupRelation(userTerminalGroupRelation));
  89 + }
  90 +
  91 + /**
  92 + * 修改终端分组关系
  93 + */
  94 + @ApiOperation("修改终端分组关系")
  95 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroupRelation:edit')")
  96 + @Log(title = "终端分组关系", businessType = BusinessType.UPDATE)
  97 + @PutMapping
  98 + public AjaxResult edit(@RequestBody UserTerminalGroupRelation userTerminalGroupRelation)
  99 + {
  100 + return toAjax(userTerminalGroupRelationService.updateUserTerminalGroupRelation(userTerminalGroupRelation));
  101 + }
  102 +
  103 + /**
  104 + * 删除终端分组关系
  105 + */
  106 + @ApiOperation("删除终端分组关系")
  107 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroupRelation:remove')")
  108 + @Log(title = "终端分组关系", businessType = BusinessType.DELETE)
  109 + @DeleteMapping("/{ids}")
  110 + public AjaxResult remove(@PathVariable Integer[] ids)
  111 + {
  112 + return toAjax(userTerminalGroupRelationService.deleteUserTerminalGroupRelationByIds(ids));
  113 + }
  114 +}
1 package com.zhonglai.luhui.api; 1 package com.zhonglai.luhui.api;
2 2
  3 +import org.springframework.boot.SpringApplication;
  4 +import org.springframework.boot.autoconfigure.SpringBootApplication;
  5 +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  6 +import org.springframework.context.annotation.ComponentScan;
  7 +
  8 +@ComponentScan(basePackages = {
  9 + "com.ruoyi.common",
  10 + "com.ruoyi.system",
  11 + "com.ruoyi.framework",
  12 + "com.zhonglai.luhui.api.config",
  13 + "com.zhonglai.luhui.api.controller",
  14 +})
  15 +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
3 public class LhApiApplication { 16 public class LhApiApplication {
  17 + public static void main(String[] args) {
  18 + SpringApplication.run(LhApiApplication.class,args);
  19 + System.out.println("启动成功");
  20 + }
4 } 21 }
  1 +package com.zhonglai.luhui.api.config;
  2 +
  3 +import com.ruoyi.common.config.RuoYiConfig;
  4 +import io.swagger.annotations.ApiOperation;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.context.annotation.Bean;
  7 +import org.springframework.context.annotation.Configuration;
  8 +import springfox.documentation.builders.ApiInfoBuilder;
  9 +import springfox.documentation.builders.PathSelectors;
  10 +import springfox.documentation.builders.RequestHandlerSelectors;
  11 +import springfox.documentation.service.ApiInfo;
  12 +import springfox.documentation.service.Contact;
  13 +import springfox.documentation.spi.DocumentationType;
  14 +import springfox.documentation.spring.web.plugins.Docket;
  15 +import springfox.documentation.swagger2.annotations.EnableSwagger2;
  16 +
  17 +
  18 +@Configuration
  19 +@EnableSwagger2
  20 +public class SwaggerConfig {
  21 + /** 系统基础配置 */
  22 + @Autowired
  23 + private RuoYiConfig ruoyiConfig;
  24 + @Bean
  25 + public Docket createRestApi() {
  26 + return new Docket(DocumentationType.SWAGGER_2)
  27 + .apiInfo(apiInfo())
  28 + .select()
  29 + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
  30 + .paths(PathSelectors.any())
  31 + .build();
  32 + }
  33 +
  34 + /**
  35 + * 添加摘要信息
  36 + */
  37 + private ApiInfo apiInfo()
  38 + {
  39 + // 用ApiInfoBuilder进行定制
  40 + return new ApiInfoBuilder()
  41 + // 设置标题
  42 + .title("标题:后台管理员端")
  43 + // 描述
  44 + .description("描述:用于通过mqtt发送指令控制PC端操作")
  45 + // 作者信息
  46 + .contact(new Contact(ruoyiConfig.getName(), null, null))
  47 + // 版本
  48 + .version("版本号:" + ruoyiConfig.getVersion())
  49 + .build();
  50 + }
  51 +
  52 +}
  1 +package com.zhonglai.luhui.api.controller;
  2 +
  3 +import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
  5 +
  6 +import io.swagger.annotations.Api;
  7 +import io.swagger.annotations.ApiOperation;
  8 +import org.springframework.security.access.prepost.PreAuthorize;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.GetMapping;
  11 +import org.springframework.web.bind.annotation.PostMapping;
  12 +import org.springframework.web.bind.annotation.PutMapping;
  13 +import org.springframework.web.bind.annotation.DeleteMapping;
  14 +import org.springframework.web.bind.annotation.PathVariable;
  15 +import org.springframework.web.bind.annotation.RequestBody;
  16 +import org.springframework.web.bind.annotation.RequestMapping;
  17 +import org.springframework.web.bind.annotation.RestController;
  18 +import com.ruoyi.common.annotation.Log;
  19 +import com.ruoyi.common.core.controller.BaseController;
  20 +import com.ruoyi.common.core.domain.AjaxResult;
  21 +import com.ruoyi.common.enums.BusinessType;
  22 +import com.ruoyi.system.domain.UserTerminalGroup;
  23 +import com.ruoyi.system.service.IUserTerminalGroupService;
  24 +import com.ruoyi.common.utils.poi.ExcelUtil;
  25 +import com.ruoyi.common.core.page.TableDataInfo;
  26 +
  27 +/**
  28 + * 终端分组Controller
  29 + *
  30 + * @author 钟来
  31 + * @date 2022-11-22
  32 + */
  33 +@Api(tags = "终端分组")
  34 +@RestController
  35 +@RequestMapping("/user/UserTerminalGroup")
  36 +public class UserTerminalGroupController extends BaseController
  37 +{
  38 + @Autowired
  39 + private IUserTerminalGroupService userTerminalGroupService;
  40 +
  41 + /**
  42 + * 查询终端分组列表
  43 + */
  44 + @ApiOperation("查询终端分组列表")
  45 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:list')")
  46 + @GetMapping("/list")
  47 + public TableDataInfo list(UserTerminalGroup userTerminalGroup)
  48 + {
  49 + userTerminalGroup.setUser_info_id(getUserId().intValue());
  50 + startPage();
  51 + List<UserTerminalGroup> list = userTerminalGroupService.selectUserTerminalGroupList(userTerminalGroup);
  52 + return getDataTable(list);
  53 + }
  54 +
  55 + /**
  56 + * 导出终端分组列表
  57 + */
  58 + @ApiOperation("导出终端分组列表")
  59 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:export')")
  60 + @Log(title = "终端分组", businessType = BusinessType.EXPORT)
  61 + @PostMapping("/export")
  62 + public void export(HttpServletResponse response, UserTerminalGroup userTerminalGroup)
  63 + {
  64 + userTerminalGroup.setUser_info_id(getUserId().intValue());
  65 + List<UserTerminalGroup> list = userTerminalGroupService.selectUserTerminalGroupList(userTerminalGroup);
  66 + ExcelUtil<UserTerminalGroup> util = new ExcelUtil<UserTerminalGroup>(UserTerminalGroup.class);
  67 + util.exportExcel(response, list, "终端分组数据");
  68 + }
  69 +
  70 + /**
  71 + * 获取终端分组详细信息
  72 + */
  73 + @ApiOperation("获取终端分组详细信息")
  74 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:query')")
  75 + @GetMapping(value = "/{id}")
  76 + public AjaxResult getInfo(@PathVariable("id") Integer id)
  77 + {
  78 + return AjaxResult.success(userTerminalGroupService.selectUserTerminalGroupById(id));
  79 + }
  80 +
  81 + /**
  82 + * 新增终端分组
  83 + */
  84 + @ApiOperation("新增终端分组")
  85 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:add')")
  86 + @Log(title = "终端分组", businessType = BusinessType.INSERT)
  87 + @PostMapping
  88 + public AjaxResult add(@RequestBody UserTerminalGroup userTerminalGroup)
  89 + {
  90 + return toAjax(userTerminalGroupService.insertUserTerminalGroup(userTerminalGroup));
  91 + }
  92 +
  93 + /**
  94 + * 修改终端分组
  95 + */
  96 + @ApiOperation("修改终端分组")
  97 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:edit')")
  98 + @Log(title = "终端分组", businessType = BusinessType.UPDATE)
  99 + @PutMapping
  100 + public AjaxResult edit(@RequestBody UserTerminalGroup userTerminalGroup)
  101 + {
  102 + return toAjax(userTerminalGroupService.updateUserTerminalGroup(userTerminalGroup));
  103 + }
  104 +
  105 + /**
  106 + * 删除终端分组
  107 + */
  108 + @ApiOperation("删除终端分组")
  109 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:remove')")
  110 + @Log(title = "终端分组", businessType = BusinessType.DELETE)
  111 + @DeleteMapping("/{ids}")
  112 + public AjaxResult remove(@PathVariable Integer[] ids)
  113 + {
  114 + return toAjax(userTerminalGroupService.deleteUserTerminalGroupByIds(ids));
  115 + }
  116 +}
  1 +package com.zhonglai.luhui.api.controller;
  2 +
  3 +import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
  5 +
  6 +import io.swagger.annotations.Api;
  7 +import io.swagger.annotations.ApiOperation;
  8 +import org.springframework.security.access.prepost.PreAuthorize;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.GetMapping;
  11 +import org.springframework.web.bind.annotation.PostMapping;
  12 +import org.springframework.web.bind.annotation.PutMapping;
  13 +import org.springframework.web.bind.annotation.DeleteMapping;
  14 +import org.springframework.web.bind.annotation.PathVariable;
  15 +import org.springframework.web.bind.annotation.RequestBody;
  16 +import org.springframework.web.bind.annotation.RequestMapping;
  17 +import org.springframework.web.bind.annotation.RestController;
  18 +import com.ruoyi.common.annotation.Log;
  19 +import com.ruoyi.common.core.controller.BaseController;
  20 +import com.ruoyi.common.core.domain.AjaxResult;
  21 +import com.ruoyi.common.enums.BusinessType;
  22 +import com.ruoyi.system.domain.UserTerminalGroupRelation;
  23 +import com.ruoyi.system.service.IUserTerminalGroupRelationService;
  24 +import com.ruoyi.common.utils.poi.ExcelUtil;
  25 +import com.ruoyi.common.core.page.TableDataInfo;
  26 +
  27 +/**
  28 + * 终端分组关系Controller
  29 + *
  30 + * @author 钟来
  31 + * @date 2022-11-22
  32 + */
  33 +@Api(tags = "终端分组关系")
  34 +@RestController
  35 +@RequestMapping("/user/UserTerminalGroupRelation")
  36 +public class UserTerminalGroupRelationController extends BaseController
  37 +{
  38 + @Autowired
  39 + private IUserTerminalGroupRelationService userTerminalGroupRelationService;
  40 +
  41 + /**
  42 + * 查询终端分组关系列表
  43 + */
  44 + @ApiOperation("查询终端分组关系列表")
  45 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroupRelation:list')")
  46 + @GetMapping("/list")
  47 + public TableDataInfo list(UserTerminalGroupRelation userTerminalGroupRelation)
  48 + {
  49 + userTerminalGroupRelation.setUser_info_id(getUserId().intValue());
  50 + startPage();
  51 + List<UserTerminalGroupRelation> list = userTerminalGroupRelationService.selectUserTerminalGroupRelationList(userTerminalGroupRelation);
  52 + return getDataTable(list);
  53 + }
  54 +
  55 + /**
  56 + * 导出终端分组关系列表
  57 + */
  58 + @ApiOperation("导出终端分组关系列表")
  59 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroupRelation:export')")
  60 + @Log(title = "终端分组关系", businessType = BusinessType.EXPORT)
  61 + @PostMapping("/export")
  62 + public void export(HttpServletResponse response, UserTerminalGroupRelation userTerminalGroupRelation)
  63 + {
  64 + List<UserTerminalGroupRelation> list = userTerminalGroupRelationService.selectUserTerminalGroupRelationList(userTerminalGroupRelation);
  65 + ExcelUtil<UserTerminalGroupRelation> util = new ExcelUtil<UserTerminalGroupRelation>(UserTerminalGroupRelation.class);
  66 + util.exportExcel(response, list, "终端分组关系数据");
  67 + }
  68 +
  69 + /**
  70 + * 获取终端分组关系详细信息
  71 + */
  72 + @ApiOperation("获取终端分组关系详细信息")
  73 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroupRelation:query')")
  74 + @GetMapping(value = "/{id}")
  75 + public AjaxResult getInfo(@PathVariable("id") Integer id)
  76 + {
  77 + return AjaxResult.success(userTerminalGroupRelationService.selectUserTerminalGroupRelationById(id));
  78 + }
  79 +
  80 + /**
  81 + * 新增终端分组关系
  82 + */
  83 + @ApiOperation("新增终端分组关系")
  84 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroupRelation:add')")
  85 + @Log(title = "终端分组关系", businessType = BusinessType.INSERT)
  86 + @PostMapping
  87 + public AjaxResult add(@RequestBody UserTerminalGroupRelation userTerminalGroupRelation)
  88 + {
  89 + return toAjax(userTerminalGroupRelationService.insertUserTerminalGroupRelation(userTerminalGroupRelation));
  90 + }
  91 +
  92 + /**
  93 + * 修改终端分组关系
  94 + */
  95 + @ApiOperation("修改终端分组关系")
  96 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroupRelation:edit')")
  97 + @Log(title = "终端分组关系", businessType = BusinessType.UPDATE)
  98 + @PutMapping
  99 + public AjaxResult edit(@RequestBody UserTerminalGroupRelation userTerminalGroupRelation)
  100 + {
  101 + return toAjax(userTerminalGroupRelationService.updateUserTerminalGroupRelation(userTerminalGroupRelation));
  102 + }
  103 +
  104 + /**
  105 + * 删除终端分组关系
  106 + */
  107 + @ApiOperation("删除终端分组关系")
  108 + @PreAuthorize("@ss.hasPermi('user:UserTerminalGroupRelation:remove')")
  109 + @Log(title = "终端分组关系", businessType = BusinessType.DELETE)
  110 + @DeleteMapping("/{ids}")
  111 + public AjaxResult remove(@PathVariable Integer[] ids)
  112 + {
  113 + return toAjax(userTerminalGroupRelationService.deleteUserTerminalGroupRelationByIds(ids));
  114 + }
  115 +}
  1 +restart.include.json=/com.alibaba.fastjson.*.jar
  1 +# 数据源配置
  2 +spring:
  3 + datasource:
  4 + type: com.alibaba.druid.pool.DruidDataSource
  5 + driverClassName: com.mysql.cj.jdbc.Driver
  6 + druid:
  7 + # 主库数据源
  8 + master:
  9 + url: jdbc:mysql://rm-wz9740un21f09iokuao.mysql.rds.aliyuncs.com:3306/mqtt_broker?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
  10 + username: luhui
  11 + password: Luhui586
  12 + # 从库数据源
  13 + slave:
  14 + # 从数据源开关/默认关闭
  15 + enabled: false
  16 + url:
  17 + username:
  18 + password:
  19 + # 初始连接数
  20 + initialSize: 5
  21 + # 最小连接池数量
  22 + minIdle: 10
  23 + # 最大连接池数量
  24 + maxActive: 20
  25 + # 配置获取连接等待超时的时间
  26 + maxWait: 60000
  27 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
  28 + timeBetweenEvictionRunsMillis: 60000
  29 + # 配置一个连接在池中最小生存的时间,单位是毫秒
  30 + minEvictableIdleTimeMillis: 300000
  31 + # 配置一个连接在池中最大生存的时间,单位是毫秒
  32 + maxEvictableIdleTimeMillis: 900000
  33 + # 配置检测连接是否有效
  34 + validationQuery: SELECT 1 FROM DUAL
  35 + testWhileIdle: true
  36 + testOnBorrow: false
  37 + testOnReturn: false
  38 + webStatFilter:
  39 + enabled: true
  40 + statViewServlet:
  41 + enabled: true
  42 + # 设置白名单,不填则允许所有访问
  43 + allow:
  44 + url-pattern: /druid/*
  45 + # 控制台管理用户名和密码
  46 + login-username: ruoyi
  47 + login-password: 123456
  48 + filter:
  49 + stat:
  50 + enabled: true
  51 + # 慢SQL记录
  52 + log-slow-sql: true
  53 + slow-sql-millis: 1000
  54 + merge-sql: true
  55 + wall:
  56 + config:
  57 + multi-statement-allow: true
1 -# 项目相关配置 jhlt: # 名称 name: zhonglai # 版本 version: 3.8.2 # 版权年份 copyrightYear: 2022 # 实例演示开关 demoEnabled: true # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) profile: D:/ruoyi/uploadPath # 获取ip地址开关 addressEnabled: false # 验证码类型 math 数组计算 char 字符验证 captchaType: math # 开发环境配置 server: # 服务器的HTTP端口,默认为8080 port: 8080 servlet: # 应用的访问路径 context-path: / tomcat: # tomcat的URI编码 uri-encoding: UTF-8 # 连接数满后的排队数,默认为100 accept-count: 1000 threads: # tomcat最大线程数,默认为200 max: 800 # Tomcat启动初始化的线程数,默认值10 min-spare: 100 # 日志配置 logging: level: com.ruoyi: debug org.springframework: warn # Spring配置 spring: # 资源信息 messages: # 国际化资源文件路径 basename: i18n/messages profiles: active: druid # 文件上传 servlet: multipart: # 单个文件大小 max-file-size: 10MB # 设置总上传的文件大小 max-request-size: 20MB # 服务模块 devtools: restart: # 热部署开关 enabled: true # redis 配置 redis: # 地址 host: 47.112.163.61 # 端口,默认为6379 port: 9527 # 数据库索引 database: 1 # 密码 password: Luhui586 # 连接超时时间 timeout: 10s lettuce: pool: # 连接池中的最小空闲连接 min-idle: 0 # 连接池中的最大空闲连接 max-idle: 8 # 连接池的最大数据库连接数 max-active: 8 # #连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1ms # token配置 token: # 令牌自定义标识 header: Authorization # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz # 令牌有效期(默认30分钟) expireTime: 1440 # MyBatis配置 mybatis: # 搜索指定包别名 typeAliasesPackage: com.ruoyi.**.domain # 配置mapper的扫描,找到所有的mapper.xml映射文件 mapperLocations: classpath*:mapper/**/*Mapper.xml # 加载全局的配置文件 configLocation: classpath:mybatis/mybatis-config.xml # PageHelper分页插件 pagehelper: helperDialect: mysql supportMethodsArguments: true params: count=countSql # Swagger配置 swagger: # 是否开启swagger enabled: true # 请求前缀 pathMapping: /dev-api # 防止XSS攻击 xss: # 过滤开关 enabled: true # 排除链接(多个用逗号分隔) excludes: /system/notice # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* mqtt: client: device_life: 180 sys: ## // 对于登录login 注册register 验证码captchaImage 允许匿名访问 antMatchers: /login,/register,/captchaImage,/getCacheObject,/v2/api-docs,/tool/gen/generatorCodeFromDb  
  1 +# 项目相关配置 jhlt: # 名称 name: zhonglai # 版本 version: 3.8.2 # 版权年份 copyrightYear: 2022 # 实例演示开关 demoEnabled: true # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) profile: D:/ruoyi/uploadPath # 获取ip地址开关 addressEnabled: false # 验证码类型 math 数组计算 char 字符验证 captchaType: math # 开发环境配置 server: # 服务器的HTTP端口,默认为8080 port: 8080 servlet: # 应用的访问路径 context-path: / tomcat: # tomcat的URI编码 uri-encoding: UTF-8 # 连接数满后的排队数,默认为100 accept-count: 1000 threads: # tomcat最大线程数,默认为200 max: 800 # Tomcat启动初始化的线程数,默认值10 min-spare: 100 # 日志配置 logging: level: com.ruoyi: debug org.springframework: warn # Spring配置 spring: # 资源信息 messages: # 国际化资源文件路径 basename: i18n/messages profiles: active: druid # 文件上传 servlet: multipart: # 单个文件大小 max-file-size: 10MB # 设置总上传的文件大小 max-request-size: 20MB # 服务模块 devtools: restart: # 热部署开关 enabled: true # redis 配置 redis: # 地址 host: 47.112.163.61 # 端口,默认为6379 port: 9527 # 数据库索引 database: 1 # 密码 password: Luhui586 # 连接超时时间 timeout: 10s lettuce: pool: # 连接池中的最小空闲连接 min-idle: 0 # 连接池中的最大空闲连接 max-idle: 8 # 连接池的最大数据库连接数 max-active: 8 # #连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1ms # token配置 token: # 令牌自定义标识 header: Authorization # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz # 令牌有效期(默认30分钟) expireTime: 1440 rediskey: lh-api # MyBatis配置 mybatis: # 搜索指定包别名 typeAliasesPackage: com.ruoyi.**.domain # 配置mapper的扫描,找到所有的mapper.xml映射文件 mapperLocations: classpath*:mapper/**/*Mapper.xml # 加载全局的配置文件 configLocation: classpath:mybatis/mybatis-config.xml # PageHelper分页插件 pagehelper: helperDialect: mysql supportMethodsArguments: true params: count=countSql # Swagger配置 swagger: # 是否开启swagger enabled: true # 请求前缀 pathMapping: /dev-api # 防止XSS攻击 xss: # 过滤开关 enabled: true # 排除链接(多个用逗号分隔) excludes: /system/notice # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* mqtt: client: device_life: 180 sys: ## // 对于登录login 注册register 验证码captchaImage 允许匿名访问 antMatchers: /login,/register,/captchaImage,/getCacheObject,/v2/api-docs,/tool/gen/generatorCodeFromDb
  1 +#错误消息
  2 +not.null=* 必须填写
  3 +user.jcaptcha.error=验证码错误
  4 +user.jcaptcha.expire=验证码已失效
  5 +user.not.exists=用户不存在/密码错误
  6 +user.password.not.match=用户不存在/密码错误
  7 +user.password.retry.limit.count=密码输入错误{0}次
  8 +user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定10分钟
  9 +user.password.delete=对不起,您的账号已被删除
  10 +user.blocked=用户已封禁,请联系管理员
  11 +role.blocked=角色已封禁,请联系管理员
  12 +user.logout.success=退出成功
  13 +
  14 +length.not.valid=长度必须在{min}到{max}个字符之间
  15 +
  16 +user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
  17 +user.password.not.valid=* 5-50个字符
  18 +
  19 +user.email.not.valid=邮箱格式错误
  20 +user.mobile.phone.number.not.valid=手机号格式错误
  21 +user.login.success=登录成功
  22 +user.register.success=注册成功
  23 +user.notfound=请重新登录
  24 +user.forcelogout=管理员强制退出,请重新登录
  25 +user.unknown.error=未知错误,请重新登录
  26 +
  27 +##文件上传消息
  28 +upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
  29 +upload.filename.exceed.length=上传的文件名最长{0}个字符
  30 +
  31 +##权限
  32 +no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
  33 +no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
  34 +no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
  35 +no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
  36 +no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
  37 +no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE configuration
  3 +PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
  4 +"http://mybatis.org/dtd/mybatis-3-config.dtd">
  5 +<configuration>
  6 + <!-- 全局参数 -->
  7 + <settings>
  8 + <!-- 使全局的映射器启用或禁用缓存 -->
  9 + <setting name="cacheEnabled" value="true" />
  10 + <!-- 允许JDBC 支持自动生成主键 -->
  11 + <setting name="useGeneratedKeys" value="true" />
  12 + <!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
  13 + <setting name="defaultExecutorType" value="SIMPLE" />
  14 + <!-- 指定 MyBatis 所用日志的具体实现 -->
  15 + <setting name="logImpl" value="SLF4J" />
  16 + <!-- 使用驼峰命名法转换字段 -->
  17 + <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
  18 + </settings>
  19 +
  20 +</configuration>
@@ -10,6 +10,7 @@ import com.ruoyi.system.domain.IotDevice; @@ -10,6 +10,7 @@ import com.ruoyi.system.domain.IotDevice;
10 import okhttp3.Response; 10 import okhttp3.Response;
11 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.stereotype.Service; 12 import org.springframework.stereotype.Service;
  13 +import org.springframework.web.bind.annotation.RequestBody;
13 14
14 import java.io.IOException; 15 import java.io.IOException;
15 import java.util.HashMap; 16 import java.util.HashMap;
@@ -20,20 +21,15 @@ public class DeviceControlService { @@ -20,20 +21,15 @@ public class DeviceControlService {
20 @Autowired 21 @Autowired
21 private RedisCache redisCache; 22 private RedisCache redisCache;
22 private String redisHostPath = "luhui:mqttservice:device:device:"; 23 private String redisHostPath = "luhui:mqttservice:device:device:";
  24 +
  25 + @Autowired
  26 + private DeviceDBOperationService deviceDBOperationService;
  27 +
23 private IotDevice getRedisIotDevice(String imei) 28 private IotDevice getRedisIotDevice(String imei)
24 { 29 {
25 return (IotDevice)redisCache.getCacheObject(redisHostPath+imei); 30 return (IotDevice)redisCache.getCacheObject(redisHostPath+imei);
26 } 31 }
27 32
28 - private String getServiceAdrres(String imei) {  
29 - IotDevice iotDevice = getRedisIotDevice(imei);  
30 - if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))  
31 - {  
32 - return null;  
33 - }  
34 - return "http://"+iotDevice.getListen_service_ip()+"device/control/"+imei;  
35 - }  
36 -  
37 /** 33 /**
38 * 固件版本更新 34 * 固件版本更新
39 * @param imei 主机imei 35 * @param imei 主机imei
@@ -43,11 +39,12 @@ public class DeviceControlService { @@ -43,11 +39,12 @@ public class DeviceControlService {
43 */ 39 */
44 public Message firmwareUp(String imei,String firmwareVersion,Integer code) 40 public Message firmwareUp(String imei,String firmwareVersion,Integer code)
45 { 41 {
46 - String url = getServiceAdrres(imei);  
47 - if(null == url) 42 + IotDevice iotDevice = getRedisIotDevice(imei);
  43 + if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
48 { 44 {
49 - return null; 45 + return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
50 } 46 }
  47 + String url = "http://"+iotDevice.getListen_service_ip()+"device/control/"+imei;
51 Map<String,Object> valueMap = new HashMap<>(); 48 Map<String,Object> valueMap = new HashMap<>();
52 valueMap.put("firmwareVersion",firmwareVersion); 49 valueMap.put("firmwareVersion",firmwareVersion);
53 valueMap.put("code",code); 50 valueMap.put("code",code);
@@ -62,17 +59,175 @@ public class DeviceControlService { @@ -62,17 +59,175 @@ public class DeviceControlService {
62 */ 59 */
63 public Message restart(String imei ,Integer restart) 60 public Message restart(String imei ,Integer restart)
64 { 61 {
65 - String url = getServiceAdrres(imei);  
66 - if(null == url) 62 + IotDevice iotDevice = getRedisIotDevice(imei);
  63 + if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
67 { 64 {
68 return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线"); 65 return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
69 } 66 }
  67 + String url = "http://"+iotDevice.getListen_service_ip()+"device/control/"+imei;
70 Map<String,Object> map = new HashMap<>(); 68 Map<String,Object> map = new HashMap<>();
71 Map<String,Object> valueMap = new HashMap<>(); 69 Map<String,Object> valueMap = new HashMap<>();
72 valueMap.put("restart",restart); 70 valueMap.put("restart",restart);
73 return post(url, jsonObject -> jsonObject.put("0",valueMap)); 71 return post(url, jsonObject -> jsonObject.put("0",valueMap));
74 } 72 }
75 73
  74 + /**
  75 + * 获取指定设备版本信息
  76 + * @param imei 主机imei
  77 + * @return
  78 + * @throws IOException
  79 + */
  80 + public Message getFirmwareVersion(String imei) throws IOException {
  81 + IotDevice iotDevice = getRedisIotDevice(imei);
  82 + if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
  83 + {
  84 + return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
  85 + }
  86 + String url = "http://"+iotDevice.getListen_service_ip()+"device/getFirmwareVersion/"+iotDevice.getMqtt_username();
  87 + return postFrom(url, formBody -> {
  88 + });
  89 + }
  90 +
  91 + /**
  92 + * 强行断开链接
  93 + * @param imei 主机imei
  94 + * @return
  95 + * @throws IOException
  96 + */
  97 + public Message closeSession(String imei) {
  98 + IotDevice iotDevice = getRedisIotDevice(imei);
  99 + if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
  100 + {
  101 + return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
  102 + }
  103 + String url = "http://"+iotDevice.getListen_service_ip()+"device/closeSession/"+imei;
  104 + return postFrom(url, formBody -> {
  105 + });
  106 + }
  107 +
  108 + /**
  109 + * 删除主机
  110 + * @param imei 主机imei
  111 + * @return
  112 + */
  113 + public Message delIotDevice(String imei) {
  114 + IotDevice iotDevice = getRedisIotDevice(imei);
  115 + if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
  116 + {
  117 + return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
  118 + }
  119 + deviceDBOperationService.deleteIotDeviceByClient_id(imei);
  120 + deviceDBOperationService.deleteIotTerminalByDeviceId(imei);
  121 + if(StringUtils.isEmpty(iotDevice.getListen_service_ip()))
  122 + {
  123 + return new Message(MessageCode.DEFAULT_SUCCESS_CODE,"删除成功");
  124 + }
  125 + String url = "http://"+iotDevice.getListen_service_ip()+"device/delIotDevice/"+imei;
  126 +
  127 + return postFrom(url, formBody -> {
  128 + });
  129 + }
  130 +
  131 + /**
  132 + * 删除终端
  133 + * @param imei 主机imei
  134 + * @param number 终端编号
  135 + * @return
  136 + */
  137 + public Message delIotTerminal(String imei,String number) {
  138 + IotDevice iotDevice = getRedisIotDevice(imei);
  139 + if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
  140 + {
  141 + return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
  142 + }
  143 + deviceDBOperationService.deleteIotTerminalById(imei+"_"+number);
  144 + if(StringUtils.isEmpty(iotDevice.getListen_service_ip()))
  145 + {
  146 + return new Message(MessageCode.DEFAULT_SUCCESS_CODE,"删除成功");
  147 + }
  148 + String url = "http://"+iotDevice.getListen_service_ip()+"device/delIotTerminal/"+imei+"/"+number;
  149 +
  150 + return postFrom(url, formBody -> {
  151 + });
  152 + }
  153 +
  154 + /**
  155 + * 读取属性
  156 + * @param imei 主机imei
  157 + * @param sensor_number 传感器编号(0,1_1,10_1)
  158 + * @param attributes 属性集合(id1,id2,id3)
  159 + * @return
  160 + * @throws IOException
  161 + */
  162 + public Message readAttribute(String imei,String sensor_number,String attributes) throws IOException {
  163 + IotDevice iotDevice = getRedisIotDevice(imei);
  164 + if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
  165 + {
  166 + return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
  167 + }
  168 + String url = "http://"+iotDevice.getListen_service_ip()+"device/read/"+imei;
  169 + return post(url, jsonObject -> jsonObject.put(sensor_number,attributes));
  170 + }
  171 +
  172 + /**
  173 + * 设置主机自定义参数
  174 + * @param imei 主机imei
  175 + * @param summary 自定义数据json字符串
  176 + * @return
  177 + * @throws IOException
  178 + */
  179 + public Message upSummary(String imei,String summary) {
  180 + IotDevice iotDevice = getRedisIotDevice(imei);
  181 + if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
  182 + {
  183 + return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
  184 + }
  185 + String url = "http://"+iotDevice.getListen_service_ip()+"device/control/"+imei;
  186 + Map<String,Object> valueMap = new HashMap<>();
  187 + valueMap.put("summary",JSONObject.parseObject(summary));
  188 + return post(url, jsonObject -> jsonObject.put("0",valueMap));
  189 + }
  190 +
  191 + /**
  192 + * 修改指定终端属性
  193 + * @param imei 主机imei
  194 + * @param number 终端编号(如:1_1)
  195 + * @param config 配置参数json字符串
  196 + * @return
  197 + * @throws IOException
  198 + */
  199 + public Message upTerminalConfig(String imei,String number,@RequestBody Map<String,Object> config) throws IOException {
  200 + IotDevice iotDevice = getRedisIotDevice(imei);
  201 + if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
  202 + {
  203 + return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
  204 + }
  205 + String url = "http://"+iotDevice.getListen_service_ip()+"device/control/"+imei;
  206 + return post(url, jsonObject -> jsonObject.put(number,config));
  207 + }
  208 +
  209 + /**
  210 + * 批量修改终端属性
  211 + * @param imei 主机imei
  212 + * @param map 批量数据json字符串
  213 + * @return
  214 + * @throws IOException
  215 + */
  216 + public Message batchUpTerminalConfig(String imei,@RequestBody Map<String,Object> map) {
  217 + IotDevice iotDevice = getRedisIotDevice(imei);
  218 + if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
  219 + {
  220 + return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
  221 + }
  222 + String url = "http://"+iotDevice.getListen_service_ip()+"device/control/"+imei;
  223 + return post(url, jsonObject -> {
  224 + for (String key:map.keySet())
  225 + {
  226 + jsonObject.put(key, map.get(key));
  227 + }
  228 + });
  229 + }
  230 +
76 231
77 private Message post(String url, HttpUtils.JsonBody jsonBody) 232 private Message post(String url, HttpUtils.JsonBody jsonBody)
78 { 233 {
@@ -89,4 +244,21 @@ public class DeviceControlService { @@ -89,4 +244,21 @@ public class DeviceControlService {
89 } 244 }
90 return new Message(MessageCode.DEFAULT_FAIL_CODE,"指令执行失败请稍后重试"); 245 return new Message(MessageCode.DEFAULT_FAIL_CODE,"指令执行失败请稍后重试");
91 } 246 }
  247 + private Message postFrom(String url,HttpUtils.FromBody fromBody )
  248 + {
  249 + Response response1 = null;
  250 + try {
  251 + response1 = HttpUtils.postFromBody(url, builder -> {
  252 + }, fromBody);
  253 + if(null != response1.body() && StringUtils.isNotEmpty(response1.body().string()))
  254 + {
  255 + Message message = com.alibaba.fastjson.JSONObject.parseObject(response1.body().string(),Message.class);
  256 + return message;
  257 + }
  258 + } catch (IOException e) {
  259 + return new Message(MessageCode.DEFAULT_FAIL_CODE,"指令转发失败请联系管理员");
  260 + }
  261 + return new Message(MessageCode.DEFAULT_FAIL_CODE,"指令执行失败请稍后重试");
  262 + }
  263 +
92 } 264 }
  1 +package com.zhonglai.luhui.central.control;
  2 +
  3 +public interface DeviceDBOperationService {
  4 + int deleteIotDeviceByClient_id(String imei);
  5 + int deleteIotTerminalByDeviceId(String imei);
  6 + int deleteIotTerminalById(String id);
  7 +}
  1 +package com.ruoyi.system.domain;
  2 +
  3 +import com.ruoyi.system.domain.tool.BaseEntity;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import org.apache.commons.lang3.builder.ToStringBuilder;
  7 +import org.apache.commons.lang3.builder.ToStringStyle;
  8 +
  9 +/**
  10 + * 终端分组对象 user_terminal_group
  11 + *
  12 + * @author 钟来
  13 + * @date 2022-11-22
  14 + */
  15 +@ApiModel("终端分组")
  16 +public class UserTerminalGroup extends BaseEntity
  17 +{
  18 + private static final long serialVersionUID = 1L;
  19 +
  20 + /** 创建时间 */
  21 + @ApiModelProperty("创建时间")
  22 + private Integer create_time;
  23 +
  24 + /** 主键 */
  25 + @ApiModelProperty("主键")
  26 + private Integer id;
  27 +
  28 + /** 名称 */
  29 + @ApiModelProperty("名称")
  30 + private String name;
  31 +
  32 + /** 关联用户id */
  33 + @ApiModelProperty("关联用户id")
  34 + private Integer user_info_id;
  35 +
  36 + public void setCreate_time(Integer create_time)
  37 + {
  38 + this.create_time = create_time;
  39 + }
  40 +
  41 + public Integer getCreate_time()
  42 + {
  43 + return create_time;
  44 + }
  45 + public void setId(Integer id)
  46 + {
  47 + this.id = id;
  48 + }
  49 +
  50 + public Integer getId()
  51 + {
  52 + return id;
  53 + }
  54 + public void setName(String name)
  55 + {
  56 + this.name = name;
  57 + }
  58 +
  59 + public String getName()
  60 + {
  61 + return name;
  62 + }
  63 + public void setUser_info_id(Integer user_info_id)
  64 + {
  65 + this.user_info_id = user_info_id;
  66 + }
  67 +
  68 + public Integer getUser_info_id()
  69 + {
  70 + return user_info_id;
  71 + }
  72 +
  73 + @Override
  74 + public String toString() {
  75 + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
  76 + .append("create_time", getCreate_time())
  77 + .append("id", getId())
  78 + .append("name", getName())
  79 + .append("user_info_id", getUser_info_id())
  80 + .toString();
  81 + }
  82 +}
  1 +package com.ruoyi.system.domain;
  2 +
  3 +import com.ruoyi.system.domain.tool.BaseEntity;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import org.apache.commons.lang3.builder.ToStringBuilder;
  7 +import org.apache.commons.lang3.builder.ToStringStyle;
  8 +
  9 +/**
  10 + * 终端分组关系对象 user_terminal_group_relation
  11 + *
  12 + * @author 钟来
  13 + * @date 2022-11-22
  14 + */
  15 +@ApiModel("终端分组关系")
  16 +public class UserTerminalGroupRelation extends BaseEntity
  17 +{
  18 + private static final long serialVersionUID = 1L;
  19 +
  20 + /** 创建时间 */
  21 + @ApiModelProperty("创建时间")
  22 + private Integer create_time;
  23 +
  24 + /** 主键 */
  25 + @ApiModelProperty("主键")
  26 + private Integer id;
  27 +
  28 + /** 分组id */
  29 + @ApiModelProperty("分组id")
  30 + private Integer iot_terminal_group_id;
  31 +
  32 + /** 分组名称 */
  33 + @ApiModelProperty("分组名称")
  34 + private String iot_terminal_group_name;
  35 +
  36 + /** 终端id */
  37 + @ApiModelProperty("终端id")
  38 + private String iot_terminal_id;
  39 +
  40 + /** 关联用户 */
  41 + @ApiModelProperty("关联用户")
  42 + private Integer user_info_id;
  43 +
  44 + public void setCreate_time(Integer create_time)
  45 + {
  46 + this.create_time = create_time;
  47 + }
  48 +
  49 + public Integer getCreate_time()
  50 + {
  51 + return create_time;
  52 + }
  53 + public void setId(Integer id)
  54 + {
  55 + this.id = id;
  56 + }
  57 +
  58 + public Integer getId()
  59 + {
  60 + return id;
  61 + }
  62 + public void setIot_terminal_group_id(Integer iot_terminal_group_id)
  63 + {
  64 + this.iot_terminal_group_id = iot_terminal_group_id;
  65 + }
  66 +
  67 + public Integer getIot_terminal_group_id()
  68 + {
  69 + return iot_terminal_group_id;
  70 + }
  71 + public void setIot_terminal_group_name(String iot_terminal_group_name)
  72 + {
  73 + this.iot_terminal_group_name = iot_terminal_group_name;
  74 + }
  75 +
  76 + public String getIot_terminal_group_name()
  77 + {
  78 + return iot_terminal_group_name;
  79 + }
  80 + public void setIot_terminal_id(String iot_terminal_id)
  81 + {
  82 + this.iot_terminal_id = iot_terminal_id;
  83 + }
  84 +
  85 + public String getIot_terminal_id()
  86 + {
  87 + return iot_terminal_id;
  88 + }
  89 + public void setUser_info_id(Integer user_info_id)
  90 + {
  91 + this.user_info_id = user_info_id;
  92 + }
  93 +
  94 + public Integer getUser_info_id()
  95 + {
  96 + return user_info_id;
  97 + }
  98 +
  99 + @Override
  100 + public String toString() {
  101 + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
  102 + .append("create_time", getCreate_time())
  103 + .append("id", getId())
  104 + .append("iot_terminal_group_id", getIot_terminal_group_id())
  105 + .append("iot_terminal_group_name", getIot_terminal_group_name())
  106 + .append("iot_terminal_id", getIot_terminal_id())
  107 + .append("user_info_id", getUser_info_id())
  108 + .toString();
  109 + }
  110 +}
@@ -41,6 +41,9 @@ public class TokenService @@ -41,6 +41,9 @@ public class TokenService
41 @Value("${token.expireTime}") 41 @Value("${token.expireTime}")
42 private int expireTime; 42 private int expireTime;
43 43
  44 + @Value("${token.rediskey}")
  45 + private int rediskey;
  46 +
44 protected static final long MILLIS_SECOND = 1000; 47 protected static final long MILLIS_SECOND = 1000;
45 48
46 protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND; 49 protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND;
@@ -221,6 +224,6 @@ public class TokenService @@ -221,6 +224,6 @@ public class TokenService
221 224
222 private String getTokenKey(String uuid) 225 private String getTokenKey(String uuid)
223 { 226 {
224 - return Constants.LOGIN_TOKEN_KEY + uuid; 227 + return Constants.LOGIN_TOKEN_KEY+rediskey+":" + uuid;
225 } 228 }
226 } 229 }
  1 +package com.ruoyi.system.mapper;
  2 +
  3 +import java.util.List;
  4 +import com.ruoyi.system.domain.UserTerminalGroup;
  5 +
  6 +/**
  7 + * 终端分组Mapper接口
  8 + *
  9 + * @author 钟来
  10 + * @date 2022-11-22
  11 + */
  12 +public interface UserTerminalGroupMapper
  13 +{
  14 + /**
  15 + * 查询终端分组
  16 + *
  17 + * @param id 终端分组主键
  18 + * @return 终端分组
  19 + */
  20 + public UserTerminalGroup selectUserTerminalGroupById(Integer id);
  21 +
  22 + /**
  23 + * 查询终端分组列表
  24 + *
  25 + * @param userTerminalGroup 终端分组
  26 + * @return 终端分组集合
  27 + */
  28 + public List<UserTerminalGroup> selectUserTerminalGroupList(UserTerminalGroup userTerminalGroup);
  29 +
  30 + /**
  31 + * 新增终端分组
  32 + *
  33 + * @param userTerminalGroup 终端分组
  34 + * @return 结果
  35 + */
  36 + public int insertUserTerminalGroup(UserTerminalGroup userTerminalGroup);
  37 +
  38 + /**
  39 + * 修改终端分组
  40 + *
  41 + * @param userTerminalGroup 终端分组
  42 + * @return 结果
  43 + */
  44 + public int updateUserTerminalGroup(UserTerminalGroup userTerminalGroup);
  45 +
  46 + /**
  47 + * 删除终端分组
  48 + *
  49 + * @param id 终端分组主键
  50 + * @return 结果
  51 + */
  52 + public int deleteUserTerminalGroupById(Integer id);
  53 +
  54 + /**
  55 + * 批量删除终端分组
  56 + *
  57 + * @param ids 需要删除的数据主键集合
  58 + * @return 结果
  59 + */
  60 + public int deleteUserTerminalGroupByIds(Integer[] ids);
  61 +}
  1 +package com.ruoyi.system.mapper;
  2 +
  3 +import java.util.List;
  4 +import com.ruoyi.system.domain.UserTerminalGroupRelation;
  5 +
  6 +/**
  7 + * 终端分组关系Mapper接口
  8 + *
  9 + * @author 钟来
  10 + * @date 2022-11-22
  11 + */
  12 +public interface UserTerminalGroupRelationMapper
  13 +{
  14 + /**
  15 + * 查询终端分组关系
  16 + *
  17 + * @param id 终端分组关系主键
  18 + * @return 终端分组关系
  19 + */
  20 + public UserTerminalGroupRelation selectUserTerminalGroupRelationById(Integer id);
  21 +
  22 + /**
  23 + * 查询终端分组关系列表
  24 + *
  25 + * @param userTerminalGroupRelation 终端分组关系
  26 + * @return 终端分组关系集合
  27 + */
  28 + public List<UserTerminalGroupRelation> selectUserTerminalGroupRelationList(UserTerminalGroupRelation userTerminalGroupRelation);
  29 +
  30 + /**
  31 + * 新增终端分组关系
  32 + *
  33 + * @param userTerminalGroupRelation 终端分组关系
  34 + * @return 结果
  35 + */
  36 + public int insertUserTerminalGroupRelation(UserTerminalGroupRelation userTerminalGroupRelation);
  37 +
  38 + /**
  39 + * 修改终端分组关系
  40 + *
  41 + * @param userTerminalGroupRelation 终端分组关系
  42 + * @return 结果
  43 + */
  44 + public int updateUserTerminalGroupRelation(UserTerminalGroupRelation userTerminalGroupRelation);
  45 +
  46 + /**
  47 + * 删除终端分组关系
  48 + *
  49 + * @param id 终端分组关系主键
  50 + * @return 结果
  51 + */
  52 + public int deleteUserTerminalGroupRelationById(Integer id);
  53 +
  54 + /**
  55 + * 批量删除终端分组关系
  56 + *
  57 + * @param ids 需要删除的数据主键集合
  58 + * @return 结果
  59 + */
  60 + public int deleteUserTerminalGroupRelationByIds(Integer[] ids);
  61 +}
  1 +package com.ruoyi.system.service;
  2 +
  3 +import java.util.List;
  4 +import com.ruoyi.system.domain.UserTerminalGroupRelation;
  5 +
  6 +/**
  7 + * 终端分组关系Service接口
  8 + *
  9 + * @author 钟来
  10 + * @date 2022-11-22
  11 + */
  12 +public interface IUserTerminalGroupRelationService
  13 +{
  14 + /**
  15 + * 查询终端分组关系
  16 + *
  17 + * @param id 终端分组关系主键
  18 + * @return 终端分组关系
  19 + */
  20 + public UserTerminalGroupRelation selectUserTerminalGroupRelationById(Integer id);
  21 +
  22 + /**
  23 + * 查询终端分组关系列表
  24 + *
  25 + * @param userTerminalGroupRelation 终端分组关系
  26 + * @return 终端分组关系集合
  27 + */
  28 + public List<UserTerminalGroupRelation> selectUserTerminalGroupRelationList(UserTerminalGroupRelation userTerminalGroupRelation);
  29 +
  30 + /**
  31 + * 新增终端分组关系
  32 + *
  33 + * @param userTerminalGroupRelation 终端分组关系
  34 + * @return 结果
  35 + */
  36 + public int insertUserTerminalGroupRelation(UserTerminalGroupRelation userTerminalGroupRelation);
  37 +
  38 + /**
  39 + * 修改终端分组关系
  40 + *
  41 + * @param userTerminalGroupRelation 终端分组关系
  42 + * @return 结果
  43 + */
  44 + public int updateUserTerminalGroupRelation(UserTerminalGroupRelation userTerminalGroupRelation);
  45 +
  46 + /**
  47 + * 批量删除终端分组关系
  48 + *
  49 + * @param ids 需要删除的终端分组关系主键集合
  50 + * @return 结果
  51 + */
  52 + public int deleteUserTerminalGroupRelationByIds(Integer[] ids);
  53 +
  54 + /**
  55 + * 删除终端分组关系信息
  56 + *
  57 + * @param id 终端分组关系主键
  58 + * @return 结果
  59 + */
  60 + public int deleteUserTerminalGroupRelationById(Integer id);
  61 +}
  1 +package com.ruoyi.system.service;
  2 +
  3 +import java.util.List;
  4 +import com.ruoyi.system.domain.UserTerminalGroup;
  5 +
  6 +/**
  7 + * 终端分组Service接口
  8 + *
  9 + * @author 钟来
  10 + * @date 2022-11-22
  11 + */
  12 +public interface IUserTerminalGroupService
  13 +{
  14 + /**
  15 + * 查询终端分组
  16 + *
  17 + * @param id 终端分组主键
  18 + * @return 终端分组
  19 + */
  20 + public UserTerminalGroup selectUserTerminalGroupById(Integer id);
  21 +
  22 + /**
  23 + * 查询终端分组列表
  24 + *
  25 + * @param userTerminalGroup 终端分组
  26 + * @return 终端分组集合
  27 + */
  28 + public List<UserTerminalGroup> selectUserTerminalGroupList(UserTerminalGroup userTerminalGroup);
  29 +
  30 + /**
  31 + * 新增终端分组
  32 + *
  33 + * @param userTerminalGroup 终端分组
  34 + * @return 结果
  35 + */
  36 + public int insertUserTerminalGroup(UserTerminalGroup userTerminalGroup);
  37 +
  38 + /**
  39 + * 修改终端分组
  40 + *
  41 + * @param userTerminalGroup 终端分组
  42 + * @return 结果
  43 + */
  44 + public int updateUserTerminalGroup(UserTerminalGroup userTerminalGroup);
  45 +
  46 + /**
  47 + * 批量删除终端分组
  48 + *
  49 + * @param ids 需要删除的终端分组主键集合
  50 + * @return 结果
  51 + */
  52 + public int deleteUserTerminalGroupByIds(Integer[] ids);
  53 +
  54 + /**
  55 + * 删除终端分组信息
  56 + *
  57 + * @param id 终端分组主键
  58 + * @return 结果
  59 + */
  60 + public int deleteUserTerminalGroupById(Integer id);
  61 +}
  1 +package com.ruoyi.system.service.impl;
  2 +
  3 +import java.util.List;
  4 +import org.springframework.beans.factory.annotation.Autowired;
  5 +import org.springframework.stereotype.Service;
  6 +import com.ruoyi.system.mapper.UserTerminalGroupRelationMapper;
  7 +import com.ruoyi.system.domain.UserTerminalGroupRelation;
  8 +import com.ruoyi.system.service.IUserTerminalGroupRelationService;
  9 +
  10 +/**
  11 + * 终端分组关系Service业务层处理
  12 + *
  13 + * @author 钟来
  14 + * @date 2022-11-22
  15 + */
  16 +@Service
  17 +public class UserTerminalGroupRelationServiceImpl implements IUserTerminalGroupRelationService
  18 +{
  19 + @Autowired
  20 + private UserTerminalGroupRelationMapper userTerminalGroupRelationMapper;
  21 +
  22 + /**
  23 + * 查询终端分组关系
  24 + *
  25 + * @param id 终端分组关系主键
  26 + * @return 终端分组关系
  27 + */
  28 + @Override
  29 + public UserTerminalGroupRelation selectUserTerminalGroupRelationById(Integer id)
  30 + {
  31 + return userTerminalGroupRelationMapper.selectUserTerminalGroupRelationById(id);
  32 + }
  33 +
  34 + /**
  35 + * 查询终端分组关系列表
  36 + *
  37 + * @param userTerminalGroupRelation 终端分组关系
  38 + * @return 终端分组关系
  39 + */
  40 + @Override
  41 + public List<UserTerminalGroupRelation> selectUserTerminalGroupRelationList(UserTerminalGroupRelation userTerminalGroupRelation)
  42 + {
  43 + return userTerminalGroupRelationMapper.selectUserTerminalGroupRelationList(userTerminalGroupRelation);
  44 + }
  45 +
  46 + /**
  47 + * 新增终端分组关系
  48 + *
  49 + * @param userTerminalGroupRelation 终端分组关系
  50 + * @return 结果
  51 + */
  52 + @Override
  53 + public int insertUserTerminalGroupRelation(UserTerminalGroupRelation userTerminalGroupRelation)
  54 + {
  55 + return userTerminalGroupRelationMapper.insertUserTerminalGroupRelation(userTerminalGroupRelation);
  56 + }
  57 +
  58 + /**
  59 + * 修改终端分组关系
  60 + *
  61 + * @param userTerminalGroupRelation 终端分组关系
  62 + * @return 结果
  63 + */
  64 + @Override
  65 + public int updateUserTerminalGroupRelation(UserTerminalGroupRelation userTerminalGroupRelation)
  66 + {
  67 + return userTerminalGroupRelationMapper.updateUserTerminalGroupRelation(userTerminalGroupRelation);
  68 + }
  69 +
  70 + /**
  71 + * 批量删除终端分组关系
  72 + *
  73 + * @param ids 需要删除的终端分组关系主键
  74 + * @return 结果
  75 + */
  76 + @Override
  77 + public int deleteUserTerminalGroupRelationByIds(Integer[] ids)
  78 + {
  79 + return userTerminalGroupRelationMapper.deleteUserTerminalGroupRelationByIds(ids);
  80 + }
  81 +
  82 + /**
  83 + * 删除终端分组关系信息
  84 + *
  85 + * @param id 终端分组关系主键
  86 + * @return 结果
  87 + */
  88 + @Override
  89 + public int deleteUserTerminalGroupRelationById(Integer id)
  90 + {
  91 + return userTerminalGroupRelationMapper.deleteUserTerminalGroupRelationById(id);
  92 + }
  93 +}
  1 +package com.ruoyi.system.service.impl;
  2 +
  3 +import java.util.List;
  4 +import org.springframework.beans.factory.annotation.Autowired;
  5 +import org.springframework.stereotype.Service;
  6 +import com.ruoyi.system.mapper.UserTerminalGroupMapper;
  7 +import com.ruoyi.system.domain.UserTerminalGroup;
  8 +import com.ruoyi.system.service.IUserTerminalGroupService;
  9 +
  10 +/**
  11 + * 终端分组Service业务层处理
  12 + *
  13 + * @author 钟来
  14 + * @date 2022-11-22
  15 + */
  16 +@Service
  17 +public class UserTerminalGroupServiceImpl implements IUserTerminalGroupService
  18 +{
  19 + @Autowired
  20 + private UserTerminalGroupMapper userTerminalGroupMapper;
  21 +
  22 + /**
  23 + * 查询终端分组
  24 + *
  25 + * @param id 终端分组主键
  26 + * @return 终端分组
  27 + */
  28 + @Override
  29 + public UserTerminalGroup selectUserTerminalGroupById(Integer id)
  30 + {
  31 + return userTerminalGroupMapper.selectUserTerminalGroupById(id);
  32 + }
  33 +
  34 + /**
  35 + * 查询终端分组列表
  36 + *
  37 + * @param userTerminalGroup 终端分组
  38 + * @return 终端分组
  39 + */
  40 + @Override
  41 + public List<UserTerminalGroup> selectUserTerminalGroupList(UserTerminalGroup userTerminalGroup)
  42 + {
  43 + return userTerminalGroupMapper.selectUserTerminalGroupList(userTerminalGroup);
  44 + }
  45 +
  46 + /**
  47 + * 新增终端分组
  48 + *
  49 + * @param userTerminalGroup 终端分组
  50 + * @return 结果
  51 + */
  52 + @Override
  53 + public int insertUserTerminalGroup(UserTerminalGroup userTerminalGroup)
  54 + {
  55 + return userTerminalGroupMapper.insertUserTerminalGroup(userTerminalGroup);
  56 + }
  57 +
  58 + /**
  59 + * 修改终端分组
  60 + *
  61 + * @param userTerminalGroup 终端分组
  62 + * @return 结果
  63 + */
  64 + @Override
  65 + public int updateUserTerminalGroup(UserTerminalGroup userTerminalGroup)
  66 + {
  67 + return userTerminalGroupMapper.updateUserTerminalGroup(userTerminalGroup);
  68 + }
  69 +
  70 + /**
  71 + * 批量删除终端分组
  72 + *
  73 + * @param ids 需要删除的终端分组主键
  74 + * @return 结果
  75 + */
  76 + @Override
  77 + public int deleteUserTerminalGroupByIds(Integer[] ids)
  78 + {
  79 + return userTerminalGroupMapper.deleteUserTerminalGroupByIds(ids);
  80 + }
  81 +
  82 + /**
  83 + * 删除终端分组信息
  84 + *
  85 + * @param id 终端分组主键
  86 + * @return 结果
  87 + */
  88 + @Override
  89 + public int deleteUserTerminalGroupById(Integer id)
  90 + {
  91 + return userTerminalGroupMapper.deleteUserTerminalGroupById(id);
  92 + }
  93 +}
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper
  3 +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4 +"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5 +<mapper namespace="com.ruoyi.system.mapper.UserTerminalGroupMapper">
  6 +
  7 + <resultMap type="UserTerminalGroup" id="UserTerminalGroupResult">
  8 + <result property="create_time" column="create_time" />
  9 + <result property="id" column="id" />
  10 + <result property="name" column="name" />
  11 + <result property="user_info_id" column="user_info_id" />
  12 + </resultMap>
  13 +
  14 + <sql id="selectUserTerminalGroupVo">
  15 + select `create_time`, `id`, `name`, `user_info_id` from user_terminal_group
  16 + </sql>
  17 +
  18 + <select id="selectUserTerminalGroupList" parameterType="UserTerminalGroup" resultMap="UserTerminalGroupResult">
  19 + <include refid="selectUserTerminalGroupVo"/>
  20 + <where>
  21 + </where>
  22 + </select>
  23 +
  24 + <select id="selectUserTerminalGroupById" parameterType="Integer" resultMap="UserTerminalGroupResult">
  25 + <include refid="selectUserTerminalGroupVo"/>
  26 + where id = #{id}
  27 + </select>
  28 +
  29 + <insert id="insertUserTerminalGroup" parameterType="UserTerminalGroup" useGeneratedKeys="true" keyProperty="id">
  30 + insert into user_terminal_group
  31 + <trim prefix="(" suffix=")" suffixOverrides=",">
  32 + <if test="create_time != null">create_time,</if>
  33 + <if test="name != null">name,</if>
  34 + <if test="user_info_id != null">user_info_id,</if>
  35 + </trim>
  36 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  37 + <if test="create_time != null">#{create_time},</if>
  38 + <if test="name != null">#{name},</if>
  39 + <if test="user_info_id != null">#{user_info_id},</if>
  40 + </trim>
  41 + </insert>
  42 +
  43 + <update id="updateUserTerminalGroup" parameterType="UserTerminalGroup">
  44 + update user_terminal_group
  45 + <trim prefix="SET" suffixOverrides=",">
  46 + <if test="create_time != null">create_time = #{create_time},</if>
  47 + <if test="name != null">name = #{name},</if>
  48 + <if test="user_info_id != null">user_info_id = #{user_info_id},</if>
  49 + </trim>
  50 + where id = #{id}
  51 + </update>
  52 +
  53 + <delete id="deleteUserTerminalGroupById" parameterType="Integer">
  54 + delete from user_terminal_group where id = #{id}
  55 + </delete>
  56 +
  57 + <delete id="deleteUserTerminalGroupByIds" parameterType="String">
  58 + delete from user_terminal_group where id in
  59 + <foreach item="id" collection="array" open="(" separator="," close=")">
  60 + #{id}
  61 + </foreach>
  62 + </delete>
  63 +</mapper>
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper
  3 +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4 +"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5 +<mapper namespace="com.ruoyi.system.mapper.UserTerminalGroupRelationMapper">
  6 +
  7 + <resultMap type="UserTerminalGroupRelation" id="UserTerminalGroupRelationResult">
  8 + <result property="create_time" column="create_time" />
  9 + <result property="id" column="id" />
  10 + <result property="iot_terminal_group_id" column="iot_terminal_group_id" />
  11 + <result property="iot_terminal_group_name" column="iot_terminal_group_name" />
  12 + <result property="iot_terminal_id" column="iot_terminal_id" />
  13 + <result property="user_info_id" column="user_info_id" />
  14 + </resultMap>
  15 +
  16 + <sql id="selectUserTerminalGroupRelationVo">
  17 + select `create_time`, `id`, `iot_terminal_group_id`, `iot_terminal_group_name`, `iot_terminal_id`, `user_info_id` from user_terminal_group_relation
  18 + </sql>
  19 +
  20 + <select id="selectUserTerminalGroupRelationList" parameterType="UserTerminalGroupRelation" resultMap="UserTerminalGroupRelationResult">
  21 + <include refid="selectUserTerminalGroupRelationVo"/>
  22 + <where>
  23 + </where>
  24 + </select>
  25 +
  26 + <select id="selectUserTerminalGroupRelationById" parameterType="Integer" resultMap="UserTerminalGroupRelationResult">
  27 + <include refid="selectUserTerminalGroupRelationVo"/>
  28 + where id = #{id}
  29 + </select>
  30 +
  31 + <insert id="insertUserTerminalGroupRelation" parameterType="UserTerminalGroupRelation" useGeneratedKeys="true" keyProperty="id">
  32 + insert into user_terminal_group_relation
  33 + <trim prefix="(" suffix=")" suffixOverrides=",">
  34 + <if test="create_time != null">create_time,</if>
  35 + <if test="iot_terminal_group_id != null">iot_terminal_group_id,</if>
  36 + <if test="iot_terminal_group_name != null">iot_terminal_group_name,</if>
  37 + <if test="iot_terminal_id != null">iot_terminal_id,</if>
  38 + <if test="user_info_id != null">user_info_id,</if>
  39 + </trim>
  40 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  41 + <if test="create_time != null">#{create_time},</if>
  42 + <if test="iot_terminal_group_id != null">#{iot_terminal_group_id},</if>
  43 + <if test="iot_terminal_group_name != null">#{iot_terminal_group_name},</if>
  44 + <if test="iot_terminal_id != null">#{iot_terminal_id},</if>
  45 + <if test="user_info_id != null">#{user_info_id},</if>
  46 + </trim>
  47 + </insert>
  48 +
  49 + <update id="updateUserTerminalGroupRelation" parameterType="UserTerminalGroupRelation">
  50 + update user_terminal_group_relation
  51 + <trim prefix="SET" suffixOverrides=",">
  52 + <if test="create_time != null">create_time = #{create_time},</if>
  53 + <if test="iot_terminal_group_id != null">iot_terminal_group_id = #{iot_terminal_group_id},</if>
  54 + <if test="iot_terminal_group_name != null">iot_terminal_group_name = #{iot_terminal_group_name},</if>
  55 + <if test="iot_terminal_id != null">iot_terminal_id = #{iot_terminal_id},</if>
  56 + <if test="user_info_id != null">user_info_id = #{user_info_id},</if>
  57 + </trim>
  58 + where id = #{id}
  59 + </update>
  60 +
  61 + <delete id="deleteUserTerminalGroupRelationById" parameterType="Integer">
  62 + delete from user_terminal_group_relation where id = #{id}
  63 + </delete>
  64 +
  65 + <delete id="deleteUserTerminalGroupRelationByIds" parameterType="String">
  66 + delete from user_terminal_group_relation where id in
  67 + <foreach item="id" collection="array" open="(" separator="," close=")">
  68 + #{id}
  69 + </foreach>
  70 + </delete>
  71 +</mapper>