Merge branch 'develop' of http://10.0.6.99/gwall/gwall.git into develop
This commit is contained in:
151
src/main/java/com/nis/domain/configuration/ServiceDictInfo.java
Normal file
151
src/main/java/com/nis/domain/configuration/ServiceDictInfo.java
Normal file
@@ -0,0 +1,151 @@
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nis.domain.BaseEntity;
|
||||
import com.nis.domain.SysMenu;
|
||||
import com.nis.domain.SysUser;
|
||||
/**
|
||||
* 业务辅助表-业务字典信息表
|
||||
* @author zsl
|
||||
*
|
||||
*/
|
||||
public class ServiceDictInfo extends BaseEntity<ServiceDictInfo>{
|
||||
|
||||
private static final long serialVersionUID = 4680466118906894338L;
|
||||
|
||||
private Integer serviceDictId; //service_dict_id 字典ID int N 主键,自增
|
||||
private Integer itemType; //item_type 数据类型 int N 1:分类 2:性质 3:标签
|
||||
private Integer itemCode; //item_code编码 int N
|
||||
private String itemValue; //item_value 编码对应值 varchar2(64) N
|
||||
private String itemDesc; //item_desc 描述信息 varcahr2(128) Y
|
||||
private ServiceDictInfo parent; //parent_id 父ID number(9) N 无父属性,默认填0
|
||||
private Integer isLeaf; //is_leaf 是否叶子节点 int N 0-否 1-是;只有一级填0;
|
||||
private Integer isValid; //is_valid 有效标志 int N 1-有效 0-无效
|
||||
private SysUser serviceDictCreator; //creator_id 创建人员 int N 取自sys_user.id
|
||||
private Date createTime; //create_time 配置时间 date N
|
||||
private SysUser serviceDictEditor; //editor_id 修改人员 int Y 取自sys_user.id
|
||||
private Date editTime; //edit_time 修改时间 date Y
|
||||
private List<ServiceDictInfo> ChildrenList = new ArrayList<ServiceDictInfo>();//字列表
|
||||
|
||||
private Date beginDate; // 开始日期
|
||||
private Date endDate; // 结束日期
|
||||
|
||||
public Integer getServiceDictId() {
|
||||
return serviceDictId;
|
||||
}
|
||||
public void setServiceDictId(Integer serviceDictId) {
|
||||
this.serviceDictId = serviceDictId;
|
||||
}
|
||||
public Integer getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
public void setItemType(Integer itemType) {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
public Integer getItemCode() {
|
||||
return itemCode;
|
||||
}
|
||||
public void setItemCode(Integer itemCode) {
|
||||
this.itemCode = itemCode;
|
||||
}
|
||||
public String getItemValue() {
|
||||
return itemValue;
|
||||
}
|
||||
public void setItemValue(String itemValue) {
|
||||
this.itemValue = itemValue;
|
||||
}
|
||||
public String getItemDesc() {
|
||||
return itemDesc;
|
||||
}
|
||||
public void setItemDesc(String itemDesc) {
|
||||
this.itemDesc = itemDesc;
|
||||
}
|
||||
@JsonBackReference
|
||||
public ServiceDictInfo getParent() {
|
||||
return parent;
|
||||
}
|
||||
public void setParent(ServiceDictInfo parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
public Integer getIsLeaf() {
|
||||
return isLeaf;
|
||||
}
|
||||
public void setIsLeaf(Integer isLeaf) {
|
||||
this.isLeaf = isLeaf;
|
||||
}
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
|
||||
public SysUser getServiceDictCreator() {
|
||||
return serviceDictCreator;
|
||||
}
|
||||
public void setServiceDictCreator(SysUser serviceDictCreator) {
|
||||
this.serviceDictCreator = serviceDictCreator;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public SysUser getServiceDictEditor() {
|
||||
return serviceDictEditor;
|
||||
}
|
||||
public void setServiceDictEditor(SysUser serviceDictEditor) {
|
||||
this.serviceDictEditor = serviceDictEditor;
|
||||
}
|
||||
public Date getEditTime() {
|
||||
return editTime;
|
||||
}
|
||||
public void setEditTime(Date editTime) {
|
||||
this.editTime = editTime;
|
||||
}
|
||||
public List<ServiceDictInfo> getChildrenList() {
|
||||
return ChildrenList;
|
||||
}
|
||||
public void setChildrenList(List<ServiceDictInfo> childrenList) {
|
||||
ChildrenList = childrenList;
|
||||
}
|
||||
public Date getBeginDate() {
|
||||
return beginDate;
|
||||
}
|
||||
public void setBeginDate(Date beginDate) {
|
||||
this.beginDate = beginDate;
|
||||
}
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
@JsonIgnore
|
||||
public static void sortList(List<ServiceDictInfo> list, List<ServiceDictInfo> sourcelist, Long parentId, boolean cascade){
|
||||
for (int i=0; i<sourcelist.size(); i++){
|
||||
ServiceDictInfo serviceDictInfo = sourcelist.get(i);
|
||||
if (serviceDictInfo.getParent()!=null && serviceDictInfo.getParent().getId()!=null
|
||||
&& serviceDictInfo.getParent().getId().equals(parentId)){
|
||||
list.add(serviceDictInfo);
|
||||
if (cascade){
|
||||
// 判断是否还有子节点, 有则继续获取子节点
|
||||
for (int j=0; j<sourcelist.size(); j++){
|
||||
ServiceDictInfo child = sourcelist.get(j);
|
||||
if (child.getParent()!=null && child.getParent().getId()!=null
|
||||
&& child.getParent().getId().equals(serviceDictInfo.getId())){
|
||||
sortList(list, sourcelist, serviceDictInfo.getId(), true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
149
src/main/java/com/nis/domain/configuration/SysDictInfo.java
Normal file
149
src/main/java/com/nis/domain/configuration/SysDictInfo.java
Normal file
@@ -0,0 +1,149 @@
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nis.domain.BaseEntity;
|
||||
import com.nis.domain.SysUser;
|
||||
/**
|
||||
* 业务辅助表-系统字典信息表
|
||||
* @author zsl
|
||||
*
|
||||
*/
|
||||
public class SysDictInfo extends BaseEntity<SysDictInfo>{
|
||||
|
||||
private static final long serialVersionUID = 893702645278342859L;
|
||||
|
||||
private Integer sysDictId; //service_dict_id 字典ID int N 主键,自增
|
||||
private Integer itemType; //item_type 数据类型 int N 1:分类 2:性质 3:标签
|
||||
private Integer itemCode; //item_code编码 int N
|
||||
private String itemValue; //item_value 编码对应值 varchar2(64) N
|
||||
private String desc; //desc 描述信息 varcahr2(128) Y
|
||||
private SysDictInfo parent; //parent_id 父ID number(9) N 无父属性,默认填0
|
||||
private Integer isLeaf; //is_leaf 是否叶子节点 int N 0-否 1-是;只有一级填0;
|
||||
private Integer isValid; //is_valid 有效标志 int N 1-有效 0-无效
|
||||
private SysUser sysDictCreator; //creator_id 创建人员 int N 取自sys_user.id
|
||||
private Date createTime; //create_time 配置时间 date N
|
||||
private SysUser sysDictEditor; //editor_id 修改人员 int Y 取自sys_user.id
|
||||
private Date editTime; //edit_time 修改时间 date Y
|
||||
private List<ServiceDictInfo> ChildrenList = new ArrayList<ServiceDictInfo>();//字列表
|
||||
|
||||
private Date beginDate; // 开始日期
|
||||
private Date endDate; // 结束日期
|
||||
|
||||
|
||||
public Integer getSysDictId() {
|
||||
return sysDictId;
|
||||
}
|
||||
public void setSysDictId(Integer sysDictId) {
|
||||
this.sysDictId = sysDictId;
|
||||
}
|
||||
public Integer getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
public void setItemType(Integer itemType) {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
public Integer getItemCode() {
|
||||
return itemCode;
|
||||
}
|
||||
public void setItemCode(Integer itemCode) {
|
||||
this.itemCode = itemCode;
|
||||
}
|
||||
public String getItemValue() {
|
||||
return itemValue;
|
||||
}
|
||||
public void setItemValue(String itemValue) {
|
||||
this.itemValue = itemValue;
|
||||
}
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
public SysDictInfo getParent() {
|
||||
return parent;
|
||||
}
|
||||
public void setParent(SysDictInfo parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
public Integer getIsLeaf() {
|
||||
return isLeaf;
|
||||
}
|
||||
public void setIsLeaf(Integer isLeaf) {
|
||||
this.isLeaf = isLeaf;
|
||||
}
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
public SysUser getSysDictCreator() {
|
||||
return sysDictCreator;
|
||||
}
|
||||
public void setSysDictCreator(SysUser sysDictCreator) {
|
||||
this.sysDictCreator = sysDictCreator;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public SysUser getSysDictEditor() {
|
||||
return sysDictEditor;
|
||||
}
|
||||
public void setSysDictEditor(SysUser sysDictEditor) {
|
||||
this.sysDictEditor = sysDictEditor;
|
||||
}
|
||||
public Date getEditTime() {
|
||||
return editTime;
|
||||
}
|
||||
public void setEditTime(Date editTime) {
|
||||
this.editTime = editTime;
|
||||
}
|
||||
public List<ServiceDictInfo> getChildrenList() {
|
||||
return ChildrenList;
|
||||
}
|
||||
public void setChildrenList(List<ServiceDictInfo> childrenList) {
|
||||
ChildrenList = childrenList;
|
||||
}
|
||||
public Date getBeginDate() {
|
||||
return beginDate;
|
||||
}
|
||||
public void setBeginDate(Date beginDate) {
|
||||
this.beginDate = beginDate;
|
||||
}
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
@JsonIgnore
|
||||
public static void sortList(List<SysDictInfo> list, List<SysDictInfo> sourcelist, Integer parentId, boolean cascade){
|
||||
for (int i=0; i<sourcelist.size(); i++){
|
||||
SysDictInfo sysDictInfo = sourcelist.get(i);
|
||||
if (sysDictInfo.getParent()!=null && sysDictInfo.getParent().getSysDictId()!=null
|
||||
&& sysDictInfo.getParent().getSysDictId().equals(parentId)){
|
||||
list.add(sysDictInfo);
|
||||
if (cascade){
|
||||
// 判断是否还有子节点, 有则继续获取子节点
|
||||
for (int j=0; j<sourcelist.size(); j++){
|
||||
SysDictInfo child = sourcelist.get(j);
|
||||
if (child.getParent()!=null && child.getParent().getSysDictId()!=null
|
||||
&& child.getParent().getSysDictId().equals(sysDictInfo.getSysDictId())){
|
||||
sortList(list, sourcelist, sysDictInfo.getSysDictId(), true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysDataDictionaryName;
|
||||
import com.nis.domain.SysMenu;
|
||||
import com.nis.domain.configuration.ServiceDictInfo;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/configuration/serviceDictInfo")
|
||||
public class ServiceDictInfoController extends BaseController {
|
||||
|
||||
|
||||
@ModelAttribute
|
||||
public ServiceDictInfo get(@RequestParam(required=false) Integer serviceDictId) {
|
||||
if (!StringUtil.isEmpty(serviceDictId)){
|
||||
return serviceDictInfoService.getDictById(serviceDictId);
|
||||
}else{
|
||||
return new ServiceDictInfo();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据serviceDictId查出配置对象
|
||||
* @param serviceDictId
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "loadDataDict")
|
||||
public ServiceDictInfo loadDataDict(@RequestParam(required=false) Integer serviceDictId,HttpServletRequest request, HttpServletResponse response, Model model){
|
||||
|
||||
return serviceDictInfoService.getDictById(serviceDictId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询业务辅助表-业务字典信息列表
|
||||
* @param serviceDictInfo
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("sys:dict:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(ServiceDictInfo serviceDictInfo,HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
|
||||
Page<ServiceDictInfo> page = serviceDictInfoService.findDictList(new Page<ServiceDictInfo>(request, response), serviceDictInfo);
|
||||
model.addAttribute("page", page);
|
||||
|
||||
return "/cfg/serviceDictList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入添加或修改页面
|
||||
* @param serviceDictInfo
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"form"})
|
||||
public String form(ServiceDictInfo serviceDictInfo, Model model,String doAction) {
|
||||
if(doAction!=null&&doAction.equals("0")){
|
||||
return "/cfg/serviceDictInfo";
|
||||
}
|
||||
return "/cfg/serviceDictForm";
|
||||
}
|
||||
/**
|
||||
* 新增或修改
|
||||
* @param serviceDictInfo
|
||||
* @param model
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("sys:dict:edit")
|
||||
@RequestMapping(value = "saveOrUpdate")
|
||||
public String saveOrUpdate(ServiceDictInfo serviceDictInfo,Model model, RedirectAttributes redirectAttributes) {
|
||||
|
||||
try {
|
||||
serviceDictInfoService.saveOrUpdate(serviceDictInfo);
|
||||
addMessage(redirectAttributes, "保存配置成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "保存配置失败!");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/configuration/serviceDictInfo/list";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param serviceDictInfo
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"delete"})
|
||||
public String delete(ServiceDictInfo serviceDictInfo, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
serviceDictInfoService.deleteDict(serviceDictInfo);
|
||||
addMessage(redirectAttributes, "删除配置成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "删除配置失败!");
|
||||
}
|
||||
return "redirect:" + adminPath + "/configuration/serviceDictInfo/list";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* isShowHide是否显示隐藏菜单
|
||||
* @param extId
|
||||
* @param isShowHidden
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("user")
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "treeData")
|
||||
public List<Map<String, Object>> treeData(@RequestParam(required=false) String extId,@RequestParam(required=false) String isShowHide, HttpServletResponse response) {
|
||||
List<Map<String, Object>> mapList = Lists.newArrayList();
|
||||
List<ServiceDictInfo> list = serviceDictInfoService.findAllDict();
|
||||
for (int i=0; i<list.size(); i++){
|
||||
ServiceDictInfo serviceDictInfo = list.get(i);
|
||||
if (StringUtils.isBlank(extId) || (extId !=null && !extId.equals(serviceDictInfo.getServiceDictId().toString()))) {
|
||||
if(isShowHide != null && isShowHide.equals("0") && serviceDictInfo.getIsValid().equals(0)){
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> map = Maps.newHashMap();
|
||||
map.put("id", serviceDictInfo.getServiceDictId());
|
||||
map.put("pId", serviceDictInfo.getParent().getServiceDictId());
|
||||
map.put("name",serviceDictInfo.getItemValue());
|
||||
mapList.add(map);
|
||||
}
|
||||
}
|
||||
return mapList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//标签配置
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 进入添加或修改页面
|
||||
* @param serviceDictInfo
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"markForm"})
|
||||
public String markForm(ServiceDictInfo serviceDictInfo, Model model,String doAction) {
|
||||
if(doAction!=null&&doAction.equals("0")){
|
||||
return "/cfg/serviceDictMarkInfo";
|
||||
}
|
||||
return "/cfg/serviceDictMarkForm";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询业务辅助表-业务字典信息列表
|
||||
* @param serviceDictInfo
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("sys:dict:view")
|
||||
@RequestMapping(value = {"markList"})
|
||||
public String markList(ServiceDictInfo serviceDictInfo,HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
|
||||
Page<ServiceDictInfo> page = serviceDictInfoService.findDictMarkList(new Page<ServiceDictInfo>(request, response), serviceDictInfo);
|
||||
model.addAttribute("page", page);
|
||||
|
||||
return "/cfg/serviceDictMarkList";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
* @param serviceDictInfo
|
||||
* @param model
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("sys:dict:edit")
|
||||
@RequestMapping(value = "markSaveOrUpdate")
|
||||
public String markSaveOrUpdate(ServiceDictInfo serviceDictInfo,Model model, RedirectAttributes redirectAttributes) {
|
||||
|
||||
try {
|
||||
serviceDictInfoService.saveOrUpdate(serviceDictInfo);
|
||||
addMessage(redirectAttributes, "保存配置成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "保存配置失败!");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/configuration/serviceDictInfo/markList";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param serviceDictInfo
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"markDelete"})
|
||||
public String markDelete(ServiceDictInfo serviceDictInfo, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
serviceDictInfoService.deleteDict(serviceDictInfo);
|
||||
addMessage(redirectAttributes, "删除配置成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "删除配置失败!");
|
||||
}
|
||||
return "redirect:" + adminPath + "/configuration/serviceDictInfo/markList";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.SysDictInfo;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/configuration/sysDictInfo")
|
||||
public class SysDictInfoController extends BaseController {
|
||||
|
||||
|
||||
@ModelAttribute
|
||||
public SysDictInfo get(@RequestParam(required=false) Integer sysDictId) {
|
||||
if (!StringUtil.isEmpty(sysDictId)){
|
||||
return sysDictInfoService.getDictById(sysDictId);
|
||||
}else{
|
||||
return new SysDictInfo();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据sysDictId查出配置对象
|
||||
* @param sysDictId
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "loadDataDict")
|
||||
public SysDictInfo loadDataDict(@RequestParam(required=false) Integer sysDictId,HttpServletRequest request, HttpServletResponse response, Model model){
|
||||
|
||||
return sysDictInfoService.getDictById(sysDictId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询业务辅助表-生效范围系统字典信息列表
|
||||
* @param sysDictInfo
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("sys:dict:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(SysDictInfo sysDictInfo,HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
|
||||
Page<SysDictInfo> page = sysDictInfoService.findDictList(new Page<SysDictInfo>(request, response), sysDictInfo);
|
||||
model.addAttribute("page", page);
|
||||
|
||||
return "/cfg/sysDictList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入添加或修改页面
|
||||
* @param sysDictInfo
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"form"})
|
||||
public String form(SysDictInfo sysDictInfo, Model model,String doAction) {
|
||||
if(doAction!=null&&doAction.equals("0")){
|
||||
return "/cfg/sysDictInfo";
|
||||
}
|
||||
return "/cfg/sysDictForm";
|
||||
}
|
||||
/**
|
||||
* 新增或修改
|
||||
* @param sysDictInfo
|
||||
* @param model
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("sys:dict:edit")
|
||||
@RequestMapping(value = "saveOrUpdate")
|
||||
public String saveOrUpdate(SysDictInfo sysDictInfo,Model model, RedirectAttributes redirectAttributes) {
|
||||
|
||||
try {
|
||||
sysDictInfoService.saveOrUpdate(sysDictInfo);
|
||||
addMessage(redirectAttributes, "保存配置成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "保存配置失败!");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/configuration/sysDictInfo/list";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param sysDictInfo
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"delete"})
|
||||
public String delete(SysDictInfo sysDictInfo, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
sysDictInfoService.deleteDict(sysDictInfo);
|
||||
addMessage(redirectAttributes, "删除配置成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "删除配置失败!");
|
||||
}
|
||||
return "redirect:" + adminPath + "/configuration/sysDictInfo/list";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.configuration.ServiceDictInfo;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface ServiceDictInfoDao extends CrudDao<ServiceDictInfo> {
|
||||
|
||||
/**
|
||||
* 查询分类性质字典列表,
|
||||
* @param serviceDictInfo
|
||||
* @return
|
||||
*/
|
||||
List<ServiceDictInfo> findDictList(ServiceDictInfo serviceDictInfo);
|
||||
|
||||
/**
|
||||
* 查询标签字典列表
|
||||
* @param serviceDictInfo
|
||||
* @return
|
||||
*/
|
||||
List<ServiceDictInfo> findDictMarkList(ServiceDictInfo serviceDictInfo);
|
||||
|
||||
|
||||
/**
|
||||
* 添加字典信息
|
||||
* @param serviceDictInfo
|
||||
*/
|
||||
void insertDict(ServiceDictInfo serviceDictInfo);
|
||||
|
||||
/**
|
||||
* 根据主键查询字典详细信息
|
||||
* @param serviceDictId
|
||||
* @return
|
||||
*/
|
||||
ServiceDictInfo getDictById(Integer serviceDictId);
|
||||
|
||||
/**
|
||||
* 查询所有非叶子节点字典配置信息
|
||||
* @return
|
||||
*/
|
||||
List<ServiceDictInfo> findAllDict();
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
<?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="com.nis.web.dao.configuration.ServiceDictInfoDao" >
|
||||
|
||||
<resultMap id="dictResultMap" type="com.nis.domain.configuration.ServiceDictInfo" >
|
||||
<id column="service_dict_id" property="serviceDictId" jdbcType="INTEGER" />
|
||||
<result column="item_type" property="itemType" jdbcType="INTEGER" />
|
||||
<result column="item_code" property="itemCode" jdbcType="INTEGER" />
|
||||
<result column="item_value" property="itemValue" jdbcType="VARCHAR" />
|
||||
<result column="item_desc" property="itemDesc" jdbcType="VARCHAR" />
|
||||
<result column="is_leaf" property="isLeaf" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<!-- 父id -->
|
||||
<association property="parent" javaType="com.nis.domain.configuration.ServiceDictInfo">
|
||||
<id column="service_dict_id" property="serviceDictId" jdbcType="INTEGER" />
|
||||
<result column="item_type" property="itemType" jdbcType="INTEGER" />
|
||||
<result column="item_code" property="itemCode" jdbcType="INTEGER" />
|
||||
<result column="item_value" property="itemValue" jdbcType="VARCHAR" />
|
||||
<result column="item_desc" property="itemDesc" jdbcType="VARCHAR" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
</association>
|
||||
<!-- 创建人员 -->
|
||||
<association property="serviceDictCreator" javaType="com.nis.domain.SysUser">
|
||||
<id property="id" column="id"/>
|
||||
<result property="loginId" column="login_id"/>
|
||||
<result property="name" column="name"/>
|
||||
</association>
|
||||
<!-- 修改人员 -->
|
||||
<association property="serviceDictEditor" javaType="com.nis.domain.SysUser">
|
||||
<id property="id" column="id"/>
|
||||
<result property="loginId" column="login_id"/>
|
||||
<result property="name" column="name"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<sql id="serviceDictInfoColumns">
|
||||
s.service_dict_id AS serviceDictId,
|
||||
s.item_type AS itemType,
|
||||
s.item_code AS itemCode,
|
||||
s.item_value AS itemValue,
|
||||
s.item_desc AS itemDesc,
|
||||
s.parent_id AS "parent.serviceDictId",
|
||||
s.is_leaf AS isLeaf,
|
||||
s.is_valid AS isValid,
|
||||
s.creator_id AS "serviceDictCreator.id",
|
||||
s.create_time AS createTime,
|
||||
s.editor_id AS "serviceDictEditor.id",
|
||||
s.edit_time AS editTime
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
<!-- 查询分类性质列表 -->
|
||||
<select id="findDictList" resultMap="dictResultMap" parameterType="com.nis.domain.configuration.ServiceDictInfo">
|
||||
SELECT * FROM service_dict_info WHERE is_valid=1 AND item_type <![CDATA[<>]]> 3
|
||||
|
||||
<if test="itemType != null and itemType != '' " >
|
||||
AND item_type like '%${itemType}%'
|
||||
</if>
|
||||
<if test="itemCode != null and itemCode != '' " >
|
||||
AND item_code like '%${itemCode}%'
|
||||
</if>
|
||||
|
||||
<if test="beginDate !=null" >
|
||||
AND create_time >= #{beginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="endDate !=null" >
|
||||
AND create_time <= #{endDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY ${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY create_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 查询标签列表 -->
|
||||
<select id="findDictMarkList" resultMap="dictResultMap" parameterType="com.nis.domain.configuration.ServiceDictInfo">
|
||||
SELECT * FROM service_dict_info WHERE is_valid=1 AND item_type=3
|
||||
|
||||
<if test="itemType != null and itemType != '' " >
|
||||
AND item_type like '%${itemType}%'
|
||||
</if>
|
||||
<if test="itemCode != null and itemCode != '' " >
|
||||
AND item_code like '%${itemCode}%'
|
||||
</if>
|
||||
|
||||
<if test="beginDate !=null" >
|
||||
AND create_time >= #{beginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="endDate !=null" >
|
||||
AND create_time <= #{endDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY ${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY create_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 根据主键查询字典详细信息 -->
|
||||
|
||||
<select id="getDictById" resultType="com.nis.domain.configuration.ServiceDictInfo">
|
||||
select
|
||||
<include refid="serviceDictInfoColumns"/>
|
||||
from service_dict_info s where s.service_dict_id = #{serviceDictId}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<!-- 新增字典信息 -->
|
||||
|
||||
<insert id="insertDict" parameterType="com.nis.domain.configuration.ServiceDictInfo" useGeneratedKeys="true" keyProperty="id" >
|
||||
insert into service_dict_info (item_type, item_code, item_value, item_desc, parent_id, is_leaf, is_valid, creator_id, create_time, editor_id, edit_time)
|
||||
values ( #{itemType,jdbcType=INTEGER}, #{itemCode,jdbcType=INTEGER},
|
||||
#{itemValue,jdbcType=VARCHAR}, #{itemDesc,jdbcType=VARCHAR},
|
||||
#{parent.serviceDictId,jdbcType=INTEGER}, #{isLeaf,jdbcType=INTEGER}, #{isValid,jdbcType=INTEGER},
|
||||
#{serviceDictCreator.id,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{serviceDictEditor.id,jdbcType=INTEGER}, #{editTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
|
||||
|
||||
<!-- 查询非叶子节点的所有字典信息 -->
|
||||
|
||||
<select id="findAllDict">
|
||||
select
|
||||
<include refid="serviceDictInfoColumns" />
|
||||
from service_dict_info s where s.is_leaf = 0;
|
||||
</select>
|
||||
|
||||
<!-- 修改 -->
|
||||
<update id="update">
|
||||
UPDATE service_dict_info s SET
|
||||
s.service_dict_id = #{serviceDictId},
|
||||
s.item_type = #{itemType},
|
||||
s.item_code = #{itemCode},
|
||||
s.item_value = #{itemValue},
|
||||
s.item_desc = #{itemDesc},
|
||||
s.parent_id = #{parent.serviceDictId},
|
||||
s.is_leaf = #{isLeaf},
|
||||
s.creator_id = #{serviceDictCreator.id},
|
||||
s.editor_id = #{serviceDictEditor.id},
|
||||
s.edit_time = #{editTime}
|
||||
WHERE s.service_dict_id = #{serviceDictId}
|
||||
</update>
|
||||
|
||||
<!-- 删除 -->
|
||||
|
||||
<update id="delete">
|
||||
UPDATE service_dict_info s set s.is_valid = #{isValid} where s.service_dict_id = #{serviceDictId}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.nis.domain.configuration.SysDictInfo;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface SysDictInfoDao extends CrudDao<SysDictInfo> {
|
||||
|
||||
/**
|
||||
* 查询生效范围字典列表,
|
||||
* @param sysDictInfo
|
||||
* @return
|
||||
*/
|
||||
List<SysDictInfo> findDictList(SysDictInfo sysDictInfo);
|
||||
|
||||
|
||||
/**
|
||||
* 添加字典信息
|
||||
* @param sysDictInfo
|
||||
*/
|
||||
void insertDict(SysDictInfo sysDictInfo);
|
||||
|
||||
/**
|
||||
* 根据主键查询字典详细信息
|
||||
* @param sysDictId
|
||||
* @return
|
||||
*/
|
||||
SysDictInfo getDictById(Integer sysDictId);
|
||||
|
||||
/**
|
||||
* 查询所有非叶子节点字典配置信息
|
||||
* @return
|
||||
*/
|
||||
List<SysDictInfo> findAllDict();
|
||||
|
||||
|
||||
}
|
||||
133
src/main/java/com/nis/web/dao/configuration/SysDictInfoDao.xml
Normal file
133
src/main/java/com/nis/web/dao/configuration/SysDictInfoDao.xml
Normal file
@@ -0,0 +1,133 @@
|
||||
<?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="com.nis.web.dao.configuration.SysDictInfoDao" >
|
||||
|
||||
<resultMap id="dictResultMap" type="com.nis.domain.configuration.SysDictInfo" >
|
||||
<id column="sys_dict_id" property="sysDictId" jdbcType="INTEGER" />
|
||||
<result column="item_type" property="itemType" jdbcType="INTEGER" />
|
||||
<result column="item_code" property="itemCode" jdbcType="INTEGER" />
|
||||
<result column="item_value" property="itemValue" jdbcType="VARCHAR" />
|
||||
<result column="item_desc" property="itemDesc" jdbcType="VARCHAR" />
|
||||
<result column="is_leaf" property="isLeaf" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<!-- 父id -->
|
||||
<association property="parent" javaType="com.nis.domain.configuration.SysDictInfo">
|
||||
<id column="sys_dict_id" property="sysDictId" jdbcType="INTEGER" />
|
||||
<result column="item_type" property="itemType" jdbcType="INTEGER" />
|
||||
<result column="item_code" property="itemCode" jdbcType="INTEGER" />
|
||||
<result column="item_value" property="itemValue" jdbcType="VARCHAR" />
|
||||
<result column="item_desc" property="itemDesc" jdbcType="VARCHAR" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
</association>
|
||||
<!-- 创建人员 -->
|
||||
<association property="sysDictCreator" javaType="com.nis.domain.SysUser">
|
||||
<id property="id" column="id"/>
|
||||
<result property="loginId" column="login_id"/>
|
||||
<result property="name" column="name"/>
|
||||
</association>
|
||||
<!-- 修改人员 -->
|
||||
<association property="sysDictEditor" javaType="com.nis.domain.SysUser">
|
||||
<id property="id" column="id"/>
|
||||
<result property="loginId" column="login_id"/>
|
||||
<result property="name" column="name"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<sql id="sysDictInfoColumns">
|
||||
s.sys_dict_id AS sysDictId,
|
||||
s.item_type AS itemType,
|
||||
s.item_code AS itemCode,
|
||||
s.item_value AS itemValue,
|
||||
s.item_desc AS itemDesc,
|
||||
s.parent_id AS "parent.sysDictId",
|
||||
s.is_leaf AS isLeaf,
|
||||
s.is_valid AS isValid,
|
||||
s.creator_id AS "sysDictCreator.id",
|
||||
s.create_time AS createTime,
|
||||
s.editor_id AS "sysDictEditor.id",
|
||||
s.edit_time AS editTime
|
||||
</sql>
|
||||
|
||||
<!-- 查询分类性质列表 -->
|
||||
<select id="findDictList" resultMap="dictResultMap" parameterType="com.nis.domain.configuration.SysDictInfo">
|
||||
SELECT * FROM sys_dict_info WHERE is_valid=1
|
||||
|
||||
<if test="itemType != null and itemType != '' " >
|
||||
AND item_type like '%${itemType}%'
|
||||
</if>
|
||||
<if test="itemCode != null and itemCode != '' " >
|
||||
AND item_code like '%${itemCode}%'
|
||||
</if>
|
||||
|
||||
<if test="beginDate !=null" >
|
||||
AND create_time >= #{beginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="endDate !=null" >
|
||||
AND create_time <= #{endDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY ${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY create_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 根据主键查询字典详细信息 -->
|
||||
|
||||
<select id="getDictById" resultType="com.nis.domain.configuration.SysDictInfo">
|
||||
select
|
||||
<include refid="sysDictInfoColumns"/>
|
||||
from sys_dict_info s where s.sys_dict_id = #{sysDictId}
|
||||
</select>
|
||||
|
||||
<!-- 新增字典信息 -->
|
||||
|
||||
<insert id="insertDict" parameterType="com.nis.domain.configuration.SysDictInfo" useGeneratedKeys="true" keyProperty="id" >
|
||||
insert into sys_dict_info (item_type, item_code, item_value, item_desc, parent_id, is_leaf, is_valid, creator_id, create_time, editor_id, edit_time)
|
||||
values ( #{itemType,jdbcType=INTEGER}, #{itemCode,jdbcType=INTEGER},
|
||||
#{itemValue,jdbcType=VARCHAR}, #{itemDesc,jdbcType=VARCHAR},
|
||||
#{parent.sysDictId,jdbcType=INTEGER}, #{isLeaf,jdbcType=INTEGER}, #{isValid,jdbcType=INTEGER},
|
||||
#{sysDictCreator.id,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{sysDictEditor.id,jdbcType=INTEGER}, #{editTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
|
||||
|
||||
<!-- 查询非叶子节点的所有字典信息 -->
|
||||
|
||||
<select id="findAllDict">
|
||||
select
|
||||
<include refid="sysDictInfoColumns" />
|
||||
from sys_dict_info s where s.is_leaf = 0;
|
||||
</select>
|
||||
|
||||
<!-- 修改 -->
|
||||
<update id="update">
|
||||
UPDATE sys_dict_info s SET
|
||||
s.sys_dict_id = #{sysDictId},
|
||||
s.item_type = #{itemType},
|
||||
s.item_code = #{itemCode},
|
||||
s.item_value = #{itemValue},
|
||||
s.item_desc = #{itemDesc},
|
||||
s.parent_id = #{parent.sysDictId},
|
||||
s.is_leaf = #{isLeaf},
|
||||
s.creator_id = #{sysDictCreator.id},
|
||||
s.editor_id = #{sysDictEditor.id},
|
||||
s.edit_time = #{editTime}
|
||||
WHERE s.sys_dict_id = #{sysDictId}
|
||||
</update>
|
||||
|
||||
<!-- 删除 -->
|
||||
|
||||
<update id="delete">
|
||||
UPDATE sys_dict_info s set s.is_valid = #{isValid} where s.sys_dict_id = #{sysDictId}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.SysMenu;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.configuration.ServiceDictInfo;
|
||||
import com.nis.util.DateUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.configuration.ServiceDictInfoDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
|
||||
@Service
|
||||
public class ServiceDictInfoService extends BaseService{
|
||||
|
||||
@Autowired
|
||||
private ServiceDictInfoDao serviceDictInfoDao;
|
||||
|
||||
/**
|
||||
* 查询分类性质字典分页
|
||||
* @param page
|
||||
* @param serviceDictInfo
|
||||
* @return
|
||||
*/
|
||||
public Page<ServiceDictInfo> findDictList(Page<ServiceDictInfo> page, ServiceDictInfo serviceDictInfo) {
|
||||
// 设置分页参数
|
||||
serviceDictInfo.setPage(page);
|
||||
// 执行分页查询
|
||||
List<ServiceDictInfo> list = Lists.newArrayList();
|
||||
List<ServiceDictInfo> sourcelist = serviceDictInfoDao.findDictList(serviceDictInfo);
|
||||
ServiceDictInfo.sortList(list, sourcelist, 0l, true);
|
||||
page.setList(sourcelist);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询标签分页
|
||||
* @param page
|
||||
* @param serviceDictInfo
|
||||
* @return
|
||||
*/
|
||||
public Page<ServiceDictInfo> findDictMarkList(Page<ServiceDictInfo> page, ServiceDictInfo serviceDictInfo) {
|
||||
// 设置分页参数
|
||||
serviceDictInfo.setPage(page);
|
||||
// 执行分页查询
|
||||
List<ServiceDictInfo> list = Lists.newArrayList();
|
||||
List<ServiceDictInfo> sourcelist = serviceDictInfoDao.findDictMarkList(serviceDictInfo);
|
||||
ServiceDictInfo.sortList(list, sourcelist, 0l, true);
|
||||
page.setList(sourcelist);
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据主键查询字典详细信息
|
||||
* @param serviceDictId
|
||||
* @return
|
||||
*/
|
||||
public ServiceDictInfo getDictById(Integer serviceDictId) {
|
||||
return serviceDictInfoDao.getDictById(serviceDictId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改业务字典表
|
||||
* @param serviceDictInfo
|
||||
*/
|
||||
public void saveOrUpdate(ServiceDictInfo serviceDictInfo) {
|
||||
SysUser user = UserUtils.getUser();
|
||||
if(StringUtil.isEmpty(serviceDictInfo.getServiceDictId())) {//新增
|
||||
serviceDictInfo.setIsValid(1);
|
||||
serviceDictInfo.setServiceDictCreator(user);
|
||||
serviceDictInfo.setCreateTime(new Date());
|
||||
serviceDictInfo.setServiceDictEditor(user);
|
||||
serviceDictInfo.setEditTime(serviceDictInfo.getCreateTime());
|
||||
if(serviceDictInfo.getParent()==null||(serviceDictInfo.getParent()!=null&&serviceDictInfo.getParent().getServiceDictId()==null)){
|
||||
ServiceDictInfo parent = new ServiceDictInfo();
|
||||
parent.setServiceDictId(0);
|
||||
serviceDictInfo.setParent(parent);
|
||||
}
|
||||
serviceDictInfoDao.insertDict(serviceDictInfo);
|
||||
|
||||
}
|
||||
|
||||
else {//修改
|
||||
serviceDictInfo.setServiceDictEditor(user);
|
||||
serviceDictInfo.setEditTime(new Date());
|
||||
serviceDictInfoDao.update(serviceDictInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有非叶子节点字典配置信息
|
||||
* @return
|
||||
*/
|
||||
public List<ServiceDictInfo> findAllDict() {
|
||||
|
||||
return serviceDictInfoDao.findAllDict();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param serviceDictInfo
|
||||
*/
|
||||
public void deleteDict(ServiceDictInfo serviceDictInfo) {
|
||||
serviceDictInfo.setIsValid(0);
|
||||
serviceDictInfoDao.delete(serviceDictInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.configuration.SysDictInfo;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.configuration.SysDictInfoDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
|
||||
@Service
|
||||
public class SysDictInfoService extends BaseService{
|
||||
|
||||
@Autowired
|
||||
private SysDictInfoDao sysDictInfoDao;
|
||||
|
||||
/**
|
||||
* 查询生效范围字典分页
|
||||
* @param page
|
||||
* @param sysDictInfo
|
||||
* @return
|
||||
*/
|
||||
public Page<SysDictInfo> findDictList(Page<SysDictInfo> page, SysDictInfo sysDictInfo) {
|
||||
// 设置分页参数
|
||||
sysDictInfo.setPage(page);
|
||||
// 执行分页查询
|
||||
List<SysDictInfo> list = Lists.newArrayList();
|
||||
List<SysDictInfo> sourcelist = sysDictInfoDao.findDictList(sysDictInfo);
|
||||
SysDictInfo.sortList(list, sourcelist, 0, true);
|
||||
page.setList(sourcelist);
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据主键查询生效范围字典详细信息
|
||||
* @param sysDictId
|
||||
* @return
|
||||
*/
|
||||
public SysDictInfo getDictById(Integer sysDictId) {
|
||||
return sysDictInfoDao.getDictById(sysDictId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改生效范围字典表
|
||||
* @param sysDictInfo
|
||||
*/
|
||||
public void saveOrUpdate(SysDictInfo sysDictInfo) {
|
||||
SysUser user = UserUtils.getUser();
|
||||
if(StringUtil.isEmpty(sysDictInfo.getSysDictId())) {//新增
|
||||
sysDictInfo.setIsValid(1);
|
||||
sysDictInfo.setSysDictCreator(user);
|
||||
sysDictInfo.setCreateTime(new Date());
|
||||
sysDictInfo.setSysDictEditor(user);
|
||||
sysDictInfo.setEditTime(sysDictInfo.getCreateTime());
|
||||
if(sysDictInfo.getParent()==null||(sysDictInfo.getParent()!=null&&sysDictInfo.getParent().getSysDictId()==null)){
|
||||
SysDictInfo parent = new SysDictInfo();
|
||||
parent.setSysDictId(0);
|
||||
sysDictInfo.setParent(parent);
|
||||
}
|
||||
sysDictInfoDao.insertDict(sysDictInfo);
|
||||
|
||||
}
|
||||
|
||||
else {//修改
|
||||
sysDictInfo.setSysDictEditor(user);
|
||||
sysDictInfo.setEditTime(new Date());
|
||||
sysDictInfoDao.update(sysDictInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有非叶子节点生效范围字典配置信息
|
||||
* @return
|
||||
*/
|
||||
public List<SysDictInfo> findAllDict() {
|
||||
|
||||
return sysDictInfoDao.findAllDict();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param sysDictInfo
|
||||
*/
|
||||
public void deleteDict(SysDictInfo sysDictInfo) {
|
||||
sysDictInfo.setIsValid(0);
|
||||
sysDictInfoDao.delete(sysDictInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user