app新建工单流程走通
This commit is contained in:
parent
e4d6de291b
commit
c6e571e56c
@ -128,4 +128,13 @@ public class RepairProjectController {
|
||||
List<RepairProject> list = repairProjectService.list(new LambdaQueryWrapper<RepairProject>().eq(RepairProject::getName, name));
|
||||
return success(list.stream().max(Comparator.comparing(RepairProject::getCreateTime)).orElse(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取维修项目和分类
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getRepairProjectAndCateGory")
|
||||
public CommonResult getRepairProjectAndCateGory(){
|
||||
return success(repairProjectService.getRepairProjectAndCateGory());
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.project.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.project.entity.RepairProject;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectAppvo;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectRespVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
@ -9,6 +10,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 维修项目 Mapper
|
||||
*
|
||||
@ -28,4 +31,9 @@ public interface RepairProjectMapper extends BaseMapper<RepairProject> {
|
||||
**/
|
||||
IPage<RepairProjectRespVO> selectListPage(@Param("entity") RepairProjectPageReqVO pageReqVO, Page<RepairProjectRespVO> page);
|
||||
|
||||
/**
|
||||
* 查询维修项目和维修项目分类信息
|
||||
* @return
|
||||
*/
|
||||
List<RepairProjectAppvo> selectProjectAndCateGory();
|
||||
}
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.project.service;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.module.project.entity.RepairProject;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectAppvo;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectRespVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectSaveReqVO;
|
||||
@ -9,6 +10,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 维修项目 Service 接口
|
||||
*
|
||||
@ -56,4 +59,9 @@ public interface RepairProjectService extends IService<RepairProject> {
|
||||
IPage<RepairProjectRespVO> queryListPage(RepairProjectPageReqVO pageReqVO, Page<RepairProjectRespVO> page);
|
||||
|
||||
|
||||
/**
|
||||
* 查询服务分类和维修项目列表
|
||||
* @return
|
||||
*/
|
||||
List<RepairProjectAppvo> getRepairProjectAndCateGory();
|
||||
}
|
@ -1,9 +1,13 @@
|
||||
package cn.iocoder.yudao.module.project.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.project.entity.RepairProject;
|
||||
import cn.iocoder.yudao.module.project.mapper.RepairProjectMapper;
|
||||
import cn.iocoder.yudao.module.project.service.RepairProjectService;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectAppvo;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectRespVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectSaveReqVO;
|
||||
@ -14,6 +18,9 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 维修项目 Service 实现类
|
||||
@ -82,5 +89,36 @@ public class RepairProjectServiceImpl extends ServiceImpl<RepairProjectMapper, R
|
||||
return repairProjectMapper.selectListPage(pageReqVO,page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询服务分类和维修项目列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<RepairProjectAppvo> getRepairProjectAndCateGory() {
|
||||
List<RepairProjectAppvo> repairProjectAppvos = repairProjectMapper.selectProjectAndCateGory();
|
||||
// 提取并去重 typeId
|
||||
List<String> uniqueTypeIds = repairProjectAppvos.stream()
|
||||
.map(RepairProjectAppvo::getTypeId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<RepairProjectAppvo> list = new ArrayList<>();
|
||||
for (String uniqueTypeId : uniqueTypeIds) {
|
||||
RepairProjectAppvo repairProjectAppvo = new RepairProjectAppvo();
|
||||
repairProjectAppvo.setTypeId(uniqueTypeId);
|
||||
if (ObjectUtil.isNotEmpty(uniqueTypeId)) {
|
||||
List<RepairProjectAppvo> filteredList = repairProjectAppvos.stream()
|
||||
.filter(appvo -> uniqueTypeId.equals(appvo.getTypeId()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(filteredList)) {
|
||||
repairProjectAppvo.setTypeName(filteredList.get(0).getTypeName());
|
||||
repairProjectAppvo.setGroupList(BeanUtil.copyToList(filteredList, RepairProject.class));
|
||||
}
|
||||
}
|
||||
list.add(repairProjectAppvo);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.project.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.project.entity.RepairProject;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class RepairProjectAppvo extends RepairProject{
|
||||
private String typeName;
|
||||
private String typeId;
|
||||
private List<RepairProject> groupList;
|
||||
}
|
@ -33,4 +33,16 @@
|
||||
ORDER BY
|
||||
drp.create_time DESC
|
||||
</select>
|
||||
<select id="selectProjectAndCateGory" resultType="cn.iocoder.yudao.module.project.vo.RepairProjectAppvo">
|
||||
SELECT
|
||||
drp.*,
|
||||
dbt.id AS typeId,
|
||||
dbt.name AS typeName
|
||||
FROM
|
||||
dl_repair_project drp
|
||||
LEFT JOIN dl_base_type dbt ON drp.type = dbt.id
|
||||
AND dbt.deleted = 0 AND dbt.type = "03"
|
||||
WHERE
|
||||
drp.deleted = 0
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user