考试规则数量,标签 针对实训线路过滤调整
This commit is contained in:
parent
fc5b8721b7
commit
68bbde3029
@ -16,11 +16,11 @@ import java.util.Map;
|
||||
@Repository
|
||||
public interface PublishedTraining2DAO {
|
||||
|
||||
@Select("<script>select label_json from rts_published_training2 where 1 = 1 " +
|
||||
/* @Select("<script>select label_json from rts_published_training2 where 1 = 1 " +
|
||||
"<if test=\"orgId != null\"> " +
|
||||
" and org_id = #{orgId} " +
|
||||
" </if> and type = #{type} and map_id = #{mapId}</script>")
|
||||
List<String> selectAllLabel(@Param("mapId") Long mapId,@Param("orgId") Long orgId,@Param("type") String type);
|
||||
List<String> selectAllLabel(@Param("mapId") Long mapId,@Param("orgId") Long orgId,@Param("type") String type);*/
|
||||
long countByExample(PublishedTraining2Example example);
|
||||
|
||||
int deleteByExample(PublishedTraining2Example example);
|
||||
|
@ -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<String> 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<String> 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<PublishedTraining2> 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<String> 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 已发布实训分页列表
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user