已发布实训添加查询维度(名称,地图,类型,标签及组织)

This commit is contained in:
tiger_zhou 2022-10-09 16:09:12 +08:00
parent 75c0965797
commit 1e18878c67
10 changed files with 668 additions and 520 deletions

View File

@ -0,0 +1,3 @@
-- 新实训标添加组织id
alter table published_training2 add column org_id bigint;

View File

@ -2,11 +2,14 @@ package club.joylink.rtss.controller.training2;
import club.joylink.rtss.services.training2.Training2DraftPublishService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.training2.draft.TrainingDraftPublishReqVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import static club.joylink.rtss.controller.advice.AuthenticateInterceptor.LOGIN_INFO_KEY;
/**
* 实训草稿发布管理接口
*/
@ -20,7 +23,7 @@ public class TrainingDraftV2PublishController {
* 当前用户发布自己的实训草稿
*/
@PostMapping
public void draftPublish(@RequestBody TrainingDraftPublishReqVo req, @RequestAttribute AccountVO user){
this.publishService.draftPublish(req,user.getId());
public void draftPublish(@RequestBody TrainingDraftPublishReqVo req, @RequestAttribute(name = LOGIN_INFO_KEY)LoginUserInfoVO userInfo){
this.publishService.draftPublish(req,userInfo.getAccountVO().getId(),userInfo.getTopOrgId());
}
}

View File

@ -2,6 +2,7 @@ package club.joylink.rtss.entity.training2;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import lombok.Data;
/**
@ -69,5 +70,7 @@ public class PublishedTraining2 implements Serializable {
*/
private Integer state;
private Long orgId;
private static final long serialVersionUID = 1L;
}
}

View File

@ -1,7 +1,7 @@
package club.joylink.rtss.entity.training2;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class PublishedTraining2Example {
@ -795,52 +795,52 @@ public class PublishedTraining2Example {
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;
}
@ -855,52 +855,52 @@ public class PublishedTraining2Example {
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;
}
@ -964,6 +964,66 @@ public class PublishedTraining2Example {
addCriterion("`state` not between", value1, value2, "state");
return (Criteria) this;
}
public Criteria andOrgIdIsNull() {
addCriterion("org_id is null");
return (Criteria) this;
}
public Criteria andOrgIdIsNotNull() {
addCriterion("org_id is not null");
return (Criteria) this;
}
public Criteria andOrgIdEqualTo(Long value) {
addCriterion("org_id =", value, "orgId");
return (Criteria) this;
}
public Criteria andOrgIdNotEqualTo(Long value) {
addCriterion("org_id <>", value, "orgId");
return (Criteria) this;
}
public Criteria andOrgIdGreaterThan(Long value) {
addCriterion("org_id >", value, "orgId");
return (Criteria) this;
}
public Criteria andOrgIdGreaterThanOrEqualTo(Long value) {
addCriterion("org_id >=", value, "orgId");
return (Criteria) this;
}
public Criteria andOrgIdLessThan(Long value) {
addCriterion("org_id <", value, "orgId");
return (Criteria) this;
}
public Criteria andOrgIdLessThanOrEqualTo(Long value) {
addCriterion("org_id <=", value, "orgId");
return (Criteria) this;
}
public Criteria andOrgIdIn(List<Long> values) {
addCriterion("org_id in", values, "orgId");
return (Criteria) this;
}
public Criteria andOrgIdNotIn(List<Long> values) {
addCriterion("org_id not in", values, "orgId");
return (Criteria) this;
}
public Criteria andOrgIdBetween(Long value1, Long value2) {
addCriterion("org_id between", value1, value2, "orgId");
return (Criteria) this;
}
public Criteria andOrgIdNotBetween(Long value1, Long value2) {
addCriterion("org_id not between", value1, value2, "orgId");
return (Criteria) this;
}
}
/**
@ -1060,4 +1120,4 @@ public class PublishedTraining2Example {
this(condition, value, secondValue, null);
}
}
}
}

View File

@ -40,9 +40,9 @@ public class PublishedTraining2WithBLOBs extends PublishedTraining2 implements S
private String playerIdJson;
/**
* 实训编制后的最终场景json数据
* 实训编制后的最终场景json数据(删掉)
*/
private String finalScenesJson;
private static final long serialVersionUID = 1L;
}
}

View File

