fix:设备-维护保养、使用记录微调
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
package com.zt.plat.module.qms.resource.device.controller.admin;
|
package com.zt.plat.module.qms.resource.device.controller.admin;
|
||||||
|
|
||||||
|
import com.zt.plat.module.qms.resource.device.common.DeviceConstant;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessItemPageReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessItemPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessItemRespVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessItemRespVO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessItemSaveReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessItemSaveReqVO;
|
||||||
|
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceConfigBusinessRuleDO;
|
||||||
|
import com.zt.plat.module.qms.resource.device.service.DeviceConfigBusinessRuleService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -54,6 +57,7 @@ public class DeviceConfigBusinessItemController extends AbstractFileUploadContro
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DeviceConfigBusinessItemService deviceConfigBusinessItemService;
|
private DeviceConfigBusinessItemService deviceConfigBusinessItemService;
|
||||||
|
@Resource private DeviceConfigBusinessRuleService deviceConfigBusinessRuleService;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建设备-检查项目配置")
|
@Operation(summary = "创建设备-检查项目配置")
|
||||||
@@ -101,6 +105,15 @@ public class DeviceConfigBusinessItemController extends AbstractFileUploadContro
|
|||||||
@Operation(summary = "获得设备-检查项目配置分页")
|
@Operation(summary = "获得设备-检查项目配置分页")
|
||||||
// @PreAuthorize("@ss.hasPermission('qms:device-config-business-item:query')")
|
// @PreAuthorize("@ss.hasPermission('qms:device-config-business-item:query')")
|
||||||
public CommonResult<PageResult<DeviceConfigBusinessItemRespVO>> getDeviceConfigBusinessItemPage(@Valid DeviceConfigBusinessItemPageReqVO pageReqVO) {
|
public CommonResult<PageResult<DeviceConfigBusinessItemRespVO>> getDeviceConfigBusinessItemPage(@Valid DeviceConfigBusinessItemPageReqVO pageReqVO) {
|
||||||
|
|
||||||
|
Long productId = pageReqVO.getProductId();
|
||||||
|
if (productId != null) {
|
||||||
|
DeviceConfigBusinessRuleDO ruleDO = deviceConfigBusinessRuleService.getByProductId(productId, DeviceConstant.MAINTAIN_TYPE);
|
||||||
|
if(ruleDO != null){
|
||||||
|
pageReqVO.setRuleId(ruleDO.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PageResult<DeviceConfigBusinessItemDO> pageResult = deviceConfigBusinessItemService.getDeviceConfigBusinessItemPage(pageReqVO);
|
PageResult<DeviceConfigBusinessItemDO> pageResult = deviceConfigBusinessItemService.getDeviceConfigBusinessItemPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, DeviceConfigBusinessItemRespVO.class));
|
return success(BeanUtils.toBean(pageResult, DeviceConfigBusinessItemRespVO.class));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ public class DeviceConfigBusinessRuleController extends AbstractFileUploadContro
|
|||||||
@GetMapping("/getByProductId")
|
@GetMapping("/getByProductId")
|
||||||
@Operation(summary = "获得设备-业务配置")
|
@Operation(summary = "获得设备-业务配置")
|
||||||
@Parameter(name = "productId", description = "设备大类id", required = true, example = "1024")
|
@Parameter(name = "productId", description = "设备大类id", required = true, example = "1024")
|
||||||
public CommonResult<DeviceConfigBusinessRuleRespVO> getByProductId(@RequestParam("productId") Long productId) {
|
public CommonResult<DeviceConfigBusinessRuleRespVO> getByProductId(@RequestParam("productId") Long productId, @RequestParam("businessDomain") String businessDomain) {
|
||||||
DeviceConfigBusinessRuleDO entity = deviceConfigBusinessRuleService.getByProductId(productId);
|
DeviceConfigBusinessRuleDO entity = deviceConfigBusinessRuleService.getByProductId(productId, businessDomain);
|
||||||
if(entity == null)
|
if(entity == null)
|
||||||
return success(null);
|
return success(null);
|
||||||
return success(BeanUtils.toBean(entity, DeviceConfigBusinessRuleRespVO.class));
|
return success(BeanUtils.toBean(entity, DeviceConfigBusinessRuleRespVO.class));
|
||||||
|
|||||||
@@ -53,4 +53,8 @@ public class DeviceConfigBusinessItemPageReqVO extends PageParam {
|
|||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
private LocalDateTime[] createTime;
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
//=================扩展属性====================
|
||||||
|
@Schema(description = "设备大类id")
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,7 @@ import com.zt.plat.framework.common.pojo.PageResult;
|
|||||||
*/
|
*/
|
||||||
public interface DeviceConfigBusinessRuleService {
|
public interface DeviceConfigBusinessRuleService {
|
||||||
|
|
||||||
DeviceConfigBusinessRuleDO getByProductId(Long productId);
|
DeviceConfigBusinessRuleDO getByProductId(Long productId, String businessDomain);
|
||||||
|
|
||||||
CommonResult<DeviceConfigBusinessRuleDO> getRuleByDeviceIdAndType(Long deviceId, String type);
|
CommonResult<DeviceConfigBusinessRuleDO> getRuleByDeviceIdAndType(Long deviceId, String type);
|
||||||
|
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ public class DeviceConfigBusinessRuleServiceImpl implements DeviceConfigBusiness
|
|||||||
@Resource private DeviceProductService deviceProductService;
|
@Resource private DeviceProductService deviceProductService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeviceConfigBusinessRuleDO getByProductId(Long productId) {
|
public DeviceConfigBusinessRuleDO getByProductId(Long productId, String businessDomain) {
|
||||||
LambdaQueryWrapper<DeviceConfigBusinessRuleDO> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<DeviceConfigBusinessRuleDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(DeviceConfigBusinessRuleDO::getProductId, productId);
|
queryWrapper.eq(DeviceConfigBusinessRuleDO::getProductId, productId).eq(DeviceConfigBusinessRuleDO::getBusinessDomain, businessDomain);
|
||||||
List<DeviceConfigBusinessRuleDO> list = deviceConfigBusinessRuleMapper.selectList(queryWrapper);
|
List<DeviceConfigBusinessRuleDO> list = deviceConfigBusinessRuleMapper.selectList(queryWrapper);
|
||||||
if(list.size() > 1)
|
if(list.size() > 1)
|
||||||
throw exception0(DEVICE_CONFIG_BUSINESS_RULE_NOT_EXISTS.getCode(), "业务配置数据有" + list.size() + "行, 请联系管理员处理!");
|
throw exception0(DEVICE_CONFIG_BUSINESS_RULE_NOT_EXISTS.getCode(), "业务配置数据有" + list.size() + "行, 请联系管理员处理!");
|
||||||
|
|||||||
@@ -78,6 +78,13 @@
|
|||||||
<if test="param.productId != null">
|
<if test="param.productId != null">
|
||||||
and d.PDT_ID = #{param.productId}
|
and d.PDT_ID = #{param.productId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.productIds != null and param.productIds.size > 0">
|
||||||
|
and d.PDT_ID in (
|
||||||
|
<foreach collection="param.productIds" item="productId" separator=",">
|
||||||
|
#{productId}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
<if test="param.deviceName != null and param.deviceName != ''">
|
<if test="param.deviceName != null and param.deviceName != ''">
|
||||||
and d.DEV_NAME like concat('%',#{param.deviceName},'%')
|
and d.DEV_NAME like concat('%',#{param.deviceName},'%')
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user