zhaoxianglong
5 months ago
4 changed files with 317 additions and 0 deletions
@ -0,0 +1,117 @@ |
|||||
|
package com.zc.business.controller; |
||||
|
|
||||
|
import com.ruoyi.common.annotation.Log; |
||||
|
import com.ruoyi.common.core.controller.BaseController; |
||||
|
import com.ruoyi.common.core.domain.AjaxResult; |
||||
|
import com.ruoyi.common.core.page.TableDataInfo; |
||||
|
import com.ruoyi.common.enums.BusinessType; |
||||
|
import com.zc.business.domain.DcFacility; |
||||
|
import com.zc.business.domain.DcNoStakeWarningTable; |
||||
|
import com.zc.business.service.IDcFacilityService; |
||||
|
import com.zc.business.service.IDcNoStakeWarningTableService; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 无桩号预警Controller |
||||
|
* |
||||
|
* @author zhaoxianglong |
||||
|
*/ |
||||
|
@Api(tags = {"无桩号预警"}) |
||||
|
@RestController |
||||
|
@RequestMapping("/business/facility") |
||||
|
public class DcNoStakeWarningTableController extends BaseController { |
||||
|
@Resource |
||||
|
private IDcNoStakeWarningTableService dcNoStakeWarningTableService; |
||||
|
|
||||
|
//*********************************路网设施增删改查******************************************
|
||||
|
|
||||
|
/** |
||||
|
* 分页查询无桩号预警列表 |
||||
|
* |
||||
|
* @param dcNoStakeWarningTable 请求参数 |
||||
|
* @return 分页查询结果 |
||||
|
*/ |
||||
|
@ApiOperation("分页查询路网设施列表") |
||||
|
@PreAuthorize("@ss.hasPermi('iot:facility:list')") |
||||
|
@GetMapping("list") |
||||
|
public TableDataInfo listFacility(DcNoStakeWarningTable dcNoStakeWarningTable) { |
||||
|
return getDataTable(dcNoStakeWarningTableService.pageDcNoStakeWarningTable(dcNoStakeWarningTable)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 无分页查询无桩号预警列表 |
||||
|
* |
||||
|
* @param dcNoStakeWarningTable 请求参数 |
||||
|
* @return 查询结果 |
||||
|
*/ |
||||
|
@ApiOperation("无分页查询路网设施列表") |
||||
|
@PreAuthorize("@ss.hasPermi('iot:facility:query')") |
||||
|
@GetMapping("query") |
||||
|
public AjaxResult queryFacility(DcNoStakeWarningTable dcNoStakeWarningTable) { |
||||
|
return AjaxResult.success(dcNoStakeWarningTableService.listDcNoStakeWarningTable(dcNoStakeWarningTable)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据id查询无桩号预警信息 |
||||
|
* |
||||
|
* @param id id |
||||
|
* @return 查询结果 |
||||
|
*/ |
||||
|
@ApiOperation("根据id查询路网设施信息") |
||||
|
@PreAuthorize("@ss.hasPermi('iot:facility:query')") |
||||
|
@GetMapping("{id}") |
||||
|
public AjaxResult getFacility(@PathVariable String id) { |
||||
|
return AjaxResult.success(dcNoStakeWarningTableService.getDcNoStakeWarningTable(id)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 新增 |
||||
|
* |
||||
|
* @param dcNoStakeWarningTable 新增参数 |
||||
|
* @return 新增操作结果 |
||||
|
*/ |
||||
|
@ApiOperation("新增") |
||||
|
@PreAuthorize("@ss.hasPermi('iot:facility:add')") |
||||
|
@Log(title = "新增路网设施", businessType = BusinessType.INSERT) |
||||
|
@PostMapping |
||||
|
public AjaxResult addFacility(@Valid @RequestBody DcNoStakeWarningTable dcNoStakeWarningTable) { |
||||
|
return toAjax(dcNoStakeWarningTableService.addDcNoStakeWarningTable(dcNoStakeWarningTable)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改 |
||||
|
* |
||||
|
* @param dcNoStakeWarningTable 修改参数 |
||||
|
* @return 修改操作结果 |
||||
|
*/ |
||||
|
@ApiOperation("修改") |
||||
|
@PreAuthorize("@ss.hasPermi('iot:facility:edit')") |
||||
|
@Log(title = "修改路网设施", businessType = BusinessType.UPDATE) |
||||
|
@PutMapping |
||||
|
public AjaxResult editFacility(@Valid @RequestBody DcNoStakeWarningTable dcNoStakeWarningTable) { |
||||
|
return toAjax(dcNoStakeWarningTableService.editDcNoStakeWarningTable(dcNoStakeWarningTable)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除 |
||||
|
* |
||||
|
* @param ids id集 |
||||
|
* @return 删除操作结果 |
||||
|
*/ |
||||
|
@ApiOperation("删除") |
||||
|
@PreAuthorize("@ss.hasPermi('iot:facility:remove')") |
||||
|
@Log(title = "删除", businessType = BusinessType.DELETE) |
||||
|
@DeleteMapping("{ids}") |
||||
|
public AjaxResult removeFacility(@PathVariable List<String> ids) { |
||||
|
return toAjax(dcNoStakeWarningTableService.removeDcNoStakeWarningTable(ids)); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package com.zc.business.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.zc.business.domain.DcNoStakeWarningTable; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 无桩号预警Mapper接口 |
||||
|
* |
||||
|
* @author zhaoxianglong |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface DcNoStakeWarningTableMapper extends BaseMapper<DcNoStakeWarningTable> { |
||||
|
} |
@ -0,0 +1,63 @@ |
|||||
|
package com.zc.business.service; |
||||
|
|
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.zc.business.domain.DcNoStakeWarningTable; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 无桩号预警Service接口 |
||||
|
* |
||||
|
* @author zhaoxianglong |
||||
|
*/ |
||||
|
public interface IDcNoStakeWarningTableService extends IService<DcNoStakeWarningTable> { |
||||
|
/** |
||||
|
* 添加无桩号预警 |
||||
|
* |
||||
|
* @param dcNoStakeWarningTable 设备信息 |
||||
|
* @return 操作结果 |
||||
|
*/ |
||||
|
boolean addDcNoStakeWarningTable(DcNoStakeWarningTable dcNoStakeWarningTable); |
||||
|
|
||||
|
/** |
||||
|
* 修改无桩号预警 |
||||
|
* |
||||
|
* @param dcNoStakeWarningTable 设备信息 |
||||
|
* @return 操作结果 |
||||
|
*/ |
||||
|
boolean editDcNoStakeWarningTable(DcNoStakeWarningTable dcNoStakeWarningTable); |
||||
|
|
||||
|
/** |
||||
|
* 删除无桩号预警 |
||||
|
* |
||||
|
* @param ids 设备ID |
||||
|
* @return 操作结果 |
||||
|
*/ |
||||
|
boolean removeDcNoStakeWarningTable(List<String> ids); |
||||
|
|
||||
|
/** |
||||
|
* 获取无桩号预警列表 |
||||
|
* |
||||
|
* @param dcNoStakeWarningTable 参数 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
List<DcNoStakeWarningTable> pageDcNoStakeWarningTable(DcNoStakeWarningTable dcNoStakeWarningTable); |
||||
|
|
||||
|
/** |
||||
|
* 获取无桩号预警列表 |
||||
|
* |
||||
|
* @param dcNoStakeWarningTable 参数 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
List<DcNoStakeWarningTable> listDcNoStakeWarningTable(DcNoStakeWarningTable dcNoStakeWarningTable); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 根据id查询设备信息 |
||||
|
* |
||||
|
* @param id 设备ID |
||||
|
* @return 设备信息 |
||||
|
*/ |
||||
|
DcNoStakeWarningTable getDcNoStakeWarningTable(String id); |
||||
|
} |
@ -0,0 +1,123 @@ |
|||||
|
package com.zc.business.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.ruoyi.common.constant.HttpStatus; |
||||
|
import com.ruoyi.common.exception.ServiceException; |
||||
|
import com.ruoyi.common.utils.PageUtils; |
||||
|
import com.zc.business.domain.DcFacility; |
||||
|
import com.zc.business.domain.DcNoStakeWarningTable; |
||||
|
import com.zc.business.mapper.DcFacilityMapper; |
||||
|
import com.zc.business.mapper.DcNoStakeWarningTableMapper; |
||||
|
import com.zc.business.service.IDcFacilityService; |
||||
|
import com.zc.business.service.IDcNoStakeWarningTableService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.util.StringUtils; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Objects; |
||||
|
|
||||
|
/** |
||||
|
* 无桩号预警Service业务层处理 |
||||
|
* |
||||
|
* @author zhaoxianglong |
||||
|
*/ |
||||
|
@Service |
||||
|
public class DcNoStakeWarningTableServiceImpl extends ServiceImpl<DcNoStakeWarningTableMapper, DcNoStakeWarningTable> implements IDcNoStakeWarningTableService { |
||||
|
|
||||
|
public LambdaQueryWrapper<DcNoStakeWarningTable> noStakeWarningTableQueryWrapper(DcNoStakeWarningTable dcNoStakeWarningTable) { |
||||
|
|
||||
|
LambdaQueryWrapper<DcNoStakeWarningTable> queryWrapper = new LambdaQueryWrapper<>(); |
||||
|
|
||||
|
// 设备ID
|
||||
|
if (Objects.nonNull(dcNoStakeWarningTable.getId())) { |
||||
|
queryWrapper.eq(DcNoStakeWarningTable::getId, dcNoStakeWarningTable.getId()); |
||||
|
} |
||||
|
|
||||
|
// 设备ID
|
||||
|
if (Objects.nonNull(dcNoStakeWarningTable.getWarningDescription())) { |
||||
|
queryWrapper.eq(DcNoStakeWarningTable::getWarningDescription, dcNoStakeWarningTable.getWarningDescription()); |
||||
|
} |
||||
|
|
||||
|
// 设备ID
|
||||
|
if (Objects.nonNull(dcNoStakeWarningTable.getWarningTime())) { |
||||
|
queryWrapper.eq(DcNoStakeWarningTable::getWarningTime, dcNoStakeWarningTable.getWarningTime()); |
||||
|
} |
||||
|
|
||||
|
// 设备ID
|
||||
|
if (Objects.nonNull(dcNoStakeWarningTable.getWarningType())) { |
||||
|
queryWrapper.eq(DcNoStakeWarningTable::getWarningType, dcNoStakeWarningTable.getWarningType()); |
||||
|
} |
||||
|
|
||||
|
// 设备ID
|
||||
|
if (Objects.nonNull(dcNoStakeWarningTable.getCreateTime())) { |
||||
|
queryWrapper.eq(DcNoStakeWarningTable::getCreateTime, dcNoStakeWarningTable.getCreateTime()); |
||||
|
} |
||||
|
|
||||
|
// 木桩
|
||||
|
return queryWrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public boolean addDcNoStakeWarningTable(DcNoStakeWarningTable dcNoStakeWarningTable) { |
||||
|
|
||||
|
Long id = dcNoStakeWarningTable.getId(); |
||||
|
if (Objects.nonNull(id)) { |
||||
|
DcNoStakeWarningTable noStakeWarningTable = getById(id); |
||||
|
if (noStakeWarningTable != null) { |
||||
|
throw new ServiceException("预警ID[" + id + "]已存在", HttpStatus.BAD_REQUEST); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
dcNoStakeWarningTable.setCreateTime(new Date()); |
||||
|
return save(dcNoStakeWarningTable); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public boolean editDcNoStakeWarningTable(DcNoStakeWarningTable dcNoStakeWarningTable) { |
||||
|
|
||||
|
Long id = dcNoStakeWarningTable.getId(); |
||||
|
|
||||
|
// 检查设备id是否重复
|
||||
|
DcNoStakeWarningTable noStakeWarningTable = getById(id); |
||||
|
|
||||
|
if (Objects.isNull(noStakeWarningTable)) { |
||||
|
throw new ServiceException("预警ID[" + id + "]不存在", HttpStatus.BAD_REQUEST); |
||||
|
} |
||||
|
|
||||
|
return updateById(dcNoStakeWarningTable); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public boolean removeDcNoStakeWarningTable(List<String> ids) { |
||||
|
return removeByIds(ids); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<DcNoStakeWarningTable> pageDcNoStakeWarningTable(DcNoStakeWarningTable dcNoStakeWarningTable) { |
||||
|
// 分页
|
||||
|
PageUtils.startPage(); |
||||
|
return list(noStakeWarningTableQueryWrapper(dcNoStakeWarningTable)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<DcNoStakeWarningTable> listDcNoStakeWarningTable(DcNoStakeWarningTable dcNoStakeWarningTable) { |
||||
|
return list(noStakeWarningTableQueryWrapper(dcNoStakeWarningTable)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public DcNoStakeWarningTable getDcNoStakeWarningTable(String id) { |
||||
|
// 检查设备id是否重复
|
||||
|
DcNoStakeWarningTable dcNoStakeWarningTable = getById(id); |
||||
|
|
||||
|
if (Objects.isNull(dcNoStakeWarningTable)) { |
||||
|
throw new ServiceException("预警ID[" + id + "]不存在", HttpStatus.BAD_REQUEST); |
||||
|
} |
||||
|
|
||||
|
return getById(id); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
Loading…
Reference in new issue