搜索条件,开始时间结束时间控件精确到日期;

列表中去掉“层级”一列;
列表中显示序号一列
数据列表上下级节点的数据类型校验
分类性质菜单拆分,分为分类管理、性质管理两个菜单
地域、运营商、特征作用域三种数据拆分为三个功能菜单管理地域管理、运营商管理、特征作用域管理。
This commit is contained in:
zhangshilin
2018-03-10 18:54:05 +08:00
parent fd6425772c
commit bdea050447
20 changed files with 1521 additions and 395 deletions

View File

@@ -36,6 +36,14 @@ public class ServiceDictInfo extends BaseEntity<ServiceDictInfo>{
private Date beginDate; // 开始日期
private Date endDate; // 结束日期
private Date editBeginDate; // 修改开始日期
private Date editEndDate; // 修改结束日期
/**
* 筛选搜索框展开状态
*/
private boolean isFilterActio = false;
public Integer getServiceDictId() {
return serviceDictId;
}
@@ -134,6 +142,24 @@ public class ServiceDictInfo extends BaseEntity<ServiceDictInfo>{
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Date getEditBeginDate() {
return editBeginDate;
}
public void setEditBeginDate(Date editBeginDate) {
this.editBeginDate = editBeginDate;
}
public Date getEditEndDate() {
return editEndDate;
}
public void setEditEndDate(Date editEndDate) {
this.editEndDate = editEndDate;
}
public boolean isFilterActio() {
return isFilterActio;
}
public void setFilterActio(boolean isFilterActio) {
this.isFilterActio = isFilterActio;
}
@JsonIgnore
public static void sortList(List<ServiceDictInfo> list, List<ServiceDictInfo> sourcelist, Integer parentId, boolean cascade){
for (int i=0; i<sourcelist.size(); i++){

View File

@@ -34,6 +34,14 @@ public class SysDictInfo extends BaseEntity<SysDictInfo>{
private Date beginDate; // 开始日期
private Date endDate; // 结束日期
private Date editBeginDate; // 修改开始日期
private Date editEndDate; // 修改结束日期
/**
* 筛选搜索框展开状态
*/
private boolean isFilterActio = false;
public Integer getSysDictId() {
return sysDictId;
@@ -131,6 +139,24 @@ public class SysDictInfo extends BaseEntity<SysDictInfo>{
public void setLevelNo(Integer levelNo) {
this.levelNo = levelNo;
}
public Date getEditBeginDate() {
return editBeginDate;
}
public void setEditBeginDate(Date editBeginDate) {
this.editBeginDate = editBeginDate;
}
public Date getEditEndDate() {
return editEndDate;
}
public void setEditEndDate(Date editEndDate) {
this.editEndDate = editEndDate;
}
public boolean isFilterActio() {
return isFilterActio;
}
public void setFilterActio(boolean isFilterActio) {
this.isFilterActio = isFilterActio;
}
@JsonIgnore
public static void sortList(List<SysDictInfo> list, List<SysDictInfo> sourcelist, Integer parentId, boolean cascade){
for (int i=0; i<sourcelist.size(); i++){

View File

@@ -47,5 +47,43 @@ public class ConfigDictUtils {
public static SysDictInfo getSysDictInfoById(Integer sysDictId){
return sysDictInfoDao.getDictById(sysDictId);
}
/**
* 根据计算公式计算数据结果
* @param sysDictId
* @return
*/
public static Integer getNumberResult(Integer number1, Integer number2, Integer number3){
return number1+(number2-1)*number3;
}
/**
* 根据数据类型编码取出数据类型
* @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("分类")){
result = "分类";
}
if(value.trim().equals("性质")){
result = "性质";
}
if(value.trim().equals("标签")){
result = "标签";
}
if(value.trim().equals("地域")){
result = "地域";
}
if(value.trim().equals("运营商")){
result = "运营商";
}
if(value.trim().equals("特征作用域")){
result = "特征作用域";
}
return result;
}
}

View File

@@ -8,6 +8,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.zookeeper.ZooDefs.Ids;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
@@ -118,7 +119,9 @@ public class ServiceDictInfoController extends BaseController {
if(StringUtils.strIsBlank(serviceDictInfo.getItemValue())
&&StringUtils.strIsBlank(serviceDictInfo.getItemCode())
&&serviceDictInfo.getBeginDate()==null
&&serviceDictInfo.getEndDate()==null){
&&serviceDictInfo.getEndDate()==null
&&serviceDictInfo.getEditBeginDate()==null
&&serviceDictInfo.getEditEndDate()==null){
if(serviceDictInfo.getItemType()!=null){
selectedType = serviceDictInfo.getItemType();
return "redirect:"+ adminPath + "/basics/serviceDictInfo/list?itType="+itType+"&selectedType="+selectedType;
@@ -136,6 +139,19 @@ public class ServiceDictInfoController extends BaseController {
model.addAttribute("selectedType", selectedType);
serviceDictInfo.setItemType(selectedType);
}
String searchType = null;
String searchContent = null;
if(!StringUtils.isBlank(serviceDictInfo.getItemCode())){
searchType = "itemCode";
searchContent = serviceDictInfo.getItemCode();
}
if(!StringUtils.isBlank(serviceDictInfo.getItemValue())){
searchType = "itemValue";
searchContent = serviceDictInfo.getItemValue();
}
model.addAttribute("searchType", searchType);
model.addAttribute("searchContent", searchContent);
//先查出条件查询所有数据(注意顺序)
List<ServiceDictInfo> allList = serviceDictInfoService.findAllDictSearchList(serviceDictInfo,intArr);
@@ -180,10 +196,18 @@ public class ServiceDictInfoController extends BaseController {
* @return
*/
@RequestMapping(value={"form"})
public String form(ServiceDictInfo serviceDictInfo, Model model,String doAction,String itType) {
public String form(ServiceDictInfo serviceDictInfo, Model model,String doAction,String itType, String mulitId) {
if(doAction!=null&&doAction.equals("0")){
return "/basics/serviceDictInfo";
}
Integer id=0;
if(mulitId!=null){
String[] ids = mulitId.split(",");
id = Integer.valueOf(ids[0]);
}
if(id!=0){
serviceDictInfo = serviceDictInfoService.getDictById(id);
}
if (serviceDictInfo.getParent() == null || serviceDictInfo.getParent().getServiceDictId() == null||serviceDictInfo.getParent().getServiceDictId() == 0) {
ServiceDictInfo parent = new ServiceDictInfo();
parent.setServiceDictId(0);
@@ -232,9 +256,9 @@ public class ServiceDictInfoController extends BaseController {
* @return
*/
@RequestMapping(value={"delete"})
public String delete(ServiceDictInfo serviceDictInfo, RedirectAttributes redirectAttributes,String itType) {
public String delete(ServiceDictInfo serviceDictInfo, RedirectAttributes redirectAttributes, String itType, String mulitId) {
try {
serviceDictInfoService.deleteDict(serviceDictInfo);
serviceDictInfoService.deleteDict(mulitId);
addMessage(redirectAttributes, "删除成功");
} catch (Exception e) {
e.printStackTrace();

View File

@@ -116,7 +116,9 @@ public class SysDictInfoController extends BaseController {
if(StringUtils.strIsBlank(sysDictInfo.getItemValue())
&&StringUtils.strIsBlank(sysDictInfo.getItemCode())
&&sysDictInfo.getBeginDate()==null
&&sysDictInfo.getEndDate()==null){
&&sysDictInfo.getEndDate()==null
&&sysDictInfo.getEditBeginDate()==null
&&sysDictInfo.getEditEndDate()==null){
if(sysDictInfo.getItemType()!=null){
selectedType = sysDictInfo.getItemType();
return "redirect:"+ adminPath + "/basics/sysDictInfo/list?itType="+itType+"&selectedType="+selectedType;
@@ -134,6 +136,18 @@ public class SysDictInfoController extends BaseController {
model.addAttribute("selectedType", selectedType);
sysDictInfo.setItemType(selectedType);
}
String searchType = null;
String searchContent = null;
if(!StringUtils.isBlank(sysDictInfo.getItemCode())){
searchType = "itemCode";
searchContent = sysDictInfo.getItemCode();
}
if(!StringUtils.isBlank(sysDictInfo.getItemValue())){
searchType = "itemValue";
searchContent = sysDictInfo.getItemValue();
}
model.addAttribute("searchType", searchType);
model.addAttribute("searchContent", searchContent);
//先查出条件查询所有数据(注意顺序)
List<SysDictInfo> allList = sysDictInfoService.findAllDictSearchList(sysDictInfo,intArr);
@@ -198,10 +212,18 @@ public class SysDictInfoController extends BaseController {
* @return
*/
@RequestMapping(value={"form"})
public String form(SysDictInfo sysDictInfo, Model model, String doAction, String itType) {
public String form(SysDictInfo sysDictInfo, Model model, String doAction, String itType, String mulitId) {
if(doAction!=null&&doAction.equals("0")){
return "/basics/sysDictInfo";
}
Integer id=0;
if(mulitId!=null){
String[] ids = mulitId.split(",");
id = Integer.valueOf(ids[0]);
}
if(id!=0){
sysDictInfo = sysDictInfoService.getDictById(id);
}
if (sysDictInfo.getParent() == null || sysDictInfo.getParent().getSysDictId() == null||sysDictInfo.getParent().getSysDictId() == 0) {
SysDictInfo parent = new SysDictInfo();
parent.setSysDictId(0);
@@ -247,9 +269,9 @@ public class SysDictInfoController extends BaseController {
* @return
*/
@RequestMapping(value={"delete"})
public String delete(SysDictInfo sysDictInfo, RedirectAttributes redirectAttributes, String itType) {
public String delete(SysDictInfo sysDictInfo, RedirectAttributes redirectAttributes, String itType, String mulitId) {
try {
sysDictInfoService.deleteDict(sysDictInfo);
sysDictInfoService.deleteDict(mulitId);
addMessage(redirectAttributes, "删除成功");
} catch (Exception e) {
e.printStackTrace();
@@ -413,7 +435,7 @@ public class SysDictInfoController extends BaseController {
*/
@ResponseBody
@RequestMapping(value = "ajaxLeafHasTree")
public boolean ajaxLeafHasTree(Integer serviceDictId,Integer newIsLeaf,Integer parentId) {
public boolean ajaxLeafHasTree(Integer sysDictId,Integer newIsLeaf,Integer parentId) {
if(parentId==null||parentId==0||parentId==-1){
if(newIsLeaf==0){

View File

@@ -86,6 +86,12 @@
<if test="endDate !=null" >
AND create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{editEndDate,jdbcType=TIMESTAMP}
</if>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
@@ -117,7 +123,12 @@
<if test="endDate !=null" >
AND create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{editEndDate,jdbcType=TIMESTAMP}
</if>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
@@ -169,6 +180,12 @@
</if>
<if test="endDate !=null" >
AND s.create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{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
@@ -187,6 +204,12 @@
<if test="endDate !=null" >
AND s2.create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{editEndDate,jdbcType=TIMESTAMP}
</if>
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
@@ -217,6 +240,12 @@
</if>
<if test="endDate !=null" >
AND s.create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{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
@@ -235,6 +264,12 @@
<if test="endDate !=null" >
AND s2.create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{editEndDate,jdbcType=TIMESTAMP}
</if>
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
@@ -268,6 +303,12 @@
<if test="endDate !=null" >
AND create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{editEndDate,jdbcType=TIMESTAMP}
</if>
</select>
<!-- 条件查询所有列表 (!=)-->
@@ -288,6 +329,12 @@
</if>
<if test="endDate !=null" >
AND create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{editEndDate,jdbcType=TIMESTAMP}
</if>
</select>

View File

@@ -17,6 +17,12 @@ public interface SysDictInfoDao extends CrudDao<SysDictInfo> {
* @return
*/
List<SysDictInfo> findTopDictList(SysDictInfo sysDictInfo);
/**
* 查询顶层字典列表(无条件查询(!=)
* @param sysDictInfo
* @return
*/
List<SysDictInfo> findTopDictListN(SysDictInfo sysDictInfo);
/**
* 查出所有有效数据
@@ -30,15 +36,24 @@ public interface SysDictInfoDao extends CrudDao<SysDictInfo> {
* @return
*/
List<SysDictInfo> findDictTopSearchList(SysDictInfo sysDictInfo);
/**
* 查询条件查询顶层字典列表(含条件查询(!=)
* @param sysDictInfo
* @return
*/
List<SysDictInfo> findDictTopSearchListN(SysDictInfo sysDictInfo);
/**
* 查询字典列表(含条件查询(==)
* @param sysDictInfo
* @return
*/
List<SysDictInfo> findAllDictSearchList(SysDictInfo sysDictInfo);
/**
* 查询字典列表(含条件查询(!=)
* @param sysDictInfo
* @return
*/
List<SysDictInfo> findAllDictSearchListN(SysDictInfo sysDictInfo);
/**
* 添加字典信息
* @param sysDictInfo
@@ -91,6 +106,8 @@ public interface SysDictInfoDao extends CrudDao<SysDictInfo> {

View File

@@ -69,6 +69,12 @@
<if test="endDate !=null" >
AND create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{editEndDate,jdbcType=TIMESTAMP}
</if>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
@@ -79,6 +85,42 @@
</otherwise>
</choose>
</select>
<!-- 查询顶层分页列表 (!=)-->
<select id="findTopDictListN" resultMap="dictResultMap" parameterType="com.nis.domain.basics.SysDictInfo">
SELECT * FROM sys_dict_info WHERE is_valid=1 AND parent_id = 0
<if test="itemValue != null and itemValue != '' " >
AND item_value like '%${itemValue}%'
</if>
<if test="itemCode != null and itemCode != '' " >
AND item_code like '%${itemCode}%'
</if>
<if test="itemType != null and itemType != '' " >
AND item_type != #{itemType}
</if>
<if test="beginDate !=null" >
AND create_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate !=null" >
AND create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{editEndDate,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>
<!-- 查出所有 -->
@@ -109,6 +151,12 @@
<if test="endDate !=null" >
AND s.create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{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 != '' " >
@@ -126,6 +174,72 @@
<if test="endDate !=null" >
AND s2.create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{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="findDictTopSearchListN" 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 &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate !=null" >
AND s.create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{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 &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate !=null" >
AND s2.create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{editEndDate,jdbcType=TIMESTAMP}
</if>
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
@@ -157,6 +271,38 @@
<if test="endDate !=null" >
AND create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{editEndDate,jdbcType=TIMESTAMP}
</if>
</select>
<!-- 条件查询所有(!=) -->
<select id="findAllDictSearchListN" resultMap="dictResultMap" parameterType="com.nis.domain.basics.SysDictInfo">
SELECT * FROM sys_dict_info WHERE is_valid=1
<if test="itemType != null and itemType != '' " >
AND item_type = ${itemType}
</if>
<if test="itemCode != null and itemCode != '' " >
AND item_code like '%${itemCode}%'
</if>
<if test="itemValue!= null and itemValue != '' " >
AND item_value like '%${itemValue}%'
</if>
<if test="beginDate !=null" >
AND create_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate !=null" >
AND create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="editBeginDate !=null" >
AND edit_time &gt;= #{editBeginDate,jdbcType=TIMESTAMP}
</if>
<if test="editEndDate !=null" >
AND edit_time &lt;= #{editEndDate,jdbcType=TIMESTAMP}
</if>
</select>
<!-- 根据主键查询字典详细信息 -->

View File

@@ -354,17 +354,29 @@ public class ServiceDictInfoService extends BaseService{
* @param serviceDictInfo
*/
@Transactional(readOnly = false)
public void deleteDict(ServiceDictInfo serviceDictInfo) {
List<ServiceDictInfo> list = Lists.newArrayList();
//找出所有下级
//查出所有节点
ServiceDictInfo.sortList(list, serviceDictInfoDao.findAllDictList(new ServiceDictInfo()), serviceDictInfo.getServiceDictId(), true);
list.add(serviceDictInfo);
for(ServiceDictInfo se:list){
se.setIsValid(0);
serviceDictInfoDao.delete(se);
public void deleteDict(String mulitId) {
String[] ids = mulitId.split(",");
for(String id:ids){
if (!id.equals("")) {
ServiceDictInfo serviceDictInfo = serviceDictInfoDao.getDictById(Integer.valueOf(id));
List<ServiceDictInfo> list = Lists.newArrayList();
//找出所有下级
//查出所有节点
if(serviceDictInfo!=null){
ServiceDictInfo.sortList(list, serviceDictInfoDao.findAllDictList(new ServiceDictInfo()), serviceDictInfo.getServiceDictId(), true);
list.add(serviceDictInfo);
for(ServiceDictInfo se:list){
se.setIsValid(0);
serviceDictInfoDao.delete(se);
}
}
}
}
}
/**

View File

@@ -5,6 +5,7 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.google.common.collect.Lists;
import com.nis.domain.Page;
@@ -28,10 +29,10 @@ public class SysDictInfoService extends BaseService{
* 查询顶层分页(无条件查询)
* @param page
* @param sysDictInfo
* @param intArr
* @param itType
* @return
*/
public Page<SysDictInfo> findTopDictList(Page<SysDictInfo> page, SysDictInfo sysDictInfo, Integer[] intArr) {
public Page<SysDictInfo> findTopDictList(Page<SysDictInfo> page, SysDictInfo sysDictInfo, Integer[] itType) {
// 设置分页参数
sysDictInfo.setPage(page);
List<SysDictInfo> parentList = Lists.newArrayList();
@@ -41,8 +42,28 @@ public class SysDictInfoService extends BaseService{
tempType = sysDictInfo.getItemType();
}
//查出顶层分页查询
parentList = sysDictInfoDao.findTopDictList(sysDictInfo);
if(itType.length==1){
sysDictInfo.setItemType(itType[0]);
parentList = sysDictInfoDao.findTopDictList(sysDictInfo);
}
if(itType.length==2){
if(tempType!=0){
parentList = sysDictInfoDao.findTopDictList(sysDictInfo);
}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]);
}
sysDictInfo.setItemType(tempList.get(0));
parentList = sysDictInfoDao.findTopDictListN(sysDictInfo);
}
}
page.setList(parentList);
return page;
}
@@ -63,8 +84,36 @@ public class SysDictInfoService extends BaseService{
public List<SysDictInfo> findAllDictSearchList(SysDictInfo sysDictInfo, Integer[] itType) {
List<SysDictInfo> list = Lists.newArrayList();
list = sysDictInfoDao.findAllDictSearchList(sysDictInfo);
Integer tempType = 0;
if(sysDictInfo.getItemType()!=null){
tempType = sysDictInfo.getItemType();
}
if(itType.length==1){
sysDictInfo.setItemType(itType[0]);
list = sysDictInfoDao.findAllDictSearchList(sysDictInfo);
}
if(itType.length==2){
if(tempType!=0){
list = sysDictInfoDao.findAllDictSearchList(sysDictInfo);
}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]);
}
sysDictInfo.setItemType(tempIntegerList.get(0));
list = sysDictInfoDao.findAllDictSearchListN(sysDictInfo);
}
}
if(tempType!=0){
sysDictInfo.setItemType(tempType);
}else{
sysDictInfo.setItemType(null);
}
return list;
}
/**
@@ -81,6 +130,31 @@ public class SysDictInfoService extends BaseService{
List<SysDictInfo> allList = Lists.newArrayList();
List<SysDictInfo> list = Lists.newArrayList();
Integer tempType = 0;
if(sysDictInfo.getItemType()!=null){
tempType = sysDictInfo.getItemType();
}
if(itType.length==1){
sysDictInfo.setItemType(itType[0]);
allList = sysDictInfoDao.findDictTopSearchList(sysDictInfo);
}
if(itType.length==2){
if(tempType!=0){
allList = sysDictInfoDao.findDictTopSearchList(sysDictInfo);
}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]);
}
sysDictInfo.setItemType(tempIntegerList.get(0));
allList = sysDictInfoDao.findDictTopSearchListN(sysDictInfo);
}
}
allList = sysDictInfoDao.findDictTopSearchList(sysDictInfo);
SysDictInfo tempSe = new SysDictInfo();
tempSe.setSysDictId(0);
@@ -176,15 +250,26 @@ public class SysDictInfoService extends BaseService{
* 删除
* @param sysDictInfo
*/
public void deleteDict(SysDictInfo sysDictInfo) {
List<SysDictInfo> list = Lists.newArrayList();
SysDictInfo.sortList(list, sysDictInfoDao.findAllDictList(new SysDictInfo()), sysDictInfo.getSysDictId(), true);
list.add(sysDictInfo);
for(SysDictInfo se:list){
se.setIsValid(0);
sysDictInfoDao.delete(sysDictInfo);
@Transactional(readOnly = false)
public void deleteDict(String mulitId) {
String[] ids = mulitId.split(",");
for(String id:ids){
if (!id.equals("")) {
List<SysDictInfo> list = Lists.newArrayList();
SysDictInfo sysDictInfo = sysDictInfoDao.getDictById(Integer.valueOf(id));
if(sysDictInfo!=null){
SysDictInfo.sortList(list, sysDictInfoDao.findAllDictList(new SysDictInfo()), sysDictInfo.getSysDictId(), true);
list.add(sysDictInfo);
for(SysDictInfo se:list){
se.setIsValid(0);
sysDictInfoDao.delete(se);
}
}
}
}
}
/**
* 查询该类型所有的非叶子配置