|
@@ -13,7 +13,7 @@ import com.persagy.dmp.rwd.enums.FuncidDataType;
|
|
import com.persagy.dmp.rwd.enums.ObjType;
|
|
import com.persagy.dmp.rwd.enums.ObjType;
|
|
import com.persagy.dmp.rwd.model.ClassDefModel;
|
|
import com.persagy.dmp.rwd.model.ClassDefModel;
|
|
import com.persagy.dmp.rwd.model.FuncidDefModel;
|
|
import com.persagy.dmp.rwd.model.FuncidDefModel;
|
|
-import com.persagy.dmp.rwd.repository.ClassDefRepository;
|
|
|
|
|
|
+import com.persagy.dmp.rwd.repository.ClassDefWdRepository;
|
|
import com.persagy.dmp.rwd.util.ClassCodeUtils;
|
|
import com.persagy.dmp.rwd.util.ClassCodeUtils;
|
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -29,229 +29,229 @@ import java.util.stream.Collectors;
|
|
@Service
|
|
@Service
|
|
public class ClassDefService extends BaseService {
|
|
public class ClassDefService extends BaseService {
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private ClassDefRepository classDefRepository;
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ClassDefWdRepository classDefWdRepository;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private FuncidDefService funcidDefService;
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private FuncidDefService funcidDefService;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private CriteriaUtils criteriaUtils;
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private CriteriaUtils criteriaUtils;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private ClassCodeUtils classCodeUtils;
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ClassCodeUtils classCodeUtils;
|
|
|
|
|
|
- public ListResponse<ClassDefModel> queryClass(String groupCode, String schemaId, String projectId, String appId, Boolean subFlag, JacksonCriteria criteria) {
|
|
|
|
- ListResponse<ClassDefModel> resp = new ListResponse<>();
|
|
|
|
- OrgParam orgParam = prepareParam(resp);
|
|
|
|
- if (!resp.success()) {
|
|
|
|
- return resp;
|
|
|
|
- }
|
|
|
|
- //
|
|
|
|
- classCodeUtils.prepareCriteriaForFuncid(criteria, "code");
|
|
|
|
|
|
+ public ListResponse<ClassDefModel> queryClass(String groupCode, String schemaId, String projectId, String appId, Boolean subFlag, JacksonCriteria criteria) {
|
|
|
|
+ ListResponse<ClassDefModel> resp = new ListResponse<>();
|
|
|
|
+ OrgParam orgParam = prepareParam(resp);
|
|
|
|
+ if (!resp.success()) {
|
|
|
|
+ return resp;
|
|
|
|
+ }
|
|
|
|
+ //
|
|
|
|
+ classCodeUtils.prepareCriteriaForFuncid(criteria, "code");
|
|
|
|
|
|
- if (orgParam.appId != null && (orgParam.projectId == null || "0".equalsIgnoreCase(orgParam.projectId))) {
|
|
|
|
- resp.setFail("传入appId时必须同时传入projectId");
|
|
|
|
- return resp;
|
|
|
|
- }
|
|
|
|
|
|
+ if (orgParam.appId != null && (orgParam.projectId == null || "0".equalsIgnoreCase(orgParam.projectId))) {
|
|
|
|
+ resp.setFail("传入appId时必须同时传入projectId");
|
|
|
|
+ return resp;
|
|
|
|
+ }
|
|
|
|
|
|
- if (orgParam.projectId != null && !"0".equalsIgnoreCase(orgParam.projectId)) {
|
|
|
|
- if (orgParam.groupCode == null || "0".equals(orgParam.groupCode)) {
|
|
|
|
- resp.setFail("传入porjectId时必须同时传入groupCode");
|
|
|
|
- return resp;
|
|
|
|
- }
|
|
|
|
- QSchemaProject pqt = QSchemaProject.schemaProject;
|
|
|
|
- Optional<SchemaProject> one = schemaProjectRepository.findOne(pqt.projectId.eq(orgParam.projectId).and(pqt.groupCode.eq(orgParam.groupCode)));
|
|
|
|
- if (one.isPresent()) {
|
|
|
|
- orgParam.schemaId = one.get().getSchemaId();
|
|
|
|
- } else {
|
|
|
|
- resp.setFail("当前项目未配置集团方案");
|
|
|
|
- return resp;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ if (orgParam.projectId != null && !"0".equalsIgnoreCase(orgParam.projectId)) {
|
|
|
|
+ if (orgParam.groupCode == null || "0".equals(orgParam.groupCode)) {
|
|
|
|
+ resp.setFail("传入porjectId时必须同时传入groupCode");
|
|
|
|
+ return resp;
|
|
|
|
+ }
|
|
|
|
+ QSchemaProject pqt = QSchemaProject.schemaProject;
|
|
|
|
+ Optional<SchemaProject> one = schemaProjectRepository.findOne(pqt.projectId.eq(orgParam.projectId).and(pqt.groupCode.eq(orgParam.groupCode)));
|
|
|
|
+ if (one.isPresent()) {
|
|
|
|
+ orgParam.schemaId = one.get().getSchemaId();
|
|
|
|
+ } else {
|
|
|
|
+ resp.setFail("当前项目未配置集团方案");
|
|
|
|
+ return resp;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- Map<String, ClassDefModel> map = new HashMap<>();
|
|
|
|
- // 查询平台级
|
|
|
|
- JacksonCriteria jacksonCriteria = JacksonCriteria.newInstance();
|
|
|
|
- jacksonCriteria.getCriteria().setAll(criteria.getCriteria());
|
|
|
|
- jacksonCriteria.add("type", "common");
|
|
|
|
- jacksonCriteria.add("groupCode", "0");
|
|
|
|
- jacksonCriteria.setWithoutCount(true);
|
|
|
|
- setSharding("0", "0"); // sharding
|
|
|
|
- PagedResponse<ClassDefModel> queryResponse = query(jacksonCriteria);
|
|
|
|
- for (ClassDefModel model : queryResponse.getData()) {
|
|
|
|
- map.put(model.getCode(), model);
|
|
|
|
- }
|
|
|
|
|
|
+ Map<String, ClassDefModel> map = new HashMap<>();
|
|
|
|
+ // 查询平台级
|
|
|
|
+ JacksonCriteria jacksonCriteria = JacksonCriteria.newInstance();
|
|
|
|
+ jacksonCriteria.getCriteria().setAll(criteria.getCriteria());
|
|
|
|
+ jacksonCriteria.add("type", "common");
|
|
|
|
+ jacksonCriteria.add("groupCode", "0");
|
|
|
|
+ jacksonCriteria.setWithoutCount(true);
|
|
|
|
+ setSharding("0", "0"); // sharding
|
|
|
|
+ PagedResponse<ClassDefModel> queryResponse = query(jacksonCriteria);
|
|
|
|
+ for (ClassDefModel model : queryResponse.getData()) {
|
|
|
|
+ map.put(model.getCode(), model);
|
|
|
|
+ }
|
|
|
|
|
|
- // 查询集团级
|
|
|
|
- if (orgParam.groupCode != null && !"0".equalsIgnoreCase(orgParam.groupCode)) {
|
|
|
|
- JacksonCriteria groupCriteria = JacksonCriteria.newInstance();
|
|
|
|
- groupCriteria.getCriteria().setAll(criteria.getCriteria());
|
|
|
|
- groupCriteria.add("type", "group");
|
|
|
|
- groupCriteria.add("groupCode", orgParam.groupCode);
|
|
|
|
- jacksonCriteria.setWithoutCount(true);
|
|
|
|
- setSharding(orgParam.groupCode, "0"); // sharding
|
|
|
|
- queryResponse = query(groupCriteria);
|
|
|
|
- for (ClassDefModel model : queryResponse.getData()) {
|
|
|
|
- map.put(model.getCode(), model);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // 查询集团级
|
|
|
|
+ if (orgParam.groupCode != null && !"0".equalsIgnoreCase(orgParam.groupCode)) {
|
|
|
|
+ JacksonCriteria groupCriteria = JacksonCriteria.newInstance();
|
|
|
|
+ groupCriteria.getCriteria().setAll(criteria.getCriteria());
|
|
|
|
+ groupCriteria.add("type", "group");
|
|
|
|
+ groupCriteria.add("groupCode", orgParam.groupCode);
|
|
|
|
+ jacksonCriteria.setWithoutCount(true);
|
|
|
|
+ setSharding(orgParam.groupCode, "0"); // sharding
|
|
|
|
+ queryResponse = query(groupCriteria);
|
|
|
|
+ for (ClassDefModel model : queryResponse.getData()) {
|
|
|
|
+ map.put(model.getCode(), model);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- // 查询项目级
|
|
|
|
- if (orgParam.projectId != null && !"0".equalsIgnoreCase(orgParam.projectId)) {
|
|
|
|
- jacksonCriteria = JacksonCriteria.newInstance();
|
|
|
|
- jacksonCriteria.getCriteria().setAll(criteria.getCriteria());
|
|
|
|
- jacksonCriteria.add("type", "project");
|
|
|
|
- jacksonCriteria.add("groupCode", orgParam.groupCode);
|
|
|
|
- jacksonCriteria.add("projectId", orgParam.projectId);
|
|
|
|
- jacksonCriteria.setWithoutCount(true);
|
|
|
|
- setSharding(orgParam.groupCode, orgParam.projectId); // sharding
|
|
|
|
- queryResponse = query(jacksonCriteria);
|
|
|
|
- for (ClassDefModel model : queryResponse.getData()) {
|
|
|
|
- map.put(model.getCode(), model);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // 查询项目级
|
|
|
|
+ if (orgParam.projectId != null && !"0".equalsIgnoreCase(orgParam.projectId)) {
|
|
|
|
+ jacksonCriteria = JacksonCriteria.newInstance();
|
|
|
|
+ jacksonCriteria.getCriteria().setAll(criteria.getCriteria());
|
|
|
|
+ jacksonCriteria.add("type", "project");
|
|
|
|
+ jacksonCriteria.add("groupCode", orgParam.groupCode);
|
|
|
|
+ jacksonCriteria.add("projectId", orgParam.projectId);
|
|
|
|
+ jacksonCriteria.setWithoutCount(true);
|
|
|
|
+ setSharding(orgParam.groupCode, orgParam.projectId); // sharding
|
|
|
|
+ queryResponse = query(jacksonCriteria);
|
|
|
|
+ for (ClassDefModel model : queryResponse.getData()) {
|
|
|
|
+ map.put(model.getCode(), model);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- // 筛选方案订阅
|
|
|
|
- if (orgParam.schemaId != null && !"0".equalsIgnoreCase(orgParam.schemaId)) {
|
|
|
|
- QSchemaClass qsc = QSchemaClass.schemaClass;
|
|
|
|
- setSharding(orgParam.groupCode, orgParam.projectId); // sharding
|
|
|
|
- Iterable<SchemaClass> all = schemaClassRepository.findAll(qsc.schemaId.eq(orgParam.schemaId).and(qsc.groupCode.eq(orgParam.groupCode)));
|
|
|
|
- Set<String> classCodes = new HashSet<>();
|
|
|
|
- for (SchemaClass item : all) {
|
|
|
|
- classCodes.add(item.getClassCode());
|
|
|
|
- }
|
|
|
|
|
|
+ // 筛选方案订阅
|
|
|
|
+ if (orgParam.schemaId != null && !"0".equalsIgnoreCase(orgParam.schemaId)) {
|
|
|
|
+ QSchemaClass qsc = QSchemaClass.schemaClass;
|
|
|
|
+ setSharding(orgParam.groupCode, orgParam.projectId); // sharding
|
|
|
|
+ Iterable<SchemaClass> all = schemaClassRepository.findAll(qsc.schemaId.eq(orgParam.schemaId).and(qsc.groupCode.eq(orgParam.groupCode)));
|
|
|
|
+ Set<String> classCodes = new HashSet<>();
|
|
|
|
+ for (SchemaClass item : all) {
|
|
|
|
+ classCodes.add(item.getClassCode());
|
|
|
|
+ }
|
|
|
|
|
|
- if (classCodes.size() > 0) {
|
|
|
|
- // 方案有订阅, 去除未订阅的内容
|
|
|
|
- Iterator<Map.Entry<String, ClassDefModel>> iterator = map.entrySet().iterator();
|
|
|
|
- while (iterator.hasNext()) {
|
|
|
|
- Map.Entry<String, ClassDefModel> next = iterator.next();
|
|
|
|
- if (!classCodes.contains(next.getKey())) {
|
|
|
|
- iterator.remove();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ if (classCodes.size() > 0) {
|
|
|
|
+ // 方案有订阅, 去除未订阅的内容
|
|
|
|
+ Iterator<Map.Entry<String, ClassDefModel>> iterator = map.entrySet().iterator();
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ Map.Entry<String, ClassDefModel> next = iterator.next();
|
|
|
|
+ if (!classCodes.contains(next.getKey())) {
|
|
|
|
+ iterator.remove();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- // 筛选应用订阅部分
|
|
|
|
- if (orgParam.appId != null && !"0".equalsIgnoreCase(orgParam.appId)) {
|
|
|
|
- QAppClass qac = QAppClass.appClass;
|
|
|
|
- setSharding(orgParam.groupCode, orgParam.projectId); // sharding
|
|
|
|
- Iterable<AppClass> all = appClassRepository.findAll(qac.appId.eq(appId).and(qac.groupCode.eq(orgParam.groupCode).and(qac.projectId.eq(orgParam.projectId))));
|
|
|
|
- Set<String> classCodes = new HashSet<>();
|
|
|
|
- for (AppClass item : all) {
|
|
|
|
- classCodes.add(item.getClassCode());
|
|
|
|
- }
|
|
|
|
|
|
+ // 筛选应用订阅部分
|
|
|
|
+ if (orgParam.appId != null && !"0".equalsIgnoreCase(orgParam.appId)) {
|
|
|
|
+ QAppClass qac = QAppClass.appClass;
|
|
|
|
+ setSharding(orgParam.groupCode, orgParam.projectId); // sharding
|
|
|
|
+ Iterable<AppClass> all = appClassRepository.findAll(qac.appId.eq(appId).and(qac.groupCode.eq(orgParam.groupCode).and(qac.projectId.eq(orgParam.projectId))));
|
|
|
|
+ Set<String> classCodes = new HashSet<>();
|
|
|
|
+ for (AppClass item : all) {
|
|
|
|
+ classCodes.add(item.getClassCode());
|
|
|
|
+ }
|
|
|
|
|
|
- if (classCodes.size() > 0) {
|
|
|
|
- // 方案有订阅, 去除未订阅的内容
|
|
|
|
- Iterator<Map.Entry<String, ClassDefModel>> iterator = map.entrySet().iterator();
|
|
|
|
- while (iterator.hasNext()) {
|
|
|
|
- Map.Entry<String, ClassDefModel> next = iterator.next();
|
|
|
|
- if (!classCodes.contains(next.getKey())) {
|
|
|
|
- iterator.remove();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // 处理子分类
|
|
|
|
- // TODO
|
|
|
|
- if (subFlag && map.size() > 0) {
|
|
|
|
|
|
+ if (classCodes.size() > 0) {
|
|
|
|
+ // 方案有订阅, 去除未订阅的内容
|
|
|
|
+ Iterator<Map.Entry<String, ClassDefModel>> iterator = map.entrySet().iterator();
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ Map.Entry<String, ClassDefModel> next = iterator.next();
|
|
|
|
+ if (!classCodes.contains(next.getKey())) {
|
|
|
|
+ iterator.remove();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 处理子分类
|
|
|
|
+ // TODO
|
|
|
|
+ if (subFlag && map.size() > 0) {
|
|
|
|
|
|
- //List<FuncidDataType> enumTypeList = Arrays.asList(FuncidDataType.ENUM);
|
|
|
|
- List<String> classCodeList = map.values().stream().map(ClassDefModel::getCode).collect(Collectors.toList());
|
|
|
|
- JacksonCriteria funcidCriteria = JacksonCriteria.newInstance();
|
|
|
|
- funcidCriteria.add("classCode").in(classCodeList);
|
|
|
|
- funcidCriteria.add("dataType", FuncidDataType.ENUM);
|
|
|
|
- funcidCriteria.setWithoutCount(true);
|
|
|
|
- ListResponse<FuncidDefModel> funcidDefModelListResponse = funcidDefService.queryFuncid(groupCode, schemaId, projectId, appId, funcidCriteria);
|
|
|
|
- List<FuncidDefModel> funcidList = funcidDefModelListResponse.getData() != null ? funcidDefModelListResponse.getData() : Collections.emptyList();
|
|
|
|
|
|
+ //List<FuncidDataType> enumTypeList = Arrays.asList(FuncidDataType.ENUM);
|
|
|
|
+ List<String> classCodeList = map.values().stream().map(ClassDefModel::getCode).collect(Collectors.toList());
|
|
|
|
+ JacksonCriteria funcidCriteria = JacksonCriteria.newInstance();
|
|
|
|
+ funcidCriteria.add("classCode").in(classCodeList);
|
|
|
|
+ funcidCriteria.add("dataType", FuncidDataType.ENUM);
|
|
|
|
+ funcidCriteria.setWithoutCount(true);
|
|
|
|
+ ListResponse<FuncidDefModel> funcidDefModelListResponse = funcidDefService.queryFuncid(groupCode, schemaId, projectId, appId, funcidCriteria);
|
|
|
|
+ List<FuncidDefModel> funcidList = funcidDefModelListResponse.getData() != null ? funcidDefModelListResponse.getData() : Collections.emptyList();
|
|
|
|
|
|
- for (FuncidDefModel funcid : funcidList) {
|
|
|
|
- if (!funcid.getSubFlag()) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ for (FuncidDefModel funcid : funcidList) {
|
|
|
|
+ if (!funcid.getSubFlag()) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
- String classCode = funcid.getClassCode();
|
|
|
|
- ClassDefModel classDefModel = map.get(classCode);
|
|
|
|
- if (classDefModel == null) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- ArrayNode dataSource = funcid.getDataSource();
|
|
|
|
- if (dataSource.size() == 0) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ String classCode = funcid.getClassCode();
|
|
|
|
+ ClassDefModel classDefModel = map.get(classCode);
|
|
|
|
+ if (classDefModel == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ ArrayNode dataSource = funcid.getDataSource();
|
|
|
|
+ if (dataSource.size() == 0) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
- for (JsonNode jsonNode : dataSource) {
|
|
|
|
- ObjectNode item = (ObjectNode) jsonNode;
|
|
|
|
- ClassDefModel model = new ClassDefModel();
|
|
|
|
- BeanUtils.copyProperties(classDefModel, model);
|
|
|
|
- model.setCode(classDefModel.getCode() + "&" + funcid.getCode() + "=" + item.get("code").asText());
|
|
|
|
- model.setName(classDefModel.getName() + "-" + item.get("name").asText());
|
|
|
|
- model.setAliasCode(classDefModel.getAliasCode() + "-" + item.get("code").asText());
|
|
|
|
- model.setAliasName(classDefModel.getAliasName() + "-" + item.get("name").asText());
|
|
|
|
- map.put(model.getCode(), model);
|
|
|
|
- }
|
|
|
|
- map.remove(classCode);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ for (JsonNode jsonNode : dataSource) {
|
|
|
|
+ ObjectNode item = (ObjectNode) jsonNode;
|
|
|
|
+ ClassDefModel model = new ClassDefModel();
|
|
|
|
+ BeanUtils.copyProperties(classDefModel, model);
|
|
|
|
+ model.setCode(classDefModel.getCode() + "&" + funcid.getCode() + "=" + item.get("code").asText());
|
|
|
|
+ model.setName(classDefModel.getName() + "-" + item.get("name").asText());
|
|
|
|
+ model.setAliasCode(classDefModel.getAliasCode() + "-" + item.get("code").asText());
|
|
|
|
+ model.setAliasName(classDefModel.getAliasName() + "-" + item.get("name").asText());
|
|
|
|
+ map.put(model.getCode(), model);
|
|
|
|
+ }
|
|
|
|
+ map.remove(classCode);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- //
|
|
|
|
- List<ClassDefModel> data = new ArrayList<>(map.size());
|
|
|
|
- data.addAll(map.values());
|
|
|
|
- resp.setData(data);
|
|
|
|
- return resp;
|
|
|
|
- }
|
|
|
|
|
|
+ //
|
|
|
|
+ List<ClassDefModel> data = new ArrayList<>(map.size());
|
|
|
|
+ data.addAll(map.values());
|
|
|
|
+ resp.setData(data);
|
|
|
|
+ return resp;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
- private List<BooleanExpression> parse(ObjectNode object) {
|
|
|
|
- // TODO
|
|
|
|
- List<BooleanExpression> list = new LinkedList<>();
|
|
|
|
- QClassDef qt = QClassDef.classDef;
|
|
|
|
- list.addAll(CriteriaUtils.parse(qt.objType, object.get("objType"), ObjType.class));
|
|
|
|
- return list;
|
|
|
|
- }
|
|
|
|
|
|
+ private List<BooleanExpression> parse(ObjectNode object) {
|
|
|
|
+ // TODO
|
|
|
|
+ List<BooleanExpression> list = new LinkedList<>();
|
|
|
|
+ QClassDefWd qt = QClassDefWd.classDefWd;
|
|
|
|
+ list.addAll(CriteriaUtils.parse(qt.objType, object.get("objType"), ObjType.class));
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
|
|
- public PagedResponse<ClassDefModel> query(JacksonCriteria criteria) {
|
|
|
|
- PagedResponse<ClassDef> resp = criteriaUtils.query(QClassDef.classDef, this::parse, criteria);
|
|
|
|
- PagedResponse<ClassDefModel> result = new PagedResponse<>();
|
|
|
|
- result.setCount(resp.getCount());
|
|
|
|
- List<ClassDef> dataList = resp.getData();
|
|
|
|
- if (dataList != null && dataList.size() > 0) {
|
|
|
|
- List<ClassDefModel> collect = dataList.stream().map(entity -> {
|
|
|
|
- ClassDefModel model = entity.toModel();
|
|
|
|
- return model;
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
- result.setData(collect);
|
|
|
|
- }
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
|
|
+ public PagedResponse<ClassDefModel> query(JacksonCriteria criteria) {
|
|
|
|
+ PagedResponse<ClassDefWd> resp = criteriaUtils.query(QClassDefWd.classDefWd, this::parse, criteria);
|
|
|
|
+ PagedResponse<ClassDefModel> result = new PagedResponse<>();
|
|
|
|
+ result.setCount(resp.getCount());
|
|
|
|
+ List<ClassDefWd> dataList = resp.getData();
|
|
|
|
+ if (dataList != null && dataList.size() > 0) {
|
|
|
|
+ List<ClassDefModel> collect = dataList.stream().map(entity -> {
|
|
|
|
+ ClassDefModel model = entity.toModel();
|
|
|
|
+ return model;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ result.setData(collect);
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
|
|
- @Transactional
|
|
|
|
- public MapResponse create(ClassDefModel param) {
|
|
|
|
- MapResponse response = new MapResponse();
|
|
|
|
- // TODO
|
|
|
|
- ClassDef entity = ClassDef.fromModel(param);
|
|
|
|
- classDefRepository.save(entity);
|
|
|
|
- return response;
|
|
|
|
- }
|
|
|
|
|
|
+ @Transactional
|
|
|
|
+ public MapResponse create(ClassDefModel param) {
|
|
|
|
+ MapResponse response = new MapResponse();
|
|
|
|
+ // TODO
|
|
|
|
+ ClassDefWd entity = ClassDefWd.fromModel(param);
|
|
|
|
+ classDefWdRepository.save(entity);
|
|
|
|
+ return response;
|
|
|
|
+ }
|
|
|
|
|
|
- @Transactional
|
|
|
|
- public MapResponse update(ClassDefModel param) {
|
|
|
|
- MapResponse response = new MapResponse();
|
|
|
|
- // TODO
|
|
|
|
- ClassDef entity = ClassDef.fromModel(param);
|
|
|
|
- classDefRepository.save(entity);
|
|
|
|
- return response;
|
|
|
|
- }
|
|
|
|
|
|
+ @Transactional
|
|
|
|
+ public MapResponse update(ClassDefModel param) {
|
|
|
|
+ MapResponse response = new MapResponse();
|
|
|
|
+ // TODO
|
|
|
|
+ ClassDefWd entity = ClassDefWd.fromModel(param);
|
|
|
|
+ classDefWdRepository.save(entity);
|
|
|
|
+ return response;
|
|
|
|
+ }
|
|
|
|
|
|
- @Transactional
|
|
|
|
- public MapResponse delete(ClassDefModel param) {
|
|
|
|
- MapResponse response = new MapResponse();
|
|
|
|
- // TODO
|
|
|
|
- return response;
|
|
|
|
- }
|
|
|
|
|
|
+ @Transactional
|
|
|
|
+ public MapResponse delete(ClassDefModel param) {
|
|
|
|
+ MapResponse response = new MapResponse();
|
|
|
|
+ // TODO
|
|
|
|
+ return response;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|