获取责任领域字典数据接口
This commit is contained in:
+65
-2
@@ -188,7 +188,7 @@ public class SysDictController {
|
||||
}
|
||||
|
||||
// 将结果集进行排序
|
||||
if (CollectionUtils.isNotEmpty(ls)) {
|
||||
/*if (CollectionUtils.isNotEmpty(ls)) {
|
||||
// 匿名比较器排序
|
||||
Collections.sort(ls, new Comparator<DictModel>() {
|
||||
@Override
|
||||
@@ -196,7 +196,7 @@ public class SysDictController {
|
||||
return p1.getText().compareTo(p2.getText());
|
||||
}
|
||||
});
|
||||
}
|
||||
}*/
|
||||
|
||||
result.setSuccess(true);
|
||||
result.setResult(ls);
|
||||
@@ -790,4 +790,67 @@ public class SysDictController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取责任领域字典数据
|
||||
* @param dictCode 字典code
|
||||
* @param dictCode 表名,文本字段,code字段 | 举例:sys_user,realname,id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "字典控制器-获取责任领域字典数据", notes = "字典控制器-获取责任领域字典数据")
|
||||
@RequestMapping(value = "/getDutyTerritoryDictItems/{dictCode}", method = RequestMethod.GET)
|
||||
public Result<List<DictModel>> getDutyTerritoryDictItems(@PathVariable String dictCode, @RequestParam(value = "sign",required = false) String sign, HttpServletRequest request) {
|
||||
log.info(" dictCode : "+ dictCode);
|
||||
Result<List<DictModel>> result = new Result<List<DictModel>>();
|
||||
List<DictModel> ls = null;
|
||||
try {
|
||||
if(dictCode.indexOf(",")!=-1) {
|
||||
//关联表字典(举例:sys_user,realname,id)
|
||||
String[] params = dictCode.split(",");
|
||||
|
||||
if(params.length<3) {
|
||||
result.error500("字典Code格式不正确!");
|
||||
return result;
|
||||
}
|
||||
//SQL注入校验(只限制非法串改数据库)
|
||||
final String[] sqlInjCheck = {params[0],params[1],params[2]};
|
||||
SqlInjectionUtil.filterContent(sqlInjCheck);
|
||||
|
||||
if(params.length==4) {
|
||||
//SQL注入校验(查询条件SQL 特殊check,此方法仅供此处使用)
|
||||
SqlInjectionUtil.specialFilterContent(params[3]);
|
||||
ls = sysDictService.queryTableDictItemsByCodeAndFilter(params[0],params[1],params[2],params[3]);
|
||||
}else if (params.length==3) {
|
||||
ls = sysDictService.queryTableDictItemsByCode(params[0],params[1],params[2]);
|
||||
}else{
|
||||
result.error500("字典Code格式不正确!");
|
||||
return result;
|
||||
}
|
||||
}else {
|
||||
//字典表
|
||||
ls = sysDictService.queryDictItemsByCode(dictCode);
|
||||
}
|
||||
|
||||
// 将结果集进行排序
|
||||
if (CollectionUtils.isNotEmpty(ls)) {
|
||||
// 匿名比较器排序
|
||||
Collections.sort(ls, new Comparator<DictModel>() {
|
||||
@Override
|
||||
public int compare(DictModel p1, DictModel p2) {
|
||||
return p1.getText().compareTo(p2.getText());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
result.setSuccess(true);
|
||||
result.setResult(ls);
|
||||
log.debug(result.toString());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result.error500("操作失败");
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user