perf: 补上规约信息

dev
huangfeng 2 months ago
parent 25c3e74e23
commit 128068aa9e

@ -28,6 +28,15 @@ public class CameraSchedule {
*/
private Integer channelId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column camera_schedule.protocol
*
* @mbg.generated
*/
private Integer protocol;
/**
*
* This field was generated by MyBatis Generator.
@ -109,6 +118,30 @@ public class CameraSchedule {
this.channelId = channelId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column camera_schedule.protocol
*
* @return the value of camera_schedule.protocol
*
* @mbg.generated
*/
public Integer getProtocol() {
return protocol;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column camera_schedule.protocol
*
* @param protocol the value for camera_schedule.protocol
*
* @mbg.generated
*/
public void setProtocol(Integer protocol) {
this.protocol = protocol;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column camera_schedule.data

@ -373,6 +373,66 @@ public class CameraScheduleExample {
addCriterion("channel_id not between", value1, value2, "channelId");
return (Criteria) this;
}
public Criteria andProtocolIsNull() {
addCriterion("protocol is null");
return (Criteria) this;
}
public Criteria andProtocolIsNotNull() {
addCriterion("protocol is not null");
return (Criteria) this;
}
public Criteria andProtocolEqualTo(Integer value) {
addCriterion("protocol =", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotEqualTo(Integer value) {
addCriterion("protocol <>", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolGreaterThan(Integer value) {
addCriterion("protocol >", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolGreaterThanOrEqualTo(Integer value) {
addCriterion("protocol >=", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolLessThan(Integer value) {
addCriterion("protocol <", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolLessThanOrEqualTo(Integer value) {
addCriterion("protocol <=", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolIn(List<Integer> values) {
addCriterion("protocol in", values, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotIn(List<Integer> values) {
addCriterion("protocol not in", values, "protocol");
return (Criteria) this;
}
public Criteria andProtocolBetween(Integer value1, Integer value2) {
addCriterion("protocol between", value1, value2, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotBetween(Integer value1, Integer value2) {
addCriterion("protocol not between", value1, value2, "protocol");
return (Criteria) this;
}
}
/**

@ -9,6 +9,7 @@
<id column="id" jdbcType="INTEGER" property="id" />
<result column="term_id" jdbcType="INTEGER" property="termId" />
<result column="channel_id" jdbcType="INTEGER" property="channelId" />
<result column="protocol" jdbcType="INTEGER" property="protocol" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.shxy.xymanager_common.entity.CameraSchedule">
<!--
@ -88,7 +89,7 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, term_id, channel_id
id, term_id, channel_id, protocol
</sql>
<sql id="Blob_Column_List">
<!--
@ -173,10 +174,10 @@
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into camera_schedule (term_id, channel_id, `data`
)
values (#{termId,jdbcType=INTEGER}, #{channelId,jdbcType=INTEGER}, #{data,jdbcType=LONGVARCHAR}
)
insert into camera_schedule (term_id, channel_id, protocol,
`data`)
values (#{termId,jdbcType=INTEGER}, #{channelId,jdbcType=INTEGER}, #{protocol,jdbcType=INTEGER},
#{data,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.CameraSchedule">
<!--
@ -194,6 +195,9 @@
<if test="channelId != null">
channel_id,
</if>
<if test="protocol != null">
protocol,
</if>
<if test="data != null">
`data`,
</if>
@ -205,6 +209,9 @@
<if test="channelId != null">
#{channelId,jdbcType=INTEGER},
</if>
<if test="protocol != null">
#{protocol,jdbcType=INTEGER},
</if>
<if test="data != null">
#{data,jdbcType=LONGVARCHAR},
</if>
@ -236,6 +243,9 @@
<if test="row.channelId != null">
channel_id = #{row.channelId,jdbcType=INTEGER},
</if>
<if test="row.protocol != null">
protocol = #{row.protocol,jdbcType=INTEGER},
</if>
<if test="row.data != null">
`data` = #{row.data,jdbcType=LONGVARCHAR},
</if>
@ -253,6 +263,7 @@
set id = #{row.id,jdbcType=INTEGER},
term_id = #{row.termId,jdbcType=INTEGER},
channel_id = #{row.channelId,jdbcType=INTEGER},
protocol = #{row.protocol,jdbcType=INTEGER},
`data` = #{row.data,jdbcType=LONGVARCHAR}
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
@ -266,7 +277,8 @@
update camera_schedule
set id = #{row.id,jdbcType=INTEGER},
term_id = #{row.termId,jdbcType=INTEGER},
channel_id = #{row.channelId,jdbcType=INTEGER}
channel_id = #{row.channelId,jdbcType=INTEGER},
protocol = #{row.protocol,jdbcType=INTEGER}
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -284,6 +296,9 @@
<if test="channelId != null">
channel_id = #{channelId,jdbcType=INTEGER},
</if>
<if test="protocol != null">
protocol = #{protocol,jdbcType=INTEGER},
</if>
<if test="data != null">
`data` = #{data,jdbcType=LONGVARCHAR},
</if>
@ -298,6 +313,7 @@
update camera_schedule
set term_id = #{termId,jdbcType=INTEGER},
channel_id = #{channelId,jdbcType=INTEGER},
protocol = #{protocol,jdbcType=INTEGER},
`data` = #{data,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
@ -308,7 +324,8 @@
-->
update camera_schedule
set term_id = #{termId,jdbcType=INTEGER},
channel_id = #{channelId,jdbcType=INTEGER}
channel_id = #{channelId,jdbcType=INTEGER},
protocol = #{protocol,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

@ -57,19 +57,23 @@ public class StoreCameraScheduleTask {
Integer channel = Constants.scheduleRequestMap.get(requestid);
Constants.scheduleRequestMap.remove(requestid);
Terminals term = newCacheService.getTerminal(results.getTermId());
CameraScheduleExample example = new CameraScheduleExample();
CameraScheduleExample.Criteria criteria = example.createCriteria();
criteria.andTermIdEqualTo(results.getTermId());
criteria.andTermIdEqualTo(term.getId());
criteria.andChannelIdEqualTo(channel);
List<CameraSchedule> list = cameraScheduleMapper.selectByExample(example);
if (CollectionUtils.isEmpty(list)) {
CameraSchedule record = new CameraSchedule();
record.setTermId(results.getTermId());
record.setChannelId(channel);
record.setProtocol(term.getProtocol());
record.setData(results.getData());
cameraScheduleMapper.insert(record);
} else {
CameraSchedule record = list.get(0);
record.setProtocol(term.getProtocol());
record.setData(results.getData());
cameraScheduleMapper.updateByPrimaryKeyWithBLOBs(record);
}

Loading…
Cancel
Save