优化业务/系统字典功能,数据类型数量可改变,可任意组合菜单(作用域必须单独),页面自动设定权限,组合菜单时数据类型超过1种,列表页面条件搜索添加数据类型条件。
修订校验时浏览器的兼容问题,
This commit is contained in:
@@ -43,6 +43,13 @@ public class ServiceDictInfo extends BaseEntity<ServiceDictInfo>{
|
||||
private String showSequence; //显示序号
|
||||
|
||||
|
||||
/**
|
||||
* 封装参数数据类型,
|
||||
*
|
||||
*/
|
||||
private List<Integer> conditionType;
|
||||
|
||||
|
||||
public Integer getServiceDictId() {
|
||||
return serviceDictId;
|
||||
}
|
||||
@@ -159,6 +166,12 @@ public class ServiceDictInfo extends BaseEntity<ServiceDictInfo>{
|
||||
public void setShowSequence(String showSequence) {
|
||||
this.showSequence = showSequence;
|
||||
}
|
||||
public List<Integer> getConditionType() {
|
||||
return conditionType;
|
||||
}
|
||||
public void setConditionType(List<Integer> conditionType) {
|
||||
this.conditionType = conditionType;
|
||||
}
|
||||
@JsonIgnore
|
||||
public static void sortList(List<ServiceDictInfo> list, List<ServiceDictInfo> sourcelist, Integer parentId, boolean cascade){
|
||||
for (int i=0; i<sourcelist.size(); i++){
|
||||
|
||||
@@ -40,6 +40,12 @@ public class SysDictInfo extends BaseEntity<SysDictInfo>{
|
||||
|
||||
private String showSequence; //显示序号
|
||||
|
||||
/**
|
||||
* 封装参数数据类型,
|
||||
*
|
||||
*/
|
||||
private List<Integer> conditionType;
|
||||
|
||||
|
||||
public Integer getSysDictId() {
|
||||
return sysDictId;
|
||||
@@ -155,6 +161,12 @@ public class SysDictInfo extends BaseEntity<SysDictInfo>{
|
||||
public String getShowSequence() {
|
||||
return showSequence;
|
||||
}
|
||||
public List<Integer> getConditionType() {
|
||||
return conditionType;
|
||||
}
|
||||
public void setConditionType(List<Integer> conditionType) {
|
||||
this.conditionType = conditionType;
|
||||
}
|
||||
@JsonIgnore
|
||||
public static void sortList(List<SysDictInfo> list, List<SysDictInfo> sourcelist, Integer parentId, boolean cascade){
|
||||
for (int i=0; i<sourcelist.size(); i++){
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -69,64 +70,84 @@ public class ConfigDictUtils {
|
||||
return number1+(number2-1)*number3;
|
||||
}
|
||||
/**
|
||||
* 根据数据类型编码取出数据类型
|
||||
* @param dictKey
|
||||
* 根据数据类型编码取出数据类型标题国际化
|
||||
* (2018-03-30修订获取的国际化改为类型的国际化)
|
||||
* @param dictKey 数据的字典标识
|
||||
* @param intArr
|
||||
* @return
|
||||
*/
|
||||
public static String getItemTypeByNo(String dictKey, List intArr){
|
||||
String result = "";
|
||||
String value = DictUtils.getDictLabel(dictKey,intArr.get(0).toString());
|
||||
if(value.trim().equals("classification")){
|
||||
result = "classification_manage";
|
||||
public static List<String> getItemTypeByNo(String dictKey, List intArr){
|
||||
List<String> itemValueList = Lists.newArrayList();
|
||||
if(intArr==null||intArr.size()==0){
|
||||
List<SysDataDictionaryItem> itemList = DictUtils.getDictList(dictKey);
|
||||
if(!StringUtil.isEmpty(itemList)){
|
||||
for(SysDataDictionaryItem sd:itemList){
|
||||
itemValueList.add(sd.getItemValue());
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for(Object itemCode:intArr){
|
||||
itemValueList.add(DictUtils.getDictLabel(dictKey,itemCode.toString()));
|
||||
}
|
||||
}
|
||||
if(value.trim().equals("attribute")){
|
||||
result = "attribute_manage";
|
||||
}
|
||||
if(value.trim().equals("label")){
|
||||
result = "label_manage";
|
||||
}
|
||||
if(value.trim().equals("area")){
|
||||
result = "area_manage";
|
||||
}
|
||||
if(value.trim().equals("isp")){
|
||||
result = "isp_manage";
|
||||
}
|
||||
if(value.trim().equals("scope")){
|
||||
result = "feature_scope_manage";
|
||||
}
|
||||
return result;
|
||||
|
||||
return itemValueList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据数据类型编码取出权限标识码
|
||||
* @param dictKey
|
||||
* @param dictKey 数据的字典标识
|
||||
* @param intArr
|
||||
* @return
|
||||
*/
|
||||
public static String getPermissionByNo(String dictKey, List intArr){
|
||||
String result = "";
|
||||
String value = DictUtils.getDictLabel(dictKey,intArr.get(0).toString());
|
||||
if(value.trim().equals("classification")){
|
||||
result = "classification";
|
||||
List<String> itemValueList = Lists.newArrayList();
|
||||
StringBuffer sb = new StringBuffer("");
|
||||
itemValueList=getItemTypeByNo(dictKey,intArr);
|
||||
if(!StringUtil.isEmpty(itemValueList)){
|
||||
for(String itermvalue:itemValueList){
|
||||
sb.append(itermvalue);
|
||||
}
|
||||
}
|
||||
if(value.trim().equals("attribute")){
|
||||
result = "attribute";
|
||||
}
|
||||
if(value.trim().equals("label")){
|
||||
result = "label";
|
||||
}
|
||||
if(value.trim().equals("area")){
|
||||
result = "area";
|
||||
}
|
||||
if(value.trim().equals("isp")){
|
||||
result = "isp";
|
||||
}
|
||||
if(value.trim().equals("scope")){
|
||||
result = "scope";
|
||||
}
|
||||
return result;
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据数据类型标识取出数据类型的itemCode
|
||||
* @param dictKey 数据的字典标识
|
||||
* @param intArr
|
||||
* @return
|
||||
*/
|
||||
public static List<Integer> getAllType(String dictKey){
|
||||
List<Integer> itemCodeList = Lists.newArrayList();
|
||||
List<SysDataDictionaryItem> itemList = DictUtils.getDictList(dictKey);
|
||||
if(!StringUtil.isEmpty(itemList)){
|
||||
for(SysDataDictionaryItem sd:itemList){
|
||||
itemCodeList.add(Integer.valueOf(sd.getItemCode()));
|
||||
}
|
||||
}
|
||||
return itemCodeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入数据拆分数据类型参数
|
||||
* @param dictKey 数据的字典标识
|
||||
* @param itType 传入参数
|
||||
* @return
|
||||
*/
|
||||
public static List<Integer> dealTypeCondition(String dictKey,String itType ){
|
||||
List<Integer> intArr = Lists.newArrayList();
|
||||
if(StringUtil.isEmpty(itType)){
|
||||
intArr = ConfigDictUtils.getAllType(dictKey);
|
||||
}else{
|
||||
String[] strArr = itType.split("-");
|
||||
Integer[] tempArr = new Integer[strArr.length];
|
||||
for(int i=0;i<strArr.length;i++){
|
||||
tempArr[i] = Integer.valueOf(strArr[i]);
|
||||
}
|
||||
intArr = Arrays.asList(tempArr);
|
||||
}
|
||||
return intArr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.util.ConfigDictUtils;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
@@ -44,21 +45,6 @@ public class ServiceDictInfoController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询业务辅助表-业务字典信息列表(无条件分页查询)
|
||||
@@ -69,16 +55,11 @@ public class ServiceDictInfoController extends BaseController {
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions(value={"basics:classification:view","basics:attribute:view","basics:label:view"},logical=Logical.OR)
|
||||
@RequiresPermissions(value={"basics:classification:view","basics:attribute:view","basics:label:view","basics:classificationattribute:edit"},logical=Logical.OR)
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(String itType, ServiceDictInfo serviceDictInfo,HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
//处理数据
|
||||
String[] strArr = itType.split("-");
|
||||
Integer[] intArr = new Integer[strArr.length];
|
||||
for(int i=0;i<strArr.length;i++){
|
||||
intArr[i] = Integer.valueOf(strArr[i]);
|
||||
}
|
||||
|
||||
List<Integer> intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SERVICE_DICT_ITM_TYPE", ""), itType);
|
||||
String searchType = null;
|
||||
String searchContent = null;
|
||||
if(!StringUtils.isBlank(serviceDictInfo.getItemCode())){
|
||||
@@ -93,12 +74,15 @@ public class ServiceDictInfoController extends BaseController {
|
||||
model.addAttribute("searchContent", searchContent);
|
||||
|
||||
Page<ServiceDictInfo> pageCondition = new Page<ServiceDictInfo>(request, response);
|
||||
|
||||
//查询符合条件总数
|
||||
List<ServiceDictInfo> allList = serviceDictInfoService.findAllServiceDictInfo(serviceDictInfo,intArr,pageCondition.getOrderBy());
|
||||
model.addAttribute("showTotalCount", allList.size());
|
||||
|
||||
//查出顶层分页数据
|
||||
Page<ServiceDictInfo> page = serviceDictInfoService.findTopDictList(pageCondition, serviceDictInfo,intArr);
|
||||
Page<ServiceDictInfo> page = serviceDictInfoService.findTopDictList(pageCondition, serviceDictInfo,intArr);
|
||||
|
||||
|
||||
// 植入序号
|
||||
for (int i = 0; i < page.getList().size(); i++) {
|
||||
page.getList().get(i).setShowSequence("" + (i + 1 + ((page.getPageNo() - 1) * page.getPageSize())));
|
||||
@@ -129,7 +113,7 @@ public class ServiceDictInfoController extends BaseController {
|
||||
//处理下级序号
|
||||
ServiceDictInfo.addChildrenSeq(list, 0);
|
||||
model.addAttribute("itType", itType);
|
||||
model.addAttribute("intArr", Arrays.asList(intArr));
|
||||
model.addAttribute("intArr", intArr);
|
||||
model.addAttribute("list", list);
|
||||
return "/basics/serviceDictList";
|
||||
}
|
||||
@@ -141,7 +125,7 @@ public class ServiceDictInfoController extends BaseController {
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions(value={"basics:classification:edit","basics:attribute:edit","basics:label:edit"},logical=Logical.OR)
|
||||
@RequiresPermissions(value={"basics:classification:edit","basics:attribute:edit","basics:label:edit","basics:classificationattribute:edit"},logical=Logical.OR)
|
||||
@RequestMapping(value={"form"})
|
||||
public String form(ServiceDictInfo serviceDictInfo, Model model,String doAction,String itType) {
|
||||
if(doAction!=null&&doAction.equals("0")){
|
||||
@@ -152,12 +136,8 @@ public class ServiceDictInfoController extends BaseController {
|
||||
parent.setServiceDictId(0);
|
||||
serviceDictInfo.setParent(parent);
|
||||
}
|
||||
String[] strArr = itType.split("-");
|
||||
Integer[] intArr = new Integer[strArr.length];
|
||||
for(int i=0;i<strArr.length;i++){
|
||||
intArr[i] = Integer.valueOf(strArr[i]);
|
||||
}
|
||||
model.addAttribute("intArr", Arrays.asList(intArr));
|
||||
List<Integer> intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SERVICE_DICT_ITM_TYPE", ""), itType);
|
||||
model.addAttribute("intArr", intArr);
|
||||
model.addAttribute("serviceDictInfo", serviceDictInfo);
|
||||
model.addAttribute("itType", itType);
|
||||
return "/basics/serviceDictForm";
|
||||
@@ -236,10 +216,6 @@ public class ServiceDictInfoController extends BaseController {
|
||||
map.put("id", serviceDictInfo.getServiceDictId());
|
||||
map.put("pId", serviceDictInfo.getParent().getServiceDictId());
|
||||
map.put("name",serviceDictInfo.getItemValue());
|
||||
/*if(serviceDictInfo.getParent().getServiceDictId()!=0){
|
||||
ServiceDictInfo parent = serviceDictInfoService.getDictById(serviceDictInfo.getParent().getServiceDictId());
|
||||
//map.put("placeholder",parent.getItemType().toString());
|
||||
}*/
|
||||
|
||||
mapList.add(map);
|
||||
}
|
||||
@@ -296,7 +272,7 @@ public class ServiceDictInfoController extends BaseController {
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "ajaxChildrenType")
|
||||
public boolean ajaxChildrenType(Integer parent,Integer newItemType) {
|
||||
public boolean ajaxChildrenType(Integer parent,Integer itemType) {
|
||||
if(parent==null){
|
||||
return true;
|
||||
}
|
||||
@@ -306,7 +282,7 @@ public class ServiceDictInfoController extends BaseController {
|
||||
return true;
|
||||
}else{
|
||||
for(ServiceDictInfo serviceDictInfo:list){
|
||||
if(serviceDictInfo.getItemType()==newItemType){
|
||||
if(serviceDictInfo.getItemType()==itemType){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -386,9 +362,8 @@ public class ServiceDictInfoController extends BaseController {
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
ServiceDictInfo c = serviceDictInfoService.getDictById(currentId);
|
||||
if(p.getLevelNo()<max){
|
||||
//查出该类所有下级的层级数之和
|
||||
//查出该节点所有下级的层级数之和
|
||||
List<ServiceDictInfo> list = serviceDictInfoService.getDictByParentId(currentId);
|
||||
if(list==null||list.size()==0){
|
||||
return true;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.nis.web.controller.basics;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -22,6 +23,7 @@ import com.google.common.collect.Maps;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.basics.SysDictInfo;
|
||||
import com.nis.util.ConfigDictUtils;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
@@ -43,21 +45,6 @@ public class SysDictInfoController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询业务辅助表-生效范围系统字典信息列表(无条件分页查询)
|
||||
@@ -71,13 +58,9 @@ public class SysDictInfoController extends BaseController {
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(String itType, SysDictInfo sysDictInfo,HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
//处理数据
|
||||
String[] strArr = itType.split("-");
|
||||
Integer[] intArr = new Integer[strArr.length];
|
||||
for(int i=0;i<strArr.length;i++){
|
||||
intArr[i] = Integer.valueOf(strArr[i]);
|
||||
}
|
||||
if(intArr.length==1){
|
||||
model.addAttribute("specType", intArr[0]);
|
||||
List<Integer> intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SYS_DICT_ITM_TYPE", ""), itType);
|
||||
if(intArr.size()==1){
|
||||
model.addAttribute("specType", intArr.get(0));
|
||||
}
|
||||
String searchType = null;
|
||||
String searchContent = null;
|
||||
@@ -127,7 +110,7 @@ public class SysDictInfoController extends BaseController {
|
||||
//处理下级序号
|
||||
SysDictInfo.addChildrenSeq(list, 0);
|
||||
model.addAttribute("itType", itType);
|
||||
model.addAttribute("intArr", Arrays.asList(intArr));
|
||||
model.addAttribute("intArr", intArr);
|
||||
model.addAttribute("list", list);
|
||||
return "/basics/sysDictList";
|
||||
}
|
||||
@@ -145,20 +128,16 @@ public class SysDictInfoController extends BaseController {
|
||||
model.addAttribute("specType", sysDictInfo.getItemType());
|
||||
return "/basics/sysDictInfo";
|
||||
}
|
||||
if (sysDictInfo.getParent() == null || sysDictInfo.getParent().getSysDictId() == null) {
|
||||
if (sysDictInfo==null||sysDictInfo.getParent() == null || sysDictInfo.getParent().getSysDictId() == null) {
|
||||
SysDictInfo parent = new SysDictInfo();
|
||||
parent.setSysDictId(0);
|
||||
sysDictInfo.setParent(parent);
|
||||
}
|
||||
String[] strArr = itType.split("-");
|
||||
Integer[] intArr = new Integer[strArr.length];
|
||||
for(int i=0;i<strArr.length;i++){
|
||||
intArr[i] = Integer.valueOf(strArr[i]);
|
||||
List<Integer> intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SYS_DICT_ITM_TYPE", ""), itType);
|
||||
if(intArr.size()==1){
|
||||
model.addAttribute("specType", intArr.get(0));
|
||||
}
|
||||
if(intArr.length==1){
|
||||
model.addAttribute("specType", intArr[0]);
|
||||
}
|
||||
model.addAttribute("intArr", Arrays.asList(intArr));
|
||||
model.addAttribute("intArr", intArr);
|
||||
model.addAttribute("sysDictInfo", sysDictInfo);
|
||||
model.addAttribute("itType", itType);
|
||||
return "/basics/sysDictForm";
|
||||
@@ -298,7 +277,7 @@ public class SysDictInfoController extends BaseController {
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "ajaxChildrenType")
|
||||
public boolean ajaxChildrenType(Integer parent,Integer newItemType) {
|
||||
public boolean ajaxChildrenType(Integer parent,Integer itemType) {
|
||||
if(parent==null){
|
||||
return true;
|
||||
}
|
||||
@@ -308,7 +287,7 @@ public class SysDictInfoController extends BaseController {
|
||||
return true;
|
||||
}else{
|
||||
for(SysDictInfo sysDictInfo:list){
|
||||
if(sysDictInfo.getItemType()==newItemType){
|
||||
if(sysDictInfo.getItemType()==itemType){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -388,14 +367,41 @@ public class SysDictInfoController extends BaseController {
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
SysDictInfo c = sysDictInfoService.getDictById(currentId);
|
||||
if((p.getLevelNo()+c.getLevelNo())<(max+1)){
|
||||
return true;
|
||||
if(p.getLevelNo()<max){
|
||||
//查出该节点所有下级的层级数之和
|
||||
List<SysDictInfo> list = sysDictInfoService.getDictByParentId(currentId);
|
||||
if(list==null||list.size()==0){
|
||||
return true;
|
||||
}
|
||||
List<SysDictInfo> resultList = Lists.newArrayList();
|
||||
List<Integer> intList = Lists.newArrayList();
|
||||
allTreeNode(1,list,resultList);
|
||||
for(SysDictInfo se:resultList){
|
||||
intList.add(se.getLevelNo());
|
||||
}
|
||||
int x = Collections.max(intList);
|
||||
if((p.getLevelNo()+x)<(max+1)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查出所该节点下有树形子节点
|
||||
*/
|
||||
|
||||
private void allTreeNode(int levelNo, List<SysDictInfo> list, List<SysDictInfo> resultList) {
|
||||
if(list!=null&&list.size()>0){
|
||||
for(SysDictInfo se:list){
|
||||
se.setLevelNo(levelNo+1);
|
||||
resultList.add(se);
|
||||
List<SysDictInfo> newList = sysDictInfoService.getDictByParentId(se.getSysDictId());
|
||||
allTreeNode(se.getLevelNo(),newList,resultList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,34 +13,22 @@ import com.nis.web.dao.MyBatisDao;
|
||||
public interface ServiceDictInfoDao extends CrudDao<ServiceDictInfo> {
|
||||
|
||||
/**
|
||||
* 查询顶层字典列表(==)
|
||||
* 查询顶层字典列表
|
||||
* @param serviceDictInfo
|
||||
* @return
|
||||
*/
|
||||
List<ServiceDictInfo> findTopDictList(ServiceDictInfo serviceDictInfo);
|
||||
/**
|
||||
* 查询顶层字典列表(!=)
|
||||
* @param serviceDictInfo
|
||||
* @return
|
||||
*/
|
||||
List<ServiceDictInfo> findTopDictListN(ServiceDictInfo serviceDictInfo);
|
||||
/**
|
||||
* findAllServiceDictInfo
|
||||
*/
|
||||
/**
|
||||
* 查询所有字典列表(==)
|
||||
* 查询所有符合条件的字典列表
|
||||
* @param serviceDictInfo
|
||||
* @return
|
||||
*/
|
||||
List<ServiceDictInfo> findAllServiceDictInfo(@Param("serviceDictInfo")ServiceDictInfo serviceDictInfo,@Param("orderBy")String orderBy);
|
||||
/**
|
||||
* 查询所有字典列表(!=)
|
||||
* @param serviceDictInfo
|
||||
* @return
|
||||
*/
|
||||
List<ServiceDictInfo> findAllServiceDictInfoN(@Param("serviceDictInfo")ServiceDictInfo serviceDictInfo,@Param("orderBy")String orderBy);
|
||||
/**
|
||||
* 查出所有有效数据
|
||||
* 查出所有有效数据父级(!=0)
|
||||
*/
|
||||
List<ServiceDictInfo> findAllDictList(ServiceDictInfo serviceDictInfo);
|
||||
/**
|
||||
|
||||
@@ -72,10 +72,16 @@
|
||||
|
||||
|
||||
|
||||
<!-- 查询顶层分页列表 (==)-->
|
||||
<!-- 查询顶层分页列表-->
|
||||
<select id="findTopDictList" resultMap="dictResultMap" parameterType="com.nis.domain.basics.ServiceDictInfo">
|
||||
SELECT * FROM service_dict_info s WHERE s.is_valid=1
|
||||
|
||||
<if test="conditionType != null and conditionType.size()>0 " >
|
||||
AND s.item_type in
|
||||
<foreach collection="conditionType" item="singleType" index="index"
|
||||
open="(" close=")" separator=",">
|
||||
#{singleType}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="itemCode != null and itemCode != '' " >
|
||||
AND s.item_code like '%${itemCode}%'
|
||||
</if>
|
||||
@@ -91,7 +97,7 @@
|
||||
<if test="endDate !=null" >
|
||||
AND s.create_time <= #{endDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editBeginDate !=null" >
|
||||
<if test="editBeginDate !=null" >
|
||||
AND edit_time >= #{editBeginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editEndDate !=null" >
|
||||
@@ -99,6 +105,13 @@
|
||||
</if>
|
||||
AND s.parent_id not in (
|
||||
SELECT s2.service_dict_id FROM service_dict_info s2 WHERE s2.is_valid=1
|
||||
<if test="conditionType != null and conditionType.size()>0 " >
|
||||
AND s2.item_type in
|
||||
<foreach collection="conditionType" item="singleType" index="index"
|
||||
open="(" close=")" separator=",">
|
||||
#{singleType}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="itemCode != null and itemCode != '' " >
|
||||
AND s2.item_code like '%${itemCode}%'
|
||||
</if>
|
||||
@@ -130,72 +143,20 @@
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 查询顶层分页列表 (!=)-->
|
||||
<select id="findTopDictListN" resultMap="dictResultMap" parameterType="com.nis.domain.basics.ServiceDictInfo">
|
||||
SELECT * FROM service_dict_info s WHERE s.is_valid=1
|
||||
|
||||
<if test="itemCode != null and itemCode != '' " >
|
||||
AND s.item_code like '%${itemCode}%'
|
||||
</if>
|
||||
<if test="itemValue!= null and itemValue != '' " >
|
||||
AND s.item_value like '%${itemValue}%'
|
||||
</if>
|
||||
<if test="itemType != null and itemType != '' " >
|
||||
AND s.item_type != ${itemType}
|
||||
</if>
|
||||
<if test="beginDate !=null" >
|
||||
AND s.create_time >= #{beginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="endDate !=null" >
|
||||
AND s.create_time <= #{endDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editBeginDate !=null" >
|
||||
AND edit_time >= #{editBeginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editEndDate !=null" >
|
||||
AND edit_time <= #{editEndDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
AND s.parent_id not in (
|
||||
SELECT s2.service_dict_id FROM service_dict_info s2 WHERE s2.is_valid=1
|
||||
<if test="itemCode != null and itemCode != '' " >
|
||||
AND s2.item_code like '%${itemCode}%'
|
||||
</if>
|
||||
<if test="itemValue!= null and itemValue != '' " >
|
||||
AND s2.item_value like '%${itemValue}%'
|
||||
</if>
|
||||
<if test="itemType != null and itemType != '' " >
|
||||
AND s2.item_type != ${itemType}
|
||||
</if>
|
||||
<if test="beginDate !=null" >
|
||||
AND s2.create_time >= #{beginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="endDate !=null" >
|
||||
AND s2.create_time <= #{endDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editBeginDate !=null" >
|
||||
AND edit_time >= #{editBeginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editEndDate !=null" >
|
||||
AND edit_time <= #{editEndDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
)
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY s.${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY s.create_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 查询所有列表 (==)-->
|
||||
<!-- 查询所有符合条件列表-->
|
||||
<select id="findAllServiceDictInfo" resultMap="dictResultMap">
|
||||
SELECT * FROM service_dict_info WHERE is_valid=1
|
||||
|
||||
<if test="serviceDictInfo.conditionType != null and serviceDictInfo.conditionType.size()>0 " >
|
||||
AND item_type in
|
||||
<foreach collection="serviceDictInfo.conditionType" item="singleType" index="index"
|
||||
open="(" close=")" separator=",">
|
||||
#{singleType}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="serviceDictInfo.itemValue != null and serviceDictInfo.itemValue != '' " >
|
||||
AND item_value like '%${serviceDictInfo.itemValue}%'
|
||||
</if>
|
||||
@@ -227,42 +188,7 @@
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<!-- 查询所有列表 (!=)-->
|
||||
<select id="findAllServiceDictInfoN" resultMap="dictResultMap">
|
||||
SELECT * FROM service_dict_info WHERE is_valid=1
|
||||
|
||||
<if test="serviceDictInfo.itemValue != null and serviceDictInfo.itemValue != '' " >
|
||||
AND item_value like '%${serviceDictInfo.itemValue}%'
|
||||
</if>
|
||||
<if test="serviceDictInfo.itemCode != null and serviceDictInfo.itemCode != '' " >
|
||||
AND item_code like '%${serviceDictInfo.itemCode}%'
|
||||
</if>
|
||||
<if test="serviceDictInfo.itemType != null and serviceDictInfo.itemType != '' " >
|
||||
AND item_type != #{serviceDictInfo.itemType}
|
||||
</if>
|
||||
<if test="serviceDictInfo.beginDate !=null" >
|
||||
AND create_time >= #{serviceDictInfo.beginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="serviceDictInfo.endDate !=null" >
|
||||
AND create_time <= #{serviceDictInfo.endDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="serviceDictInfo.editBeginDate !=null" >
|
||||
AND edit_time >= #{serviceDictInfo.editBeginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="serviceDictInfo.editEndDate !=null" >
|
||||
AND edit_time <= #{serviceDictInfo.editEndDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY create_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<!-- 查出所有 -->
|
||||
<!-- 查出所有有效(父级(!=0))字典信息 -->
|
||||
<select id="findAllDictList" resultType="serviceDictInfo">
|
||||
SELECT
|
||||
<include refid="serviceDictInfoColumns"/>
|
||||
|
||||
@@ -14,30 +14,18 @@ public interface SysDictInfoDao extends CrudDao<SysDictInfo> {
|
||||
|
||||
|
||||
/**
|
||||
* 查询顶层字典列表(==))
|
||||
* 查询顶层字典列表
|
||||
* @param sysDictInfo
|
||||
* @return
|
||||
*/
|
||||
List<SysDictInfo> findTopDictList(SysDictInfo sysDictInfo);
|
||||
/**
|
||||
* 查询顶层字典列表(!=)
|
||||
* @param sysDictInfo
|
||||
* @return
|
||||
*/
|
||||
List<SysDictInfo> findTopDictListN(SysDictInfo sysDictInfo);
|
||||
/**
|
||||
* 查询所有字典列表(含条件查询(==))
|
||||
* 查询所有符合条件的字典列表
|
||||
* @param sysDictInfo
|
||||
* @return
|
||||
*/
|
||||
List<SysDictInfo> findAllSysDictInfo(@Param("sysDictInfo")SysDictInfo sysDictInfo,@Param("orderBy")String orderBy);
|
||||
/**
|
||||
* 查询所有字典列表(含条件查询(!=))
|
||||
* @param sysDictInfo
|
||||
* @return
|
||||
*/
|
||||
List<SysDictInfo> findAllSysDictInfoN(@Param("sysDictInfo")SysDictInfo sysDictInfo,@Param("orderBy")String orderBy);
|
||||
/**
|
||||
/**
|
||||
* 查出所有有效数据
|
||||
* @param sysDictInfo
|
||||
* @return
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
LEFT JOIN sys_dict_info p ON p.sys_dict_id = s.parent_id
|
||||
</sql>
|
||||
|
||||
<!-- 查出所有 -->
|
||||
<!-- 查出所有 有效数据-->
|
||||
<select id="findAllDictList" resultType="sysDictInfo">
|
||||
SELECT
|
||||
<include refid="sysDictInfoColumns"/>
|
||||
@@ -59,10 +59,16 @@
|
||||
WHERE s.is_valid =1
|
||||
</select>
|
||||
|
||||
<!-- 查询顶层分页(==) -->
|
||||
<!-- 查询顶层分页 -->
|
||||
<select id="findTopDictList" resultMap="dictResultMap" parameterType="com.nis.domain.basics.SysDictInfo">
|
||||
SELECT * FROM sys_dict_info s WHERE s.is_valid=1
|
||||
|
||||
<if test="conditionType != null and conditionType.size()>0 " >
|
||||
AND s.item_type in
|
||||
<foreach collection="conditionType" item="singleType" index="index"
|
||||
open="(" close=")" separator=",">
|
||||
#{singleType}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="itemCode != null and itemCode != '' " >
|
||||
AND s.item_code like '%${itemCode}%'
|
||||
</if>
|
||||
@@ -86,6 +92,13 @@
|
||||
</if>
|
||||
AND s.parent_id not in (
|
||||
SELECT s2.sys_dict_id FROM sys_dict_info s2 WHERE s2.is_valid=1
|
||||
<if test="conditionType != null and conditionType.size()>0 " >
|
||||
AND s2.item_type in
|
||||
<foreach collection="conditionType" item="singleType" index="index"
|
||||
open="(" close=")" separator=",">
|
||||
#{singleType}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="itemCode != null and itemCode != '' " >
|
||||
AND s2.item_code like '%${itemCode}%'
|
||||
</if>
|
||||
@@ -119,70 +132,20 @@
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 查询顶层分页(!=) -->
|
||||
<select id="findTopDictListN" resultMap="dictResultMap" parameterType="com.nis.domain.basics.SysDictInfo">
|
||||
SELECT * FROM sys_dict_info s WHERE s.is_valid=1
|
||||
|
||||
|
||||
<if test="itemCode != null and itemCode != '' " >
|
||||
AND s.item_code like '%${itemCode}%'
|
||||
</if>
|
||||
<if test="itemValue!= null and itemValue != '' " >
|
||||
AND s.item_value like '%${itemValue}%'
|
||||
</if>
|
||||
<if test="itemType != null and itemType != '' " >
|
||||
AND s.item_type != ${itemType}
|
||||
</if>
|
||||
<if test="beginDate !=null" >
|
||||
AND s.create_time >= #{beginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="endDate !=null" >
|
||||
AND s.create_time <= #{endDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editBeginDate !=null" >
|
||||
AND edit_time >= #{editBeginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editEndDate !=null" >
|
||||
AND edit_time <= #{editEndDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
AND s.parent_id not in (
|
||||
SELECT s2.sys_dict_id FROM sys_dict_info s2 WHERE s2.is_valid=1
|
||||
<if test="itemCode != null and itemCode != '' " >
|
||||
AND s2.item_code like '%${itemCode}%'
|
||||
</if>
|
||||
<if test="itemValue!= null and itemValue != '' " >
|
||||
AND s2.item_value like '%${itemValue}%'
|
||||
</if>
|
||||
<if test="itemType != null and itemType != '' " >
|
||||
AND s2.item_type != ${itemType}
|
||||
</if>
|
||||
<if test="beginDate !=null" >
|
||||
AND s2.create_time >= #{beginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="endDate !=null" >
|
||||
AND s2.create_time <= #{endDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editBeginDate !=null" >
|
||||
AND edit_time >= #{editBeginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editEndDate !=null" >
|
||||
AND edit_time <= #{editEndDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
)
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY s.${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY s.create_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 查询所有(==) -->
|
||||
<!-- 查询所有符合条件列表 -->
|
||||
<select id="findAllSysDictInfo" resultMap="dictResultMap">
|
||||
SELECT * FROM sys_dict_info WHERE is_valid=1
|
||||
|
||||
<if test="sysDictInfo.conditionType != null and sysDictInfo.conditionType.size()>0 " >
|
||||
AND item_type in
|
||||
<foreach collection="sysDictInfo.conditionType" item="singleType" index="index"
|
||||
open="(" close=")" separator=",">
|
||||
#{singleType}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="sysDictInfo.itemType != null and sysDictInfo.itemType != '' " >
|
||||
AND item_type = ${sysDictInfo.itemType}
|
||||
</if>
|
||||
@@ -213,41 +176,6 @@
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
<!-- 查询所有(!=) -->
|
||||
<select id="findAllSysDictInfoN" resultMap="dictResultMap">
|
||||
SELECT * FROM sys_dict_info WHERE is_valid=1
|
||||
|
||||
<if test="sysDictInfo.itemType != null and sysDictInfo.itemType != '' " >
|
||||
AND item_type = ${sysDictInfo.itemType}
|
||||
</if>
|
||||
<if test="sysDictInfo.itemCode != null and sysDictInfo.itemCode != '' " >
|
||||
AND item_code like '%${sysDictInfo.itemCode}%'
|
||||
</if>
|
||||
<if test="sysDictInfo.itemValue!= null and sysDictInfo.itemValue != '' " >
|
||||
AND item_value like '%${sysDictInfo.itemValue}%'
|
||||
</if>
|
||||
<if test="sysDictInfo.beginDate !=null" >
|
||||
AND create_time >= #{sysDictInfo.beginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="sysDictInfo.endDate !=null" >
|
||||
AND create_time <= #{sysDictInfo.endDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="sysDictInfo.editBeginDate !=null" >
|
||||
AND edit_time >= #{sysDictInfo.editBeginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="sysDictInfo.editEndDate !=null" >
|
||||
AND edit_time <= #{sysDictInfo.editEndDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY create_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<!-- 根据主键查询字典详细信息 -->
|
||||
|
||||
<select id="getDictById" resultType="com.nis.domain.basics.SysDictInfo">
|
||||
|
||||
@@ -12,6 +12,8 @@ import com.nis.domain.Page;
|
||||
import com.nis.domain.SysMenu;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.util.ConfigDictUtils;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.basics.ServiceDictInfoDao;
|
||||
@@ -30,89 +32,29 @@ public class ServiceDictInfoService extends BaseService{
|
||||
* @param serviceDictInfo
|
||||
* @return
|
||||
*/
|
||||
public Page<ServiceDictInfo> findTopDictList(Page<ServiceDictInfo> page, ServiceDictInfo serviceDictInfo,Integer[] itType) {
|
||||
public Page<ServiceDictInfo> findTopDictList(Page<ServiceDictInfo> page, ServiceDictInfo serviceDictInfo,List<Integer> itType) {
|
||||
// 设置分页参数
|
||||
serviceDictInfo.setPage(page);
|
||||
List<ServiceDictInfo> parentList = Lists.newArrayList();
|
||||
Integer tempType = 0;
|
||||
if(serviceDictInfo.getItemType()!=null){
|
||||
tempType = serviceDictInfo.getItemType();
|
||||
}
|
||||
//查出顶层分页查询
|
||||
if(itType.length==1){
|
||||
serviceDictInfo.setItemType(itType[0]);
|
||||
parentList = serviceDictInfoDao.findTopDictList(serviceDictInfo);
|
||||
}
|
||||
if(itType.length==2){
|
||||
if(tempType!=0){
|
||||
parentList = serviceDictInfoDao.findTopDictList(serviceDictInfo);
|
||||
}else{
|
||||
List<Integer> tempList = Lists.newArrayList();
|
||||
tempList.add(1);tempList.add(2);tempList.add(3);
|
||||
//Map<String,String> map = DictUtils.getDictOption("SERVICE_DICT_ITM_TYPE");
|
||||
if(tempList.contains(itType[0])){
|
||||
tempList.remove(itType[0]);
|
||||
}
|
||||
if(tempList.contains(itType[1])){
|
||||
tempList.remove(itType[1]);
|
||||
}
|
||||
serviceDictInfo.setItemType(tempList.get(0));
|
||||
parentList = serviceDictInfoDao.findTopDictListN(serviceDictInfo);
|
||||
}
|
||||
|
||||
}
|
||||
serviceDictInfo.setConditionType(itType);
|
||||
List<ServiceDictInfo> parentList = serviceDictInfoDao.findTopDictList(serviceDictInfo);
|
||||
ServiceDictInfo sd = new ServiceDictInfo();
|
||||
sd.setServiceDictId(0);
|
||||
for(ServiceDictInfo se:parentList){
|
||||
se.setParent(sd);
|
||||
}
|
||||
if(tempType!=0){
|
||||
serviceDictInfo.setItemType(tempType);
|
||||
}else{
|
||||
serviceDictInfo.setItemType(null);
|
||||
}
|
||||
page.setList(parentList);
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询所有数据
|
||||
* 根据条件查询所有数据
|
||||
* @param serviceDictInfo
|
||||
* @param itType
|
||||
* @return
|
||||
*/
|
||||
public List<ServiceDictInfo> findAllServiceDictInfo(ServiceDictInfo serviceDictInfo,Integer[] itType,String orderBy){
|
||||
List<ServiceDictInfo> list = Lists.newArrayList();
|
||||
Integer tempType = 0;
|
||||
if(serviceDictInfo.getItemType()!=null){
|
||||
tempType = serviceDictInfo.getItemType();
|
||||
}
|
||||
if(itType.length==1){
|
||||
serviceDictInfo.setItemType(itType[0]);
|
||||
list = serviceDictInfoDao.findAllServiceDictInfo(serviceDictInfo,orderBy);
|
||||
}
|
||||
if(itType.length==2){
|
||||
if(tempType!=0){
|
||||
list = serviceDictInfoDao.findAllServiceDictInfo(serviceDictInfo,orderBy);
|
||||
}else{
|
||||
List<Integer> tempIntegerList = Lists.newArrayList();
|
||||
tempIntegerList.add(1);tempIntegerList.add(2);tempIntegerList.add(3);
|
||||
//Map<String,String> map = DictUtils.getDictOption("SERVICE_DICT_ITM_TYPE");
|
||||
if(tempIntegerList.contains(itType[0])){
|
||||
tempIntegerList.remove(itType[0]);
|
||||
}
|
||||
if(tempIntegerList.contains(itType[1])){
|
||||
tempIntegerList.remove(itType[1]);
|
||||
}
|
||||
serviceDictInfo.setItemType(tempIntegerList.get(0));
|
||||
list = serviceDictInfoDao.findAllServiceDictInfoN(serviceDictInfo,orderBy);
|
||||
}
|
||||
}
|
||||
if(tempType!=0){
|
||||
serviceDictInfo.setItemType(tempType);
|
||||
}else{
|
||||
serviceDictInfo.setItemType(null);
|
||||
}
|
||||
return list;
|
||||
public List<ServiceDictInfo> findAllServiceDictInfo(ServiceDictInfo serviceDictInfo,List<Integer> itType,String orderBy){
|
||||
|
||||
serviceDictInfo.setConditionType(itType);;
|
||||
return serviceDictInfoDao.findAllServiceDictInfo(serviceDictInfo,orderBy);
|
||||
}
|
||||
|
||||
|
||||
@@ -136,14 +78,11 @@ public class ServiceDictInfoService extends BaseService{
|
||||
*/
|
||||
public List<ServiceDictInfo> findAllNoLeafDictList(String itType) {
|
||||
List<ServiceDictInfo> list = Lists.newArrayList();
|
||||
String[] strArr = itType.split("-");
|
||||
Integer[] intArr = new Integer[strArr.length];
|
||||
for(int i=0;i<strArr.length;i++){
|
||||
intArr[i] = Integer.valueOf(strArr[i]);
|
||||
List<ServiceDictInfo> tempList = serviceDictInfoDao.findAllNoLeafDictList(intArr[i]);
|
||||
for(ServiceDictInfo serviceDictInfo:tempList){
|
||||
list.add(serviceDictInfo);
|
||||
}
|
||||
List<Integer> intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SERVICE_DICT_ITM_TYPE", ""), itType);
|
||||
|
||||
for(Integer intType:intArr){
|
||||
List<ServiceDictInfo> tempList = serviceDictInfoDao.findAllNoLeafDictList(intType);
|
||||
list.addAll(tempList);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ import com.google.common.collect.Lists;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.basics.SysDictInfo;
|
||||
import com.nis.util.ConfigDictUtils;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.basics.SysDictInfoDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -25,99 +27,39 @@ public class SysDictInfoService extends BaseService{
|
||||
|
||||
|
||||
/**
|
||||
* 查询顶层分页(含条件查询,考虑排序接入可行性)
|
||||
* 查询顶层分页()
|
||||
* @param page
|
||||
* @param sysDictInfo
|
||||
* @param itType
|
||||
* @return
|
||||
*/
|
||||
public Page<SysDictInfo> findTopDictList(Page<SysDictInfo> page, SysDictInfo sysDictInfo, Integer[] itType) {
|
||||
public Page<SysDictInfo> findTopDictList(Page<SysDictInfo> page, SysDictInfo sysDictInfo, List<Integer> itType) {
|
||||
// 设置分页参数
|
||||
sysDictInfo.setPage(page);
|
||||
//根据条件查询符合数据
|
||||
List<SysDictInfo> allList = Lists.newArrayList();
|
||||
Integer tempType = 0;
|
||||
if(sysDictInfo.getItemType()!=null){
|
||||
tempType = sysDictInfo.getItemType();
|
||||
}
|
||||
if(itType.length==1){
|
||||
sysDictInfo.setItemType(itType[0]);
|
||||
allList = sysDictInfoDao.findTopDictList(sysDictInfo);
|
||||
}
|
||||
if(itType.length==2){
|
||||
if(tempType!=0){
|
||||
allList = sysDictInfoDao.findTopDictList(sysDictInfo);
|
||||
}else{
|
||||
List<Integer> tempIntegerList = Lists.newArrayList();
|
||||
tempIntegerList.add(1);tempIntegerList.add(2);tempIntegerList.add(3);
|
||||
if(tempIntegerList.contains(itType[0])){
|
||||
tempIntegerList.remove(itType[0]);
|
||||
}
|
||||
if(tempIntegerList.contains(itType[1])){
|
||||
tempIntegerList.remove(itType[1]);
|
||||
}
|
||||
sysDictInfo.setItemType(tempIntegerList.get(0));
|
||||
allList = sysDictInfoDao.findTopDictListN(sysDictInfo);
|
||||
}
|
||||
|
||||
}
|
||||
//allList = sysDictInfoDao.findDictTopSearchList(sysDictInfo);
|
||||
if(tempType!=0){
|
||||
sysDictInfo.setItemType(tempType);
|
||||
}else{
|
||||
sysDictInfo.setItemType(null);
|
||||
}
|
||||
SysDictInfo tempSe = new SysDictInfo();
|
||||
sysDictInfo.setConditionType(itType);
|
||||
List<SysDictInfo> allList = sysDictInfoDao.findTopDictList(sysDictInfo);
|
||||
SysDictInfo tempSe = new SysDictInfo();
|
||||
tempSe.setSysDictId(0);
|
||||
for(SysDictInfo se:allList){
|
||||
se.setParent(tempSe);
|
||||
}
|
||||
page.setList(allList);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有数据
|
||||
* 根据条件查询所有数据
|
||||
* @param page
|
||||
* @param sysDictInfo
|
||||
* @param intArr
|
||||
* @return
|
||||
*/
|
||||
public List<SysDictInfo> findAllSysDictInfo(SysDictInfo sysDictInfo, Integer[] itType,String orderBy) {
|
||||
public List<SysDictInfo> findAllSysDictInfo(SysDictInfo sysDictInfo, List<Integer> itType,String orderBy) {
|
||||
|
||||
List<SysDictInfo> list = Lists.newArrayList();
|
||||
Integer tempType = 0;
|
||||
if(sysDictInfo.getItemType()!=null){
|
||||
tempType = sysDictInfo.getItemType();
|
||||
}
|
||||
if(itType.length==1){
|
||||
sysDictInfo.setItemType(itType[0]);
|
||||
list = sysDictInfoDao.findAllSysDictInfo(sysDictInfo,orderBy);
|
||||
}
|
||||
if(itType.length==2){
|
||||
if(tempType!=0){
|
||||
list = sysDictInfoDao.findAllSysDictInfo(sysDictInfo,orderBy);
|
||||
}else{
|
||||
List<Integer> tempIntegerList = Lists.newArrayList();
|
||||
tempIntegerList.add(1);tempIntegerList.add(2);tempIntegerList.add(3);
|
||||
if(tempIntegerList.contains(itType[0])){
|
||||
tempIntegerList.remove(itType[0]);
|
||||
}
|
||||
if(tempIntegerList.contains(itType[1])){
|
||||
tempIntegerList.remove(itType[1]);
|
||||
}
|
||||
sysDictInfo.setItemType(tempIntegerList.get(0));
|
||||
list = sysDictInfoDao.findAllSysDictInfoN(sysDictInfo,orderBy);
|
||||
}
|
||||
}
|
||||
if(tempType!=0){
|
||||
sysDictInfo.setItemType(tempType);
|
||||
}else{
|
||||
sysDictInfo.setItemType(null);
|
||||
}
|
||||
return list;
|
||||
sysDictInfo.setConditionType(itType);
|
||||
return sysDictInfoDao.findAllSysDictInfo(sysDictInfo,orderBy);
|
||||
}
|
||||
|
||||
|
||||
@@ -244,14 +186,10 @@ public class SysDictInfoService extends BaseService{
|
||||
*/
|
||||
public List<SysDictInfo> findAllNoLeafDictList(String itType) {
|
||||
List<SysDictInfo> list = Lists.newArrayList();
|
||||
String[] strArr = itType.split("-");
|
||||
Integer[] intArr = new Integer[strArr.length];
|
||||
for(int i=0;i<strArr.length;i++){
|
||||
intArr[i] = Integer.valueOf(strArr[i]);
|
||||
List<SysDictInfo> tempList = sysDictInfoDao.findAllNoLeafDictList(intArr[i]);
|
||||
for(SysDictInfo sysDictInfo:tempList){
|
||||
list.add(sysDictInfo);
|
||||
}
|
||||
List<Integer> intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SYS_DICT_ITM_TYPE", ""), itType);
|
||||
for(Integer intType:intArr){
|
||||
List<SysDictInfo> tempList = sysDictInfoDao.findAllNoLeafDictList(intType);
|
||||
list.addAll(tempList);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user