opt:策略管理包结构修改
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package org.nl.system.controller.dict;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
@@ -36,12 +38,12 @@ public class SysDictController {
|
||||
|
||||
@Log("查询字典")
|
||||
@GetMapping
|
||||
|
||||
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery pageable){
|
||||
return new ResponseEntity<>(TableDataInfo.build(dictService.queryAll(whereJson,pageable)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping(value = "/all")
|
||||
public ResponseEntity<Object> queryAll(){
|
||||
return new ResponseEntity<>(dictService.queryAll(),HttpStatus.OK);
|
||||
@@ -74,7 +76,7 @@ public class SysDictController {
|
||||
return new ResponseEntity<>(TableDataInfo.build(dictService.queryAllDetail(dictQuery,pageable)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping(value = "/dictDetail/map")
|
||||
public ResponseEntity<Object> getDictDetailMaps(@RequestParam String dictName){
|
||||
String[] names = dictName.split("[,,]");
|
||||
@@ -106,5 +108,17 @@ public class SysDictController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getTableEnum")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getTableEnum(@RequestParam Map criteria) {
|
||||
Object type = criteria.get("code");
|
||||
Object label = criteria.get("label");
|
||||
Object value = criteria.get("value");
|
||||
if (type == null||label == null||value == null){
|
||||
throw new BadRequestException("参数不能为空");
|
||||
}
|
||||
List<Map> maps = dictService.dynamicTableEnum((String) type, (String) label, (String) value);
|
||||
return new ResponseEntity<>(maps, HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,4 +85,9 @@ public interface ISysDictService extends IService<Dict> {
|
||||
* @return
|
||||
*/
|
||||
List<Dict> queryAll();
|
||||
|
||||
/**
|
||||
* 动态枚举信息
|
||||
*/
|
||||
List<Map> dynamicTableEnum(String table,String label,String value);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package org.nl.system.service.dict.dao.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典表 Mapper 接口
|
||||
@@ -13,4 +17,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface SysDictMapper extends BaseMapper<Dict> {
|
||||
|
||||
List<Map> dynamicTableEnum(@Param("table") String table, @Param("label")String label, @Param("value")String value);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.system.service.dict.dao.mapper.SysDictMapper">
|
||||
|
||||
<select id="dynamicTableEnum" resultType="java.util.Map">
|
||||
select ${label} as label,${value} as value from ${table}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -194,4 +195,11 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
||||
.groupBy(Dict::getCode, Dict::getName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> dynamicTableEnum(String table, String label, String value) {
|
||||
if (StringUtils.isEmpty(table)||StringUtils.isEmpty(label)||StringUtils.isEmpty(value)){
|
||||
throw new BadRequestException("参数不能为空");
|
||||
}
|
||||
return this.sysDictMapper.dynamicTableEnum(table,label,value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user