fix: 后台模块查询过滤相同的行

This commit is contained in:
xiongxiaoyang 2023-04-14 21:33:31 +08:00
parent 687eb61846
commit a7d825cc54
2 changed files with 300 additions and 263 deletions
novel-admin/src/main/java/com/java2nb/system

@ -1,17 +1,12 @@
package com.java2nb.system.domain; package com.java2nb.system.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.java2nb.common.jsonserializer.LongToStringSerializer; import com.java2nb.common.jsonserializer.LongToStringSerializer;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
/** /**
@ -22,6 +17,7 @@ import java.util.Date;
* @date 2019-11-25 11:40:03 * @date 2019-11-25 11:40:03
*/ */
public class DataPermDO implements Serializable { public class DataPermDO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -57,118 +53,160 @@ public class DataPermDO implements Serializable {
public void setId(Long id) { public void setId(Long id) {
this.id = id; this.id = id;
} }
/** /**
* 获取 * 获取
*/ */
public Long getId() { public Long getId() {
return id; return id;
} }
/** /**
* 设置权限名称 * 设置权限名称
*/ */
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
/** /**
* 获取权限名称 * 获取权限名称
*/ */
public String getName() { public String getName() {
return name; return name;
} }
/** /**
* 设置数据表名称 * 设置数据表名称
*/ */
public void setTableName(String tableName) { public void setTableName(String tableName) {
this.tableName = tableName; this.tableName = tableName;
} }
/** /**
* 获取数据表名称 * 获取数据表名称
*/ */
public String getTableName() { public String getTableName() {
return tableName; return tableName;
} }
/** /**
* 设置所属模块 * 设置所属模块
*/ */
public void setModuleName(String moduleName) { public void setModuleName(String moduleName) {
this.moduleName = moduleName; this.moduleName = moduleName;
} }
/** /**
* 获取所属模块 * 获取所属模块
*/ */
public String getModuleName() { public String getModuleName() {
return moduleName; return moduleName;
} }
/** /**
* 设置用户权限控制属性名 * 设置用户权限控制属性名
*/ */
public void setCrlAttrName(String crlAttrName) { public void setCrlAttrName(String crlAttrName) {
this.crlAttrName = crlAttrName; this.crlAttrName = crlAttrName;
} }
/** /**
* 获取用户权限控制属性名 * 获取用户权限控制属性名
*/ */
public String getCrlAttrName() { public String getCrlAttrName() {
return crlAttrName; return crlAttrName;
} }
/** /**
* 设置数据表权限控制列名 * 设置数据表权限控制列名
*/ */
public void setCrlColumnName(String crlColumnName) { public void setCrlColumnName(String crlColumnName) {
this.crlColumnName = crlColumnName; this.crlColumnName = crlColumnName;
} }
/** /**
* 获取数据表权限控制列名 * 获取数据表权限控制列名
*/ */
public String getCrlColumnName() { public String getCrlColumnName() {
return crlColumnName; return crlColumnName;
} }
/** /**
* 设置权限codeall_开头表示查看所有数据的权限sup_开头表示查看下级数据的权限own_开头表示查看本级数据的权限 * 设置权限codeall_开头表示查看所有数据的权限sup_开头表示查看下级数据的权限own_开头表示查看本级数据的权限
*/ */
public void setPermCode(String permCode) { public void setPermCode(String permCode) {
this.permCode = permCode; this.permCode = permCode;
} }
/** /**
* 获取权限codeall_开头表示查看所有数据的权限sup_开头表示查看下级数据的权限own_开头表示查看本级数据的权限 * 获取权限codeall_开头表示查看所有数据的权限sup_开头表示查看下级数据的权限own_开头表示查看本级数据的权限
*/ */
public String getPermCode() { public String getPermCode() {
return permCode; return permCode;
} }
/** /**
* 设置排序 * 设置排序
*/ */
public void setOrderNum(Integer orderNum) { public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum; this.orderNum = orderNum;
} }
/** /**
* 获取排序 * 获取排序
*/ */
public Integer getOrderNum() { public Integer getOrderNum() {
return orderNum; return orderNum;
} }
/** /**
* 设置创建时间 * 设置创建时间
*/ */
public void setGmtCreate(Date gmtCreate) { public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate; this.gmtCreate = gmtCreate;
} }
/** /**
* 获取创建时间 * 获取创建时间
*/ */
public Date getGmtCreate() { public Date getGmtCreate() {
return gmtCreate; return gmtCreate;
} }
/** /**
* 设置修改时间 * 设置修改时间
*/ */
public void setGmtModified(Date gmtModified) { public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified; this.gmtModified = gmtModified;
} }
/** /**
* 获取修改时间 * 获取修改时间
*/ */
public Date getGmtModified() { public Date getGmtModified() {
return gmtModified; return gmtModified;
} }
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DataPermDO that = (DataPermDO) o;
return Objects.equals(id, that.id) && Objects.equals(name, that.name)
&& Objects.equals(tableName, that.tableName) && Objects.equals(moduleName, that.moduleName)
&& Objects.equals(crlAttrName, that.crlAttrName) && Objects.equals(crlColumnName,
that.crlColumnName) && Objects.equals(permCode, that.permCode) && Objects.equals(orderNum,
that.orderNum) && Objects.equals(gmtCreate, that.gmtCreate) && Objects.equals(gmtModified,
that.gmtModified);
}
@Override
public int hashCode() {
return Objects.hash(id, name, tableName, moduleName, crlAttrName, crlColumnName, permCode, orderNum, gmtCreate,
gmtModified);
}
} }

@ -1,10 +1,12 @@
package com.java2nb.system.service.impl; package com.java2nb.system.service.impl;
import com.java2nb.common.domain.DictDO;
import com.java2nb.common.domain.Tree; import com.java2nb.common.domain.Tree;
import com.java2nb.common.utils.BuildTree; import com.java2nb.common.utils.BuildTree;
import com.java2nb.common.utils.IdWorker; import com.java2nb.common.utils.IdWorker;
import com.java2nb.system.dao.DataPermDao;
import com.java2nb.system.dao.RoleDataPermDao; import com.java2nb.system.dao.RoleDataPermDao;
import com.java2nb.system.domain.DataPermDO;
import com.java2nb.system.service.DataPermService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -12,15 +14,12 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import com.java2nb.system.dao.DataPermDao;
import com.java2nb.system.domain.DataPermDO;
import com.java2nb.system.service.DataPermService;
@Service @Service
public class DataPermServiceImpl implements DataPermService { public class DataPermServiceImpl implements DataPermService {
@Autowired @Autowired
private DataPermDao dataPermDao; private DataPermDao dataPermDao;
@ -64,7 +63,7 @@ public class DataPermServiceImpl implements DataPermService {
@Override @Override
public List<DataPermDO> listModuleName() { public List<DataPermDO> listModuleName() {
return dataPermDao.listModuleName(); return dataPermDao.listModuleName().stream().distinct().collect(Collectors.toList());
} }
@Override @Override