perf: mntn_cmd_history和mntn_cmd_results合并

dev
huangfeng 9 months ago
parent 7a2deb17ed
commit c6fc7635ed

@ -66,7 +66,7 @@ public class MntnController extends BaseController {
@GetMapping("status")
@ApiOperation("上传命令结果")
public ResponseReult status(@RequestParam("cid") Integer cid,
public ResponseReult status(@RequestParam("cid") Long cid,
@RequestParam("res") Integer res,
@RequestParam("content") String content) {
service.result(cid, res, content);

@ -56,7 +56,7 @@ public class MntnCmdHistory {
*
* @mbg.generated
*/
private Byte status;
private Integer status;
/**
*
@ -76,6 +76,33 @@ public class MntnCmdHistory {
*/
private Date publishTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_cmd_history.result
*
* @mbg.generated
*/
private Integer result;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_cmd_history.res_time
*
* @mbg.generated
*/
private Date resTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_cmd_history.content
*
* @mbg.generated
*/
private String content;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_cmd_history.id
@ -204,7 +231,7 @@ public class MntnCmdHistory {
*
* @mbg.generated
*/
public Byte getStatus() {
public Integer getStatus() {
return status;
}
@ -216,7 +243,7 @@ public class MntnCmdHistory {
*
* @mbg.generated
*/
public void setStatus(Byte status) {
public void setStatus(Integer status) {
this.status = status;
}
@ -268,6 +295,78 @@ public class MntnCmdHistory {
this.publishTime = publishTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_cmd_history.result
*
* @return the value of mntn_cmd_history.result
*
* @mbg.generated
*/
public Integer getResult() {
return result;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_cmd_history.result
*
* @param result the value for mntn_cmd_history.result
*
* @mbg.generated
*/
public void setResult(Integer result) {
this.result = result;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_cmd_history.res_time
*
* @return the value of mntn_cmd_history.res_time
*
* @mbg.generated
*/
public Date getResTime() {
return resTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_cmd_history.res_time
*
* @param resTime the value for mntn_cmd_history.res_time
*
* @mbg.generated
*/
public void setResTime(Date resTime) {
this.resTime = resTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_cmd_history.content
*
* @return the value of mntn_cmd_history.content
*
* @mbg.generated
*/
public String getContent() {
return content;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_cmd_history.content
*
* @param content the value for mntn_cmd_history.content
*
* @mbg.generated
*/
public void setContent(String content) {
this.content = content;
}
private Terminals terminal;
public Terminals getTerminal() {

@ -535,52 +535,52 @@ public class MntnCmdHistoryExample {
return (Criteria) this;
}
public Criteria andStatusEqualTo(Byte value) {
public Criteria andStatusEqualTo(Integer value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Byte value) {
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Byte value) {
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Byte value) {
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Byte value) {
public Criteria andStatusLessThan(Integer value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Byte value) {
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Byte> values) {
public Criteria andStatusIn(List<Integer> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Byte> values) {
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Byte value1, Byte value2) {
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Byte value1, Byte value2) {
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
@ -704,6 +704,126 @@ public class MntnCmdHistoryExample {
addCriterion("publish_time not between", value1, value2, "publishTime");
return (Criteria) this;
}
public Criteria andResultIsNull() {
addCriterion("`result` is null");
return (Criteria) this;
}
public Criteria andResultIsNotNull() {
addCriterion("`result` is not null");
return (Criteria) this;
}
public Criteria andResultEqualTo(Integer value) {
addCriterion("`result` =", value, "result");
return (Criteria) this;
}
public Criteria andResultNotEqualTo(Integer value) {
addCriterion("`result` <>", value, "result");
return (Criteria) this;
}
public Criteria andResultGreaterThan(Integer value) {
addCriterion("`result` >", value, "result");
return (Criteria) this;
}
public Criteria andResultGreaterThanOrEqualTo(Integer value) {
addCriterion("`result` >=", value, "result");
return (Criteria) this;
}
public Criteria andResultLessThan(Integer value) {
addCriterion("`result` <", value, "result");
return (Criteria) this;
}
public Criteria andResultLessThanOrEqualTo(Integer value) {
addCriterion("`result` <=", value, "result");
return (Criteria) this;
}
public Criteria andResultIn(List<Integer> values) {
addCriterion("`result` in", values, "result");
return (Criteria) this;
}
public Criteria andResultNotIn(List<Integer> values) {
addCriterion("`result` not in", values, "result");
return (Criteria) this;
}
public Criteria andResultBetween(Integer value1, Integer value2) {
addCriterion("`result` between", value1, value2, "result");
return (Criteria) this;
}
public Criteria andResultNotBetween(Integer value1, Integer value2) {
addCriterion("`result` not between", value1, value2, "result");
return (Criteria) this;
}
public Criteria andResTimeIsNull() {
addCriterion("res_time is null");
return (Criteria) this;
}
public Criteria andResTimeIsNotNull() {
addCriterion("res_time is not null");
return (Criteria) this;
}
public Criteria andResTimeEqualTo(Date value) {
addCriterion("res_time =", value, "resTime");
return (Criteria) this;
}
public Criteria andResTimeNotEqualTo(Date value) {
addCriterion("res_time <>", value, "resTime");
return (Criteria) this;
}
public Criteria andResTimeGreaterThan(Date value) {
addCriterion("res_time >", value, "resTime");
return (Criteria) this;
}
public Criteria andResTimeGreaterThanOrEqualTo(Date value) {
addCriterion("res_time >=", value, "resTime");
return (Criteria) this;
}
public Criteria andResTimeLessThan(Date value) {
addCriterion("res_time <", value, "resTime");
return (Criteria) this;
}
public Criteria andResTimeLessThanOrEqualTo(Date value) {
addCriterion("res_time <=", value, "resTime");
return (Criteria) this;
}
public Criteria andResTimeIn(List<Date> values) {
addCriterion("res_time in", values, "resTime");
return (Criteria) this;
}
public Criteria andResTimeNotIn(List<Date> values) {
addCriterion("res_time not in", values, "resTime");
return (Criteria) this;
}
public Criteria andResTimeBetween(Date value1, Date value2) {
addCriterion("res_time between", value1, value2, "resTime");
return (Criteria) this;
}
public Criteria andResTimeNotBetween(Date value1, Date value2) {
addCriterion("res_time not between", value1, value2, "resTime");
return (Criteria) this;
}
}
/**

@ -47,6 +47,14 @@ public interface MntnCmdHistoryMapper {
*/
int insertSelective(MntnCmdHistory row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_cmd_history
*
* @mbg.generated
*/
List<MntnCmdHistory> selectByExampleWithBLOBs(MntnCmdHistoryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_cmd_history
@ -71,6 +79,14 @@ public interface MntnCmdHistoryMapper {
*/
int updateByExampleSelective(@Param("row") MntnCmdHistory row, @Param("example") MntnCmdHistoryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_cmd_history
*
* @mbg.generated
*/
int updateByExampleWithBLOBs(@Param("row") MntnCmdHistory row, @Param("example") MntnCmdHistoryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_cmd_history
@ -87,6 +103,14 @@ public interface MntnCmdHistoryMapper {
*/
int updateByPrimaryKeySelective(MntnCmdHistory row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_cmd_history
*
* @mbg.generated
*/
int updateByPrimaryKeyWithBLOBs(MntnCmdHistory row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_cmd_history

@ -11,9 +11,18 @@
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="cmd" jdbcType="VARCHAR" property="cmd" />
<result column="desc" jdbcType="VARCHAR" property="desc" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="publish_time" jdbcType="TIMESTAMP" property="publishTime" />
<result column="result" jdbcType="INTEGER" property="result" />
<result column="res_time" jdbcType="TIMESTAMP" property="resTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.shxy.xymanager_common.entity.MntnCmdHistory">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<result column="content" jdbcType="LONGVARCHAR" property="content" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
@ -86,8 +95,36 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, term_id, `name`, cmd, `desc`, `status`, create_time, publish_time
id, term_id, `name`, cmd, `desc`, `status`, create_time, publish_time, `result`,
res_time
</sql>
<sql id="Blob_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
content
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.shxy.xymanager_common.entity.MntnCmdHistoryExample" resultMap="ResultMapWithBLOBs">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from mntn_cmd_history
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="com.shxy.xymanager_common.entity.MntnCmdHistoryExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
@ -106,13 +143,15 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from mntn_cmd_history
where id = #{id,jdbcType=BIGINT}
</select>
@ -139,23 +178,28 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into mntn_cmd_history (id, term_id, `name`,
cmd, `desc`, `status`,
create_time, publish_time)
values (#{id,jdbcType=BIGINT}, #{termId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{cmd,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT},
#{createTime,jdbcType=TIMESTAMP}, #{publishTime,jdbcType=TIMESTAMP})
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into mntn_cmd_history (term_id, `name`, cmd,
`desc`, `status`, create_time,
publish_time, `result`, res_time,
content)
values (#{termId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{cmd,jdbcType=VARCHAR},
#{desc,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{publishTime,jdbcType=TIMESTAMP}, #{result,jdbcType=INTEGER}, #{resTime,jdbcType=TIMESTAMP},
#{content,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.MntnCmdHistory">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into mntn_cmd_history
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="termId != null">
term_id,
</if>
@ -177,11 +221,17 @@
<if test="publishTime != null">
publish_time,
</if>
<if test="result != null">
`result`,
</if>
<if test="resTime != null">
res_time,
</if>
<if test="content != null">
content,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="termId != null">
#{termId,jdbcType=INTEGER},
</if>
@ -195,7 +245,7 @@
#{desc,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=TINYINT},
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
@ -203,6 +253,15 @@
<if test="publishTime != null">
#{publishTime,jdbcType=TIMESTAMP},
</if>
<if test="result != null">
#{result,jdbcType=INTEGER},
</if>
<if test="resTime != null">
#{resTime,jdbcType=TIMESTAMP},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.shxy.xymanager_common.entity.MntnCmdHistoryExample" resultType="java.lang.Long">
@ -238,7 +297,7 @@
`desc` = #{row.desc,jdbcType=VARCHAR},
</if>
<if test="row.status != null">
`status` = #{row.status,jdbcType=TINYINT},
`status` = #{row.status,jdbcType=INTEGER},
</if>
<if test="row.createTime != null">
create_time = #{row.createTime,jdbcType=TIMESTAMP},
@ -246,11 +305,41 @@
<if test="row.publishTime != null">
publish_time = #{row.publishTime,jdbcType=TIMESTAMP},
</if>
<if test="row.result != null">
`result` = #{row.result,jdbcType=INTEGER},
</if>
<if test="row.resTime != null">
res_time = #{row.resTime,jdbcType=TIMESTAMP},
</if>
<if test="row.content != null">
content = #{row.content,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update mntn_cmd_history
set id = #{row.id,jdbcType=BIGINT},
term_id = #{row.termId,jdbcType=INTEGER},
`name` = #{row.name,jdbcType=VARCHAR},
cmd = #{row.cmd,jdbcType=VARCHAR},
`desc` = #{row.desc,jdbcType=VARCHAR},
`status` = #{row.status,jdbcType=INTEGER},
create_time = #{row.createTime,jdbcType=TIMESTAMP},
publish_time = #{row.publishTime,jdbcType=TIMESTAMP},
`result` = #{row.result,jdbcType=INTEGER},
res_time = #{row.resTime,jdbcType=TIMESTAMP},
content = #{row.content,jdbcType=LONGVARCHAR}
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbg.generated
@ -262,9 +351,11 @@
`name` = #{row.name,jdbcType=VARCHAR},
cmd = #{row.cmd,jdbcType=VARCHAR},
`desc` = #{row.desc,jdbcType=VARCHAR},
`status` = #{row.status,jdbcType=TINYINT},
`status` = #{row.status,jdbcType=INTEGER},
create_time = #{row.createTime,jdbcType=TIMESTAMP},
publish_time = #{row.publishTime,jdbcType=TIMESTAMP}
publish_time = #{row.publishTime,jdbcType=TIMESTAMP},
`result` = #{row.result,jdbcType=INTEGER},
res_time = #{row.resTime,jdbcType=TIMESTAMP}
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -289,7 +380,7 @@
`desc` = #{desc,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=TINYINT},
`status` = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
@ -297,9 +388,36 @@
<if test="publishTime != null">
publish_time = #{publishTime,jdbcType=TIMESTAMP},
</if>
<if test="result != null">
`result` = #{result,jdbcType=INTEGER},
</if>
<if test="resTime != null">
res_time = #{resTime,jdbcType=TIMESTAMP},
</if>
<if test="content != null">
content = #{content,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.shxy.xymanager_common.entity.MntnCmdHistory">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update mntn_cmd_history
set term_id = #{termId,jdbcType=INTEGER},
`name` = #{name,jdbcType=VARCHAR},
cmd = #{cmd,jdbcType=VARCHAR},
`desc` = #{desc,jdbcType=VARCHAR},
`status` = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
publish_time = #{publishTime,jdbcType=TIMESTAMP},
`result` = #{result,jdbcType=INTEGER},
res_time = #{resTime,jdbcType=TIMESTAMP},
content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.MntnCmdHistory">
<!--
WARNING - @mbg.generated
@ -310,9 +428,11 @@
`name` = #{name,jdbcType=VARCHAR},
cmd = #{cmd,jdbcType=VARCHAR},
`desc` = #{desc,jdbcType=VARCHAR},
`status` = #{status,jdbcType=TINYINT},
`status` = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
publish_time = #{publishTime,jdbcType=TIMESTAMP}
publish_time = #{publishTime,jdbcType=TIMESTAMP},
`result` = #{result,jdbcType=INTEGER},
res_time = #{resTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

@ -163,7 +163,7 @@ public class CmdServiceImpl implements CmdService {
}
}
criteria.andStatusEqualTo(Byte.valueOf("1"));
criteria.andStatusEqualTo(1);
if (StringUtils.isNotBlank(action)) {
criteria.andNameEqualTo(action);
@ -171,7 +171,7 @@ public class CmdServiceImpl implements CmdService {
example.setOrderByClause("id desc");
PageHelper.startPage(pageNum, pageSize);
List<MntnCmdHistory> list = historyMapper.selectByExample(example);
List<MntnCmdHistory> list = historyMapper.selectByExampleWithBLOBs(example);
this.fillHisTerm(list);
return new PageInfo<>(list);
@ -281,7 +281,7 @@ public class CmdServiceImpl implements CmdService {
history.setName(item.getName());
history.setTermId(item.getTermId());
history.setCreateTime(item.getCreateTime());
history.setStatus(Byte.valueOf("2"));
history.setStatus(2);
history.setPublishTime(new Date());
historyMapper.insert(history);
cmdsMapper.deleteByPrimaryKey(item.getId());
@ -300,7 +300,7 @@ public class CmdServiceImpl implements CmdService {
history.setName(item.getName());
history.setTermId(item.getTermId());
history.setCreateTime(item.getCreateTime());
history.setStatus(Byte.valueOf("2"));
history.setStatus(2);
history.setPublishTime(new Date());
historyMapper.insert(history);
cmdsMapper.deleteByPrimaryKey(item.getId());
@ -312,7 +312,7 @@ public class CmdServiceImpl implements CmdService {
MntnCmdHistoryExample.Criteria criteria = example.createCriteria();
MntnCmdHistory row = new MntnCmdHistory();
row.setStatus(Byte.valueOf("0"));
row.setStatus(0);
historyMapper.updateByExampleSelective(row, example);
}

@ -34,8 +34,6 @@ public class MntnServiceImpl implements MntnService {
@Resource
TerminalExtService terminalExtService;
@Resource
MntnCmdResultsMapper resultsMapper;
@Resource
CmdService cmdService;
@Override
@ -130,20 +128,21 @@ public class MntnServiceImpl implements MntnService {
history.setName(cmd.getName());
history.setTermId(cmd.getTermId());
history.setCreateTime(cmd.getCreateTime());
history.setStatus(Byte.valueOf("1"));
history.setStatus(1);
history.setPublishTime(new Date());
historyMapper.insert(history);
cmdsMapper.deleteByPrimaryKey(cmd.getId());
}
@Override
public void result(Integer cid, Integer res, String content) {
MntnCmdResults item = new MntnCmdResults();
item.setCid(cid);
item.setResult(res);
item.setContent(content);
item.setCreateTime(new Date());
resultsMapper.insert(item);
public void result(Long cid, Integer res, String content) {
MntnCmdHistory history = historyMapper.selectByPrimaryKey(cid);
if (history != null) {
history.setResult(res);
history.setContent(content);
history.setResTime(new Date());
historyMapper.updateByPrimaryKeyWithBLOBs(history);
}
}
}

@ -6,5 +6,5 @@ public interface MntnService {
HashMap<String, Object> sync(String cmdid, String ip, String multi, String data) throws Exception;
void result(Integer cid, Integer res, String content);
void result(Long cid, Integer res, String content);
}

Loading…
Cancel
Save