重构iot

This commit is contained in:
sxu 2024-10-16 20:22:19 +08:00
parent 2db458e227
commit f43604d86a
10 changed files with 86 additions and 86 deletions

View File

@ -28,13 +28,12 @@ import com.bonus.common.core.web.page.TableDataInfo;
* 设备类型绑定Controller
*
* @author xsheng
* @date 2024-09-27
* @date 2024-10-16
*/
@Api(tags = "设备类型绑定接口")
@RestController
@RequestMapping("/iot_machine_bind")
public class IotMachineBindController extends BaseController
{
public class IotMachineBindController extends BaseController {
@Autowired
private IIotMachineBindService iotMachineBindService;
@ -44,8 +43,7 @@ public class IotMachineBindController extends BaseController
@ApiOperation(value = "查询设备类型绑定列表")
@RequiresPermissions("iot:bind:list")
@GetMapping("/list")
public TableDataInfo list(IotMachineBind iotMachineBind)
{
public TableDataInfo list(IotMachineBind iotMachineBind) {
startPage();
List<IotMachineBind> list = iotMachineBindService.selectIotMachineBindList(iotMachineBind);
return getDataTable(list);
@ -59,8 +57,7 @@ public class IotMachineBindController extends BaseController
@RequiresPermissions("iot:bind:export")
@SysLog(title = "设备类型绑定", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出设备类型绑定")
@PostMapping("/export")
public void export(HttpServletResponse response, IotMachineBind iotMachineBind)
{
public void export(HttpServletResponse response, IotMachineBind iotMachineBind) {
List<IotMachineBind> list = iotMachineBindService.selectIotMachineBindList(iotMachineBind);
ExcelUtil<IotMachineBind> util = new ExcelUtil<IotMachineBind>(IotMachineBind.class);
util.exportExcel(response, list, "设备类型绑定数据");
@ -72,8 +69,7 @@ public class IotMachineBindController extends BaseController
@ApiOperation(value = "获取设备类型绑定详细信息")
@RequiresPermissions("iot:bind:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(iotMachineBindService.selectIotMachineBindById(id));
}
@ -85,9 +81,12 @@ public class IotMachineBindController extends BaseController
@RequiresPermissions("iot:bind:add")
@SysLog(title = "设备类型绑定", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增设备类型绑定")
@PostMapping
public AjaxResult add(@RequestBody IotMachineBind iotMachineBind)
{
public AjaxResult add(@RequestBody IotMachineBind iotMachineBind) {
try {
return toAjax(iotMachineBindService.insertIotMachineBind(iotMachineBind));
} catch (Exception e) {
return error("系统错误, " + e.getMessage());
}
}
/**
@ -98,9 +97,12 @@ public class IotMachineBindController extends BaseController
@RequiresPermissions("iot:bind:edit")
@SysLog(title = "设备类型绑定", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改设备类型绑定")
@PutMapping
public AjaxResult edit(@RequestBody IotMachineBind iotMachineBind)
{
public AjaxResult edit(@RequestBody IotMachineBind iotMachineBind) {
try {
return toAjax(iotMachineBindService.updateIotMachineBind(iotMachineBind));
} catch (Exception e) {
return error("系统错误, " + e.getMessage());
}
}
/**
@ -111,8 +113,7 @@ public class IotMachineBindController extends BaseController
@RequiresPermissions("iot:bind:remove")
@SysLog(title = "设备类型绑定", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除设备类型绑定")
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(iotMachineBindService.deleteIotMachineBindByIds(ids));
}
}

View File

@ -28,13 +28,12 @@ import com.bonus.common.core.web.page.TableDataInfo;
* 设备管理Controller
*
* @author xsheng
* @date 2024-09-27
* @date 2024-10-16
*/
@Api(tags = "设备管理接口")
@RestController
@RequestMapping("/iot_machine")
public class IotMachineController extends BaseController
{
public class IotMachineController extends BaseController {
@Autowired
private IIotMachineService iotMachineService;
@ -44,8 +43,7 @@ public class IotMachineController extends BaseController
@ApiOperation(value = "查询设备管理列表")
@RequiresPermissions("iot:machine:list")
@GetMapping("/list")
public TableDataInfo list(IotMachine iotMachine)
{
public TableDataInfo list(IotMachine iotMachine) {
startPage();
List<IotMachine> list = iotMachineService.selectIotMachineList(iotMachine);
return getDataTable(list);
@ -59,8 +57,7 @@ public class IotMachineController extends BaseController
@RequiresPermissions("iot:machine:export")
@SysLog(title = "设备管理", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出设备管理")
@PostMapping("/export")
public void export(HttpServletResponse response, IotMachine iotMachine)
{
public void export(HttpServletResponse response, IotMachine iotMachine) {
List<IotMachine> list = iotMachineService.selectIotMachineList(iotMachine);
ExcelUtil<IotMachine> util = new ExcelUtil<IotMachine>(IotMachine.class);
util.exportExcel(response, list, "设备管理数据");
@ -72,8 +69,7 @@ public class IotMachineController extends BaseController
@ApiOperation(value = "获取设备管理详细信息")
@RequiresPermissions("iot:machine:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(iotMachineService.selectIotMachineById(id));
}
@ -85,9 +81,12 @@ public class IotMachineController extends BaseController
@RequiresPermissions("iot:machine:add")
@SysLog(title = "设备管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增设备管理")
@PostMapping
public AjaxResult add(@RequestBody IotMachine iotMachine)
{
public AjaxResult add(@RequestBody IotMachine iotMachine) {
try {
return toAjax(iotMachineService.insertIotMachine(iotMachine));
} catch (Exception e) {
return error("系统错误, " + e.getMessage());
}
}
/**
@ -98,9 +97,12 @@ public class IotMachineController extends BaseController
@RequiresPermissions("iot:machine:edit")
@SysLog(title = "设备管理", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改设备管理")
@PutMapping
public AjaxResult edit(@RequestBody IotMachine iotMachine)
{
public AjaxResult edit(@RequestBody IotMachine iotMachine) {
try {
return toAjax(iotMachineService.updateIotMachine(iotMachine));
} catch (Exception e) {
return error("系统错误, " + e.getMessage());
}
}
/**
@ -111,8 +113,7 @@ public class IotMachineController extends BaseController
@RequiresPermissions("iot:machine:remove")
@SysLog(title = "设备管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除设备管理")
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(iotMachineService.deleteIotMachineByIds(ids));
}
}

View File

@ -10,14 +10,13 @@ import com.bonus.common.core.web.domain.BaseEntity;
* 设备管理对象 iot_machine
*
* @author xsheng
* @date 2024-09-27
* @date 2024-10-16
*/
@Data
@ToString
public class IotMachine extends BaseEntity
{
public class IotMachine extends BaseEntity {
private static final long serialVersionUID = 1L;
/** iot设备id */

View File

@ -12,14 +12,13 @@ import com.bonus.common.core.web.domain.BaseEntity;
* 设备类型绑定对象 iot_machine_bind
*
* @author xsheng
* @date 2024-09-27
* @date 2024-10-16
*/
@Data
@ToString
public class IotMachineBind extends BaseEntity
{
public class IotMachineBind extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键id */

View File

@ -7,10 +7,9 @@ import com.bonus.material.iot.domain.IotMachineBind;
* 设备类型绑定Mapper接口
*
* @author xsheng
* @date 2024-09-27
* @date 2024-10-16
*/
public interface IotMachineBindMapper
{
public interface IotMachineBindMapper {
/**
* 查询设备类型绑定
*

View File

@ -7,10 +7,9 @@ import com.bonus.material.iot.domain.IotMachine;
* 设备管理Mapper接口
*
* @author xsheng
* @date 2024-09-27
* @date 2024-10-16
*/
public interface IotMachineMapper
{
public interface IotMachineMapper {
/**
* 查询设备管理
*

View File

@ -7,10 +7,9 @@ import com.bonus.material.iot.domain.IotMachineBind;
* 设备类型绑定Service接口
*
* @author xsheng
* @date 2024-09-27
* @date 2024-10-16
*/
public interface IIotMachineBindService
{
public interface IIotMachineBindService {
/**
* 查询设备类型绑定
*

View File

@ -7,10 +7,9 @@ import com.bonus.material.iot.domain.IotMachine;
* 设备管理Service接口
*
* @author xsheng
* @date 2024-09-27
* @date 2024-10-16
*/
public interface IIotMachineService
{
public interface IIotMachineService {
/**
* 查询设备管理
*

View File

@ -1,6 +1,7 @@
package com.bonus.material.iot.service.impl;
import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -12,11 +13,10 @@ import com.bonus.material.iot.service.IIotMachineBindService;
* 设备类型绑定Service业务层处理
*
* @author xsheng
* @date 2024-09-27
* @date 2024-10-16
*/
@Service
public class IotMachineBindServiceImpl implements IIotMachineBindService
{
public class IotMachineBindServiceImpl implements IIotMachineBindService {
@Autowired
private IotMachineBindMapper iotMachineBindMapper;
@ -27,8 +27,7 @@ public class IotMachineBindServiceImpl implements IIotMachineBindService
* @return 设备类型绑定
*/
@Override
public IotMachineBind selectIotMachineBindById(Long id)
{
public IotMachineBind selectIotMachineBindById(Long id) {
return iotMachineBindMapper.selectIotMachineBindById(id);
}
@ -39,8 +38,7 @@ public class IotMachineBindServiceImpl implements IIotMachineBindService
* @return 设备类型绑定
*/
@Override
public List<IotMachineBind> selectIotMachineBindList(IotMachineBind iotMachineBind)
{
public List<IotMachineBind> selectIotMachineBindList(IotMachineBind iotMachineBind) {
return iotMachineBindMapper.selectIotMachineBindList(iotMachineBind);
}
@ -51,10 +49,13 @@ public class IotMachineBindServiceImpl implements IIotMachineBindService
* @return 结果
*/
@Override
public int insertIotMachineBind(IotMachineBind iotMachineBind)
{
public int insertIotMachineBind(IotMachineBind iotMachineBind) {
iotMachineBind.setCreateTime(DateUtils.getNowDate());
try {
return iotMachineBindMapper.insertIotMachineBind(iotMachineBind);
} catch (Exception e) {
throw new ServiceException("错误信息描述");
}
}
/**
@ -64,10 +65,13 @@ public class IotMachineBindServiceImpl implements IIotMachineBindService
* @return 结果
*/
@Override
public int updateIotMachineBind(IotMachineBind iotMachineBind)
{
public int updateIotMachineBind(IotMachineBind iotMachineBind) {
iotMachineBind.setUpdateTime(DateUtils.getNowDate());
try {
return iotMachineBindMapper.updateIotMachineBind(iotMachineBind);
} catch (Exception e) {
throw new ServiceException("错误信息描述");
}
}
/**
@ -77,8 +81,7 @@ public class IotMachineBindServiceImpl implements IIotMachineBindService
* @return 结果
*/
@Override
public int deleteIotMachineBindByIds(Long[] ids)
{
public int deleteIotMachineBindByIds(Long[] ids) {
return iotMachineBindMapper.deleteIotMachineBindByIds(ids);
}
@ -89,8 +92,7 @@ public class IotMachineBindServiceImpl implements IIotMachineBindService
* @return 结果
*/
@Override
public int deleteIotMachineBindById(Long id)
{
public int deleteIotMachineBindById(Long id) {
return iotMachineBindMapper.deleteIotMachineBindById(id);
}
}

View File

@ -1,6 +1,7 @@
package com.bonus.material.iot.service.impl;
import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -12,11 +13,10 @@ import com.bonus.material.iot.service.IIotMachineService;
* 设备管理Service业务层处理
*
* @author xsheng
* @date 2024-09-27
* @date 2024-10-16
*/
@Service
public class IotMachineServiceImpl implements IIotMachineService
{
public class IotMachineServiceImpl implements IIotMachineService {
@Autowired
private IotMachineMapper iotMachineMapper;
@ -27,8 +27,7 @@ public class IotMachineServiceImpl implements IIotMachineService
* @return 设备管理
*/
@Override
public IotMachine selectIotMachineById(Long id)
{
public IotMachine selectIotMachineById(Long id) {
return iotMachineMapper.selectIotMachineById(id);
}
@ -39,8 +38,7 @@ public class IotMachineServiceImpl implements IIotMachineService
* @return 设备管理
*/
@Override
public List<IotMachine> selectIotMachineList(IotMachine iotMachine)
{
public List<IotMachine> selectIotMachineList(IotMachine iotMachine) {
return iotMachineMapper.selectIotMachineList(iotMachine);
}
@ -51,10 +49,13 @@ public class IotMachineServiceImpl implements IIotMachineService
* @return 结果
*/
@Override
public int insertIotMachine(IotMachine iotMachine)
{
public int insertIotMachine(IotMachine iotMachine) {
iotMachine.setCreateTime(DateUtils.getNowDate());
try {
return iotMachineMapper.insertIotMachine(iotMachine);
} catch (Exception e) {
throw new ServiceException("错误信息描述");
}
}
/**
@ -64,10 +65,13 @@ public class IotMachineServiceImpl implements IIotMachineService
* @return 结果
*/
@Override
public int updateIotMachine(IotMachine iotMachine)
{
public int updateIotMachine(IotMachine iotMachine) {
iotMachine.setUpdateTime(DateUtils.getNowDate());
try {
return iotMachineMapper.updateIotMachine(iotMachine);
} catch (Exception e) {
throw new ServiceException("错误信息描述");
}
}
/**
@ -77,8 +81,7 @@ public class IotMachineServiceImpl implements IIotMachineService
* @return 结果
*/
@Override
public int deleteIotMachineByIds(Long[] ids)
{
public int deleteIotMachineByIds(Long[] ids) {
return iotMachineMapper.deleteIotMachineByIds(ids);
}
@ -89,8 +92,7 @@ public class IotMachineServiceImpl implements IIotMachineService
* @return 结果
*/
@Override
public int deleteIotMachineById(Long id)
{
public int deleteIotMachineById(Long id) {
return iotMachineMapper.deleteIotMachineById(id);
}
}