字典查询台站类型信息方式修改
This commit is contained in:
parent
3347b16dde
commit
20a32baf79
|
@ -36,6 +36,7 @@ public class WebStatisticsController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IGardsSampleCertService gardsSampleCertService;
|
private IGardsSampleCertService gardsSampleCertService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("findStationList")
|
@GetMapping("findStationList")
|
||||||
@ApiOperation(value = "根据菜单名称查询对应的台站信息", notes = "根据菜单名称查询对应的台站信息")
|
@ApiOperation(value = "根据菜单名称查询对应的台站信息", notes = "根据菜单名称查询对应的台站信息")
|
||||||
public Result findStationList(String menuName){
|
public Result findStationList(String menuName){
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
package org.jeecg.modules.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @Author zhangweijian
|
||||||
|
* @since 2018-12-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "sys_dict_item")
|
||||||
|
public class SysDictItem implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典id
|
||||||
|
*/
|
||||||
|
@TableField(value = "dict_id")
|
||||||
|
private String dictId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典项文本
|
||||||
|
*/
|
||||||
|
@TableField(value = "item_text")
|
||||||
|
private String itemText;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典项值
|
||||||
|
*/
|
||||||
|
@TableField(value = "item_value")
|
||||||
|
private String itemValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@TableField(value = "description")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
@TableField(value = "sort_order")
|
||||||
|
private Integer sortOrder;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(1启用 0不启用)
|
||||||
|
*/
|
||||||
|
@TableField(value = "status")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@TableField(value = "create_by")
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
@TableField(value = "create_time")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@TableField(value = "update_by")
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
@TableField(value = "update_time")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package org.jeecg.modules.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.jeecg.modules.entity.SysDictItem;
|
||||||
|
|
||||||
|
public interface SysDictItemMapper extends BaseMapper<SysDictItem> {
|
||||||
|
}
|
|
@ -1,12 +1,15 @@
|
||||||
package org.jeecg.modules.service.impl;
|
package org.jeecg.modules.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.util.RedisUtil;
|
import org.jeecg.common.util.RedisUtil;
|
||||||
import org.jeecg.modules.entity.SysDict;
|
import org.jeecg.modules.entity.SysDict;
|
||||||
|
import org.jeecg.modules.entity.SysDictItem;
|
||||||
|
import org.jeecg.modules.mapper.SysDictItemMapper;
|
||||||
import org.jeecg.modules.mapper.SysDictMapper;
|
import org.jeecg.modules.mapper.SysDictMapper;
|
||||||
import org.jeecg.modules.service.ISysDictService;
|
import org.jeecg.modules.service.ISysDictService;
|
||||||
import org.jeecg.modules.system.entity.GardsStations;
|
import org.jeecg.modules.system.entity.GardsStations;
|
||||||
|
@ -23,6 +26,8 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDictMapper sysDictMapper;
|
private SysDictMapper sysDictMapper;
|
||||||
|
@Autowired
|
||||||
|
private SysDictItemMapper sysDictItemMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result findList(String menuName) {
|
public Result findList(String menuName) {
|
||||||
|
@ -35,15 +40,15 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||||
if (StringUtils.isNotBlank(menuName)){
|
if (StringUtils.isNotBlank(menuName)){
|
||||||
//根据菜单名称查询出数据字典中对应的内容
|
//根据菜单名称查询出数据字典中对应的内容
|
||||||
LambdaQueryWrapper<SysDict> dictQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysDict> dictQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
dictQueryWrapper.eq(SysDict::getDictName, menuName);
|
dictQueryWrapper.eq(SysDict::getDictCode, menuName);
|
||||||
SysDict sysDict = sysDictMapper.selectOne(dictQueryWrapper);
|
SysDict sysDict = sysDictMapper.selectOne(dictQueryWrapper);
|
||||||
//如果字典内容不为空
|
//如果字典内容不为空
|
||||||
if (Objects.nonNull(sysDict)){
|
if (Objects.nonNull(sysDict)){
|
||||||
//获取当前字典对应的code数据
|
LambdaQueryWrapper<SysDictItem> dictItemQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
String dictCode = sysDict.getDictCode();
|
dictItemQueryWrapper.eq(SysDictItem::getDictId, sysDict.getId());
|
||||||
if (StringUtils.isNotBlank(dictCode)){
|
List<SysDictItem> dictItems = sysDictItemMapper.selectList(dictItemQueryWrapper);
|
||||||
//根据英文,切割台站类型信息
|
List<String> types = dictItems.stream().map(SysDictItem::getItemValue).collect(Collectors.toList());
|
||||||
List<String> types = Arrays.asList(dictCode.split(StringPool.COMMA));
|
if (CollectionUtils.isNotEmpty(types)){
|
||||||
//遍历过滤出和类型匹配的台站信息 存入新的数据集合中
|
//遍历过滤出和类型匹配的台站信息 存入新的数据集合中
|
||||||
for (String type:types) {
|
for (String type:types) {
|
||||||
gardsStationsList.addAll(stationsList.stream().filter(item-> StringUtils.isNotBlank(item.getType()) && item.getType().equals(type)).collect(Collectors.toList()));
|
gardsStationsList.addAll(stationsList.stream().filter(item-> StringUtils.isNotBlank(item.getType()) && item.getType().equals(type)).collect(Collectors.toList()));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user