From 68bbde3029cc0644fbf23554ebd914fad1b6b1e3 Mon Sep 17 00:00:00 2001
From: tiger_zhou <123456>
Date: Tue, 31 Jan 2023 10:57:44 +0800
Subject: [PATCH] =?UTF-8?q?=E8=80=83=E8=AF=95=E8=A7=84=E5=88=99=E6=95=B0?=
=?UTF-8?q?=E9=87=8F=EF=BC=8C=E6=A0=87=E7=AD=BE=20=E9=92=88=E5=AF=B9?=
=?UTF-8?q?=E5=AE=9E=E8=AE=AD=E7=BA=BF=E8=B7=AF=E8=BF=87=E6=BB=A4=E8=B0=83?=
=?UTF-8?q?=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../rtss/dao/PublishedTraining2DAO.java | 4 +--
.../training2/Training2PublishService.java | 31 ++++++++++---------
2 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/src/main/java/club/joylink/rtss/dao/PublishedTraining2DAO.java b/src/main/java/club/joylink/rtss/dao/PublishedTraining2DAO.java
index 08a2d4d97..24c2101ee 100644
--- a/src/main/java/club/joylink/rtss/dao/PublishedTraining2DAO.java
+++ b/src/main/java/club/joylink/rtss/dao/PublishedTraining2DAO.java
@@ -16,11 +16,11 @@ import java.util.Map;
@Repository
public interface PublishedTraining2DAO {
- @Select("")
- List selectAllLabel(@Param("mapId") Long mapId,@Param("orgId") Long orgId,@Param("type") String type);
+ List selectAllLabel(@Param("mapId") Long mapId,@Param("orgId") Long orgId,@Param("type") String type);*/
long countByExample(PublishedTraining2Example example);
int deleteByExample(PublishedTraining2Example example);
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 96b365e22..5e28f4bcb 100644
--- a/src/main/java/club/joylink/rtss/services/training2/Training2PublishService.java
+++ b/src/main/java/club/joylink/rtss/services/training2/Training2PublishService.java
@@ -49,16 +49,9 @@ public class Training2PublishService {
*/
public Long queryCountForLabel(Long mapId,@Deprecated Long orgId,String type,String label){
- BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(mapId),"没有关联对应的地图");
- BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织信息不能为空");
- BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(type),"查询类型信息不能为空");
-
PublishedTraining2Example example = new PublishedTraining2Example();
PublishedTraining2Example.Criteria c = example.createCriteria();
- //针对实训只过滤对应的线路
- c.andMapIdEqualTo(mapId);
-// c.andOrgIdEqualTo(orgId);
- c.andTypeEqualTo(type);
+ this.findAllLableCriteria(c,mapId,orgId,type);
if(Objects.nonNull(label)){
c.andLabelJsonLike(String.format("%%%s%%", label));
}
@@ -69,20 +62,28 @@ public class Training2PublishService {
* 根据 组织,类型(单操作,实操) 获取标签
*/
public Collection findAllLabel(Long mapId,Long orgId, String type){
- BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(mapId),"请关联对应的线路");
- BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织信息不能为空");
- BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(type),"查询类型信息不能为空");
- //针对实训只过滤关联的线路
- List list = this.publishedDao.selectAllLabel(mapId,null,type);
- if(CollectionUtils.isEmpty(list)){
+ PublishedTraining2Example example = new PublishedTraining2Example();
+ PublishedTraining2Example.Criteria c = example.createCriteria();
+ this.findAllLableCriteria(c,mapId,orgId,type);
+ List dataList = this.publishedDao.selectByExample(example);
+ if(CollectionUtils.isEmpty(dataList)){
return Collections.emptyList();
}
- return list.stream().filter(StringUtils::hasText).map(d->{
+ return dataList.stream().map(PublishedTraining2::getLabelJson).filter(StringUtils::hasText).map(d->{
List l = JsonUtils.readCollection(d,List.class,String.class);
return l;
}).flatMap(d->d.stream()).collect(Collectors.toSet());
}
+ private void findAllLableCriteria(PublishedTraining2Example.Criteria criteria,Long mapId,Long orgId,String type){
+ BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(mapId),"请关联对应的线路");
+ BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织信息不能为空");
+ BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(type),"查询类型信息不能为空");
+ criteria.andMapIdEqualTo(mapId);
+// c.andOrgIdEqualTo(orgId);
+ criteria.andTypeEqualTo(type);
+ }
+
/**
* 已发布实训分页列表
*/