rolecanteentype0318
This commit is contained in:
parent
02b87a316e
commit
a466bd2092
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.bonus.system.api.domain;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@ApiModel("区域食堂档口权限")
|
||||||
|
@Data
|
||||||
|
public class RoleCanteenVo {
|
||||||
|
@ApiModelProperty("角色ID")
|
||||||
|
private Long roleId;
|
||||||
|
@ApiModelProperty("区域、食堂、档口ID")
|
||||||
|
private String dataId;
|
||||||
|
@ApiModelProperty("类型:0:区域,1:食堂,2:档口或餐线")
|
||||||
|
private Integer type;
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.system.api.domain;
|
package com.bonus.system.api.domain;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
@ -80,7 +81,7 @@ public class SysRole extends BaseEntity
|
||||||
|
|
||||||
private String[] areaIds;
|
private String[] areaIds;
|
||||||
|
|
||||||
private String[] dataIds;
|
private List<RoleCanteenVo> roleCanteenList;
|
||||||
|
|
||||||
/** 角色菜单权限 */
|
/** 角色菜单权限 */
|
||||||
private Set<String> permissions;
|
private Set<String> permissions;
|
||||||
|
|
@ -265,12 +266,12 @@ public class SysRole extends BaseEntity
|
||||||
this.areaIds = areaIds;
|
this.areaIds = areaIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getDataIds() {
|
public List<RoleCanteenVo> getRoleCanteenList() {
|
||||||
return dataIds;
|
return roleCanteenList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataIds(String[] dataIds) {
|
public void setRoleCanteenList(List<RoleCanteenVo> roleCanteenList) {
|
||||||
this.dataIds = dataIds;
|
this.roleCanteenList = roleCanteenList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getPermissions()
|
public Set<String> getPermissions()
|
||||||
|
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
package com.bonus.system.domain;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 角色和食堂等关联 sys_role_canteen
|
|
||||||
*
|
|
||||||
* @author bonus
|
|
||||||
*/
|
|
||||||
public class SysRoleCanteen
|
|
||||||
{
|
|
||||||
/** 角色ID */
|
|
||||||
private Long roleId;
|
|
||||||
|
|
||||||
/** 区域、食堂、档口ID */
|
|
||||||
private String dataId;
|
|
||||||
|
|
||||||
public Long getRoleId()
|
|
||||||
{
|
|
||||||
return roleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoleId(Long roleId)
|
|
||||||
{
|
|
||||||
this.roleId = roleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDataId() {
|
|
||||||
return dataId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDataId(String dataId) {
|
|
||||||
this.dataId = dataId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("roleId", getRoleId())
|
|
||||||
.append("dataId", getDataId())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
package com.bonus.system.mapper;
|
package com.bonus.system.mapper;
|
||||||
|
|
||||||
|
import com.bonus.system.api.domain.RoleCanteenVo;
|
||||||
import com.bonus.system.domain.SysRoleArea;
|
import com.bonus.system.domain.SysRoleArea;
|
||||||
import com.bonus.system.domain.SysRoleCanteen;
|
|
||||||
import com.bonus.system.domain.SysRoleDept;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -47,5 +46,5 @@ public interface SysRoleAreaMapper
|
||||||
*/
|
*/
|
||||||
public int batchRoleArea(List<SysRoleArea> roleAreaList);
|
public int batchRoleArea(List<SysRoleArea> roleAreaList);
|
||||||
|
|
||||||
public int batchRoleCanteen(List<SysRoleCanteen> roleCanteenList);
|
public int batchRoleCanteen(List<RoleCanteenVo> roleCanteenList);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.bonus.system.mapper;
|
package com.bonus.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.system.api.domain.RoleCanteenVo;
|
||||||
import com.bonus.system.api.domain.SysRole;
|
import com.bonus.system.api.domain.SysRole;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -107,5 +109,5 @@ public interface SysRoleMapper
|
||||||
|
|
||||||
public List<String> getAreaIdsByRoleId(Long roleId);
|
public List<String> getAreaIdsByRoleId(Long roleId);
|
||||||
|
|
||||||
public List<String> getDataIdsByRoleId(Long roleId);
|
public List<RoleCanteenVo> getDataIdsByRoleId(Long roleId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,10 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.bonus.common.core.web.domain.BaseEntity;
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
import com.bonus.common.datascope.enums.DataTypeEnum;
|
|
||||||
import com.bonus.common.datascope.utils.CommonDataPermissionInfo;
|
import com.bonus.common.datascope.utils.CommonDataPermissionInfo;
|
||||||
|
import com.bonus.system.api.domain.RoleCanteenVo;
|
||||||
import com.bonus.system.api.domain.SysUserRole;
|
import com.bonus.system.api.domain.SysUserRole;
|
||||||
import com.bonus.system.domain.SysRoleArea;
|
import com.bonus.system.domain.SysRoleArea;
|
||||||
import com.bonus.system.domain.SysRoleCanteen;
|
|
||||||
import com.bonus.system.mapper.*;
|
import com.bonus.system.mapper.*;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -84,9 +83,9 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
List<SysRole> roles = roleMapper.selectRoleList(role);
|
List<SysRole> roles = roleMapper.selectRoleList(role);
|
||||||
for (SysRole r : roles) {
|
for (SysRole r : roles) {
|
||||||
List<String> areaIds = roleMapper.getAreaIdsByRoleId(r.getRoleId());
|
List<String> areaIds = roleMapper.getAreaIdsByRoleId(r.getRoleId());
|
||||||
List<String> dataIds = roleMapper.getDataIdsByRoleId(r.getRoleId());
|
List<RoleCanteenVo> roleCanteenList = roleMapper.getDataIdsByRoleId(r.getRoleId());
|
||||||
r.setAreaIds(areaIds.toArray(new String[areaIds.size()]));
|
r.setAreaIds(areaIds.toArray(new String[areaIds.size()]));
|
||||||
r.setDataIds(dataIds.toArray(new String[dataIds.size()]));
|
r.setRoleCanteenList(roleCanteenList);
|
||||||
}
|
}
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
@ -431,12 +430,13 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
{
|
{
|
||||||
int rows = 1;
|
int rows = 1;
|
||||||
// 新增角色与食堂档口(数据权限)管理
|
// 新增角色与食堂档口(数据权限)管理
|
||||||
List<SysRoleCanteen> list = new ArrayList<SysRoleCanteen>();
|
List<RoleCanteenVo> list = new ArrayList<RoleCanteenVo>();
|
||||||
for (String dataId : role.getDataIds())
|
for (RoleCanteenVo roleCanteen : role.getRoleCanteenList())
|
||||||
{
|
{
|
||||||
SysRoleCanteen rd = new SysRoleCanteen();
|
RoleCanteenVo rd = new RoleCanteenVo();
|
||||||
rd.setRoleId(role.getRoleId());
|
rd.setRoleId(role.getRoleId());
|
||||||
rd.setDataId(dataId);
|
rd.setDataId(roleCanteen.getDataId());
|
||||||
|
rd.setType(roleCanteen.getType());
|
||||||
list.add(rd);
|
list.add(rd);
|
||||||
}
|
}
|
||||||
if (list.size() > 0)
|
if (list.size() > 0)
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="batchRoleCanteen">
|
<insert id="batchRoleCanteen">
|
||||||
insert into sys_role_canteen(role_id, data_id) values
|
insert into sys_role_canteen(role_id, data_id, type) values
|
||||||
<foreach item="item" index="index" collection="list" separator=",">
|
<foreach item="item" index="index" collection="list" separator=",">
|
||||||
(#{item.roleId},#{item.dataId})
|
(#{item.roleId},#{item.dataId},#{item.type})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -182,8 +182,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where role_id = #{roleId}
|
where role_id = #{roleId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDataIdsByRoleId" resultType="String">
|
<select id="getDataIdsByRoleId" resultType="com.bonus.system.api.domain.RoleCanteenVo">
|
||||||
select data_id
|
select role_id, data_id, type
|
||||||
from sys_role_canteen
|
from sys_role_canteen
|
||||||
where role_id = #{roleId}
|
where role_id = #{roleId}
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue