Commit 43839c13 by 王力

Merge branch 'dev_engineer_filter' into 'develop'

Dev engineer filter

See merge request !171
2 parents 8041eba5 05b1ac9a
package com.dituhui.pea.order.controller;
import com.dituhui.pea.common.BusinessException;
import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.service.SkillGroupCategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/pea-order")
public class SkillController {
@Autowired
SkillGroupCategoryService skillGroupCategoryService;
@GetMapping("/pea-order/skill/group/category")
public Result<?> skillGroupCategory() {
Result<?> res = null;
try {
res = skillGroupCategoryService.querySkillGroupCategoryService();
} catch (BusinessException e) {
return Result.failed(e.getMessage());
}
return res;
}
}
...@@ -2,25 +2,17 @@ package com.dituhui.pea.order.entity; ...@@ -2,25 +2,17 @@ package com.dituhui.pea.order.entity;
import lombok.Data; import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Data @Data
public class SkillGroup { public class SkillGroup {
private Integer id; private Integer id;
private String skillCode;
private String brand;
private String type;
private String skill;
private Integer takeTime;
private Integer takeEngineer;
private Integer lowElectricianCert;
private Integer gasCert;
private Integer priority;
private String skillGroupCode; private String skillGroupCode;
private String layerId; private String skillGroup;
private String typeCategory; private String describe;
private String skillCategory; private String category;
private String memo; private String memo;
private LocalDateTime createTime; private LocalDateTime createTime;
private LocalDateTime updateTime; private LocalDate updateTime;
} }
...@@ -2,17 +2,25 @@ package com.dituhui.pea.order.entity; ...@@ -2,17 +2,25 @@ package com.dituhui.pea.order.entity;
import lombok.Data; import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Data @Data
public class SkillInfo { public class SkillInfo {
private Integer id; private Integer id;
private String skillCode;
private String brand;
private String type;
private String skill;
private Integer takeTime;
private Integer takeEngineer;
private Integer lowElectricianCert;
private Integer gasCert;
private Integer priority;
private String skillGroupCode; private String skillGroupCode;
private String skillGroup; private String layerId;
private String describe; private String typeCategory;
private String category; private String skillCategory;
private String memo; private String memo;
private LocalDateTime createTime; private LocalDateTime createTime;
private LocalDate updateTime; private LocalDateTime updateTime;
} }
package com.dituhui.pea.order.service;
import com.dituhui.pea.common.Result;
public interface SkillGroupCategoryService {
public Result<?> querySkillGroupCategoryService();
}
package com.dituhui.pea.order.service.impl;
import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.dao.SkillGroupMPDao;
import com.dituhui.pea.order.entity.SkillGroup;
import com.dituhui.pea.order.service.SkillGroupCategoryService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class SkillGroupCategoryServiceImpl implements SkillGroupCategoryService {
@Autowired
SkillGroupMPDao skillGroupMPDao;
@Override
public Result<?> querySkillGroupCategoryService() {
List<SkillGroup> records = skillGroupMPDao.selectList(null).stream().sorted(
Comparator.comparing(SkillGroup::getCategory)).collect(Collectors.toList());
List<Category> items = new ArrayList<>();
for (SkillGroup r : records) {
items.add(new Category(r.getSkillGroupCode(), r.getSkillGroup(), r.getCategory()));
}
Response res = new Response();
res.setCategories(items);
return Result.success(res);
}
}
@Data
class Response {
private List<Category> categories;
}
@Data
class Category {
private String skillGroupId;
private String category;
private String skillGroupName;
public Category(String skillGroupId, String skillGroupName, String category) {
this.category = category;
this.skillGroupName = skillGroupName;
this.skillGroupId = skillGroupId;
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!