From 9ac0ad8f44b78c0ef9a4570c3e10ae80ced6b82f Mon Sep 17 00:00:00 2001 From: weizhihong Date: Mon, 28 Nov 2022 10:23:14 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E3=80=90=E5=AE=9E=E8=AE=AD=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=89=80=E6=9C=89=E4=BF=A1=E6=81=AF=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrainingV2PublishController.java | 16 ++++++- .../training2/Training2PublishService.java | 44 +++++++++---------- 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/src/main/java/club/joylink/rtss/controller/training2/TrainingV2PublishController.java b/src/main/java/club/joylink/rtss/controller/training2/TrainingV2PublishController.java index 10d313ee2..001e0fe17 100644 --- a/src/main/java/club/joylink/rtss/controller/training2/TrainingV2PublishController.java +++ b/src/main/java/club/joylink/rtss/controller/training2/TrainingV2PublishController.java @@ -1,6 +1,7 @@ package club.joylink.rtss.controller.training2; import club.joylink.rtss.services.training2.Training2PublishService; +import club.joylink.rtss.services.training2.Training2TypeEnum; import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.training2.publish.*; import lombok.extern.slf4j.Slf4j; @@ -47,20 +48,31 @@ public class TrainingV2PublishController { public DeletePublishedTraining2RspVo deletePublishedTrainings(@RequestBody DeletePublishedTraining2ReqVo req){ return this.publishService.deletePublishedTrainings(req); } + /** * 根据mapId查所有的已发布单操实训的基础信息 */ @GetMapping("/{mapId}/singles") - public List findAllSingleTrainingBasicInfo(@PathVariable("mapId") Long mapId){ + public List findSingleTrainingBasicInfo(@PathVariable("mapId") Long mapId){ return this.publishService.findAllSingleTrainingBasicInfoByMapId(mapId); } + /** * 根据mapId查所有的已发布场景实训的基础信息 */ @GetMapping("/{mapId}/scenes") - public List findAllSceneTrainingBasicInfo(@PathVariable("mapId") Long mapId){ + public List findSceneTrainingBasicInfo(@PathVariable("mapId") Long mapId){ return this.publishService.findAllSceneTrainingBasicInfoByMapId(mapId); } + + /** + * 查所有的已发布场景实训的基础信息 + */ + @GetMapping("/list") + public List findTrainingList(Long mapId,Training2TypeEnum type){ + return this.publishService.findTrainingInfo(mapId, type); + } + /** * 根据实训id查该已发布实训的所有信息 */ diff --git a/src/main/java/club/joylink/rtss/services/training2/Training2PublishService.java b/src/main/java/club/joylink/rtss/services/training2/Training2PublishService.java index f9c5ff6c5..85057baad 100644 --- a/src/main/java/club/joylink/rtss/services/training2/Training2PublishService.java +++ b/src/main/java/club/joylink/rtss/services/training2/Training2PublishService.java @@ -19,6 +19,7 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; /** * 已发布实训管理业务实现 @@ -202,18 +203,7 @@ public class Training2PublishService { */ @Transactional(readOnly = true) public List findAllSingleTrainingBasicInfoByMapId(Long mapId) { - List rsp = new ArrayList<>(); - // - PublishedTraining2Example example = new PublishedTraining2Example(); - example.createCriteria().andMapIdEqualTo(mapId).andTypeEqualTo(Training2TypeEnum.single.value()); - List list = this.publishedDao.selectByExample(example); - if (!CollectionUtils.isEmpty(list)) { - list.forEach(p -> { - rsp.add(Training2Convertor.convertFrom(p)); - }); - } - // - return rsp; + return findTrainingInfo(mapId, Training2TypeEnum.single); } /** @@ -221,18 +211,28 @@ public class Training2PublishService { */ @Transactional(readOnly = true) public List findAllSceneTrainingBasicInfoByMapId(Long mapId) { - List rsp = new ArrayList<>(); - // + return findTrainingInfo(mapId, Training2TypeEnum.scene); + } + + + /** + * 根据地图ID和类型查询实训列表 + */ + public List findTrainingInfo(Long mapId, Training2TypeEnum type) { PublishedTraining2Example example = new PublishedTraining2Example(); - example.createCriteria().andMapIdEqualTo(mapId).andTypeEqualTo(Training2TypeEnum.scene.value()); - List list = this.publishedDao.selectByExample(example); - if (!CollectionUtils.isEmpty(list)) { - list.forEach(p -> { - rsp.add(Training2Convertor.convertFrom(p)); - }); + PublishedTraining2Example.Criteria criteria = example.createCriteria(); + if (mapId != null) { + criteria.andMapIdEqualTo(mapId); + } + if (type != null) { + criteria.andTypeEqualTo(type.value()); + } + List list = this.publishedDao.selectByExample(example); + if (CollectionUtils.isEmpty(list)) { + return List.of(); + } else { + return list.stream().map(Training2Convertor::convertFrom).collect(Collectors.toList()); } - // - return rsp; } /** From 753ad674f4119d4007e3bf26081eb48bdd4edd0d Mon Sep 17 00:00:00 2001 From: weizhihong Date: Mon, 28 Nov 2022 10:46:33 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E3=80=90=E5=8F=96=E6=B6=88=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=88=97=E8=A1=A8=E6=9D=A1=E6=95=B0=E9=99=90=E5=88=B6?= =?UTF-8?q?=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rtss/entity/project/ProjectExample.java | 70 ------------------- .../services/org/OrgUserManageService.java | 1 - 2 files changed, 71 deletions(-) diff --git a/src/main/java/club/joylink/rtss/entity/project/ProjectExample.java b/src/main/java/club/joylink/rtss/entity/project/ProjectExample.java index ff5f4ddd2..00e1ae3c1 100644 --- a/src/main/java/club/joylink/rtss/entity/project/ProjectExample.java +++ b/src/main/java/club/joylink/rtss/entity/project/ProjectExample.java @@ -394,76 +394,6 @@ public class ProjectExample { addCriterion("`status` not between", value1, value2, "status"); return (Criteria) this; } - - public Criteria andViewShowIsNull() { - addCriterion("`view_show` is null"); - return (Criteria) this; - } - - public Criteria andViewShowIsNotNull() { - addCriterion("`view_show` is not null"); - return (Criteria) this; - } - - public Criteria andViewShowEqualTo(Integer value) { - addCriterion("`view_show` =", value, "viewShow"); - return (Criteria) this; - } - - public Criteria andViewShowNotEqualTo(Integer value) { - addCriterion("`view_show` <>", value, "viewShow"); - return (Criteria) this; - } - - public Criteria andViewShowGreaterThan(Integer value) { - addCriterion("`view_show` >", value, "viewShow"); - return (Criteria) this; - } - - public Criteria andViewShowGreaterThanOrEqualTo(Integer value) { - addCriterion("`view_show` >=", value, "viewShow"); - return (Criteria) this; - } - - public Criteria andViewShowLessThan(Integer value) { - addCriterion("`view_show` <", value, "viewShow"); - return (Criteria) this; - } - - public Criteria andViewShowLessThanOrEqualTo(Integer value) { - addCriterion("`view_show` <=", value, "viewShow"); - return (Criteria) this; - } - - public Criteria andViewShowLike(Integer value) { - addCriterion("`view_show` like", value, "viewShow"); - return (Criteria) this; - } - - public Criteria andViewShowNotLike(Integer value) { - addCriterion("`view_show` not like", value, "viewShow"); - return (Criteria) this; - } - - public Criteria andViewShowIn(List values) { - addCriterion("`view_show` in", values, "viewShow"); - return (Criteria) this; - } - - public Criteria andViewShowNotIn(List values) { - addCriterion("`view_show` not in", values, "viewShow"); - return (Criteria) this; - } - - public Criteria andViewShowBetween(Integer value1, Integer value2) { - addCriterion("`view_show` between", value1, value2, "viewShow"); - return (Criteria) this; - } - - public Criteria andViewShowNotBetween(Integer value1, Integer value2) { - addCriterion("`view_show` not between", value1, value2, "viewShow"); - return (Criteria) this; - } } /** diff --git a/src/main/java/club/joylink/rtss/services/org/OrgUserManageService.java b/src/main/java/club/joylink/rtss/services/org/OrgUserManageService.java index e1538bb0b..0c7b45e87 100644 --- a/src/main/java/club/joylink/rtss/services/org/OrgUserManageService.java +++ b/src/main/java/club/joylink/rtss/services/org/OrgUserManageService.java @@ -57,7 +57,6 @@ public class OrgUserManageService { if (StringUtils.hasText(queryVO.getName())) { criteria.andNameLike(String.format("%%%s%%", queryVO.getName())); } - example.setLimit(10); List sysAccounts = sysAccountDAO.selectByExample(example); if (CollectionUtils.isEmpty(sysAccounts)) { return new ArrayList<>(); From 6552caaec22b6dd5ac17c55cbd4a879bbf2cb3be Mon Sep 17 00:00:00 2001 From: weizhihong Date: Mon, 28 Nov 2022 11:00:47 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E3=80=90=E6=9F=A5=E8=AF=A2=E6=9C=89?= =?UTF-8?q?=E6=95=88=E7=9A=84=E7=BB=84=E7=BB=87=E4=BF=A1=E6=81=AF=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/mybatis/mapper/OrgUserDAO.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/mybatis/mapper/OrgUserDAO.xml b/src/main/resources/mybatis/mapper/OrgUserDAO.xml index b529f4ea7..4bfa4b2cb 100644 --- a/src/main/resources/mybatis/mapper/OrgUserDAO.xml +++ b/src/main/resources/mybatis/mapper/OrgUserDAO.xml @@ -275,7 +275,7 @@ FROM org_user os LEFT JOIN org o ON o.id = os.org_id LEFT JOIN org ro ON o.root_id = ro.id - WHERE os.user_id = #{userId} + WHERE os.user_id = #{userId} and o.status = 1