You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
112 lines
4.1 KiB
Java
112 lines
4.1 KiB
Java
package com.glxp.api.controller.inv;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.glxp.api.annotation.Log;
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
import com.glxp.api.constant.BusinessType;
|
|
import com.glxp.api.entity.inv.DeviceMAOrderDetailEntity;
|
|
import com.glxp.api.req.inv.FilterDeviceMAOrderDetailRequest;
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
import com.glxp.api.res.inv.DeviceMAOrderDetailResponse;
|
|
import com.glxp.api.service.inv.DeviceMAOrderDetailService;
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 设备养护记录详情接口
|
|
*/
|
|
@RestController
|
|
public class DeviceMAOrderDetailCotroller {
|
|
|
|
@Resource
|
|
private DeviceMAOrderDetailService deviceMAOrderDetailService;
|
|
|
|
/**
|
|
* 查询设备养护记录详情列表
|
|
*
|
|
* @param detailRequest
|
|
* @return
|
|
*/
|
|
@GetMapping("/device/MA/order/detail/filterList")
|
|
public BaseResponse filterList(FilterDeviceMAOrderDetailRequest detailRequest) {
|
|
List<DeviceMAOrderDetailResponse> list = deviceMAOrderDetailService.filterList(detailRequest);
|
|
PageInfo<DeviceMAOrderDetailResponse> pageInfo = new PageInfo<>(list);
|
|
PageSimpleResponse<DeviceMAOrderDetailResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
pageSimpleResponse.setList(list);
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
}
|
|
|
|
/**
|
|
* 添加设备养护记录详情
|
|
*
|
|
* @param detailEntity
|
|
* @param bindingResult
|
|
* @return
|
|
*/
|
|
@PostMapping("/device/MA/order/detail/addOrderDetail")
|
|
@Log(title = "设备养护", businessType = BusinessType.INSERT)
|
|
public BaseResponse addOrderDetail(@RequestBody DeviceMAOrderDetailEntity detailEntity, BindingResult bindingResult) {
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
}
|
|
return deviceMAOrderDetailService.addDetail(detailEntity);
|
|
}
|
|
|
|
/**
|
|
* 更新设备养护记录详情
|
|
*
|
|
* @param detailEntity
|
|
* @param bindingResult
|
|
* @return
|
|
*/
|
|
@PostMapping("/device/MA/order/detail/updateOrderDetail")
|
|
@Log(title = "设备养护", businessType = BusinessType.UPDATE)
|
|
public BaseResponse updateOrderDetail(@RequestBody DeviceMAOrderDetailEntity detailEntity, BindingResult bindingResult) {
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
}
|
|
return deviceMAOrderDetailService.updateDetail(detailEntity);
|
|
}
|
|
|
|
/**
|
|
* 删除设备养护记录详情
|
|
*
|
|
* @param detailEntity
|
|
* @param bindingResult
|
|
* @return
|
|
*/
|
|
@PostMapping("/device/MA/order/detail/deleteOrderDetail")
|
|
@Log(title = "设备养护", businessType = BusinessType.DELETE)
|
|
public BaseResponse deleteOrderDetail(@RequestBody DeviceMAOrderDetailEntity detailEntity, BindingResult bindingResult) {
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
}
|
|
return deviceMAOrderDetailService.deleteDetail(detailEntity);
|
|
}
|
|
|
|
/**
|
|
* 养护设备信息接口
|
|
*
|
|
* @param code
|
|
* @return
|
|
*/
|
|
@GetMapping("/device/MA/order/detail/filterMAOrderDetail")
|
|
public BaseResponse filterMAOrderDetail(String code) {
|
|
if (StrUtil.isBlank(code)) {
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
|
}
|
|
return deviceMAOrderDetailService.filterMAOrderDetail(code);
|
|
}
|
|
|
|
}
|