2021年9月2日10:07:12 1.增加微信小程序接口 2.4G开关功能接口

This commit is contained in:
xxmfl
2021-09-02 10:08:27 +08:00
parent 5c97293269
commit a8bc50f67c
337 changed files with 16032 additions and 12055 deletions

View File

@@ -48,7 +48,29 @@
<version>1.5.21</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<version>2.5.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.zaxxer/HikariCP -->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.2.0</version>
</dependency>
</dependencies>
</project>

View File

@@ -35,15 +35,14 @@ import com.ruoyi.common.core.page.TableDataInfo;
/**
* 设备分类Controller
*
*
* @author kerwincui
* @date 2021-05-07
*/
@Api(value="设备分类",tags="设备分类")
@Api(value = "设备分类", tags = "设备分类")
@RestController
@RequestMapping("/system/category")
public class IotCategoryController extends BaseController
{
public class IotCategoryController extends BaseController {
@Autowired
private IIotCategoryService iotCategoryService;
@@ -53,8 +52,7 @@ public class IotCategoryController extends BaseController
@ApiOperation(value = "分类列表", notes = "分类列表")
@PreAuthorize("@ss.hasPermi('system:category:list')")
@GetMapping("/list")
public TableDataInfo list(IotCategory iotCategory)
{
public TableDataInfo list(IotCategory iotCategory) {
startPage();
List<IotCategory> list = iotCategoryService.selectIotCategoryList(iotCategory);
return getDataTable(list);
@@ -67,8 +65,7 @@ public class IotCategoryController extends BaseController
@PreAuthorize("@ss.hasPermi('system:category:export')")
@Log(title = "设备分类", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(IotCategory iotCategory)
{
public AjaxResult export(IotCategory iotCategory) {
List<IotCategory> list = iotCategoryService.selectIotCategoryList(iotCategory);
ExcelUtil<IotCategory> util = new ExcelUtil<IotCategory>(IotCategory.class);
return util.exportExcel(list, "category");
@@ -80,8 +77,7 @@ public class IotCategoryController extends BaseController
@ApiOperation(value = "获取分类详情", notes = "获取分类详情")
@PreAuthorize("@ss.hasPermi('system:category:query')")
@GetMapping(value = "/{categoryId}")
public AjaxResult getInfo(@PathVariable("categoryId") Long categoryId)
{
public AjaxResult getInfo(@PathVariable("categoryId") Long categoryId) {
return AjaxResult.success(iotCategoryService.selectIotCategoryById(categoryId));
}
@@ -92,8 +88,7 @@ public class IotCategoryController extends BaseController
@PreAuthorize("@ss.hasPermi('system:category:add')")
@Log(title = "设备分类", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody IotCategory iotCategory)
{
public AjaxResult add(@RequestBody IotCategory iotCategory) {
return toAjax(iotCategoryService.insertIotCategory(iotCategory));
}
@@ -104,8 +99,7 @@ public class IotCategoryController extends BaseController
@PreAuthorize("@ss.hasPermi('system:category:edit')")
@Log(title = "设备分类", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody IotCategory iotCategory)
{
public AjaxResult edit(@RequestBody IotCategory iotCategory) {
return toAjax(iotCategoryService.updateIotCategory(iotCategory));
}
@@ -115,9 +109,8 @@ public class IotCategoryController extends BaseController
@ApiOperation(value = "删除分类", notes = "删除分类")
@PreAuthorize("@ss.hasPermi('system:category:remove')")
@Log(title = "设备分类", businessType = BusinessType.DELETE)
@DeleteMapping("/{categoryIds}")
public AjaxResult remove(@PathVariable Long[] categoryIds)
{
@DeleteMapping("/{categoryIds}")
public AjaxResult remove(@PathVariable Long[] categoryIds) {
return toAjax(iotCategoryService.deleteIotCategoryByIds(categoryIds));
}
}

View File

@@ -14,7 +14,10 @@ import java.math.BigDecimal;
import java.util.List;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.vo.DeviceControlCMD;
import com.ruoyi.system.domain.vo.IotDeviceListDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -22,14 +25,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.token.TokenService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@@ -39,17 +35,18 @@ import com.ruoyi.system.service.IIotDeviceService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import javax.validation.constraints.Size;
/**
* 设备Controller
*
*
* @author kerwincui
* @date 2021-05-06
*/
@Api(value="设备",tags="设备")
@Api(value = "设备", tags = "设备")
@RestController
@RequestMapping("/system/device")
public class IotDeviceController extends BaseController
{
public class IotDeviceController extends BaseController {
@Autowired
private IIotDeviceService iotDeviceService;
@@ -59,15 +56,16 @@ public class IotDeviceController extends BaseController
@ApiOperation(value = "设备列表", notes = "设备列表")
@PreAuthorize("@ss.hasPermi('system:device:list')")
@GetMapping("/list")
public TableDataInfo list(IotDevice iotDevice)
{
public TableDataInfo list(IotDevice iotDevice) {
startPage();
LoginUser user=(LoginUser)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
LoginUser user = (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
iotDevice.setOwnerId(user.getUser().getUserId().toString());
List<IotDeviceListDto> list = iotDeviceService.selectIotDeviceList(iotDevice);
return getDataTable(list);
}
/**
* 导出设备列表
*/
@@ -75,8 +73,7 @@ public class IotDeviceController extends BaseController
@PreAuthorize("@ss.hasPermi('system:device:export')")
@Log(title = "设备", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(IotDevice iotDevice)
{
public AjaxResult export(IotDevice iotDevice) {
List<IotDeviceListDto> list = iotDeviceService.selectIotDeviceList(iotDevice);
ExcelUtil<IotDeviceListDto> util = new ExcelUtil<IotDeviceListDto>(IotDeviceListDto.class);
return util.exportExcel(list, "device");
@@ -88,8 +85,7 @@ public class IotDeviceController extends BaseController
@ApiOperation(value = "获取设备详情", notes = "获取设备详情")
@PreAuthorize("@ss.hasPermi('system:device:query')")
@GetMapping(value = "/{deviceId}")
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId)
{
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) {
return AjaxResult.success(iotDeviceService.selectIotDeviceById(deviceId));
}
@@ -99,8 +95,7 @@ public class IotDeviceController extends BaseController
@ApiOperation(value = "根据设备编号获取设备详情", notes = "根据设备编号获取设备详情")
@PreAuthorize("@ss.hasPermi('system:device:query')")
@GetMapping(value = "/getByNum/{deviceNum}")
public AjaxResult getInfoByNum(@PathVariable("deviceNum") String deviceNum)
{
public AjaxResult getInfoByNum(@PathVariable("deviceNum") String deviceNum) {
return AjaxResult.success(iotDeviceService.selectIotDeviceByNum(deviceNum));
}
@@ -111,12 +106,11 @@ public class IotDeviceController extends BaseController
@PreAuthorize("@ss.hasPermi('system:device:add')")
@Log(title = "设备", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody IotDevice iotDevice)
{
LoginUser user=(LoginUser)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
public AjaxResult add(@RequestBody IotDevice iotDevice) {
LoginUser user = (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
iotDevice.setOwnerId(user.getUser().getUserId().toString());
IotDevice device=iotDeviceService.selectIotDeviceByNum(iotDevice.getDeviceNum());
if(device!=null){
IotDevice device = iotDeviceService.selectIotDeviceByNum(iotDevice.getDeviceNum());
if (device != null) {
return AjaxResult.error("设备编号已存在,请重新填写");
}
return toAjax(iotDeviceService.insertIotDevice(iotDevice));
@@ -129,8 +123,7 @@ public class IotDeviceController extends BaseController
@PreAuthorize("@ss.hasPermi('system:device:edit')")
@Log(title = "设备", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody IotDevice iotDevice)
{
public AjaxResult edit(@RequestBody IotDevice iotDevice) {
return toAjax(iotDeviceService.updateIotDevice(iotDevice));
}
@@ -140,9 +133,103 @@ public class IotDeviceController extends BaseController
@ApiOperation(value = "删除设备", notes = "删除设备")
@PreAuthorize("@ss.hasPermi('system:device:remove')")
@Log(title = "设备", businessType = BusinessType.DELETE)
@DeleteMapping("/{deviceIds}")
public AjaxResult remove(@PathVariable Long[] deviceIds)
{
@DeleteMapping("/{deviceIds}")
public AjaxResult remove(@PathVariable Long[] deviceIds) {
return toAjax(iotDeviceService.deleteIotDeviceByIds(deviceIds));
}
@ApiOperation(value = "绑定设备", notes = "绑定设备")
@Log(title = "设备", businessType = BusinessType.UPDATE)
@PostMapping("/bindDevice")
public AjaxResult bindDevice(@RequestBody IotDevice iotDevice) {
LoginUser user = (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
Long userId = user.getUser().getUserId();
String username = user.getUsername();
String deviceNum = iotDevice.getDeviceNum();
String deviceName = iotDevice.getDeviceName();
Long categoryId = iotDevice.getCategoryId();
String remark = iotDevice.getRemark();
return AjaxResult.success(iotDeviceService.bindDevice(userId,username,deviceNum,deviceName,categoryId, remark));
}
@ApiOperation(value = "控制设备", notes = "控制设备")
@PreAuthorize("@ss.hasPermi('system:device:control')")
@Log(title = "设备", businessType = BusinessType.UPDATE)
@PostMapping("/control")
public AjaxResult control(@RequestBody DeviceControlCMD deviceControlCMD) {
String deviceNum = deviceControlCMD.getDeviceNum();
String cmd = deviceControlCMD.getCmd();
if(StringUtils.isBlank(deviceNum)) {
throw new CustomException("设备编号不能为空");
}
if(StringUtils.isBlank(cmd)) {
throw new CustomException("控制指令不能为空");
}
return toAjax(iotDeviceService.controlDeviceByNum(deviceNum,cmd));
}
@ApiOperation(value = "小程序设备列表", notes = "小程序设备列表")
@PreAuthorize("@ss.hasPermi('system:device:list')")
@GetMapping("/listDevice")
public TableDataInfo listDevice(IotDevice iotDevice) {
startPage();
LoginUser user = (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
iotDevice.setOwnerId(user.getUser().getUserId().toString());
List<IotDeviceListDto> list = iotDeviceService.selectMpIotDeviceList(iotDevice);
return getDataTable(list);
}
@ApiOperation(value = "修改设备名称和备注", notes = "修改设备名称和备注")
@Log(title = "设备", businessType = BusinessType.UPDATE)
@PostMapping("/updateDeviceInfo")
public AjaxResult updateDeviceInfo(@RequestBody IotDevice iotDevice) {
Long deviceId = iotDevice.getDeviceId();
String deviceName = iotDevice.getDeviceName();
String remark = iotDevice.getRemark();
LoginUser user = (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
Long userId = user.getUser().getUserId();
String nickName = user.getUser().getNickName();
return AjaxResult.success(iotDeviceService.updateDeviceInfo( userId, nickName, deviceId, deviceName, remark));
}
@ApiOperation(value = "根据用户设备编号获取设备详情", notes = "根据设备编号获取设备详情")
@GetMapping(value = "/getByUserAndNum/{deviceNum}")
public AjaxResult getInfoByUserAndNum(@PathVariable("deviceNum") String deviceNum) {
LoginUser user = (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
Long userId = user.getUser().getUserId();
return AjaxResult.success(iotDeviceService.selectIotDeviceByUserAndNum(userId,deviceNum));
}
@ApiOperation(value = "解除绑定设备", notes = "解除绑定设备")
@Log(title = "设备", businessType = BusinessType.UPDATE)
@PostMapping("/unBindDevice")
public AjaxResult unBindDevice(@RequestBody IotDevice iotDevice) {
LoginUser user = (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
Long userId = user.getUser().getUserId();
String username = user.getUsername();
Long deviceId = iotDevice.getDeviceId();
return AjaxResult.success(iotDeviceService.unBindDevice(userId,username,deviceId));
}
@ApiOperation(value = "根据设备编号查询设备信息", notes = "根据设备编号查询设备信息")
@Log(title = "设备", businessType = BusinessType.UPDATE)
@GetMapping("/getDeviceInfoByDeviceNum")
public AjaxResult getDeviceInfoByDeviceNum(@RequestParam String deviceNum ) {
LoginUser user = (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
Long userId = user.getUser().getUserId();
String username = user.getUsername();
return AjaxResult.success(iotDeviceService.getDeviceInfoByDeviceNum(userId,username,deviceNum));
}
@ApiOperation(value = "根据设备编号查询设备信息", notes = "根据设备编号查询设备信息")
@Log(title = "设备", businessType = BusinessType.UPDATE)
@GetMapping("/getDeviceInfoByDeviceId")
public AjaxResult getDeviceInfoByDeviceId(@RequestParam Long deviceId ) {
LoginUser user = (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
Long userId = user.getUser().getUserId();
String username = user.getUsername();
return AjaxResult.success(iotDeviceService.getDeviceInfoByDeviceId(userId,username,deviceId));
}
}

View File

@@ -41,15 +41,14 @@ import com.ruoyi.common.core.page.TableDataInfo;
/**
* 设备配置Controller
*
*
* @author kerwincui
* @date 2021-05-06
*/
@Api(value="设备配置",tags="设备配置")
@Api(value = "设备配置", tags = "设备配置")
@RestController
@RequestMapping("/system/set")
public class IotDeviceSetController extends BaseController
{
public class IotDeviceSetController extends BaseController {
@Autowired
private IIotDeviceSetService iotDeviceSetService;
@Autowired
@@ -66,8 +65,7 @@ public class IotDeviceSetController extends BaseController
@ApiOperation(value = "查询设备配置列表", notes = "查询设备配置列表")
@PreAuthorize("@ss.hasPermi('system:set:list')")
@GetMapping("/list")
public TableDataInfo list(IotDeviceSet iotDeviceSet)
{
public TableDataInfo list(IotDeviceSet iotDeviceSet) {
startPage();
List<IotDeviceSet> list = iotDeviceSetService.selectIotDeviceSetList(iotDeviceSet);
return getDataTable(list);
@@ -80,8 +78,7 @@ public class IotDeviceSetController extends BaseController
@PreAuthorize("@ss.hasPermi('system:set:export')")
@Log(title = "设备配置", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(IotDeviceSet iotDeviceSet)
{
public AjaxResult export(IotDeviceSet iotDeviceSet) {
List<IotDeviceSet> list = iotDeviceSetService.selectIotDeviceSetList(iotDeviceSet);
ExcelUtil<IotDeviceSet> util = new ExcelUtil<IotDeviceSet>(IotDeviceSet.class);
return util.exportExcel(list, "set");
@@ -93,8 +90,7 @@ public class IotDeviceSetController extends BaseController
@ApiOperation(value = "获取设备配置详情", notes = "获取设备配置详情")
@PreAuthorize("@ss.hasPermi('system:set:query')")
@GetMapping(value = "/{deviceSetId}")
public AjaxResult getInfo(@PathVariable("deviceSetId") Long deviceSetId)
{
public AjaxResult getInfo(@PathVariable("deviceSetId") Long deviceSetId) {
return AjaxResult.success(iotDeviceSetService.selectIotDeviceSetById(deviceSetId));
}
@@ -104,14 +100,13 @@ public class IotDeviceSetController extends BaseController
@ApiOperation(value = "获取最新设备配置详情", notes = "获取最新设备配置详情")
@PreAuthorize("@ss.hasPermi('system:set:query')")
@GetMapping(value = "/new/{deviceId}")
public AjaxResult getNewInfo(@PathVariable("deviceId") Long deviceId)
{
IotDeviceSet set=iotDeviceSetService.selectIotDeviceSetByDeviceId(deviceId);
if(set==null){
public AjaxResult getNewInfo(@PathVariable("deviceId") Long deviceId) {
IotDeviceSet set = iotDeviceSetService.selectIotDeviceSetByDeviceId(deviceId);
if (set == null) {
// 构建默认数据
IotDevice device=iotDeviceService.selectIotDeviceById(deviceId);
if(device!=null) {
set=new IotDeviceSet();
IotDevice device = iotDeviceService.selectIotDeviceById(deviceId);
if (device != null) {
set = new IotDeviceSet();
set.setDeviceId(device.getDeviceId());
set.setDeviceNum(device.getDeviceNum());
set.setOwnerId(device.getOwnerId());
@@ -139,8 +134,7 @@ public class IotDeviceSetController extends BaseController
@PreAuthorize("@ss.hasPermi('system:set:add')")
@Log(title = "设备配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody IotDeviceSet iotDeviceSet)
{
public AjaxResult add(@RequestBody IotDeviceSet iotDeviceSet) {
return toAjax(iotDeviceSetService.insertIotDeviceSet(iotDeviceSet));
}
@@ -151,62 +145,67 @@ public class IotDeviceSetController extends BaseController
@PreAuthorize("@ss.hasPermi('system:set:edit')")
@Log(title = "设备配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody IotDeviceSet iotDeviceSet)
{
IotDeviceStatus status=iotDeviceStatusService.selectIotDeviceStatusByDeviceId(iotDeviceSet.getDeviceId());
if(status==null || status.getIsOnline()==0){return AjaxResult.error("设备已离线,不能更新状态。");}
public AjaxResult edit(@RequestBody IotDeviceSet iotDeviceSet) {
IotDeviceStatus status = iotDeviceStatusService.selectIotDeviceStatusByDeviceId(iotDeviceSet.getDeviceId());
if (status == null || status.getIsOnline() == 0) {
return AjaxResult.error("设备已离线,不能更新状态。");
}
// 存储
iotDeviceSetService.updateIotDeviceSet(iotDeviceSet);
//mqtt发布
IotDeviceSet set=iotDeviceSetService.selectIotDeviceSetByDeviceId(iotDeviceSet.getDeviceId());
if(iotDeviceSet.getIsRadar()!=null){
IotDeviceSet set = iotDeviceSetService.selectIotDeviceSetByDeviceId(iotDeviceSet.getDeviceId());
if (iotDeviceSet.getIsRadar() != null) {
set.setIsRadar(iotDeviceSet.getIsRadar());
}
if(iotDeviceSet.getIsAlarm()!=null){
if (iotDeviceSet.getIsAlarm() != null) {
set.setIsAlarm(iotDeviceSet.getIsAlarm());
}
if(iotDeviceSet.getRadarInterval()!=null){
if (iotDeviceSet.getRadarInterval() != null) {
set.setRadarInterval(iotDeviceSet.getRadarInterval());
}
if(iotDeviceSet.getIsRfControl()!=null){
if (iotDeviceSet.getIsRfControl() != null) {
set.setIsRfControl(iotDeviceSet.getIsRfControl());
}
if(iotDeviceSet.getRfOneFunc()!=null){
if (iotDeviceSet.getRfOneFunc() != null) {
set.setRfOneFunc(iotDeviceSet.getRfOneFunc());
}
if(iotDeviceSet.getRfTwoFunc()!=null){
if (iotDeviceSet.getRfTwoFunc() != null) {
set.setRfTwoFunc(iotDeviceSet.getRfTwoFunc());
}
if(iotDeviceSet.getRfThreeFunc()!=null){
if (iotDeviceSet.getRfThreeFunc() != null) {
set.setRfThreeFunc(iotDeviceSet.getRfThreeFunc());
}
if(iotDeviceSet.getRfFourFunc()!=null){
if (iotDeviceSet.getRfFourFunc() != null) {
set.setRfFourFunc(iotDeviceSet.getRfFourFunc());
}
if(iotDeviceSet.getIsRfLearn()!=null){
if (iotDeviceSet.getIsRfLearn() != null) {
set.setIsRfLearn(iotDeviceSet.getIsRfLearn());
}
if(iotDeviceSet.getIsRfClear()!=null){
if (iotDeviceSet.getIsRfClear() != null) {
set.setIsRfClear(iotDeviceSet.getIsRfClear());
}
if(iotDeviceSet.getIsAp()!=null){
if (iotDeviceSet.getIsAp() != null) {
set.setIsAp(iotDeviceSet.getIsAp());
}
if(iotDeviceSet.getIsReset()!=null){
if (iotDeviceSet.getIsReset() != null) {
set.setIsReset(iotDeviceSet.getIsReset());
}
String content = JSON.toJSONString(set);
boolean isSuccess=mqttPushClient.publish(0,true,"setting/set/"+set.getDeviceNum(),content);
if(isSuccess){return AjaxResult.success("mqtt 发布成功");}
boolean isSuccess = mqttPushClient.publish(0, true, "setting/set/" + set.getDeviceNum(), content);
if (isSuccess) {
return AjaxResult.success("mqtt 发布成功");
}
return AjaxResult.error("mqtt 发布失败。");
}
@ApiOperation(value = "mqtt获取设备配置", notes = "mqtt获取设备配置")
@GetMapping(value = "/getSetting/{deviceNum}")
public AjaxResult getSetting(@PathVariable("deviceNum") String deviceNum){
boolean isSuccess=mqttPushClient.publish(0,true,"setting/get/"+deviceNum,"wumei.live");
if(isSuccess){return AjaxResult.success("mqtt 发布成功");}
public AjaxResult getSetting(@PathVariable("deviceNum") String deviceNum) {
boolean isSuccess = mqttPushClient.publish(0, true, "setting/get/" + deviceNum, "wumei.live");
if (isSuccess) {
return AjaxResult.success("mqtt 发布成功");
}
return AjaxResult.error("mqtt 发布失败。");
}
@@ -216,9 +215,8 @@ public class IotDeviceSetController extends BaseController
@ApiOperation(value = "删除设备配置", notes = "删除设备配置")
@PreAuthorize("@ss.hasPermi('system:set:remove')")
@Log(title = "设备配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{deviceSetIds}")
public AjaxResult remove(@PathVariable Long[] deviceSetIds)
{
@DeleteMapping("/{deviceSetIds}")
public AjaxResult remove(@PathVariable Long[] deviceSetIds) {
return toAjax(iotDeviceSetService.deleteIotDeviceSetByIds(deviceSetIds));
}
}

View File

@@ -40,15 +40,14 @@ import com.ruoyi.common.core.page.TableDataInfo;
/**
* 设备状态Controller
*
*
* @author kerwincui
* @date 2021-05-06
*/
@Api(value="设备状态",tags="设备状态")
@Api(value = "设备状态", tags = "设备状态")
@RestController
@RequestMapping("/system/status")
public class IotDeviceStatusController extends BaseController
{
public class IotDeviceStatusController extends BaseController {
@Autowired
private IIotDeviceStatusService iotDeviceStatusService;
@Autowired
@@ -63,8 +62,7 @@ public class IotDeviceStatusController extends BaseController
@ApiOperation(value = "查询设备状态列表", notes = "查询设备状态列表")
@PreAuthorize("@ss.hasPermi('system:status:list')")
@GetMapping("/list")
public TableDataInfo list(IotDeviceStatus iotDeviceStatus)
{
public TableDataInfo list(IotDeviceStatus iotDeviceStatus) {
startPage();
List<IotDeviceStatus> list = iotDeviceStatusService.selectIotDeviceStatusList(iotDeviceStatus);
return getDataTable(list);
@@ -77,8 +75,7 @@ public class IotDeviceStatusController extends BaseController
@PreAuthorize("@ss.hasPermi('system:status:export')")
@Log(title = "设备状态", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(IotDeviceStatus iotDeviceStatus)
{
public AjaxResult export(IotDeviceStatus iotDeviceStatus) {
List<IotDeviceStatus> list = iotDeviceStatusService.selectIotDeviceStatusList(iotDeviceStatus);
ExcelUtil<IotDeviceStatus> util = new ExcelUtil<IotDeviceStatus>(IotDeviceStatus.class);
return util.exportExcel(list, "status");
@@ -90,8 +87,7 @@ public class IotDeviceStatusController extends BaseController
@ApiOperation(value = "获取设备状态详情", notes = "获取设备状态详情")
@PreAuthorize("@ss.hasPermi('system:status:query')")
@GetMapping(value = "/{deviceStatusId}")
public AjaxResult getInfo(@PathVariable("deviceStatusId") Long deviceStatusId)
{
public AjaxResult getInfo(@PathVariable("deviceStatusId") Long deviceStatusId) {
return AjaxResult.success(iotDeviceStatusService.selectIotDeviceStatusById(deviceStatusId));
}
@@ -101,8 +97,7 @@ public class IotDeviceStatusController extends BaseController
@ApiOperation(value = "根据设备编号获取最新设备状态", notes = "根据设备编号获取最新设备状态")
@PreAuthorize("@ss.hasPermi('system:status:query')")
@GetMapping(value = "/newByNum/{deviceNum}")
public AjaxResult getNewStatus(@PathVariable("deviceNum") String deviceNum)
{
public AjaxResult getNewStatus(@PathVariable("deviceNum") String deviceNum) {
return AjaxResult.success(iotDeviceStatusService.selectIotDeviceStatusByDeviceNum(deviceNum));
}
@@ -112,14 +107,13 @@ public class IotDeviceStatusController extends BaseController
@ApiOperation(value = "获取最新设备状态详情", notes = "获取最新设备状态详情")
@PreAuthorize("@ss.hasPermi('system:status:query')")
@GetMapping(value = "/new/{deviceId}")
public AjaxResult getNewInfo(@PathVariable("deviceId") Long deviceId)
{
IotDeviceStatus status=iotDeviceStatusService.selectIotDeviceStatusByDeviceId(deviceId);
if(status==null){
public AjaxResult getNewInfo(@PathVariable("deviceId") Long deviceId) {
IotDeviceStatus status = iotDeviceStatusService.selectIotDeviceStatusByDeviceId(deviceId);
if (status == null) {
// 构建默认数据
IotDevice device=iotDeviceService.selectIotDeviceById(deviceId);
if(device!=null) {
status=new IotDeviceStatus();
IotDevice device = iotDeviceService.selectIotDeviceById(deviceId);
if (device != null) {
status = new IotDeviceStatus();
status.setDeviceId(device.getDeviceId());
status.setDeviceNum(device.getDeviceNum());
status.setRelayStatus(0);
@@ -146,8 +140,7 @@ public class IotDeviceStatusController extends BaseController
@PreAuthorize("@ss.hasPermi('system:status:add')")
@Log(title = "设备状态", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody IotDeviceStatus iotDeviceStatus)
{
public AjaxResult add(@RequestBody IotDeviceStatus iotDeviceStatus) {
return toAjax(iotDeviceStatusService.insertIotDeviceStatus(iotDeviceStatus));
}
@@ -158,53 +151,58 @@ public class IotDeviceStatusController extends BaseController
@PreAuthorize("@ss.hasPermi('system:status:edit')")
@Log(title = "设备状态", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody IotDeviceStatus iotDeviceStatus)
{
IotDeviceStatus status=iotDeviceStatusService.selectIotDeviceStatusByDeviceId(iotDeviceStatus.getDeviceId());
if(status==null || status.getIsOnline()==0){return AjaxResult.error("设备已离线,不能更新状态。");}
public AjaxResult edit(@RequestBody IotDeviceStatus iotDeviceStatus) {
IotDeviceStatus status = iotDeviceStatusService.selectIotDeviceStatusByDeviceId(iotDeviceStatus.getDeviceId());
if (status == null || status.getIsOnline() == 0) {
return AjaxResult.error("设备已离线,不能更新状态。");
}
// 存储
iotDeviceStatusService.updateIotDeviceStatus(iotDeviceStatus);
// mqtt发布
if(iotDeviceStatus.getRelayStatus()!=null){
if (iotDeviceStatus.getRelayStatus() != null) {
status.setRelayStatus(iotDeviceStatus.getRelayStatus());
}
if(iotDeviceStatus.getLightStatus()!=null){
if (iotDeviceStatus.getLightStatus() != null) {
status.setLightStatus(iotDeviceStatus.getLightStatus());
}
if(iotDeviceStatus.getLightMode()!=null){
if (iotDeviceStatus.getLightMode() != null) {
status.setLightMode(iotDeviceStatus.getLightMode());
}
if(iotDeviceStatus.getLightInterval()!=null){
if (iotDeviceStatus.getLightInterval() != null) {
status.setLightInterval(iotDeviceStatus.getLightInterval());
}
if(iotDeviceStatus.getFadeTime()!=null){
if (iotDeviceStatus.getFadeTime() != null) {
status.setFadeTime(iotDeviceStatus.getFadeTime());
}
if(iotDeviceStatus.getBrightness()!=null){
if (iotDeviceStatus.getBrightness() != null) {
status.setBrightness(iotDeviceStatus.getBrightness());
}
if(iotDeviceStatus.getRed()!=null){
if (iotDeviceStatus.getRed() != null) {
status.setRed(iotDeviceStatus.getRed());
}
if(iotDeviceStatus.getGreen()!=null){
if (iotDeviceStatus.getGreen() != null) {
status.setGreen(iotDeviceStatus.getGreen());
}
if(iotDeviceStatus.getBlue()!=null){
if (iotDeviceStatus.getBlue() != null) {
status.setBlue(iotDeviceStatus.getBlue());
}
String content = JSON.toJSONString(status);
boolean isSuccess=mqttPushClient.publish(1,true,"status/set/"+status.getDeviceNum(),content);
if(isSuccess){return AjaxResult.success("mqtt 发布成功");}
boolean isSuccess = mqttPushClient.publish(1, true, "status/set/" + status.getDeviceNum(), content);
if (isSuccess) {
return AjaxResult.success("mqtt 发布成功");
}
return AjaxResult.error("mqtt 发布失败。");
}
@ApiOperation(value = "mqtt获取设备状态", notes = "mqtt获取设备状态")
@GetMapping(value = "/getStatus/{deviceNum}")
public AjaxResult getStatus(@PathVariable("deviceNum") String deviceNum){
boolean isSuccess=mqttPushClient.publish(0,true,"status/get/"+deviceNum,"wumei.live");
if(isSuccess){return AjaxResult.success("mqtt 发布成功");}
public AjaxResult getStatus(@PathVariable("deviceNum") String deviceNum) {
boolean isSuccess = mqttPushClient.publish(0, true, "status/get/" + deviceNum, "wumei.live");
if (isSuccess) {
return AjaxResult.success("mqtt 发布成功");
}
return AjaxResult.error("mqtt 发布失败。");
}
@@ -214,9 +212,8 @@ public class IotDeviceStatusController extends BaseController
@ApiOperation(value = "删除设备状态", notes = "删除设备状态")
@PreAuthorize("@ss.hasPermi('system:status:remove')")
@Log(title = "设备状态", businessType = BusinessType.DELETE)
@DeleteMapping("/{deviceStatusIds}")
public AjaxResult remove(@PathVariable Long[] deviceStatusIds)
{
@DeleteMapping("/{deviceStatusIds}")
public AjaxResult remove(@PathVariable Long[] deviceStatusIds) {
return toAjax(iotDeviceStatusService.deleteIotDeviceStatusByIds(deviceStatusIds));
}
}

View File

@@ -0,0 +1,97 @@
package com.ruoyi.system.controller;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.IotDeviceUserRelation;
import com.ruoyi.system.service.IIotDeviceUserRelationService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 【请填写功能名称】Controller
*
* @author wxy
* @date 2021-08-27
*/
@RestController
@RequestMapping("/system/relation")
public class IotDeviceUserRelationController extends BaseController {
@Autowired
private IIotDeviceUserRelationService iotDeviceUserRelationService;
/**
* 查询【请填写功能名称】列表
*/
@PreAuthorize("@ss.hasPermi('system:relation:list')")
@GetMapping("/list")
public TableDataInfo list(IotDeviceUserRelation iotDeviceUserRelation) {
startPage();
List<IotDeviceUserRelation> list = iotDeviceUserRelationService.selectIotDeviceUserRelationList(iotDeviceUserRelation);
return getDataTable(list);
}
/**
* 导出【请填写功能名称】列表
*/
@PreAuthorize("@ss.hasPermi('system:relation:export')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(IotDeviceUserRelation iotDeviceUserRelation) {
List<IotDeviceUserRelation> list = iotDeviceUserRelationService.selectIotDeviceUserRelationList(iotDeviceUserRelation);
ExcelUtil<IotDeviceUserRelation> util = new ExcelUtil<IotDeviceUserRelation>(IotDeviceUserRelation. class);
return util.exportExcel(list, "relation");
}
/**
* 获取【请填写功能名称】详细信息
*/
@PreAuthorize("@ss.hasPermi('system:relation:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(iotDeviceUserRelationService.selectIotDeviceUserRelationById(id));
}
/**
* 新增【请填写功能名称】
*/
@PreAuthorize("@ss.hasPermi('system:relation:add')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody IotDeviceUserRelation iotDeviceUserRelation) {
return toAjax(iotDeviceUserRelationService.insertIotDeviceUserRelation(iotDeviceUserRelation));
}
/**
* 修改【请填写功能名称】
*/
@PreAuthorize("@ss.hasPermi('system:relation:edit')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody IotDeviceUserRelation iotDeviceUserRelation) {
return toAjax(iotDeviceUserRelationService.updateIotDeviceUserRelation(iotDeviceUserRelation));
}
/**
* 删除【请填写功能名称】
*/
@PreAuthorize("@ss.hasPermi('system:relation:remove')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(iotDeviceUserRelationService.deleteIotDeviceUserRelationByIds(ids));
}
}

View File

@@ -35,15 +35,14 @@ import com.ruoyi.common.core.page.TableDataInfo;
/**
* 分组Controller
*
*
* @author kerwincui
* @date 2021-05-18
*/
@Api(value="设备分组",tags="设备分组")
@Api(value = "设备分组", tags = "设备分组")
@RestController
@RequestMapping("/system/group")
public class IotGroupController extends BaseController
{
public class IotGroupController extends BaseController {
@Autowired
private IIotGroupService iotGroupService;
@@ -53,8 +52,7 @@ public class IotGroupController extends BaseController
@ApiOperation(value = "分组列表", notes = "分组列表")
@PreAuthorize("@ss.hasPermi('system:group:list')")
@GetMapping("/list")
public TableDataInfo list(IotGroup iotGroup)
{
public TableDataInfo list(IotGroup iotGroup) {
startPage();
List<IotGroup> list = iotGroupService.selectIotGroupList(iotGroup);
return getDataTable(list);
@@ -67,8 +65,7 @@ public class IotGroupController extends BaseController
@PreAuthorize("@ss.hasPermi('system:group:export')")
@Log(title = "分组", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(IotGroup iotGroup)
{
public AjaxResult export(IotGroup iotGroup) {
List<IotGroup> list = iotGroupService.selectIotGroupList(iotGroup);
ExcelUtil<IotGroup> util = new ExcelUtil<IotGroup>(IotGroup.class);
return util.exportExcel(list, "group");
@@ -80,8 +77,7 @@ public class IotGroupController extends BaseController
@ApiOperation(value = "获取分组详情", notes = "获取分组详情")
@PreAuthorize("@ss.hasPermi('system:group:query')")
@GetMapping(value = "/{groupId}")
public AjaxResult getInfo(@PathVariable("groupId") Long groupId)
{
public AjaxResult getInfo(@PathVariable("groupId") Long groupId) {
return AjaxResult.success(iotGroupService.selectIotGroupById(groupId));
}
@@ -92,8 +88,7 @@ public class IotGroupController extends BaseController
@PreAuthorize("@ss.hasPermi('system:group:add')")
@Log(title = "分组", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody IotGroup iotGroup)
{
public AjaxResult add(@RequestBody IotGroup iotGroup) {
return toAjax(iotGroupService.insertIotGroup(iotGroup));
}
@@ -104,8 +99,7 @@ public class IotGroupController extends BaseController
@PreAuthorize("@ss.hasPermi('system:group:edit')")
@Log(title = "分组", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody IotGroup iotGroup)
{
public AjaxResult edit(@RequestBody IotGroup iotGroup) {
return toAjax(iotGroupService.updateIotGroup(iotGroup));
}
@@ -115,9 +109,8 @@ public class IotGroupController extends BaseController
@ApiOperation(value = "删除分组", notes = "删除分组")
@PreAuthorize("@ss.hasPermi('system:group:remove')")
@Log(title = "分组", businessType = BusinessType.DELETE)
@DeleteMapping("/{groupIds}")
public AjaxResult remove(@PathVariable Long[] groupIds)
{
@DeleteMapping("/{groupIds}")
public AjaxResult remove(@PathVariable Long[] groupIds) {
return toAjax(iotGroupService.deleteIotGroupByIds(groupIds));
}
}

View File

@@ -22,16 +22,13 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
/**
* mqtt接口
*
*/
@Api(value="mqtt消息发布",tags="mqtt消息发布")
@Api(value = "mqtt消息发布", tags = "mqtt消息发布")
@RestController
@RequestMapping("/system/mqtt")
public class MqttController extends BaseController
{
public class MqttController extends BaseController {
// @Autowired
// private MqttPushClient mqttPushClient;
//

View File

@@ -0,0 +1,97 @@
package com.ruoyi.system.controller;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TUserAccountInfo;
import com.ruoyi.system.service.ITUserAccountInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 小程序用户Controller
*
* @author wxy
* @date 2021-08-26
*/
@RestController
@RequestMapping("/system/info")
public class TUserAccountInfoController extends BaseController {
@Autowired
private ITUserAccountInfoService tUserAccountInfoService;
/**
* 查询小程序用户列表
*/
@PreAuthorize("@ss.hasPermi('system:info:list')")
@GetMapping("/list")
public TableDataInfo list(TUserAccountInfo tUserAccountInfo) {
startPage();
List<TUserAccountInfo> list = tUserAccountInfoService.selectTUserAccountInfoList(tUserAccountInfo);
return getDataTable(list);
}
/**
* 导出小程序用户列表
*/
@PreAuthorize("@ss.hasPermi('system:info:export')")
@Log(title = "小程序用户", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TUserAccountInfo tUserAccountInfo) {
List<TUserAccountInfo> list = tUserAccountInfoService.selectTUserAccountInfoList(tUserAccountInfo);
ExcelUtil<TUserAccountInfo> util = new ExcelUtil<TUserAccountInfo>(TUserAccountInfo.class);
return util.exportExcel(list, "info");
}
/**
* 获取小程序用户详细信息
*/
@PreAuthorize("@ss.hasPermi('system:info:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(tUserAccountInfoService.selectTUserAccountInfoById(id));
}
/**
* 新增小程序用户
*/
@PreAuthorize("@ss.hasPermi('system:info:add')")
@Log(title = "小程序用户", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TUserAccountInfo tUserAccountInfo) {
return toAjax(tUserAccountInfoService.insertTUserAccountInfo(tUserAccountInfo));
}
/**
* 修改小程序用户
*/
@PreAuthorize("@ss.hasPermi('system:info:edit')")
@Log(title = "小程序用户", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TUserAccountInfo tUserAccountInfo) {
return toAjax(tUserAccountInfoService.updateTUserAccountInfo(tUserAccountInfo));
}
/**
* 删除小程序用户
*/
@PreAuthorize("@ss.hasPermi('system:info:remove')")
@Log(title = "小程序用户", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(tUserAccountInfoService.deleteTUserAccountInfoByIds(ids));
}
}

View File

@@ -0,0 +1,97 @@
package com.ruoyi.system.controller;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TUserLoginLog;
import com.ruoyi.system.service.ITUserLoginLogService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 【请填写功能名称】Controller
*
* @author wxy
* @date 2021-08-26
*/
@RestController
@RequestMapping("/system/log")
public class TUserLoginLogController extends BaseController {
@Autowired
private ITUserLoginLogService tUserLoginLogService;
/**
* 查询【请填写功能名称】列表
*/
@PreAuthorize("@ss.hasPermi('system:log:list')")
@GetMapping("/list")
public TableDataInfo list(TUserLoginLog tUserLoginLog) {
startPage();
List<TUserLoginLog> list = tUserLoginLogService.selectTUserLoginLogList(tUserLoginLog);
return getDataTable(list);
}
/**
* 导出【请填写功能名称】列表
*/
@PreAuthorize("@ss.hasPermi('system:log:export')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TUserLoginLog tUserLoginLog) {
List<TUserLoginLog> list = tUserLoginLogService.selectTUserLoginLogList(tUserLoginLog);
ExcelUtil<TUserLoginLog> util = new ExcelUtil<TUserLoginLog>(TUserLoginLog.class);
return util.exportExcel(list, "log");
}
/**
* 获取【请填写功能名称】详细信息
*/
@PreAuthorize("@ss.hasPermi('system:log:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(tUserLoginLogService.selectTUserLoginLogById(id));
}
/**
* 新增【请填写功能名称】
*/
@PreAuthorize("@ss.hasPermi('system:log:add')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TUserLoginLog tUserLoginLog) {
return toAjax(tUserLoginLogService.insertTUserLoginLog(tUserLoginLog));
}
/**
* 修改【请填写功能名称】
*/
@PreAuthorize("@ss.hasPermi('system:log:edit')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TUserLoginLog tUserLoginLog) {
return toAjax(tUserLoginLogService.updateTUserLoginLog(tUserLoginLog));
}
/**
* 删除【请填写功能名称】
*/
@PreAuthorize("@ss.hasPermi('system:log:remove')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(tUserLoginLogService.deleteTUserLoginLogByIds(ids));
}
}

View File

@@ -17,63 +17,64 @@ import com.ruoyi.common.core.domain.BaseEntity;
/**
* 设备分类对象 iot_category
*
*
* @author kerwincui
* @date 2021-05-07
*/
public class IotCategory extends BaseEntity
{
public class IotCategory extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 序号 */
/**
* 序号
*/
private Long categoryId;
/** 分类名称 */
/**
* 分类名称
*/
@Excel(name = "分类名称")
private String categoryName;
/** 删除标志0代表存在 2代表删除 */
/**
* 删除标志0代表存在 2代表删除
*/
private String delFlag;
public void setCategoryId(Long categoryId)
{
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public Long getCategoryId()
{
public Long getCategoryId() {
return categoryId;
}
public void setCategoryName(String categoryName)
{
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public String getCategoryName()
{
public String getCategoryName() {
return categoryName;
}
public void setDelFlag(String delFlag)
{
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag()
{
public String getDelFlag() {
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("categoryId", getCategoryId())
.append("categoryName", getCategoryName())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("categoryId", getCategoryId())
.append("categoryName", getCategoryName())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -19,150 +19,178 @@ import java.math.BigDecimal;
/**
* 设备对象 iot_device
*
*
* @author kerwincui
* @date 2021-05-06
*/
public class IotDevice extends BaseEntity
{
public class IotDevice extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 序号 */
/**
* 序号
*/
private Long deviceId;
/** 编号 */
/**
* 编号
*/
@Excel(name = "编号")
private String deviceNum;
/** 分类 */
/**
* 分类
*/
@Excel(name = "分类")
private Long categoryId;
/** 分类名称 */
/**
* 分类名称
*/
@Excel(name = "分类名称")
private String categoryName;
/** 分类名称 */
/**
* 分类名称
*/
@Excel(name = "分类名称")
private BigDecimal deviceTemp;
/** 名称 */
/**
* 名称
*/
@Excel(name = "名称")
private String deviceName;
/** 固件版本 */
/**
* 固件版本
*/
@Excel(name = "固件版本")
private String firmwareVersion;
/** 用户 */
/** 设备状态:未激活,未绑定,已绑定 */
@Excel(name = "设备状态:未激活,未绑定,已绑定")
private String status;
/**
* 用户
*/
@Excel(name = "用户")
private String ownerId;
/** 分组ID */
/**
* 分组ID
*/
private Long groupId;
/** 删除标志0代表存在 2代表删除 */
/**
* 删除标志0代表存在 2代表删除
*/
private String delFlag;
public void setDeviceId(Long deviceId)
{
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public Long getDeviceId()
{
public Long getDeviceId() {
return deviceId;
}
public void setDeviceNum(String deviceNum)
{
public void setDeviceNum(String deviceNum) {
this.deviceNum = deviceNum;
}
public String getDeviceNum()
{
public String getDeviceNum() {
return deviceNum;
}
public void setCategoryId(Long categoryId)
{
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public Long getCategoryId()
{
public Long getCategoryId() {
return categoryId;
}
public void setDeviceName(String deviceName)
{
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceName()
{
public String getDeviceName() {
return deviceName;
}
public void setFirmwareVersion(String firmwareVersion)
{
public void setFirmwareVersion(String firmwareVersion) {
this.firmwareVersion = firmwareVersion;
}
public String getFirmwareVersion()
{
public String getFirmwareVersion() {
return firmwareVersion;
}
public void setOwnerId(String ownerId)
{
public void setOwnerId(String ownerId) {
this.ownerId = ownerId;
}
public String getOwnerId()
{
public String getOwnerId() {
return ownerId;
}
public void setDelFlag(String delFlag)
{
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag()
{
public void setStatus(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
public String getDelFlag() {
return delFlag;
}
public Long getGroupId()
{
public Long getGroupId() {
return groupId;
}
public void setGroupId(Long groupId)
{
public void setGroupId(Long groupId) {
this.groupId = groupId;
}
public void setDeviceTemp(BigDecimal deviceTemp)
{
public void setDeviceTemp(BigDecimal deviceTemp) {
this.deviceTemp = deviceTemp;
}
public BigDecimal getDeviceTemp()
{
public BigDecimal getDeviceTemp() {
return deviceTemp;
}
public void setCategoryName(String categoryName)
{
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public String getCategoryName()
{
public String getCategoryName() {
return categoryName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("deviceId", getDeviceId())
.append("deviceNum", getDeviceNum())
.append("categoryName", getCategoryName())
.append("deviceTemp", getDeviceTemp())
.append("categoryId", getCategoryId())
.append("groupId", getGroupId())
.append("deviceName", getDeviceName())
.append("firmwareVersion", getFirmwareVersion())
.append("ownerId", getOwnerId())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("deviceId", getDeviceId())
.append("deviceNum", getDeviceNum())
.append("categoryName", getCategoryName())
.append("deviceTemp", getDeviceTemp())
.append("categoryId", getCategoryId())
.append("groupId", getGroupId())
.append("deviceName", getDeviceName())
.append("firmwareVersion", getFirmwareVersion())
.append("ownerId", getOwnerId())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -17,343 +17,362 @@ import com.ruoyi.common.core.domain.BaseEntity;
/**
* 设备配置对象 iot_device_set
*
*
* @author kerwincui
* @date 2021-05-06
*/
public class IotDeviceSet extends BaseEntity
{
public class IotDeviceSet extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 序号 */
/**
* 序号
*/
private Long deviceSetId;
/** 设备 */
/**
* 设备
*/
@Excel(name = "设备")
private Long deviceId;
/** 设备编号 */
/**
* 设备编号
*/
@Excel(name = "设备编号")
private String deviceNum;
/** 报警 */
/**
* 报警
*/
@Excel(name = "报警")
private Integer isAlarm;
/** 雷达感应 */
/**
* 雷达感应
*/
@Excel(name = "雷达感应")
private Integer isRadar;
/** 托管 */
/**
* 托管
*/
@Excel(name = "托管")
private Integer isHost;
/** 重启 */
/**
* 重启
*/
@Excel(name = "重启")
private Integer isReset;
/** 打开AP */
/**
* 打开AP
*/
@Excel(name = "打开AP")
private Integer isAp;
/** 是否离线使用 */
/**
* 是否离线使用
*/
@Excel(name = "是否离线使用")
private Integer isWifiOffline;
/** 是否使用证书 */
/**
* 是否使用证书
*/
@Excel(name = "是否使用证书")
private Integer isOpenCertifi;
/** 智能配网 */
/**
* 智能配网
*/
@Excel(name = "智能配网")
private Integer isSmartConfig;
/** 射频遥控 */
/**
* 射频遥控
*/
@Excel(name = "射频遥控")
private Integer isRfControl;
/** 遥控配对 */
/**
* 遥控配对
*/
@Excel(name = "遥控配对")
private Integer isRfLearn;
/** 遥控清码 */
/**
* 遥控清码
*/
@Excel(name = "遥控清码")
private Integer isRfClear;
/** 按键一 */
/**
* 按键一
*/
@Excel(name = "按键一")
private Integer rfOneFunc;
/** 按键二 */
/**
* 按键二
*/
@Excel(name = "按键二")
private Integer rfTwoFunc;
/** 按键三 */
/**
* 按键三
*/
@Excel(name = "按键三")
private Integer rfThreeFunc;
/** 按键四 */
/**
* 按键四
*/
@Excel(name = "按键四")
private Integer rfFourFunc;
/** 用户 */
/**
* 用户
*/
@Excel(name = "用户")
private String ownerId;
/** 配网地址 */
/**
* 配网地址
*/
@Excel(name = "配网地址")
private String networkAddress;
/** 配网IP */
/**
* 配网IP
*/
@Excel(name = "配网IP")
private String networkIp;
/** 雷达感应间隔 */
/**
* 雷达感应间隔
*/
@Excel(name = "雷达感应间隔")
private Integer radarInterval;
/** 删除标志0代表存在 2代表删除 */
/**
* 删除标志0代表存在 2代表删除
*/
private String delFlag;
public void setDeviceSetId(Long deviceSetId)
{
public void setDeviceSetId(Long deviceSetId) {
this.deviceSetId = deviceSetId;
}
public Long getDeviceSetId()
{
public Long getDeviceSetId() {
return deviceSetId;
}
public void setDeviceId(Long deviceId)
{
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public Long getDeviceId()
{
public Long getDeviceId() {
return deviceId;
}
public void setDeviceNum(String deviceNum)
{
public void setDeviceNum(String deviceNum) {
this.deviceNum = deviceNum;
}
public String getDeviceNum()
{
public String getDeviceNum() {
return deviceNum;
}
public void setIsAlarm(Integer isAlarm)
{
public void setIsAlarm(Integer isAlarm) {
this.isAlarm = isAlarm;
}
public Integer getIsAlarm()
{
public Integer getIsAlarm() {
return isAlarm;
}
public void setIsRadar(Integer isRadar)
{
public void setIsRadar(Integer isRadar) {
this.isRadar = isRadar;
}
public Integer getIsRadar()
{
public Integer getIsRadar() {
return isRadar;
}
public void setIsHost(Integer isHost)
{
public void setIsHost(Integer isHost) {
this.isHost = isHost;
}
public Integer getIsHost()
{
public Integer getIsHost() {
return isHost;
}
public void setIsReset(Integer isReset)
{
public void setIsReset(Integer isReset) {
this.isReset = isReset;
}
public Integer getIsReset()
{
public Integer getIsReset() {
return isReset;
}
public void setIsAp(Integer isAp)
{
public void setIsAp(Integer isAp) {
this.isAp = isAp;
}
public Integer getIsAp()
{
public Integer getIsAp() {
return isAp;
}
public void setIsWifiOffline(Integer isWifiOffline)
{
public void setIsWifiOffline(Integer isWifiOffline) {
this.isWifiOffline = isWifiOffline;
}
public Integer getIsWifiOffline()
{
public Integer getIsWifiOffline() {
return isWifiOffline;
}
public void setIsOpenCertifi(Integer isOpenCertifi)
{
public void setIsOpenCertifi(Integer isOpenCertifi) {
this.isOpenCertifi = isOpenCertifi;
}
public Integer getIsOpenCertifi()
{
public Integer getIsOpenCertifi() {
return isOpenCertifi;
}
public void setIsSmartConfig(Integer isSmartConfig)
{
public void setIsSmartConfig(Integer isSmartConfig) {
this.isSmartConfig = isSmartConfig;
}
public Integer getIsSmartConfig()
{
public Integer getIsSmartConfig() {
return isSmartConfig;
}
public void setIsRfControl(Integer isRfControl)
{
public void setIsRfControl(Integer isRfControl) {
this.isRfControl = isRfControl;
}
public Integer getIsRfControl()
{
public Integer getIsRfControl() {
return isRfControl;
}
public void setIsRfLearn(Integer isRfLearn)
{
public void setIsRfLearn(Integer isRfLearn) {
this.isRfLearn = isRfLearn;
}
public Integer getIsRfLearn()
{
public Integer getIsRfLearn() {
return isRfLearn;
}
public void setIsRfClear(Integer isRfClear)
{
public void setIsRfClear(Integer isRfClear) {
this.isRfClear = isRfClear;
}
public Integer getIsRfClear()
{
public Integer getIsRfClear() {
return isRfClear;
}
public void setRfOneFunc(Integer rfOneFunc)
{
public void setRfOneFunc(Integer rfOneFunc) {
this.rfOneFunc = rfOneFunc;
}
public Integer getRfOneFunc()
{
public Integer getRfOneFunc() {
return rfOneFunc;
}
public void setRfTwoFunc(Integer rfTwoFunc)
{
public void setRfTwoFunc(Integer rfTwoFunc) {
this.rfTwoFunc = rfTwoFunc;
}
public Integer getRfTwoFunc()
{
public Integer getRfTwoFunc() {
return rfTwoFunc;
}
public void setRfThreeFunc(Integer rfThreeFunc)
{
public void setRfThreeFunc(Integer rfThreeFunc) {
this.rfThreeFunc = rfThreeFunc;
}
public Integer getRfThreeFunc()
{
public Integer getRfThreeFunc() {
return rfThreeFunc;
}
public void setRfFourFunc(Integer rfFourFunc)
{
public void setRfFourFunc(Integer rfFourFunc) {
this.rfFourFunc = rfFourFunc;
}
public Integer getRfFourFunc()
{
public Integer getRfFourFunc() {
return rfFourFunc;
}
public void setOwnerId(String ownerId)
{
public void setOwnerId(String ownerId) {
this.ownerId = ownerId;
}
public String getOwnerId()
{
public String getOwnerId() {
return ownerId;
}
public void setNetworkAddress(String networkAddress)
{
public void setNetworkAddress(String networkAddress) {
this.networkAddress = networkAddress;
}
public String getNetworkAddress()
{
public String getNetworkAddress() {
return networkAddress;
}
public void setNetworkIp(String networkIp)
{
public void setNetworkIp(String networkIp) {
this.networkIp = networkIp;
}
public String getNetworkIp()
{
public String getNetworkIp() {
return networkIp;
}
public void setDelFlag(String delFlag)
{
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public void setRadarInterval(Integer radarInterval)
{
public void setRadarInterval(Integer radarInterval) {
this.radarInterval = radarInterval;
}
public Integer getRadarInterval()
{
public Integer getRadarInterval() {
return radarInterval;
}
public String getDelFlag()
{
public String getDelFlag() {
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("deviceSetId", getDeviceSetId())
.append("deviceId", getDeviceId())
.append("deviceNum", getDeviceNum())
.append("isAlarm", getIsAlarm())
.append("isRadar", getIsRadar())
.append("isHost", getIsHost())
.append("isReset", getIsReset())
.append("isAp", getIsAp())
.append("isSmartConfig", getIsSmartConfig())
.append("isRfControl", getIsRfControl())
.append("isRfLearn", getIsRfLearn())
.append("isRfClear", getIsRfClear())
.append("rfOneFunc", getRfOneFunc())
.append("rfTwoFunc", getRfTwoFunc())
.append("rfThreeFunc", getRfThreeFunc())
.append("rfFourFunc", getRfFourFunc())
.append("ownerId", getOwnerId())
.append("networkAddress", getNetworkAddress())
.append("networkIp", getNetworkIp())
.append("radarInterval", getRadarInterval())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("deviceSetId", getDeviceSetId())
.append("deviceId", getDeviceId())
.append("deviceNum", getDeviceNum())
.append("isAlarm", getIsAlarm())
.append("isRadar", getIsRadar())
.append("isHost", getIsHost())
.append("isReset", getIsReset())
.append("isAp", getIsAp())
.append("isSmartConfig", getIsSmartConfig())
.append("isRfControl", getIsRfControl())
.append("isRfLearn", getIsRfLearn())
.append("isRfClear", getIsRfClear())
.append("rfOneFunc", getRfOneFunc())
.append("rfTwoFunc", getRfTwoFunc())
.append("rfThreeFunc", getRfThreeFunc())
.append("rfFourFunc", getRfFourFunc())
.append("ownerId", getOwnerId())
.append("networkAddress", getNetworkAddress())
.append("networkIp", getNetworkIp())
.append("radarInterval", getRadarInterval())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -11,6 +11,7 @@
package com.ruoyi.system.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
@@ -18,287 +19,304 @@ import com.ruoyi.common.core.domain.BaseEntity;
/**
* 设备状态对象 iot_device_status
*
*
* @author kerwincui
* @date 2021-05-06
*/
public class IotDeviceStatus extends BaseEntity
{
public class IotDeviceStatus extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 序号 */
/**
* 序号
*/
private Long deviceStatusId;
/** 设备 */
/**
* 设备
*/
@Excel(name = "设备")
private Long deviceId;
/** 设备编号 */
/**
* 设备编号
*/
@Excel(name = "设备编号")
private String deviceNum;
/** 继电器 */
/**
* 继电器
*/
@Excel(name = "继电器")
private Integer relayStatus;
/** 灯状态 */
/**
* 灯状态
*/
@Excel(name = "灯状态")
private Integer lightStatus;
/** 在线 */
/**
* 在线
*/
@Excel(name = "在线")
private Integer isOnline;
/** 设备温度 */
/**
* 设备温度
*/
@Excel(name = "设备温度")
private BigDecimal deviceTemperature;
/** 设备湿度 */
/**
* 设备湿度
*/
@Excel(name = "信号")
private Integer rssi;
/** 空气温度 */
/**
* 空气温度
*/
@Excel(name = "空气温度")
private BigDecimal airTemperature;
/** 空气湿度 */
/**
* 空气湿度
*/
@Excel(name = "空气湿度")
private BigDecimal airHumidity;
/** 触发源 */
/**
* 触发源
*/
@Excel(name = "触发源")
private Integer triggerSource;
/** 彩灯亮度 */
/**
* 彩灯亮度
*/
@Excel(name = "彩灯亮度")
private Integer brightness;
/** 渐变间隔 */
/**
* 渐变间隔
*/
@Excel(name = "渐变间隔")
private Integer lightInterval;
/** 彩灯模式 */
/**
* 彩灯模式
*/
@Excel(name = "彩灯模式")
private Integer lightMode;
/** 灯渐变时间 */
/**
* 灯渐变时间
*/
@Excel(name = "渐变时间")
private Integer fadeTime;
/** 红灯 */
/**
* 红灯
*/
@Excel(name = "红灯")
private Long red;
/** 绿灯 */
/**
* 绿灯
*/
@Excel(name = "绿灯")
private Long green;
/** 蓝灯 */
/**
* 蓝灯
*/
@Excel(name = "蓝灯")
private Long blue;
/** 删除标志0代表存在 2代表删除 */
/**
* 删除标志0代表存在 2代表删除
*/
private String delFlag;
public void setDeviceStatusId(Long deviceStatusId)
{
public void setDeviceStatusId(Long deviceStatusId) {
this.deviceStatusId = deviceStatusId;
}
public Long getDeviceStatusId()
{
public Long getDeviceStatusId() {
return deviceStatusId;
}
public void setDeviceId(Long deviceId)
{
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public Long getDeviceId()
{
public Long getDeviceId() {
return deviceId;
}
public void setDeviceNum(String deviceNum)
{
public void setDeviceNum(String deviceNum) {
this.deviceNum = deviceNum;
}
public String getDeviceNum()
{
public String getDeviceNum() {
return deviceNum;
}
public void setRelayStatus(Integer relayStatus)
{
public void setRelayStatus(Integer relayStatus) {
this.relayStatus = relayStatus;
}
public Integer getRelayStatus()
{
public Integer getRelayStatus() {
return relayStatus;
}
public void setLightStatus(Integer lightStatus)
{
public void setLightStatus(Integer lightStatus) {
this.lightStatus = lightStatus;
}
public Integer getLightStatus()
{
public Integer getLightStatus() {
return lightStatus;
}
public void setIsOnline(Integer isOnline)
{
public void setIsOnline(Integer isOnline) {
this.isOnline = isOnline;
}
public Integer getIsOnline()
{
public Integer getIsOnline() {
return isOnline;
}
public void setDeviceTemperature(BigDecimal deviceTemperature)
{
public void setDeviceTemperature(BigDecimal deviceTemperature) {
this.deviceTemperature = deviceTemperature;
}
public BigDecimal getDeviceTemperature()
{
public BigDecimal getDeviceTemperature() {
return deviceTemperature;
}
public void setRssi(Integer rssi)
{
public void setRssi(Integer rssi) {
this.rssi = rssi;
}
public Integer getRssi()
{
public Integer getRssi() {
return rssi;
}
public void setAirTemperature(BigDecimal airTemperature)
{
public void setAirTemperature(BigDecimal airTemperature) {
this.airTemperature = airTemperature;
}
public BigDecimal getAirTemperature()
{
public BigDecimal getAirTemperature() {
return airTemperature;
}
public void setAirHumidity(BigDecimal airHumidity)
{
public void setAirHumidity(BigDecimal airHumidity) {
this.airHumidity = airHumidity;
}
public BigDecimal getAirHumidity()
{
public BigDecimal getAirHumidity() {
return airHumidity;
}
public void setTriggerSource(Integer triggerSource)
{
public void setTriggerSource(Integer triggerSource) {
this.triggerSource = triggerSource;
}
public Integer getTriggerSource()
{
public Integer getTriggerSource() {
return triggerSource;
}
public void setBrightness(Integer brightness)
{
public void setBrightness(Integer brightness) {
this.brightness = brightness;
}
public Integer getBrightness()
{
public Integer getBrightness() {
return brightness;
}
public void setLightInterval(Integer lightInterval)
{
public void setLightInterval(Integer lightInterval) {
this.lightInterval = lightInterval;
}
public Integer getLightInterval()
{
public Integer getLightInterval() {
return lightInterval;
}
public void setLightMode(Integer lightMode)
{
public void setLightMode(Integer lightMode) {
this.lightMode = lightMode;
}
public Integer getLightMode()
{
public Integer getLightMode() {
return lightMode;
}
public void setRed(Long red)
{
public void setRed(Long red) {
this.red = red;
}
public Long getRed()
{
public Long getRed() {
return red;
}
public void setGreen(Long green)
{
public void setGreen(Long green) {
this.green = green;
}
public Long getGreen()
{
public Long getGreen() {
return green;
}
public void setBlue(Long blue)
{
public void setBlue(Long blue) {
this.blue = blue;
}
public Long getBlue()
{
public Long getBlue() {
return blue;
}
public void setDelFlag(String delFlag)
{
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public void setFadeTime(Integer fadeTime)
{
public void setFadeTime(Integer fadeTime) {
this.fadeTime = fadeTime;
}
public Integer getFadeTime()
{
public Integer getFadeTime() {
return fadeTime;
}
public String getDelFlag()
{
public String getDelFlag() {
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("deviceStatusId", getDeviceStatusId())
.append("deviceId", getDeviceId())
.append("deviceNum", getDeviceNum())
.append("relayStatus", getRelayStatus())
.append("lightStatus", getLightStatus())
.append("isOnline", getIsOnline())
.append("deviceTemperature", getDeviceTemperature())
.append("rssid", getRssi())
.append("airTemperature", getAirTemperature())
.append("airHumidity", getAirHumidity())
.append("triggerSource", getTriggerSource())
.append("brightness", getBrightness())
.append("lightInterval", getLightInterval())
.append("lightMode", getLightMode())
.append("fadeTime", getFadeTime())
.append("red", getRed())
.append("green", getGreen())
.append("blue", getBlue())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("deviceStatusId", getDeviceStatusId())
.append("deviceId", getDeviceId())
.append("deviceNum", getDeviceNum())
.append("relayStatus", getRelayStatus())
.append("lightStatus", getLightStatus())
.append("isOnline", getIsOnline())
.append("deviceTemperature", getDeviceTemperature())
.append("rssid", getRssi())
.append("airTemperature", getAirTemperature())
.append("airHumidity", getAirHumidity())
.append("triggerSource", getTriggerSource())
.append("brightness", getBrightness())
.append("lightInterval", getLightInterval())
.append("lightMode", getLightMode())
.append("fadeTime", getFadeTime())
.append("red", getRed())
.append("green", getGreen())
.append("blue", getBlue())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -0,0 +1,136 @@
package com.ruoyi.system.domain;
import java.util.Date;
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;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 【请填写功能名称】对象 iot_device_user_relation
*
* @author wxy
* @date 2021-08-27
*/
public class IotDeviceUserRelation extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* $column.columnComment
*/
private Long id;
/**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long userId;
/**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long deviceId;
/**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String deviceNum;
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String deviceName;
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String remark;
/**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Date gmtTime;
/**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Date gmtUpdate;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getUserId() {
return userId;
}
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public Long getDeviceId() {
return deviceId;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceName() {
return deviceName;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public void setDeviceNum(String deviceNum) {
this.deviceNum = deviceNum;
}
public String getDeviceNum() {
return deviceNum;
}
public void setGmtTime(Date gmtTime) {
this.gmtTime = gmtTime;
}
public Date getGmtTime() {
return gmtTime;
}
public void setGmtUpdate(Date gmtUpdate) {
this.gmtUpdate = gmtUpdate;
}
public Date getGmtUpdate() {
return gmtUpdate;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userId", getUserId())
.append("deviceId", getDeviceId())
.append("deviceNum", getDeviceNum())
.append("gmtTime", getGmtTime())
.append("gmtUpdate", getGmtUpdate())
.toString();
}
}

View File

@@ -17,91 +17,94 @@ import com.ruoyi.common.core.domain.BaseEntity;
/**
* 分组对象 iot_group
*
*
* @author kerwincui
* @date 2021-05-18
*/
public class IotGroup extends BaseEntity
{
public class IotGroup extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 设备分组 */
/**
* 设备分组
*/
private Long groupId;
/** 用户 */
/**
* 用户
*/
@Excel(name = "用户")
private Long userId;
/** 分组名称 */
/**
* 分组名称
*/
@Excel(name = "分组名称")
private String groupName;
/** 排序 */
/**
* 排序
*/
@Excel(name = "排序")
private Integer groupOrder;
/** 删除标志0代表存在 2代表删除 */
/**
* 删除标志0代表存在 2代表删除
*/
private String delFlag;
public void setGroupId(Long groupId)
{
public void setGroupId(Long groupId) {
this.groupId = groupId;
}
public Long getGroupId()
{
public Long getGroupId() {
return groupId;
}
public void setUserId(Long userId)
{
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getUserId()
{
public Long getUserId() {
return userId;
}
public void setGroupName(String groupName)
{
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getGroupName()
{
public String getGroupName() {
return groupName;
}
public void setGroupOrder(Integer groupOrder)
{
public void setGroupOrder(Integer groupOrder) {
this.groupOrder = groupOrder;
}
public Integer getGroupOrder()
{
public Integer getGroupOrder() {
return groupOrder;
}
public void setDelFlag(String delFlag)
{
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag()
{
public String getDelFlag() {
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("groupId", getGroupId())
.append("userId", getUserId())
.append("groupName", getGroupName())
.append("groupOrder", getGroupOrder())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("groupId", getGroupId())
.append("userId", getUserId())
.append("groupName", getGroupName())
.append("groupOrder", getGroupOrder())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -12,6 +12,7 @@ package com.ruoyi.system.domain;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
@@ -20,102 +21,101 @@ import com.ruoyi.common.core.domain.BaseEntity;
/**
* 参数配置表 sys_config
*
*
* @author ruoyi
*/
public class SysConfig extends BaseEntity
{
public class SysConfig extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 参数主键 */
/**
* 参数主键
*/
@Excel(name = "参数主键", cellType = ColumnType.NUMERIC)
private Long configId;
/** 参数名称 */
/**
* 参数名称
*/
@Excel(name = "参数名称")
private String configName;
/** 参数键名 */
/**
* 参数键名
*/
@Excel(name = "参数键名")
private String configKey;
/** 参数键值 */
/**
* 参数键值
*/
@Excel(name = "参数键值")
private String configValue;
/** 系统内置Y是 N否 */
/**
* 系统内置Y是 N否
*/
@Excel(name = "系统内置", readConverterExp = "Y=是,N=否")
private String configType;
public Long getConfigId()
{
public Long getConfigId() {
return configId;
}
public void setConfigId(Long configId)
{
public void setConfigId(Long configId) {
this.configId = configId;
}
@NotBlank(message = "参数名称不能为空")
@Size(min = 0, max = 100, message = "参数名称不能超过100个字符")
public String getConfigName()
{
public String getConfigName() {
return configName;
}
public void setConfigName(String configName)
{
public void setConfigName(String configName) {
this.configName = configName;
}
@NotBlank(message = "参数键名长度不能为空")
@Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符")
public String getConfigKey()
{
public String getConfigKey() {
return configKey;
}
public void setConfigKey(String configKey)
{
public void setConfigKey(String configKey) {
this.configKey = configKey;
}
@NotBlank(message = "参数键值不能为空")
@Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符")
public String getConfigValue()
{
public String getConfigValue() {
return configValue;
}
public void setConfigValue(String configValue)
{
public void setConfigValue(String configValue) {
this.configValue = configValue;
}
public String getConfigType()
{
public String getConfigType() {
return configType;
}
public void setConfigType(String configType)
{
public void setConfigType(String configType) {
this.configType = configType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("configId", getConfigId())
.append("configName", getConfigName())
.append("configKey", getConfigKey())
.append("configValue", getConfigValue())
.append("configType", getConfigType())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("configId", getConfigId())
.append("configName", getConfigName())
.append("configKey", getConfigKey())
.append("configValue", getConfigValue())
.append("configType", getConfigType())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -11,6 +11,7 @@
package com.ruoyi.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
@@ -18,137 +19,136 @@ import com.ruoyi.common.core.domain.BaseEntity;
/**
* 系统访问记录表 sys_logininfor
*
*
* @author ruoyi
*/
public class SysLogininfor extends BaseEntity
{
public class SysLogininfor extends BaseEntity {
private static final long serialVersionUID = 1L;
/** ID */
/**
* ID
*/
@Excel(name = "序号", cellType = ColumnType.NUMERIC)
private Long infoId;
/** 用户账号 */
/**
* 用户账号
*/
@Excel(name = "用户账号")
private String userName;
/** 登录状态 0成功 1失败 */
/**
* 登录状态 0成功 1失败
*/
@Excel(name = "登录状态", readConverterExp = "0=成功,1=失败")
private String status;
/** 登录IP地址 */
/**
* 登录IP地址
*/
@Excel(name = "登录地址")
private String ipaddr;
/** 登录地点 */
/**
* 登录地点
*/
@Excel(name = "登录地点")
private String loginLocation;
/** 浏览器类型 */
/**
* 浏览器类型
*/
@Excel(name = "浏览器")
private String browser;
/** 操作系统 */
/**
* 操作系统
*/
@Excel(name = "操作系统")
private String os;
/** 提示消息 */
/**
* 提示消息
*/
@Excel(name = "提示消息")
private String msg;
/** 访问时间 */
/**
* 访问时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date loginTime;
public Long getInfoId()
{
public Long getInfoId() {
return infoId;
}
public void setInfoId(Long infoId)
{
public void setInfoId(Long infoId) {
this.infoId = infoId;
}
public String getUserName()
{
public String getUserName() {
return userName;
}
public void setUserName(String userName)
{
public void setUserName(String userName) {
this.userName = userName;
}
public String getStatus()
{
public String getStatus() {
return status;
}
public void setStatus(String status)
{
public void setStatus(String status) {
this.status = status;
}
public String getIpaddr()
{
public String getIpaddr() {
return ipaddr;
}
public void setIpaddr(String ipaddr)
{
public void setIpaddr(String ipaddr) {
this.ipaddr = ipaddr;
}
public String getLoginLocation()
{
public String getLoginLocation() {
return loginLocation;
}
public void setLoginLocation(String loginLocation)
{
public void setLoginLocation(String loginLocation) {
this.loginLocation = loginLocation;
}
public String getBrowser()
{
public String getBrowser() {
return browser;
}
public void setBrowser(String browser)
{
public void setBrowser(String browser) {
this.browser = browser;
}
public String getOs()
{
public String getOs() {
return os;
}
public void setOs(String os)
{
public void setOs(String os) {
this.os = os;
}
public String getMsg()
{
public String getMsg() {
return msg;
}
public void setMsg(String msg)
{
public void setMsg(String msg) {
this.msg = msg;
}
public Date getLoginTime()
{
public Date getLoginTime() {
return loginTime;
}
public void setLoginTime(Date loginTime)
{
public void setLoginTime(Date loginTime) {
this.loginTime = loginTime;
}
}

View File

@@ -12,99 +12,99 @@ package com.ruoyi.system.domain;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 通知公告表 sys_notice
*
*
* @author ruoyi
*/
public class SysNotice extends BaseEntity
{
public class SysNotice extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 公告ID */
/**
* 公告ID
*/
private Long noticeId;
/** 公告标题 */
/**
* 公告标题
*/
private String noticeTitle;
/** 公告类型1通知 2公告 */
/**
* 公告类型1通知 2公告
*/
private String noticeType;
/** 公告内容 */
/**
* 公告内容
*/
private String noticeContent;
/** 公告状态0正常 1关闭 */
/**
* 公告状态0正常 1关闭
*/
private String status;
public Long getNoticeId()
{
public Long getNoticeId() {
return noticeId;
}
public void setNoticeId(Long noticeId)
{
public void setNoticeId(Long noticeId) {
this.noticeId = noticeId;
}
public void setNoticeTitle(String noticeTitle)
{
public void setNoticeTitle(String noticeTitle) {
this.noticeTitle = noticeTitle;
}
@NotBlank(message = "公告标题不能为空")
@Size(min = 0, max = 50, message = "公告标题不能超过50个字符")
public String getNoticeTitle()
{
public String getNoticeTitle() {
return noticeTitle;
}
public void setNoticeType(String noticeType)
{
public void setNoticeType(String noticeType) {
this.noticeType = noticeType;
}
public String getNoticeType()
{
public String getNoticeType() {
return noticeType;
}
public void setNoticeContent(String noticeContent)
{
public void setNoticeContent(String noticeContent) {
this.noticeContent = noticeContent;
}
public String getNoticeContent()
{
public String getNoticeContent() {
return noticeContent;
}
public void setStatus(String status)
{
public void setStatus(String status) {
this.status = status;
}
public String getStatus()
{
public String getStatus() {
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("noticeId", getNoticeId())
.append("noticeTitle", getNoticeTitle())
.append("noticeType", getNoticeType())
.append("noticeContent", getNoticeContent())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("noticeId", getNoticeId())
.append("noticeTitle", getNoticeTitle())
.append("noticeType", getNoticeType())
.append("noticeContent", getNoticeContent())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -1,6 +1,7 @@
package com.ruoyi.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
@@ -8,248 +9,247 @@ import com.ruoyi.common.core.domain.BaseEntity;
/**
* 操作日志记录表 oper_log
*
*
* @author ruoyi
*/
public class SysOperLog extends BaseEntity
{
public class SysOperLog extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 日志主键 */
/**
* 日志主键
*/
@Excel(name = "操作序号", cellType = ColumnType.NUMERIC)
private Long operId;
/** 操作模块 */
/**
* 操作模块
*/
@Excel(name = "操作模块")
private String title;
/** 业务类型0其它 1新增 2修改 3删除 */
/**
* 业务类型0其它 1新增 2修改 3删除
*/
@Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除,4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据")
private Integer businessType;
/** 业务类型数组 */
/**
* 业务类型数组
*/
private Integer[] businessTypes;
/** 请求方法 */
/**
* 请求方法
*/
@Excel(name = "请求方法")
private String method;
/** 请求方式 */
/**
* 请求方式
*/
@Excel(name = "请求方式")
private String requestMethod;
/** 操作类别0其它 1后台用户 2手机端用户 */
/**
* 操作类别0其它 1后台用户 2手机端用户
*/
@Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户")
private Integer operatorType;
/** 操作人员 */
/**
* 操作人员
*/
@Excel(name = "操作人员")
private String operName;
/** 部门名称 */
/**
* 部门名称
*/
@Excel(name = "部门名称")
private String deptName;
/** 请求url */
/**
* 请求url
*/
@Excel(name = "请求地址")
private String operUrl;
/** 操作地址 */
/**
* 操作地址
*/
@Excel(name = "操作地址")
private String operIp;
/** 操作地点 */
/**
* 操作地点
*/
@Excel(name = "操作地点")
private String operLocation;
/** 请求参数 */
/**
* 请求参数
*/
@Excel(name = "请求参数")
private String operParam;
/** 返回参数 */
/**
* 返回参数
*/
@Excel(name = "返回参数")
private String jsonResult;
/** 操作状态0正常 1异常 */
/**
* 操作状态0正常 1异常
*/
@Excel(name = "状态", readConverterExp = "0=正常,1=异常")
private Integer status;
/** 错误消息 */
/**
* 错误消息
*/
@Excel(name = "错误消息")
private String errorMsg;
/** 操作时间 */
/**
* 操作时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date operTime;
public Long getOperId()
{
public Long getOperId() {
return operId;
}
public void setOperId(Long operId)
{
public void setOperId(Long operId) {
this.operId = operId;
}
public String getTitle()
{
public String getTitle() {
return title;
}
public void setTitle(String title)
{
public void setTitle(String title) {
this.title = title;
}
public Integer getBusinessType()
{
public Integer getBusinessType() {
return businessType;
}
public void setBusinessType(Integer businessType)
{
public void setBusinessType(Integer businessType) {
this.businessType = businessType;
}
public Integer[] getBusinessTypes()
{
public Integer[] getBusinessTypes() {
return businessTypes;
}
public void setBusinessTypes(Integer[] businessTypes)
{
public void setBusinessTypes(Integer[] businessTypes) {
this.businessTypes = businessTypes;
}
public String getMethod()
{
public String getMethod() {
return method;
}
public void setMethod(String method)
{
public void setMethod(String method) {
this.method = method;
}
public String getRequestMethod()
{
public String getRequestMethod() {
return requestMethod;
}
public void setRequestMethod(String requestMethod)
{
public void setRequestMethod(String requestMethod) {
this.requestMethod = requestMethod;
}
public Integer getOperatorType()
{
public Integer getOperatorType() {
return operatorType;
}
public void setOperatorType(Integer operatorType)
{
public void setOperatorType(Integer operatorType) {
this.operatorType = operatorType;
}
public String getOperName()
{
public String getOperName() {
return operName;
}
public void setOperName(String operName)
{
public void setOperName(String operName) {
this.operName = operName;
}
public String getDeptName()
{
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName)
{
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getOperUrl()
{
public String getOperUrl() {
return operUrl;
}
public void setOperUrl(String operUrl)
{
public void setOperUrl(String operUrl) {
this.operUrl = operUrl;
}
public String getOperIp()
{
public String getOperIp() {
return operIp;
}
public void setOperIp(String operIp)
{
public void setOperIp(String operIp) {
this.operIp = operIp;
}
public String getOperLocation()
{
public String getOperLocation() {
return operLocation;
}
public void setOperLocation(String operLocation)
{
public void setOperLocation(String operLocation) {
this.operLocation = operLocation;
}
public String getOperParam()
{
public String getOperParam() {
return operParam;
}
public void setOperParam(String operParam)
{
public void setOperParam(String operParam) {
this.operParam = operParam;
}
public String getJsonResult()
{
public String getJsonResult() {
return jsonResult;
}
public void setJsonResult(String jsonResult)
{
public void setJsonResult(String jsonResult) {
this.jsonResult = jsonResult;
}
public Integer getStatus()
{
public Integer getStatus() {
return status;
}
public void setStatus(Integer status)
{
public void setStatus(Integer status) {
this.status = status;
}
public String getErrorMsg()
{
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg)
{
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public Date getOperTime()
{
public Date getOperTime() {
return operTime;
}
public void setOperTime(Date operTime)
{
public void setOperTime(Date operTime) {
this.operTime = operTime;
}
}

View File

@@ -2,6 +2,7 @@ package com.ruoyi.system.domain;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
@@ -10,114 +11,113 @@ import com.ruoyi.common.core.domain.BaseEntity;
/**
* 岗位表 sys_post
*
*
* @author ruoyi
*/
public class SysPost extends BaseEntity
{
public class SysPost extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 岗位序号 */
/**
* 岗位序号
*/
@Excel(name = "岗位序号", cellType = ColumnType.NUMERIC)
private Long postId;
/** 岗位编码 */
/**
* 岗位编码
*/
@Excel(name = "岗位编码")
private String postCode;
/** 岗位名称 */
/**
* 岗位名称
*/
@Excel(name = "岗位名称")
private String postName;
/** 岗位排序 */
/**
* 岗位排序
*/
@Excel(name = "岗位排序")
private String postSort;
/** 状态0正常 1停用 */
/**
* 状态0正常 1停用
*/
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 用户是否存在此岗位标识 默认不存在 */
/**
* 用户是否存在此岗位标识 默认不存在
*/
private boolean flag = false;
public Long getPostId()
{
public Long getPostId() {
return postId;
}
public void setPostId(Long postId)
{
public void setPostId(Long postId) {
this.postId = postId;
}
@NotBlank(message = "岗位编码不能为空")
@Size(min = 0, max = 64, message = "岗位编码长度不能超过64个字符")
public String getPostCode()
{
public String getPostCode() {
return postCode;
}
public void setPostCode(String postCode)
{
public void setPostCode(String postCode) {
this.postCode = postCode;
}
@NotBlank(message = "岗位名称不能为空")
@Size(min = 0, max = 50, message = "岗位名称长度不能超过50个字符")
public String getPostName()
{
public String getPostName() {
return postName;
}
public void setPostName(String postName)
{
public void setPostName(String postName) {
this.postName = postName;
}
@NotBlank(message = "显示顺序不能为空")
public String getPostSort()
{
public String getPostSort() {
return postSort;
}
public void setPostSort(String postSort)
{
public void setPostSort(String postSort) {
this.postSort = postSort;
}
public String getStatus()
{
public String getStatus() {
return status;
}
public void setStatus(String status)
{
public void setStatus(String status) {
this.status = status;
}
public boolean isFlag()
{
public boolean isFlag() {
return flag;
}
public void setFlag(boolean flag)
{
public void setFlag(boolean flag) {
this.flag = flag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("postId", getPostId())
.append("postCode", getPostCode())
.append("postName", getPostName())
.append("postSort", getPostSort())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("postId", getPostId())
.append("postCode", getPostCode())
.append("postName", getPostName())
.append("postSort", getPostSort())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -5,42 +5,41 @@ import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 角色和部门关联 sys_role_dept
*
*
* @author ruoyi
*/
public class SysRoleDept
{
/** 角色ID */
public class SysRoleDept {
/**
* 角色ID
*/
private Long roleId;
/** 部门ID */
/**
* 部门ID
*/
private Long deptId;
public Long getRoleId()
{
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId)
{
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public Long getDeptId()
{
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId)
{
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId())
.append("deptId", getDeptId())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId())
.append("deptId", getDeptId())
.toString();
}
}

View File

@@ -5,42 +5,41 @@ import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 角色和菜单关联 sys_role_menu
*
*
* @author ruoyi
*/
public class SysRoleMenu
{
/** 角色ID */
public class SysRoleMenu {
/**
* 角色ID
*/
private Long roleId;
/** 菜单ID */
/**
* 菜单ID
*/
private Long menuId;
public Long getRoleId()
{
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId)
{
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public Long getMenuId()
{
public Long getMenuId() {
return menuId;
}
public void setMenuId(Long menuId)
{
public void setMenuId(Long menuId) {
this.menuId = menuId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId())
.append("menuId", getMenuId())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId())
.append("menuId", getMenuId())
.toString();
}
}

View File

@@ -2,112 +2,111 @@ package com.ruoyi.system.domain;
/**
* 当前在线会话
*
*
* @author ruoyi
*/
public class SysUserOnline
{
/** 会话编号 */
public class SysUserOnline {
/**
* 会话编号
*/
private String tokenId;
/** 部门名称 */
/**
* 部门名称
*/
private String deptName;
/** 用户名称 */
/**
* 用户名称
*/
private String userName;
/** 登录IP地址 */
/**
* 登录IP地址
*/
private String ipaddr;
/** 登录地址 */
/**
* 登录地址
*/
private String loginLocation;
/** 浏览器类型 */
/**
* 浏览器类型
*/
private String browser;
/** 操作系统 */
/**
* 操作系统
*/
private String os;
/** 登录时间 */
/**
* 登录时间
*/
private Long loginTime;
public String getTokenId()
{
public String getTokenId() {
return tokenId;
}
public void setTokenId(String tokenId)
{
public void setTokenId(String tokenId) {
this.tokenId = tokenId;
}
public String getDeptName()
{
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName)
{
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getUserName()
{
public String getUserName() {
return userName;
}
public void setUserName(String userName)
{
public void setUserName(String userName) {
this.userName = userName;
}
public String getIpaddr()
{
public String getIpaddr() {
return ipaddr;
}
public void setIpaddr(String ipaddr)
{
public void setIpaddr(String ipaddr) {
this.ipaddr = ipaddr;
}
public String getLoginLocation()
{
public String getLoginLocation() {
return loginLocation;
}
public void setLoginLocation(String loginLocation)
{
public void setLoginLocation(String loginLocation) {
this.loginLocation = loginLocation;
}
public String getBrowser()
{
public String getBrowser() {
return browser;
}
public void setBrowser(String browser)
{
public void setBrowser(String browser) {
this.browser = browser;
}
public String getOs()
{
public String getOs() {
return os;
}
public void setOs(String os)
{
public void setOs(String os) {
this.os = os;
}
public Long getLoginTime()
{
public Long getLoginTime() {
return loginTime;
}
public void setLoginTime(Long loginTime)
{
public void setLoginTime(Long loginTime) {
this.loginTime = loginTime;
}
}

View File

@@ -5,42 +5,41 @@ import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 用户和岗位关联 sys_user_post
*
*
* @author ruoyi
*/
public class SysUserPost
{
/** 用户ID */
public class SysUserPost {
/**
* 用户ID
*/
private Long userId;
/** 岗位ID */
/**
* 岗位ID
*/
private Long postId;
public Long getUserId()
{
public Long getUserId() {
return userId;
}
public void setUserId(Long userId)
{
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getPostId()
{
public Long getPostId() {
return postId;
}
public void setPostId(Long postId)
{
public void setPostId(Long postId) {
this.postId = postId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("postId", getPostId())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("postId", getPostId())
.toString();
}
}

View File

@@ -5,42 +5,41 @@ import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 用户和角色关联 sys_user_role
*
*
* @author ruoyi
*/
public class SysUserRole
{
/** 用户ID */
public class SysUserRole {
/**
* 用户ID
*/
private Long userId;
/** 角色ID */
/**
* 角色ID
*/
private Long roleId;
public Long getUserId()
{
public Long getUserId() {
return userId;
}
public void setUserId(Long userId)
{
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getRoleId()
{
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId)
{
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("roleId", getRoleId())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("roleId", getRoleId())
.toString();
}
}

View File

@@ -0,0 +1,327 @@
package com.ruoyi.system.domain;
import java.util.Date;
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;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 小程序用户对象 t_user_account_info
*
* @author wxy
* @date 2021-08-26
*/
public class TUserAccountInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* $column.columnComment
*/
private Long id;
/**
* sessionKey
*/
@Excel(name = "sessionKey")
private String sessionkey;
/**
* accessToken
*/
@Excel(name = "accessToken")
private String accessToken;
/**
* $column.columnComment
*/
@Excel(name = "accessToken")
private String openId;
/**
* $column.columnComment
*/
@Excel(name = "accessToken")
private String unionId;
/**
* 昵称
*/
@Excel(name = "昵称")
private String nickName;
/**
* 头像
*/
@Excel(name = "头像")
private String avatar;
/**
* 手机号
*/
@Excel(name = "手机号")
private String phone;
/**
* 生日
*/
@Excel(name = "生日")
private String birthday;
/**
* 用户状态0-冻结1-正常
*/
@Excel(name = "用户状态0-冻结1-正常")
private Long status;
/**
* 国家
*/
@Excel(name = "国家")
private String country;
/**
* 省份
*/
@Excel(name = "省份")
private String province;
/**
* 城市
*/
@Excel(name = "城市")
private String city;
/**
* 地址
*/
@Excel(name = "地址")
private String address;
/**
* 用户类型0-未授权用户1-消费者2-商家
*/
@Excel(name = "用户类型0-未授权用户1-消费者2-商家")
private Long userType;
/**
* 绑定的管理员编号
*/
@Excel(name = "绑定的管理员编号")
private Long adminId;
/**
* $column.columnComment
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "绑定的管理员编号", width = 30, dateFormat = "yyyy-MM-dd")
private Date lastLoginTime;
/**
* $column.columnComment
*/
@Excel(name = "绑定的管理员编号")
private String lastLoginIp;
/**
* $column.columnComment
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "绑定的管理员编号", width = 30, dateFormat = "yyyy-MM-dd")
private Date gmtTime;
/**
* $column.columnComment
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "绑定的管理员编号", width = 30, dateFormat = "yyyy-MM-dd")
private Date gmtUpdate;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setSessionkey(String sessionkey) {
this.sessionkey = sessionkey;
}
public String getSessionkey() {
return sessionkey;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public String getAccessToken() {
return accessToken;
}
public void setOpenId(String openId) {
this.openId = openId;
}
public String getOpenId() {
return openId;
}
public void setUnionId(String unionId) {
this.unionId = unionId;
}
public String getUnionId() {
return unionId;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getNickName() {
return nickName;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getAvatar() {
return avatar;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getPhone() {
return phone;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getBirthday() {
return birthday;
}
public void setStatus(Long status) {
this.status = status;
}
public Long getStatus() {
return status;
}
public void setCountry(String country) {
this.country = country;
}
public String getCountry() {
return country;
}
public void setProvince(String province) {
this.province = province;
}
public String getProvince() {
return province;
}
public void setCity(String city) {
this.city = city;
}
public String getCity() {
return city;
}
public void setAddress(String address) {
this.address = address;
}
public String getAddress() {
return address;
}
public void setUserType(Long userType) {
this.userType = userType;
}
public Long getUserType() {
return userType;
}
public void setAdminId(Long adminId) {
this.adminId = adminId;
}
public Long getAdminId() {
return adminId;
}
public void setLastLoginTime(Date lastLoginTime) {
this.lastLoginTime = lastLoginTime;
}
public Date getLastLoginTime() {
return lastLoginTime;
}
public void setLastLoginIp(String lastLoginIp) {
this.lastLoginIp = lastLoginIp;
}
public String getLastLoginIp() {
return lastLoginIp;
}
public void setGmtTime(Date gmtTime) {
this.gmtTime = gmtTime;
}
public Date getGmtTime() {
return gmtTime;
}
public void setGmtUpdate(Date gmtUpdate) {
this.gmtUpdate = gmtUpdate;
}
public Date getGmtUpdate() {
return gmtUpdate;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("sessionkey", getSessionkey())
.append("accessToken", getAccessToken())
.append("openId", getOpenId())
.append("unionId", getUnionId())
.append("nickName", getNickName())
.append("avatar", getAvatar())
.append("phone", getPhone())
.append("birthday", getBirthday())
.append("status", getStatus())
.append("country", getCountry())
.append("province", getProvince())
.append("city", getCity())
.append("address", getAddress())
.append("userType", getUserType())
.append("adminId", getAdminId())
.append("lastLoginTime", getLastLoginTime())
.append("lastLoginIp", getLastLoginIp())
.append("gmtTime", getGmtTime())
.append("gmtUpdate", getGmtUpdate())
.toString();
}
}

View File

@@ -0,0 +1,146 @@
package com.ruoyi.system.domain;
import java.util.Date;
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;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 【请填写功能名称】对象 t_user_login_log
*
* @author wxy
* @date 2021-08-26
*/
public class TUserLoginLog extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* $column.columnComment
*/
private Long id;
/**
* 用户类型
*/
@Excel(name = "用户类型")
private String userType;
/**
* $column.columnComment
*/
@Excel(name = "用户类型")
private Long userId;
/**
* $column.columnComment
*/
@Excel(name = "用户类型")
private String code;
/**
* $column.columnComment
*/
@Excel(name = "用户类型")
private String openId;
/**
* IP地址
*/
@Excel(name = "IP地址")
private String ip;
/**
* $column.columnComment
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "IP地址", width = 30, dateFormat = "yyyy-MM-dd")
private Date gmtTime;
/**
* $column.columnComment
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "IP地址", width = 30, dateFormat = "yyyy-MM-dd")
private Date gmtUpdate;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setUserType(String userType) {
this.userType = userType;
}
public String getUserType() {
return userType;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getUserId() {
return userId;
}
public void setCode(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public void setOpenId(String openId) {
this.openId = openId;
}
public String getOpenId() {
return openId;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getIp() {
return ip;
}
public void setGmtTime(Date gmtTime) {
this.gmtTime = gmtTime;
}
public Date getGmtTime() {
return gmtTime;
}
public void setGmtUpdate(Date gmtUpdate) {
this.gmtUpdate = gmtUpdate;
}
public Date getGmtUpdate() {
return gmtUpdate;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userType", getUserType())
.append("userId", getUserId())
.append("code", getCode())
.append("openId", getOpenId())
.append("ip", getIp())
.append("gmtTime", getGmtTime())
.append("gmtUpdate", getGmtUpdate())
.toString();
}
}

View File

@@ -0,0 +1,16 @@
package com.ruoyi.system.domain.vo;
import lombok.Data;
/**
* 类名: DeviceControlCMD
* 描述: 设备控制指令参数
* 时间: 2021-08-26,0026 18:54
* 开发人: admin
*/
@Data
public class DeviceControlCMD {
private Long deviceId;
String deviceNum;
String cmd;
}

View File

@@ -19,263 +19,316 @@ import java.math.BigDecimal;
/**
* 设备对象 iot_device
*
*
* @author kerwincui
* @date 2021-05-06
*/
public class IotDeviceListDto extends BaseEntity
{
public class IotDeviceListDto extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 序号 */
/**
* 序号
*/
private Long deviceId;
/** 编号 */
/**
* 编号
*/
@Excel(name = "编号")
private String deviceNum;
/** 分类 */
/**
* 分类
*/
@Excel(name = "分类")
private Long categoryId;
/** 分类名称 */
/**
* 分类名称
*/
@Excel(name = "分类名称")
private String categoryName;
/** 名称 */
/**
* 名称
*/
@Excel(name = "名称")
private String deviceName;
/** 固件版本 */
/**
* 固件版本
*/
@Excel(name = "固件版本")
private String firmwareVersion;
/** 用户 */
/**
* 用户
*/
@Excel(name = "用户")
private String ownerId;
@Excel(name="用户昵称")
@Excel(name = "设备状态")
private String status;
@Excel(name = "用户昵称")
private String nickName;
/** 删除标志0代表存在 2代表删除 */
/**
* 删除标志0代表存在 2代表删除
*/
private String delFlag;
/** 报警 */
/**
* 报警
*/
@Excel(name = "报警")
private Integer isAlarm;
/** 雷达感应 */
/**
* 雷达感应
*/
@Excel(name = "雷达感应")
private Integer isRadar;
/** 射频遥控 */
/**
* 射频遥控
*/
@Excel(name = "射频遥控")
private Integer isRfControl;
/** 配网地址 */
/**
* 配网地址
*/
@Excel(name = "配网地址")
private String networkAddress;
/** 配网IP */
/**
* 配网IP
*/
@Excel(name = "配网IP")
private String networkIp;
/** 继电器 */
/**
* 继电器
*/
@Excel(name = "继电器")
private Integer relayStatus;
/** 灯状态 */
/**
* 灯状态
*/
@Excel(name = "灯状态")
private Integer lightStatus;
/** 在线 */
/**
* 在线
*/
@Excel(name = "在线")
private Integer isOnline;
/** 设备温度 */
/**
* 设备温度
*/
@Excel(name = "设备温度")
private BigDecimal deviceTemperature;
/** 设备湿度 */
/**
* 设备湿度
*/
@Excel(name = "信号")
private Integer rssi;
@Excel(name = "备注")
private String remark;
public void setDeviceId(Long deviceId)
{
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public Long getDeviceId()
{
public Long getDeviceId() {
return deviceId;
}
public void setDeviceNum(String deviceNum)
{
public void setDeviceNum(String deviceNum) {
this.deviceNum = deviceNum;
}
public String getDeviceNum()
{
public String getDeviceNum() {
return deviceNum;
}
public void setCategoryId(Long categoryId)
{
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public Long getCategoryId()
{
public Long getCategoryId() {
return categoryId;
}
public void setCategoryName(String categoryName)
{
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public String getCategoryName()
{
public String getCategoryName() {
return categoryName;
}
public void setDeviceName(String deviceName)
{
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceName()
{
public String getDeviceName() {
return deviceName;
}
public void setFirmwareVersion(String firmwareVersion)
{
public void setStatus(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
public void setFirmwareVersion(String firmwareVersion) {
this.firmwareVersion = firmwareVersion;
}
public String getFirmwareVersion()
{
public String getFirmwareVersion() {
return firmwareVersion;
}
public void setOwnerId(String ownerId)
{
public void setOwnerId(String ownerId) {
this.ownerId = ownerId;
}
public String getOwnerId()
{
public String getOwnerId() {
return ownerId;
}
public void setNickName(String nickName)
{
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getNickName()
{
public String getNickName() {
return nickName;
}
public void setDelFlag(String delFlag)
{
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag()
{
public String getDelFlag() {
return delFlag;
}
public void setIsAlarm(Integer isAlarm)
{
public void setIsAlarm(Integer isAlarm) {
this.isAlarm = isAlarm;
}
public Integer getIsAlarm()
{
public Integer getIsAlarm() {
return isAlarm;
}
public void setIsRadar(Integer isRadar)
{
public void setIsRadar(Integer isRadar) {
this.isRadar = isRadar;
}
public Integer getIsRadar()
{
public Integer getIsRadar() {
return isRadar;
}
public void setIsRfControl(Integer isRfControl)
{
public void setIsRfControl(Integer isRfControl) {
this.isRfControl = isRfControl;
}
public Integer getIsRfControl()
{
public Integer getIsRfControl() {
return isRfControl;
}
public void setNetworkAddress(String networkAddress)
{
public void setNetworkAddress(String networkAddress) {
this.networkAddress = networkAddress;
}
public String getNetworkAddress()
{
public String getNetworkAddress() {
return networkAddress;
}
public void setNetworkIp(String networkIp)
{
public void setNetworkIp(String networkIp) {
this.networkIp = networkIp;
}
public String getNetworkIp()
{
public String getNetworkIp() {
return networkIp;
}
public void setRelayStatus(Integer relayStatus)
{
public void setRelayStatus(Integer relayStatus) {
this.relayStatus = relayStatus;
}
public Integer getRelayStatus()
{
public Integer getRelayStatus() {
return relayStatus;
}
public void setLightStatus(Integer lightStatus)
{
public void setLightStatus(Integer lightStatus) {
this.lightStatus = lightStatus;
}
public Integer getLightStatus()
{
public Integer getLightStatus() {
return lightStatus;
}
public void setIsOnline(Integer isOnline)
{
public void setIsOnline(Integer isOnline) {
this.isOnline = isOnline;
}
public Integer getIsOnline()
{
public Integer getIsOnline() {
return isOnline;
}
public void setDeviceTemperature(BigDecimal deviceTemperature)
{
public void setDeviceTemperature(BigDecimal deviceTemperature) {
this.deviceTemperature = deviceTemperature;
}
public BigDecimal getDeviceTemperature()
{
public BigDecimal getDeviceTemperature() {
return deviceTemperature;
}
public void setRssi(Integer rssi)
{
public void setRssi(Integer rssi) {
this.rssi = rssi;
}
public Integer getRssi()
{
public Integer getRssi() {
return rssi;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getRemark() {
return remark;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("deviceId", getDeviceId())
.append("deviceNum", getDeviceNum())
.append("categoryId", getCategoryId())
.append("categoryName", getCategoryName())
.append("deviceName", getDeviceName())
.append("firmwareVersion", getFirmwareVersion())
.append("ownerId", getOwnerId())
.append("nickName", getNickName())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("deviceId", getDeviceId())
.append("deviceNum", getDeviceNum())
.append("categoryId", getCategoryId())
.append("categoryName", getCategoryName())
.append("deviceName", getDeviceName())
.append("firmwareVersion", getFirmwareVersion())
.append("ownerId", getOwnerId())
.append("nickName", getNickName())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("isAlarm", getIsAlarm())
.append("isRadar", getIsRadar())
.append("isRfControl", getIsRfControl())
@@ -286,6 +339,6 @@ public class IotDeviceListDto extends BaseEntity
.append("isOnline", getIsOnline())
.append("deviceTemperature", getDeviceTemperature())
.append("rssid", getRssi())
.toString();
.toString();
}
}

View File

@@ -2,11 +2,10 @@ package com.ruoyi.system.domain.vo;
/**
* 路由显示信息
*
*
* @author ruoyi
*/
public class MetaVo
{
public class MetaVo {
/**
* 设置该路由在侧边栏和面包屑中展示的名字
*/
@@ -22,50 +21,41 @@ public class MetaVo
*/
private boolean noCache;
public MetaVo()
{
public MetaVo() {
}
public MetaVo(String title, String icon)
{
public MetaVo(String title, String icon) {
this.title = title;
this.icon = icon;
}
public MetaVo(String title, String icon, boolean noCache)
{
public MetaVo(String title, String icon, boolean noCache) {
this.title = title;
this.icon = icon;
this.noCache = noCache;
}
public boolean isNoCache()
{
public boolean isNoCache() {
return noCache;
}
public void setNoCache(boolean noCache)
{
public void setNoCache(boolean noCache) {
this.noCache = noCache;
}
public String getTitle()
{
public String getTitle() {
return title;
}
public void setTitle(String title)
{
public void setTitle(String title) {
this.title = title;
}
public String getIcon()
{
public String getIcon() {
return icon;
}
public void setIcon(String icon)
{
public void setIcon(String icon) {
this.icon = icon;
}
}

View File

@@ -1,16 +1,16 @@
package com.ruoyi.system.domain.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.List;
/**
* 路由配置信息
*
*
* @author ruoyi
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class RouterVo
{
public class RouterVo {
/**
* 路由名字
*/
@@ -51,83 +51,67 @@ public class RouterVo
*/
private List<RouterVo> children;
public String getName()
{
public String getName() {
return name;
}
public void setName(String name)
{
public void setName(String name) {
this.name = name;
}
public String getPath()
{
public String getPath() {
return path;
}
public void setPath(String path)
{
public void setPath(String path) {
this.path = path;
}
public boolean getHidden()
{
public boolean getHidden() {
return hidden;
}
public void setHidden(boolean hidden)
{
public void setHidden(boolean hidden) {
this.hidden = hidden;
}
public String getRedirect()
{
public String getRedirect() {
return redirect;
}
public void setRedirect(String redirect)
{
public void setRedirect(String redirect) {
this.redirect = redirect;
}
public String getComponent()
{
public String getComponent() {
return component;
}
public void setComponent(String component)
{
public void setComponent(String component) {
this.component = component;
}
public Boolean getAlwaysShow()
{
public Boolean getAlwaysShow() {
return alwaysShow;
}
public void setAlwaysShow(Boolean alwaysShow)
{
public void setAlwaysShow(Boolean alwaysShow) {
this.alwaysShow = alwaysShow;
}
public MetaVo getMeta()
{
public MetaVo getMeta() {
return meta;
}
public void setMeta(MetaVo meta)
{
public void setMeta(MetaVo meta) {
this.meta = meta;
}
public List<RouterVo> getChildren()
{
public List<RouterVo> getChildren() {
return children;
}
public void setChildren(List<RouterVo> children)
{
public void setChildren(List<RouterVo> children) {
this.children = children;
}
}

View File

@@ -1,19 +1,21 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.IotCategory;
import org.springframework.stereotype.Repository;
/**
* 设备分类Mapper接口
*
*
* @author kerwincui
* @date 2021-05-07
*/
public interface IotCategoryMapper
{
@Repository
public interface IotCategoryMapper {
/**
* 查询设备分类
*
*
* @param categoryId 设备分类ID
* @return 设备分类
*/
@@ -21,7 +23,7 @@ public interface IotCategoryMapper
/**
* 查询设备分类列表
*
*
* @param iotCategory 设备分类
* @return 设备分类集合
*/
@@ -29,7 +31,7 @@ public interface IotCategoryMapper
/**
* 新增设备分类
*
*
* @param iotCategory 设备分类
* @return 结果
*/
@@ -37,7 +39,7 @@ public interface IotCategoryMapper
/**
* 修改设备分类
*
*
* @param iotCategory 设备分类
* @return 结果
*/
@@ -45,7 +47,7 @@ public interface IotCategoryMapper
/**
* 删除设备分类
*
*
* @param categoryId 设备分类ID
* @return 结果
*/
@@ -53,7 +55,7 @@ public interface IotCategoryMapper
/**
* 批量删除设备分类
*
*
* @param categoryIds 需要删除的数据ID
* @return 结果
*/

View File

@@ -1,20 +1,24 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.system.domain.IotDevice;
import com.ruoyi.system.domain.vo.IotDeviceListDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* 设备Mapper接口
*
*
* @author kerwincui
* @date 2021-05-06
*/
public interface IotDeviceMapper
{
@Repository
public interface IotDeviceMapper {
/**
* 查询设备
*
*
* @param deviceId 设备ID
* @return 设备
*/
@@ -30,7 +34,7 @@ public interface IotDeviceMapper
/**
* 查询设备列表
*
*
* @param iotDevice 设备
* @return 设备集合
*/
@@ -38,7 +42,7 @@ public interface IotDeviceMapper
/**
* 新增设备
*
*
* @param iotDevice 设备
* @return 结果
*/
@@ -46,7 +50,7 @@ public interface IotDeviceMapper
/**
* 修改设备
*
*
* @param iotDevice 设备
* @return 结果
*/
@@ -54,7 +58,7 @@ public interface IotDeviceMapper
/**
* 删除设备
*
*
* @param deviceId 设备ID
* @return 结果
*/
@@ -62,9 +66,15 @@ public interface IotDeviceMapper
/**
* 批量删除设备
*
*
* @param deviceIds 需要删除的数据ID
* @return 结果
*/
public int deleteIotDeviceByIds(Long[] deviceIds);
List<IotDeviceListDto> selectMpIotDeviceList(IotDevice iotDevice);
JSONObject getDeviceInfoByDeviceNum(@Param("userId") Long userId,@Param("deviceNum") String deviceNum);
JSONObject getDeviceInfoByDeviceId(@Param("userId") Long userId,@Param("deviceId") Long deviceId);
}

View File

@@ -1,19 +1,21 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.IotDeviceSet;
import org.springframework.stereotype.Repository;
/**
* 设备配置Mapper接口
*
*
* @author kerwincui
* @date 2021-05-06
*/
public interface IotDeviceSetMapper
{
@Repository
public interface IotDeviceSetMapper {
/**
* 查询设备配置
*
*
* @param deviceSetId 设备配置ID
* @return 设备配置
*/
@@ -29,7 +31,7 @@ public interface IotDeviceSetMapper
/**
* 查询设备配置列表
*
*
* @param iotDeviceSet 设备配置
* @return 设备配置集合
*/
@@ -37,7 +39,7 @@ public interface IotDeviceSetMapper
/**
* 新增设备配置
*
*
* @param iotDeviceSet 设备配置
* @return 结果
*/
@@ -45,7 +47,7 @@ public interface IotDeviceSetMapper
/**
* 修改设备配置
*
*
* @param iotDeviceSet 设备配置
* @return 结果
*/
@@ -53,7 +55,7 @@ public interface IotDeviceSetMapper
/**
* 删除设备配置
*
*
* @param deviceConfigId 设备配置ID
* @return 结果
*/
@@ -61,7 +63,7 @@ public interface IotDeviceSetMapper
/**
* 批量删除设备配置
*
*
* @param deviceConfigIds 需要删除的数据ID
* @return 结果
*/

View File

@@ -1,19 +1,21 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.IotDeviceStatus;
import org.springframework.stereotype.Repository;
/**
* 设备状态Mapper接口
*
*
* @author kerwincui
* @date 2021-05-06
*/
public interface IotDeviceStatusMapper
{
@Repository
public interface IotDeviceStatusMapper {
/**
* 查询设备状态
*
*
* @param deviceStatusId 设备状态ID
* @return 设备状态
*/
@@ -37,7 +39,7 @@ public interface IotDeviceStatusMapper
/**
* 查询设备状态列表
*
*
* @param iotDeviceStatus 设备状态
* @return 设备状态集合
*/
@@ -45,7 +47,7 @@ public interface IotDeviceStatusMapper
/**
* 新增设备状态
*
*
* @param iotDeviceStatus 设备状态
* @return 结果
*/
@@ -53,7 +55,7 @@ public interface IotDeviceStatusMapper
/**
* 修改设备状态
*
*
* @param iotDeviceStatus 设备状态
* @return 结果
*/
@@ -61,7 +63,7 @@ public interface IotDeviceStatusMapper
/**
* 删除设备状态
*
*
* @param deviceStatusId 设备状态ID
* @return 结果
*/
@@ -69,7 +71,7 @@ public interface IotDeviceStatusMapper
/**
* 批量删除设备状态
*
*
* @param deviceStatusIds 需要删除的数据ID
* @return 结果
*/

View File

@@ -0,0 +1,63 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.IotDeviceUserRelation;
import org.springframework.stereotype.Repository;
/**
* 【请填写功能名称】Mapper接口
*
* @author wxy
* @date 2021-08-27
*/
@Repository
public interface IotDeviceUserRelationMapper {
/**
* 查询【请填写功能名称】
*
* @param id 【请填写功能名称】ID
* @return 【请填写功能名称】
*/
public IotDeviceUserRelation selectIotDeviceUserRelationById(Long id);
/**
* 查询【请填写功能名称】列表
*
* @param iotDeviceUserRelation 【请填写功能名称】
* @return 【请填写功能名称】集合
*/
public List<IotDeviceUserRelation> selectIotDeviceUserRelationList(IotDeviceUserRelation iotDeviceUserRelation);
/**
* 新增【请填写功能名称】
*
* @param iotDeviceUserRelation 【请填写功能名称】
* @return 结果
*/
public int insertIotDeviceUserRelation(IotDeviceUserRelation iotDeviceUserRelation);
/**
* 修改【请填写功能名称】
*
* @param iotDeviceUserRelation 【请填写功能名称】
* @return 结果
*/
public int updateIotDeviceUserRelation(IotDeviceUserRelation iotDeviceUserRelation);
/**
* 删除【请填写功能名称】
*
* @param id 【请填写功能名称】ID
* @return 结果
*/
public int deleteIotDeviceUserRelationById(Long id);
/**
* 批量删除【请填写功能名称】
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteIotDeviceUserRelationByIds(Long[] ids);
}

View File

@@ -1,19 +1,21 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.IotGroup;
import org.springframework.stereotype.Repository;
/**
* 分组Mapper接口
*
*
* @author kerwincui
* @date 2021-05-18
*/
public interface IotGroupMapper
{
@Repository
public interface IotGroupMapper {
/**
* 查询分组
*
*
* @param groupId 分组ID
* @return 分组
*/
@@ -21,7 +23,7 @@ public interface IotGroupMapper
/**
* 查询分组列表
*
*
* @param iotGroup 分组
* @return 分组集合
*/
@@ -29,7 +31,7 @@ public interface IotGroupMapper
/**
* 新增分组
*
*
* @param iotGroup 分组
* @return 结果
*/
@@ -37,7 +39,7 @@ public interface IotGroupMapper
/**
* 修改分组
*
*
* @param iotGroup 分组
* @return 结果
*/
@@ -45,7 +47,7 @@ public interface IotGroupMapper
/**
* 删除分组
*
*
* @param groupId 分组ID
* @return 结果
*/
@@ -53,7 +55,7 @@ public interface IotGroupMapper
/**
* 批量删除分组
*
*
* @param groupIds 需要删除的数据ID
* @return 结果
*/

View File

@@ -1,18 +1,20 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysConfig;
import org.springframework.stereotype.Repository;
/**
* 参数配置 数据层
*
*
* @author ruoyi
*/
public interface SysConfigMapper
{
@Repository
public interface SysConfigMapper {
/**
* 查询参数配置信息
*
*
* @param config 参数配置信息
* @return 参数配置信息
*/
@@ -20,7 +22,7 @@ public interface SysConfigMapper
/**
* 查询参数配置列表
*
*
* @param config 参数配置信息
* @return 参数配置集合
*/
@@ -28,7 +30,7 @@ public interface SysConfigMapper
/**
* 根据键名查询参数配置信息
*
*
* @param configKey 参数键名
* @return 参数配置信息
*/
@@ -36,7 +38,7 @@ public interface SysConfigMapper
/**
* 新增参数配置
*
*
* @param config 参数配置信息
* @return 结果
*/
@@ -44,7 +46,7 @@ public interface SysConfigMapper
/**
* 修改参数配置
*
*
* @param config 参数配置信息
* @return 结果
*/
@@ -52,7 +54,7 @@ public interface SysConfigMapper
/**
* 删除参数配置
*
*
* @param configId 参数ID
* @return 结果
*/
@@ -60,7 +62,7 @@ public interface SysConfigMapper
/**
* 批量删除参数信息
*
*
* @param configIds 需要删除的参数ID
* @return 结果
*/

View File

@@ -1,19 +1,21 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.common.core.domain.entity.SysDept;
import org.springframework.stereotype.Repository;
/**
* 部门管理 数据层
*
*
* @author ruoyi
*/
public interface SysDeptMapper
{
@Repository
public interface SysDeptMapper {
/**
* 查询部门管理数据
*
*
* @param dept 部门信息
* @return 部门信息集合
*/
@@ -21,8 +23,8 @@ public interface SysDeptMapper
/**
* 根据角色ID查询部门树信息
*
* @param roleId 角色ID
*
* @param roleId 角色ID
* @param deptCheckStrictly 部门树选择项是否关联显示
* @return 选中部门列表
*/
@@ -30,7 +32,7 @@ public interface SysDeptMapper
/**
* 根据部门ID查询信息
*
*
* @param deptId 部门ID
* @return 部门信息
*/
@@ -38,7 +40,7 @@ public interface SysDeptMapper
/**
* 根据ID查询所有子部门
*
*
* @param deptId 部门ID
* @return 部门列表
*/
@@ -46,7 +48,7 @@ public interface SysDeptMapper
/**
* 根据ID查询所有子部门正常状态
*
*
* @param deptId 部门ID
* @return 子部门数
*/
@@ -54,7 +56,7 @@ public interface SysDeptMapper
/**
* 是否存在子节点
*
*
* @param deptId 部门ID
* @return 结果
*/
@@ -62,7 +64,7 @@ public interface SysDeptMapper
/**
* 查询部门是否存在用户
*
*
* @param deptId 部门ID
* @return 结果
*/
@@ -70,7 +72,7 @@ public interface SysDeptMapper
/**
* 校验部门名称是否唯一
*
*
* @param deptName 部门名称
* @param parentId 父部门ID
* @return 结果
@@ -79,7 +81,7 @@ public interface SysDeptMapper
/**
* 新增部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
@@ -87,7 +89,7 @@ public interface SysDeptMapper
/**
* 修改部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
@@ -95,14 +97,14 @@ public interface SysDeptMapper
/**
* 修改所在部门的父级部门状态
*
*
* @param dept 部门
*/
public void updateDeptStatus(SysDept dept);
/**
* 修改子元素关系
*
*
* @param depts 子元素
* @return 结果
*/
@@ -110,7 +112,7 @@ public interface SysDeptMapper
/**
* 删除部门管理信息
*
*
* @param deptId 部门ID
* @return 结果
*/

View File

@@ -1,19 +1,21 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.common.core.domain.entity.SysDictData;
import org.springframework.stereotype.Repository;
/**
* 字典表 数据层
*
*
* @author ruoyi
*/
public interface SysDictDataMapper
{
@Repository
public interface SysDictDataMapper {
/**
* 根据条件分页查询字典数据
*
*
* @param dictData 字典数据信息
* @return 字典数据集合信息
*/
@@ -21,7 +23,7 @@ public interface SysDictDataMapper
/**
* 根据字典类型查询字典数据
*
*
* @param dictType 字典类型
* @return 字典数据集合信息
*/
@@ -29,8 +31,8 @@ public interface SysDictDataMapper
/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典标签
*/
@@ -38,7 +40,7 @@ public interface SysDictDataMapper
/**
* 根据字典数据ID查询信息
*
*
* @param dictCode 字典数据ID
* @return 字典数据
*/
@@ -46,7 +48,7 @@ public interface SysDictDataMapper
/**
* 查询字典数据
*
*
* @param dictType 字典类型
* @return 字典数据
*/
@@ -54,7 +56,7 @@ public interface SysDictDataMapper
/**
* 通过字典ID删除字典数据信息
*
*
* @param dictCode 字典数据ID
* @return 结果
*/
@@ -62,7 +64,7 @@ public interface SysDictDataMapper
/**
* 批量删除字典数据信息
*
*
* @param dictCodes 需要删除的字典数据ID
* @return 结果
*/
@@ -70,7 +72,7 @@ public interface SysDictDataMapper
/**
* 新增字典数据信息
*
*
* @param dictData 字典数据信息
* @return 结果
*/
@@ -78,7 +80,7 @@ public interface SysDictDataMapper
/**
* 修改字典数据信息
*
*
* @param dictData 字典数据信息
* @return 结果
*/
@@ -86,7 +88,7 @@ public interface SysDictDataMapper
/**
* 同步修改字典类型
*
*
* @param oldDictType 旧字典类型
* @param newDictType 新旧字典类型
* @return 结果

View File

@@ -1,20 +1,20 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import com.ruoyi.common.core.domain.entity.SysDictType;
/**
* 字典表 数据层
*
*
* @author ruoyi
*/
@Mapper
public interface SysDictTypeMapper
{
public interface SysDictTypeMapper {
/**
* 根据条件分页查询字典类型
*
*
* @param dictType 字典类型信息
* @return 字典类型集合信息
*/
@@ -22,14 +22,14 @@ public interface SysDictTypeMapper
/**
* 根据所有字典类型
*
*
* @return 字典类型集合信息
*/
public List<SysDictType> selectDictTypeAll();
/**
* 根据字典类型ID查询信息
*
*
* @param dictId 字典类型ID
* @return 字典类型
*/
@@ -37,7 +37,7 @@ public interface SysDictTypeMapper
/**
* 根据字典类型查询信息
*
*
* @param dictType 字典类型
* @return 字典类型
*/
@@ -45,7 +45,7 @@ public interface SysDictTypeMapper
/**
* 通过字典ID删除字典信息
*
*
* @param dictId 字典ID
* @return 结果
*/
@@ -53,7 +53,7 @@ public interface SysDictTypeMapper
/**
* 批量删除字典类型信息
*
*
* @param dictIds 需要删除的字典ID
* @return 结果
*/
@@ -61,7 +61,7 @@ public interface SysDictTypeMapper
/**
* 新增字典类型信息
*
*
* @param dictType 字典类型信息
* @return 结果
*/
@@ -69,7 +69,7 @@ public interface SysDictTypeMapper
/**
* 修改字典类型信息
*
*
* @param dictType 字典类型信息
* @return 结果
*/
@@ -77,7 +77,7 @@ public interface SysDictTypeMapper
/**
* 校验字典类型称是否唯一
*
*
* @param dictType 字典类型
* @return 结果
*/

View File

@@ -1,25 +1,27 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysLogininfor;
import org.springframework.stereotype.Repository;
/**
* 系统访问日志情况信息 数据层
*
*
* @author ruoyi
*/
public interface SysLogininforMapper
{
@Repository
public interface SysLogininforMapper {
/**
* 新增系统登录日志
*
*
* @param logininfor 访问日志对象
*/
public void insertLogininfor(SysLogininfor logininfor);
/**
* 查询系统登录日志集合
*
*
* @param logininfor 访问日志对象
* @return 登录记录集合
*/
@@ -27,7 +29,7 @@ public interface SysLogininforMapper
/**
* 批量删除系统登录日志
*
*
* @param infoIds 需要删除的登录日志ID
* @return 结果
*/
@@ -35,7 +37,7 @@ public interface SysLogininforMapper
/**
* 清空系统登录日志
*
*
* @return 结果
*/
public int cleanLogininfor();

View File

@@ -1,16 +1,18 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.common.core.domain.entity.SysMenu;
import org.springframework.stereotype.Repository;
/**
* 菜单表 数据层
*
* @author ruoyi
*/
public interface SysMenuMapper
{
@Repository
public interface SysMenuMapper {
/**
* 查询系统菜单列表
*
@@ -59,8 +61,8 @@ public interface SysMenuMapper
/**
* 根据角色ID查询菜单树信息
*
* @param roleId 角色ID
*
* @param roleId 角色ID
* @param menuCheckStrictly 菜单树选择项是否关联显示
* @return 选中菜单列表
*/

View File

@@ -1,18 +1,20 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysNotice;
import org.springframework.stereotype.Repository;
/**
* 通知公告表 数据层
*
*
* @author ruoyi
*/
public interface SysNoticeMapper
{
@Repository
public interface SysNoticeMapper {
/**
* 查询公告信息
*
*
* @param noticeId 公告ID
* @return 公告信息
*/
@@ -20,7 +22,7 @@ public interface SysNoticeMapper
/**
* 查询公告列表
*
*
* @param notice 公告信息
* @return 公告集合
*/
@@ -28,7 +30,7 @@ public interface SysNoticeMapper
/**
* 新增公告
*
*
* @param notice 公告信息
* @return 结果
*/
@@ -36,7 +38,7 @@ public interface SysNoticeMapper
/**
* 修改公告
*
*
* @param notice 公告信息
* @return 结果
*/
@@ -44,7 +46,7 @@ public interface SysNoticeMapper
/**
* 批量删除公告
*
*
* @param noticeId 公告ID
* @return 结果
*/
@@ -52,7 +54,7 @@ public interface SysNoticeMapper
/**
* 批量删除公告信息
*
*
* @param noticeIds 需要删除的公告ID
* @return 结果
*/

View File

@@ -1,25 +1,27 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysOperLog;
import org.springframework.stereotype.Repository;
/**
* 操作日志 数据层
*
*
* @author ruoyi
*/
public interface SysOperLogMapper
{
@Repository
public interface SysOperLogMapper {
/**
* 新增操作日志
*
*
* @param operLog 操作日志对象
*/
public void insertOperlog(SysOperLog operLog);
/**
* 查询系统操作日志集合
*
*
* @param operLog 操作日志对象
* @return 操作日志集合
*/
@@ -27,7 +29,7 @@ public interface SysOperLogMapper
/**
* 批量删除系统操作日志
*
*
* @param operIds 需要删除的操作日志ID
* @return 结果
*/
@@ -35,7 +37,7 @@ public interface SysOperLogMapper
/**
* 查询操作日志详细
*
*
* @param operId 操作ID
* @return 操作日志对象
*/

View File

@@ -1,18 +1,20 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysPost;
import org.springframework.stereotype.Repository;
/**
* 岗位信息 数据层
*
*
* @author ruoyi
*/
public interface SysPostMapper
{
@Repository
public interface SysPostMapper {
/**
* 查询岗位数据集合
*
*
* @param post 岗位信息
* @return 岗位数据集合
*/
@@ -20,14 +22,14 @@ public interface SysPostMapper
/**
* 查询所有岗位
*
*
* @return 岗位列表
*/
public List<SysPost> selectPostAll();
/**
* 通过岗位ID查询岗位信息
*
*
* @param postId 岗位ID
* @return 角色对象信息
*/
@@ -35,7 +37,7 @@ public interface SysPostMapper
/**
* 根据用户ID获取岗位选择框列表
*
*
* @param userId 用户ID
* @return 选中岗位ID列表
*/
@@ -43,7 +45,7 @@ public interface SysPostMapper
/**
* 查询用户所属岗位组
*
*
* @param userName 用户名
* @return 结果
*/
@@ -51,7 +53,7 @@ public interface SysPostMapper
/**
* 删除岗位信息
*
*
* @param postId 岗位ID
* @return 结果
*/
@@ -59,7 +61,7 @@ public interface SysPostMapper
/**
* 批量删除岗位信息
*
*
* @param postIds 需要删除的岗位ID
* @return 结果
*/
@@ -67,7 +69,7 @@ public interface SysPostMapper
/**
* 修改岗位信息
*
*
* @param post 岗位信息
* @return 结果
*/
@@ -75,7 +77,7 @@ public interface SysPostMapper
/**
* 新增岗位信息
*
*
* @param post 岗位信息
* @return 结果
*/
@@ -83,7 +85,7 @@ public interface SysPostMapper
/**
* 校验岗位名称
*
*
* @param postName 岗位名称
* @return 结果
*/
@@ -91,7 +93,7 @@ public interface SysPostMapper
/**
* 校验岗位编码
*
*
* @param postCode 岗位编码
* @return 结果
*/

View File

@@ -1,18 +1,20 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysRoleDept;
import org.springframework.stereotype.Repository;
/**
* 角色与部门关联表 数据层
*
*
* @author ruoyi
*/
public interface SysRoleDeptMapper
{
@Repository
public interface SysRoleDeptMapper {
/**
* 通过角色ID删除角色和部门关联
*
*
* @param roleId 角色ID
* @return 结果
*/
@@ -20,7 +22,7 @@ public interface SysRoleDeptMapper
/**
* 批量删除角色部门关联信息
*
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@@ -28,7 +30,7 @@ public interface SysRoleDeptMapper
/**
* 查询部门使用数量
*
*
* @param deptId 部门ID
* @return 结果
*/
@@ -36,7 +38,7 @@ public interface SysRoleDeptMapper
/**
* 批量新增角色部门信息
*
*
* @param roleDeptList 角色部门列表
* @return 结果
*/

View File

@@ -1,18 +1,20 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysRole;
import org.springframework.stereotype.Repository;
/**
* 角色表 数据层
*
*
* @author ruoyi
*/
public interface SysRoleMapper
{
@Repository
public interface SysRoleMapper {
/**
* 根据条件分页查询角色数据
*
*
* @param role 角色信息
* @return 角色数据集合信息
*/
@@ -20,7 +22,7 @@ public interface SysRoleMapper
/**
* 根据用户ID查询角色
*
*
* @param userId 用户ID
* @return 角色列表
*/
@@ -28,14 +30,14 @@ public interface SysRoleMapper
/**
* 查询所有角色
*
*
* @return 角色列表
*/
public List<SysRole> selectRoleAll();
/**
* 根据用户ID获取角色选择框列表
*
*
* @param userId 用户ID
* @return 选中角色ID列表
*/
@@ -43,7 +45,7 @@ public interface SysRoleMapper
/**
* 通过角色ID查询角色
*
*
* @param roleId 角色ID
* @return 角色对象信息
*/
@@ -51,7 +53,7 @@ public interface SysRoleMapper
/**
* 根据用户ID查询角色
*
*
* @param userName 用户名
* @return 角色列表
*/
@@ -59,7 +61,7 @@ public interface SysRoleMapper
/**
* 校验角色名称是否唯一
*
*
* @param roleName 角色名称
* @return 角色信息
*/
@@ -67,7 +69,7 @@ public interface SysRoleMapper
/**
* 校验角色权限是否唯一
*
*
* @param roleKey 角色权限
* @return 角色信息
*/
@@ -75,7 +77,7 @@ public interface SysRoleMapper
/**
* 修改角色信息
*
*
* @param role 角色信息
* @return 结果
*/
@@ -83,7 +85,7 @@ public interface SysRoleMapper
/**
* 新增角色信息
*
*
* @param role 角色信息
* @return 结果
*/
@@ -91,7 +93,7 @@ public interface SysRoleMapper
/**
* 通过角色ID删除角色
*
*
* @param roleId 角色ID
* @return 结果
*/
@@ -99,7 +101,7 @@ public interface SysRoleMapper
/**
* 批量删除角色信息
*
*
* @param roleIds 需要删除的角色ID
* @return 结果
*/

View File

@@ -1,18 +1,20 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysRoleMenu;
import org.springframework.stereotype.Repository;
/**
* 角色与菜单关联表 数据层
*
*
* @author ruoyi
*/
public interface SysRoleMenuMapper
{
@Repository
public interface SysRoleMenuMapper {
/**
* 查询菜单使用数量
*
*
* @param menuId 菜单ID
* @return 结果
*/
@@ -20,7 +22,7 @@ public interface SysRoleMenuMapper
/**
* 通过角色ID删除角色和菜单关联
*
*
* @param roleId 角色ID
* @return 结果
*/
@@ -28,7 +30,7 @@ public interface SysRoleMenuMapper
/**
* 批量删除角色菜单关联信息
*
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@@ -36,7 +38,7 @@ public interface SysRoleMenuMapper
/**
* 批量新增角色菜单信息
*
*
* @param roleMenuList 角色菜单列表
* @return 结果
*/

View File

@@ -1,19 +1,21 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.common.core.domain.entity.SysUser;
import org.springframework.stereotype.Repository;
/**
* 用户表 数据层
*
*
* @author ruoyi
*/
public interface SysUserMapper
{
@Repository
public interface SysUserMapper {
/**
* 根据条件分页查询用户列表
*
*
* @param sysUser 用户信息
* @return 用户信息集合信息
*/
@@ -21,15 +23,17 @@ public interface SysUserMapper
/**
* 通过用户名查询用户
*
*
* @param userName 用户名
* @return 用户对象信息
*/
public SysUser selectUserByUserName(String userName);
public SysUser selectUserByOpenId(String openId);
/**
* 通过用户ID查询用户
*
*
* @param userId 用户ID
* @return 用户对象信息
*/
@@ -37,7 +41,7 @@ public interface SysUserMapper
/**
* 新增用户信息
*
*
* @param user 用户信息
* @return 结果
*/
@@ -45,7 +49,7 @@ public interface SysUserMapper
/**
* 修改用户信息
*
*
* @param user 用户信息
* @return 结果
*/
@@ -53,16 +57,16 @@ public interface SysUserMapper
/**
* 修改用户头像
*
*
* @param userName 用户名
* @param avatar 头像地址
* @param avatar 头像地址
* @return 结果
*/
public int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar);
/**
* 重置用户密码
*
*
* @param userName 用户名
* @param password 密码
* @return 结果
@@ -71,7 +75,7 @@ public interface SysUserMapper
/**
* 通过用户ID删除用户
*
*
* @param userId 用户ID
* @return 结果
*/
@@ -79,7 +83,7 @@ public interface SysUserMapper
/**
* 批量删除用户信息
*
*
* @param userIds 需要删除的用户ID
* @return 结果
*/
@@ -87,7 +91,7 @@ public interface SysUserMapper
/**
* 校验用户名称是否唯一
*
*
* @param userName 用户名称
* @return 结果
*/

View File

@@ -1,18 +1,20 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysUserPost;
import org.springframework.stereotype.Repository;
/**
* 用户与岗位关联表 数据层
*
*
* @author ruoyi
*/
public interface SysUserPostMapper
{
@Repository
public interface SysUserPostMapper {
/**
* 通过用户ID删除用户和岗位关联
*
*
* @param userId 用户ID
* @return 结果
*/
@@ -20,7 +22,7 @@ public interface SysUserPostMapper
/**
* 通过岗位ID查询岗位使用数量
*
*
* @param postId 岗位ID
* @return 结果
*/
@@ -28,7 +30,7 @@ public interface SysUserPostMapper
/**
* 批量删除用户和岗位关联
*
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@@ -36,7 +38,7 @@ public interface SysUserPostMapper
/**
* 批量新增用户岗位信息
*
*
* @param userPostList 用户角色列表
* @return 结果
*/

View File

@@ -1,19 +1,21 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.system.domain.SysUserRole;
import org.springframework.stereotype.Repository;
/**
* 用户与角色关联表 数据层
*
*
* @author ruoyi
*/
public interface SysUserRoleMapper
{
@Repository
public interface SysUserRoleMapper {
/**
* 通过用户ID删除用户和角色关联
*
*
* @param userId 用户ID
* @return 结果
*/
@@ -21,7 +23,7 @@ public interface SysUserRoleMapper
/**
* 批量删除用户和角色关联
*
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@@ -29,7 +31,7 @@ public interface SysUserRoleMapper
/**
* 通过角色ID查询角色使用数量
*
*
* @param roleId 角色ID
* @return 结果
*/
@@ -37,7 +39,7 @@ public interface SysUserRoleMapper
/**
* 批量新增用户角色信息
*
*
* @param userRoleList 用户角色列表
* @return 结果
*/
@@ -45,7 +47,7 @@ public interface SysUserRoleMapper
/**
* 删除用户和角色关联信息
*
*
* @param userRole 用户和角色关联信息
* @return 结果
*/
@@ -53,8 +55,8 @@ public interface SysUserRoleMapper
/**
* 批量取消授权用户角色
*
* @param roleId 角色ID
*
* @param roleId 角色ID
* @param userIds 需要删除的用户数据ID
* @return 结果
*/

View File

@@ -0,0 +1,63 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.TUserAccountInfo;
import org.springframework.stereotype.Repository;
/**
* 小程序用户Mapper接口
*
* @author wxy
* @date 2021-08-26
*/
@Repository
public interface TUserAccountInfoMapper {
/**
* 查询小程序用户
*
* @param id 小程序用户ID
* @return 小程序用户
*/
public TUserAccountInfo selectTUserAccountInfoById(Long id);
/**
* 查询小程序用户列表
*
* @param tUserAccountInfo 小程序用户
* @return 小程序用户集合
*/
public List<TUserAccountInfo> selectTUserAccountInfoList(TUserAccountInfo tUserAccountInfo);
/**
* 新增小程序用户
*
* @param tUserAccountInfo 小程序用户
* @return 结果
*/
public int insertTUserAccountInfo(TUserAccountInfo tUserAccountInfo);
/**
* 修改小程序用户
*
* @param tUserAccountInfo 小程序用户
* @return 结果
*/
public int updateTUserAccountInfo(TUserAccountInfo tUserAccountInfo);
/**
* 删除小程序用户
*
* @param id 小程序用户ID
* @return 结果
*/
public int deleteTUserAccountInfoById(Long id);
/**
* 批量删除小程序用户
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteTUserAccountInfoByIds(Long[] ids);
}

View File

@@ -0,0 +1,63 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.TUserLoginLog;
import org.springframework.stereotype.Repository;
/**
* 【请填写功能名称】Mapper接口
*
* @author wxy
* @date 2021-08-26
*/
@Repository
public interface TUserLoginLogMapper {
/**
* 查询【请填写功能名称】
*
* @param id 【请填写功能名称】ID
* @return 【请填写功能名称】
*/
public TUserLoginLog selectTUserLoginLogById(Long id);
/**
* 查询【请填写功能名称】列表
*
* @param tUserLoginLog 【请填写功能名称】
* @return 【请填写功能名称】集合
*/
public List<TUserLoginLog> selectTUserLoginLogList(TUserLoginLog tUserLoginLog);
/**
* 新增【请填写功能名称】
*
* @param tUserLoginLog 【请填写功能名称】
* @return 结果
*/
public int insertTUserLoginLog(TUserLoginLog tUserLoginLog);
/**
* 修改【请填写功能名称】
*
* @param tUserLoginLog 【请填写功能名称】
* @return 结果
*/
public int updateTUserLoginLog(TUserLoginLog tUserLoginLog);
/**
* 删除【请填写功能名称】
*
* @param id 【请填写功能名称】ID
* @return 结果
*/
public int deleteTUserLoginLogById(Long id);
/**
* 批量删除【请填写功能名称】
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteTUserLoginLogByIds(Long[] ids);
}

View File

@@ -55,47 +55,61 @@ public class MqttConfig {
private int keepalive;
public String getusername()
{
public String getusername() {
return username;
}
public void setusername(String username) {this.username = username;}
public String getpassword()
{
public void setusername(String username) {
this.username = username;
}
public String getpassword() {
return password;
}
public void setpassword(String password) {this.password = password;}
public String gethostUrl()
{
public void setpassword(String password) {
this.password = password;
}
public String gethostUrl() {
return hostUrl;
}
public void sethostUrl(String hostUrl) {this.hostUrl = hostUrl;}
public String getclientId()
{
public void sethostUrl(String hostUrl) {
this.hostUrl = hostUrl;
}
public String getclientId() {
return clientId;
}
public void setclientId(String clientId) {this.clientId = clientId;}
public String getdefaultTopic()
{
public void setclientId(String clientId) {
this.clientId = clientId;
}
public String getdefaultTopic() {
return defaultTopic;
}
public void setdefaultTopic(String defaultTopic) {this.defaultTopic = defaultTopic;}
public int gettimeout()
{
public void setdefaultTopic(String defaultTopic) {
this.defaultTopic = defaultTopic;
}
public int gettimeout() {
return timeout;
}
public void settimeout(int timeout) {this.timeout = timeout;}
public int getkeepalive()
{
public void settimeout(int timeout) {
this.timeout = timeout;
}
public int getkeepalive() {
return keepalive;
}
public void setkeepalive(int keepalive) {this.keepalive = keepalive;}
public void setkeepalive(int keepalive) {
this.keepalive = keepalive;
}
@Bean
public MqttPushClient getMqttPushClient() {

View File

@@ -15,6 +15,7 @@ import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
/**
@@ -22,6 +23,7 @@ import org.springframework.stereotype.Component;
* @Description mqtt推送客户端
*/
@Component
@Primary
public class MqttPushClient {
private static final Logger logger = LoggerFactory.getLogger(MqttPushClient.class);
@@ -40,6 +42,7 @@ public class MqttPushClient {
/**
* 客户端连接
*
* @param host ip+端口
* @param clientID 客户端Id
* @param username 用户名
@@ -61,6 +64,7 @@ public class MqttPushClient {
try {
client.setCallback(pushCallback);
client.connect(options);
System.out.println("MQTT Server Connected ...");
} catch (Exception e) {
e.printStackTrace();
}
@@ -71,6 +75,7 @@ public class MqttPushClient {
/**
* 发布
*
* @param qos 连接方式
* @param retained 是否保留
* @param topic 主题
@@ -101,6 +106,7 @@ public class MqttPushClient {
/**
* 订阅某个主题
*
* @param topic 主题
* @param qos 连接方式
*/

View File

@@ -11,9 +11,11 @@
package com.ruoyi.system.mqtt.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.ip.AddressUtils;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.system.domain.IotCategory;
@@ -32,6 +34,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Random;
/**
@@ -72,40 +75,45 @@ public class PushCallback implements MqttCallback {
logger.info("接收消息主题 : " + topic);
logger.info("接收消息Qos : " + mqttMessage.getQos());
logger.info("接收消息内容 : " + new String(mqttMessage.getPayload()));
if(topic.equals("device_info")){
try {
JSONObject jsonObject = JSON.parseObject(new String(mqttMessage.getPayload()));
}catch (Exception e){
System.err.println("===未知消息格式:"+new String(mqttMessage.getPayload()));
return;
}
if (topic.equals("device_info")) {
//添加设备信息
IotDevice device = JSON.parseObject(new String(mqttMessage.getPayload()), IotDevice.class);
IotDevice deviceEntity=iotDeviceService.selectIotDeviceByNum(device.getDeviceNum());
if(deviceEntity!=null){
IotDevice deviceEntity = iotDeviceService.selectIotDeviceByNum(device.getDeviceNum());
if (deviceEntity != null) {
device.setDeviceId(deviceEntity.getDeviceId());
iotDeviceService.updateIotDevice(device);
}else {
IotCategory categoryEntity=iotCategoryService.selectIotCategoryById(device.getCategoryId());
if(device.getDeviceName()==null || device.getDeviceNum().length()==0) {
} else {
IotCategory categoryEntity = iotCategoryService.selectIotCategoryById(device.getCategoryId());
if (device.getDeviceName() == null || device.getDeviceNum().length() == 0) {
Random rand = new Random(); //随机生成两位数
device.setDeviceName(categoryEntity.getCategoryName()+(rand.nextInt(90) + 10));
device.setDeviceName(categoryEntity.getCategoryName() + (rand.nextInt(90) + 10));
}
iotDeviceService.insertIotDevice(device);
}
//获取设备状态(消息内容不能为空,硬件获取不到数据报错)
mqttPushClient.publish(1,false,"status/get/"+device.getDeviceNum(),"wumei.live");
mqttPushClient.publish(1, false, "status/get/" + device.getDeviceNum(), "wumei.live");
//获取设备配置
mqttPushClient.publish(1,false,"setting/get/"+device.getDeviceNum(),"wumei.live");
}else if(topic.equals("status")){
mqttPushClient.publish(1, false, "setting/get/" + device.getDeviceNum(), "wumei.live");
} else if (topic.equals("status")) {
IotDeviceStatus deviceStatus = JSON.parseObject(new String(mqttMessage.getPayload()), IotDeviceStatus.class);
IotDevice device=iotDeviceService.selectIotDeviceByNum(deviceStatus.getDeviceNum());
IotDevice device = iotDeviceService.selectIotDeviceByNum(deviceStatus.getDeviceNum());
//添加设备状态
deviceStatus.setDeviceId(device.getDeviceId());
iotDeviceStatusService.insertIotDeviceStatus(deviceStatus);
}else if(topic.equals("setting")){
} else if (topic.equals("setting")) {
IotDeviceSet deviceSet = JSON.parseObject(new String(mqttMessage.getPayload()), IotDeviceSet.class);
// 智能配网时需要获取IP、地址和设备用户
IotDevice device=iotDeviceService.selectIotDeviceByNum(deviceSet.getDeviceNum());
if(deviceSet.getIsSmartConfig()==1){
IotDevice device = iotDeviceService.selectIotDeviceByNum(deviceSet.getDeviceNum());
if (deviceSet.getIsSmartConfig() == 1) {
final String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
deviceSet.setNetworkIp(ip);
deviceSet.setNetworkAddress( AddressUtils.getRealAddressByIP(ip));
deviceSet.setNetworkAddress(AddressUtils.getRealAddressByIP(ip));
//更新设备用户
device.setOwnerId(deviceSet.getOwnerId());
iotDeviceService.updateIotDevice(device);
@@ -113,12 +121,12 @@ public class PushCallback implements MqttCallback {
//添加设备配置
deviceSet.setDeviceId(device.getDeviceId());
iotDeviceSetService.insertIotDeviceSet(deviceSet);
}else if(topic.equals("offline")){
} else if (topic.equals("offline")) {
//离线遗嘱
IotDeviceStatus deviceStatus = JSON.parseObject(new String(mqttMessage.getPayload()), IotDeviceStatus.class);
IotDeviceStatus deviceStatusEntity=iotDeviceStatusService.selectIotDeviceStatusByDeviceNum(deviceStatus.getDeviceNum());
IotDeviceStatus deviceStatusEntity = iotDeviceStatusService.selectIotDeviceStatusByDeviceNum(deviceStatus.getDeviceNum());
//设备状态为离线
if(deviceStatusEntity!=null) {
if (deviceStatusEntity != null) {
deviceStatusEntity.setIsOnline(0);
iotDeviceStatusService.insertIotDeviceStatus(deviceStatusEntity);
}

View File

@@ -1,19 +1,19 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.IotCategory;
/**
* 设备分类Service接口
*
*
* @author kerwincui
* @date 2021-05-07
*/
public interface IIotCategoryService
{
public interface IIotCategoryService {
/**
* 查询设备分类
*
*
* @param categoryId 设备分类ID
* @return 设备分类
*/
@@ -21,7 +21,7 @@ public interface IIotCategoryService
/**
* 查询设备分类列表
*
*
* @param iotCategory 设备分类
* @return 设备分类集合
*/
@@ -29,7 +29,7 @@ public interface IIotCategoryService
/**
* 新增设备分类
*
*
* @param iotCategory 设备分类
* @return 结果
*/
@@ -37,7 +37,7 @@ public interface IIotCategoryService
/**
* 修改设备分类
*
*
* @param iotCategory 设备分类
* @return 结果
*/
@@ -45,7 +45,7 @@ public interface IIotCategoryService
/**
* 批量删除设备分类
*
*
* @param categoryIds 需要删除的设备分类ID
* @return 结果
*/
@@ -53,7 +53,7 @@ public interface IIotCategoryService
/**
* 删除设备分类信息
*
*
* @param categoryId 设备分类ID
* @return 结果
*/

View File

@@ -1,20 +1,22 @@
package com.ruoyi.system.service;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.system.domain.IotDevice;
import com.ruoyi.system.domain.vo.IotDeviceListDto;
import org.springframework.transaction.annotation.Transactional;
/**
* 设备Service接口
*
*
* @author kerwincui
* @date 2021-05-06
*/
public interface IIotDeviceService
{
public interface IIotDeviceService {
/**
* 查询设备
*
*
* @param deviceId 设备ID
* @return 设备
*/
@@ -27,7 +29,7 @@ public interface IIotDeviceService
/**
* 查询设备列表
*
*
* @param iotDevice 设备
* @return 设备集合
*/
@@ -35,7 +37,7 @@ public interface IIotDeviceService
/**
* 新增设备
*
*
* @param iotDevice 设备
* @return 结果
*/
@@ -43,7 +45,7 @@ public interface IIotDeviceService
/**
* 修改设备
*
*
* @param iotDevice 设备
* @return 结果
*/
@@ -51,7 +53,7 @@ public interface IIotDeviceService
/**
* 批量删除设备
*
*
* @param deviceIds 需要删除的设备ID
* @return 结果
*/
@@ -59,9 +61,27 @@ public interface IIotDeviceService
/**
* 删除设备信息
*
*
* @param deviceId 设备ID
* @return 结果
*/
public int deleteIotDeviceById(Long deviceId);
int controlDeviceByNum(String deviceNum, String cmd);
int bindDevice(Long userId,String nickname,String deviceNum,String name,Long categoryId,String remark);
List<IotDeviceListDto> selectMpIotDeviceList(IotDevice iotDevice);
@Transactional
int updateDeviceInfo(Long userId, String nickName, Long deviceId, String name, String remark);
IotDevice selectIotDeviceByUserAndNum(Long userId, String deviceNum);
int unBindDevice(Long userId,String username,Long deviceId);
JSONObject getDeviceInfoByDeviceNum(Long userId,String nickName,String deviceNum);
JSONObject getDeviceInfoByDeviceId(Long userId, String username, Long deviceId);
}

View File

@@ -1,19 +1,19 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.IotDeviceSet;
/**
* 设备配置Service接口
*
*
* @author kerwincui
* @date 2021-05-06
*/
public interface IIotDeviceSetService
{
public interface IIotDeviceSetService {
/**
* 查询设备配置
*
*
* @param deviceConfigId 设备配置ID
* @return 设备配置
*/
@@ -29,7 +29,7 @@ public interface IIotDeviceSetService
/**
* 查询设备配置列表
*
*
* @param iotDeviceSet 设备配置
* @return 设备配置集合
*/
@@ -37,7 +37,7 @@ public interface IIotDeviceSetService
/**
* 新增设备配置
*
*
* @param iotDeviceSet 设备配置
* @return 结果
*/
@@ -45,7 +45,7 @@ public interface IIotDeviceSetService
/**
* 修改设备配置
*
*
* @param iotDeviceSet 设备配置
* @return 结果
*/
@@ -53,7 +53,7 @@ public interface IIotDeviceSetService
/**
* 批量删除设备配置
*
*
* @param deviceConfigIds 需要删除的设备配置ID
* @return 结果
*/
@@ -61,7 +61,7 @@ public interface IIotDeviceSetService
/**
* 删除设备配置信息
*
*
* @param deviceConfigId 设备配置ID
* @return 结果
*/

View File

@@ -1,19 +1,19 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.IotDeviceStatus;
/**
* 设备状态Service接口
*
*
* @author kerwincui
* @date 2021-05-06
*/
public interface IIotDeviceStatusService
{
public interface IIotDeviceStatusService {
/**
* 查询设备状态
*
*
* @param deviceStatusId 设备状态ID
* @return 设备状态
*/
@@ -37,7 +37,7 @@ public interface IIotDeviceStatusService
/**
* 查询设备状态列表
*
*
* @param iotDeviceStatus 设备状态
* @return 设备状态集合
*/
@@ -45,7 +45,7 @@ public interface IIotDeviceStatusService
/**
* 新增设备状态
*
*
* @param iotDeviceStatus 设备状态
* @return 结果
*/
@@ -53,7 +53,7 @@ public interface IIotDeviceStatusService
/**
* 修改设备状态
*
*
* @param iotDeviceStatus 设备状态
* @return 结果
*/
@@ -61,7 +61,7 @@ public interface IIotDeviceStatusService
/**
* 批量删除设备状态
*
*
* @param deviceStatusIds 需要删除的设备状态ID
* @return 结果
*/
@@ -69,7 +69,7 @@ public interface IIotDeviceStatusService
/**
* 删除设备状态信息
*
*
* @param deviceStatusId 设备状态ID
* @return 结果
*/

View File

@@ -0,0 +1,68 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.IotDeviceUserRelation;
/**
* 【请填写功能名称】Service接口
*
* @author wxy
* @date 2021-08-27
*/
public interface IIotDeviceUserRelationService {
/**
* 查询【请填写功能名称】
*
* @param id 【请填写功能名称】ID
* @return 【请填写功能名称】
*/
public IotDeviceUserRelation selectIotDeviceUserRelationById(Long id);
/**
* 查询【请填写功能名称】列表
*
* @param iotDeviceUserRelation 【请填写功能名称】
* @return 【请填写功能名称】集合
*/
public List<IotDeviceUserRelation> selectIotDeviceUserRelationList(IotDeviceUserRelation iotDeviceUserRelation);
/**
* 新增【请填写功能名称】
*
* @param iotDeviceUserRelation 【请填写功能名称】
* @return 结果
*/
public int insertIotDeviceUserRelation(IotDeviceUserRelation iotDeviceUserRelation);
/**
* 修改【请填写功能名称】
*
* @param iotDeviceUserRelation 【请填写功能名称】
* @return 结果
*/
public int updateIotDeviceUserRelation(IotDeviceUserRelation iotDeviceUserRelation);
/**
* 批量删除【请填写功能名称】
*
* @param ids 需要删除的【请填写功能名称】ID
* @return 结果
*/
public int deleteIotDeviceUserRelationByIds(Long[] ids);
/**
* 删除【请填写功能名称】信息
*
* @param id 【请填写功能名称】ID
* @return 结果
*/
public int deleteIotDeviceUserRelationById(Long id);
List<IotDeviceUserRelation> selectIotDeviceUserRelationByDeviceId(Long deviceId);
List<IotDeviceUserRelation> selectIotDeviceUserRelationByUserId(Long userId);
IotDeviceUserRelation selectIotDeviceUserRelationByDeviceIdAndUserId(Long deviceId,Long userId);
}

View File

@@ -1,19 +1,19 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.IotGroup;
/**
* 分组Service接口
*
*
* @author kerwincui
* @date 2021-05-18
*/
public interface IIotGroupService
{
public interface IIotGroupService {
/**
* 查询分组
*
*
* @param groupId 分组ID
* @return 分组
*/
@@ -21,7 +21,7 @@ public interface IIotGroupService
/**
* 查询分组列表
*
*
* @param iotGroup 分组
* @return 分组集合
*/
@@ -29,7 +29,7 @@ public interface IIotGroupService
/**
* 新增分组
*
*
* @param iotGroup 分组
* @return 结果
*/
@@ -37,7 +37,7 @@ public interface IIotGroupService
/**
* 修改分组
*
*
* @param iotGroup 分组
* @return 结果
*/
@@ -45,7 +45,7 @@ public interface IIotGroupService
/**
* 批量删除分组
*
*
* @param groupIds 需要删除的分组ID
* @return 结果
*/
@@ -53,7 +53,7 @@ public interface IIotGroupService
/**
* 删除分组信息
*
*
* @param groupId 分组ID
* @return 结果
*/

View File

@@ -1,18 +1,18 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.SysConfig;
/**
* 参数配置 服务层
*
*
* @author ruoyi
*/
public interface ISysConfigService
{
public interface ISysConfigService {
/**
* 查询参数配置信息
*
*
* @param configId 参数配置ID
* @return 参数配置信息
*/
@@ -20,7 +20,7 @@ public interface ISysConfigService
/**
* 根据键名查询参数配置信息
*
*
* @param configKey 参数键名
* @return 参数键值
*/
@@ -28,7 +28,7 @@ public interface ISysConfigService
/**
* 查询参数配置列表
*
*
* @param config 参数配置信息
* @return 参数配置集合
*/
@@ -36,7 +36,7 @@ public interface ISysConfigService
/**
* 新增参数配置
*
*
* @param config 参数配置信息
* @return 结果
*/
@@ -44,7 +44,7 @@ public interface ISysConfigService
/**
* 修改参数配置
*
*
* @param config 参数配置信息
* @return 结果
*/
@@ -52,7 +52,7 @@ public interface ISysConfigService
/**
* 批量删除参数信息
*
*
* @param configIds 需要删除的参数ID
* @return 结果
*/
@@ -65,7 +65,7 @@ public interface ISysConfigService
/**
* 校验参数键名是否唯一
*
*
* @param config 参数信息
* @return 结果
*/

View File

@@ -1,19 +1,19 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysDept;
/**
* 部门管理 服务层
*
*
* @author ruoyi
*/
public interface ISysDeptService
{
public interface ISysDeptService {
/**
* 查询部门管理数据
*
*
* @param dept 部门信息
* @return 部门信息集合
*/
@@ -21,7 +21,7 @@ public interface ISysDeptService
/**
* 构建前端所需要树结构
*
*
* @param depts 部门列表
* @return 树结构列表
*/
@@ -29,7 +29,7 @@ public interface ISysDeptService
/**
* 构建前端所需要下拉树结构
*
*
* @param depts 部门列表
* @return 下拉树结构列表
*/
@@ -37,7 +37,7 @@ public interface ISysDeptService
/**
* 根据角色ID查询部门树信息
*
*
* @param roleId 角色ID
* @return 选中部门列表
*/
@@ -45,7 +45,7 @@ public interface ISysDeptService
/**
* 根据部门ID查询信息
*
*
* @param deptId 部门ID
* @return 部门信息
*/
@@ -53,7 +53,7 @@ public interface ISysDeptService
/**
* 根据ID查询所有子部门正常状态
*
*
* @param deptId 部门ID
* @return 子部门数
*/
@@ -61,7 +61,7 @@ public interface ISysDeptService
/**
* 是否存在部门子节点
*
*
* @param deptId 部门ID
* @return 结果
*/
@@ -69,7 +69,7 @@ public interface ISysDeptService
/**
* 查询部门是否存在用户
*
*
* @param deptId 部门ID
* @return 结果 true 存在 false 不存在
*/
@@ -77,7 +77,7 @@ public interface ISysDeptService
/**
* 校验部门名称是否唯一
*
*
* @param dept 部门信息
* @return 结果
*/
@@ -85,7 +85,7 @@ public interface ISysDeptService
/**
* 新增保存部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
@@ -93,7 +93,7 @@ public interface ISysDeptService
/**
* 修改保存部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
@@ -101,7 +101,7 @@ public interface ISysDeptService
/**
* 删除部门管理信息
*
*
* @param deptId 部门ID
* @return 结果
*/

View File

@@ -1,18 +1,18 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysDictData;
/**
* 字典 业务层
*
*
* @author ruoyi
*/
public interface ISysDictDataService
{
public interface ISysDictDataService {
/**
* 根据条件分页查询字典数据
*
*
* @param dictData 字典数据信息
* @return 字典数据集合信息
*/
@@ -20,8 +20,8 @@ public interface ISysDictDataService
/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典标签
*/
@@ -29,7 +29,7 @@ public interface ISysDictDataService
/**
* 根据字典数据ID查询信息
*
*
* @param dictCode 字典数据ID
* @return 字典数据
*/
@@ -37,7 +37,7 @@ public interface ISysDictDataService
/**
* 批量删除字典数据信息
*
*
* @param dictCodes 需要删除的字典数据ID
* @return 结果
*/
@@ -45,7 +45,7 @@ public interface ISysDictDataService
/**
* 新增保存字典数据信息
*
*
* @param dictData 字典数据信息
* @return 结果
*/
@@ -53,7 +53,7 @@ public interface ISysDictDataService
/**
* 修改保存字典数据信息
*
*
* @param dictData 字典数据信息
* @return 结果
*/

View File

@@ -1,19 +1,19 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysDictType;
/**
* 字典 业务层
*
*
* @author ruoyi
*/
public interface ISysDictTypeService
{
public interface ISysDictTypeService {
/**
* 根据条件分页查询字典类型
*
*
* @param dictType 字典类型信息
* @return 字典类型集合信息
*/
@@ -21,14 +21,14 @@ public interface ISysDictTypeService
/**
* 根据所有字典类型
*
*
* @return 字典类型集合信息
*/
public List<SysDictType> selectDictTypeAll();
/**
* 根据字典类型查询字典数据
*
*
* @param dictType 字典类型
* @return 字典数据集合信息
*/
@@ -36,7 +36,7 @@ public interface ISysDictTypeService
/**
* 根据字典类型ID查询信息
*
*
* @param dictId 字典类型ID
* @return 字典类型
*/
@@ -44,7 +44,7 @@ public interface ISysDictTypeService
/**
* 根据字典类型查询信息
*
*
* @param dictType 字典类型
* @return 字典类型
*/
@@ -52,7 +52,7 @@ public interface ISysDictTypeService
/**
* 批量删除字典信息
*
*
* @param dictIds 需要删除的字典ID
* @return 结果
*/
@@ -65,7 +65,7 @@ public interface ISysDictTypeService
/**
* 新增保存字典类型信息
*
*
* @param dictType 字典类型信息
* @return 结果
*/
@@ -73,7 +73,7 @@ public interface ISysDictTypeService
/**
* 修改保存字典类型信息
*
*
* @param dictType 字典类型信息
* @return 结果
*/
@@ -81,7 +81,7 @@ public interface ISysDictTypeService
/**
* 校验字典类型称是否唯一
*
*
* @param dictType 字典类型
* @return 结果
*/

View File

@@ -1,25 +1,25 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.SysLogininfor;
/**
* 系统访问日志情况信息 服务层
*
*
* @author ruoyi
*/
public interface ISysLogininforService
{
public interface ISysLogininforService {
/**
* 新增系统登录日志
*
*
* @param logininfor 访问日志对象
*/
public void insertLogininfor(SysLogininfor logininfor);
/**
* 查询系统登录日志集合
*
*
* @param logininfor 访问日志对象
* @return 登录记录集合
*/
@@ -27,7 +27,7 @@ public interface ISysLogininforService
/**
* 批量删除系统登录日志
*
*
* @param infoIds 需要删除的登录日志ID
* @return
*/

View File

@@ -2,20 +2,20 @@ package com.ruoyi.system.service;
import java.util.List;
import java.util.Set;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.system.domain.vo.RouterVo;
/**
* 菜单 业务层
*
*
* @author ruoyi
*/
public interface ISysMenuService
{
public interface ISysMenuService {
/**
* 根据用户查询系统菜单列表
*
*
* @param userId 用户ID
* @return 菜单列表
*/
@@ -23,8 +23,8 @@ public interface ISysMenuService
/**
* 根据用户查询系统菜单列表
*
* @param menu 菜单信息
*
* @param menu 菜单信息
* @param userId 用户ID
* @return 菜单列表
*/
@@ -32,7 +32,7 @@ public interface ISysMenuService
/**
* 根据用户ID查询权限
*
*
* @param userId 用户ID
* @return 权限列表
*/
@@ -40,7 +40,7 @@ public interface ISysMenuService
/**
* 根据用户ID查询菜单树信息
*
*
* @param userId 用户ID
* @return 菜单列表
*/
@@ -48,7 +48,7 @@ public interface ISysMenuService
/**
* 根据角色ID查询菜单树信息
*
*
* @param roleId 角色ID
* @return 选中菜单列表
*/
@@ -56,7 +56,7 @@ public interface ISysMenuService
/**
* 构建前端路由所需要的菜单
*
*
* @param menus 菜单列表
* @return 路由列表
*/
@@ -64,7 +64,7 @@ public interface ISysMenuService
/**
* 构建前端所需要树结构
*
*
* @param menus 菜单列表
* @return 树结构列表
*/
@@ -72,7 +72,7 @@ public interface ISysMenuService
/**
* 构建前端所需要下拉树结构
*
*
* @param menus 菜单列表
* @return 下拉树结构列表
*/
@@ -80,7 +80,7 @@ public interface ISysMenuService
/**
* 根据菜单ID查询信息
*
*
* @param menuId 菜单ID
* @return 菜单信息
*/
@@ -88,7 +88,7 @@ public interface ISysMenuService
/**
* 是否存在菜单子节点
*
*
* @param menuId 菜单ID
* @return 结果 true 存在 false 不存在
*/
@@ -96,7 +96,7 @@ public interface ISysMenuService
/**
* 查询菜单是否存在角色
*
*
* @param menuId 菜单ID
* @return 结果 true 存在 false 不存在
*/
@@ -104,7 +104,7 @@ public interface ISysMenuService
/**
* 新增保存菜单信息
*
*
* @param menu 菜单信息
* @return 结果
*/
@@ -112,7 +112,7 @@ public interface ISysMenuService
/**
* 修改保存菜单信息
*
*
* @param menu 菜单信息
* @return 结果
*/
@@ -120,7 +120,7 @@ public interface ISysMenuService
/**
* 删除菜单管理信息
*
*
* @param menuId 菜单ID
* @return 结果
*/
@@ -128,7 +128,7 @@ public interface ISysMenuService
/**
* 校验菜单名称是否唯一
*
*
* @param menu 菜单信息
* @return 结果
*/

View File

@@ -1,18 +1,18 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.SysNotice;
/**
* 公告 服务层
*
*
* @author ruoyi
*/
public interface ISysNoticeService
{
public interface ISysNoticeService {
/**
* 查询公告信息
*
*
* @param noticeId 公告ID
* @return 公告信息
*/
@@ -20,7 +20,7 @@ public interface ISysNoticeService
/**
* 查询公告列表
*
*
* @param notice 公告信息
* @return 公告集合
*/
@@ -28,7 +28,7 @@ public interface ISysNoticeService
/**
* 新增公告
*
*
* @param notice 公告信息
* @return 结果
*/
@@ -36,7 +36,7 @@ public interface ISysNoticeService
/**
* 修改公告
*
*
* @param notice 公告信息
* @return 结果
*/
@@ -44,15 +44,15 @@ public interface ISysNoticeService
/**
* 删除公告信息
*
*
* @param noticeId 公告ID
* @return 结果
*/
public int deleteNoticeById(Long noticeId);
/**
* 批量删除公告信息
*
*
* @param noticeIds 需要删除的公告ID
* @return 结果
*/

View File

@@ -1,25 +1,25 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.SysOperLog;
/**
* 操作日志 服务层
*
*
* @author ruoyi
*/
public interface ISysOperLogService
{
public interface ISysOperLogService {
/**
* 新增操作日志
*
*
* @param operLog 操作日志对象
*/
public void insertOperlog(SysOperLog operLog);
/**
* 查询系统操作日志集合
*
*
* @param operLog 操作日志对象
* @return 操作日志集合
*/
@@ -27,7 +27,7 @@ public interface ISysOperLogService
/**
* 批量删除系统操作日志
*
*
* @param operIds 需要删除的操作日志ID
* @return 结果
*/
@@ -35,7 +35,7 @@ public interface ISysOperLogService
/**
* 查询操作日志详细
*
*
* @param operId 操作ID
* @return 操作日志对象
*/

View File

@@ -1,18 +1,18 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.SysPost;
/**
* 岗位信息 服务层
*
*
* @author ruoyi
*/
public interface ISysPostService
{
public interface ISysPostService {
/**
* 查询岗位信息集合
*
*
* @param post 岗位信息
* @return 岗位列表
*/
@@ -20,14 +20,14 @@ public interface ISysPostService
/**
* 查询所有岗位
*
*
* @return 岗位列表
*/
public List<SysPost> selectPostAll();
/**
* 通过岗位ID查询岗位信息
*
*
* @param postId 岗位ID
* @return 角色对象信息
*/
@@ -35,7 +35,7 @@ public interface ISysPostService
/**
* 根据用户ID获取岗位选择框列表
*
*
* @param userId 用户ID
* @return 选中岗位ID列表
*/
@@ -43,7 +43,7 @@ public interface ISysPostService
/**
* 校验岗位名称
*
*
* @param post 岗位信息
* @return 结果
*/
@@ -51,7 +51,7 @@ public interface ISysPostService
/**
* 校验岗位编码
*
*
* @param post 岗位信息
* @return 结果
*/
@@ -59,7 +59,7 @@ public interface ISysPostService
/**
* 通过岗位ID查询岗位使用数量
*
*
* @param postId 岗位ID
* @return 结果
*/
@@ -67,7 +67,7 @@ public interface ISysPostService
/**
* 删除岗位信息
*
*
* @param postId 岗位ID
* @return 结果
*/
@@ -75,7 +75,7 @@ public interface ISysPostService
/**
* 批量删除岗位信息
*
*
* @param postIds 需要删除的岗位ID
* @return 结果
* @throws Exception 异常
@@ -84,7 +84,7 @@ public interface ISysPostService
/**
* 新增保存岗位信息
*
*
* @param post 岗位信息
* @return 结果
*/
@@ -92,7 +92,7 @@ public interface ISysPostService
/**
* 修改保存岗位信息
*
*
* @param post 岗位信息
* @return 结果
*/

View File

@@ -2,18 +2,18 @@ package com.ruoyi.system.service;
import java.util.List;
import java.util.Set;
import com.ruoyi.common.core.domain.entity.SysRole;
/**
* 角色业务层
*
*
* @author ruoyi
*/
public interface ISysRoleService
{
public interface ISysRoleService {
/**
* 根据条件分页查询角色数据
*
*
* @param role 角色信息
* @return 角色数据集合信息
*/
@@ -21,7 +21,7 @@ public interface ISysRoleService
/**
* 根据用户ID查询角色
*
*
* @param userId 用户ID
* @return 权限列表
*/
@@ -29,14 +29,14 @@ public interface ISysRoleService
/**
* 查询所有角色
*
*
* @return 角色列表
*/
public List<SysRole> selectRoleAll();
/**
* 根据用户ID获取角色选择框列表
*
*
* @param userId 用户ID
* @return 选中角色ID列表
*/
@@ -44,7 +44,7 @@ public interface ISysRoleService
/**
* 通过角色ID查询角色
*
*
* @param roleId 角色ID
* @return 角色对象信息
*/
@@ -52,7 +52,7 @@ public interface ISysRoleService
/**
* 校验角色名称是否唯一
*
*
* @param role 角色信息
* @return 结果
*/
@@ -60,7 +60,7 @@ public interface ISysRoleService
/**
* 校验角色权限是否唯一
*
*
* @param role 角色信息
* @return 结果
*/
@@ -68,14 +68,14 @@ public interface ISysRoleService
/**
* 校验角色是否允许操作
*
*
* @param role 角色信息
*/
public void checkRoleAllowed(SysRole role);
/**
* 通过角色ID查询角色使用数量
*
*
* @param roleId 角色ID
* @return 结果
*/
@@ -83,7 +83,7 @@ public interface ISysRoleService
/**
* 新增保存角色信息
*
*
* @param role 角色信息
* @return 结果
*/
@@ -91,7 +91,7 @@ public interface ISysRoleService
/**
* 修改保存角色信息
*
*
* @param role 角色信息
* @return 结果
*/
@@ -99,7 +99,7 @@ public interface ISysRoleService
/**
* 修改角色状态
*
*
* @param role 角色信息
* @return 结果
*/
@@ -107,7 +107,7 @@ public interface ISysRoleService
/**
* 修改数据权限信息
*
*
* @param role 角色信息
* @return 结果
*/
@@ -115,7 +115,7 @@ public interface ISysRoleService
/**
* 通过角色ID删除角色
*
*
* @param roleId 角色ID
* @return 结果
*/
@@ -123,7 +123,7 @@ public interface ISysRoleService
/**
* 批量删除角色信息
*
*
* @param roleIds 需要删除的角色ID
* @return 结果
*/

View File

@@ -5,42 +5,41 @@ import com.ruoyi.system.domain.SysUserOnline;
/**
* 在线用户 服务层
*
*
* @author ruoyi
*/
public interface ISysUserOnlineService
{
public interface ISysUserOnlineService {
/**
* 通过登录地址查询信息
*
*
* @param ipaddr 登录地址
* @param user 用户信息
* @param user 用户信息
* @return 在线用户信息
*/
public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user);
/**
* 通过用户名称查询信息
*
*
* @param userName 用户名称
* @param user 用户信息
* @param user 用户信息
* @return 在线用户信息
*/
public SysUserOnline selectOnlineByUserName(String userName, LoginUser user);
/**
* 通过登录地址/用户名称查询信息
*
* @param ipaddr 登录地址
*
* @param ipaddr 登录地址
* @param userName 用户名称
* @param user 用户信息
* @param user 用户信息
* @return 在线用户信息
*/
public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user);
/**
* 设置在线用户信息
*
*
* @param user 用户信息
* @return 在线用户
*/

View File

@@ -1,18 +1,18 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysUser;
/**
* 用户 业务层
*
*
* @author ruoyi
*/
public interface ISysUserService
{
public interface ISysUserService {
/**
* 根据条件分页查询用户列表
*
*
* @param user 用户信息
* @return 用户信息集合信息
*/
@@ -20,15 +20,17 @@ public interface ISysUserService
/**
* 通过用户名查询用户
*
*
* @param userName 用户名
* @return 用户对象信息
*/
public SysUser selectUserByUserName(String userName);
public SysUser selectUserByOpenId(String openId);
/**
* 通过用户ID查询用户
*
*
* @param userId 用户ID
* @return 用户对象信息
*/
@@ -36,7 +38,7 @@ public interface ISysUserService
/**
* 根据用户ID查询用户所属角色组
*
*
* @param userName 用户名
* @return 结果
*/
@@ -44,7 +46,7 @@ public interface ISysUserService
/**
* 根据用户ID查询用户所属岗位组
*
*
* @param userName 用户名
* @return 结果
*/
@@ -52,7 +54,7 @@ public interface ISysUserService
/**
* 校验用户名称是否唯一
*
*
* @param userName 用户名称
* @return 结果
*/
@@ -76,14 +78,14 @@ public interface ISysUserService
/**
* 校验用户是否允许操作
*
*
* @param user 用户信息
*/
public void checkUserAllowed(SysUser user);
/**
* 新增用户信息
*
*
* @param user 用户信息
* @return 结果
*/
@@ -91,7 +93,7 @@ public interface ISysUserService
/**
* 修改用户信息
*
*
* @param user 用户信息
* @return 结果
*/
@@ -99,7 +101,7 @@ public interface ISysUserService
/**
* 修改用户状态
*
*
* @param user 用户信息
* @return 结果
*/
@@ -107,7 +109,7 @@ public interface ISysUserService
/**
* 修改用户基本信息
*
*
* @param user 用户信息
* @return 结果
*/
@@ -115,16 +117,16 @@ public interface ISysUserService
/**
* 修改用户头像
*
*
* @param userName 用户名
* @param avatar 头像地址
* @param avatar 头像地址
* @return 结果
*/
public boolean updateUserAvatar(String userName, String avatar);
/**
* 重置用户密码
*
*
* @param user 用户信息
* @return 结果
*/
@@ -132,7 +134,7 @@ public interface ISysUserService
/**
* 重置用户密码
*
*
* @param userName 用户名
* @param password 密码
* @return 结果
@@ -141,7 +143,7 @@ public interface ISysUserService
/**
* 通过用户ID删除用户
*
*
* @param userId 用户ID
* @return 结果
*/
@@ -149,7 +151,7 @@ public interface ISysUserService
/**
* 批量删除用户信息
*
*
* @param userIds 需要删除的用户ID
* @return 结果
*/
@@ -157,10 +159,10 @@ public interface ISysUserService
/**
* 导入用户数据
*
* @param userList 用户数据列表
*
* @param userList 用户数据列表
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
* @param operName 操作用户
* @param operName 操作用户
* @return 结果
*/
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.TUserAccountInfo;
/**
* 小程序用户Service接口
*
* @author wxy
* @date 2021-08-26
*/
public interface ITUserAccountInfoService {
/**
* 查询小程序用户
*
* @param id 小程序用户ID
* @return 小程序用户
*/
public TUserAccountInfo selectTUserAccountInfoById(Long id);
/**
* 查询小程序用户列表
*
* @param tUserAccountInfo 小程序用户
* @return 小程序用户集合
*/
public List<TUserAccountInfo> selectTUserAccountInfoList(TUserAccountInfo tUserAccountInfo);
/**
* 新增小程序用户
*
* @param tUserAccountInfo 小程序用户
* @return 结果
*/
public int insertTUserAccountInfo(TUserAccountInfo tUserAccountInfo);
/**
* 修改小程序用户
*
* @param tUserAccountInfo 小程序用户
* @return 结果
*/
public int updateTUserAccountInfo(TUserAccountInfo tUserAccountInfo);
/**
* 批量删除小程序用户
*
* @param ids 需要删除的小程序用户ID
* @return 结果
*/
public int deleteTUserAccountInfoByIds(Long[] ids);
/**
* 删除小程序用户信息
*
* @param id 小程序用户ID
* @return 结果
*/
public int deleteTUserAccountInfoById(Long id);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.TUserLoginLog;
/**
* 【请填写功能名称】Service接口
*
* @author wxy
* @date 2021-08-26
*/
public interface ITUserLoginLogService {
/**
* 查询【请填写功能名称】
*
* @param id 【请填写功能名称】ID
* @return 【请填写功能名称】
*/
public TUserLoginLog selectTUserLoginLogById(Long id);
/**
* 查询【请填写功能名称】列表
*
* @param tUserLoginLog 【请填写功能名称】
* @return 【请填写功能名称】集合
*/
public List<TUserLoginLog> selectTUserLoginLogList(TUserLoginLog tUserLoginLog);
/**
* 新增【请填写功能名称】
*
* @param tUserLoginLog 【请填写功能名称】
* @return 结果
*/
public int insertTUserLoginLog(TUserLoginLog tUserLoginLog);
/**
* 修改【请填写功能名称】
*
* @param tUserLoginLog 【请填写功能名称】
* @return 结果
*/
public int updateTUserLoginLog(TUserLoginLog tUserLoginLog);
/**
* 批量删除【请填写功能名称】
*
* @param ids 需要删除的【请填写功能名称】ID
* @return 结果
*/
public int deleteTUserLoginLogByIds(Long[] ids);
/**
* 删除【请填写功能名称】信息
*
* @param id 【请填写功能名称】ID
* @return 结果
*/
public int deleteTUserLoginLogById(Long id);
}

View File

@@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -10,87 +11,80 @@ import com.ruoyi.system.service.IIotCategoryService;
/**
* 设备分类Service业务层处理
*
*
* @author kerwincui
* @date 2021-05-07
*/
@Service
public class IotCategoryServiceImpl implements IIotCategoryService
{
public class IotCategoryServiceImpl implements IIotCategoryService {
@Autowired
private IotCategoryMapper iotCategoryMapper;
/**
* 查询设备分类
*
*
* @param categoryId 设备分类ID
* @return 设备分类
*/
@Override
public IotCategory selectIotCategoryById(Long categoryId)
{
public IotCategory selectIotCategoryById(Long categoryId) {
return iotCategoryMapper.selectIotCategoryById(categoryId);
}
/**
* 查询设备分类列表
*
*
* @param iotCategory 设备分类
* @return 设备分类
*/
@Override
public List<IotCategory> selectIotCategoryList(IotCategory iotCategory)
{
public List<IotCategory> selectIotCategoryList(IotCategory iotCategory) {
return iotCategoryMapper.selectIotCategoryList(iotCategory);
}
/**
* 新增设备分类
*
*
* @param iotCategory 设备分类
* @return 结果
*/
@Override
public int insertIotCategory(IotCategory iotCategory)
{
public int insertIotCategory(IotCategory iotCategory) {
iotCategory.setCreateTime(DateUtils.getNowDate());
return iotCategoryMapper.insertIotCategory(iotCategory);
}
/**
* 修改设备分类
*
*
* @param iotCategory 设备分类
* @return 结果
*/
@Override
public int updateIotCategory(IotCategory iotCategory)
{
public int updateIotCategory(IotCategory iotCategory) {
iotCategory.setUpdateTime(DateUtils.getNowDate());
return iotCategoryMapper.updateIotCategory(iotCategory);
}
/**
* 批量删除设备分类
*
*
* @param categoryIds 需要删除的设备分类ID
* @return 结果
*/
@Override
public int deleteIotCategoryByIds(Long[] categoryIds)
{
public int deleteIotCategoryByIds(Long[] categoryIds) {
return iotCategoryMapper.deleteIotCategoryByIds(categoryIds);
}
/**
* 删除设备分类信息
*
*
* @param categoryId 设备分类ID
* @return 结果
*/
@Override
public int deleteIotCategoryById(Long categoryId)
{
public int deleteIotCategoryById(Long categoryId) {
return iotCategoryMapper.deleteIotCategoryById(categoryId);
}
}

View File

@@ -1,35 +1,56 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.vo.IotDeviceListDto;
import com.ruoyi.system.mqtt.config.MqttPushClient;
import com.ruoyi.system.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.IotDeviceMapper;
import com.ruoyi.system.domain.IotDevice;
import com.ruoyi.system.service.IIotDeviceService;
import org.springframework.transaction.annotation.Transactional;
/**
* 设备Service业务层处理
*
*
* @author kerwincui
* @date 2021-05-06
*/
@Service
public class IotDeviceServiceImpl implements IIotDeviceService
{
@Slf4j
public class IotDeviceServiceImpl implements IIotDeviceService {
@Autowired
private IotDeviceMapper iotDeviceMapper;
@Autowired
private MqttPushClient pushClient;
@Autowired
private ITUserAccountInfoService userAccountInfoService;
@Autowired
private IIotDeviceUserRelationService deviceUserRelationService;
@Autowired
private IIotDeviceSetService iotDeviceSetService;
@Autowired
private IIotDeviceStatusService iotDeviceStatusService;
/**
* 查询设备
*
*
* @param deviceId 设备ID
* @return 设备
*/
@Override
public IotDevice selectIotDeviceById(Long deviceId)
{
public IotDevice selectIotDeviceById(Long deviceId) {
return iotDeviceMapper.selectIotDeviceById(deviceId);
}
@@ -40,70 +61,276 @@ public class IotDeviceServiceImpl implements IIotDeviceService
* @return 设备
*/
@Override
public IotDevice selectIotDeviceByNum(String deviceNum)
{
public IotDevice selectIotDeviceByNum(String deviceNum) {
return iotDeviceMapper.selectIotDeviceByNum(deviceNum);
}
/**
* 查询设备列表
*
*
* @param iotDevice 设备
* @return 设备
*/
@Override
public List<IotDeviceListDto> selectIotDeviceList(IotDevice iotDevice)
{
public List<IotDeviceListDto> selectIotDeviceList(IotDevice iotDevice) {
return iotDeviceMapper.selectIotDeviceList(iotDevice);
}
/**
* 新增设备
*
*
* @param iotDevice 设备
* @return 结果
*/
@Override
public int insertIotDevice(IotDevice iotDevice)
{
public int insertIotDevice(IotDevice iotDevice) {
iotDevice.setCreateTime(DateUtils.getNowDate());
return iotDeviceMapper.insertIotDevice(iotDevice);
}
/**
* 修改设备
*
*
* @param iotDevice 设备
* @return 结果
*/
@Override
public int updateIotDevice(IotDevice iotDevice)
{
public int updateIotDevice(IotDevice iotDevice) {
iotDevice.setUpdateTime(DateUtils.getNowDate());
return iotDeviceMapper.updateIotDevice(iotDevice);
}
/**
* 批量删除设备
*
*
* @param deviceIds 需要删除的设备ID
* @return 结果
*/
@Override
public int deleteIotDeviceByIds(Long[] deviceIds)
{
public int deleteIotDeviceByIds(Long[] deviceIds) {
return iotDeviceMapper.deleteIotDeviceByIds(deviceIds);
}
/**
* 删除设备信息
*
*
* @param deviceId 设备ID
* @return 结果
*/
@Override
public int deleteIotDeviceById(Long deviceId)
{
public int deleteIotDeviceById(Long deviceId) {
return iotDeviceMapper.deleteIotDeviceById(deviceId);
}
@Override
public int controlDeviceByNum(String deviceNum, String cmd) {
IotDevice iotDevice = iotDeviceMapper.selectIotDeviceByNum(deviceNum);
if(iotDevice==null)
{
throw new CustomException("设备不存在");
}
Long deviceId = iotDevice.getDeviceId();
// IotDeviceStatus status = iotDeviceStatusService.selectIotDeviceStatusByDeviceId(iotDeviceSet.getDeviceId());
// if (status == null || status.getIsOnline() == 0) {
// return AjaxResult.error("设备已离线,不能更新状态。");
// }
// // 存储
// iotDeviceSetService.updateIotDeviceSet(iotDeviceSet);
//
// //mqtt发布
// IotDeviceSet set = iotDeviceSetService.selectIotDeviceSetByDeviceId(iotDeviceSet.getDeviceId());
// if (iotDeviceSet.getIsRadar() != null) {
// set.setIsRadar(iotDeviceSet.getIsRadar());
// }
// if (iotDeviceSet.getIsAlarm() != null) {
// set.setIsAlarm(iotDeviceSet.getIsAlarm());
// }
// if (iotDeviceSet.getRadarInterval() != null) {
// set.setRadarInterval(iotDeviceSet.getRadarInterval());
// }
// if (iotDeviceSet.getIsRfControl() != null) {
// set.setIsRfControl(iotDeviceSet.getIsRfControl());
// }
// if (iotDeviceSet.getRfOneFunc() != null) {
// set.setRfOneFunc(iotDeviceSet.getRfOneFunc());
// }
// if (iotDeviceSet.getRfTwoFunc() != null) {
// set.setRfTwoFunc(iotDeviceSet.getRfTwoFunc());
// }
// if (iotDeviceSet.getRfThreeFunc() != null) {
// set.setRfThreeFunc(iotDeviceSet.getRfThreeFunc());
// }
// if (iotDeviceSet.getRfFourFunc() != null) {
// set.setRfFourFunc(iotDeviceSet.getRfFourFunc());
// }
// if (iotDeviceSet.getIsRfLearn() != null) {
// set.setIsRfLearn(iotDeviceSet.getIsRfLearn());
// }
// if (iotDeviceSet.getIsRfClear() != null) {
// set.setIsRfClear(iotDeviceSet.getIsRfClear());
// }
// if (iotDeviceSet.getIsAp() != null) {
// set.setIsAp(iotDeviceSet.getIsAp());
// }
// if (iotDeviceSet.getIsReset() != null) {
// set.setIsReset(iotDeviceSet.getIsReset());
// }
// String content = JSON.toJSONString(set);
// String topic = "xiaoyi/swtich/devices/"+deviceNum;
IotDeviceStatus iotDeviceStatus = new IotDeviceStatus();
iotDeviceStatus.setDeviceId(deviceId);
if("on".equalsIgnoreCase(cmd))
{
iotDeviceStatus.setRelayStatus(1);
}else{
iotDeviceStatus.setRelayStatus(0);
}
String topic = "status/set/" + deviceNum;
String content = JSON.toJSONString(iotDeviceStatus);
// content="{\"deviceId\":\"4\",\"params\":{},\"relayStatus\":\"1\"}";
System.out.println("topic:"+topic);
System.out.println("content:"+content);
boolean publish = pushClient.publish(2, true, topic, content);
if(publish)
{
return 1;
}else{
throw new CustomException("指令发送失败");
}
}
/**
* @Method
* @Description 用户添加设备
* @Param null
* @return
* @date 2021-08-27,0027 11:33
* @author admin
*
*/
@Override
@Transactional
public int bindDevice(Long userId,String nickName, String deviceNum, String name, Long categoryId, String remark) {
IotDevice iotDevice = iotDeviceMapper.selectIotDeviceByNum(deviceNum);
if(iotDevice==null)
{
throw new CustomException("设备【"+deviceNum+"】不存在");
}
Long deviceId = iotDevice.getDeviceId();
IotDeviceUserRelation iotDeviceUserRelation = deviceUserRelationService.selectIotDeviceUserRelationByDeviceIdAndUserId(deviceId, userId);
if(iotDeviceUserRelation!=null)
{
throw new CustomException("该设备已被绑定!");
// throw new CustomException("设备【"+deviceNum+"】已经绑定,请换其他设备!");
}
log.info("用户: "+nickName+",添加设备【"+deviceNum+"】,名称为:"+name);
// iotDevice.setDeviceName(name);
iotDevice.setRemark(remark);
if("未激活".equals(iotDevice.getStatus()))
{
throw new CustomException("该设备未激活不能绑定!");
}
iotDeviceMapper.updateIotDevice(iotDevice);
//保存设备用户关联
IotDeviceUserRelation iotDeviceUserRelation1 = new IotDeviceUserRelation();
iotDeviceUserRelation1.setDeviceId(deviceId);
iotDeviceUserRelation1.setDeviceNum(deviceNum);
iotDeviceUserRelation1.setUserId(userId);
iotDeviceUserRelation1.setDeviceName(name);
return deviceUserRelationService.insertIotDeviceUserRelation(iotDeviceUserRelation1);
}
@Override
public List<IotDeviceListDto> selectMpIotDeviceList(IotDevice iotDevice) {
return iotDeviceMapper.selectMpIotDeviceList(iotDevice);
}
@Override
@Transactional
public int updateDeviceInfo(Long userId, String nickName, Long deviceId, String name, String remark) {
IotDevice iotDevice = iotDeviceMapper.selectIotDeviceById(deviceId);
if(iotDevice==null)
{
throw new CustomException("设备不存在");
}
IotDeviceUserRelation iotDeviceUserRelation = deviceUserRelationService.selectIotDeviceUserRelationByDeviceIdAndUserId(deviceId, userId);
if(iotDeviceUserRelation==null)
{
throw new CustomException("设备不存在!");
}
String deviceNum=iotDevice.getDeviceNum();
log.info("用户: "+nickName+",修改设备【"+deviceNum+"】名称为:"+name);
// iotDeviceMapper.updateIotDevice(iotDevice);
//保存设备用户关联
IotDeviceUserRelation iotDeviceUserRelation1 = new IotDeviceUserRelation();
iotDeviceUserRelation1.setId(iotDeviceUserRelation.getId());
iotDeviceUserRelation1.setDeviceId(deviceId);
iotDeviceUserRelation1.setDeviceNum(deviceNum);
iotDeviceUserRelation1.setUserId(userId);
iotDeviceUserRelation1.setDeviceName(name);
iotDeviceUserRelation1.setRemark(remark);
return deviceUserRelationService.updateIotDeviceUserRelation(iotDeviceUserRelation1);
}
@Override
public IotDevice selectIotDeviceByUserAndNum(Long userId, String deviceNum) {
IotDevice iotDevice = iotDeviceMapper.selectIotDeviceByNum(deviceNum);
if(iotDevice==null)
{
throw new CustomException("设备不存在");
}
Long deviceId = iotDevice.getDeviceId();
IotDeviceUserRelation iotDeviceUserRelation = deviceUserRelationService.selectIotDeviceUserRelationByDeviceIdAndUserId(deviceId, userId);
if(iotDeviceUserRelation==null)
{
throw new CustomException("设备不存在!");
}
iotDevice.setDeviceName(iotDeviceUserRelation.getDeviceName());
iotDevice.setRemark(iotDeviceUserRelation.getRemark());
return iotDevice;
}
@Override
public int unBindDevice(Long userId, String nickName, Long deviceId) {
IotDevice iotDevice = iotDeviceMapper.selectIotDeviceById(deviceId);
if(iotDevice==null)
{
throw new CustomException("设备不存在");
}
IotDeviceUserRelation iotDeviceUserRelation = deviceUserRelationService.selectIotDeviceUserRelationByDeviceIdAndUserId(deviceId, userId);
if(iotDeviceUserRelation==null)
{
throw new CustomException("设备不存在,或已解绑!");
}
String deviceNum = iotDevice.getDeviceNum();
log.info("用户: "+nickName+",解绑设备【"+deviceNum+"");
return deviceUserRelationService.deleteIotDeviceUserRelationById(iotDeviceUserRelation.getId());
}
@Override
public JSONObject getDeviceInfoByDeviceNum(Long userId, String nickname,String deviceNum) {
return iotDeviceMapper.getDeviceInfoByDeviceNum(userId,deviceNum);
}
@Override
public JSONObject getDeviceInfoByDeviceId(Long userId, String nickname,Long deviceId) {
return iotDeviceMapper.getDeviceInfoByDeviceId(userId,deviceId);
}
}

View File

@@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -10,25 +11,23 @@ import com.ruoyi.system.service.IIotDeviceSetService;
/**
* 设备配置Service业务层处理
*
*
* @author kerwincui
* @date 2021-05-06
*/
@Service
public class IotDeviceSetServiceImpl implements IIotDeviceSetService
{
public class IotDeviceSetServiceImpl implements IIotDeviceSetService {
@Autowired
private IotDeviceSetMapper iotDeviceSetMapper;
/**
* 查询设备配置
*
*
* @param deviceConfigId 设备配置ID
* @return 设备配置
*/
@Override
public IotDeviceSet selectIotDeviceSetById(Long deviceSetId)
{
public IotDeviceSet selectIotDeviceSetById(Long deviceSetId) {
return iotDeviceSetMapper.selectIotDeviceSetById(deviceSetId);
}
@@ -39,70 +38,64 @@ public class IotDeviceSetServiceImpl implements IIotDeviceSetService
* @return 设备配置
*/
@Override
public IotDeviceSet selectIotDeviceSetByDeviceId(Long deviceId)
{
public IotDeviceSet selectIotDeviceSetByDeviceId(Long deviceId) {
return iotDeviceSetMapper.selectIotDeviceSetByDeviceId(deviceId);
}
/**
* 查询设备配置列表
*
*
* @param iotDeviceSet 设备配置
* @return 设备配置
*/
@Override
public List<IotDeviceSet> selectIotDeviceSetList(IotDeviceSet iotDeviceSet)
{
public List<IotDeviceSet> selectIotDeviceSetList(IotDeviceSet iotDeviceSet) {
return iotDeviceSetMapper.selectIotDeviceSetList(iotDeviceSet);
}
/**
* 新增设备配置
*
*
* @param iotDeviceSet 设备配置
* @return 结果
*/
@Override
public int insertIotDeviceSet(IotDeviceSet iotDeviceSet)
{
public int insertIotDeviceSet(IotDeviceSet iotDeviceSet) {
iotDeviceSet.setCreateTime(DateUtils.getNowDate());
return iotDeviceSetMapper.insertIotDeviceSet(iotDeviceSet);
}
/**
* 修改设备配置
*
*
* @param iotDeviceSet 设备配置
* @return 结果
*/
@Override
public int updateIotDeviceSet(IotDeviceSet iotDeviceSet)
{
public int updateIotDeviceSet(IotDeviceSet iotDeviceSet) {
iotDeviceSet.setUpdateTime(DateUtils.getNowDate());
return iotDeviceSetMapper.updateIotDeviceSet(iotDeviceSet);
}
/**
* 批量删除设备配置
*
*
* @param deviceConfigIds 需要删除的设备配置ID
* @return 结果
*/
@Override
public int deleteIotDeviceSetByIds(Long[] deviceConfigIds)
{
public int deleteIotDeviceSetByIds(Long[] deviceConfigIds) {
return iotDeviceSetMapper.deleteIotDeviceSetByIds(deviceConfigIds);
}
/**
* 删除设备配置信息
*
*
* @param deviceConfigId 设备配置ID
* @return 结果
*/
@Override
public int deleteIotDeviceSetById(Long deviceConfigId)
{
public int deleteIotDeviceSetById(Long deviceConfigId) {
return iotDeviceSetMapper.deleteIotDeviceSetById(deviceConfigId);
}
}

View File

@@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -10,25 +11,23 @@ import com.ruoyi.system.service.IIotDeviceStatusService;
/**
* 设备状态Service业务层处理
*
*
* @author kerwincui
* @date 2021-05-06
*/
@Service
public class IotDeviceStatusServiceImpl implements IIotDeviceStatusService
{
public class IotDeviceStatusServiceImpl implements IIotDeviceStatusService {
@Autowired
private IotDeviceStatusMapper iotDeviceStatusMapper;
/**
* 查询设备状态
*
*
* @param deviceStatusId 设备状态ID
* @return 设备状态
*/
@Override
public IotDeviceStatus selectIotDeviceStatusById(Long deviceStatusId)
{
public IotDeviceStatus selectIotDeviceStatusById(Long deviceStatusId) {
return iotDeviceStatusMapper.selectIotDeviceStatusById(deviceStatusId);
}
@@ -39,8 +38,7 @@ public class IotDeviceStatusServiceImpl implements IIotDeviceStatusService
* @return 设备状态
*/
@Override
public IotDeviceStatus selectIotDeviceStatusByDeviceId(Long deviceId)
{
public IotDeviceStatus selectIotDeviceStatusByDeviceId(Long deviceId) {
return iotDeviceStatusMapper.selectIotDeviceStatusByDeviceId(deviceId);
}
@@ -51,70 +49,64 @@ public class IotDeviceStatusServiceImpl implements IIotDeviceStatusService
* @return 设备状态
*/
@Override
public IotDeviceStatus selectIotDeviceStatusByDeviceNum(String deviceNum)
{
public IotDeviceStatus selectIotDeviceStatusByDeviceNum(String deviceNum) {
return iotDeviceStatusMapper.selectIotDeviceStatusByDeviceNum(deviceNum);
}
/**
* 查询设备状态列表
*
*
* @param iotDeviceStatus 设备状态
* @return 设备状态
*/
@Override
public List<IotDeviceStatus> selectIotDeviceStatusList(IotDeviceStatus iotDeviceStatus)
{
public List<IotDeviceStatus> selectIotDeviceStatusList(IotDeviceStatus iotDeviceStatus) {
return iotDeviceStatusMapper.selectIotDeviceStatusList(iotDeviceStatus);
}
/**
* 新增设备状态
*
*
* @param iotDeviceStatus 设备状态
* @return 结果
*/
@Override
public int insertIotDeviceStatus(IotDeviceStatus iotDeviceStatus)
{
public int insertIotDeviceStatus(IotDeviceStatus iotDeviceStatus) {
iotDeviceStatus.setCreateTime(DateUtils.getNowDate());
return iotDeviceStatusMapper.insertIotDeviceStatus(iotDeviceStatus);
}
/**
* 修改设备状态
*
*
* @param iotDeviceStatus 设备状态
* @return 结果
*/
@Override
public int updateIotDeviceStatus(IotDeviceStatus iotDeviceStatus)
{
public int updateIotDeviceStatus(IotDeviceStatus iotDeviceStatus) {
iotDeviceStatus.setUpdateTime(DateUtils.getNowDate());
return iotDeviceStatusMapper.updateIotDeviceStatus(iotDeviceStatus);
}
/**
* 批量删除设备状态
*
*
* @param deviceStatusIds 需要删除的设备状态ID
* @return 结果
*/
@Override
public int deleteIotDeviceStatusByIds(Long[] deviceStatusIds)
{
public int deleteIotDeviceStatusByIds(Long[] deviceStatusIds) {
return iotDeviceStatusMapper.deleteIotDeviceStatusByIds(deviceStatusIds);
}
/**
* 删除设备状态信息
*
*
* @param deviceStatusId 设备状态ID
* @return 结果
*/
@Override
public int deleteIotDeviceStatusById(Long deviceStatusId)
{
public int deleteIotDeviceStatusById(Long deviceStatusId) {
return iotDeviceStatusMapper.deleteIotDeviceStatusById(deviceStatusId);
}
}

View File

@@ -0,0 +1,113 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.IotDeviceUserRelationMapper;
import com.ruoyi.system.domain.IotDeviceUserRelation;
import com.ruoyi.system.service.IIotDeviceUserRelationService;
/**
* 【请填写功能名称】Service业务层处理
*
* @author wxy
* @date 2021-08-27
*/
@Service
public class IotDeviceUserRelationServiceImpl implements IIotDeviceUserRelationService {
@Autowired
private IotDeviceUserRelationMapper iotDeviceUserRelationMapper;
/**
* 查询【请填写功能名称】
*
* @param id 【请填写功能名称】ID
* @return 【请填写功能名称】
*/
@Override
public IotDeviceUserRelation selectIotDeviceUserRelationById(Long id) {
return iotDeviceUserRelationMapper.selectIotDeviceUserRelationById(id);
}
/**
* 查询【请填写功能名称】列表
*
* @param iotDeviceUserRelation 【请填写功能名称】
* @return 【请填写功能名称】
*/
@Override
public List<IotDeviceUserRelation> selectIotDeviceUserRelationList(IotDeviceUserRelation iotDeviceUserRelation) {
return iotDeviceUserRelationMapper.selectIotDeviceUserRelationList(iotDeviceUserRelation);
}
/**
* 新增【请填写功能名称】
*
* @param iotDeviceUserRelation 【请填写功能名称】
* @return 结果
*/
@Override
public int insertIotDeviceUserRelation(IotDeviceUserRelation iotDeviceUserRelation) {
return iotDeviceUserRelationMapper.insertIotDeviceUserRelation(iotDeviceUserRelation);
}
/**
* 修改【请填写功能名称】
*
* @param iotDeviceUserRelation 【请填写功能名称】
* @return 结果
*/
@Override
public int updateIotDeviceUserRelation(IotDeviceUserRelation iotDeviceUserRelation) {
return iotDeviceUserRelationMapper.updateIotDeviceUserRelation(iotDeviceUserRelation);
}
/**
* 批量删除【请填写功能名称】
*
* @param ids 需要删除的【请填写功能名称】ID
* @return 结果
*/
@Override
public int deleteIotDeviceUserRelationByIds(Long[] ids) {
return iotDeviceUserRelationMapper.deleteIotDeviceUserRelationByIds(ids);
}
/**
* 删除【请填写功能名称】信息
*
* @param id 【请填写功能名称】ID
* @return 结果
*/
@Override
public int deleteIotDeviceUserRelationById(Long id) {
return iotDeviceUserRelationMapper.deleteIotDeviceUserRelationById(id);
}
@Override
public List<IotDeviceUserRelation> selectIotDeviceUserRelationByDeviceId(Long deviceId) {
IotDeviceUserRelation iotDeviceUserRelation = new IotDeviceUserRelation();
iotDeviceUserRelation.setDeviceId(deviceId);
return iotDeviceUserRelationMapper.selectIotDeviceUserRelationList(iotDeviceUserRelation);
}
@Override
public List<IotDeviceUserRelation> selectIotDeviceUserRelationByUserId(Long userId) {
IotDeviceUserRelation iotDeviceUserRelation = new IotDeviceUserRelation();
iotDeviceUserRelation.setUserId(userId);
return iotDeviceUserRelationMapper.selectIotDeviceUserRelationList(iotDeviceUserRelation);
}
@Override
public IotDeviceUserRelation selectIotDeviceUserRelationByDeviceIdAndUserId(Long deviceId, Long userId) {
IotDeviceUserRelation iotDeviceUserRelation = new IotDeviceUserRelation();
iotDeviceUserRelation.setUserId(userId);
List<IotDeviceUserRelation> iotDeviceUserRelations = iotDeviceUserRelationMapper.selectIotDeviceUserRelationList(iotDeviceUserRelation);
if(iotDeviceUserRelations==null || iotDeviceUserRelations.size()==0)
{
return null;
}
return iotDeviceUserRelations.get(0);
}
}

View File

@@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -10,87 +11,80 @@ import com.ruoyi.system.service.IIotGroupService;
/**
* 分组Service业务层处理
*
*
* @author kerwincui
* @date 2021-05-18
*/
@Service
public class IotGroupServiceImpl implements IIotGroupService
{
public class IotGroupServiceImpl implements IIotGroupService {
@Autowired
private IotGroupMapper iotGroupMapper;
/**
* 查询分组
*
*
* @param groupId 分组ID
* @return 分组
*/
@Override
public IotGroup selectIotGroupById(Long groupId)
{
public IotGroup selectIotGroupById(Long groupId) {
return iotGroupMapper.selectIotGroupById(groupId);
}
/**
* 查询分组列表
*
*
* @param iotGroup 分组
* @return 分组
*/
@Override
public List<IotGroup> selectIotGroupList(IotGroup iotGroup)
{
public List<IotGroup> selectIotGroupList(IotGroup iotGroup) {
return iotGroupMapper.selectIotGroupList(iotGroup);
}
/**
* 新增分组
*
*
* @param iotGroup 分组
* @return 结果
*/
@Override
public int insertIotGroup(IotGroup iotGroup)
{
public int insertIotGroup(IotGroup iotGroup) {
iotGroup.setCreateTime(DateUtils.getNowDate());
return iotGroupMapper.insertIotGroup(iotGroup);
}
/**
* 修改分组
*
*
* @param iotGroup 分组
* @return 结果
*/
@Override
public int updateIotGroup(IotGroup iotGroup)
{
public int updateIotGroup(IotGroup iotGroup) {
iotGroup.setUpdateTime(DateUtils.getNowDate());
return iotGroupMapper.updateIotGroup(iotGroup);
}
/**
* 批量删除分组
*
*
* @param groupIds 需要删除的分组ID
* @return 结果
*/
@Override
public int deleteIotGroupByIds(Long[] groupIds)
{
public int deleteIotGroupByIds(Long[] groupIds) {
return iotGroupMapper.deleteIotGroupByIds(groupIds);
}
/**
* 删除分组信息
*
*
* @param groupId 分组ID
* @return 结果
*/
@Override
public int deleteIotGroupById(Long groupId)
{
public int deleteIotGroupById(Long groupId) {
return iotGroupMapper.deleteIotGroupById(groupId);
}
}

View File

@@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl;
import java.util.Collection;
import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.annotation.DataSource;
@@ -19,12 +20,11 @@ import com.ruoyi.system.service.ISysConfigService;
/**
* 参数配置 服务层实现
*
*
* @author ruoyi
*/
@Service
public class SysConfigServiceImpl implements ISysConfigService
{
public class SysConfigServiceImpl implements ISysConfigService {
@Autowired
private SysConfigMapper configMapper;
@@ -35,25 +35,22 @@ public class SysConfigServiceImpl implements ISysConfigService
* 项目启动时,初始化参数到缓存
*/
@PostConstruct
public void init()
{
public void init() {
List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig());
for (SysConfig config : configsList)
{
for (SysConfig config : configsList) {
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
}
}
/**
* 查询参数配置信息
*
*
* @param configId 参数配置ID
* @return 参数配置信息
*/
@Override
@DataSource(DataSourceType.MASTER)
public SysConfig selectConfigById(Long configId)
{
public SysConfig selectConfigById(Long configId) {
SysConfig config = new SysConfig();
config.setConfigId(configId);
return configMapper.selectConfig(config);
@@ -61,23 +58,20 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 根据键名查询参数配置信息
*
*
* @param configKey 参数key
* @return 参数键值
*/
@Override
public String selectConfigByKey(String configKey)
{
public String selectConfigByKey(String configKey) {
String configValue = Convert.toStr(redisCache.getCacheObject(getCacheKey(configKey)));
if (StringUtils.isNotEmpty(configValue))
{
if (StringUtils.isNotEmpty(configValue)) {
return configValue;
}
SysConfig config = new SysConfig();
config.setConfigKey(configKey);
SysConfig retConfig = configMapper.selectConfig(config);
if (StringUtils.isNotNull(retConfig))
{
if (StringUtils.isNotNull(retConfig)) {
redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue());
return retConfig.getConfigValue();
}
@@ -86,28 +80,25 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 查询参数配置列表
*
*
* @param config 参数配置信息
* @return 参数配置集合
*/
@Override
public List<SysConfig> selectConfigList(SysConfig config)
{
public List<SysConfig> selectConfigList(SysConfig config) {
return configMapper.selectConfigList(config);
}
/**
* 新增参数配置
*
*
* @param config 参数配置信息
* @return 结果
*/
@Override
public int insertConfig(SysConfig config)
{
public int insertConfig(SysConfig config) {
int row = configMapper.insertConfig(config);
if (row > 0)
{
if (row > 0) {
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
}
return row;
@@ -115,16 +106,14 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 修改参数配置
*
*
* @param config 参数配置信息
* @return 结果
*/
@Override
public int updateConfig(SysConfig config)
{
public int updateConfig(SysConfig config) {
int row = configMapper.updateConfig(config);
if (row > 0)
{
if (row > 0) {
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
}
return row;
@@ -132,24 +121,20 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 批量删除参数信息
*
*
* @param configIds 需要删除的参数ID
* @return 结果
*/
@Override
public int deleteConfigByIds(Long[] configIds)
{
for (Long configId : configIds)
{
public int deleteConfigByIds(Long[] configIds) {
for (Long configId : configIds) {
SysConfig config = selectConfigById(configId);
if (StringUtils.equals(UserConstants.YES, config.getConfigType()))
{
if (StringUtils.equals(UserConstants.YES, config.getConfigType())) {
throw new CustomException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
}
}
int count = configMapper.deleteConfigByIds(configIds);
if (count > 0)
{
if (count > 0) {
Collection<String> keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*");
redisCache.deleteObject(keys);
}
@@ -160,25 +145,22 @@ public class SysConfigServiceImpl implements ISysConfigService
* 清空缓存数据
*/
@Override
public void clearCache()
{
public void clearCache() {
Collection<String> keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*");
redisCache.deleteObject(keys);
}
/**
* 校验参数键名是否唯一
*
*
* @param config 参数配置信息
* @return 结果
*/
@Override
public String checkConfigKeyUnique(SysConfig config)
{
public String checkConfigKeyUnique(SysConfig config) {
Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey());
if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue())
{
if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@@ -186,12 +168,11 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 设置cache key
*
*
* @param configKey 参数键
* @return 缓存键key
*/
private String getCacheKey(String configKey)
{
private String getCacheKey(String configKey) {
return Constants.SYS_CONFIG_KEY + configKey;
}
}

View File

@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.annotation.DataScope;
@@ -19,12 +20,11 @@ import com.ruoyi.system.service.ISysDeptService;
/**
* 部门管理 服务实现
*
*
* @author ruoyi
*/
@Service
public class SysDeptServiceImpl implements ISysDeptService
{
public class SysDeptServiceImpl implements ISysDeptService {
@Autowired
private SysDeptMapper deptMapper;
@@ -33,44 +33,38 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 查询部门管理数据
*
*
* @param dept 部门信息
* @return 部门信息集合
*/
@Override
@DataScope(deptAlias = "d")
public List<SysDept> selectDeptList(SysDept dept)
{
public List<SysDept> selectDeptList(SysDept dept) {
return deptMapper.selectDeptList(dept);
}
/**
* 构建前端所需要树结构
*
*
* @param depts 部门列表
* @return 树结构列表
*/
@Override
public List<SysDept> buildDeptTree(List<SysDept> depts)
{
public List<SysDept> buildDeptTree(List<SysDept> depts) {
List<SysDept> returnList = new ArrayList<SysDept>();
List<Long> tempList = new ArrayList<Long>();
for (SysDept dept : depts)
{
for (SysDept dept : depts) {
tempList.add(dept.getDeptId());
}
for (Iterator<SysDept> iterator = depts.iterator(); iterator.hasNext();)
{
for (Iterator<SysDept> iterator = depts.iterator(); iterator.hasNext(); ) {
SysDept dept = (SysDept) iterator.next();
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(dept.getParentId()))
{
if (!tempList.contains(dept.getParentId())) {
recursionFn(depts, dept);
returnList.add(dept);
}
}
if (returnList.isEmpty())
{
if (returnList.isEmpty()) {
returnList = depts;
}
return returnList;
@@ -78,93 +72,85 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 构建前端所需要下拉树结构
*
*
* @param depts 部门列表
* @return 下拉树结构列表
*/
@Override
public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts)
{
public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts) {
List<SysDept> deptTrees = buildDeptTree(depts);
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
}
/**
* 根据角色ID查询部门树信息
*
*
* @param roleId 角色ID
* @return 选中部门列表
*/
@Override
public List<Integer> selectDeptListByRoleId(Long roleId)
{
public List<Integer> selectDeptListByRoleId(Long roleId) {
SysRole role = roleMapper.selectRoleById(roleId);
return deptMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly());
}
/**
* 根据部门ID查询信息
*
*
* @param deptId 部门ID
* @return 部门信息
*/
@Override
public SysDept selectDeptById(Long deptId)
{
public SysDept selectDeptById(Long deptId) {
return deptMapper.selectDeptById(deptId);
}
/**
* 根据ID查询所有子部门正常状态
*
*
* @param deptId 部门ID
* @return 子部门数
*/
@Override
public int selectNormalChildrenDeptById(Long deptId)
{
public int selectNormalChildrenDeptById(Long deptId) {
return deptMapper.selectNormalChildrenDeptById(deptId);
}
/**
* 是否存在子节点
*
*
* @param deptId 部门ID
* @return 结果
*/
@Override
public boolean hasChildByDeptId(Long deptId)
{
public boolean hasChildByDeptId(Long deptId) {
int result = deptMapper.hasChildByDeptId(deptId);
return result > 0 ? true : false;
}
/**
* 查询部门是否存在用户
*
*
* @param deptId 部门ID
* @return 结果 true 存在 false 不存在
*/
@Override
public boolean checkDeptExistUser(Long deptId)
{
public boolean checkDeptExistUser(Long deptId) {
int result = deptMapper.checkDeptExistUser(deptId);
return result > 0 ? true : false;
}
/**
* 校验部门名称是否唯一
*
*
* @param dept 部门信息
* @return 结果
*/
@Override
public String checkDeptNameUnique(SysDept dept)
{
public String checkDeptNameUnique(SysDept dept) {
Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue())
{
if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@@ -172,17 +158,15 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 新增保存部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
@Override
public int insertDept(SysDept dept)
{
public int insertDept(SysDept dept) {
SysDept info = deptMapper.selectDeptById(dept.getParentId());
// 如果父节点不为正常状态,则不允许新增子节点
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
{
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
throw new CustomException("部门停用,不允许新增");
}
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
@@ -191,25 +175,22 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 修改保存部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
@Override
public int updateDept(SysDept dept)
{
public int updateDept(SysDept dept) {
SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept))
{
if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) {
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
String oldAncestors = oldDept.getAncestors();
dept.setAncestors(newAncestors);
updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
}
int result = deptMapper.updateDept(dept);
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()))
{
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus())) {
// 如果该部门是启用状态,则启用该部门的所有上级部门
updateParentDeptStatus(dept);
}
@@ -218,11 +199,10 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 修改该部门的父级部门状态
*
*
* @param dept 当前部门
*/
private void updateParentDeptStatus(SysDept dept)
{
private void updateParentDeptStatus(SysDept dept) {
String updateBy = dept.getUpdateBy();
dept = deptMapper.selectDeptById(dept.getDeptId());
dept.setUpdateBy(updateBy);
@@ -231,48 +211,41 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 修改子元素关系
*
* @param deptId 被修改的部门ID
*
* @param deptId 被修改的部门ID
* @param newAncestors 新的父ID集合
* @param oldAncestors 旧的父ID集合
*/
public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors)
{
public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) {
List<SysDept> children = deptMapper.selectChildrenDeptById(deptId);
for (SysDept child : children)
{
for (SysDept child : children) {
child.setAncestors(child.getAncestors().replace(oldAncestors, newAncestors));
}
if (children.size() > 0)
{
if (children.size() > 0) {
deptMapper.updateDeptChildren(children);
}
}
/**
* 删除部门管理信息
*
*
* @param deptId 部门ID
* @return 结果
*/
@Override
public int deleteDeptById(Long deptId)
{
public int deleteDeptById(Long deptId) {
return deptMapper.deleteDeptById(deptId);
}
/**
* 递归列表
*/
private void recursionFn(List<SysDept> list, SysDept t)
{
private void recursionFn(List<SysDept> list, SysDept t) {
// 得到子节点列表
List<SysDept> childList = getChildList(list, t);
t.setChildren(childList);
for (SysDept tChild : childList)
{
if (hasChild(list, tChild))
{
for (SysDept tChild : childList) {
if (hasChild(list, tChild)) {
recursionFn(list, tChild);
}
}
@@ -281,15 +254,12 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 得到子节点列表
*/
private List<SysDept> getChildList(List<SysDept> list, SysDept t)
{
private List<SysDept> getChildList(List<SysDept> list, SysDept t) {
List<SysDept> tlist = new ArrayList<SysDept>();
Iterator<SysDept> it = list.iterator();
while (it.hasNext())
{
while (it.hasNext()) {
SysDept n = (SysDept) it.next();
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue())
{
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) {
tlist.add(n);
}
}
@@ -299,8 +269,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 判断是否有子节点
*/
private boolean hasChild(List<SysDept> list, SysDept t)
{
private boolean hasChild(List<SysDept> list, SysDept t) {
return getChildList(list, t).size() > 0 ? true : false;
}
}

View File

@@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.domain.entity.SysDictData;
@@ -10,64 +11,58 @@ import com.ruoyi.system.service.ISysDictDataService;
/**
* 字典 业务层处理
*
*
* @author ruoyi
*/
@Service
public class SysDictDataServiceImpl implements ISysDictDataService
{
public class SysDictDataServiceImpl implements ISysDictDataService {
@Autowired
private SysDictDataMapper dictDataMapper;
/**
* 根据条件分页查询字典数据
*
*
* @param dictData 字典数据信息
* @return 字典数据集合信息
*/
@Override
public List<SysDictData> selectDictDataList(SysDictData dictData)
{
public List<SysDictData> selectDictDataList(SysDictData dictData) {
return dictDataMapper.selectDictDataList(dictData);
}
/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典标签
*/
@Override
public String selectDictLabel(String dictType, String dictValue)
{
public String selectDictLabel(String dictType, String dictValue) {
return dictDataMapper.selectDictLabel(dictType, dictValue);
}
/**
* 根据字典数据ID查询信息
*
*
* @param dictCode 字典数据ID
* @return 字典数据
*/
@Override
public SysDictData selectDictDataById(Long dictCode)
{
public SysDictData selectDictDataById(Long dictCode) {
return dictDataMapper.selectDictDataById(dictCode);
}
/**
* 批量删除字典数据信息
*
*
* @param dictCodes 需要删除的字典数据ID
* @return 结果
*/
@Override
public int deleteDictDataByIds(Long[] dictCodes)
{
public int deleteDictDataByIds(Long[] dictCodes) {
int row = dictDataMapper.deleteDictDataByIds(dictCodes);
if (row > 0)
{
if (row > 0) {
DictUtils.clearDictCache();
}
return row;
@@ -75,16 +70,14 @@ public class SysDictDataServiceImpl implements ISysDictDataService
/**
* 新增保存字典数据信息
*
*
* @param dictData 字典数据信息
* @return 结果
*/
@Override
public int insertDictData(SysDictData dictData)
{
public int insertDictData(SysDictData dictData) {
int row = dictDataMapper.insertDictData(dictData);
if (row > 0)
{
if (row > 0) {
DictUtils.clearDictCache();
}
return row;
@@ -92,16 +85,14 @@ public class SysDictDataServiceImpl implements ISysDictDataService
/**
* 修改保存字典数据信息
*
*
* @param dictData 字典数据信息
* @return 结果
*/
@Override
public int updateDictData(SysDictData dictData)
{
public int updateDictData(SysDictData dictData) {
int row = dictDataMapper.updateDictData(dictData);
if (row > 0)
{
if (row > 0) {
DictUtils.clearDictCache();
}
return row;

View File

@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -17,12 +18,11 @@ import com.ruoyi.system.service.ISysDictTypeService;
/**
* 字典 业务层处理
*
*
* @author ruoyi
*/
@Service
public class SysDictTypeServiceImpl implements ISysDictTypeService
{
public class SysDictTypeServiceImpl implements ISysDictTypeService {
@Autowired
private SysDictTypeMapper dictTypeMapper;
@@ -33,11 +33,9 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
* 项目启动时,初始化字典到缓存
*/
@PostConstruct
public void init()
{
public void init() {
List<SysDictType> dictTypeList = dictTypeMapper.selectDictTypeAll();
for (SysDictType dictType : dictTypeList)
{
for (SysDictType dictType : dictTypeList) {
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType());
DictUtils.setDictCache(dictType.getDictType(), dictDatas);
}
@@ -45,44 +43,39 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/**
* 根据条件分页查询字典类型
*
*
* @param dictType 字典类型信息
* @return 字典类型集合信息
*/
@Override
public List<SysDictType> selectDictTypeList(SysDictType dictType)
{
public List<SysDictType> selectDictTypeList(SysDictType dictType) {
return dictTypeMapper.selectDictTypeList(dictType);
}
/**
* 根据所有字典类型
*
*
* @return 字典类型集合信息
*/
@Override
public List<SysDictType> selectDictTypeAll()
{
public List<SysDictType> selectDictTypeAll() {
return dictTypeMapper.selectDictTypeAll();
}
/**
* 根据字典类型查询字典数据
*
*
* @param dictType 字典类型
* @return 字典数据集合信息
*/
@Override
public List<SysDictData> selectDictDataByType(String dictType)
{
public List<SysDictData> selectDictDataByType(String dictType) {
List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
if (StringUtils.isNotEmpty(dictDatas))
{
if (StringUtils.isNotEmpty(dictDatas)) {
return dictDatas;
}
dictDatas = dictDataMapper.selectDictDataByType(dictType);
if (StringUtils.isNotEmpty(dictDatas))
{
if (StringUtils.isNotEmpty(dictDatas)) {
DictUtils.setDictCache(dictType, dictDatas);
return dictDatas;
}
@@ -91,48 +84,42 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/**
* 根据字典类型ID查询信息
*
*
* @param dictId 字典类型ID
* @return 字典类型
*/
@Override
public SysDictType selectDictTypeById(Long dictId)
{
public SysDictType selectDictTypeById(Long dictId) {
return dictTypeMapper.selectDictTypeById(dictId);
}
/**
* 根据字典类型查询信息
*
*
* @param dictType 字典类型
* @return 字典类型
*/
@Override
public SysDictType selectDictTypeByType(String dictType)
{
public SysDictType selectDictTypeByType(String dictType) {
return dictTypeMapper.selectDictTypeByType(dictType);
}
/**
* 批量删除字典类型信息
*
*
* @param dictIds 需要删除的字典ID
* @return 结果
*/
@Override
public int deleteDictTypeByIds(Long[] dictIds)
{
for (Long dictId : dictIds)
{
public int deleteDictTypeByIds(Long[] dictIds) {
for (Long dictId : dictIds) {
SysDictType dictType = selectDictTypeById(dictId);
if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0)
{
if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0) {
throw new CustomException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
}
}
int count = dictTypeMapper.deleteDictTypeByIds(dictIds);
if (count > 0)
{
if (count > 0) {
DictUtils.clearDictCache();
}
return count;
@@ -142,23 +129,20 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
* 清空缓存数据
*/
@Override
public void clearCache()
{
public void clearCache() {
DictUtils.clearDictCache();
}
/**
* 新增保存字典类型信息
*
*
* @param dictType 字典类型信息
* @return 结果
*/
@Override
public int insertDictType(SysDictType dictType)
{
public int insertDictType(SysDictType dictType) {
int row = dictTypeMapper.insertDictType(dictType);
if (row > 0)
{
if (row > 0) {
DictUtils.clearDictCache();
}
return row;
@@ -166,19 +150,17 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/**
* 修改保存字典类型信息
*
*
* @param dictType 字典类型信息
* @return 结果
*/
@Override
@Transactional
public int updateDictType(SysDictType dictType)
{
public int updateDictType(SysDictType dictType) {
SysDictType oldDict = dictTypeMapper.selectDictTypeById(dictType.getDictId());
dictDataMapper.updateDictDataType(oldDict.getDictType(), dictType.getDictType());
int row = dictTypeMapper.updateDictType(dictType);
if (row > 0)
{
if (row > 0) {
DictUtils.clearDictCache();
}
return row;
@@ -186,17 +168,15 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/**
* 校验字典类型称是否唯一
*
*
* @param dict 字典类型
* @return 结果
*/
@Override
public String checkDictTypeUnique(SysDictType dict)
{
public String checkDictTypeUnique(SysDictType dict) {
Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue())
{
if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;

View File

@@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.domain.SysLogininfor;
@@ -9,48 +10,44 @@ import com.ruoyi.system.service.ISysLogininforService;
/**
* 系统访问日志情况信息 服务层处理
*
*
* @author ruoyi
*/
@Service
public class SysLogininforServiceImpl implements ISysLogininforService
{
public class SysLogininforServiceImpl implements ISysLogininforService {
@Autowired
private SysLogininforMapper logininforMapper;
/**
* 新增系统登录日志
*
*
* @param logininfor 访问日志对象
*/
@Override
public void insertLogininfor(SysLogininfor logininfor)
{
public void insertLogininfor(SysLogininfor logininfor) {
logininforMapper.insertLogininfor(logininfor);
}
/**
* 查询系统登录日志集合
*
*
* @param logininfor 访问日志对象
* @return 登录记录集合
*/
@Override
public List<SysLogininfor> selectLogininforList(SysLogininfor logininfor)
{
public List<SysLogininfor> selectLogininforList(SysLogininfor logininfor) {
return logininforMapper.selectLogininforList(logininfor);
}
/**
* 批量删除系统登录日志
*
*
* @param infoIds 需要删除的登录日志ID
* @return
*/
@Override
public int deleteLogininforByIds(Long[] infoIds)
{
public int deleteLogininforByIds(Long[] infoIds) {
return logininforMapper.deleteLogininforByIds(infoIds);
}
@@ -58,8 +55,7 @@ public class SysLogininforServiceImpl implements ISysLogininforService
* 清空系统登录日志
*/
@Override
public void cleanLogininfor()
{
public void cleanLogininfor() {
logininforMapper.cleanLogininfor();
}
}

View File

@@ -8,6 +8,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.UserConstants;
@@ -26,12 +27,11 @@ import com.ruoyi.system.service.ISysMenuService;
/**
* 菜单 业务层处理
*
*
* @author ruoyi
*/
@Service
public class SysMenuServiceImpl implements ISysMenuService
{
public class SysMenuServiceImpl implements ISysMenuService {
public static final String PREMISSION_STRING = "perms[\"{0}\"]";
@Autowired
@@ -45,33 +45,28 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 根据用户查询系统菜单列表
*
*
* @param userId 用户ID
* @return 菜单列表
*/
@Override
public List<SysMenu> selectMenuList(Long userId)
{
public List<SysMenu> selectMenuList(Long userId) {
return selectMenuList(new SysMenu(), userId);
}
/**
* 查询系统菜单列表
*
*
* @param menu 菜单信息
* @return 菜单列表
*/
@Override
public List<SysMenu> selectMenuList(SysMenu menu, Long userId)
{
public List<SysMenu> selectMenuList(SysMenu menu, Long userId) {
List<SysMenu> menuList = null;
// 管理员显示所有菜单信息
if (SysUser.isAdmin(userId))
{
if (SysUser.isAdmin(userId)) {
menuList = menuMapper.selectMenuList(menu);
}
else
{
} else {
menu.getParams().put("userId", userId);
menuList = menuMapper.selectMenuListByUserId(menu);
}
@@ -80,19 +75,16 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 根据用户ID查询权限
*
*
* @param userId 用户ID
* @return 权限列表
*/
@Override
public Set<String> selectMenuPermsByUserId(Long userId)
{
public Set<String> selectMenuPermsByUserId(Long userId) {
List<String> perms = menuMapper.selectMenuPermsByUserId(userId);
Set<String> permsSet = new HashSet<>();
for (String perm : perms)
{
if (StringUtils.isNotEmpty(perm))
{
for (String perm : perms) {
if (StringUtils.isNotEmpty(perm)) {
permsSet.addAll(Arrays.asList(perm.trim().split(",")));
}
}
@@ -101,20 +93,16 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 根据用户ID查询菜单
*
*
* @param userId 用户名称
* @return 菜单列表
*/
@Override
public List<SysMenu> selectMenuTreeByUserId(Long userId)
{
public List<SysMenu> selectMenuTreeByUserId(Long userId) {
List<SysMenu> menus = null;
if (SecurityUtils.isAdmin(userId))
{
if (SecurityUtils.isAdmin(userId)) {
menus = menuMapper.selectMenuTreeAll();
}
else
{
} else {
menus = menuMapper.selectMenuTreeByUserId(userId);
}
return getChildPerms(menus, 0);
@@ -122,29 +110,26 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 根据角色ID查询菜单树信息
*
*
* @param roleId 角色ID
* @return 选中菜单列表
*/
@Override
public List<Integer> selectMenuListByRoleId(Long roleId)
{
public List<Integer> selectMenuListByRoleId(Long roleId) {
SysRole role = roleMapper.selectRoleById(roleId);
return menuMapper.selectMenuListByRoleId(roleId, role.isMenuCheckStrictly());
}
/**
* 构建前端路由所需要的菜单
*
*
* @param menus 菜单列表
* @return 路由列表
*/
@Override
public List<RouterVo> buildMenus(List<SysMenu> menus)
{
public List<RouterVo> buildMenus(List<SysMenu> menus) {
List<RouterVo> routers = new LinkedList<RouterVo>();
for (SysMenu menu : menus)
{
for (SysMenu menu : menus) {
RouterVo router = new RouterVo();
router.setHidden("1".equals(menu.getVisible()));
router.setName(getRouteName(menu));
@@ -152,14 +137,11 @@ public class SysMenuServiceImpl implements ISysMenuService
router.setComponent(getComponent(menu));
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache())));
List<SysMenu> cMenus = menu.getChildren();
if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()))
{
if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType())) {
router.setAlwaysShow(true);
router.setRedirect("noRedirect");
router.setChildren(buildMenus(cMenus));
}
else if (isMeunFrame(menu))
{
} else if (isMeunFrame(menu)) {
List<RouterVo> childrenList = new ArrayList<RouterVo>();
RouterVo children = new RouterVo();
children.setPath(menu.getPath());
@@ -176,31 +158,26 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 构建前端所需要树结构
*
*
* @param menus 菜单列表
* @return 树结构列表
*/
@Override
public List<SysMenu> buildMenuTree(List<SysMenu> menus)
{
public List<SysMenu> buildMenuTree(List<SysMenu> menus) {
List<SysMenu> returnList = new ArrayList<SysMenu>();
List<Long> tempList = new ArrayList<Long>();
for (SysMenu dept : menus)
{
for (SysMenu dept : menus) {
tempList.add(dept.getMenuId());
}
for (Iterator<SysMenu> iterator = menus.iterator(); iterator.hasNext();)
{
for (Iterator<SysMenu> iterator = menus.iterator(); iterator.hasNext(); ) {
SysMenu menu = (SysMenu) iterator.next();
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(menu.getParentId()))
{
if (!tempList.contains(menu.getParentId())) {
recursionFn(menus, menu);
returnList.add(menu);
}
}
if (returnList.isEmpty())
{
if (returnList.isEmpty()) {
returnList = menus;
}
return returnList;
@@ -208,104 +185,95 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 构建前端所需要下拉树结构
*
*
* @param menus 菜单列表
* @return 下拉树结构列表
*/
@Override
public List<TreeSelect> buildMenuTreeSelect(List<SysMenu> menus)
{
public List<TreeSelect> buildMenuTreeSelect(List<SysMenu> menus) {
List<SysMenu> menuTrees = buildMenuTree(menus);
return menuTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
}
/**
* 根据菜单ID查询信息
*
*
* @param menuId 菜单ID
* @return 菜单信息
*/
@Override
public SysMenu selectMenuById(Long menuId)
{
public SysMenu selectMenuById(Long menuId) {
return menuMapper.selectMenuById(menuId);
}
/**
* 是否存在菜单子节点
*
*
* @param menuId 菜单ID
* @return 结果
*/
@Override
public boolean hasChildByMenuId(Long menuId)
{
public boolean hasChildByMenuId(Long menuId) {
int result = menuMapper.hasChildByMenuId(menuId);
return result > 0 ? true : false;
}
/**
* 查询菜单使用数量
*
*
* @param menuId 菜单ID
* @return 结果
*/
@Override
public boolean checkMenuExistRole(Long menuId)
{
public boolean checkMenuExistRole(Long menuId) {
int result = roleMenuMapper.checkMenuExistRole(menuId);
return result > 0 ? true : false;
}
/**
* 新增保存菜单信息
*
*
* @param menu 菜单信息
* @return 结果
*/
@Override
public int insertMenu(SysMenu menu)
{
public int insertMenu(SysMenu menu) {
return menuMapper.insertMenu(menu);
}
/**
* 修改保存菜单信息
*
*
* @param menu 菜单信息
* @return 结果
*/
@Override
public int updateMenu(SysMenu menu)
{
public int updateMenu(SysMenu menu) {
return menuMapper.updateMenu(menu);
}
/**
* 删除菜单管理信息
*
*
* @param menuId 菜单ID
* @return 结果
*/
@Override
public int deleteMenuById(Long menuId)
{
public int deleteMenuById(Long menuId) {
return menuMapper.deleteMenuById(menuId);
}
/**
* 校验菜单名称是否唯一
*
*
* @param menu 菜单信息
* @return 结果
*/
@Override
public String checkMenuNameUnique(SysMenu menu)
{
public String checkMenuNameUnique(SysMenu menu) {
Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId();
SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId());
if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue())
{
if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@@ -313,16 +281,14 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 获取路由名称
*
*
* @param menu 菜单信息
* @return 路由名称
*/
public String getRouteName(SysMenu menu)
{
public String getRouteName(SysMenu menu) {
String routerName = StringUtils.capitalize(menu.getPath());
// 非外链并且是一级目录(类型为目录)
if (isMeunFrame(menu))
{
if (isMeunFrame(menu)) {
routerName = StringUtils.EMPTY;
}
return routerName;
@@ -330,22 +296,19 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 获取路由地址
*
*
* @param menu 菜单信息
* @return 路由地址
*/
public String getRouterPath(SysMenu menu)
{
public String getRouterPath(SysMenu menu) {
String routerPath = menu.getPath();
// 非外链并且是一级目录(类型为目录)
if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType())
&& UserConstants.NO_FRAME.equals(menu.getIsFrame()))
{
&& UserConstants.NO_FRAME.equals(menu.getIsFrame())) {
routerPath = "/" + menu.getPath();
}
// 非外链并且是一级目录(类型为菜单)
else if (isMeunFrame(menu))
{
else if (isMeunFrame(menu)) {
routerPath = "/";
}
return routerPath;
@@ -353,19 +316,15 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 获取组件信息
*
*
* @param menu 菜单信息
* @return 组件信息
*/
public String getComponent(SysMenu menu)
{
public String getComponent(SysMenu menu) {
String component = UserConstants.LAYOUT;
if (StringUtils.isNotEmpty(menu.getComponent()) && !isMeunFrame(menu))
{
if (StringUtils.isNotEmpty(menu.getComponent()) && !isMeunFrame(menu)) {
component = menu.getComponent();
}
else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu))
{
} else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) {
component = UserConstants.PARENT_VIEW;
}
return component;
@@ -373,43 +332,38 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 是否为菜单内部跳转
*
*
* @param menu 菜单信息
* @return 结果
*/
public boolean isMeunFrame(SysMenu menu)
{
public boolean isMeunFrame(SysMenu menu) {
return menu.getParentId().intValue() == 0 && UserConstants.TYPE_MENU.equals(menu.getMenuType())
&& menu.getIsFrame().equals(UserConstants.NO_FRAME);
}
/**
* 是否为parent_view组件
*
*
* @param menu 菜单信息
* @return 结果
*/
public boolean isParentView(SysMenu menu)
{
public boolean isParentView(SysMenu menu) {
return menu.getParentId().intValue() != 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType());
}
/**
* 根据父节点的ID获取所有子节点
*
* @param list 分类表
*
* @param list 分类表
* @param parentId 传入的父节点ID
* @return String
*/
public List<SysMenu> getChildPerms(List<SysMenu> list, int parentId)
{
public List<SysMenu> getChildPerms(List<SysMenu> list, int parentId) {
List<SysMenu> returnList = new ArrayList<SysMenu>();
for (Iterator<SysMenu> iterator = list.iterator(); iterator.hasNext();)
{
for (Iterator<SysMenu> iterator = list.iterator(); iterator.hasNext(); ) {
SysMenu t = (SysMenu) iterator.next();
// 一、根据传入的某个父节点ID,遍历该父节点的所有子节点
if (t.getParentId() == parentId)
{
if (t.getParentId() == parentId) {
recursionFn(list, t);
returnList.add(t);
}
@@ -419,19 +373,16 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 递归列表
*
*
* @param list
* @param t
*/
private void recursionFn(List<SysMenu> list, SysMenu t)
{
private void recursionFn(List<SysMenu> list, SysMenu t) {
// 得到子节点列表
List<SysMenu> childList = getChildList(list, t);
t.setChildren(childList);
for (SysMenu tChild : childList)
{
if (hasChild(list, tChild))
{
for (SysMenu tChild : childList) {
if (hasChild(list, tChild)) {
recursionFn(list, tChild);
}
}
@@ -440,15 +391,12 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 得到子节点列表
*/
private List<SysMenu> getChildList(List<SysMenu> list, SysMenu t)
{
private List<SysMenu> getChildList(List<SysMenu> list, SysMenu t) {
List<SysMenu> tlist = new ArrayList<SysMenu>();
Iterator<SysMenu> it = list.iterator();
while (it.hasNext())
{
while (it.hasNext()) {
SysMenu n = (SysMenu) it.next();
if (n.getParentId().longValue() == t.getMenuId().longValue())
{
if (n.getParentId().longValue() == t.getMenuId().longValue()) {
tlist.add(n);
}
}
@@ -458,8 +406,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 判断是否有子节点
*/
private boolean hasChild(List<SysMenu> list, SysMenu t)
{
private boolean hasChild(List<SysMenu> list, SysMenu t) {
return getChildList(list, t).size() > 0 ? true : false;
}
}

View File

@@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.domain.SysNotice;
@@ -9,84 +10,77 @@ import com.ruoyi.system.service.ISysNoticeService;
/**
* 公告 服务层实现
*
*
* @author ruoyi
*/
@Service
public class SysNoticeServiceImpl implements ISysNoticeService
{
public class SysNoticeServiceImpl implements ISysNoticeService {
@Autowired
private SysNoticeMapper noticeMapper;
/**
* 查询公告信息
*
*
* @param noticeId 公告ID
* @return 公告信息
*/
@Override
public SysNotice selectNoticeById(Long noticeId)
{
public SysNotice selectNoticeById(Long noticeId) {
return noticeMapper.selectNoticeById(noticeId);
}
/**
* 查询公告列表
*
*
* @param notice 公告信息
* @return 公告集合
*/
@Override
public List<SysNotice> selectNoticeList(SysNotice notice)
{
public List<SysNotice> selectNoticeList(SysNotice notice) {
return noticeMapper.selectNoticeList(notice);
}
/**
* 新增公告
*
*
* @param notice 公告信息
* @return 结果
*/
@Override
public int insertNotice(SysNotice notice)
{
public int insertNotice(SysNotice notice) {
return noticeMapper.insertNotice(notice);
}
/**
* 修改公告
*
*
* @param notice 公告信息
* @return 结果
*/
@Override
public int updateNotice(SysNotice notice)
{
public int updateNotice(SysNotice notice) {
return noticeMapper.updateNotice(notice);
}
/**
* 删除公告对象
*
*
* @param noticeId 公告ID
* @return 结果
*/
@Override
public int deleteNoticeById(Long noticeId)
{
public int deleteNoticeById(Long noticeId) {
return noticeMapper.deleteNoticeById(noticeId);
}
/**
* 批量删除公告信息
*
*
* @param noticeIds 需要删除的公告ID
* @return 结果
*/
@Override
public int deleteNoticeByIds(Long[] noticeIds)
{
public int deleteNoticeByIds(Long[] noticeIds) {
return noticeMapper.deleteNoticeByIds(noticeIds);
}
}

View File

@@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.domain.SysOperLog;
@@ -9,59 +10,54 @@ import com.ruoyi.system.service.ISysOperLogService;
/**
* 操作日志 服务层处理
*
*
* @author ruoyi
*/
@Service
public class SysOperLogServiceImpl implements ISysOperLogService
{
public class SysOperLogServiceImpl implements ISysOperLogService {
@Autowired
private SysOperLogMapper operLogMapper;
/**
* 新增操作日志
*
*
* @param operLog 操作日志对象
*/
@Override
public void insertOperlog(SysOperLog operLog)
{
public void insertOperlog(SysOperLog operLog) {
operLogMapper.insertOperlog(operLog);
}
/**
* 查询系统操作日志集合
*
*
* @param operLog 操作日志对象
* @return 操作日志集合
*/
@Override
public List<SysOperLog> selectOperLogList(SysOperLog operLog)
{
public List<SysOperLog> selectOperLogList(SysOperLog operLog) {
return operLogMapper.selectOperLogList(operLog);
}
/**
* 批量删除系统操作日志
*
*
* @param operIds 需要删除的操作日志ID
* @return 结果
*/
@Override
public int deleteOperLogByIds(Long[] operIds)
{
public int deleteOperLogByIds(Long[] operIds) {
return operLogMapper.deleteOperLogByIds(operIds);
}
/**
* 查询操作日志详细
*
*
* @param operId 操作ID
* @return 操作日志对象
*/
@Override
public SysOperLog selectOperLogById(Long operId)
{
public SysOperLog selectOperLogById(Long operId) {
return operLogMapper.selectOperLogById(operId);
}
@@ -69,8 +65,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
* 清空操作日志
*/
@Override
public void cleanOperLog()
{
public void cleanOperLog() {
operLogMapper.cleanOperLog();
}
}

View File

@@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.UserConstants;
@@ -13,12 +14,11 @@ import com.ruoyi.system.service.ISysPostService;
/**
* 岗位信息 服务层处理
*
*
* @author ruoyi
*/
@Service
public class SysPostServiceImpl implements ISysPostService
{
public class SysPostServiceImpl implements ISysPostService {
@Autowired
private SysPostMapper postMapper;
@@ -27,64 +27,58 @@ public class SysPostServiceImpl implements ISysPostService
/**
* 查询岗位信息集合
*
*
* @param post 岗位信息
* @return 岗位信息集合
*/
@Override
public List<SysPost> selectPostList(SysPost post)
{
public List<SysPost> selectPostList(SysPost post) {
return postMapper.selectPostList(post);
}
/**
* 查询所有岗位
*
*
* @return 岗位列表
*/
@Override
public List<SysPost> selectPostAll()
{
public List<SysPost> selectPostAll() {
return postMapper.selectPostAll();
}
/**
* 通过岗位ID查询岗位信息
*
*
* @param postId 岗位ID
* @return 角色对象信息
*/
@Override
public SysPost selectPostById(Long postId)
{
public SysPost selectPostById(Long postId) {
return postMapper.selectPostById(postId);
}
/**
* 根据用户ID获取岗位选择框列表
*
*
* @param userId 用户ID
* @return 选中岗位ID列表
*/
@Override
public List<Integer> selectPostListByUserId(Long userId)
{
public List<Integer> selectPostListByUserId(Long userId) {
return postMapper.selectPostListByUserId(userId);
}
/**
* 校验岗位名称是否唯一
*
*
* @param post 岗位信息
* @return 结果
*/
@Override
public String checkPostNameUnique(SysPost post)
{
public String checkPostNameUnique(SysPost post) {
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
SysPost info = postMapper.checkPostNameUnique(post.getPostName());
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
{
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@@ -92,17 +86,15 @@ public class SysPostServiceImpl implements ISysPostService
/**
* 校验岗位编码是否唯一
*
*
* @param post 岗位信息
* @return 结果
*/
@Override
public String checkPostCodeUnique(SysPost post)
{
public String checkPostCodeUnique(SysPost post) {
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
SysPost info = postMapper.checkPostCodeUnique(post.getPostCode());
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
{
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@@ -110,43 +102,38 @@ public class SysPostServiceImpl implements ISysPostService
/**
* 通过岗位ID查询岗位使用数量
*
*
* @param postId 岗位ID
* @return 结果
*/
@Override
public int countUserPostById(Long postId)
{
public int countUserPostById(Long postId) {
return userPostMapper.countUserPostById(postId);
}
/**
* 删除岗位信息
*
*
* @param postId 岗位ID
* @return 结果
*/
@Override
public int deletePostById(Long postId)
{
public int deletePostById(Long postId) {
return postMapper.deletePostById(postId);
}
/**
* 批量删除岗位信息
*
*
* @param postIds 需要删除的岗位ID
* @return 结果
* @throws Exception 异常
*/
@Override
public int deletePostByIds(Long[] postIds)
{
for (Long postId : postIds)
{
public int deletePostByIds(Long[] postIds) {
for (Long postId : postIds) {
SysPost post = selectPostById(postId);
if (countUserPostById(postId) > 0)
{
if (countUserPostById(postId) > 0) {
throw new CustomException(String.format("%1$s已分配,不能删除", post.getPostName()));
}
}
@@ -155,25 +142,23 @@ public class SysPostServiceImpl implements ISysPostService
/**
* 新增保存岗位信息
*
*
* @param post 岗位信息
* @return 结果
*/
@Override
public int insertPost(SysPost post)
{
public int insertPost(SysPost post) {
return postMapper.insertPost(post);
}
/**
* 修改保存岗位信息
*
*
* @param post 岗位信息
* @return 结果
*/
@Override
public int updatePost(SysPost post)
{
public int updatePost(SysPost post) {
return postMapper.updatePost(post);
}
}

View File

@@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -24,12 +25,11 @@ import com.ruoyi.system.service.ISysRoleService;
/**
* 角色 业务层处理
*
*
* @author ruoyi
*/
@Service
public class SysRoleServiceImpl implements ISysRoleService
{
public class SysRoleServiceImpl implements ISysRoleService {
@Autowired
private SysRoleMapper roleMapper;
@@ -44,32 +44,28 @@ public class SysRoleServiceImpl implements ISysRoleService
/**
* 根据条件分页查询角色数据
*
*
* @param role 角色信息
* @return 角色数据集合信息
*/
@Override
@DataScope(deptAlias = "d")
public List<SysRole> selectRoleList(SysRole role)
{
public List<SysRole> selectRoleList(SysRole role) {
return roleMapper.selectRoleList(role);
}
/**
* 根据用户ID查询权限
*
*
* @param userId 用户ID
* @return 权限列表
*/
@Override
public Set<String> selectRolePermissionByUserId(Long userId)
{
public Set<String> selectRolePermissionByUserId(Long userId) {
List<SysRole> perms = roleMapper.selectRolePermissionByUserId(userId);
Set<String> permsSet = new HashSet<>();
for (SysRole perm : perms)
{
if (StringUtils.isNotNull(perm))
{
for (SysRole perm : perms) {
if (StringUtils.isNotNull(perm)) {
permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(",")));
}
}
@@ -78,52 +74,47 @@ public class SysRoleServiceImpl implements ISysRoleService
/**
* 查询所有角色
*
*
* @return 角色列表
*/
@Override
public List<SysRole> selectRoleAll()
{
public List<SysRole> selectRoleAll() {
return SpringUtils.getAopProxy(this).selectRoleList(new SysRole());
}
/**
* 根据用户ID获取角色选择框列表
*
*
* @param userId 用户ID
* @return 选中角色ID列表
*/
@Override
public List<Integer> selectRoleListByUserId(Long userId)
{
public List<Integer> selectRoleListByUserId(Long userId) {
return roleMapper.selectRoleListByUserId(userId);
}
/**
* 通过角色ID查询角色
*
*
* @param roleId 角色ID
* @return 角色对象信息
*/
@Override
public SysRole selectRoleById(Long roleId)
{
public SysRole selectRoleById(Long roleId) {
return roleMapper.selectRoleById(roleId);
}
/**
* 校验角色名称是否唯一
*
*
* @param role 角色信息
* @return 结果
*/
@Override
public String checkRoleNameUnique(SysRole role)
{
public String checkRoleNameUnique(SysRole role) {
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName());
if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue())
{
if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@@ -131,17 +122,15 @@ public class SysRoleServiceImpl implements ISysRoleService
/**
* 校验角色权限是否唯一
*
*
* @param role 角色信息
* @return 结果
*/
@Override
public String checkRoleKeyUnique(SysRole role)
{
public String checkRoleKeyUnique(SysRole role) {
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey());
if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue())
{
if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@@ -149,40 +138,36 @@ public class SysRoleServiceImpl implements ISysRoleService
/**
* 校验角色是否允许操作
*
*
* @param role 角色信息
*/
@Override
public void checkRoleAllowed(SysRole role)
{
if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin())
{
public void checkRoleAllowed(SysRole role) {
if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin()) {
throw new CustomException("不允许操作超级管理员角色");
}
}
/**
* 通过角色ID查询角色使用数量
*
*
* @param roleId 角色ID
* @return 结果
*/
@Override
public int countUserRoleByRoleId(Long roleId)
{
public int countUserRoleByRoleId(Long roleId) {
return userRoleMapper.countUserRoleByRoleId(roleId);
}
/**
* 新增保存角色信息
*
*
* @param role 角色信息
* @return 结果
*/
@Override
@Transactional
public int insertRole(SysRole role)
{
public int insertRole(SysRole role) {
// 新增角色信息
roleMapper.insertRole(role);
return insertRoleMenu(role);
@@ -190,14 +175,13 @@ public class SysRoleServiceImpl implements ISysRoleService
/**
* 修改保存角色信息
*
*
* @param role 角色信息
* @return 结果
*/
@Override
@Transactional
public int updateRole(SysRole role)
{
public int updateRole(SysRole role) {
// 修改角色信息
roleMapper.updateRole(role);
// 删除角色与菜单关联
@@ -207,26 +191,24 @@ public class SysRoleServiceImpl implements ISysRoleService
/**
* 修改角色状态
*
*
* @param role 角色信息
* @return 结果
*/
@Override
public int updateRoleStatus(SysRole role)
{
public int updateRoleStatus(SysRole role) {
return roleMapper.updateRole(role);
}
/**
* 修改数据权限信息
*
*
* @param role 角色信息
* @return 结果
*/
@Override
@Transactional
public int authDataScope(SysRole role)
{
public int authDataScope(SysRole role) {
// 修改角色信息
roleMapper.updateRole(role);
// 删除角色与部门关联
@@ -237,23 +219,20 @@ public class SysRoleServiceImpl implements ISysRoleService
/**
* 新增角色菜单信息
*
*
* @param role 角色对象
*/
public int insertRoleMenu(SysRole role)
{
public int insertRoleMenu(SysRole role) {
int rows = 1;
// 新增用户与角色管理
List<SysRoleMenu> list = new ArrayList<SysRoleMenu>();
for (Long menuId : role.getMenuIds())
{
for (Long menuId : role.getMenuIds()) {
SysRoleMenu rm = new SysRoleMenu();
rm.setRoleId(role.getRoleId());
rm.setMenuId(menuId);
list.add(rm);
}
if (list.size() > 0)
{
if (list.size() > 0) {
rows = roleMenuMapper.batchRoleMenu(list);
}
return rows;
@@ -264,20 +243,17 @@ public class SysRoleServiceImpl implements ISysRoleService
*
* @param role 角色对象
*/
public int insertRoleDept(SysRole role)
{
public int insertRoleDept(SysRole role) {
int rows = 1;
// 新增角色与部门(数据权限)管理
List<SysRoleDept> list = new ArrayList<SysRoleDept>();
for (Long deptId : role.getDeptIds())
{
for (Long deptId : role.getDeptIds()) {
SysRoleDept rd = new SysRoleDept();
rd.setRoleId(role.getRoleId());
rd.setDeptId(deptId);
list.add(rd);
}
if (list.size() > 0)
{
if (list.size() > 0) {
rows = roleDeptMapper.batchRoleDept(list);
}
return rows;
@@ -285,14 +261,13 @@ public class SysRoleServiceImpl implements ISysRoleService
/**
* 通过角色ID删除角色
*
*
* @param roleId 角色ID
* @return 结果
*/
@Override
@Transactional
public int deleteRoleById(Long roleId)
{
public int deleteRoleById(Long roleId) {
// 删除角色与菜单关联
roleMenuMapper.deleteRoleMenuByRoleId(roleId);
// 删除角色与部门关联
@@ -302,20 +277,17 @@ public class SysRoleServiceImpl implements ISysRoleService
/**
* 批量删除角色信息
*
*
* @param roleIds 需要删除的角色ID
* @return 结果
*/
@Override
@Transactional
public int deleteRoleByIds(Long[] roleIds)
{
for (Long roleId : roleIds)
{
public int deleteRoleByIds(Long[] roleIds) {
for (Long roleId : roleIds) {
checkRoleAllowed(new SysRole(roleId));
SysRole role = selectRoleById(roleId);
if (countUserRoleByRoleId(roleId) > 0)
{
if (countUserRoleByRoleId(roleId) > 0) {
throw new CustomException(String.format("%1$s已分配,不能删除", role.getRoleName()));
}
}

View File

@@ -8,24 +8,21 @@ import com.ruoyi.system.service.ISysUserOnlineService;
/**
* 在线用户 服务层处理
*
*
* @author ruoyi
*/
@Service
public class SysUserOnlineServiceImpl implements ISysUserOnlineService
{
public class SysUserOnlineServiceImpl implements ISysUserOnlineService {
/**
* 通过登录地址查询信息
*
*
* @param ipaddr 登录地址
* @param user 用户信息
* @param user 用户信息
* @return 在线用户信息
*/
@Override
public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user)
{
if (StringUtils.equals(ipaddr, user.getIpaddr()))
{
public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user) {
if (StringUtils.equals(ipaddr, user.getIpaddr())) {
return loginUserToUserOnline(user);
}
return null;
@@ -33,16 +30,14 @@ public class SysUserOnlineServiceImpl implements ISysUserOnlineService
/**
* 通过用户名称查询信息
*
*
* @param userName 用户名称
* @param user 用户信息
* @param user 用户信息
* @return 在线用户信息
*/
@Override
public SysUserOnline selectOnlineByUserName(String userName, LoginUser user)
{
if (StringUtils.equals(userName, user.getUsername()))
{
public SysUserOnline selectOnlineByUserName(String userName, LoginUser user) {
if (StringUtils.equals(userName, user.getUsername())) {
return loginUserToUserOnline(user);
}
return null;
@@ -50,17 +45,15 @@ public class SysUserOnlineServiceImpl implements ISysUserOnlineService
/**
* 通过登录地址/用户名称查询信息
*
* @param ipaddr 登录地址
*
* @param ipaddr 登录地址
* @param userName 用户名称
* @param user 用户信息
* @param user 用户信息
* @return 在线用户信息
*/
@Override
public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user)
{
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
{
public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user) {
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername())) {
return loginUserToUserOnline(user);
}
return null;
@@ -68,15 +61,13 @@ public class SysUserOnlineServiceImpl implements ISysUserOnlineService
/**
* 设置在线用户信息
*
*
* @param user 用户信息
* @return 在线用户
*/
@Override
public SysUserOnline loginUserToUserOnline(LoginUser user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUser()))
{
public SysUserOnline loginUserToUserOnline(LoginUser user) {
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUser())) {
return null;
}
SysUserOnline sysUserOnline = new SysUserOnline();
@@ -87,8 +78,7 @@ public class SysUserOnlineServiceImpl implements ISysUserOnlineService
sysUserOnline.setBrowser(user.getBrowser());
sysUserOnline.setOs(user.getOs());
sysUserOnline.setLoginTime(user.getLoginTime());
if (StringUtils.isNotNull(user.getUser().getDept()))
{
if (StringUtils.isNotNull(user.getUser().getDept())) {
sysUserOnline.setDeptName(user.getUser().getDept().getDeptName());
}
return sysUserOnline;

View File

@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -27,12 +28,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
@@ -55,58 +55,57 @@ 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 userName 用户名
* @return 用户对象信息
*/
@Override
public SysUser selectUserByUserName(String userName)
{
public SysUser selectUserByUserName(String userName) {
return userMapper.selectUserByUserName(userName);
}
@Override
public SysUser selectUserByOpenId(String openId) {
return userMapper.selectUserByOpenId(openId);
}
/**
* 通过用户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);
StringBuffer idsStr = new StringBuffer();
for (SysRole role : list)
{
for (SysRole role : list) {
idsStr.append(role.getRoleName()).append(",");
}
if (StringUtils.isNotEmpty(idsStr.toString()))
{
if (StringUtils.isNotEmpty(idsStr.toString())) {
return idsStr.substring(0, idsStr.length() - 1);
}
return idsStr.toString();
@@ -114,21 +113,18 @@ 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);
StringBuffer idsStr = new StringBuffer();
for (SysPost post : list)
{
for (SysPost post : list) {
idsStr.append(post.getPostName()).append(",");
}
if (StringUtils.isNotEmpty(idsStr.toString()))
{
if (StringUtils.isNotEmpty(idsStr.toString())) {
return idsStr.substring(0, idsStr.length() - 1);
}
return idsStr.toString();
@@ -136,16 +132,14 @@ public class SysUserServiceImpl implements ISysUserService
/**
* 校验用户名称是否唯一
*
*
* @param userName 用户名称
* @return 结果
*/
@Override
public String checkUserNameUnique(String userName)
{
public String checkUserNameUnique(String userName) {
int count = userMapper.checkUserNameUnique(userName);
if (count > 0)
{
if (count > 0) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@@ -158,12 +152,10 @@ public class SysUserServiceImpl implements ISysUserService
* @return
*/
@Override
public String checkPhoneUnique(SysUser user)
{
public String 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;
@@ -176,12 +168,10 @@ public class SysUserServiceImpl implements ISysUserService
* @return
*/
@Override
public String checkEmailUnique(SysUser user)
{
public String 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;
@@ -189,28 +179,25 @@ 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 CustomException("不允许操作超级管理员用户");
}
}
/**
* 新增保存用户信息
*
*
* @param user 用户信息
* @return 结果
*/
@Override
@Transactional
public int insertUser(SysUser user)
{
public int insertUser(SysUser user) {
// 新增用户信息
int rows = userMapper.insertUser(user);
// 新增用户岗位关联
@@ -222,14 +209,13 @@ public class SysUserServiceImpl implements ISysUserService
/**
* 修改保存用户信息
*
*
* @param user 用户信息
* @return 结果
*/
@Override
@Transactional
public int updateUser(SysUser user)
{
public int updateUser(SysUser user) {
Long userId = user.getUserId();
// 删除用户与角色关联
userRoleMapper.deleteUserRoleByUserId(userId);
@@ -244,87 +230,78 @@ public class SysUserServiceImpl implements ISysUserService
/**
* 修改用户状态
*
*
* @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) {
Long[] roles = user.getRoleIds();
if (StringUtils.isNotNull(roles))
{
if (StringUtils.isNotNull(roles)) {
// 新增用户与角色管理
List<SysUserRole> list = new ArrayList<SysUserRole>();
for (Long roleId : roles)
{
for (Long roleId : roles) {
SysUserRole ur = new SysUserRole();
ur.setUserId(user.getUserId());
ur.setRoleId(roleId);
list.add(ur);
}
if (list.size() > 0)
{
if (list.size() > 0) {
userRoleMapper.batchUserRole(list);
}
}
@@ -332,25 +309,21 @@ public class SysUserServiceImpl implements ISysUserService
/**
* 新增用户岗位信息
*
*
* @param user 用户对象
*/
public void insertUserPost(SysUser user)
{
public void insertUserPost(SysUser user) {
Long[] posts = user.getPostIds();
if (StringUtils.isNotNull(posts))
{
if (StringUtils.isNotNull(posts)) {
// 新增用户与岗位管理
List<SysUserPost> list = new ArrayList<SysUserPost>();
for (Long postId : posts)
{
for (Long postId : posts) {
SysUserPost up = new SysUserPost();
up.setUserId(user.getUserId());
up.setPostId(postId);
list.add(up);
}
if (list.size() > 0)
{
if (list.size() > 0) {
userPostMapper.batchUserPost(list);
}
}
@@ -358,14 +331,13 @@ public class SysUserServiceImpl implements ISysUserService
/**
* 通过用户ID删除用户
*
*
* @param userId 用户ID
* @return 结果
*/
@Override
@Transactional
public int deleteUserById(Long userId)
{
public int deleteUserById(Long userId) {
// 删除用户与角色关联
userRoleMapper.deleteUserRoleByUserId(userId);
// 删除用户与岗位表
@@ -375,16 +347,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));
}
// 删除用户与角色关联
@@ -396,17 +366,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 CustomException("导入用户数据不能为空!");
}
int successNum = 0;
@@ -414,48 +382,36 @@ 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)) {
user.setPassword(SecurityUtils.encryptPassword(password));
user.setCreateBy(operName);
this.insertUser(user);
successNum++;
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
}
else if (isUpdateSupport)
{
} else if (isUpdateSupport) {
user.setUpdateBy(operName);
this.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 CustomException(failureMsg.toString());
}
else
{
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();

View File

@@ -0,0 +1,87 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TUserAccountInfoMapper;
import com.ruoyi.system.domain.TUserAccountInfo;
import com.ruoyi.system.service.ITUserAccountInfoService;
/**
* 小程序用户Service业务层处理
*
* @author wxy
* @date 2021-08-26
*/
@Service
public class TUserAccountInfoServiceImpl implements ITUserAccountInfoService {
@Autowired
private TUserAccountInfoMapper tUserAccountInfoMapper;
/**
* 查询小程序用户
*
* @param id 小程序用户ID
* @return 小程序用户
*/
@Override
public TUserAccountInfo selectTUserAccountInfoById(Long id) {
return tUserAccountInfoMapper.selectTUserAccountInfoById(id);
}
/**
* 查询小程序用户列表
*
* @param tUserAccountInfo 小程序用户
* @return 小程序用户
*/
@Override
public List<TUserAccountInfo> selectTUserAccountInfoList(TUserAccountInfo tUserAccountInfo) {
return tUserAccountInfoMapper.selectTUserAccountInfoList(tUserAccountInfo);
}
/**
* 新增小程序用户
*
* @param tUserAccountInfo 小程序用户
* @return 结果
*/
@Override
public int insertTUserAccountInfo(TUserAccountInfo tUserAccountInfo) {
return tUserAccountInfoMapper.insertTUserAccountInfo(tUserAccountInfo);
}
/**
* 修改小程序用户
*
* @param tUserAccountInfo 小程序用户
* @return 结果
*/
@Override
public int updateTUserAccountInfo(TUserAccountInfo tUserAccountInfo) {
return tUserAccountInfoMapper.updateTUserAccountInfo(tUserAccountInfo);
}
/**
* 批量删除小程序用户
*
* @param ids 需要删除的小程序用户ID
* @return 结果
*/
@Override
public int deleteTUserAccountInfoByIds(Long[] ids) {
return tUserAccountInfoMapper.deleteTUserAccountInfoByIds(ids);
}
/**
* 删除小程序用户信息
*
* @param id 小程序用户ID
* @return 结果
*/
@Override
public int deleteTUserAccountInfoById(Long id) {
return tUserAccountInfoMapper.deleteTUserAccountInfoById(id);
}
}

View File

@@ -0,0 +1,87 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TUserLoginLogMapper;
import com.ruoyi.system.domain.TUserLoginLog;
import com.ruoyi.system.service.ITUserLoginLogService;
/**
* 【请填写功能名称】Service业务层处理
*
* @author wxy
* @date 2021-08-26
*/
@Service
public class TUserLoginLogServiceImpl implements ITUserLoginLogService {
@Autowired
private TUserLoginLogMapper tUserLoginLogMapper;
/**
* 查询【请填写功能名称】
*
* @param id 【请填写功能名称】ID
* @return 【请填写功能名称】
*/
@Override
public TUserLoginLog selectTUserLoginLogById(Long id) {
return tUserLoginLogMapper.selectTUserLoginLogById(id);
}
/**
* 查询【请填写功能名称】列表
*
* @param tUserLoginLog 【请填写功能名称】
* @return 【请填写功能名称】
*/
@Override
public List<TUserLoginLog> selectTUserLoginLogList(TUserLoginLog tUserLoginLog) {
return tUserLoginLogMapper.selectTUserLoginLogList(tUserLoginLog);
}
/**
* 新增【请填写功能名称】
*
* @param tUserLoginLog 【请填写功能名称】
* @return 结果
*/
@Override
public int insertTUserLoginLog(TUserLoginLog tUserLoginLog) {
return tUserLoginLogMapper.insertTUserLoginLog(tUserLoginLog);
}
/**
* 修改【请填写功能名称】
*
* @param tUserLoginLog 【请填写功能名称】
* @return 结果
*/
@Override
public int updateTUserLoginLog(TUserLoginLog tUserLoginLog) {
return tUserLoginLogMapper.updateTUserLoginLog(tUserLoginLog);
}
/**
* 批量删除【请填写功能名称】
*
* @param ids 需要删除的【请填写功能名称】ID
* @return 结果
*/
@Override
public int deleteTUserLoginLogByIds(Long[] ids) {
return tUserLoginLogMapper.deleteTUserLoginLogByIds(ids);
}
/**
* 删除【请填写功能名称】信息
*
* @param id 【请填写功能名称】ID
* @return 结果
*/
@Override
public int deleteTUserLoginLogById(Long id) {
return tUserLoginLogMapper.deleteTUserLoginLogById(id);
}
}

View File

@@ -1,17 +1,17 @@
<?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.IotCategoryMapper">
<resultMap type="IotCategory" id="IotCategoryResult">
<result property="categoryId" column="category_id" />
<result property="categoryName" column="category_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="categoryId" column="category_id"/>
<result property="categoryName" column="category_name"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectIotCategoryVo">
@@ -22,15 +22,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectIotCategoryVo"/>
<where>
del_flag= '0'
<if test="categoryName != null and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</if>
<if test="categoryName != null and categoryName != ''">and category_name like concat('%', #{categoryName},
'%')
</if>
</where>
</select>
<select id="selectIotCategoryById" parameterType="Long" resultMap="IotCategoryResult">
<include refid="selectIotCategoryVo"/>
where category_id = #{categoryId}
</select>
<insert id="insertIotCategory" parameterType="IotCategory" useGeneratedKeys="true" keyProperty="categoryId">
insert into iot_category
<trim prefix="(" suffix=")" suffixOverrides=",">
@@ -40,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="categoryName != null and categoryName != ''">#{categoryName},</if>
<if test="createBy != null">#{createBy},</if>
@@ -48,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</trim>
</insert>
<update id="updateIotCategory" parameterType="IotCategory">

View File

@@ -1,93 +1,154 @@
<?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.IotDeviceMapper">
<resultMap type="IotDevice" id="IotDeviceResult">
<result property="deviceId" column="device_id" />
<result property="deviceNum" column="device_num" />
<result property="categoryId" column="category_id" />
<result property="categoryName" column="category_Name" />
<result property="deviceTemp" column="device_temp" />
<result property="deviceName" column="device_name" />
<result property="firmwareVersion" column="firmware_version" />
<result property="ownerId" column="owner_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="deviceId" column="device_id"/>
<result property="deviceNum" column="device_num"/>
<result property="categoryId" column="category_id"/>
<result property="categoryName" column="category_Name"/>
<result property="deviceTemp" column="device_temp"/>
<result property="deviceName" column="device_name"/>
<result property="firmwareVersion" column="firmware_version"/>
<result property="ownerId" column="owner_id"/>
<result property="status" column="status"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<resultMap type="IotDeviceListDto" id="IotDeviceListResult">
<result property="deviceId" column="device_id" />
<result property="deviceNum" column="device_num" />
<result property="categoryId" column="category_id" />
<result property="categoryName" column="category_Name" />
<result property="deviceName" column="device_name" />
<result property="firmwareVersion" column="firmware_version" />
<result property="ownerId" column="owner_id" />
<result property="nickName" column="nick_name" />
<result property="createTime" column="create_time" />
<result property="isAlarm" column="is_alarm" />
<result property="isRadar" column="is_radar" />
<result property="isRfControl" column="is_rf_control" />
<result property="networkAddress" column="network_address" />
<result property="networkIp" column="network_ip" />
<result property="relayStatus" column="relay_status" />
<result property="lightStatus" column="light_status" />
<result property="isOnline" column="is_online" />
<result property="deviceTemperature" column="device_temperature" />
<result property="rssi" column="rssi" />
<result property="deviceId" column="device_id"/>
<result property="deviceNum" column="device_num"/>
<result property="categoryId" column="category_id"/>
<result property="categoryName" column="category_Name"/>
<result property="deviceName" column="device_name"/>
<result property="firmwareVersion" column="firmware_version"/>
<result property="ownerId" column="owner_id"/>
<result property="status" column="status"/>
<result property="nickName" column="nick_name"/>
<result property="createTime" column="create_time"/>
<result property="isAlarm" column="is_alarm"/>
<result property="isRadar" column="is_radar"/>
<result property="isRfControl" column="is_rf_control"/>
<result property="networkAddress" column="network_address"/>
<result property="networkIp" column="network_ip"/>
<result property="relayStatus" column="relay_status"/>
<result property="lightStatus" column="light_status"/>
<result property="isOnline" column="is_online"/>
<result property="deviceTemperature" column="device_temperature"/>
<result property="rssi" column="rssi"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectIotDeviceVo">
select d.device_id, d.device_num, d.category_id, d.device_name, d.firmware_version, d.owner_id, d.create_by, d.create_time, d.update_by, d.update_time, d.remark,
c.category_name,
s.device_temperature as device_temp
select d.device_id, d.device_num, d.category_id, d.device_name, d.firmware_version, d.owner_id,d.status, d.create_by,
d.create_time, d.update_by, d.update_time, d.remark,
c.category_name,
s.device_temperature as device_temp
from iot_device d
left join iot_category c on d.category_id=c.category_id
left join (select device_id,device_temperature from iot_device_status
right join (select max(device_status_id) as status_id from iot_device_status group by device_id) mt
on mt.status_id=device_status_id ) as s
on d.device_id=s.device_id
left join iot_category c on d.category_id=c.category_id
left join (select device_id,device_temperature from iot_device_status
right join (select max(device_status_id) as status_id from iot_device_status group by device_id) mt
on mt.status_id=device_status_id ) as s
on d.device_id=s.device_id
</sql>
<sql id="selectIotDeviceListVo">
select d.device_id, d.device_num, d.category_id, d.device_name, d.firmware_version, d.owner_id, d.create_time,
s.relay_status,s.light_status,s.is_online,s.rssi,s.device_temperature,
t.network_address, t.network_ip,t.is_alarm, t.is_radar,t.is_rf_control,
u.nick_name,
c.category_name
<if test="groupId != null and groupId!=0">,g.group_id </if>
select d.device_id,d.status, d.device_num, d.category_id, d.device_name, d.firmware_version, d.owner_id, d.create_time,
s.relay_status,s.light_status,s.is_online,s.rssi,s.device_temperature,
t.network_address, t.network_ip,t.is_alarm, t.is_radar,t.is_rf_control,
u.nick_name,
c.category_name
<if test="groupId != null and groupId!=0">,g.group_id</if>
from iot_device d
left join (select * from iot_device_set
right join (select max(device_set_id) as set_id from iot_device_set group by device_id) ms on ms.set_id=device_set_id ) as t
on d.device_id = t.device_id
left join (select * from iot_device_status
right join (select max(device_status_id) as status_id from iot_device_status group by device_id) mt on mt.status_id=device_status_id ) as s
on d.device_id=s.device_id
left join sys_user u on d.owner_id=u.user_id
left join iot_category c on d.category_id=c.category_id
<if test="groupId != null and groupId!=0"> left join iot_device_group g on d.device_id=g.device_id </if>
left join (select * from iot_device_set
right join (select max(device_set_id) as set_id from iot_device_set group by device_id) ms on
ms.set_id=device_set_id ) as t
on d.device_id = t.device_id
left join (select * from iot_device_status
right join (select max(device_status_id) as status_id from iot_device_status group by device_id) mt on
mt.status_id=device_status_id ) as s
on d.device_id=s.device_id
left join sys_user u on d.owner_id=u.user_id
left join iot_category c on d.category_id=c.category_id
<if test="groupId != null and groupId!=0">left join iot_device_group g on d.device_id=g.device_id</if>
</sql>
<sql id="selectMpIotDeviceListVo">
SELECT
t2.device_id,
t2.status,
t2.device_num,
t2.category_id,
t1.device_name,
t2.firmware_version,
t2.owner_id,
t2.create_time,
s.relay_status,
s.light_status,
s.is_online,
s.rssi,
s.device_temperature,
t.network_address,
t.network_ip,
t.is_alarm,
t.is_radar,
t.is_rf_control,
t4.nick_name,
t3.category_name,
t1.remark
FROM
iot_device_user_relation t1
LEFT JOIN iot_device t2 ON t1.device_id = t2.device_id
AND t1.user_id = #{ownerId}
LEFT JOIN sys_user t4 on t4.user_id = t1.user_id
LEFT JOIN iot_category t3 ON t3.category_id = t2.category_id
LEFT JOIN (
SELECT
*
FROM
iot_device_set
RIGHT JOIN ( SELECT max( device_set_id ) AS set_id FROM iot_device_set GROUP BY device_id ) ms ON ms.set_id = device_set_id
) AS t ON t2.device_id = t.device_id
LEFT JOIN (
SELECT
*
FROM
iot_device_status
RIGHT JOIN ( SELECT max( device_status_id ) AS status_id FROM iot_device_status GROUP BY device_id ) mt ON mt.status_id = device_status_id
) AS s ON t2.device_id = s.device_id
</sql>
<select id="selectIotDeviceList" parameterType="IotDevice" resultMap="IotDeviceListResult">
<include refid="selectIotDeviceListVo"/>
<where>
d.del_flag= '0'
<if test="deviceNum != null and deviceNum != ''"> and d.device_num like concat('%', #{deviceNum}, '%')</if>
<if test="categoryId != null "> and d.category_id = #{categoryId}</if>
<if test="groupId != null and groupId!=0 "> and g.group_id = #{groupId}</if>
<if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
<if test="firmwareVersion != null and firmwareVersion != ''"> and d.firmware_version like concat('%', #{firmwareVersion}, '%')</if>
<if test="ownerId != null and ownerId != ''"> and d.owner_id like concat('%', #{ownerId}, '%')</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
<if test="deviceNum != null and deviceNum != ''">and d.device_num like concat('%', #{deviceNum}, '%')</if>
<if test="categoryId != null ">and d.category_id = #{categoryId}</if>
<if test="groupId != null and groupId!=0 ">and g.group_id = #{groupId}</if>
<if test="deviceName != null and deviceName != ''">and d.device_name like concat('%', #{deviceName}, '%')
</if>
<if test="firmwareVersion != null and firmwareVersion != ''">and d.firmware_version like concat('%',
#{firmwareVersion}, '%')
</if>
<if test="status != null and status != ''">and d.status = #{status}</if>
<if test="ownerId != null and ownerId != ''">and d.owner_id like concat('%', #{ownerId}, '%')</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
</select>
<select id="selectIotDeviceById" parameterType="Long" resultMap="IotDeviceResult">
<include refid="selectIotDeviceVo"/>
where d.device_id = #{deviceId}
@@ -97,7 +158,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectIotDeviceVo"/>
where d.device_num = #{deviceNum}
</select>
<insert id="insertIotDevice" parameterType="IotDevice" useGeneratedKeys="true" keyProperty="deviceId">
insert into iot_device
<trim prefix="(" suffix=")" suffixOverrides=",">
@@ -106,24 +167,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deviceName != null and deviceName != ''">device_name,</if>
<if test="firmwareVersion != null">firmware_version,</if>
<if test="ownerId != null">owner_id,</if>
<if test="status != null and status != ''">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceNum != null and deviceNum != ''">#{deviceNum},</if>
<if test="categoryId != null">#{categoryId},</if>
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
<if test="firmwareVersion != null">#{firmwareVersion},</if>
<if test="ownerId != null">#{ownerId},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</trim>
</insert>
<update id="updateIotDevice" parameterType="IotDevice">
@@ -134,6 +198,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deviceName != null and deviceName != ''">device_name = #{deviceName},</if>
<if test="firmwareVersion != null">firmware_version = #{firmwareVersion},</if>
<if test="ownerId != null">owner_id = #{ownerId},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
@@ -153,4 +218,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{deviceId}
</foreach>
</delete>
<select id="selectMpIotDeviceList" parameterType="IotDevice" resultMap="IotDeviceListResult">
<include refid="selectMpIotDeviceListVo"/>
<where>
t2.del_flag= '0'
<if test="deviceNum != null and deviceNum != ''">and t2.device_num like concat('%', #{deviceNum}, '%')</if>
<if test="categoryId != null ">and t2.category_id = #{categoryId}</if>
<if test="status != null and status != ''">and t2.status = #{status}</if>
<if test="ownerId != null and ownerId != ''">and t1.user_id = #{ownerId}</if>
</where>
</select>
<select id="getDeviceInfoByDeviceNum" parameterType="IotDevice" resultType="com.alibaba.fastjson.JSONObject">
SELECT
t3.device_name AS deviceName,
t3.remark,
t1.device_id AS deviceId,
t1.device_num AS deviceNum,
t2.is_online AS isOnline,
t4.category_id as categoryId,
t4.category_name as categoryName,
t2.relay_status as relayStatus,
t2.light_status as lightStatus
FROM iot_device t1
LEFT JOIN (
SELECT
*
FROM
iot_device_status
RIGHT JOIN ( SELECT max( device_status_id ) AS status_id FROM iot_device_status GROUP BY device_id ) ms ON ms.status_id = device_status_id
) t2 on t1.device_id = t2.device_id
LEFT JOIN iot_device_user_relation t3 on t3.device_id = t1.device_id and t3.user_id = #{userId}
LEFT JOIN iot_category t4 ON t4.category_id = t1.category_id
where t1.device_num=#{deviceNum}
</select>
<select id="getDeviceInfoByDeviceId" parameterType="IotDevice" resultType="com.alibaba.fastjson.JSONObject">
SELECT
t3.device_name AS deviceName,
t3.remark,
t1.device_id AS deviceId,
t1.device_num AS deviceNum,
t2.is_online AS isOnline,
t4.category_id as categoryId,
t4.category_name as categoryName,
t2.relay_status as relayStatus,
t2.light_status as lightStatus
FROM iot_device t1
LEFT JOIN (
SELECT
*
FROM
iot_device_status
RIGHT JOIN ( SELECT max( device_status_id ) AS status_id FROM iot_device_status GROUP BY device_id ) ms ON ms.status_id = device_status_id
) t2 on t1.device_id = t2.device_id
LEFT JOIN iot_device_user_relation t3 on t3.device_id = t1.device_id and t3.user_id = #{userId}
LEFT JOIN iot_category t4 ON t4.category_id = t1.category_id
where t1.device_id=#{deviceId}
</select>
</mapper>

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