Merge remote-tracking branch 'origin/test-training2' into test-training2

# Conflicts:
#	src/main/java/club/joylink/rtss/services/draftData/DraftMapDisStationService.java
This commit is contained in:
joylink_zhangsai 2022-10-18 14:21:23 +08:00
commit a652d06bb6
19 changed files with 1960 additions and 198 deletions

View File

@ -0,0 +1,2 @@
alter table `joylink`.`project_view`
drop index `mark_key`;

View File

@ -0,0 +1,37 @@
package club.joylink.rtss.controller.permission2;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.permission.CreatePermissionDistributeReqVo;
import club.joylink.rtss.vo.permission.CreatePermissionDistributeRspVo;
import club.joylink.rtss.vo.permission.FindPermissionDistributeByPageReqVo;
import club.joylink.rtss.vo.permission.PermissionDistributeRspVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 权限分发业务接口V2
*/
@RestController
@RequestMapping("/api/v2/permission/distribute")
public class AcPermissionDistributeController {
/**
* 创建权限分发
*/
@PostMapping("/create")
public CreatePermissionDistributeRspVo createPermissionDistribute(@RequestBody CreatePermissionDistributeReqVo req) {
return null;
}
/**
* 分页获取权限分发列表
*/
@PostMapping("/find/page")
public PageVO<PermissionDistributeRspVo> findPermissionDistributeByPage(@RequestBody FindPermissionDistributeByPageReqVo req) {
return null;
}
}

View File

@ -2,8 +2,9 @@ package club.joylink.rtss.controller.permission2;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 主体(用户或组织)的权限管理接口<br>
* 主体(用户或组织)的权限管理接口V2<br>
*/
@RestController
@RequestMapping("/api/v2/permission/subject")

View File

@ -0,0 +1,34 @@
package club.joylink.rtss.dao.permission;
import club.joylink.rtss.entity.permission.PermissionDistribute;
import club.joylink.rtss.entity.permission.PermissionDistributeExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface RtsPermissionDistributeDAO {
long countByExample(PermissionDistributeExample example);
int deleteByExample(PermissionDistributeExample example);
int deleteByPrimaryKey(Long id);
int insert(PermissionDistribute record);
int insertSelective(PermissionDistribute record);
List<PermissionDistribute> selectByExample(PermissionDistributeExample example);
PermissionDistribute selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") PermissionDistribute record, @Param("example") PermissionDistributeExample example);
int updateByExample(@Param("record") PermissionDistribute record, @Param("example") PermissionDistributeExample example);
int updateByPrimaryKeySelective(PermissionDistribute record);
int updateByPrimaryKey(PermissionDistribute record);
}

View File

@ -0,0 +1,76 @@
package club.joylink.rtss.entity.permission;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;
/**
* @author
*
*/
@Data
public class PermissionDistribute implements Serializable {
private Long id;
/**
* 关联权限id
*/
private Long permissionId;
/**
* 分发来自subject id(rts_permission_subject)
*/
private Long sourceSubjectId;
/**
* 总数量
*/
private Integer amount;
/**
* 剩余数量
*/
private Integer remains;
/**
* 是否永久true/false
*/
private Boolean forever;
/**
* 权限分发状态
*/
private Integer status;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 开始时间
*/
private LocalDateTime startTime;
/**
* 结束时间
*/
private LocalDateTime endTime;
/**
* 创建者id
*/
private Long creatorId;
/**
* 备注描述
*/
private String dsc;
private static final long serialVersionUID = 1L;
}

View File

@ -65,5 +65,10 @@ public class PermissionSubject implements Serializable {
*/
private LocalDateTime createTime;
/**
* 来自对应的分发id(rts_permission_distribute)
*/
private Long distributeId;
private static final long serialVersionUID = 1L;
}

View File