@ -6,8 +6,10 @@ import club.joylink.rtss.entity.training2.PublishedTraining2;
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
import club.joylink.rtss.vo.training2.draft.DraftTraining2InfoVo;
import club.joylink.rtss.vo.training2.publish.PublishedTraining2InfoRspVo;
import com.google.common.collect.Lists;
import java.time.LocalDateTime;
import java.util.List;
public class Training2Convertor {
public static DraftTraining2InfoVo convertFrom(DraftTraining2 dt){
@ -52,6 +54,13 @@ public class Training2Convertor {
//
return pub;
}
public static List<PublishedTraining2InfoRspVo> convertFrom(List<PublishedTraining2> froms){
List<PublishedTraining2InfoRspVo> list = Lists.newArrayList();
froms.forEach(d->list.add(convertFrom(d)));
return list;
}
public static PublishedTraining2InfoRspVo convertFrom(PublishedTraining2 from){
PublishedTraining2InfoRspVo rsp = new PublishedTraining2InfoRspVo();
rsp.setCreateTime(from.getCreateTime());

View File

@ -29,7 +29,7 @@ public class Training2DraftPublishService {
* 草稿发布
*/
@Transactional(rollbackFor = Exception.class)
public void draftPublish(TrainingDraftPublishReqVo req, Long userId) {
public void draftPublish(TrainingDraftPublishReqVo req, Long userId,Long orgId) {
Long draftId = Long.valueOf(req.getDraftId());
DraftTraining2Example dtExample = new DraftTraining2Example();
dtExample.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(draftId);
@ -48,6 +48,7 @@ public class Training2DraftPublishService {
PublishedTraining2Example ptExample = new PublishedTraining2Example();
ptExample.createCriteria().andNameEqualTo(pub.getName()).andMapIdEqualTo(pub.getMapId());
List<PublishedTraining2> ptFinds = this.publishedDao.selectByExample(ptExample);
pub.setOrgId(orgId);
//
if(null==ptFinds||ptFinds.isEmpty()){//同地图同名已发布实训不存在则直接存入
//发布

View File

@ -6,15 +6,19 @@ import club.joylink.rtss.entity.training2.PublishedTraining2Example;
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.training2.publish.*;
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;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* 已发布实训管理业务实现
@ -38,12 +42,45 @@ public class Training2PublishService {
*/
@Transactional(readOnly = true)
public PageVO<PublishedTraining2InfoRspVo> publishedTrainingsPage(PublishedTraining2InfoPageReqVo req){
PageVO<PublishedTraining2InfoRspVo> page = new PageVO<>();
PageHelper.startPage(req.getPageNum(),req.getPageSize());
PublishedTraining2Example example = new PublishedTraining2Example();
PublishedTraining2Example.Criteria c =example.createCriteria();
if(null!=req.getState()){
if(Objects.nonNull(req.getState())){
c.andStateEqualTo(req.getState());
}
if(Objects.nonNull(req.getOrgId())){
c.andOrgIdEqualTo(req.getOrgId());
}
if(Objects.nonNull(req.getMapId())){
c.andMapIdEqualTo(req.getMapId());
}
if(Objects.nonNull(req.getType())){
c.andTypeEqualTo(req.getType());
}
if(StringUtils.hasText(req.getName())){
c.andNameLike(String.format("%%%s%%",req.getName()));
}
if(Objects.equals(false,CollectionUtils.isEmpty(req.getLabelLikes()))){
for (String ll : req.getLabelLikes()) {
c.andLabelJsonLike(String.format("%%%s%%",ll));
}
}
String orderBy="create_time";
switch(req.getOrderBy()){
// case 1:orderBy="create_time";break;
case 2:orderBy="update_time";break;
case 3:orderBy="name";break;
case 4:orderBy="state";break;
}
if(req.getDesc()){
example.setOrderByClause(String.format(" %s desc",orderBy));
}
Page<PublishedTraining2> page = (Page<PublishedTraining2>)this.publishedDao.selectByExample(example);
List<PublishedTraining2InfoRspVo> tmpList = Training2Convertor.convertFrom(page.getResult());
return PageVO.convert(page,tmpList);
/* PageVO<PublishedTraining2InfoRspVo> page = new PageVO<>();
long sum = this.publishedDao.countByExample(example);
page.setTotal(sum);
page.setPageNum(req.getPageNum());
@ -75,7 +112,7 @@ public class Training2PublishService {
}
}
//
return page;
return page;*/
}
/**
* 已发布实训上架

View File

@ -5,6 +5,8 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.List;
/**
* 分页获取实训基础信息的请求
*/
@ -34,4 +36,23 @@ public class PublishedTraining2InfoPageReqVo extends PageQueryVO {
*/
private Boolean desc = true;
/**
* 实训名称
*/
private String name;
/**
* 对应的组织id
*/
private Long orgId;
/**
* 地图id
*/
private Long mapId;
/**
* 实训类型 单操 single场景scene
*/
private String type;
private List<String> labelLikes;
}

File diff suppressed because it is too large Load Diff