yangyang.wang@dhc.com.cn
6 months ago
14 changed files with 589 additions and 253 deletions
@ -1,121 +0,0 @@
@@ -1,121 +0,0 @@
|
||||
package com.ruoyi.dhc.domain; |
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
import com.ruoyi.common.annotation.Excel; |
||||
import com.ruoyi.common.core.domain.BaseEntity; |
||||
|
||||
/** |
||||
* 数据权限对象 dhc_data_auth |
||||
* |
||||
* @author ruoyi |
||||
* @date 2024-07-30 |
||||
*/ |
||||
public class DhcDataAuth extends BaseEntity |
||||
{ |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** 数据权限ID */ |
||||
private Long dataAuthId; |
||||
|
||||
/** 部门ID */ |
||||
@Excel(name = "部门ID") |
||||
private Long deptId; |
||||
|
||||
/** 权限控制点 */ |
||||
@Excel(name = "权限控制点") |
||||
private String authNode; |
||||
|
||||
/** 产品线编码 */ |
||||
@Excel(name = "产品线编码") |
||||
private String productLineCode; |
||||
|
||||
/** 区域类型 */ |
||||
@Excel(name = "区域类型") |
||||
private String areaType; |
||||
|
||||
/** 区域编码 */ |
||||
@Excel(name = "区域编码") |
||||
private String areaCodes; |
||||
|
||||
/** 区域名称 */ |
||||
@Excel(name = "区域名称") |
||||
private String areaNames; |
||||
|
||||
public void setDataAuthId(Long dataAuthId) |
||||
{ |
||||
this.dataAuthId = dataAuthId; |
||||
} |
||||
|
||||
public Long getDataAuthId() |
||||
{ |
||||
return dataAuthId; |
||||
} |
||||
public void setDeptId(Long deptId) |
||||
{ |
||||
this.deptId = deptId; |
||||
} |
||||
|
||||
public Long getDeptId() |
||||
{ |
||||
return deptId; |
||||
} |
||||
public void setAuthNode(String authNode) |
||||
{ |
||||
this.authNode = authNode; |
||||
} |
||||
|
||||
public String getAuthNode() |
||||
{ |
||||
return authNode; |
||||
} |
||||
public void setProductLineCode(String productLineCode) |
||||
{ |
||||
this.productLineCode = productLineCode; |
||||
} |
||||
|
||||
public String getProductLineCode() |
||||
{ |
||||
return productLineCode; |
||||
} |
||||
public void setAreaType(String areaType) |
||||
{ |
||||
this.areaType = areaType; |
||||
} |
||||
|
||||
public String getAreaType() |
||||
{ |
||||
return areaType; |
||||
} |
||||
public void setAreaCodes(String areaCodes) |
||||
{ |
||||
this.areaCodes = areaCodes; |
||||
} |
||||
|
||||
public String getAreaCodes() |
||||
{ |
||||
return areaCodes; |
||||
} |
||||
public void setAreaNames(String areaNames) |
||||
{ |
||||
this.areaNames = areaNames; |
||||
} |
||||
|
||||
public String getAreaNames() |
||||
{ |
||||
return areaNames; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
||||
.append("dataAuthId", getDataAuthId()) |
||||
.append("deptId", getDeptId()) |
||||
.append("authNode", getAuthNode()) |
||||
.append("productLineCode", getProductLineCode()) |
||||
.append("areaType", getAreaType()) |
||||
.append("areaCodes", getAreaCodes()) |
||||
.append("areaNames", getAreaNames()) |
||||
.toString(); |
||||
} |
||||
} |
@ -1,93 +0,0 @@
@@ -1,93 +0,0 @@
|
||||
package com.ruoyi.dhc.service.impl; |
||||
|
||||
import java.util.List; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import com.ruoyi.dhc.mapper.DhcDataAuthMapper; |
||||
import com.ruoyi.dhc.domain.DhcDataAuth; |
||||
import com.ruoyi.dhc.service.IDhcDataAuthService; |
||||
|
||||
/** |
||||
* 数据权限Service业务层处理 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2024-07-30 |
||||
*/ |
||||
@Service |
||||
public class DhcDataAuthServiceImpl implements IDhcDataAuthService |
||||
{ |
||||
@Autowired |
||||
private DhcDataAuthMapper dhcDataAuthMapper; |
||||
|
||||
/** |
||||
* 查询数据权限 |
||||
* |
||||
* @param dataAuthId 数据权限主键 |
||||
* @return 数据权限 |
||||
*/ |
||||
@Override |
||||
public DhcDataAuth selectDhcDataAuthByDataAuthId(Long dataAuthId) |
||||
{ |
||||
return dhcDataAuthMapper.selectDhcDataAuthByDataAuthId(dataAuthId); |
||||
} |
||||
|
||||
/** |
||||
* 查询数据权限列表 |
||||
* |
||||
* @param dhcDataAuth 数据权限 |
||||
* @return 数据权限 |
||||
*/ |
||||
@Override |
||||
public List<DhcDataAuth> selectDhcDataAuthList(DhcDataAuth dhcDataAuth) |
||||
{ |
||||
return dhcDataAuthMapper.selectDhcDataAuthList(dhcDataAuth); |
||||
} |
||||
|
||||
/** |
||||
* 新增数据权限 |
||||
* |
||||
* @param dhcDataAuth 数据权限 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int insertDhcDataAuth(DhcDataAuth dhcDataAuth) |
||||
{ |
||||
return dhcDataAuthMapper.insertDhcDataAuth(dhcDataAuth); |
||||
} |
||||
|
||||
/** |
||||
* 修改数据权限 |
||||
* |
||||
* @param dhcDataAuth 数据权限 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int updateDhcDataAuth(DhcDataAuth dhcDataAuth) |
||||
{ |
||||
return dhcDataAuthMapper.updateDhcDataAuth(dhcDataAuth); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除数据权限 |
||||
* |
||||
* @param dataAuthIds 需要删除的数据权限主键 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deleteDhcDataAuthByDataAuthIds(Long[] dataAuthIds) |
||||
{ |
||||
return dhcDataAuthMapper.deleteDhcDataAuthByDataAuthIds(dataAuthIds); |
||||
} |
||||
|
||||
/** |
||||
* 删除数据权限信息 |
||||
* |
||||
* @param dataAuthId 数据权限主键 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deleteDhcDataAuthByDataAuthId(Long dataAuthId) |
||||
{ |
||||
return dhcDataAuthMapper.deleteDhcDataAuthByDataAuthId(dataAuthId); |
||||
} |
||||
} |
@ -0,0 +1,201 @@
@@ -0,0 +1,201 @@
|
||||
package com.ruoyi.dhc.domain; |
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
import com.ruoyi.common.annotation.Excel; |
||||
import com.ruoyi.common.core.domain.BaseEntity; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 数据权限对象 dhc_data_auth |
||||
* |
||||
* @author ruoyi |
||||
* @date 2024-08-01 |
||||
*/ |
||||
public class DhcDataAuth extends BaseEntity |
||||
{ |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** 数据权限ID */ |
||||
private Long dataAuthId; |
||||
/** 用户ID */ |
||||
private Long userId; |
||||
/** 部门ID */ |
||||
@Excel(name = "部门ID") |
||||
private Long deptId; |
||||
|
||||
/** 权限控制点 */ |
||||
@Excel(name = "部门树ID") |
||||
private String deptAllId; |
||||
|
||||
/** 权限控制点 */ |
||||
@Excel(name = "部门树名称") |
||||
private String deptAllName; |
||||
|
||||
/** 权限控制点 */ |
||||
@Excel(name = "权限控制点") |
||||
private String authNode; |
||||
|
||||
/** 产品线编码 */ |
||||
@Excel(name = "产品线编码") |
||||
private String productLineCode; |
||||
|
||||
/** 区域类型 */ |
||||
@Excel(name = "区域类型") |
||||
private String areaType; |
||||
|
||||
/** 类型(0区域 1.客户) */ |
||||
private String detailType; |
||||
|
||||
/** 数据权限明细 */ |
||||
|
||||
List<DhcDataAuthDetail> detailList; |
||||
|
||||
List<String> detailCodes; |
||||
|
||||
List<Long> deptIds; |
||||
|
||||
private String detailNames; |
||||
|
||||
private boolean editFlag; |
||||
|
||||
private List<Long> dataAuthIds; |
||||
|
||||
public List<Long> getDataAuthIds() { |
||||
return dataAuthIds; |
||||
} |
||||
|
||||
public void setDataAuthIds(List<Long> dataAuthIds) { |
||||
this.dataAuthIds = dataAuthIds; |
||||
} |
||||
|
||||
public boolean getEditFlag() { |
||||
return editFlag; |
||||
} |
||||
|
||||
public void setEditFlag(boolean editFlag) { |
||||
this.editFlag = editFlag; |
||||
} |
||||
|
||||
public List<Long> getDeptIds() { |
||||
return deptIds; |
||||
} |
||||
|
||||
public void setDeptIds(List<Long> deptIds) { |
||||
this.deptIds = deptIds; |
||||
} |
||||
|
||||
public String getDetailNames() { |
||||
return detailNames; |
||||
} |
||||
|
||||
public void setDetailNames(String detailNames) { |
||||
this.detailNames = detailNames; |
||||
} |
||||
|
||||
public String getDeptAllId() { |
||||
return deptAllId; |
||||
} |
||||
|
||||
public void setDeptAllId(String deptAllId) { |
||||
this.deptAllId = deptAllId; |
||||
} |
||||
|
||||
public String getDeptAllName() { |
||||
return deptAllName; |
||||
} |
||||
|
||||
public void setDeptAllName(String deptAllName) { |
||||
this.deptAllName = deptAllName; |
||||
} |
||||
|
||||
public List<String> getDetailCodes() { |
||||
return detailCodes; |
||||
} |
||||
|
||||
public void setDetailCodes(List<String> detailCodes) { |
||||
this.detailCodes = detailCodes; |
||||
} |
||||
|
||||
public Long getUserId() { |
||||
return userId; |
||||
} |
||||
|
||||
public void setUserId(Long userId) { |
||||
this.userId = userId; |
||||
} |
||||
|
||||
public String getDetailType() { |
||||
return detailType; |
||||
} |
||||
|
||||
public void setDetailType(String detailType) { |
||||
this.detailType = detailType; |
||||
} |
||||
|
||||
public List<DhcDataAuthDetail> getDetailList() { |
||||
return detailList; |
||||
} |
||||
|
||||
public void setDetailList(List<DhcDataAuthDetail> detailList) { |
||||
this.detailList = detailList; |
||||
} |
||||
|
||||
public void setDataAuthId(Long dataAuthId) |
||||
{ |
||||
this.dataAuthId = dataAuthId; |
||||
} |
||||
|
||||
public Long getDataAuthId() |
||||
{ |
||||
return dataAuthId; |
||||
} |
||||
public void setDeptId(Long deptId) |
||||
{ |
||||
this.deptId = deptId; |
||||
} |
||||
|
||||
public Long getDeptId() |
||||
{ |
||||
return deptId; |
||||
} |
||||
public void setAuthNode(String authNode) |
||||
{ |
||||
this.authNode = authNode; |
||||
} |
||||
|
||||
public String getAuthNode() |
||||
{ |
||||
return authNode; |
||||
} |
||||
public void setProductLineCode(String productLineCode) |
||||
{ |
||||
this.productLineCode = productLineCode; |
||||
} |
||||
|
||||
public String getProductLineCode() |
||||
{ |
||||
return productLineCode; |
||||
} |
||||
public void setAreaType(String areaType) |
||||
{ |
||||
this.areaType = areaType; |
||||
} |
||||
|
||||
public String getAreaType() |
||||
{ |
||||
return areaType; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
||||
.append("dataAuthId", getDataAuthId()) |
||||
.append("deptId", getDeptId()) |
||||
.append("authNode", getAuthNode()) |
||||
.append("productLineCode", getProductLineCode()) |
||||
.append("areaType", getAreaType()) |
||||
.toString(); |
||||
} |
||||
} |
@ -0,0 +1,77 @@
@@ -0,0 +1,77 @@
|
||||
package com.ruoyi.dhc.domain; |
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
import com.ruoyi.common.annotation.Excel; |
||||
import com.ruoyi.common.core.domain.BaseEntity; |
||||
|
||||
/** |
||||
* 数据权限明细对象 dhc_data_auth_detail |
||||
* |
||||
* @author ruoyi |
||||
* @date 2024-08-01 |
||||
*/ |
||||
public class DhcDataAuthDetail extends BaseEntity |
||||
{ |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** 数据权限ID */ |
||||
private Long dataAuthId; |
||||
|
||||
/** 类型(0区域 1.客户) */ |
||||
private String detailType; |
||||
|
||||
/** 权限明细编码 */ |
||||
private String detailCode; |
||||
|
||||
/** 权限明细名称 */ |
||||
@Excel(name = "权限明细名称") |
||||
private String detailName; |
||||
|
||||
public void setDataAuthId(Long dataAuthId) |
||||
{ |
||||
this.dataAuthId = dataAuthId; |
||||
} |
||||
|
||||
public Long getDataAuthId() |
||||
{ |
||||
return dataAuthId; |
||||
} |
||||
public void setDetailType(String detailType) |
||||
{ |
||||
this.detailType = detailType; |
||||
} |
||||
|
||||
public String getDetailType() |
||||
{ |
||||
return detailType; |
||||
} |
||||
public void setDetailCode(String detailCode) |
||||
{ |
||||
this.detailCode = detailCode; |
||||
} |
||||
|
||||
public String getDetailCode() |
||||
{ |
||||
return detailCode; |
||||
} |
||||
public void setDetailName(String detailName) |
||||
{ |
||||
this.detailName = detailName; |
||||
} |
||||
|
||||
public String getDetailName() |
||||
{ |
||||
return detailName; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
||||
.append("dataAuthId", getDataAuthId()) |
||||
.append("detailType", getDetailType()) |
||||
.append("detailCode", getDetailCode()) |
||||
.append("detailName", getDetailName()) |
||||
.toString(); |
||||
} |
||||
} |
@ -0,0 +1,129 @@
@@ -0,0 +1,129 @@
|
||||
package com.ruoyi.dhc.service.impl; |
||||
|
||||
import com.ruoyi.common.utils.StringUtils; |
||||
import com.ruoyi.dhc.domain.DhcDataAuth; |
||||
import com.ruoyi.dhc.domain.DhcDataAuthDetail; |
||||
import com.ruoyi.dhc.mapper.DhcDataAuthMapper; |
||||
import com.ruoyi.dhc.service.IDhcDataAuthService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* 数据权限Service业务层处理 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2024-08-01 |
||||
*/ |
||||
@Service |
||||
public class DhcDataAuthServiceImpl implements IDhcDataAuthService |
||||
{ |
||||
@Autowired |
||||
private DhcDataAuthMapper dhcDataAuthMapper; |
||||
|
||||
/** |
||||
* 查询数据权限 |
||||
* |
||||
* @param dataAuthId 数据权限主键 |
||||
* @return 数据权限 |
||||
*/ |
||||
@Override |
||||
public DhcDataAuth selectDhcDataAuthByDataAuthId(Long dataAuthId) |
||||
{ |
||||
return dhcDataAuthMapper.selectDhcDataAuthByDataAuthId(dataAuthId); |
||||
} |
||||
|
||||
/** |
||||
* 查询数据权限列表 |
||||
* |
||||
* @param dhcDataAuth 数据权限 |
||||
* @return 数据权限 |
||||
*/ |
||||
@Override |
||||
public List<DhcDataAuth> selectDhcDataAuthList(DhcDataAuth dhcDataAuth) |
||||
{ List<DhcDataAuth> list = dhcDataAuthMapper.selectDhcDataAuthList(dhcDataAuth); |
||||
list.forEach(item->{ |
||||
item.setDetailType("0"); |
||||
List<DhcDataAuthDetail> detailList = dhcDataAuthMapper.selectDhcDataAuthDetailList(item); |
||||
String[] array = item.getDeptAllId().split("/"); |
||||
List<Long> deptIds = new ArrayList<>(); |
||||
for (String deptId : array) { |
||||
deptIds.add(Long.valueOf(deptId)); |
||||
} |
||||
item.setDeptIds(deptIds); |
||||
item.setDetailList(detailList); |
||||
item.setEditFlag(false); |
||||
item.setDetailCodes(detailList.stream().map(model->{return model.getDetailCode();}).collect(Collectors.toList())); |
||||
item.setDetailNames(StringUtils.join(detailList.stream().map(model->{return model.getDetailName();}).collect(Collectors.toList()),"/")); |
||||
}); |
||||
return list; |
||||
} |
||||
|
||||
/** |
||||
* 新增数据权限 |
||||
* |
||||
* @param dhcDataAuth 数据权限 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int insertDhcDataAuth(DhcDataAuth dhcDataAuth) |
||||
{ |
||||
if (dhcDataAuth.getDataAuthId() != null) { |
||||
dhcDataAuthMapper.deleteDhcDataAuthByDataAuthId(dhcDataAuth.getDataAuthId()); |
||||
dhcDataAuthMapper.deleteDataAuthDetailByDataAuthIds(dhcDataAuth); |
||||
} |
||||
int count = dhcDataAuthMapper.insertDhcDataAuth(dhcDataAuth); |
||||
dhcDataAuth.getDetailList().forEach(item->{ |
||||
item.setDataAuthId(dhcDataAuth.getDataAuthId()); |
||||
}); |
||||
dhcDataAuthMapper.batchAddDataAuthDetail(dhcDataAuth.getDetailList()); |
||||
return count; |
||||
} |
||||
|
||||
/** |
||||
* 修改数据权限 |
||||
* |
||||
* @param dhcDataAuth 数据权限 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int updateDhcDataAuth(DhcDataAuth dhcDataAuth) |
||||
{ |
||||
dhcDataAuthMapper.deleteDataAuthDetailByDataAuthIds(dhcDataAuth); |
||||
dhcDataAuthMapper.batchAddDataAuthDetail(dhcDataAuth.getDetailList()); |
||||
return dhcDataAuthMapper.updateDhcDataAuth(dhcDataAuth); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除数据权限 |
||||
* |
||||
* @param dataAuthIds 需要删除的数据权限主键 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deleteDhcDataAuthByDataAuthIds(Long[] dataAuthIds) |
||||
{ DhcDataAuth dhcDataAuth = new DhcDataAuth(); |
||||
dhcDataAuth.setDataAuthIds(new ArrayList<>(Arrays.asList(dataAuthIds))); |
||||
dhcDataAuthMapper.deleteDataAuthDetailByDataAuthIds(dhcDataAuth); |
||||
return dhcDataAuthMapper.deleteDhcDataAuthByDataAuthIds(dataAuthIds); |
||||
} |
||||
|
||||
/** |
||||
* 删除数据权限信息 |
||||
* |
||||
* @param dataAuthId 数据权限主键 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deleteDhcDataAuthByDataAuthId(Long dataAuthId) |
||||
{ |
||||
DhcDataAuth dhcDataAuth = new DhcDataAuth(); |
||||
dhcDataAuth.setDataAuthId(dataAuthId); |
||||
dhcDataAuthMapper.deleteDataAuthDetailByDataAuthIds(dhcDataAuth); |
||||
return dhcDataAuthMapper.deleteDhcDataAuthByDataAuthId(dataAuthId); |
||||
} |
||||
} |
Loading…
Reference in new issue