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

View File

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

View File

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

View File

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

View File

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

View File

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