Merge branch '0.8.X' of http://49.232.154.205:10100/DeXun/klp-oa into 0.8.X
This commit is contained in:
@@ -96,4 +96,14 @@ public class EqpEquipmentPartController extends BaseController {
|
||||
@PathVariable Long[] partIds) {
|
||||
return toAjax(iEqpEquipmentPartService.deleteWithValidByIds(Arrays.asList(partIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增检验部位及检验清单
|
||||
*/
|
||||
@Log(title = "检验部位", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/batch")
|
||||
public R<Void> addBatch(@RequestBody EqpEquipmentPartBo bo) {
|
||||
return toAjax(iEqpEquipmentPartService.insertBatchByBo(bo));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@@ -32,5 +33,10 @@ public class EqpEquipmentPartBo extends BaseEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 检验清单列表
|
||||
*/
|
||||
private List<EqpEquipmentChecklistBo> checklistList;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -46,4 +46,9 @@ public interface IEqpEquipmentPartService {
|
||||
* 校验并批量删除检验部位信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 批量新增检验部位及检验清单
|
||||
*/
|
||||
Boolean insertBatchByBo(EqpEquipmentPartBo bo);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import com.klp.mes.eqp.domain.bo.EqpEquipmentChecklistBo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.mes.eqp.domain.bo.EqpEquipmentPartBo;
|
||||
@@ -20,6 +21,7 @@ import com.klp.mes.eqp.service.IEqpEquipmentPartService;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 检验部位Service业务层处理
|
||||
@@ -121,4 +123,24 @@ public class EqpEquipmentPartServiceImpl implements IEqpEquipmentPartService {
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增检验部位及检验清单
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertBatchByBo(EqpEquipmentPartBo bo) {
|
||||
EqpEquipmentPart add = BeanUtil.toBean(bo, EqpEquipmentPart.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag && bo.getChecklistList() != null && !bo.getChecklistList().isEmpty()) {
|
||||
Long partId = add.getPartId();
|
||||
for (EqpEquipmentChecklistBo checklistBo : bo.getChecklistList()) {
|
||||
EqpEquipmentChecklist checklist = BeanUtil.toBean(checklistBo, EqpEquipmentChecklist.class);
|
||||
checklist.setPartId(partId);
|
||||
checklistMapper.insert(checklist);
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user