@ -804,6 +804,66 @@ public class PermissionSubjectExample {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andDistributeIdIsNull() {
addCriterion("distribute_id is null");
return (Criteria) this;
}
public Criteria andDistributeIdIsNotNull() {
addCriterion("distribute_id is not null");
return (Criteria) this;
}
public Criteria andDistributeIdEqualTo(Long value) {
addCriterion("distribute_id =", value, "distributeId");
return (Criteria) this;
}
public Criteria andDistributeIdNotEqualTo(Long value) {
addCriterion("distribute_id <>", value, "distributeId");
return (Criteria) this;
}
public Criteria andDistributeIdGreaterThan(Long value) {
addCriterion("distribute_id >", value, "distributeId");
return (Criteria) this;
}
public Criteria andDistributeIdGreaterThanOrEqualTo(Long value) {
addCriterion("distribute_id >=", value, "distributeId");
return (Criteria) this;
}
public Criteria andDistributeIdLessThan(Long value) {
addCriterion("distribute_id <", value, "distributeId");
return (Criteria) this;
}
public Criteria andDistributeIdLessThanOrEqualTo(Long value) {
addCriterion("distribute_id <=", value, "distributeId");
return (Criteria) this;
}
public Criteria andDistributeIdIn(List<Long> values) {
addCriterion("distribute_id in", values, "distributeId");
return (Criteria) this;
}
public Criteria andDistributeIdNotIn(List<Long> values) {
addCriterion("distribute_id not in", values, "distributeId");
return (Criteria) this;
}
public Criteria andDistributeIdBetween(Long value1, Long value2) {
addCriterion("distribute_id between", value1, value2, "distributeId");
return (Criteria) this;
}
public Criteria andDistributeIdNotBetween(Long value1, Long value2) {
addCriterion("distribute_id not between", value1, value2, "distributeId");
return (Criteria) this;
}
}
/**

View File

@ -8,6 +8,10 @@ import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.map.logic.MapDisStationNewVO;
import club.joylink.rtss.vo.paper.PaperUserInfoVo;
import club.joylink.rtss.vo.paper.convertor.PaperUserConvertor;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -26,94 +30,86 @@ public class DraftMapDisStationService {
* 新建调度台业务
*/
@Transactional(rollbackFor = Exception.class)
public void create(MapDisStationNewVO vo){
List<DraftMapDisStation> find = this.findByMapIdAndCode(vo.getMapId(),vo.getCode());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(CollectionUtils.isEmpty(find), String.format("草稿[mapId=%s code=%s]调度台逻辑数据已经存在",vo.getMapId(),vo.getCode()));
public void create(MapDisStationNewVO vo) {
List<DraftMapDisStation> find = this.findByMapIdAndCode(vo.getMapId(), vo.getCode());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(CollectionUtils.isEmpty(find), String.format("草稿[mapId=%s code=%s]调度台逻辑数据已经存在", vo.getMapId(), vo.getCode()));
DraftMapDisStation entity = convert(vo);
draftMapDisStationDAO.insertSelective(entity);
}
/**
* 存储
*/
@Transactional(rollbackFor = Exception.class)
public void store(MapDisStationNewVO vo){
List<DraftMapDisStation> find = this.findByMapIdAndCode(vo.getMapId(),vo.getCode());
if(CollectionUtils.isEmpty(find)){
public void store(MapDisStationNewVO vo) {
List<DraftMapDisStation> find = this.findByMapIdAndCode(vo.getMapId(), vo.getCode());
if (CollectionUtils.isEmpty(find)) {
DraftMapDisStation entity = convert(vo);
this.draftMapDisStationDAO.insert(entity);
}else{
} else {
DraftMapDisStation entity = convert(vo);
entity.setId(find.get(0).getId());
this.draftMapDisStationDAO.updateByPrimaryKey(entity);
}
}
/**
* 更新调度台业务
*/
@Transactional(rollbackFor = Exception.class)
public void update(MapDisStationNewVO vo){
List<DraftMapDisStation> find = this.findByMapIdAndCode(vo.getMapId(),vo.getCode());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != find && find.size()==1, String.format("草稿[mapId=%s code=%s]调度台逻辑数据不存在或不唯一",vo.getMapId(),vo.getCode()));
public void update(MapDisStationNewVO vo) {
List<DraftMapDisStation> find = this.findByMapIdAndCode(vo.getMapId(), vo.getCode());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != find && find.size() == 1, String.format("草稿[mapId=%s code=%s]调度台逻辑数据不存在或不唯一", vo.getMapId(), vo.getCode()));
DraftMapDisStation entity = convert(vo);
entity.setId(find.get(0).getId());
//
this.draftMapDisStationDAO.updateByPrimaryKeySelective(entity);
}
/**
* 删除调度台业务
*/
@Transactional(rollbackFor = Exception.class)
public void delete(Long mapId,String code){
public void delete(Long mapId, String code) {
DraftMapDisStationExample example = new DraftMapDisStationExample();
example.createCriteria().andMapIdEqualTo(mapId).andCodeEqualTo(code);
this.draftMapDisStationDAO.deleteByExample(example);
}
@Transactional(readOnly = true)
public MapDisStationNewVO getByMapIdAndCode(Long mapId, String code){
List<DraftMapDisStation> list = this.findByMapIdAndCode(mapId,code);
if(!CollectionUtils.isEmpty(list)){
public MapDisStationNewVO getByMapIdAndCode(Long mapId, String code) {
List<DraftMapDisStation> list = this.findByMapIdAndCode(mapId, code);
if (!CollectionUtils.isEmpty(list)) {
DraftMapDisStation entity = list.get(0);
return convert(entity);
}
return null;
}
@Transactional(readOnly = true)
public PageVO<MapDisStationNewVO> findByPage(Long mapId, DraftMapDisStationController.FindByPageReq req){
PageVO<MapDisStationNewVO> page = new PageVO<>();
public PageVO<MapDisStationNewVO> findByPage(Long mapId, DraftMapDisStationController.FindByPageReq req) {
final String orderBy = "id" + (req.getDesc() ? " desc" : "");
DraftMapDisStationExample example = new DraftMapDisStationExample();
example.createCriteria().andMapIdEqualTo(mapId);
long sum = draftMapDisStationDAO.countByExample(example);
page.setTotal(sum);
page.setPageNum(req.getPageNum());
page.setPageSize(req.getPageSize());
page.setList(new ArrayList<>());
if (sum > 0) {
//
String orderBy = "id";
long startIndex = (req.getPageNum() - 1) * req.getPageSize();
PageHelper.startPage(req.getPageNum(), req.getPageSize(), orderBy);
Page<DraftMapDisStation> pContent = (Page<DraftMapDisStation>) this.draftMapDisStationDAO.selectByExample(example);
PageHelper.clearPage();
//
if (req.getDesc()) {
example.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, startIndex, req.getPageSize()));
} else {
example.setOrderByClause(String.format("%s limit %s,%s", orderBy, startIndex, req.getPageSize()));
List<MapDisStationNewVO> voList = new ArrayList<>();
if (!CollectionUtils.isEmpty(pContent.getResult())) {
voList = pContent.getResult().stream().map(DraftMapDisStationService::convert).collect(Collectors.toList());
}
List<DraftMapDisStation> pContent = this.draftMapDisStationDAO.selectByExample(example);
if (null != pContent) {
pContent.forEach(t -> {
page.getList().add(convert(t));
});
}
}
return page;
return PageVO.convert(pContent, voList);
}
@Transactional(readOnly = true)
public List<MapDisStationNewVO> getAll(Long mapId){
public List<MapDisStationNewVO> getAll(Long mapId) {
List<MapDisStationNewVO> list = new ArrayList<>();
DraftMapDisStationExample example = new DraftMapDisStationExample();
example.createCriteria().andMapIdEqualTo(mapId);
List<DraftMapDisStation> find = draftMapDisStationDAO.selectByExample(example);
if(!CollectionUtils.isEmpty(find)){
find.forEach(entity->{
if (!CollectionUtils.isEmpty(find)) {
find.forEach(entity -> {
list.add(convert(entity));
});
}
@ -127,18 +123,19 @@ public class DraftMapDisStationService {
}
//////////////////////////////////////////////////////////////////////
public static MapDisStationNewVO convert(DraftMapDisStation from){
public static MapDisStationNewVO convert(DraftMapDisStation from) {
MapDisStationNewVO vo = new MapDisStationNewVO();
vo.setId(from.getId());
vo.setCode(from.getCode());
vo.setMapId(from.getMapId());
vo.setStationList(JsonUtils.readCollection(from.getStationList(),ArrayList.class,String.class));
vo.setStationList(JsonUtils.readCollection(from.getStationList(), ArrayList.class, String.class));
vo.setName(from.getName());
return vo;
}
public static DraftMapDisStation convert(MapDisStationNewVO from){
public static DraftMapDisStation convert(MapDisStationNewVO from) {
DraftMapDisStation entity = new DraftMapDisStation();
if(null!=from.getId()){
if (null != from.getId()) {
entity.setId(from.getId());
}
entity.setMapId(from.getMapId());

View File

@ -16,6 +16,8 @@ import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.paper.*;
import club.joylink.rtss.vo.paper.convertor.PaperCompositionConvertor;
import club.joylink.rtss.vo.paper.convertor.PaperRuleConvertor;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -122,7 +124,6 @@ public class PaperCompositionService {
curPc.setCreateTime(LocalDateTime.now());
curPc.setUpdateTime(LocalDateTime.now());
curPc.setCreatorId(user.getId());
curPc.setState(PaperCompositionState.Editing.getValue());
compositionDAO.updateByPrimaryKeySelective(curPc);
// 更新规则
this.updateCompositionRule(req.getRuleList(), req.getId());
@ -281,14 +282,6 @@ public class PaperCompositionService {
return pcState.getValue();
}).collect(Collectors.toList()));
//
PageVO<PaperCompositionWithRuleVo> page = new PageVO<>();
//
long sum = compositionDAO.countByExample(pcEx);
page.setTotal(sum);
page.setPageNum(req.getPageNum());
page.setPageSize(req.getPageSize());
page.setList(new ArrayList<>());
if (sum > 0) {
//1--创建时间 2--更新时间 3--名称默认值为1
String orderBy = "create_time";
switch (req.getOrderBy()) {
@ -302,23 +295,21 @@ public class PaperCompositionService {
orderBy = "name";
break;
}
long startIndex = (req.getPageNum() - 1) * req.getPageSize();
orderBy+=(req.getDesc()?" desc":"");
//
if (req.getDesc()) {
pcEx.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, startIndex, req.getPageSize()));
} else {
pcEx.setOrderByClause(String.format("%s limit %s,%s", orderBy, startIndex, req.getPageSize()));
}
PageHelper.startPage(req.getPageNum(),req.getPageSize(),orderBy);
Page<PaperComposition> sqlPage = (Page<PaperComposition>) compositionDAO.selectByExample(pcEx);
PageHelper.clearPage();
//
List<PaperComposition> content = compositionDAO.selectByExample(pcEx);
if (null != content) {
page.setList(new ArrayList<>(content.size()));
content.forEach(pc -> {
final List<PaperCompositionWithRuleVo> rtList = new ArrayList<>();
if(!CollectionUtils.isEmpty(sqlPage.getResult())){
sqlPage.getResult().forEach(pc->{
List<PaperRule> prList = this.findRuleByPcId(pc.getId());
page.getList().add(PaperCompositionConvertor.convert(pc, prList));
rtList.add(PaperCompositionConvertor.convert(pc, prList));
});
}
}
//
PageVO<PaperCompositionWithRuleVo> page = PageVO.convert(sqlPage,rtList);
//
if (!CollectionUtils.isEmpty(page.getList())) {
page.getList().forEach(pc -> {
@ -358,13 +349,6 @@ public class PaperCompositionService {
return pcState.getValue();
}).collect(Collectors.toList()));
//
PageVO<PaperCompositionWithRuleVo> page = new PageVO<>();
long sum = compositionDAO.countByExample(pcEx);
page.setTotal(sum);
page.setPageNum(req.getPageNum());
page.setPageSize(req.getPageSize());
page.setList(new ArrayList<>());
if (sum > 0) {
//1--创建时间 2--更新时间 3--名称默认值为1
String orderBy = "create_time";
switch (req.getOrderBy()) {
@ -378,23 +362,22 @@ public class PaperCompositionService {
orderBy = "name";
break;
}
long startIndex = (req.getPageNum() - 1) * req.getPageSize();
orderBy+=(req.getDesc()?" desc":"");
//
if (req.getDesc()) {
pcEx.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, startIndex, req.getPageSize()));
} else {
pcEx.setOrderByClause(String.format("%s limit %s,%s", orderBy, startIndex, req.getPageSize()));
}
PageHelper.startPage(req.getPageNum(),req.getPageSize(),orderBy);
Page<PaperComposition> sqlPage = (Page<PaperComposition>) compositionDAO.selectByExample(pcEx);
PageHelper.clearPage();
//
List<PaperComposition> content = compositionDAO.selectByExample(pcEx);
if (null != content) {
page.setList(new ArrayList<>(content.size()));
content.forEach(pc -> {
final List<PaperCompositionWithRuleVo> rtList = new ArrayList<>();
if(!CollectionUtils.isEmpty(sqlPage.getResult())){
sqlPage.getResult().forEach(pc->{
List<PaperRule> prList = this.findRuleByPcId(pc.getId());
page.getList().add(PaperCompositionConvertor.convert(pc, prList));
rtList.add(PaperCompositionConvertor.convert(pc, prList));
});
}
}
//
PageVO<PaperCompositionWithRuleVo> page = PageVO.convert(sqlPage,rtList);
//
if (!CollectionUtils.isEmpty(page.getList())) {
page.getList().forEach(pc -> {
pc.setCreatorInfo(this.findCreatorInfo(pc.getCreatorId()));

View File

@ -19,6 +19,8 @@ import club.joylink.rtss.vo.paper.FindPaperUserForClassReqVo;
import club.joylink.rtss.vo.paper.FindPaperUserForCompositionReqVo;
import club.joylink.rtss.vo.paper.PaperUserInfoVo;
import club.joylink.rtss.vo.paper.convertor.PaperUserConvertor;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -66,7 +68,6 @@ public class PaperUserFindPageService {
*/
@Transactional(readOnly = true)
public PageVO<PaperUserInfoVo> findPaperUserByPageForClass(FindPaperUserForClassReqVo req){
PageVO<PaperUserInfoVo> page = new PageVO<>();
PaperComposition pc = paperCompositionDAO.selectByPrimaryKey(req.getPcId());
PaperExceptionAssert.PcExisted.assertNotNull(pc,"试卷定义不存在");
//
@ -83,38 +84,24 @@ public class PaperUserFindPageService {
case Complete:c.andScoreIsNotNull();break;
case All:break;
}
long sum = paperUserDAO.countByExample(example);
page.setTotal(sum);
page.setPageNum(req.getPageNum());
page.setPageSize(req.getPageSize());
page.setList(new ArrayList<>());
if (sum > 0) {
//
String orderBy = req.getOrderBy().with();
long startIndex = (req.getPageNum() - 1) * req.getPageSize();
String orderBy = req.getOrderBy().with()+(req.getDesc()?" desc":"");
PageHelper.startPage(req.getPageNum(),req.getPageSize(),orderBy);
Page<PaperUser> sqlPage = (Page<PaperUser>) this.paperUserDAO.selectByExample(example);
//
if (req.getDesc()) {
example.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, startIndex, req.getPageSize()));
} else {
example.setOrderByClause(String.format("%s limit %s,%s", orderBy, startIndex, req.getPageSize()));
}
List<PaperUser> pContent = this.paperUserDAO.selectByExample(example);
if (null != pContent) {
pContent.forEach(t -> {
page.getList().add(PaperUserConvertor.convert(pc,t));
List<PaperUserInfoVo> rtContent= new ArrayList<>();
if(!CollectionUtils.isEmpty(sqlPage.getResult())){
sqlPage.getResult().forEach(t -> {
rtContent.add(PaperUserConvertor.convert(pc,t));
});
}
}
return page;
return PageVO.convert(sqlPage,rtContent);
}
/**
* 分页查询某个试卷蓝图的所有用户试卷基本信息
*/
@Transactional(readOnly = true)
public PageVO<PaperUserInfoVo> findPaperUserByPage(FindPaperUserForCompositionReqVo req) {
PageVO<PaperUserInfoVo> page = new PageVO<>();
//
PaperComposition pc = paperCompositionDAO.selectByPrimaryKey(req.getPcId());
PaperExceptionAssert.PcExisted.assertNotNull(pc,"试卷定义不存在");
@ -127,30 +114,18 @@ public class PaperUserFindPageService {
case Complete:c.andScoreIsNotNull();break;
case All:break;
}
long sum = paperUserDAO.countByExample(example);
page.setTotal(sum);
page.setPageNum(req.getPageNum());
page.setPageSize(req.getPageSize());
page.setList(new ArrayList<>());
if (sum > 0) {
//
String orderBy = req.getOrderBy().with();
long startIndex = (req.getPageNum() - 1) * req.getPageSize();
String orderBy = req.getOrderBy().with()+(req.getDesc()?" desc":"");
PageHelper.startPage(req.getPageNum(),req.getPageSize(),orderBy);
Page<PaperUser> sqlPage = (Page<PaperUser>) this.paperUserDAO.selectByExample(example);
//
if (req.getDesc()) {
example.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, startIndex, req.getPageSize()));
} else {
example.setOrderByClause(String.format("%s limit %s,%s", orderBy, startIndex, req.getPageSize()));
}
List<PaperUser> pContent = this.paperUserDAO.selectByExample(example);
if (null != pContent) {
pContent.forEach(t -> {
page.getList().add(PaperUserConvertor.convert(pc,t));
List<PaperUserInfoVo> rtContent= new ArrayList<>();
if(!CollectionUtils.isEmpty(sqlPage.getResult())){
sqlPage.getResult().forEach(t -> {
rtContent.add(PaperUserConvertor.convert(pc,t));
});
}
}
//
return page;
return PageVO.convert(sqlPage,rtContent);
}
/**
* 查询某个班级的所有学生的userId

View File

@ -10,6 +10,8 @@ import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.permission.*;
import club.joylink.rtss.vo.permission.convertor.PermissionConvertor;
import club.joylink.rtss.vo.permission.convertor.SystemAbilityConvertor;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -186,29 +188,19 @@ public class AcPermissionService {
}
}
//
PageVO<PermissionBasicRspVo> page = new PageVO<>();
long sum = this.permissionDAO.countByExample(permissionExample);
page.setTotal(sum);
page.setPageNum(req.getPageNum());
page.setPageSize(req.getPageSize());
page.setList(new ArrayList<>());
if (sum > 0) {
final String orderBy = req.getOrderByType().with() + (req.getDesc() ? " desc" : "");
PageHelper.startPage(req.getPageNum(), req.getPageSize(), orderBy);
Page<Permission> sqlPage = (Page<Permission>) this.permissionDAO.selectByExample(permissionExample);
PageHelper.clearPage();
//
String orderBy = req.getOrderByType().with();
long startIndex = (req.getPageNum() - 1) * req.getPageSize();
List<PermissionBasicRspVo> rtList = new ArrayList<>();
if (!CollectionUtils.isEmpty(sqlPage.getResult())) {
rtList=sqlPage.getResult().stream().map(PermissionConvertor::convertPermissionBasicRspVoFrom).collect(Collectors.toList());
}
//
if (req.getDesc()) {
permissionExample.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, startIndex, req.getPageSize()));
} else {
permissionExample.setOrderByClause(String.format("%s limit %s,%s", orderBy, startIndex, req.getPageSize()));
}
List<Permission> pContent = this.permissionDAO.selectByExample(permissionExample);
if (!CollectionUtils.isEmpty(pContent)) {
page.setList(pContent.stream().map(PermissionConvertor::convertPermissionBasicRspVoFrom).collect(Collectors.toList()));
}
}
return page;
return PageVO.convert(sqlPage,rtList);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
private List<SystemAbility> findAbilitiesByPermissionId(Long permissionId) {
PermissionSystemAbilityExample psaExample = new PermissionSystemAbilityExample();

View File

@ -45,6 +45,7 @@ public enum FindPcType {
public Integer getValue() {
return this.state;
}
/**
* 试卷蓝图状态1-正在编辑2-封存(不能修改)3-已经被使用(不能修改删除)<br>
* 选填<br>
@ -65,6 +66,7 @@ public enum FindPcType {
list.add(PaperCompositionState.Locked);
list.add(PaperCompositionState.Used);
}
break;
case Locked:
list.add(PaperCompositionState.Locked);
break;
@ -74,6 +76,7 @@ public enum FindPcType {
}
return list;
}
////////////////////////////////////////////////////////////////
private static Map<Integer, FindPcType> map = new HashMap<>();

View File

@ -0,0 +1,44 @@
package club.joylink.rtss.vo.permission;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author
*/
@Data
public class CreatePermissionDistributeReqVo {
/**
* 关联权限id
*/
private Long permissionId;
/**
* 分发来自subject id(rts_permission_subject)
*/
private Long sourceSubjectId;
/**
* 总数量
*/
private Integer amount;
/**
* 是否永久true/false
*/
private Boolean forever;
/**
* 开始时间
*/
private LocalDateTime startTime;
/**
* 结束时间
*/
private LocalDateTime endTime;
/**
* 备注描述
*/
private String dsc;
}

View File

@ -0,0 +1,32 @@
package club.joylink.rtss.vo.permission;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author
*/
@Data
public class CreatePermissionDistributeRspVo {
/**
* 分发id
*/
private Long id;
/**
* 关联权限id
*/
private Long permissionId;
/**
* 分发来自subject id(rts_permission_subject)
*/
private Long sourceSubjectId;
/**
* 总数量
*/
private Integer amount;
/**
* 是否永久true/false
*/
private Boolean forever;
}

View File

@ -0,0 +1,72 @@
package club.joylink.rtss.vo.permission;
import club.joylink.rtss.vo.client.PageQueryVO;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
@Data
public class FindPermissionDistributeByPageReqVo extends PageQueryVO {
/**
* 权限分发备注描述
*/
private String dsc;
/**
* 权限分发备注描述模糊查询默认true
*/
private Boolean dscLike=true;
/**
* 是否降序true-降序false-升序默认值为true;
*/
private Boolean desc = true;
/**
* 排序类型,默认按权限分发创建时间排序序列化为数值1-权限分发创建时间2-权限分发更新时间3-权限分发开始时间4-权限分发结束时间5-权限分发总数量6-权限分发剩余数量
*/
private OrderByType orderByType = OrderByType.OrderByCreateTime;
/////////////////////////////////////////////
public static enum OrderByType {
OrderByCreateTime(1, "create_time"),
OrderByUpdateTime(2,"update_time"),
OrderByStartTime(3,"start_time"),
OrderByEndTime(4,"end_time"),
OrderByAmount(5,"amount"),
OrderByRemains(6,"remains"),
;
private Integer value;
private String orderBy;
private OrderByType(Integer value, String orderBy) {
this.value = value;
this.orderBy = orderBy;
}
public String with(Boolean desc) {
if(null!=desc){
return this.orderBy+(desc?" desc":"");
}
return this.orderBy;
}
@JsonCreator
public static OrderByType getItem(Integer value) {
return map.get(value);
}
@JsonValue
public Integer getValue() {
return this.value;
}
private static Map<Integer, OrderByType> map = new HashMap<>();
static {
for (OrderByType t : values()) {
map.put(t.value, t);
}
}
}
}

View File

@ -0,0 +1,73 @@
package club.joylink.rtss.vo.permission;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author
*
*/
@Data
public class PermissionDistributeRspVo{
/**
* 权限分发id
*/
private Long id;
/**
* 关联权限id
*/
private Long permissionId;
/**
* 分发来自subject id(rts_permission_subject)
*/
private Long sourceSubjectId;
/**
* 总数量
*/
private Integer amount;
/**
* 剩余数量
*/
private Integer remains;
/**
* 是否永久true/false
*/
private Boolean forever;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 开始时间
*/
private LocalDateTime startTime;
/**
* 结束时间
*/
private LocalDateTime endTime;
/**
* 创建者id
*/
private Long creatorId;
/**
* 备注描述
*/
private String dsc;
}

View File

@ -13,6 +13,7 @@
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="distribute_id" jdbcType="BIGINT" property="distributeId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -74,7 +75,7 @@
</sql>
<sql id="Base_Column_List">
id, permission_id, subject_type, subject_id, amount, remains, `status`, forever,
start_time, end_time, create_time
start_time, end_time, create_time, distribute_id
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.permission.PermissionSubjectExample" resultMap="BaseResultMap">
select
@ -118,11 +119,13 @@
insert into rts_permission_subject (id, permission_id, subject_type,
subject_id, amount, remains,
`status`, forever, start_time,
end_time, create_time)
end_time, create_time, distribute_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})
#{endTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{distributeId,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.permission.PermissionSubject">
insert into rts_permission_subject
@ -160,6 +163,9 @@
<if test="createTime != null">
create_time,
</if>
<if test="distributeId != null">
distribute_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -195,6 +201,9 @@
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="distributeId != null">
#{distributeId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.permission.PermissionSubjectExample" resultType="java.lang.Long">
@ -239,6 +248,9 @@
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.distributeId != null">
distribute_id = #{record.distributeId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -256,7 +268,8 @@
forever = #{record.forever,jdbcType=BIT},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
create_time = #{record.createTime,jdbcType=TIMESTAMP}
create_time = #{record.createTime,jdbcType=TIMESTAMP},
distribute_id = #{record.distributeId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -294,6 +307,9 @@
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="distributeId != null">
distribute_id = #{distributeId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -308,7 +324,8 @@
forever = #{forever,jdbcType=BIT},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP}
create_time = #{createTime,jdbcType=TIMESTAMP},
distribute_id = #{distributeId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,346 @@
<?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.RtsPermissionDistributeDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.permission.PermissionDistribute">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="permission_id" jdbcType="BIGINT" property="permissionId" />
<result column="source_subject_id" jdbcType="BIGINT" property="sourceSubjectId" />
<result column="amount" jdbcType="INTEGER" property="amount" />
<result column="remains" jdbcType="INTEGER" property="remains" />
<result column="forever" jdbcType="BIT" property="forever" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="creator_id" jdbcType="BIGINT" property="creatorId" />
<result column="dsc" jdbcType="VARCHAR" property="dsc" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, permission_id, source_subject_id, amount, remains, forever, `status`, create_time,
update_time, start_time, end_time, creator_id, dsc
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.permission.PermissionDistributeExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from rts_permission_distribute
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from rts_permission_distribute
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from rts_permission_distribute
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.permission.PermissionDistributeExample">
delete from rts_permission_distribute
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.permission.PermissionDistribute">
insert into rts_permission_distribute (id, permission_id, source_subject_id,
amount, remains, forever,
`status`, create_time, update_time,
start_time, end_time, creator_id,
dsc)
values (#{id,jdbcType=BIGINT}, #{permissionId,jdbcType=BIGINT}, #{sourceSubjectId,jdbcType=BIGINT},
#{amount,jdbcType=INTEGER}, #{remains,jdbcType=INTEGER}, #{forever,jdbcType=BIT},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{creatorId,jdbcType=BIGINT},
#{dsc,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.permission.PermissionDistribute">
insert into rts_permission_distribute
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="permissionId != null">
permission_id,
</if>
<if test="sourceSubjectId != null">
source_subject_id,
</if>
<if test="amount != null">
amount,
</if>
<if test="remains != null">
remains,
</if>
<if test="forever != null">
forever,
</if>
<if test="status != null">
`status`,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="creatorId != null">
creator_id,
</if>
<if test="dsc != null">
dsc,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="permissionId != null">
#{permissionId,jdbcType=BIGINT},
</if>
<if test="sourceSubjectId != null">
#{sourceSubjectId,jdbcType=BIGINT},
</if>
<if test="amount != null">
#{amount,jdbcType=INTEGER},
</if>
<if test="remains != null">
#{remains,jdbcType=INTEGER},
</if>
<if test="forever != null">
#{forever,jdbcType=BIT},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
#{endTime,jdbcType=TIMESTAMP},
</if>
<if test="creatorId != null">
#{creatorId,jdbcType=BIGINT},
</if>
<if test="dsc != null">
#{dsc,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.permission.PermissionDistributeExample" resultType="java.lang.Long">
select count(*) from rts_permission_distribute
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update rts_permission_distribute
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.permissionId != null">
permission_id = #{record.permissionId,jdbcType=BIGINT},
</if>
<if test="record.sourceSubjectId != null">
source_subject_id = #{record.sourceSubjectId,jdbcType=BIGINT},
</if>
<if test="record.amount != null">
amount = #{record.amount,jdbcType=INTEGER},
</if>
<if test="record.remains != null">
remains = #{record.remains,jdbcType=INTEGER},
</if>
<if test="record.forever != null">
forever = #{record.forever,jdbcType=BIT},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=TIMESTAMP},
</if>
<if test="record.endTime != null">
end_time = #{record.endTime,jdbcType=TIMESTAMP},
</if>
<if test="record.creatorId != null">
creator_id = #{record.creatorId,jdbcType=BIGINT},
</if>
<if test="record.dsc != null">
dsc = #{record.dsc,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update rts_permission_distribute
set id = #{record.id,jdbcType=BIGINT},
permission_id = #{record.permissionId,jdbcType=BIGINT},
source_subject_id = #{record.sourceSubjectId,jdbcType=BIGINT},
amount = #{record.amount,jdbcType=INTEGER},
remains = #{record.remains,jdbcType=INTEGER},
forever = #{record.forever,jdbcType=BIT},
`status` = #{record.status,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
creator_id = #{record.creatorId,jdbcType=BIGINT},
dsc = #{record.dsc,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.permission.PermissionDistribute">
update rts_permission_distribute
<set>
<if test="permissionId != null">
permission_id = #{permissionId,jdbcType=BIGINT},
</if>
<if test="sourceSubjectId != null">
source_subject_id = #{sourceSubjectId,jdbcType=BIGINT},
</if>
<if test="amount != null">
amount = #{amount,jdbcType=INTEGER},
</if>
<if test="remains != null">
remains = #{remains,jdbcType=INTEGER},
</if>
<if test="forever != null">
forever = #{forever,jdbcType=BIT},
</if>
<if test="status != null">
`status` = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=TIMESTAMP},
</if>
<if test="creatorId != null">
creator_id = #{creatorId,jdbcType=BIGINT},
</if>
<if test="dsc != null">
dsc = #{dsc,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.permission.PermissionDistribute">
update rts_permission_distribute
set permission_id = #{permissionId,jdbcType=BIGINT},
source_subject_id = #{sourceSubjectId,jdbcType=BIGINT},
amount = #{amount,jdbcType=INTEGER},
remains = #{remains,jdbcType=INTEGER},
forever = #{forever,jdbcType=BIT},
`status` = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
creator_id = #{creatorId,jdbcType=BIGINT},
dsc = #{dsc,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>