权限功能调整及权限主体禁用功能(未完成)

This commit is contained in:
tiger_zhou 2022-10-20 13:33:58 +08:00
parent f9b02894e0
commit 0b04b23537
16 changed files with 381 additions and 166 deletions

View File

@ -8,6 +8,7 @@ import club.joylink.rtss.vo.permission.subject.PermissionSubjectQueryVO;
import club.joylink.rtss.vo.permission.subject.PermissionSubjectVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -27,4 +28,9 @@ public class PermissionSubjectController {
public PageVO<PermissionSubjectVO> page(PermissionSubjectQueryVO req) {
return this.subjectService.page(req);
}
@GetMapping(path = "/status/inValid/{subjectId}")
public void statusForInValid(@PathVariable Long subjectId){
this.subjectService.subjectAndDistributeStatusForInValid(subjectId);
}
}

View File

@ -4,13 +4,41 @@ import java.util.List;
import club.joylink.rtss.entity.permission.PermissionSubject;
import club.joylink.rtss.entity.permission.PermissionSubjectExample;
import club.joylink.rtss.vo.permission.subject.PermissionSubjectQueryVO;
import club.joylink.rtss.vo.permission.subject.PermissionSubjectVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface PermissionSubjectDAO {
@Select("<select>" +
"set global group_concat_max_len = 10240;" +
"set session group_concat_max_len = 10240;" +
"select t4.* from " +
"(" +
"select @ids _ids, (select @ids := group_concat(id) from rts_permission_subject where find_in_set(parent_id, @ids)) " +
" from rts_permission_subject t1 , (select @ids := #{currentLevelId}) t2 " +
" where t1.id >= #{currentLevelId} and @ids is not null " +
") t3, rts_permission_subject t4 " +
"where t4.id >= #{currentLevelId} and find_in_set(t4.id, t3._ids);" +
"</select>")
List<PermissionSubject> circleQueryChildById(Long currentLevelId);
@Select("<select>" +
"select A.id,A.subject_type,A.subject_id," +
"(case when A.subject_type = 'user' then B.name when A.subject_type = 'org' then C.name end) as named," +
"(case when A.subject_type = 'user' then B.nickname else '' end) as nick_name," +
"A.amount,A.remains,A.status,A.forever,A.start_time,A.end_time,A.create_time,D.name as permission_name,A.permission_id " +
" from rts_permission_subject A left join sys_account B on A.subject_type = 'user' and A.subject_id = B.id " +
" left join org C on A.subject_type = 'org' and A.subject_id = C.id " +
" left join rts_permission D on A.permission_id = D.id " +
" where 1 = 1 " +
" order by id desc " +
"</select>")
List<PermissionSubjectVO> customerQuery(PermissionSubjectQueryVO queryVO);
long countByExample(PermissionSubjectExample example);
int deleteByExample(PermissionSubjectExample example);

View File

@ -3,13 +3,25 @@ package club.joylink.rtss.dao.permission;
import club.joylink.rtss.entity.permission.SystemAbility;
import club.joylink.rtss.entity.permission.SystemAbilityExample;
import java.util.List;
import club.joylink.rtss.vo.permission.PermissionSystemAbilityVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface SystemAbilityDAO {
@Select("<select>" +
"select A.id,B.permission_id,A.type,A.ability_id,A.status,A.name as ability_name " +
"from rts_system_ability A , rts_permission_system_ability B " +
"where 1 = 1 and A.id = B.system_ability_id " +
" <foreach collection=\"permissions\" open=\" and B.permission_id in (\" close=\")\" item=\"d\" separator=\" , \"> "+
" #{d} "+
" </foreach>" +
"</select>")
List<PermissionSystemAbilityVO> findSystemAbilityByPermissionId(List<Long> permissions);
long countByExample(SystemAbilityExample example);
int deleteByExample(SystemAbilityExample example);

View File

@ -22,7 +22,7 @@ public class PermissionSubject implements Serializable {
private Long permissionId;
/**
* 主体类型(User,Org)
* 主体类型(user,org)
*/
private String subjectType;
@ -42,7 +42,7 @@ public class PermissionSubject implements Serializable {
private Integer remains;
/**
* 状态
* 权限主体状态,Valid-有效InValid-无效
*/
private String status;
@ -70,7 +70,11 @@ public class PermissionSubject implements Serializable {
* 来自对应的分发id(rts_permission_distribute)
*/
private Long distributeId;
;
/**
* 父级id 数据来源rts_permission_distribute表source_subject_id字段
*/
private Long parentId;
private static final long serialVersionUID = 1L;
}

View File

@ -864,6 +864,66 @@ public class PermissionSubjectExample {
addCriterion("distribute_id not between", value1, value2, "distributeId");
return (Criteria) this;
}
public Criteria andParentIdIsNull() {
addCriterion("parent_id is null");
return (Criteria) this;
}
public Criteria andParentIdIsNotNull() {
addCriterion("parent_id is not null");
return (Criteria) this;
}
public Criteria andParentIdEqualTo(Long value) {
addCriterion("parent_id =", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotEqualTo(Long value) {
addCriterion("parent_id <>", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdGreaterThan(Long value) {
addCriterion("parent_id >", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdGreaterThanOrEqualTo(Long value) {
addCriterion("parent_id >=", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdLessThan(Long value) {
addCriterion("parent_id <", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdLessThanOrEqualTo(Long value) {
addCriterion("parent_id <=", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdIn(List<Long> values) {
addCriterion("parent_id in", values, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotIn(List<Long> values) {
addCriterion("parent_id not in", values, "parentId");
return (Criteria) this;
}
public Criteria andParentIdBetween(Long value1, Long value2) {
addCriterion("parent_id between", value1, value2, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotBetween(Long value1, Long value2) {
addCriterion("parent_id not between", value1, value2, "parentId");
return (Criteria) this;
}
}
/**

View File

@ -2,6 +2,7 @@ package club.joylink.rtss.entity.permission;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import lombok.Data;
/**
@ -15,6 +16,11 @@ public class SystemAbility implements Serializable {
*/
private Long id;
/**
* 对应 rts_map_system 中的map_id
*/
private Long mapId;
/**
* 功能的类型
*/
@ -30,11 +36,6 @@ public class SystemAbility implements Serializable {
*/
private String name;
/**
* 功能的描述
*/
private String des;
/**
* 状态
*/

View File

@ -1,7 +1,7 @@
package club.joylink.rtss.entity.permission;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class SystemAbilityExample {
@ -185,6 +185,66 @@ public class SystemAbilityExample {
return (Criteria) this;
}
public Criteria andMapIdIsNull() {
addCriterion("map_id is null");
return (Criteria) this;
}
public Criteria andMapIdIsNotNull() {
addCriterion("map_id is not null");
return (Criteria) this;
}
public Criteria andMapIdEqualTo(Long value) {
addCriterion("map_id =", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotEqualTo(Long value) {
addCriterion("map_id <>", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThan(Long value) {
addCriterion("map_id >", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThanOrEqualTo(Long value) {
addCriterion("map_id >=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThan(Long value) {
addCriterion("map_id <", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThanOrEqualTo(Long value) {
addCriterion("map_id <=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdIn(List<Long> values) {
addCriterion("map_id in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotIn(List<Long> values) {
addCriterion("map_id not in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdBetween(Long value1, Long value2) {
addCriterion("map_id between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotBetween(Long value1, Long value2) {
addCriterion("map_id not between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
@ -385,76 +445,6 @@ public class SystemAbilityExample {
return (Criteria) this;
}
public Criteria andDesIsNull() {
addCriterion("des is null");
return (Criteria) this;
}
public Criteria andDesIsNotNull() {
addCriterion("des is not null");
return (Criteria) this;
}
public Criteria andDesEqualTo(String value) {
addCriterion("des =", value, "des");
return (Criteria) this;
}
public Criteria andDesNotEqualTo(String value) {
addCriterion("des <>", value, "des");
return (Criteria) this;
}
public Criteria andDesGreaterThan(String value) {
addCriterion("des >", value, "des");
return (Criteria) this;
}
public Criteria andDesGreaterThanOrEqualTo(String value) {
addCriterion("des >=", value, "des");
return (Criteria) this;
}
public Criteria andDesLessThan(String value) {
addCriterion("des <", value, "des");
return (Criteria) this;
}
public Criteria andDesLessThanOrEqualTo(String value) {
addCriterion("des <=", value, "des");
return (Criteria) this;
}
public Criteria andDesLike(String value) {
addCriterion("des like", value, "des");
return (Criteria) this;
}
public Criteria andDesNotLike(String value) {
addCriterion("des not like", value, "des");
return (Criteria) this;
}
public Criteria andDesIn(List<String> values) {
addCriterion("des in", values, "des");
return (Criteria) this;
}
public Criteria andDesNotIn(List<String> values) {
addCriterion("des not in", values, "des");
return (Criteria) this;
}
public Criteria andDesBetween(String value1, String value2) {
addCriterion("des between", value1, value2, "des");
return (Criteria) this;
}
public Criteria andDesNotBetween(String value1, String value2) {
addCriterion("des not between", value1, value2, "des");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
@ -595,52 +585,52 @@ public class SystemAbilityExample {
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(LocalDateTime value) {
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(LocalDateTime value) {
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(LocalDateTime value) {
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(LocalDateTime value) {
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(LocalDateTime value) {
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(LocalDateTime value) {
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<LocalDateTime> values) {
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<LocalDateTime> values) {
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(LocalDateTime value1, LocalDateTime value2) {
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
@ -655,52 +645,52 @@ public class SystemAbilityExample {
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(LocalDateTime value) {
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(LocalDateTime value) {
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(LocalDateTime value) {
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(LocalDateTime value) {
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(LocalDateTime value) {
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(LocalDateTime value) {
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<LocalDateTime> values) {
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<LocalDateTime> values) {
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(LocalDateTime value1, LocalDateTime value2) {
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}

View File

@ -3,15 +3,23 @@ package club.joylink.rtss.services.permission;
import club.joylink.rtss.dao.permission.PermissionSubjectDAO;
import club.joylink.rtss.entity.permission.PermissionSubject;
import club.joylink.rtss.entity.permission.PermissionSubjectExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.permission.PermissionSubjectTypeEnum;
import club.joylink.rtss.vo.permission.PermissionSystemAbilityVO;
import club.joylink.rtss.vo.permission.subject.PermissionSubjectQueryVO;
import club.joylink.rtss.vo.permission.subject.PermissionSubjectVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@Service
@Slf4j
@ -19,11 +27,36 @@ public class PermissionSubjectService {
@Resource
private PermissionSubjectDAO subjectDAO;
@Resource
private SystemAbilityService systemAbilityService;
public PageVO<PermissionSubjectVO> page(PermissionSubjectQueryVO queryVO){
PageHelper.startPage(queryVO.getPageNum(),queryVO.getPageSize());
PermissionSubjectExample example = new PermissionSubjectExample();
PermissionSubjectExample.Criteria criteria = example.createCriteria();
Page<PermissionSubject> page = (Page<PermissionSubject>) this.subjectDAO.selectByExample(example);
return PageVO.convert(page,PermissionSubjectVO.convertorList(page.getResult()));
Page<PermissionSubjectVO> page = (Page<PermissionSubjectVO>) this.subjectDAO.customerQuery(queryVO);
List<Long> permissionList = page.getResult().stream().filter(Objects::nonNull).map(PermissionSubjectVO::getPermissionId).collect(Collectors.toList());
List<PermissionSystemAbilityVO> abilityVOList = this.systemAbilityService.findSystemAbilityByPermissionId(permissionList);
Map<Long,List<PermissionSystemAbilityVO>> permissionMapList = abilityVOList.stream().collect(Collectors.groupingBy(PermissionSystemAbilityVO::getPermissionId));
for (PermissionSubjectVO subjectVO : page.getResult()) {
List<PermissionSystemAbilityVO> list = permissionMapList.get(subjectVO.getPermissionId());
if(!CollectionUtils.isEmpty(list)){
subjectVO.setSystemAbilityList(list);
}
}
return PageVO.convert(page);
}
public PermissionSubject findById(Long subjectId){
PermissionSubject ps = this.subjectDAO.selectByPrimaryKey(subjectId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(ps),"");
return ps;
}
public void subjectAndDistributeStatusForInValid(Long subjectId){
PermissionSubject ps = this.findById(subjectId);
if(Objects.equals(ps.getSubjectType(),PermissionSubjectTypeEnum.user.name())){
List<PermissionSubject> psList = this.subjectDAO.circleQueryChildById(subjectId);
//TODO 循环设置主体状态
}
}
}

View File

@ -7,8 +7,11 @@ import club.joylink.rtss.entity.permission.PermissionSystemAbilityExample;
import club.joylink.rtss.entity.permission.SystemAbility;
import club.joylink.rtss.entity.permission.SystemAbilityExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.mapSystem.RtsMapSystemService;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.mapSystem.RtsMapSystemQueryVO;
import club.joylink.rtss.vo.client.mapSystem.RtsMapSystemVO;
import club.joylink.rtss.vo.permission.*;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
@ -19,9 +22,11 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
import static club.joylink.rtss.vo.permission.SystemAbilityStatus.Editing;
@ -34,6 +39,8 @@ public class SystemAbilityService {
private SystemAbilityDAO systemAbilityDAO;
@Resource
private PermissionSystemAbilityDAO permissionSystemAbilityDAO;
@Resource
private RtsMapSystemService mapSystemService;
public SystemAbility findById(Long id){
@ -58,13 +65,14 @@ public class SystemAbilityService {
this.checkSameName(req.getName());
SystemAbility ability=new SystemAbility();
ability.setName(req.getName());
ability.setDes(req.getDes());
ability.setMapId(req.getMapId());
ability.setCreatorId(creatorId);
ability.setType(req.getType().name());
ability.setAbilityId(req.getFunctionId());
ability.setCreateTime(LocalDateTime.now());
ability.setUpdateTime(LocalDateTime.now());
ability.setStatus(Enable.name());
this.systemAbilityDAO.insertSelective(ability);
}
/**
@ -100,6 +108,7 @@ public class SystemAbilityService {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(vo.getId()),"数据id不能为空");
SystemAbility dbSA = this.findById(vo.getId());
dbSA.setType(vo.getType().name());
dbSA.setMapId(vo.getMapId());
dbSA.setAbilityId(vo.getFunctionId());
dbSA.setUpdateTime(LocalDateTime.now());
this.systemAbilityDAO.updateByPrimaryKeySelective(dbSA);
@ -156,4 +165,25 @@ public class SystemAbilityService {
return PageVO.convert(page, questionVOS);
}
public List<PermissionSystemAbilityVO> findSystemAbilityByPermissionId(List<Long> permissions){
if(CollectionUtils.isEmpty(permissions)){
return Collections.emptyList();
}
return this.systemAbilityDAO.findSystemAbilityByPermissionId(permissions);
}
@Transactional
public void autoSynchMapSystemData(){
List<RtsMapSystemVO> voList = this.mapSystemService.listQuery(new RtsMapSystemQueryVO());
List<SystemAbility> abilities = this.systemAbilityDAO.selectByExample(new SystemAbilityExample());
if(CollectionUtils.isEmpty(abilities)){
this.systemAbilityDAO.insertSelective(null);
}else{
Map<String,SystemAbility> abilityMap = abilities.stream().collect(Collectors.toMap(k->k.getType() + k.getAbilityId() + k.getMapId(), Function.identity()));
Map<String,RtsMapSystemVO> mapSystemMap = voList.stream().collect(Collectors.toMap(k->k.getName() + k.getId() + k.getMapId(), Function.identity()));
}
}
}

View File

@ -13,10 +13,7 @@ public class AutoCreateSystemAbilityReqVo {
*/
@NotNull
private String name;
/**
* 权限功能描述
*/
private String des;
/**
* 权限功能类型
*/
@ -29,4 +26,6 @@ public class AutoCreateSystemAbilityReqVo {
@JsonSerialize(using = ToStringSerializer.class)
@NotNull
private Long functionId;
private Long mapId;
}

View File

@ -0,0 +1,16 @@
package club.joylink.rtss.vo.permission;
import lombok.Data;
import java.io.Serializable;
@Data
public class PermissionSystemAbilityVO implements Serializable {
private static final long serialVersionUID = 374617905492080377L;
private Long id;
private Long permissionId;
private String type;
private Long abilityId;
private String status;
private String abilityName;
}

View File

@ -26,4 +26,6 @@ public class UpdateAbilityFunctionReqVo {
@JsonSerialize(using = ToStringSerializer.class)
@NotNull
private Long functionId;
private Long mapId;
}

View File

@ -5,4 +5,17 @@ import lombok.Data;
@Data
public class PermissionSubjectQueryVO extends PageQueryVO {
/**
* 查询类型 use/org
*/
private String subType;
/**
* 用户/org 对应的name
*/
private String named;
/**
* 权限主体状态,1-有效2-无效
*/
private String status;
}

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.vo.permission.subject;
import club.joylink.rtss.entity.permission.PermissionSubject;
import club.joylink.rtss.vo.permission.PermissionSystemAbilityVO;
import com.google.common.collect.Lists;
import lombok.Data;
@ -9,42 +10,37 @@ import java.util.List;
@Data
public class PermissionSubjectVO {
private Long id;
/**
* 访问权限id
*/
private Long permissionId;
/**
* 主体类型(User,Org)
* 主体类型 use/org
*/
private String subjectType;
/**
* 主体id
* 主体对应的id
*/
private Long subjectId;
/**
* 主体对该权限的总数量
* 主体名称
*/
private String named;
/**
* 用户昵称
*/
private String nickName;
private Integer amount;
/**
* 主体对该权限的剩余数量
*/
private Integer remains;
/**
* 状态
*/
private String status;
/**
* 是否永久1-true/0-false
*/
private Boolean forever;
/**
* 开始时间
*/
@ -59,12 +55,22 @@ public class PermissionSubjectVO {
* 创建时间
*/
private LocalDateTime createTime;
/**
* 权限名称
*/
private String permissionName;
/**
* 访问权限id
*/
private Long permissionId;
/**
* 来自对应的分发id(rts_permission_distribute)
*/
private Long distributeId;
private List<PermissionSystemAbilityVO> systemAbilityList;
/*
public static PermissionSubjectVO convertorBean(PermissionSubject ps) {
PermissionSubjectVO vo = new PermissionSubjectVO();
vo.setId(ps.getId());
@ -87,5 +93,5 @@ public class PermissionSubjectVO {
listData.add(convertorBean(ps));
}
return listData;
}
}*/
}

View File

@ -14,6 +14,7 @@
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="distribute_id" jdbcType="BIGINT" property="distributeId" />
<result column="parent_id" jdbcType="BIGINT" property="parentId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -75,7 +76,7 @@
</sql>
<sql id="Base_Column_List">
id, permission_id, subject_type, subject_id, amount, remains, `status`, forever,
start_time, end_time, create_time, distribute_id
start_time, end_time, create_time, distribute_id, parent_id
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.permission.PermissionSubjectExample" resultMap="BaseResultMap">
select
@ -115,19 +116,19 @@
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.permission.PermissionSubject" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
<insert id="insert" parameterType="club.joylink.rtss.entity.permission.PermissionSubject">
insert into rts_permission_subject (id, permission_id, subject_type,
subject_id, amount, remains,
`status`, forever, start_time,
end_time, create_time, distribute_id
)
end_time, create_time, distribute_id,
parent_id)
values (#{id,jdbcType=BIGINT}, #{permissionId,jdbcType=BIGINT}, #{subjectType,jdbcType=VARCHAR},
#{subjectId,jdbcType=BIGINT}, #{amount,jdbcType=INTEGER}, #{remains,jdbcType=INTEGER},
#{status,jdbcType=VARCHAR}, #{forever,jdbcType=BIT}, #{startTime,jdbcType=TIMESTAMP},
#{endTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{distributeId,jdbcType=BIGINT}
)
#{endTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{distributeId,jdbcType=BIGINT},
#{parentId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.permission.PermissionSubject" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.permission.PermissionSubject">
insert into rts_permission_subject
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -166,6 +167,9 @@
<if test="distributeId != null">
distribute_id,
</if>
<if test="parentId != null">
parent_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -204,6 +208,9 @@
<if test="distributeId != null">
#{distributeId,jdbcType=BIGINT},
</if>
<if test="parentId != null">
#{parentId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.permission.PermissionSubjectExample" resultType="java.lang.Long">
@ -251,6 +258,9 @@
<if test="record.distributeId != null">
distribute_id = #{record.distributeId,jdbcType=BIGINT},
</if>
<if test="record.parentId != null">
parent_id = #{record.parentId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -269,7 +279,8 @@
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
distribute_id = #{record.distributeId,jdbcType=BIGINT}
distribute_id = #{record.distributeId,jdbcType=BIGINT},
parent_id = #{record.parentId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -310,6 +321,9 @@
<if test="distributeId != null">
distribute_id = #{distributeId,jdbcType=BIGINT},
</if>
<if test="parentId != null">
parent_id = #{parentId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -325,7 +339,8 @@
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP},
distribute_id = #{distributeId,jdbcType=BIGINT}
distribute_id = #{distributeId,jdbcType=BIGINT},
parent_id = #{parentId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.permission.SystemAbilityDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.permission.SystemAbility">
<mapper namespace="club.joylink.rtss.dao.SystemAbilityDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.race2.SystemAbility">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="map_id" jdbcType="BIGINT" property="mapId" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="ability_id" jdbcType="BIGINT" property="abilityId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="des" jdbcType="VARCHAR" property="des" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="creator_id" jdbcType="BIGINT" property="creatorId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
@ -71,9 +71,9 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `type`, ability_id, `name`, des, `status`, creator_id, create_time, update_time
id, map_id, `type`, ability_id, `name`, `status`, creator_id, create_time, update_time
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.permission.SystemAbilityExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="club.joylink.rtss.entity.race2.SystemAbilityExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
@ -105,28 +105,31 @@
delete from rts_system_ability
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.permission.SystemAbilityExample">
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.race2.SystemAbilityExample">
delete from rts_system_ability
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.permission.SystemAbility" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
insert into rts_system_ability (id, `type`, ability_id,
`name`, des, `status`,
<insert id="insert" parameterType="club.joylink.rtss.entity.race2.SystemAbility">
insert into rts_system_ability (id, map_id, `type`,
ability_id, `name`, `status`,
creator_id, create_time, update_time
)
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{abilityId,jdbcType=BIGINT},
#{name,jdbcType=VARCHAR}, #{des,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
values (#{id,jdbcType=BIGINT}, #{mapId,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR},
#{abilityId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.permission.SystemAbility" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.race2.SystemAbility">
insert into rts_system_ability
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="mapId != null">
map_id,
</if>
<if test="type != null">
`type`,
</if>
@ -136,9 +139,6 @@
<if test="name != null">
`name`,
</if>
<if test="des != null">
des,
</if>
<if test="status != null">
`status`,
</if>
@ -156,6 +156,9 @@
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="mapId != null">
#{mapId,jdbcType=BIGINT},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
@ -165,9 +168,6 @@
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="des != null">
#{des,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
@ -182,7 +182,7 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.permission.SystemAbilityExample" resultType="java.lang.Long">
<select id="countByExample" parameterType="club.joylink.rtss.entity.race2.SystemAbilityExample" resultType="java.lang.Long">
select count(*) from rts_system_ability
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
@ -194,6 +194,9 @@
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.mapId != null">
map_id = #{record.mapId,jdbcType=BIGINT},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=VARCHAR},
</if>
@ -203,9 +206,6 @@
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.des != null">
des = #{record.des,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR},
</if>
@ -226,10 +226,10 @@
<update id="updateByExample" parameterType="map">
update rts_system_ability
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
`type` = #{record.type,jdbcType=VARCHAR},
ability_id = #{record.abilityId,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR},
des = #{record.des,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
creator_id = #{record.creatorId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
@ -238,9 +238,12 @@
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.permission.SystemAbility">
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.race2.SystemAbility">
update rts_system_ability
<set>
<if test="mapId != null">
map_id = #{mapId,jdbcType=BIGINT},
</if>
<if test="type != null">
`type` = #{type,jdbcType=VARCHAR},
</if>
@ -250,9 +253,6 @@
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="des != null">
des = #{des,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
@ -268,12 +268,12 @@
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.permission.SystemAbility">
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.race2.SystemAbility">
update rts_system_ability
set `type` = #{type,jdbcType=VARCHAR},
set map_id = #{mapId,jdbcType=BIGINT},
`type` = #{type,jdbcType=VARCHAR},
ability_id = #{abilityId,jdbcType=BIGINT},
`name` = #{name,jdbcType=VARCHAR},
des = #{des,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
creator_id = #{creatorId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},