|
|
@ -98,7 +98,7 @@ public class TemplateServiceImpl implements TemplateService { |
|
|
|
|
|
|
|
//工单信息-查询工单列表 |
|
|
|
@Override |
|
|
|
public Result<?> queryTemplateList(QueryTemplateBean templateBean, PageBean pageBean) { |
|
|
|
public Result<?> queryTemplateList(String userId, QueryTemplateBean templateBean, PageBean pageBean) { |
|
|
|
//分页 |
|
|
|
Page<WorkorderTemplate> page = new Page<WorkorderTemplate>(pageBean.getPageNo(), pageBean.getPageSize()); |
|
|
|
LambdaQueryChainWrapper<WorkorderTemplate> query = workorderTemplateService |
|
|
@ -125,6 +125,22 @@ public class TemplateServiceImpl implements TemplateService { |
|
|
|
//获取账本信息 |
|
|
|
Page<WorkorderTemplate> pageList = query.page(page); |
|
|
|
|
|
|
|
//添加工单是否被收藏标识 |
|
|
|
List<WorkorderCollection> collectionList = workorderCollectionService |
|
|
|
.lambdaQuery() |
|
|
|
.eq(WorkorderCollection::getUserId, userId) |
|
|
|
.list(); |
|
|
|
for (WorkorderTemplate record : pageList.getRecords()) { |
|
|
|
boolean flag = false; |
|
|
|
for (WorkorderCollection collection : collectionList) { |
|
|
|
if(record.getId().equals(collection.getTemplateId())){ |
|
|
|
flag = true; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
record.setCollectonFlag(flag); |
|
|
|
} |
|
|
|
|
|
|
|
return Result.OK("工单列表", pageList); |
|
|
|
} |
|
|
|
|
|
|
@ -156,8 +172,25 @@ public class TemplateServiceImpl implements TemplateService { |
|
|
|
//工单信息-修改工单 |
|
|
|
@Override |
|
|
|
public Result<?> updateTemplate(WorkorderTemplate workorderTemplate) { |
|
|
|
//修改工单信息 |
|
|
|
boolean flag = workorderTemplateService.updateById(workorderTemplate); |
|
|
|
if(flag){ |
|
|
|
|
|
|
|
//修改收藏表工单状态 |
|
|
|
boolean collectionFlag = false; |
|
|
|
List<WorkorderCollection> list = workorderCollectionService |
|
|
|
.lambdaQuery() |
|
|
|
.eq(WorkorderCollection::getTemplateId, workorderTemplate.getId()) |
|
|
|
.list(); |
|
|
|
if(list.size() != 0){ |
|
|
|
for (WorkorderCollection collection : list) { |
|
|
|
collection.setStatusId(workorderTemplate.getStatusId()); |
|
|
|
} |
|
|
|
collectionFlag = workorderCollectionService.updateBatchById(list); |
|
|
|
}else { |
|
|
|
collectionFlag = true; |
|
|
|
} |
|
|
|
|
|
|
|
if(flag && collectionFlag){ |
|
|
|
return Result.OK("修改工单信息成功!"); |
|
|
|
}else { |
|
|
|
return Result.error("修改工单信息失败!"); |
|
|
|