config
This commit is contained in:
@@ -3,6 +3,14 @@ package com.cnbm.processInspection.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.cnbm.basic.entity.Machine;
|
||||
import com.cnbm.basic.entity.Product;
|
||||
import com.cnbm.basic.entity.Shift;
|
||||
import com.cnbm.basic.entity.WorkingProcedure;
|
||||
import com.cnbm.basic.service.impl.MachineServiceImpl;
|
||||
import com.cnbm.basic.service.impl.ProductServiceImpl;
|
||||
import com.cnbm.basic.service.impl.ShiftServiceImpl;
|
||||
import com.cnbm.basic.service.impl.WorkingProcedureServiceImpl;
|
||||
import com.cnbm.common.page.PageData;
|
||||
import com.cnbm.common.service.impl.CrudServiceImpl;
|
||||
import com.cnbm.common.utils.ConvertUtils;
|
||||
@@ -27,17 +35,34 @@ import java.util.Map;
|
||||
*/
|
||||
@Service
|
||||
public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetMapper, InspectionSheet, InspectionSheetDTO> implements IInspectionSheetService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private InspectionSheetMapper mapper;
|
||||
private ProductServiceImpl productService;
|
||||
|
||||
@Autowired
|
||||
private WorkingProcedureServiceImpl workingProcedureService;
|
||||
|
||||
@Autowired
|
||||
private MachineServiceImpl machineService;
|
||||
|
||||
@Autowired
|
||||
private ShiftServiceImpl shiftService;
|
||||
|
||||
@Override
|
||||
public QueryWrapper<InspectionSheet> getWrapper(Map<String, Object> params){
|
||||
String id = (String)params.get("id");
|
||||
Long id = (Long)params.get("id");
|
||||
String inspectionSite = (String)params.get("inspectionSite");
|
||||
String orderNumber = (String)params.get("orderNumber");
|
||||
String batchNumber = (String)params.get("batchNumber");
|
||||
|
||||
QueryWrapper<InspectionSheet> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
|
||||
|
||||
wrapper.like(ObjectUtils.isNotNull(id), "id", id);
|
||||
wrapper.like(StringUtils.isNotBlank(inspectionSite), "inspection_stage", inspectionSite);
|
||||
wrapper.like(StringUtils.isNotBlank(orderNumber), "order_number", orderNumber);
|
||||
wrapper.like(StringUtils.isNotBlank(batchNumber), "batch_number", batchNumber);
|
||||
wrapper.eq(ObjectUtils.isNotNull(params.get("productId")), "product_id", params.get("productId"));
|
||||
wrapper.eq(ObjectUtils.isNotNull(params.get("workingProcedureId")), "working_procedure_id", params.get("workingProcedureId"));
|
||||
wrapper.eq(ObjectUtils.isNotNull(params.get("machineId")), "machine_id", params.get("machineId"));
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@@ -47,7 +72,40 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
|
||||
getPage(params, "id", true),
|
||||
getWrapper(params)
|
||||
);
|
||||
return getPageData(page, InspectionSheetDTO.class);
|
||||
PageData<InspectionSheetDTO> inspectionSheetDTOPageData = getPageData(page, InspectionSheetDTO.class);
|
||||
|
||||
if(!inspectionSheetDTOPageData.getList().isEmpty()){
|
||||
for(InspectionSheetDTO dto:inspectionSheetDTOPageData.getList()){
|
||||
Product product = productService.selectById(dto.getProductId());
|
||||
WorkingProcedure workingProcedure = workingProcedureService.selectById(dto.getWorkingProcedureId());
|
||||
Machine machine = machineService.selectById(dto.getMachineId());
|
||||
Shift shift = shiftService.selectById(dto.getShiftId());
|
||||
|
||||
String productName = null;
|
||||
String workingProcedureName = null;
|
||||
String machineName = null;
|
||||
String shiftName = null;
|
||||
|
||||
if (product!=null){
|
||||
productName = product.getName();
|
||||
}
|
||||
if (workingProcedure!=null){
|
||||
workingProcedureName = workingProcedure.getName();
|
||||
}
|
||||
if (machine!=null){
|
||||
machineName = machine.getName();
|
||||
}
|
||||
if (shift!=null){
|
||||
shiftName = shift.getName();
|
||||
}
|
||||
|
||||
dto.setProductName(productName);
|
||||
dto.setWorkingProcedureName(workingProcedureName);
|
||||
dto.setMachineName(machineName);
|
||||
dto.setShiftName(shiftName);
|
||||
}
|
||||
}
|
||||
return inspectionSheetDTOPageData;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,6 +135,9 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
|
||||
deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private InspectionSheetMapper mapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<InspectionSheetDTO> list(Map<String, Object> params) {
|
||||
|
||||
Reference in New Issue
Block a user