增加创建超限区段接口、进路数据关联超限区段

This commit is contained in:
joylink_zhangsai 2021-08-05 09:52:47 +08:00
parent 8e58d6ba89
commit 334d4ec105
11 changed files with 1220 additions and 0 deletions

View File

@ -0,0 +1,35 @@
package club.joylink.rtss.controller.draft;
import club.joylink.rtss.services.draftData.DraftMapOverrunService;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.MapRouteOverrunQueryVO;
import club.joylink.rtss.vo.map.MapRouteOverrunVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/draftMap/{id}/overrun")
public class DraftMapOverrunController {
@Autowired
private DraftMapOverrunService draftMapOverrunService;
@GetMapping("/paging")
public PageVO<MapRouteOverrunVO> pagingQuery(@PathVariable Long id, MapRouteOverrunQueryVO queryVO) {
return draftMapOverrunService.pagingQuery(id, queryVO);
}
@PostMapping("")
public void createOverrun(@PathVariable Long id, @RequestBody MapRouteOverrunVO overrunVO) {
draftMapOverrunService.createOverrun(id, overrunVO);
}
@DeleteMapping("/{code}")
public void delete(@PathVariable Long id, @PathVariable String code) {
draftMapOverrunService.delete(id, code);
}
@PutMapping("/{code}")
public void update(@PathVariable Long id, @PathVariable String code, @RequestBody MapRouteOverrunVO vo) {
draftMapOverrunService.update(id, code, vo);
}
}

View File

@ -0,0 +1,12 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.DraftMapRouteOverrun;
import club.joylink.rtss.entity.DraftMapRouteOverrunExample;
import org.springframework.stereotype.Repository;
/**
* DraftMapRouteOverrunDAO继承基类
*/
@Repository
public interface DraftMapRouteOverrunDAO extends MyBatisBaseDao<DraftMapRouteOverrun, Long, DraftMapRouteOverrunExample> {
}

View File

