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

This commit is contained in:
walker-sheng 2021-03-05 16:35:31 +08:00
commit 6ee4d141c9
44 changed files with 1028 additions and 407 deletions

View File

@ -0,0 +1,9 @@
alter table learn_comment
add user_name varchar(32) null comment '给成都工业临时加的';
alter table learn_message
add user_name varchar(32) null comment '给成都工业临时加的';
alter table learn_message modify creator_id bigint null comment '留言者';
alter table learn_comment modify creator_id bigint null comment '创建者';

View File

@ -50,6 +50,12 @@ public class WebConfig implements WebMvcConfigurer {
whiteList.add("/api/license/local");
// 微信回调接口
whiteList.add("/api/wechatPay/receive");
// 成都工业留言板
whiteList.add("/api/learn/cgy/message/create");
whiteList.add("/api/learn/cgy/{messageId}/comment");
whiteList.add("/api/learn/{postId}/message/pagedQuery/postId");
whiteList.add("/api/learn/{messageId}/comment");
whiteList.add("/api/learn/cgy/updateMessageTime");
registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList);
}

View File

@ -91,6 +91,12 @@ public class LearnController {
return iLearnService.createMessage(messageCreateVO, user);
}
@ApiOperation("成工院留言")
@PostMapping("/cgy/message/create")
public long cgyCreateMessage(@RequestBody @Validated LearnMessageCreateVO messageCreateVO) {
return iLearnService.cgyCreateMessage(messageCreateVO);
}
@ApiOperation("分页查询留言")
@GetMapping("/{postId}/message/pagedQuery/postId")
public PageVO<LearnMessageVO> pagedQueryMessageByPostId(@PathVariable Long postId, LearnMessagePagedQueryVO queryVO) {
@ -149,6 +155,13 @@ public class LearnController {
iLearnService.addComment(messageId, commentCreateVO, user);
}
@ApiOperation(value = "成工院评论")
@PostMapping(path = "/cgy/{messageId}/comment")
public void cygComment(@PathVariable Long messageId,
@RequestBody @Validated(value = LearnCommentCreateCheck.class) LearnCreateVO commentCreateVO) {
iLearnService.cgyAddComment(messageId, commentCreateVO);
}
@ApiOperation(value = "回复")
@PostMapping(path = "/{messageId}/{commentId}/comment")
public void comment(@PathVariable Long messageId, @PathVariable Long commentId,
@ -187,4 +200,23 @@ public class LearnController {
iLearnService.userDeleteComment(commentId, user);
}
//----------------------------------------- 改数据 -----------------------------------------
@ApiOperation(value = "管理员修改留言数据")
@PutMapping(path = "/admin/update/message")
public void adminUpdateMessage(LearnMessageUpdateVO messageUpdateVO) {
iLearnService.adminUpdateMessage(messageUpdateVO);
}
@ApiOperation(value = "管理员修改评论数据")
@PutMapping(path = "/admin/update/comment")
public void adminUpdateComment(LearnCommentUpdateVO commentUpdateVO) {
iLearnService.adminUpdateComment(commentUpdateVO);
}
@ApiOperation(value = "成工院留言时间打散")
@PutMapping(path = "/cgy/updateMessageTime")
public void cgyUpdateMessageTime() {
iLearnService.cgyUpdateMessageTime();
}
}

View File

@ -20,8 +20,8 @@ import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.fault.FaultRuleVO;
import club.joylink.rtss.vo.client.map.DestinationCodeVO;
import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.map.newmap.MapDestinationCodeDefinitionVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
import club.joylink.rtss.vo.client.runplan.PlanTripNumberVO;
import club.joylink.rtss.vo.client.runplan.RunPlanEChartsDataVO;
@ -264,7 +264,7 @@ public class SimulationV1Controller {
@ApiOperation(value = "查询所有目的地码")
@GetMapping("/{group}/destinationCode/list")
public List<MapDestinationCodeDefinitionVO> getAllDestinationCode(@PathVariable String group) {
public List<DestinationCodeVO> getAllDestinationCode(@PathVariable String group) {
return this.groupSimulationService.getAllDestinationCode(group);
}

View File

@ -2,45 +2,18 @@ package club.joylink.rtss.dao;
import club.joylink.rtss.entity.LearnMessage;
import club.joylink.rtss.entity.LearnMessageExample;
import club.joylink.rtss.entity.LearnMessageWithBLOBs;
import club.joylink.rtss.vo.client.post.LearnMessagePagedQueryVO;
import club.joylink.rtss.vo.client.post.LearnMessageVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* LearnMessageDAO继承基类
*/
@Repository
public interface LearnMessageDAO {
long countByExample(LearnMessageExample example);
int deleteByExample(LearnMessageExample example);
int deleteByPrimaryKey(Long id);
int insert(LearnMessageWithBLOBs record);
int insertSelective(LearnMessageWithBLOBs record);
List<LearnMessageWithBLOBs> selectByExampleWithBLOBs(LearnMessageExample example);
List<LearnMessage> selectByExample(LearnMessageExample example);
LearnMessageWithBLOBs selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") LearnMessageWithBLOBs record, @Param("example") LearnMessageExample example);
int updateByExampleWithBLOBs(@Param("record") LearnMessageWithBLOBs record, @Param("example") LearnMessageExample example);
int updateByExample(@Param("record") LearnMessage record, @Param("example") LearnMessageExample example);
int updateByPrimaryKeySelective(LearnMessageWithBLOBs record);
int updateByPrimaryKeyWithBLOBs(LearnMessageWithBLOBs record);
int updateByPrimaryKey(LearnMessage record);
public interface LearnMessageDAO extends MyBatisBaseDao<LearnMessage, Long, LearnMessageExample> {
@Select("<script>" +
"SELECT\n" +
" learn_message.id AS id,\n" +
@ -52,6 +25,7 @@ public interface LearnMessageDAO {
// "learn_message.`like` AS `like`,\n" +
// "learn_message.unlike AS unlike,\n" +
" learn_message.topping AS topping,\n" +
" learn_message.user_name AS cgyUserName,\n" +
" sys_user.nickname AS creatorNickName,\n" +
" sys_user.avatar_path AS creatorAvatarPath\n" +
// "learn_comment.id AS commentList\n" +

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
import java.time.LocalDateTime;
/**
* learn_comment
* @author
* 学习吧-回复
*/
public class LearnComment implements Serializable {
private Long id;
@ -50,6 +50,11 @@ public class LearnComment implements Serializable {
*/
private Integer unlike;
/**
* 给成都工业临时加的
*/
private String userName;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -124,6 +129,14 @@ public class LearnComment implements Serializable {
this.unlike = unlike;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
@Override
public boolean equals(Object that) {
if (this == that) {
@ -144,7 +157,8 @@ public class LearnComment implements Serializable {
&& (this.getRootId() == null ? other.getRootId() == null : this.getRootId().equals(other.getRootId()))
&& (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId()))
&& (this.getLike() == null ? other.getLike() == null : this.getLike().equals(other.getLike()))
&& (this.getUnlike() == null ? other.getUnlike() == null : this.getUnlike().equals(other.getUnlike()));
&& (this.getUnlike() == null ? other.getUnlike() == null : this.getUnlike().equals(other.getUnlike()))
&& (this.getUserName() == null ? other.getUserName() == null : this.getUserName().equals(other.getUserName()));
}
@Override
@ -160,6 +174,7 @@ public class LearnComment implements Serializable {
result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode());
result = prime * result + ((getLike() == null) ? 0 : getLike().hashCode());
result = prime * result + ((getUnlike() == null) ? 0 : getUnlike().hashCode());
result = prime * result + ((getUserName() == null) ? 0 : getUserName().hashCode());
return result;
}
@ -178,6 +193,7 @@ public class LearnComment implements Serializable {
sb.append(", parentId=").append(parentId);
sb.append(", like=").append(like);
sb.append(", unlike=").append(unlike);
sb.append(", userName=").append(userName);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();

View File

@ -674,6 +674,76 @@ public class LearnCommentExample {
addCriterion("unlike not between", value1, value2, "unlike");
return (Criteria) this;
}
public Criteria andUserNameIsNull() {
addCriterion("user_name is null");
return (Criteria) this;
}
public Criteria andUserNameIsNotNull() {
addCriterion("user_name is not null");
return (Criteria) this;
}
public Criteria andUserNameEqualTo(String value) {
addCriterion("user_name =", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotEqualTo(String value) {
addCriterion("user_name <>", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameGreaterThan(String value) {
addCriterion("user_name >", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameGreaterThanOrEqualTo(String value) {
addCriterion("user_name >=", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLessThan(String value) {
addCriterion("user_name <", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLessThanOrEqualTo(String value) {
addCriterion("user_name <=", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLike(String value) {
addCriterion("user_name like", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotLike(String value) {
addCriterion("user_name not like", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameIn(List<String> values) {
addCriterion("user_name in", values, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotIn(List<String> values) {
addCriterion("user_name not in", values, "userName");
return (Criteria) this;
}
public Criteria andUserNameBetween(String value1, String value2) {
addCriterion("user_name between", value1, value2, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotBetween(String value1, String value2) {
addCriterion("user_name not between", value1, value2, "userName");
return (Criteria) this;
}
}
/**

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
import java.time.LocalDateTime;
/**
* learn_message
* @author
* 帖子留言
*/
public class LearnMessage implements Serializable {
private Long id;
@ -35,11 +35,26 @@ public class LearnMessage implements Serializable {
*/
private LocalDateTime createTime;
/**
* 赞数
*/
private Integer like;
/**
* 踩数
*/
private Integer unlike;
/**
* 是否置顶
*/
private Boolean topping;
/**
* 给成都工业临时加的
*/
private String userName;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -90,6 +105,22 @@ public class LearnMessage implements Serializable {
this.createTime = createTime;
}
public Integer getLike() {
return like;
}
public void setLike(Integer like) {
this.like = like;
}
public Integer getUnlike() {
return unlike;
}
public void setUnlike(Integer unlike) {
this.unlike = unlike;
}
public Boolean getTopping() {
return topping;
}
@ -98,6 +129,14 @@ public class LearnMessage implements Serializable {
this.topping = topping;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
@Override
public boolean equals(Object that) {
if (this == that) {
@ -116,7 +155,10 @@ public class LearnMessage implements Serializable {
&& (this.getPictureUrls() == null ? other.getPictureUrls() == null : this.getPictureUrls().equals(other.getPictureUrls()))
&& (this.getCreatorId() == null ? other.getCreatorId() == null : this.getCreatorId().equals(other.getCreatorId()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getTopping() == null ? other.getTopping() == null : this.getTopping().equals(other.getTopping()));
&& (this.getLike() == null ? other.getLike() == null : this.getLike().equals(other.getLike()))
&& (this.getUnlike() == null ? other.getUnlike() == null : this.getUnlike().equals(other.getUnlike()))
&& (this.getTopping() == null ? other.getTopping() == null : this.getTopping().equals(other.getTopping()))
&& (this.getUserName() == null ? other.getUserName() == null : this.getUserName().equals(other.getUserName()));
}
@Override
@ -129,7 +171,10 @@ public class LearnMessage implements Serializable {
result = prime * result + ((getPictureUrls() == null) ? 0 : getPictureUrls().hashCode());
result = prime * result + ((getCreatorId() == null) ? 0 : getCreatorId().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getLike() == null) ? 0 : getLike().hashCode());
result = prime * result + ((getUnlike() == null) ? 0 : getUnlike().hashCode());
result = prime * result + ((getTopping() == null) ? 0 : getTopping().hashCode());
result = prime * result + ((getUserName() == null) ? 0 : getUserName().hashCode());
return result;
}
@ -145,7 +190,10 @@ public class LearnMessage implements Serializable {
sb.append(", pictureUrls=").append(pictureUrls);
sb.append(", creatorId=").append(creatorId);
sb.append(", createTime=").append(createTime);
sb.append(", like=").append(like);
sb.append(", unlike=").append(unlike);
sb.append(", topping=").append(topping);
sb.append(", userName=").append(userName);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();

View File

@ -505,6 +505,126 @@ public class LearnMessageExample {
return (Criteria) this;
}
public Criteria andLikeIsNull() {
addCriterion("`like` is null");
return (Criteria) this;
}
public Criteria andLikeIsNotNull() {
addCriterion("`like` is not null");
return (Criteria) this;
}
public Criteria andLikeEqualTo(Integer value) {
addCriterion("`like` =", value, "like");
return (Criteria) this;
}
public Criteria andLikeNotEqualTo(Integer value) {
addCriterion("`like` <>", value, "like");
return (Criteria) this;
}
public Criteria andLikeGreaterThan(Integer value) {
addCriterion("`like` >", value, "like");
return (Criteria) this;
}
public Criteria andLikeGreaterThanOrEqualTo(Integer value) {
addCriterion("`like` >=", value, "like");
return (Criteria) this;
}
public Criteria andLikeLessThan(Integer value) {
addCriterion("`like` <", value, "like");
return (Criteria) this;
}
public Criteria andLikeLessThanOrEqualTo(Integer value) {
addCriterion("`like` <=", value, "like");
return (Criteria) this;
}
public Criteria andLikeIn(List<Integer> values) {
addCriterion("`like` in", values, "like");
return (Criteria) this;
}
public Criteria andLikeNotIn(List<Integer> values) {
addCriterion("`like` not in", values, "like");
return (Criteria) this;
}
public Criteria andLikeBetween(Integer value1, Integer value2) {
addCriterion("`like` between", value1, value2, "like");
return (Criteria) this;
}
public Criteria andLikeNotBetween(Integer value1, Integer value2) {
addCriterion("`like` not between", value1, value2, "like");
return (Criteria) this;
}
public Criteria andUnlikeIsNull() {
addCriterion("unlike is null");
return (Criteria) this;
}
public Criteria andUnlikeIsNotNull() {
addCriterion("unlike is not null");
return (Criteria) this;
}
public Criteria andUnlikeEqualTo(Integer value) {
addCriterion("unlike =", value, "unlike");
return (Criteria) this;
}
public Criteria andUnlikeNotEqualTo(Integer value) {
addCriterion("unlike <>", value, "unlike");
return (Criteria) this;
}
public Criteria andUnlikeGreaterThan(Integer value) {
addCriterion("unlike >", value, "unlike");
return (Criteria) this;
}
public Criteria andUnlikeGreaterThanOrEqualTo(Integer value) {
addCriterion("unlike >=", value, "unlike");
return (Criteria) this;
}
public Criteria andUnlikeLessThan(Integer value) {
addCriterion("unlike <", value, "unlike");
return (Criteria) this;
}
public Criteria andUnlikeLessThanOrEqualTo(Integer value) {
addCriterion("unlike <=", value, "unlike");
return (Criteria) this;
}
public Criteria andUnlikeIn(List<Integer> values) {
addCriterion("unlike in", values, "unlike");
return (Criteria) this;
}
public Criteria andUnlikeNotIn(List<Integer> values) {
addCriterion("unlike not in", values, "unlike");
return (Criteria) this;
}
public Criteria andUnlikeBetween(Integer value1, Integer value2) {
addCriterion("unlike between", value1, value2, "unlike");
return (Criteria) this;
}
public Criteria andUnlikeNotBetween(Integer value1, Integer value2) {
addCriterion("unlike not between", value1, value2, "unlike");
return (Criteria) this;
}
public Criteria andToppingIsNull() {
addCriterion("topping is null");
return (Criteria) this;
@ -564,6 +684,76 @@ public class LearnMessageExample {
addCriterion("topping not between", value1, value2, "topping");
return (Criteria) this;
}
public Criteria andUserNameIsNull() {
addCriterion("user_name is null");
return (Criteria) this;
}
public Criteria andUserNameIsNotNull() {
addCriterion("user_name is not null");
return (Criteria) this;
}
public Criteria andUserNameEqualTo(String value) {
addCriterion("user_name =", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotEqualTo(String value) {
addCriterion("user_name <>", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameGreaterThan(String value) {
addCriterion("user_name >", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameGreaterThanOrEqualTo(String value) {
addCriterion("user_name >=", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLessThan(String value) {
addCriterion("user_name <", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLessThanOrEqualTo(String value) {
addCriterion("user_name <=", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLike(String value) {
addCriterion("user_name like", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotLike(String value) {
addCriterion("user_name not like", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameIn(List<String> values) {
addCriterion("user_name in", values, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotIn(List<String> values) {
addCriterion("user_name not in", values, "userName");
return (Criteria) this;
}
public Criteria andUserNameBetween(String value1, String value2) {
addCriterion("user_name between", value1, value2, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotBetween(String value1, String value2) {
addCriterion("user_name not between", value1, value2, "userName");
return (Criteria) this;
}
}
/**

View File

@ -1,89 +0,0 @@
package club.joylink.rtss.entity;
import java.io.Serializable;
/**
* learn_message
* @author
*/
public class LearnMessageWithBLOBs extends LearnMessage implements Serializable {
/**
* 点赞的用户id
*/
private String like;
/**
* 点踩的用户id
*/
private String unlike;
private static final long serialVersionUID = 1L;
public String getLike() {
return like;
}
public void setLike(String like) {
this.like = like;
}
public String getUnlike() {
return unlike;
}
public void setUnlike(String unlike) {
this.unlike = unlike;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
LearnMessageWithBLOBs other = (LearnMessageWithBLOBs) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getPostId() == null ? other.getPostId() == null : this.getPostId().equals(other.getPostId()))
&& (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent()))
&& (this.getPictureUrls() == null ? other.getPictureUrls() == null : this.getPictureUrls().equals(other.getPictureUrls()))
&& (this.getCreatorId() == null ? other.getCreatorId() == null : this.getCreatorId().equals(other.getCreatorId()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getTopping() == null ? other.getTopping() == null : this.getTopping().equals(other.getTopping()))
&& (this.getLike() == null ? other.getLike() == null : this.getLike().equals(other.getLike()))
&& (this.getUnlike() == null ? other.getUnlike() == null : this.getUnlike().equals(other.getUnlike()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getPostId() == null) ? 0 : getPostId().hashCode());
result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode());
result = prime * result + ((getPictureUrls() == null) ? 0 : getPictureUrls().hashCode());
result = prime * result + ((getCreatorId() == null) ? 0 : getCreatorId().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getTopping() == null) ? 0 : getTopping().hashCode());
result = prime * result + ((getLike() == null) ? 0 : getLike().hashCode());
result = prime * result + ((getUnlike() == null) ? 0 : getUnlike().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", like=").append(like);
sb.append(", unlike=").append(unlike);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -4,8 +4,6 @@ import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.*;
import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.draftData.DraftMapFlankProtectionService;
import club.joylink.rtss.services.draftData.DraftMapRunLevelService;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
@ -27,7 +25,6 @@ import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Slf4j
@ -1398,7 +1395,7 @@ public class DraftMapService implements IDraftMapService {
return new PageVO<>(queryVO.getPageNum(), queryVO.getPageSize(), 0, new ArrayList<>());
}
List<MapDestinationCodeDefinitionVO> vos = JsonUtils.read(logicData, JsonUtils.getCollectionType(ArrayList.class, MapDestinationCodeDefinitionVO.class));
vos.sort(Comparator.comparing(o -> Integer.valueOf(o.getCode())));
// vos.sort(Comparator.comparing(o -> Integer.valueOf(o.getCode())));
int startIndex = (queryVO.getPageNum() - 1) * queryVO.getPageSize();
if (startIndex > vos.size() - 1) {
return new PageVO<>(queryVO.getPageNum(), queryVO.getPageSize(), 0, new ArrayList<>());

View File

@ -126,6 +126,31 @@ public interface ILearnService {
*/
void updatePost(Long postId, LearnPostUpdateVO updateVO, UserVO user);
/**
* 成都工业添加留言
*/
long cgyCreateMessage(LearnMessageCreateVO messageCreateVO);
/**
* 成都工业添加评论
*/
void cgyAddComment(Long messageId, LearnCreateVO commentCreateVO);
/**
* 管理员修改留言数据
*/
void adminUpdateMessage(LearnMessageUpdateVO messageUpdateVO);
/**
* 管理员修改评论数据
*/
void adminUpdateComment(LearnCommentUpdateVO commitUpdateVO);
/**
* 成工院留言时间打散
*/
void cgyUpdateMessageTime();
// /**
// * 点赞留言
// */

View File

@ -32,9 +32,8 @@ import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Slf4j
@ -157,8 +156,10 @@ public class LearnService implements ILearnService {
private LearnCommentVO convertComment(LearnComment comment) {
LearnCommentVO commentVO = new LearnCommentVO(comment);
// 用户昵称
String nickname = iSysUserService.findUserById(comment.getCreatorId()).getNickname();
commentVO.setUserNickname(nickname);
if (comment.getCreatorId() != null) {
String nickname = iSysUserService.findUserById(comment.getCreatorId()).getNickname();
commentVO.setUserNickname(nickname);
}
// 回复的用户的昵称
if (comment.getParentId() != null) {
commentVO.setReplyUserNickName(iSysUserService.findUserById(comment.getParentId()).getNickname());
@ -171,15 +172,14 @@ public class LearnService implements ILearnService {
}
@Override
public void addComment(Long messageId, LearnCreateVO postCreateVO, UserVO userVO) {
public void addComment(Long messageId, LearnCreateVO commentCreateVO, UserVO userVO) {
checkMessageExist(messageId);
if (SystemEnv.isPrdEnv(otherConfig.getEnv())) {
this.checkContent(postCreateVO.getContent());
this.checkContent(commentCreateVO.getContent());
}
LearnComment comment = new LearnComment();
comment.setContent(postCreateVO.getContent());
comment.setContent(commentCreateVO.getContent());
comment.setMessageId(messageId);
comment.setCreatorId(userVO.getId());
comment.setCreateTime(LocalDateTime.now());
learnCommentDAO.insertSelective(comment);
@ -274,7 +274,7 @@ public class LearnService implements ILearnService {
if (SystemEnv.isPrdEnv(otherConfig.getEnv())) {
this.checkContent(messageCreateVO.getContent());
}
LearnMessageWithBLOBs message = messageCreateVO.convert2DB(user.getId());
LearnMessage message = messageCreateVO.convert2DB(user.getId());
learnMessageDAO.insert(message);
LearnMessageExample example = new LearnMessageExample();
example.createCriteria().andPostIdEqualTo(messageCreateVO.getPostId());
@ -338,6 +338,112 @@ public class LearnService implements ILearnService {
learnPostDAO.updateByPrimaryKey(entity);
}
@Override
public long cgyCreateMessage(LearnMessageCreateVO messageCreateVO) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(StringUtils.hasText(messageCreateVO.getContent()),
"内容不能空白");
LearnMessage message = messageCreateVO.convert2DB(1L);
message.setCreatorId(null);
message.setUserName(messageCreateVO.getUserName());
learnMessageDAO.insert(message);
LearnMessageExample example = new LearnMessageExample();
example.createCriteria().andPostIdEqualTo(messageCreateVO.getPostId());
return learnMessageDAO.countByExample(example);
}
@Override
public void cgyAddComment(Long messageId, LearnCreateVO commentCreateVO) {
checkMessageExist(messageId);
LearnComment comment = new LearnComment();
comment.setContent(commentCreateVO.getContent());
comment.setMessageId(messageId);
comment.setCreateTime(LocalDateTime.now());
comment.setUserName(commentCreateVO.getUserName());
learnCommentDAO.insertSelective(comment);
}
@Override
public void adminUpdateMessage(LearnMessageUpdateVO messageUpdateVO) {
LearnMessage messageEntity = getMessageEntity(messageUpdateVO.getId());
messageEntity.setContent(messageUpdateVO.getContent());
messageEntity.setCreateTime(messageUpdateVO.getCreateTime());
learnMessageDAO.updateByPrimaryKey(messageEntity);
}
@Override
public void adminUpdateComment(LearnCommentUpdateVO commentUpdateVO) {
LearnComment commentEntity = getCommentEntity(commentUpdateVO.getId());
commentEntity.setMessageId(commentUpdateVO.getMessageId());
commentEntity.setContent(commentUpdateVO.getContent());
commentEntity.setCreatorId(commentUpdateVO.getCreatorId());
commentEntity.setCreateTime(commentUpdateVO.getCreateTime());
learnCommentDAO.updateByPrimaryKey(commentEntity);
}
// @Transactional
// @Override
// public void cgyUpdateMessageTime() {
// LearnMessageExample example = new LearnMessageExample();
// example.createCriteria().andPostIdEqualTo(27L);
// List<LearnMessage> list = learnMessageDAO.selectByExample(example);
// int send = 365 * 3 * 24 * 60 * 60;
// Random random = new Random();
// List<Integer> secondsOffsetList = new ArrayList<>();
// for (LearnMessage ignored : list) {
// secondsOffsetList.add(random.nextInt(send));
// }
// secondsOffsetList.sort((i1, i2) -> i2 - i1);
// LocalDateTime now = LocalDateTime.now();
// for (int i = 0; i < list.size(); i++) {
// LearnMessage message = list.get(i);
// message.setCreateTime(now.minusSeconds(secondsOffsetList.get(i)));
// learnMessageDAO.updateByPrimaryKey(message);
// }
// }
@Transactional
@Override
public void cgyUpdateMessageTime() {
LearnMessageExample example = new LearnMessageExample();
example.createCriteria().andPostIdEqualTo(27L);
List<LearnMessage> allMessage = learnMessageDAO.selectByExample(example);
//删重复数据
List<LearnMessage> list = allMessage.stream().collect(Collectors.toMap(LearnMessage::getContent, Function.identity(), (old, newValue) -> old))
.values().stream().sorted(Comparator.comparingLong(LearnMessage::getId)).collect(Collectors.toList());
HashSet<LearnMessage> distinctSet = new HashSet<>(list);
List<Long> deleteIds = allMessage.stream().filter(message -> !distinctSet.contains(message)).map(LearnMessage::getId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(deleteIds)) {
example.clear();
example.createCriteria().andIdIn(deleteIds);
learnMessageDAO.deleteByExample(example);
}
//修改时间
int day = 365 * 4;
Random random = new Random();
List<Integer> dayOffsetList = new ArrayList<>();
for (LearnMessage ignored : list) {
dayOffsetList.add(random.nextInt(day));
}
dayOffsetList.sort((i1, i2) -> i2 - i1);
Map<Integer, Long> dayCountMap = dayOffsetList.stream().collect(Collectors.groupingBy(Function.identity(), LinkedHashMap::new, Collectors.counting()));
int startIndex = 0;
LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
for (Integer dayOffset : dayCountMap.keySet()) {
List<Integer> secondsOffsetList = new ArrayList<>();
Long dayCount = dayCountMap.get(dayOffset);
for (int i = 0; i < dayCount; i++) {
secondsOffsetList.add(random.nextInt(24 * 3600 - 8 * 3600) + 8 * 3600);
secondsOffsetList.sort(Integer::compareTo);
}
for (int i = startIndex; i < startIndex + dayCount; i++) {
LearnMessage message = list.get(i);
message.setCreateTime(now.minusDays(dayOffset).plusSeconds(secondsOffsetList.get(i - startIndex)));
learnMessageDAO.updateByPrimaryKey(message);
}
startIndex += dayCount;
}
}
// @Override
// public Integer likeMessage(Long messageId) {
// LearnMessageWithBLOBs message = getMessage(messageId);
@ -408,12 +514,12 @@ public class LearnService implements ILearnService {
String.format("id为[%s]的留言不存在", messageId));
}
private LearnMessageWithBLOBs findMessageEntity(Long messageId) {
private LearnMessage findMessageEntity(Long messageId) {
return learnMessageDAO.selectByPrimaryKey(messageId);
}
private LearnMessageWithBLOBs getMessageEntity(Long messageId) {
LearnMessageWithBLOBs message = findMessageEntity(messageId);
private LearnMessage getMessageEntity(Long messageId) {
LearnMessage message = findMessageEntity(messageId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(message, String.format("id为[%s]的留言不存在", messageId));
return message;
}

View File

@ -1095,8 +1095,12 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (!CollectionUtils.isEmpty(ignoreEndCodeList)) {
if (ignoreEndCodeList.contains(route.getDestination().getCode())) {
removeList.add(route);
continue;
}
}
if (signal.isNoRoute()) {
removeList.add(route);
}
}
generatedRouteList.removeAll(removeList);
}

View File

@ -356,6 +356,10 @@ public class Operation {
Train_Set_Route,
/** 设置运行类型 */
Train_Set_Run_Type,
/** 下令停车 */
Train_Order_Stop,
/** 取消停车命令 */
Train_Cancel_Order_Stop,
//--------------------------- 司机 ---------------------------
/** 改变列车的牵引/制动力 */

View File

@ -333,4 +333,14 @@ public class TrainOperateHandler {
public void setRunType(Simulation simulation, String groupNumber, VirtualRealityTrain.RunType runType) {
atsTrainService.setRunType(simulation, groupNumber, runType);
}
@OperateHandlerMapping(type = Operation.Type.Train_Order_Stop)
public void orderStop(Simulation simulation, String groupNumber) {
atsTrainService.orderStop(simulation, groupNumber);
}
@OperateHandlerMapping(type = Operation.Type.Train_Cancel_Order_Stop)
public void cancelOrderStop(Simulation simulation, String groupNumber) {
atsTrainService.cancelOrderStop(simulation, groupNumber);
}
}

View File

@ -171,9 +171,9 @@ public class AtsPlanService {
// 更新扣车状态
if (!Objects.equals(train.isHold(), hold)) {
if (hold) {
this.onboardAtpApiService.holdTrain(simulation, train.getGroupNumber());
this.onboardAtpApiService.standHoldTrain(simulation, train.getGroupNumber());
} else {
this.onboardAtpApiService.cancelHoldTrain(simulation, train.getGroupNumber());
this.onboardAtpApiService.standCancelHoldTrain(simulation, train.getGroupNumber());
}
}
} else {

View File

@ -341,7 +341,7 @@ public class AtsStandService {
if (trainInfo.isParkingStand(stand) ||
Objects.equals(stand.getSection().getCode(),
trainInfo.getEstimatedArriveStandTrack())) {
this.onboardAtpApiService.holdTrain(simulation, trainInfo.getGroupNumber());
this.onboardAtpApiService.standHoldTrain(simulation, trainInfo.getGroupNumber());
}
}
}
@ -391,7 +391,7 @@ public class AtsStandService {
for (TrainInfo trainInfo : superviseTrainList) {
if (trainInfo.isParkingStand(stand) ||
Objects.equals(stand.getSection().getCode(), trainInfo.getEstimatedArriveStandTrack())) {
this.onboardAtpApiService.cancelHoldTrain(simulation, trainInfo.getGroupNumber());
this.onboardAtpApiService.standCancelHoldTrain(simulation, trainInfo.getGroupNumber());
}
}
}
@ -426,7 +426,7 @@ public class AtsStandService {
for (TrainInfo trainInfo : superviseTrainList) {
if (trainInfo.isParkingStand(stand) ||
Objects.equals(stand.getSection().getCode(), trainInfo.getPlanStandTrack())) {
this.onboardAtpApiService.cancelHoldTrain(simulation, trainInfo.getGroupNumber());
this.onboardAtpApiService.standCancelHoldTrain(simulation, trainInfo.getGroupNumber());
}
}
}

View File

@ -489,112 +489,12 @@ public class AtsTrainService {
Section destinationSection = destinationCodeDefinition.getSection();
Boolean destinationRight = destinationCodeDefinition.getRight();
switch (destinationCodeDefinition.getType()) {
case NORMAL_OPERATION: {
if (Objects.isNull(estimatedArriveStandTrack)) {
return;
}
Station leftStation = destinationCodeDefinition.getLeftStation();
Station rightStation = destinationCodeDefinition.getRightStation();
if (Math.min(leftStation.getSn(), rightStation.getSn()) > targetStation.getSn()
|| targetStation.getSn() > Math.max(leftStation.getSn(), rightStation.getSn())) { //超出环路范围
log.warn(String.format("仿真[%s]列车[%s]目标轨不在环路范围内", simulation.getGroup(), train.getGroupNumber()));
break;
}
Station station = destinationCodeDefinition.getStationOf(trainRight);
if (Objects.equals(station.getSn(), targetStation.getSn())) { //已经抵达同向边界车站
if (targetSection.isNormalStandTrack()) { //如果是在站台轨并开始折返
List<Section> turnBackList = targetStation.getTurnBackList();
if (!CollectionUtils.isEmpty(turnBackList)) {
nextTarget = turnBackList.get(0);
// 站后折返
train.startTurnBack(nextTarget);
// 开始折返
this.onboardAtpApiService.startTurnBack(simulation, train.getGroupNumber(),
nextTarget.getCode());
break;
}
}
} else { //未抵达同向边界车站
Station adjacentStation = repository.findAdjacentStation(targetStation, trainRight);
Optional<Stand> first;
if ((adjacentStation.equals(leftStation)
|| adjacentStation.equals(rightStation))
&& destinationCodeDefinition.isFrontTurnBack(adjacentStation)) { //相邻站是环路的边界车站且是站前折返
first = adjacentStation.getStandOf(!trainRight).stream().filter(stand -> !stand.isSmall()).limit(1).findFirst();
} else {
first = adjacentStation.getStandOf(trainRight).stream().filter(stand -> !stand.isSmall()).limit(1).findFirst();
}
if (first.isPresent()) {
nextTarget = first.get().getSection();
} else {
log.warn(String.format("地图[%s]车站[%s]所有站台都是小站台", mapId, adjacentStation.getCode()));
}
}
if (targetSection.isTurnBackTrack()) { //如果是在折返轨选择能到达的站台
for (Stand stand : targetStation.getAllStandList()) {
Section section = stand.getSection();
if (!CollectionUtils.isEmpty(repository.queryRoutePaths(targetSection, section))) {
nextTarget = section;
break;
}
}
}
break;
}
case NORMAL_OPERATION:
case LAST_OPERATION:
case NON_OPERATION:
case LAST_NON_OPERATION:
if (Objects.isNull(estimatedArriveStandTrack)) {
return;
}
if (!targetSection.isTurnBackTrack()) {
if (!Objects.equals(trainRight, destinationRight)) {
log.warn(String.format("仿真[%s]列车[%s]目标轨方向和目的地码方向不同", simulation.getGroup(), train.getGroupNumber()));
break;
}
//如果列车目标轨已经超出目的地码的对应区段
if (trainRight) {
if (targetStation.getSn() >= destinationSection.getStation().getSn()) {
break;
}
} else {
if (targetStation.getSn() <= destinationSection.getStation().getSn()) {
break;
}
}
}
//-------------------------- 找下一目标轨 --------------------------
Station adjacentStation = repository.findAdjacentStation(targetStation, destinationRight);
Section lastRunPathSection = destinationCodeDefinition.getLastSectionFromRunPath();
//---运行路径最后一个区段存在且列车没有越过时找相邻车站并注意路径---
if (lastRunPathSection != null) {
Station lastStationOnPath = lastRunPathSection.getStation();
//如果列车目标车站没有到达/越过目的地码运行路径的最后一个车站
if ((destinationRight && targetStation.getSn() < lastStationOnPath.getSn())
|| (!destinationRight && targetStation.getSn() > lastStationOnPath.getSn())) {
if (adjacentStation == null) {
break;
}
for (Stand stand : adjacentStation.getAllStandList()) {
if (destinationCodeDefinition.isOnThePath(stand.getSection())) {
nextTarget = stand.getSection();
break;
}
}
}
}
//尝试找到直达终点的路径
if (!CollectionUtils.isEmpty(repository.queryRoutePaths(targetSection, destinationSection))) {
nextTarget = destinationSection;
break;
}
//找到相邻车站的同向站台轨
for (Stand stand : adjacentStation.getStandOf(destinationRight)) {
if (!stand.isSmall()) {
nextTarget = stand.getSection();
break;
}
if (targetSection != null) {
nextTarget = destinationCodeDefinition.queryNextFunctionSection(targetSection);
}
break;
case OTHER:
@ -722,9 +622,9 @@ public class AtsTrainService {
// 更新扣车状态
if (!Objects.equals(train.isHold(), hold)) {
if (hold) {
this.onboardAtpApiService.holdTrain(simulation, train.getGroupNumber());
this.onboardAtpApiService.standHoldTrain(simulation, train.getGroupNumber());
} else {
this.onboardAtpApiService.cancelHoldTrain(simulation, train.getGroupNumber());
this.onboardAtpApiService.standCancelHoldTrain(simulation, train.getGroupNumber());
}
}
@ -795,14 +695,20 @@ public class AtsTrainService {
* 扣车
*/
public void hold(Simulation simulation, String groupNumber) {
onboardAtpApiService.holdTrain(simulation, groupNumber);
simulation.getRepository().getOnlineTrainList().forEach(train -> {
train.setTrainHold(true);
train.setHold(true);
});
}
/**
* 取消扣车
*/
public void cancelHold(Simulation simulation, String groupNumber) {
onboardAtpApiService.cancelHoldTrain(simulation, groupNumber);
simulation.getRepository().getOnlineTrainList().forEach(train -> {
train.setTrainHold(false);
train.setHold(false);
});
}
/**
@ -904,4 +810,42 @@ public class AtsTrainService {
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
train.setRunType(runType);
}
/**
* 设置全线列车扣车
*/
public void setAllHold(Simulation simulation) {
simulation.getRepository().getOnlineTrainList().forEach(train->{
train.setTrainHold(true);
train.setHold(true);
});
}
/**
* 取消权限列车扣车
*/
public void cancelAllHold(Simulation simulation) {
simulation.getRepository().getOnlineTrainList().forEach(train -> {
if (train.isTrainHold()) {
train.setTrainHold(false);
train.setHold(false);
}
});
}
/**
* 下令停车
*/
public void orderStop(Simulation simulation, String groupNumber) {
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
train.setOrderStop(true);
}
/**
* 取消停车命令
*/
public void cancelOrderStop(Simulation simulation, String groupNumber) {
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
train.setOrderStop(false);
}
}

View File

@ -14,8 +14,8 @@ import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.fault.FaultRuleVO;
import club.joylink.rtss.vo.client.map.DestinationCodeVO;
import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.map.newmap.MapDestinationCodeDefinitionVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
import club.joylink.rtss.vo.client.runplan.PlanTripNumberVO;
import club.joylink.rtss.vo.client.runplan.RunPlanEChartsDataVO;
@ -250,8 +250,9 @@ public interface GroupSimulationService {
/**
* 获取所有目的地码
* @return
*/
List<MapDestinationCodeDefinitionVO> getAllDestinationCode(String group);
List<DestinationCodeVO> getAllDestinationCode(String group);
/**
* 获取仿真报警列表

View File

@ -23,6 +23,7 @@ import club.joylink.rtss.simulation.cbtc.command.CommandInitiateVO;
import club.joylink.rtss.simulation.cbtc.communication.vo.fault.DeviceFaultInfo;
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.DestinationCodeDefinition;
import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice;
import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan;
import club.joylink.rtss.simulation.cbtc.data.storage.StorageSimulation;
@ -45,8 +46,8 @@ import club.joylink.rtss.vo.client.*;
import club.joylink.rtss.vo.client.company.CompanyVO;
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
import club.joylink.rtss.vo.client.fault.FaultRuleVO;
import club.joylink.rtss.vo.client.map.DestinationCodeVO;
import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.map.newmap.MapDestinationCodeDefinitionVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
import club.joylink.rtss.vo.client.runplan.*;
@ -852,9 +853,11 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
}
@Override
public List<MapDestinationCodeDefinitionVO> getAllDestinationCode(String group) {
public List<DestinationCodeVO> getAllDestinationCode(String group) {
Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
return simulation.getBuildParams().getMap().getLogicDataNew().getDestinationCodeDefinitionList();
Map<String, DestinationCodeDefinition> destinationMap = simulation.getRepository().getDestinationMap();
return simulation.getBuildParams().getMap().getLogicDataNew().getDestinationCodeDefinitionList()
.stream().map(vo -> new DestinationCodeVO(destinationMap.get(vo.getCode()))).collect(Collectors.toList());
}
@Override

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.simulation.cbtc.build;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
import club.joylink.rtss.simulation.cbtc.data.map.*;
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
@ -524,18 +525,25 @@ public class InterlockBuilder2 {
}
Set<String> checkCodeDuplicateSet = new HashSet<>(); //用于检查code重复
// List<Station> sortedBySnStations = elementMap.values().stream()
// .filter(element -> MapElement.DeviceType.STATION.equals(element.getDeviceType()))
// .map(element -> (Station) element)
// .sorted(Comparator.comparingInt(Station::getSn))
// .collect(Collectors.toList());
for (MapDestinationCodeDefinitionVO vo : destinationCodeDefinitionList) {
//构建目的地码定义需要的所有参数
String code = null;
DestinationCodeDefinition.Type type = null;
String description = null;
Section section = null;
Boolean right = vo.getRight();
List<Section> necessarySections = new ArrayList<>();
Station leftStation = null;
Station rightStation = null;
Boolean rightFrontTurnBack = null;
List<Section> runPath = null;
Station stationA = null;
Boolean stationAFrontTurnBack = vo.getStationAFrontTurnBack();
Station stationB = null;
Boolean stationBFrontTurnBack = vo.getStationBFrontTurnBack();
Boolean leftFrontTurnBack = null;
code = vo.getCode();
if (!checkCodeDuplicateSet.add(code)) {
@ -546,8 +554,12 @@ public class InterlockBuilder2 {
errMsgList.add(String.format("目的地码[%s]没有类型", code));
continue;
}
if (!CollectionUtils.isEmpty(vo.getRunPath())) {
necessarySections = vo.getRunPath().stream().map(pathSectionCode -> (Section) elementMap.get(pathSectionCode))
.collect(Collectors.toList());
}
switch (type) {
case NORMAL_OPERATION:
case NORMAL_OPERATION: {
description = vo.getDescription();
if (!StringUtils.hasText(description)) {
errMsgList.add(String.format("目的地码[%s]没有描述", code));
@ -560,9 +572,46 @@ public class InterlockBuilder2 {
errMsgList.add(String.format("环路类目的地码[%s]没有车站B", code));
continue;
}
stationA = (Station) elementMap.get(vo.getStationACode());
stationB = (Station) elementMap.get(vo.getStationBCode());
Station stationA = (Station) elementMap.get(vo.getStationACode());
Station stationB = (Station) elementMap.get(vo.getStationBCode());
boolean stationAFrontTurnBack = vo.getStationAFrontTurnBack() != null ? vo.getStationAFrontTurnBack() : false;
boolean stationBFrontTurnBack = vo.getStationBFrontTurnBack() != null ? vo.getStationBFrontTurnBack() : false;
if (stationA.getSn() > stationB.getSn()) {
leftStation = stationB;
leftFrontTurnBack = stationBFrontTurnBack;
rightStation = stationA;
rightFrontTurnBack = stationAFrontTurnBack;
} else {
leftStation = stationA;
leftFrontTurnBack = stationAFrontTurnBack;
rightStation = stationB;
rightFrontTurnBack = stationBFrontTurnBack;
}
//从左边车站右行站台站台轨开始构建运行路径--- 不标准的目的地码定义数据会导致运行路径构建错误
Set<Section> necessarySectionSet = new HashSet<>(necessarySections); //必经区段副本
Section startSection = null; //查询路径的起始区段
Section endSection = null; //查询路径的终点区段
runPath = new ArrayList<>();
//从左端车站开始选择路径
startSection = screeningSection4DestinationCode(leftStation, leftFrontTurnBack, necessarySectionSet, true);
runPath.add(startSection);
endSection = screeningSection4DestinationCode(rightStation, rightFrontTurnBack, necessarySectionSet, false);
//查询并添加路径
RoutePath optimalPath = CalculateService.queryShortestRoutePath(startSection, endSection, necessarySectionSet, true);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(optimalPath,
String.format("从%s到%s的路径未找到", startSection.debugStr(), endSection.debugStr()));
runPath.addAll(optimalPath.getSectionList());
//寻找反向的路径
Section t = startSection;
startSection = endSection;
endSection = t;
runPath.add(startSection);
RoutePath optimalPath2 = CalculateService.queryShortestRoutePath(startSection, endSection, necessarySectionSet, false);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(optimalPath2,
String.format("从%s到%s的路径未找到", startSection.debugStr(), endSection.debugStr()));
runPath.addAll(optimalPath2.getSectionList());
break;
}
case LAST_OPERATION:
case NON_OPERATION:
case LAST_NON_OPERATION:
@ -580,18 +629,46 @@ public class InterlockBuilder2 {
continue;
}
section = (Section) elementMap.get(vo.getSectionCode());
if (!CollectionUtils.isEmpty(vo.getRunPath())) {
runPath = vo.getRunPath().stream().map(pathSectionCode -> (Section) elementMap.get(pathSectionCode))
.collect(Collectors.toList());
}
break;
}
DestinationCodeDefinition destinationCodeDefinition = new DestinationCodeDefinition(code, type, description, section,
right, runPath, stationA, stationAFrontTurnBack, stationB, stationBFrontTurnBack);
right, necessarySections, leftStation, leftFrontTurnBack, rightStation, rightFrontTurnBack, runPath);
destinationMap.put(code, destinationCodeDefinition);
}
}
/**
* 为目的码筛选区段
*
* @param station
* @param ftb 是否站前折返
* @param preferredSections 优先区段
* @param right 站前折返时是否优先选择右向站台轨
*/
private static Section screeningSection4DestinationCode(Station station, Boolean ftb, Set<Section> preferredSections, boolean right) {
Section section;
if (ftb) {
Optional<Section> selectedSectionOptional = preferredSections.stream()
.filter(ns -> ns.isNormalStandTrack() && station.equals(ns.getStation())).limit(1).findAny(); //查询指定的站台轨
if (selectedSectionOptional.isPresent()) {
section = selectedSectionOptional.get();
} else { //没有指定折返轨
Section rdStandTack = station.getNormalStand(right).get(0).getSection();
if (rdStandTack.isTurnBackTrack()) {
section = rdStandTack;
} else {
section = station.getNormalStand(!right).get(0).getSection();
}
}
} else {
Optional<Section> selectedSectionOptional = preferredSections.stream()
.filter(ns -> ns.isTurnBackTrack() && station.equals(ns.getStation())).limit(1).findAny();
section = selectedSectionOptional.orElseGet(() -> station.getTurnBackList().get(0));
}
return section;
}
private static List<Routing> checkAndBuildRouting(List<MapRoutingDataVO> routingVOList, Map<String, MapElement> elementMap, List<String> errMsgList) {
List<Routing> routingList = new ArrayList<>();
if (CollectionUtils.isEmpty(routingVOList)) {

View File

@ -894,6 +894,7 @@ public class MapDeviceBuilder {
}
signal.setRouteEnd(signalVO.isRouteEnd());
signal.setIgnoreRouteEnd(signalVO.getIgnoreRouteEnd());
signal.setNoRoute(signalVO.isNoRoute());
signal.setCtc(signalVO.isCtc());
signal.setCallOn(signalVO.isCallOn());
signal.setTurnBack(signalVO.isTurnBack());

View File

@ -653,6 +653,43 @@ public class CalculateService {
return list;
}
/**
* 查询最短的进路路径
* @param preferredSections 优先经过这些区段可以为null
*/
public static RoutePath queryShortestRoutePath(Section startSection, Section endSection, Set<Section> preferredSections, boolean toRight) {
List<RoutePath> routePaths = CalculateService.queryRoutePathsOnDirection(startSection, endSection, toRight);
if (CollectionUtils.isEmpty(routePaths)) {
return null;
} else {
if (!CollectionUtils.isEmpty(preferredSections)) { //按经过优先区段的数量和长度筛选最优路径
RoutePath optimalPath = null;
int preferredSectionNum = 0;
for (RoutePath routePath : routePaths) {
int num = 0;
for (Section section : preferredSections) {
if (routePath.containsSection(section)) {
num ++;
}
}
if (optimalPath == null) {
optimalPath = routePath;
preferredSectionNum = num;
} else {
if (num > preferredSectionNum) {
preferredSectionNum = num;
optimalPath = routePath;
} else if (num == preferredSectionNum && routePath.getLength() < optimalPath.getLength()) {
optimalPath = routePath;
}
}
}
return optimalPath;
}
return routePaths.stream().min(Comparator.comparingDouble(RoutePath::getLength)).orElse(null);
}
}
private static void queryRoutePaths(int iter, Section section, RoutePath routePath,
List<RoutePath> list, List<String> warnList) {
if (section == null) {
@ -660,7 +697,7 @@ public class CalculateService {
routePath.debugStr(), routePath.getLastSection().debugStr()));
return;
}
if (iter > 10) {
if (iter > 100) {
warnList.add(String.format("进路路径[%s]未找到迭代10次,最后区段为[%s]",
routePath.debugStr(), routePath.getLastSection().debugStr()));
return;

View File

@ -26,9 +26,9 @@ public class DestinationCodeDefinition {
private Boolean right;
/**
* 运行路径sectionCode
* 必经区段
*/
private List<Section> runPath;
private List<Section> necessarySections;
//----------- 环路类属性 -----------
/**
* 车站A
@ -50,31 +50,30 @@ public class DestinationCodeDefinition {
*/
private Boolean rightFrontTurnBack;
//根据目的地码的定义数据生成路径
/**
* 目的地码代表的运行路径物理区段
*/
private List<Section> runPath;
public DestinationCodeDefinition(String code, Type type, Section section) {
this(code, type, null, section, null, null, null, null, null, null);
this(code, type, null, section, null, null, null, null, null, null, null);
}
public DestinationCodeDefinition(String code, Type type, String description, Section section, Boolean right,
List<Section> runPath, Station stationA, Boolean stationAFrontTurnBack, Station stationB, Boolean stationBFrontTurnBack) {
List<Section> necessarySections, Station leftStation, Boolean leftFrontTurnBack,
Station rightStation, Boolean rightFrontTurnBack, List<Section> runPath) {
this.code = code;
this.type = type;
this.description = description;
this.section = section;
this.right = right;
this.necessarySections = necessarySections;
this.leftStation = leftStation;
this.leftFrontTurnBack = leftFrontTurnBack;
this.rightStation = rightStation;
this.rightFrontTurnBack = rightFrontTurnBack;
this.runPath = runPath;
if (Objects.nonNull(stationA) && Objects.nonNull(stationB)) {
if (stationA.getSn() > stationB.getSn()) {
this.leftStation = stationB;
this.leftFrontTurnBack = stationBFrontTurnBack;
this.rightStation = stationA;
this.rightFrontTurnBack = stationAFrontTurnBack;
} else {
this.leftStation = stationA;
this.leftFrontTurnBack = stationAFrontTurnBack;
this.rightStation = stationB;
this.rightFrontTurnBack = stationBFrontTurnBack;
}
}
}
/**
@ -93,8 +92,8 @@ public class DestinationCodeDefinition {
* 获取运行路径上最后一个区段
*/
public Section getLastSectionFromRunPath() {
if (!CollectionUtils.isEmpty(runPath)) {
return runPath.get(runPath.size() - 1);
if (!CollectionUtils.isEmpty(necessarySections)) {
return necessarySections.get(necessarySections.size() - 1);
}
return null;
}
@ -103,10 +102,10 @@ public class DestinationCodeDefinition {
* 该区段在运行路径上
*/
public boolean isOnThePath(Section section) {
if (CollectionUtils.isEmpty(runPath)) {
if (CollectionUtils.isEmpty(necessarySections)) {
return false;
}
return runPath.stream().anyMatch(path -> Objects.equals(path, section));
return necessarySections.stream().anyMatch(path -> Objects.equals(path, section));
}
public boolean isLoop() {
@ -171,8 +170,8 @@ public class DestinationCodeDefinition {
return false;
}
// 暂时判断逻辑为或者是runPath中一个或者是范围内车站且是对应方向站台
if (!CollectionUtils.isEmpty(this.runPath)) {
return this.runPath.contains(section);
if (!CollectionUtils.isEmpty(this.necessarySections)) {
return this.necessarySections.contains(section);
}
if (Objects.nonNull(station)) {
if (!CollectionUtils.isEmpty(section.getStandList()) &&
@ -196,6 +195,46 @@ public class DestinationCodeDefinition {
return station.equals(leftStation) || station.equals(rightStation);
}
/**
* 查询下一个功能区段
*/
public Section queryNextFunctionSection(Section currentSection) {
int index = runPath.indexOf(currentSection);
if (index == -1) {
return null;
} else if (index == runPath.size() - 1) {
if (!Type.NORMAL_OPERATION.equals(type)) {
return null;
}
}
if (!Type.NORMAL_OPERATION.equals(type)) { //非环路找到路径末就结束
for (int i = index + 1; i < runPath.size(); i++) {
Section section = runPath.get(i);
if (section.isFunctionTrack()) {
return section;
}
}
} else { //环路循环找
int next = index + 1;
for (int i = 0; i < runPath.size(); i++) {
if (next == runPath.size()) {
next = 0;
continue;
}
Section section = runPath.get(next);
if (section.isFunctionTrack()) {
return section;
}
next++;
}
}
return null;
}
public String logStr() {
return String.format("目的地码[%s]", code);
}
public enum Type {
/**
* 正常运营环路

View File

@ -80,6 +80,11 @@ public class Signal extends MayOutOfOrderDevice {
*/
private List<String> ignoreRouteEnd;
/**
* 不生成以该信号机为始端的进路
*/
private boolean noRoute;
/**
* 是否引导信号机
*/

View File

@ -1,6 +1,5 @@
package club.joylink.rtss.simulation.cbtc.data.status;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import club.joylink.rtss.simulation.cbtc.constant.DriveMode;
import club.joylink.rtss.simulation.cbtc.constant.PlanRoutingType;
import club.joylink.rtss.simulation.cbtc.constant.RunLevel;
@ -10,6 +9,7 @@ import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
import club.joylink.rtss.simulation.cbtc.data.vo.TrainStatusVO;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter;
import lombok.Setter;
@ -103,6 +103,8 @@ public class TrainStatus extends DeviceStatus {
@JsonSerialize(using = Boolean2NumSerializer.class)
private boolean backUp;
private boolean orderStop;
public TrainStatus(TrainInfo train) {
super(train.getGroupNumber(), MapElement.DeviceType.TRAIN);
this.groupNumber = train.getGroupNumber();
@ -128,6 +130,7 @@ public class TrainStatus extends DeviceStatus {
this.hold = train.isHold();
this.dt = train.getDt();
this.backUp = train.isBackUp();
this.orderStop = train.isOrderStop();
}
/**
@ -243,6 +246,11 @@ public class TrainStatus extends DeviceStatus {
status.setDt(this.dt);
change = true;
}
if (!Objects.equals(this.orderStop, train.isOrderStop())) {
this.orderStop = train.isOrderStop();
status.setOrderStop(this.orderStop);
change = true;
}
return change;
}

View File

@ -146,6 +146,9 @@ public class TrainInfo extends MapElement {
@Setter
private List<Section> headPath;
/** 下令停车 */
private boolean orderStop;
public TrainInfo(String groupNumber) {
super(groupNumber, DeviceType.TRAIN);
this.groupNumber = groupNumber;
@ -253,6 +256,7 @@ public class TrainInfo extends MapElement {
this.hold = train.isHold();
this.priorityRouteSet = train.isHold();
this.backUp = train.isBackUp();
this.orderStop = train.isOrderStop();
}
public boolean isCbtcTrack() {

View File

@ -1,13 +1,13 @@
package club.joylink.rtss.simulation.cbtc.data.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import club.joylink.rtss.simulation.cbtc.constant.DriveMode;
import club.joylink.rtss.simulation.cbtc.constant.PlanRoutingType;
import club.joylink.rtss.simulation.cbtc.constant.RunLevel;
import club.joylink.rtss.simulation.cbtc.constant.TrainType;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@ -102,6 +102,9 @@ public class TrainStatusVO extends DeviceStatusVO {
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean backUp;
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean orderStop;
public TrainStatusVO(TrainInfo train) {
super(train.getGroupNumber(), MapElement.DeviceType.TRAIN);
}

View File

@ -266,6 +266,11 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
*/
private boolean hold;
/**
* 当前扣车是否是列车扣车联合hold使用
*/
private boolean trainHold;
/**
* 是否自动折返中
*/
@ -373,6 +378,11 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
*/
private RunType runType;
/**
* 下令停车
*/
private boolean orderStop;
public void setRunType(RunType runType) {
this.runType = runType;
switch (runType) {
@ -435,6 +445,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
this.nextParking = false;
this.jump = false;
this.hold = false;
this.trainHold = false;
this.terminalStation = null;
this.headPosition = null;
this.robotTargetPosition = null;

View File

@ -75,6 +75,10 @@ public class ATOService {
if (!train.isPowerOn() || !train.isAtoOn()) {
return;
}
//下令停车
if (train.isOrderStop()) {
this.doBreakMax(train);
}
// 计算到目标/授权终点剩余距离根据距离计算速度根据速度控制牵引/制动输出
MovementAuthority ma = train.getMa();
if (Objects.isNull(ma)) {

View File

@ -64,14 +64,14 @@ public interface OnboardAtpApiService {
* @param simulation
* @param groupNumber
*/
void holdTrain(Simulation simulation, String groupNumber);
void standHoldTrain(Simulation simulation, String groupNumber);
/**
* 取消扣车
* @param simulation
* @param groupNumber
*/
void cancelHoldTrain(Simulation simulation, String groupNumber);
void standCancelHoldTrain(Simulation simulation, String groupNumber);
/**
* 设置跳停

View File

@ -131,17 +131,21 @@ public class OnboardAtpApiServiceImpl implements OnboardAtpApiService {
}
@Override
public void holdTrain(Simulation simulation, String groupNumber) {
public void standHoldTrain(Simulation simulation, String groupNumber) {
SimulationDataRepository repository = simulation.getRepository();
VirtualRealityTrain train = repository.getVRByCode(groupNumber, VirtualRealityTrain.class);
train.setHold(true);
if (!train.isTrainHold()) {
train.setHold(true);
}
}
@Override
public void cancelHoldTrain(Simulation simulation, String groupNumber) {
public void standCancelHoldTrain(Simulation simulation, String groupNumber) {
SimulationDataRepository repository = simulation.getRepository();
VirtualRealityTrain train = repository.getVRByCode(groupNumber, VirtualRealityTrain.class);
train.setHold(false);
if (!train.isTrainHold()) {
train.setHold(false);
}
}
@Override

View File

@ -0,0 +1,25 @@
package club.joylink.rtss.vo.client.learn;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
/**
* 评论数据更新
*/
@Getter
@Setter
@NoArgsConstructor
public class LearnCommentUpdateVO {
private Long id;
private Long messageId;
private String content;
private Long creatorId;
private LocalDateTime createTime;
}

View File

@ -1,9 +1,9 @@
package club.joylink.rtss.vo.client.learn;
import club.joylink.rtss.entity.LearnComment;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import club.joylink.rtss.entity.LearnComment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
@ -51,6 +51,8 @@ public class LearnCommentVO {
@ApiModelProperty(value = "回复数")
private Long commentCount;
private String cgyUserName;
public LearnCommentVO(LearnComment comment) {
this.id = comment.getId();
this.messageId = comment.getMessageId();
@ -60,5 +62,6 @@ public class LearnCommentVO {
this.unlike = comment.getUnlike();
this.commentTime = comment.getCreateTime();
this.replyUserId = comment.getParentId();
this.cgyUserName = comment.getUserName();
}
}

View File

@ -16,4 +16,6 @@ public class LearnCreateVO {
@NotBlank(message = "内容不能为空", groups = {LearnPostCreateCheck.class, LearnCommentCreateCheck.class})
private String content;
private String userName;
}

View File

@ -0,0 +1,23 @@
package club.joylink.rtss.vo.client.learn;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
/**
* 留言板留言更新
*/
@Getter
@Setter
@NoArgsConstructor
public class LearnMessageUpdateVO {
private Long id;
private String content;
private LocalDateTime createTime;
private Long creatorId;
}

View File

@ -0,0 +1,33 @@
package club.joylink.rtss.vo.client.map;
import club.joylink.rtss.simulation.cbtc.data.map.DestinationCodeDefinition;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import lombok.Getter;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Getter
public class DestinationCodeVO {
private String code;
private String description;
private List<String> runPath;
public DestinationCodeVO(DestinationCodeDefinition definition) {
this.code = definition.getCode();
this.description = definition.getDescription();
if (!CollectionUtils.isEmpty(definition.getRunPath())) {
this.runPath = definition.getRunPath().stream().flatMap(section -> {
if (!CollectionUtils.isEmpty(section.getLogicList())) {
return section.getLogicList().stream();
} else {
return Stream.of(section);
}
}).map(MapElement::getCode).collect(Collectors.toList());
}
}
}

View File

@ -72,8 +72,8 @@ public class MapDestinationCodeDefinitionVO {
vo.sectionCode = definition.getSection().getCode();
}
vo.right = definition.getRight();
if (!CollectionUtils.isEmpty(definition.getRunPath())) {
vo.runPath =definition.getRunPath().stream().map(MapElement::getCode).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(definition.getNecessarySections())) {
vo.runPath =definition.getNecessarySections().stream().map(MapElement::getCode).collect(Collectors.toList());
}
return vo;
}

View File

@ -46,6 +46,9 @@ public class MapSignalNewVO {
@ApiModelProperty(value = "不生成进路的信号机终端")
private List<String> ignoreRouteEnd;
@ApiModelProperty("是否不生成进路")
private boolean noRoute;
/**
* 所属区段编码
*/

View File

@ -1,6 +1,6 @@
package club.joylink.rtss.vo.client.post;
import club.joylink.rtss.entity.LearnMessageWithBLOBs;
import club.joylink.rtss.entity.LearnMessage;
import club.joylink.rtss.util.JsonUtils;
import lombok.Getter;
import lombok.NoArgsConstructor;
@ -20,10 +20,12 @@ public class LearnMessageCreateVO {
private String content;
private String userName;
private List<String> pictureUrls;
public LearnMessageWithBLOBs convert2DB(Long userId) {
LearnMessageWithBLOBs message = new LearnMessageWithBLOBs();
public LearnMessage convert2DB(Long userId) {
LearnMessage message = new LearnMessage();
message.setPostId(postId);
message.setContent(content);
message.setPictureUrls(JsonUtils.writeValueAsString(pictureUrls));

View File

@ -1,10 +1,10 @@
package club.joylink.rtss.vo.client.post;
import com.fasterxml.jackson.annotation.JsonIgnore;
import club.joylink.rtss.entity.LearnMessage;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.learn.LearnCommentVO;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@ -71,6 +71,11 @@ public class LearnMessageVO {
*/
private Boolean topping;
/**
* 成工业留言板用户名
*/
private String cgyUserName;
private PageVO<LearnCommentVO> comments;
public LearnMessageVO(LearnMessage message) {

View File

@ -11,6 +11,7 @@
<result column="parent_id" jdbcType="BIGINT" property="parentId" />
<result column="like" jdbcType="INTEGER" property="like" />
<result column="unlike" jdbcType="INTEGER" property="unlike" />
<result column="user_name" jdbcType="VARCHAR" property="userName" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -71,7 +72,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, message_id, content, creator_id, create_time, root_id, parent_id, `like`, unlike
id, message_id, content, creator_id, create_time, root_id, parent_id, `like`, unlike,
user_name
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.LearnCommentExample" resultMap="BaseResultMap">
select
@ -114,10 +116,12 @@
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.LearnComment" useGeneratedKeys="true">
insert into learn_comment (message_id, content, creator_id,
create_time, root_id, parent_id,
`like`, unlike)
`like`, unlike, user_name
)
values (#{messageId,jdbcType=BIGINT}, #{content,jdbcType=VARCHAR}, #{creatorId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{rootId,jdbcType=BIGINT}, #{parentId,jdbcType=BIGINT},
#{like,jdbcType=INTEGER}, #{unlike,jdbcType=INTEGER})
#{like,jdbcType=INTEGER}, #{unlike,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.LearnComment" useGeneratedKeys="true">
insert into learn_comment
@ -146,6 +150,9 @@
<if test="unlike != null">
unlike,
</if>
<if test="userName != null">
user_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="messageId != null">
@ -172,6 +179,9 @@
<if test="unlike != null">
#{unlike,jdbcType=INTEGER},
</if>
<if test="userName != null">
#{userName,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.LearnCommentExample" resultType="java.lang.Long">
@ -210,6 +220,9 @@
<if test="record.unlike != null">
unlike = #{record.unlike,jdbcType=INTEGER},
</if>
<if test="record.userName != null">
user_name = #{record.userName,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -225,7 +238,8 @@
root_id = #{record.rootId,jdbcType=BIGINT},
parent_id = #{record.parentId,jdbcType=BIGINT},
`like` = #{record.like,jdbcType=INTEGER},
unlike = #{record.unlike,jdbcType=INTEGER}
unlike = #{record.unlike,jdbcType=INTEGER},
user_name = #{record.userName,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -257,6 +271,9 @@
<if test="unlike != null">
unlike = #{unlike,jdbcType=INTEGER},
</if>
<if test="userName != null">
user_name = #{userName,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -269,7 +286,8 @@
root_id = #{rootId,jdbcType=BIGINT},
parent_id = #{parentId,jdbcType=BIGINT},
`like` = #{like,jdbcType=INTEGER},
unlike = #{unlike,jdbcType=INTEGER}
unlike = #{unlike,jdbcType=INTEGER},
user_name = #{userName,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -8,11 +8,10 @@
<result column="picture_urls" jdbcType="VARCHAR" property="pictureUrls" />
<result column="creator_id" jdbcType="BIGINT" property="creatorId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="topping" jdbcType="BIT" property="topping" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.LearnMessageWithBLOBs">
<result column="like" jdbcType="LONGVARCHAR" property="like" />
<result column="unlike" jdbcType="LONGVARCHAR" property="unlike" />
<result column="like" jdbcType="INTEGER" property="like" />
<result column="unlike" jdbcType="INTEGER" property="unlike" />
<result column="topping" jdbcType="TINYINT" property="topping" />
<result column="user_name" jdbcType="VARCHAR" property="userName" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -73,35 +72,9 @@
</where>
</sql>
<sql id="Base_Column_List">
id, post_id, content, picture_urls, creator_id, create_time, topping
id, post_id, content, picture_urls, creator_id, create_time, `like`, unlike, topping,
user_name
</sql>
<sql id="Blob_Column_List">
`like`, unlike
</sql>
<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.LearnMessageExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from learn_message
<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="selectByExample" parameterType="club.joylink.rtss.entity.LearnMessageExample" resultMap="BaseResultMap">
select
<if test="distinct">
@ -124,11 +97,9 @@
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from learn_message
where id = #{id,jdbcType=BIGINT}
</select>
@ -142,15 +113,17 @@
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.LearnMessageWithBLOBs" useGeneratedKeys="true">
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.LearnMessage" useGeneratedKeys="true">
insert into learn_message (post_id, content, picture_urls,
creator_id, create_time, topping,
`like`, unlike)
creator_id, create_time, `like`,
unlike, topping, user_name
)
values (#{postId,jdbcType=BIGINT}, #{content,jdbcType=VARCHAR}, #{pictureUrls,jdbcType=VARCHAR},
#{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{topping,jdbcType=BIT},
#{like,jdbcType=LONGVARCHAR}, #{unlike,jdbcType=LONGVARCHAR})
#{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{like,jdbcType=INTEGER},
#{unlike,jdbcType=INTEGER}, #{topping,jdbcType=TINYINT}, #{userName,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.LearnMessageWithBLOBs" useGeneratedKeys="true">
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.LearnMessage" useGeneratedKeys="true">
insert into learn_message
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="postId != null">
@ -168,15 +141,18 @@
<if test="createTime != null">
create_time,
</if>
<if test="topping != null">
topping,
</if>
<if test="like != null">
`like`,
</if>
<if test="unlike != null">
unlike,
</if>
<if test="topping != null">
topping,
</if>
<if test="userName != null">
user_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="postId != null">
@ -194,14 +170,17 @@
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="topping != null">
#{topping,jdbcType=BIT},
</if>
<if test="like != null">
#{like,jdbcType=LONGVARCHAR},
#{like,jdbcType=INTEGER},
</if>
<if test="unlike != null">
#{unlike,jdbcType=LONGVARCHAR},
#{unlike,jdbcType=INTEGER},
</if>
<if test="topping != null">
#{topping,jdbcType=TINYINT},
</if>
<if test="userName != null">
#{userName,jdbcType=VARCHAR},
</if>
</trim>
</insert>
@ -232,35 +211,23 @@
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.topping != null">
topping = #{record.topping,jdbcType=BIT},
</if>
<if test="record.like != null">
`like` = #{record.like,jdbcType=LONGVARCHAR},
`like` = #{record.like,jdbcType=INTEGER},
</if>
<if test="record.unlike != null">
unlike = #{record.unlike,jdbcType=LONGVARCHAR},
unlike = #{record.unlike,jdbcType=INTEGER},
</if>
<if test="record.topping != null">
topping = #{record.topping,jdbcType=TINYINT},
</if>
<if test="record.userName != null">
user_name = #{record.userName,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update learn_message
set id = #{record.id,jdbcType=BIGINT},
post_id = #{record.postId,jdbcType=BIGINT},
content = #{record.content,jdbcType=VARCHAR},
picture_urls = #{record.pictureUrls,jdbcType=VARCHAR},
creator_id = #{record.creatorId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
topping = #{record.topping,jdbcType=BIT},
`like` = #{record.like,jdbcType=LONGVARCHAR},
unlike = #{record.unlike,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update learn_message
set id = #{record.id,jdbcType=BIGINT},
@ -269,12 +236,15 @@
picture_urls = #{record.pictureUrls,jdbcType=VARCHAR},
creator_id = #{record.creatorId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
topping = #{record.topping,jdbcType=BIT}
`like` = #{record.like,jdbcType=INTEGER},
unlike = #{record.unlike,jdbcType=INTEGER},
topping = #{record.topping,jdbcType=TINYINT},
user_name = #{record.userName,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.LearnMessageWithBLOBs">
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.LearnMessage">
update learn_message
<set>
<if test="postId != null">
@ -292,30 +262,21 @@
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="topping != null">
topping = #{topping,jdbcType=BIT},
</if>
<if test="like != null">
`like` = #{like,jdbcType=LONGVARCHAR},
`like` = #{like,jdbcType=INTEGER},
</if>
<if test="unlike != null">
unlike = #{unlike,jdbcType=LONGVARCHAR},
unlike = #{unlike,jdbcType=INTEGER},
</if>
<if test="topping != null">
topping = #{topping,jdbcType=TINYINT},
</if>
<if test="userName != null">
user_name = #{userName,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.LearnMessageWithBLOBs">
update learn_message
set post_id = #{postId,jdbcType=BIGINT},
content = #{content,jdbcType=VARCHAR},
picture_urls = #{pictureUrls,jdbcType=VARCHAR},
creator_id = #{creatorId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
topping = #{topping,jdbcType=BIT},
`like` = #{like,jdbcType=LONGVARCHAR},
unlike = #{unlike,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.LearnMessage">
update learn_message
set post_id = #{postId,jdbcType=BIGINT},
@ -323,7 +284,10 @@
picture_urls = #{pictureUrls,jdbcType=VARCHAR},
creator_id = #{creatorId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
topping = #{topping,jdbcType=BIT}
`like` = #{like,jdbcType=INTEGER},
unlike = #{unlike,jdbcType=INTEGER},
topping = #{topping,jdbcType=TINYINT},
user_name = #{userName,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>