新增:地图数据增加描述字段

This commit is contained in:
joylink_zhangsai 2021-06-16 13:03:07 +08:00
parent fa76a0502a
commit dea15cefac
11 changed files with 325 additions and 17 deletions

3
sql/20210616-thesai.sql Normal file
View File

@ -0,0 +1,3 @@
ALTER TABLE `map_data`
ADD COLUMN `note` varchar(255) NULL COMMENT '备注' AFTER `version`;

View File

@ -50,7 +50,7 @@ public interface MapDataDAO {
" #{entity.graphData,jdbcType=LONGVARCHAR}, #{entity.logicData,jdbcType=LONGVARCHAR}," +
" #{entity.initPosConfig,jdbcType=LONGVARCHAR}, #{entity.checkConfig,jdbcType=LONGVARCHAR}," +
" #{entity.ciGenerateConfig,jdbcType=LONGVARCHAR}, #{entity.bigScreenConfig,jdbcType=LONGVARCHAR}" +
" #{entity.version, jdbcType=VARCHAR}, #{entity.time, jdbcType=TIMESTAMP}, #{entity.userId, jdbcType=BIGINT})"+
" #{entity.version, jdbcType=VARCHAR}, , #{entity.note, jdbcType=VARCHAR}, #{entity.time, jdbcType=TIMESTAMP}, #{entity.userId, jdbcType=BIGINT})"+
" </foreach>" +
"</script>")
int batchInsertWithId(@Param("list") List<MapDataWithBLOBs> mapDataList);
@ -65,4 +65,4 @@ public interface MapDataDAO {
"\tmap_data.time DESC\n" +
"LIMIT 1")
String findVersion(Long mapId);
}
}

View File