@ -0,0 +1,121 @@
package club.joylink.rtss.entity;
import java.io.Serializable;
/**
* @author
*
*/
public class DraftMapRouteOverrun implements Serializable {
private Long id;
private Long mapId;
private String code;
private String sectionCode;
private String ciSwitch;
private String switchCode;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMapId() {
return mapId;
}
public void setMapId(Long mapId) {
this.mapId = mapId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getSectionCode() {
return sectionCode;
}
public void setSectionCode(String sectionCode) {
this.sectionCode = sectionCode;
}
public String getCiSwitch() {
return ciSwitch;
}
public void setCiSwitch(String ciSwitch) {
this.ciSwitch = ciSwitch;
}
public String getSwitchCode() {
return switchCode;
}
public void setSwitchCode(String switchCode) {
this.switchCode = switchCode;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
DraftMapRouteOverrun other = (DraftMapRouteOverrun) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getMapId() == null ? other.getMapId() == null : this.getMapId().equals(other.getMapId()))
&& (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
&& (this.getSectionCode() == null ? other.getSectionCode() == null : this.getSectionCode().equals(other.getSectionCode()))
&& (this.getCiSwitch() == null ? other.getCiSwitch() == null : this.getCiSwitch().equals(other.getCiSwitch()))
&& (this.getSwitchCode() == null ? other.getSwitchCode() == null : this.getSwitchCode().equals(other.getSwitchCode()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getMapId() == null) ? 0 : getMapId().hashCode());
result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode());
result = prime * result + ((getSectionCode() == null) ? 0 : getSectionCode().hashCode());
result = prime * result + ((getCiSwitch() == null) ? 0 : getCiSwitch().hashCode());
result = prime * result + ((getSwitchCode() == null) ? 0 : getSwitchCode().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", mapId=").append(mapId);
sb.append(", code=").append(code);
sb.append(", sectionCode=").append(sectionCode);
sb.append(", ciSwitch=").append(ciSwitch);
sb.append(", switchCode=").append(switchCode);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -0,0 +1,622 @@
package club.joylink.rtss.entity;
import java.util.ArrayList;
import java.util.List;
public class DraftMapRouteOverrunExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public DraftMapRouteOverrunExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public Integer getLimit() {
return limit;
}
public void setOffset(Long offset) {
this.offset = offset;
}
public Long getOffset() {
return offset;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andMapIdIsNull() {
addCriterion("map_id is null");
return (Criteria) this;
}
public Criteria andMapIdIsNotNull() {
addCriterion("map_id is not null");
return (Criteria) this;
}
public Criteria andMapIdEqualTo(Long value) {
addCriterion("map_id =", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotEqualTo(Long value) {
addCriterion("map_id <>", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThan(Long value) {
addCriterion("map_id >", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThanOrEqualTo(Long value) {
addCriterion("map_id >=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThan(Long value) {
addCriterion("map_id <", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThanOrEqualTo(Long value) {
addCriterion("map_id <=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdIn(List<Long> values) {
addCriterion("map_id in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotIn(List<Long> values) {
addCriterion("map_id not in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdBetween(Long value1, Long value2) {
addCriterion("map_id between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotBetween(Long value1, Long value2) {
addCriterion("map_id not between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andCodeIsNull() {
addCriterion("code is null");
return (Criteria) this;
}
public Criteria andCodeIsNotNull() {
addCriterion("code is not null");
return (Criteria) this;
}
public Criteria andCodeEqualTo(String value) {
addCriterion("code =", value, "code");
return (Criteria) this;
}
public Criteria andCodeNotEqualTo(String value) {
addCriterion("code <>", value, "code");
return (Criteria) this;
}
public Criteria andCodeGreaterThan(String value) {
addCriterion("code >", value, "code");
return (Criteria) this;
}
public Criteria andCodeGreaterThanOrEqualTo(String value) {
addCriterion("code >=", value, "code");
return (Criteria) this;
}
public Criteria andCodeLessThan(String value) {
addCriterion("code <", value, "code");
return (Criteria) this;
}
public Criteria andCodeLessThanOrEqualTo(String value) {
addCriterion("code <=", value, "code");
return (Criteria) this;
}
public Criteria andCodeLike(String value) {
addCriterion("code like", value, "code");
return (Criteria) this;
}
public Criteria andCodeNotLike(String value) {
addCriterion("code not like", value, "code");
return (Criteria) this;
}
public Criteria andCodeIn(List<String> values) {
addCriterion("code in", values, "code");
return (Criteria) this;
}
public Criteria andCodeNotIn(List<String> values) {
addCriterion("code not in", values, "code");
return (Criteria) this;
}
public Criteria andCodeBetween(String value1, String value2) {
addCriterion("code between", value1, value2, "code");
return (Criteria) this;
}
public Criteria andCodeNotBetween(String value1, String value2) {
addCriterion("code not between", value1, value2, "code");
return (Criteria) this;
}
public Criteria andSectionCodeIsNull() {
addCriterion("section_code is null");
return (Criteria) this;
}
public Criteria andSectionCodeIsNotNull() {
addCriterion("section_code is not null");
return (Criteria) this;
}
public Criteria andSectionCodeEqualTo(String value) {
addCriterion("section_code =", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeNotEqualTo(String value) {
addCriterion("section_code <>", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeGreaterThan(String value) {
addCriterion("section_code >", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeGreaterThanOrEqualTo(String value) {
addCriterion("section_code >=", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeLessThan(String value) {
addCriterion("section_code <", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeLessThanOrEqualTo(String value) {
addCriterion("section_code <=", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeLike(String value) {
addCriterion("section_code like", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeNotLike(String value) {
addCriterion("section_code not like", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeIn(List<String> values) {
addCriterion("section_code in", values, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeNotIn(List<String> values) {
addCriterion("section_code not in", values, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeBetween(String value1, String value2) {
addCriterion("section_code between", value1, value2, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeNotBetween(String value1, String value2) {
addCriterion("section_code not between", value1, value2, "sectionCode");
return (Criteria) this;
}
public Criteria andCiSwitchIsNull() {
addCriterion("ci_switch is null");
return (Criteria) this;
}
public Criteria andCiSwitchIsNotNull() {
addCriterion("ci_switch is not null");
return (Criteria) this;
}
public Criteria andCiSwitchEqualTo(String value) {
addCriterion("ci_switch =", value, "ciSwitch");
return (Criteria) this;
}
public Criteria andCiSwitchNotEqualTo(String value) {
addCriterion("ci_switch <>", value, "ciSwitch");
return (Criteria) this;
}
public Criteria andCiSwitchGreaterThan(String value) {
addCriterion("ci_switch >", value, "ciSwitch");
return (Criteria) this;
}
public Criteria andCiSwitchGreaterThanOrEqualTo(String value) {
addCriterion("ci_switch >=", value, "ciSwitch");
return (Criteria) this;
}
public Criteria andCiSwitchLessThan(String value) {
addCriterion("ci_switch <", value, "ciSwitch");
return (Criteria) this;
}
public Criteria andCiSwitchLessThanOrEqualTo(String value) {
addCriterion("ci_switch <=", value, "ciSwitch");
return (Criteria) this;
}
public Criteria andCiSwitchLike(String value) {
addCriterion("ci_switch like", value, "ciSwitch");
return (Criteria) this;
}
public Criteria andCiSwitchNotLike(String value) {
addCriterion("ci_switch not like", value, "ciSwitch");
return (Criteria) this;
}
public Criteria andCiSwitchIn(List<String> values) {
addCriterion("ci_switch in", values, "ciSwitch");
return (Criteria) this;
}
public Criteria andCiSwitchNotIn(List<String> values) {
addCriterion("ci_switch not in", values, "ciSwitch");
return (Criteria) this;
}
public Criteria andCiSwitchBetween(String value1, String value2) {
addCriterion("ci_switch between", value1, value2, "ciSwitch");
return (Criteria) this;
}
public Criteria andCiSwitchNotBetween(String value1, String value2) {
addCriterion("ci_switch not between", value1, value2, "ciSwitch");
return (Criteria) this;
}
public Criteria andSwitchCodeIsNull() {
addCriterion("switch_code is null");
return (Criteria) this;
}
public Criteria andSwitchCodeIsNotNull() {
addCriterion("switch_code is not null");
return (Criteria) this;
}
public Criteria andSwitchCodeEqualTo(String value) {
addCriterion("switch_code =", value, "switchCode");
return (Criteria) this;
}
public Criteria andSwitchCodeNotEqualTo(String value) {
addCriterion("switch_code <>", value, "switchCode");
return (Criteria) this;
}
public Criteria andSwitchCodeGreaterThan(String value) {
addCriterion("switch_code >", value, "switchCode");
return (Criteria) this;
}
public Criteria andSwitchCodeGreaterThanOrEqualTo(String value) {
addCriterion("switch_code >=", value, "switchCode");
return (Criteria) this;
}
public Criteria andSwitchCodeLessThan(String value) {
addCriterion("switch_code <", value, "switchCode");
return (Criteria) this;
}
public Criteria andSwitchCodeLessThanOrEqualTo(String value) {
addCriterion("switch_code <=", value, "switchCode");
return (Criteria) this;
}
public Criteria andSwitchCodeLike(String value) {
addCriterion("switch_code like", value, "switchCode");
return (Criteria) this;
}
public Criteria andSwitchCodeNotLike(String value) {
addCriterion("switch_code not like", value, "switchCode");
return (Criteria) this;
}
public Criteria andSwitchCodeIn(List<String> values) {
addCriterion("switch_code in", values, "switchCode");
return (Criteria) this;
}
public Criteria andSwitchCodeNotIn(List<String> values) {
addCriterion("switch_code not in", values, "switchCode");
return (Criteria) this;
}
public Criteria andSwitchCodeBetween(String value1, String value2) {
addCriterion("switch_code between", value1, value2, "switchCode");
return (Criteria) this;
}
public Criteria andSwitchCodeNotBetween(String value1, String value2) {
addCriterion("switch_code not between", value1, value2, "switchCode");
return (Criteria) this;
}
}
/**
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -101,6 +101,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
public static final String Prefix_Routing = "Routing";
public static final String Prefix_AutoSignal = "AutoSignal";
public static final String Prefix_Cycle = "Cycle";
public static final String Prefix_Overrun = "Overrun";
private AtomicInteger sn;
private String prefix;
@ -134,6 +135,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
return new CodeGenerator(Prefix_Cycle, initVal);
}
public static CodeGenerator getOverrunCodeGenerator(int initVal) {
return new CodeGenerator(Prefix_Overrun, initVal);
}
public String next() {
return this.prefix + this.sn.incrementAndGet();
}

View File

@ -0,0 +1,15 @@
package club.joylink.rtss.services.draftData;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.MapRouteOverrunQueryVO;
import club.joylink.rtss.vo.map.MapRouteOverrunVO;
public interface DraftMapOverrunService {
void createOverrun(long mapId, MapRouteOverrunVO overrunVO);
PageVO<MapRouteOverrunVO> pagingQuery(long mapId, MapRouteOverrunQueryVO queryVO);
void delete(long mapId, String code);
void update(Long mapId, String code, MapRouteOverrunVO vo);
}

View File

@ -0,0 +1,93 @@
package club.joylink.rtss.services.draftData;
import club.joylink.rtss.dao.DraftMapRouteOverrunDAO;
import club.joylink.rtss.entity.DraftMapRouteOverrun;
import club.joylink.rtss.entity.DraftMapRouteOverrunExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.MapRouteOverrunQueryVO;
import club.joylink.rtss.vo.map.MapRouteOverrunVO;
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.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.List;
@Service
public class DraftMapOverrunServiceImpl implements DraftMapOverrunService {
@Autowired
private DraftMapRouteOverrunDAO draftMapRouteOverrunDAO;
@Override
public void createOverrun(long mapId, MapRouteOverrunVO overrunVO) {
List<DraftMapRouteOverrun> entities = findEntitiesByMapId(mapId);
String prefix_overrun = DraftMapCiDataGeneratorImpl.CodeGenerator.Prefix_Overrun;
DraftMapCiDataGeneratorImpl.CodeGenerator generator;
if (CollectionUtils.isEmpty(entities)) {
generator = DraftMapCiDataGeneratorImpl.CodeGenerator.getOverrunCodeGenerator(0);
} else {
Integer sn = entities.stream()
.map(overrun -> Integer.parseInt(overrun.getCode().substring(prefix_overrun.length())))
.max(Integer::compareTo)
.get();
generator = DraftMapCiDataGeneratorImpl.CodeGenerator.getOverrunCodeGenerator(sn);
}
overrunVO.setCode(generator.next());
DraftMapRouteOverrun entity = overrunVO.convert2draft();
entity.setId(null);
draftMapRouteOverrunDAO.insert(entity);
}
@Override
public PageVO<MapRouteOverrunVO> pagingQuery(long mapId, MapRouteOverrunQueryVO queryVO) {
DraftMapRouteOverrunExample example = new DraftMapRouteOverrunExample();
DraftMapRouteOverrunExample.Criteria criteria = example.createCriteria().andMapIdEqualTo(mapId);
if (StringUtils.hasText(queryVO.getSectionCode())) {
criteria.andSectionCodeEqualTo(queryVO.getSectionCode());
}
if (StringUtils.hasText(queryVO.getCiSwitchCode())) {
criteria.andCiSwitchLike(String.format("%%%s%%", queryVO.getCiSwitchCode()));
}
if (StringUtils.hasText(queryVO.getSwitchCode())) {
criteria.andSwitchCodeEqualTo(queryVO.getSwitchCode());
}
Page<Object> page = PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
List<DraftMapRouteOverrun> entities = draftMapRouteOverrunDAO.selectByExample(example);
return PageVO.convert(page, MapRouteOverrunVO.convertFromDraft(entities));
}
@Override
public void delete(long mapId, String code) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(code);
DraftMapRouteOverrunExample example = new DraftMapRouteOverrunExample();
example.createCriteria()
.andMapIdEqualTo(mapId)
.andCodeEqualTo(code);
this.draftMapRouteOverrunDAO.deleteByExample(example);
}
@Override
public void update(Long mapId, String code, MapRouteOverrunVO vo) {
DraftMapRouteOverrunExample example = new DraftMapRouteOverrunExample();
example.createCriteria()
.andMapIdEqualTo(mapId)
.andCodeEqualTo(code);
List<DraftMapRouteOverrun> entities = draftMapRouteOverrunDAO.selectByExample(example);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(entities, "数据不存在");
DraftMapRouteOverrun entity = entities.get(0);
DraftMapRouteOverrun newEntity = vo.convert2draft();
newEntity.setId(entity.getId());
newEntity.setCode(code);
newEntity.setMapId(mapId);
draftMapRouteOverrunDAO.updateByPrimaryKey(newEntity);
}
private List<DraftMapRouteOverrun> findEntitiesByMapId(long mapId) {
DraftMapRouteOverrunExample example = new DraftMapRouteOverrunExample();
example.createCriteria().andMapIdEqualTo(mapId);
return draftMapRouteOverrunDAO.selectByExample(example);
}
}

View File

@ -0,0 +1,17 @@
package club.joylink.rtss.vo.client.map;
import club.joylink.rtss.vo.client.PageQueryVO;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class MapRouteOverrunQueryVO extends PageQueryVO {
private String sectionCode;
private String ciSwitchCode;
private String switchCode;
}

View File

@ -156,6 +156,9 @@ public class MapRouteNewVO {
*/
private String overlapCode;
/** 超限区段列表 */
private List<String> overrunList;
// /** 站台屏蔽门 */
// @ApiModelProperty(value = "进路站台屏蔽门数据列表")
// private List<String> psdList;

View File

@ -0,0 +1,69 @@
package club.joylink.rtss.vo.map;
import club.joylink.rtss.entity.DraftMapRouteOverrun;
import club.joylink.rtss.simulation.cbtc.data.map.SwitchElement;
import club.joylink.rtss.util.JsonUtils;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* 超限区段
*/
@Getter
@Setter
@NoArgsConstructor
public class MapRouteOverrunVO {
private Long id;
private Long mapId;
private String code;
/** 区段 */
private String sectionCode;
/** 道岔位置 */
private MapCISwitchVO ciSwitch;
/** 防护的道岔 */
private String switchCode;
public MapRouteOverrunVO(DraftMapRouteOverrun overrun) {
this.id = overrun.getId();
this.mapId = overrun.getMapId();
this.code = overrun.getCode();
this.sectionCode = overrun.getSectionCode();
if (StringUtils.hasText(overrun.getCiSwitch())) {
this.ciSwitch = JsonUtils.read(overrun.getCiSwitch(), MapCISwitchVO.class);
}
this.switchCode = overrun.getSwitchCode();
}
public DraftMapRouteOverrun convert2draft() {
DraftMapRouteOverrun entity = new DraftMapRouteOverrun();
entity.setId(id);
entity.setMapId(mapId);
entity.setCode(code);
entity.setSectionCode(sectionCode);
if (ciSwitch != null) {
entity.setCiSwitch(JsonUtils.writeValueAsString(ciSwitch));
}
entity.setSwitchCode(switchCode);
return entity;
}
public static List<MapRouteOverrunVO> convertFromDraft(List<DraftMapRouteOverrun> list) {
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
} else {
return list.stream().map(MapRouteOverrunVO::new).collect(Collectors.toList());
}
}
}

View File

@ -0,0 +1,228 @@
<?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.DraftMapRouteOverrunDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.DraftMapRouteOverrun">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="map_id" jdbcType="BIGINT" property="mapId" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="section_code" jdbcType="VARCHAR" property="sectionCode" />
<result column="ci_switch" jdbcType="VARCHAR" property="ciSwitch" />
<result column="switch_code" jdbcType="VARCHAR" property="switchCode" />
</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, map_id, code, section_code, ci_switch, switch_code
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.DraftMapRouteOverrunExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from draft_map_route_overrun
<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 draft_map_route_overrun
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from draft_map_route_overrun
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.DraftMapRouteOverrunExample">
delete from draft_map_route_overrun
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.DraftMapRouteOverrun" useGeneratedKeys="true">
insert into draft_map_route_overrun (map_id, code, section_code,
ci_switch, switch_code)
values (#{mapId,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{sectionCode,jdbcType=VARCHAR},
#{ciSwitch,jdbcType=VARCHAR}, #{switchCode,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.DraftMapRouteOverrun" useGeneratedKeys="true">
insert into draft_map_route_overrun
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="mapId != null">
map_id,
</if>
<if test="code != null">
code,
</if>
<if test="sectionCode != null">
section_code,
</if>
<if test="ciSwitch != null">
ci_switch,
</if>
<if test="switchCode != null">
switch_code,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="mapId != null">
#{mapId,jdbcType=BIGINT},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="sectionCode != null">
#{sectionCode,jdbcType=VARCHAR},
</if>
<if test="ciSwitch != null">
#{ciSwitch,jdbcType=VARCHAR},
</if>
<if test="switchCode != null">
#{switchCode,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.DraftMapRouteOverrunExample" resultType="java.lang.Long">
select count(*) from draft_map_route_overrun
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update draft_map_route_overrun
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.mapId != null">
map_id = #{record.mapId,jdbcType=BIGINT},
</if>
<if test="record.code != null">
code = #{record.code,jdbcType=VARCHAR},
</if>
<if test="record.sectionCode != null">
section_code = #{record.sectionCode,jdbcType=VARCHAR},
</if>
<if test="record.ciSwitch != null">
ci_switch = #{record.ciSwitch,jdbcType=VARCHAR},
</if>
<if test="record.switchCode != null">
switch_code = #{record.switchCode,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update draft_map_route_overrun
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
code = #{record.code,jdbcType=VARCHAR},
section_code = #{record.sectionCode,jdbcType=VARCHAR},
ci_switch = #{record.ciSwitch,jdbcType=VARCHAR},
switch_code = #{record.switchCode,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.DraftMapRouteOverrun">
update draft_map_route_overrun
<set>
<if test="mapId != null">
map_id = #{mapId,jdbcType=BIGINT},
</if>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="sectionCode != null">
section_code = #{sectionCode,jdbcType=VARCHAR},
</if>
<if test="ciSwitch != null">
ci_switch = #{ciSwitch,jdbcType=VARCHAR},
</if>
<if test="switchCode != null">
switch_code = #{switchCode,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.DraftMapRouteOverrun">
update draft_map_route_overrun
set map_id = #{mapId,jdbcType=BIGINT},
code = #{code,jdbcType=VARCHAR},
section_code = #{sectionCode,jdbcType=VARCHAR},
ci_switch = #{ciSwitch,jdbcType=VARCHAR},
switch_code = #{switchCode,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>