|
|
@@ -119,9 +119,10 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public JsonResult generate(Integer[] ids) { |
|
|
|
Integer questionId = ids[0]; |
|
|
|
Question question = questionMapper.selectById(questionId); |
|
|
|
//校验,已生成工单的问题,无法生成工单 |
|
|
|
Integer count = workOrderQuestionMapper.selectCount(new LambdaQueryWrapper<WorkOrderQuestion>() |
|
|
|
.eq(WorkOrderQuestion::getTenantId, ShiroUtils.getTenantId())//xz |
|
|
|
.in(WorkOrderQuestion::getQuestionId, ids)); |
|
|
|
if(count > 0){ |
|
|
|
return JsonResult.error("有问题已生成工单"); |
|
|
@@ -131,7 +132,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
|
|
|
WorkOrder workOrder = new WorkOrder(); |
|
|
|
workOrder.setCode(code); |
|
|
|
workOrder.setTenantId(ShiroUtils.getTenantId());//xz |
|
|
|
workOrder.setTenantId(question.getTenantId());//xz |
|
|
|
workOrderMapper.insert(workOrder); |
|
|
|
|
|
|
|
for (Integer id : ids) { |
|
|
@@ -139,7 +140,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
WorkOrderQuestion workOrderQuestion = new WorkOrderQuestion(); |
|
|
|
workOrderQuestion.setWorkOrderId(workOrder.getId()); |
|
|
|
workOrderQuestion.setQuestionId(id); |
|
|
|
workOrderQuestion.setTenantId(ShiroUtils.getTenantId());//xz |
|
|
|
workOrderQuestion.setTenantId(question.getTenantId());//xz |
|
|
|
workOrderQuestionMapper.insert(workOrderQuestion); |
|
|
|
} |
|
|
|
return JsonResult.success(); |