147 lines
4.6 KiB
Plaintext
147 lines
4.6 KiB
Plaintext
|
|
package com.securityControl.system.controller;
|
||
|
|
|
||
|
|
import com.securityControl.common.core.utils.aes.StringHelper;
|
||
|
|
import com.securityControl.common.log.annotation.Log;
|
||
|
|
import com.securityControl.common.log.enums.BusinessType;
|
||
|
|
import com.securityControl.common.log.enums.OperationType;
|
||
|
|
import com.securityControl.system.domain.vo.ReturnCodeEntity;
|
||
|
|
import com.securityControl.system.domain.vo.SysDictVo;
|
||
|
|
import com.securityControl.system.domain.vo.SysMenuEntity;
|
||
|
|
import com.securityControl.system.service.SysDictService;
|
||
|
|
import lombok.extern.slf4j.Slf4j;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
||
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
|
||
|
|
import java.util.HashMap;
|
||
|
|
import java.util.List;
|
||
|
|
import java.util.Map;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 字典管理
|
||
|
|
*/
|
||
|
|
@RestController
|
||
|
|
@RequestMapping(value = "/sys/dict/")
|
||
|
|
@Slf4j
|
||
|
|
public class SysDictController {
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private SysDictService service;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查询字典列表
|
||
|
|
*
|
||
|
|
* @param sysDictVo
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@GetMapping("getDictList")
|
||
|
|
@Log(title = "字典管理", menu = "字典管理", businessType = BusinessType.QUERY, details = "查看列表", grade = OperationType.QUERY_SYS, type = "系统日志")
|
||
|
|
public List<SysMenuEntity> getDictList(SysDictVo sysDictVo) {
|
||
|
|
List<SysMenuEntity> list = service.getDictList(sysDictVo);
|
||
|
|
Map<String, Object> map = new HashMap<String, Object>(16);
|
||
|
|
map.put("code", 0);
|
||
|
|
map.put("msg", "");
|
||
|
|
map.put("data", list);
|
||
|
|
return list;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取p节点下拉选
|
||
|
|
*
|
||
|
|
* @param params
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@PostMapping("getPDict")
|
||
|
|
public List<SysDictVo> getPDict(String params) {
|
||
|
|
try {
|
||
|
|
if (StringHelper.isNotEmpty(params)) {
|
||
|
|
List<SysDictVo> list = service.getPDict(params);
|
||
|
|
return list;
|
||
|
|
}
|
||
|
|
} catch (Exception e) {
|
||
|
|
log.error(e.toString(),e);
|
||
|
|
}
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 新增字典类型
|
||
|
|
*
|
||
|
|
* @param
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@PostMapping("addDict")
|
||
|
|
@Log(title = "字典管理", menu = "字典管理", businessType = BusinessType.INSERT, details = "添加字典", grade = OperationType.ADD_SYS, type = "系统日志")
|
||
|
|
public ReturnCodeEntity addDict(SysDictVo typeVo) {
|
||
|
|
ReturnCodeEntity entity = new ReturnCodeEntity();
|
||
|
|
try {
|
||
|
|
entity = service.addDict(typeVo);
|
||
|
|
} catch (Exception e) {
|
||
|
|
entity.setCode("202");
|
||
|
|
entity.setMsg("解析异常,请联系管理员");
|
||
|
|
}
|
||
|
|
return entity;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 修改字典
|
||
|
|
*
|
||
|
|
* @param
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@PostMapping("updateDict")
|
||
|
|
@Log(title = "字典管理", menu = "字典管理", businessType = BusinessType.UPDATE, details = "修改字典", grade = OperationType.UPDATE_SYS, type = "系统日志")
|
||
|
|
public ReturnCodeEntity updateDict(SysDictVo typeVo) {
|
||
|
|
ReturnCodeEntity entity = new ReturnCodeEntity();
|
||
|
|
try {
|
||
|
|
entity = service.updateDict(typeVo);
|
||
|
|
} catch (Exception e) {
|
||
|
|
entity.setCode("202");
|
||
|
|
entity.setMsg("解析异常,请联系管理员");
|
||
|
|
}
|
||
|
|
return entity;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查看详情
|
||
|
|
*
|
||
|
|
* @param params
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@PostMapping("getDictDetail")
|
||
|
|
@Log(title = "字典管理", menu = "字典管理", businessType = BusinessType.QUERY, details = "查看字典", grade = OperationType.QUERY_SYS, type = "系统日志")
|
||
|
|
public SysDictVo getDictDetail(String params) {
|
||
|
|
SysDictVo dictVo = null;
|
||
|
|
try {
|
||
|
|
dictVo = service.getDictDetail(params);
|
||
|
|
return dictVo;
|
||
|
|
} catch (Exception e) {
|
||
|
|
log.error(e.toString(),e);
|
||
|
|
}
|
||
|
|
return dictVo;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 删除设备类型
|
||
|
|
*
|
||
|
|
* @param params
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@PostMapping("deleteDict")
|
||
|
|
@Log(title = "字典管理", menu = "字典管理", businessType = BusinessType.DELETE, details = "删除字典", grade = OperationType.DELETE_SYS, type = "系统日志")
|
||
|
|
public ReturnCodeEntity deleteDict(String params) {
|
||
|
|
ReturnCodeEntity entity = new ReturnCodeEntity();
|
||
|
|
try {
|
||
|
|
entity = service.deleteDict(params);
|
||
|
|
} catch (Exception e) {
|
||
|
|
log.error(e.toString(),e);
|
||
|
|
entity.setCode("202");
|
||
|
|
entity.setMsg("解析异常,请联系管理员");
|
||
|
|
}
|
||
|
|
return entity;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|