@ -1,7 +1,5 @@
package club.joylink.rtss.entity;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
@ -9,7 +7,6 @@ import java.time.LocalDateTime;
* @author
* 地图数据
*/
@Data
public class MapData implements Serializable {
private Long id;
@ -23,6 +20,11 @@ public class MapData implements Serializable {
*/
private String version;
/**
* 备注
*/
private String note;
/**
* 发布时间
*/
@ -34,4 +36,102 @@ public class MapData implements Serializable {
private Long userId;
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 getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public LocalDateTime getTime() {
return time;
}
public void setTime(LocalDateTime time) {
this.time = time;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
MapData other = (MapData) 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.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()))
&& (this.getNote() == null ? other.getNote() == null : this.getNote().equals(other.getNote()))
&& (this.getTime() == null ? other.getTime() == null : this.getTime().equals(other.getTime()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()));
}
@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 + ((getVersion() == null) ? 0 : getVersion().hashCode());
result = prime * result + ((getNote() == null) ? 0 : getNote().hashCode());
result = prime * result + ((getTime() == null) ? 0 : getTime().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().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(", version=").append(version);
sb.append(", note=").append(note);
sb.append(", time=").append(time);
sb.append(", userId=").append(userId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -315,6 +315,76 @@ public class MapDataExample {
return (Criteria) this;
}
public Criteria andNoteIsNull() {
addCriterion("note is null");
return (Criteria) this;
}
public Criteria andNoteIsNotNull() {
addCriterion("note is not null");
return (Criteria) this;
}
public Criteria andNoteEqualTo(String value) {
addCriterion("note =", value, "note");
return (Criteria) this;
}
public Criteria andNoteNotEqualTo(String value) {
addCriterion("note <>", value, "note");
return (Criteria) this;
}
public Criteria andNoteGreaterThan(String value) {
addCriterion("note >", value, "note");
return (Criteria) this;
}
public Criteria andNoteGreaterThanOrEqualTo(String value) {
addCriterion("note >=", value, "note");
return (Criteria) this;
}
public Criteria andNoteLessThan(String value) {
addCriterion("note <", value, "note");
return (Criteria) this;
}
public Criteria andNoteLessThanOrEqualTo(String value) {
addCriterion("note <=", value, "note");
return (Criteria) this;
}
public Criteria andNoteLike(String value) {
addCriterion("note like", value, "note");
return (Criteria) this;
}
public Criteria andNoteNotLike(String value) {
addCriterion("note not like", value, "note");
return (Criteria) this;
}
public Criteria andNoteIn(List<String> values) {
addCriterion("note in", values, "note");
return (Criteria) this;
}
public Criteria andNoteNotIn(List<String> values) {
addCriterion("note not in", values, "note");
return (Criteria) this;
}
public Criteria andNoteBetween(String value1, String value2) {
addCriterion("note between", value1, value2, "note");
return (Criteria) this;
}
public Criteria andNoteNotBetween(String value1, String value2) {
addCriterion("note not between", value1, value2, "note");
return (Criteria) this;
}
public Criteria andTimeIsNull() {
addCriterion("`time` is null");
return (Criteria) this;

View File

@ -1,14 +1,11 @@
package club.joylink.rtss.entity;
import lombok.Data;
import java.io.Serializable;
/**
* @author
* 地图数据
*/
@Data
public class MapDataWithBLOBs extends MapData implements Serializable {
/**
* 图形数据
@ -41,4 +38,114 @@ public class MapDataWithBLOBs extends MapData implements Serializable {
private String bigScreenConfig;
private static final long serialVersionUID = 1L;
public String getGraphData() {
return graphData;
}
public void setGraphData(String graphData) {
this.graphData = graphData;
}
public String getLogicData() {
return logicData;
}
public void setLogicData(String logicData) {
this.logicData = logicData;
}
public String getInitPosConfig() {
return initPosConfig;
}
public void setInitPosConfig(String initPosConfig) {
this.initPosConfig = initPosConfig;
}
public String getCheckConfig() {
return checkConfig;
}
public void setCheckConfig(String checkConfig) {
this.checkConfig = checkConfig;
}
public String getCiGenerateConfig() {
return ciGenerateConfig;
}
public void setCiGenerateConfig(String ciGenerateConfig) {
this.ciGenerateConfig = ciGenerateConfig;
}
public String getBigScreenConfig() {
return bigScreenConfig;
}
public void setBigScreenConfig(String bigScreenConfig) {
this.bigScreenConfig = bigScreenConfig;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
MapDataWithBLOBs other = (MapDataWithBLOBs) 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.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()))
&& (this.getNote() == null ? other.getNote() == null : this.getNote().equals(other.getNote()))
&& (this.getTime() == null ? other.getTime() == null : this.getTime().equals(other.getTime()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getGraphData() == null ? other.getGraphData() == null : this.getGraphData().equals(other.getGraphData()))
&& (this.getLogicData() == null ? other.getLogicData() == null : this.getLogicData().equals(other.getLogicData()))
&& (this.getInitPosConfig() == null ? other.getInitPosConfig() == null : this.getInitPosConfig().equals(other.getInitPosConfig()))
&& (this.getCheckConfig() == null ? other.getCheckConfig() == null : this.getCheckConfig().equals(other.getCheckConfig()))
&& (this.getCiGenerateConfig() == null ? other.getCiGenerateConfig() == null : this.getCiGenerateConfig().equals(other.getCiGenerateConfig()))
&& (this.getBigScreenConfig() == null ? other.getBigScreenConfig() == null : this.getBigScreenConfig().equals(other.getBigScreenConfig()));
}
@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 + ((getVersion() == null) ? 0 : getVersion().hashCode());
result = prime * result + ((getNote() == null) ? 0 : getNote().hashCode());
result = prime * result + ((getTime() == null) ? 0 : getTime().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getGraphData() == null) ? 0 : getGraphData().hashCode());
result = prime * result + ((getLogicData() == null) ? 0 : getLogicData().hashCode());
result = prime * result + ((getInitPosConfig() == null) ? 0 : getInitPosConfig().hashCode());
result = prime * result + ((getCheckConfig() == null) ? 0 : getCheckConfig().hashCode());
result = prime * result + ((getCiGenerateConfig() == null) ? 0 : getCiGenerateConfig().hashCode());
result = prime * result + ((getBigScreenConfig() == null) ? 0 : getBigScreenConfig().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", graphData=").append(graphData);
sb.append(", logicData=").append(logicData);
sb.append(", initPosConfig=").append(initPosConfig);
sb.append(", checkConfig=").append(checkConfig);
sb.append(", ciGenerateConfig=").append(ciGenerateConfig);
sb.append(", bigScreenConfig=").append(bigScreenConfig);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -335,6 +335,7 @@ public class DraftMapService implements IDraftMapService {
public void publish(Long id, DraftMapVO draftMapVO, AccountVO accountVO, MapDataVO mapDataVO) {
DraftMap draftMap = draftMapDAO.selectByPrimaryKey(id);
mapDataVO.setMap3dDataVO(find3dMapDataByMapId(id));
mapDataVO.setNote(draftMapVO.getNote());
iMapService.publish(new MapVO(draftMap, draftMapVO.getName(), draftMapVO.getCityCode()), mapDataVO, accountVO);
}

View File

@ -392,6 +392,7 @@ public class MapService implements IMapService {
mapData.setCheckConfig(new MapCheckConfig().toJson());
}
mapData.setVersion(VersionUtil.generateNext(findMapVersion(map.getId())));
mapData.setNote(mapDataVO.getNote());
mapData.setTime(LocalDateTime.now());
mapData.setUserId(accountVO.getId());
mapDataDAO.insert(mapData);

View File

@ -40,6 +40,8 @@ public class DraftMapVO {
@NotBlank(message="城市不能为空", groups= {DraftMapPublishCheck.class})
private String cityCode;
private String note;
public DraftMapVO(DraftMap draftMap) {
this.id = draftMap.getId();
this.name = draftMap.getName();

View File

@ -23,6 +23,8 @@ public class MapDataVO {
private Map3dDataVO map3dDataVO;
private String note;
public MapDataVO(MapDataWithBLOBs mapData) {
if (StringUtils.hasText(mapData.getCheckConfig())) {

View File

@ -24,10 +24,13 @@ public class MapVersionVO {
private String version;
private String note;
public MapVersionVO(MapData mapData) {
this.userId = mapData.getUserId();
this.publishTime = mapData.getTime();
this.version = mapData.getVersion();
this.note = mapData.getNote();
}
public static List<MapVersionVO> convert2VOList(List<MapData> list) {

View File

@ -5,6 +5,7 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="map_id" jdbcType="BIGINT" property="mapId" />
<result column="version" jdbcType="VARCHAR" property="version" />
<result column="note" jdbcType="VARCHAR" property="note" />
<result column="time" jdbcType="TIMESTAMP" property="time" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
</resultMap>
@ -75,7 +76,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, map_id, version, `time`, user_id
id, map_id, version, note, `time`, user_id
</sql>
<sql id="Blob_Column_List">
graph_data, logic_data, init_pos_config, check_config, ci_generate_config, big_screen_config
@ -145,14 +146,16 @@
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.MapDataWithBLOBs" useGeneratedKeys="true">
insert into map_data (map_id, version, `time`,
user_id, graph_data, logic_data,
init_pos_config, check_config, ci_generate_config,
big_screen_config)
values (#{mapId,jdbcType=BIGINT}, #{version,jdbcType=VARCHAR}, #{time,jdbcType=TIMESTAMP},
#{userId,jdbcType=BIGINT}, #{graphData,jdbcType=LONGVARCHAR}, #{logicData,jdbcType=LONGVARCHAR},
#{initPosConfig,jdbcType=LONGVARCHAR}, #{checkConfig,jdbcType=LONGVARCHAR}, #{ciGenerateConfig,jdbcType=LONGVARCHAR},
#{bigScreenConfig,jdbcType=LONGVARCHAR})
insert into map_data (map_id, version, note,
`time`, user_id, graph_data,
logic_data, init_pos_config, check_config,
ci_generate_config, big_screen_config
)
values (#{mapId,jdbcType=BIGINT}, #{version,jdbcType=VARCHAR}, #{note,jdbcType=VARCHAR},
#{time,jdbcType=TIMESTAMP}, #{userId,jdbcType=BIGINT}, #{graphData,jdbcType=LONGVARCHAR},
#{logicData,jdbcType=LONGVARCHAR}, #{initPosConfig,jdbcType=LONGVARCHAR}, #{checkConfig,jdbcType=LONGVARCHAR},
#{ciGenerateConfig,jdbcType=LONGVARCHAR}, #{bigScreenConfig,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.MapDataWithBLOBs" useGeneratedKeys="true">
insert into map_data
@ -163,6 +166,9 @@
<if test="version != null">
version,
</if>
<if test="note != null">
note,
</if>
<if test="time != null">
`time`,
</if>
@ -195,6 +201,9 @@
<if test="version != null">
#{version,jdbcType=VARCHAR},
</if>
<if test="note != null">
#{note,jdbcType=VARCHAR},
</if>
<if test="time != null">
#{time,jdbcType=TIMESTAMP},
</if>
@ -239,6 +248,9 @@
<if test="record.version != null">
version = #{record.version,jdbcType=VARCHAR},
</if>
<if test="record.note != null">
note = #{record.note,jdbcType=VARCHAR},
</if>
<if test="record.time != null">
`time` = #{record.time,jdbcType=TIMESTAMP},
</if>
@ -273,6 +285,7 @@
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
version = #{record.version,jdbcType=VARCHAR},
note = #{record.note,jdbcType=VARCHAR},
`time` = #{record.time,jdbcType=TIMESTAMP},
user_id = #{record.userId,jdbcType=BIGINT},
graph_data = #{record.graphData,jdbcType=LONGVARCHAR},
@ -290,6 +303,7 @@
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
version = #{record.version,jdbcType=VARCHAR},
note = #{record.note,jdbcType=VARCHAR},
`time` = #{record.time,jdbcType=TIMESTAMP},
user_id = #{record.userId,jdbcType=BIGINT}
<if test="_parameter != null">
@ -305,6 +319,9 @@
<if test="version != null">
version = #{version,jdbcType=VARCHAR},
</if>
<if test="note != null">
note = #{note,jdbcType=VARCHAR},
</if>
<if test="time != null">
`time` = #{time,jdbcType=TIMESTAMP},
</if>
@ -336,6 +353,7 @@
update map_data
set map_id = #{mapId,jdbcType=BIGINT},
version = #{version,jdbcType=VARCHAR},
note = #{note,jdbcType=VARCHAR},
`time` = #{time,jdbcType=TIMESTAMP},
user_id = #{userId,jdbcType=BIGINT},
graph_data = #{graphData,jdbcType=LONGVARCHAR},
@ -350,6 +368,7 @@
update map_data
set map_id = #{mapId,jdbcType=BIGINT},
version = #{version,jdbcType=VARCHAR},
note = #{note,jdbcType=VARCHAR},
`time` = #{time,jdbcType=TIMESTAMP},
user_id = #{userId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}