Commit 502ccc7a by tyfanchz

调整代码

1 parent b41ca105
...@@ -15,8 +15,8 @@ import lombok.Data; ...@@ -15,8 +15,8 @@ import lombok.Data;
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Data @Data
@Table(name = "smart_devide_status") @Table(name = "smart_device_status")
public class SmartDevideStatus { public class SmartDeviceStatus {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id; private Integer id;
...@@ -27,11 +27,6 @@ public class SmartDevideStatus { ...@@ -27,11 +27,6 @@ public class SmartDevideStatus {
private String deviceId; private String deviceId;
/** /**
* 用户id
*/
private String uid;
/**
* 设备指令 * 设备指令
*/ */
private String deviceOrderCode; private String deviceOrderCode;
......
...@@ -29,7 +29,7 @@ public class SmartProductTypeParam { ...@@ -29,7 +29,7 @@ public class SmartProductTypeParam {
private Long id; private Long id;
/** /**
* 产品类型ID 关联smart_priduct_type中id * 产品类型ID 关联smart_product_type中id
*/ */
private Long typeId; private Long typeId;
......
package com.glsx.smart.dao.mapper; package com.glsx.smart.dao.mapper;
import java.util.List; import java.util.List;
import com.glsx.smart.dao.entity.SmartDevideStatus; import com.glsx.smart.dao.entity.SmartDeviceStatus;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -14,15 +14,15 @@ import org.apache.ibatis.annotations.Param; ...@@ -14,15 +14,15 @@ import org.apache.ibatis.annotations.Param;
*/ */
@Mapper @Mapper
public interface SmartDevideStatusMapper public interface SmartDeviceStatusMapper
extends tk.mybatis.mapper.common.Mapper<SmartDevideStatus> { extends tk.mybatis.mapper.common.Mapper<SmartDeviceStatus> {
int insertOrUpdate(SmartDevideStatus record); int insertOrUpdate(SmartDeviceStatus record);
int insertOrUpdateSelective(SmartDevideStatus record); int insertOrUpdateSelective(SmartDeviceStatus record);
int updateBatch(List<SmartDevideStatus> list); int updateBatch(List<SmartDeviceStatus> list);
int updateBatchSelective(List<SmartDevideStatus> list); int updateBatchSelective(List<SmartDeviceStatus> list);
int batchInsert(@Param("list") List<SmartDevideStatus> list); int batchInsert(@Param("list") List<SmartDeviceStatus> list);
} }
package com.glsx.smart.service;
import java.util.List;
import com.glsx.smart.dao.entity.SmartDeviceStatus;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-15
*/
public interface SmartDeviceStatusService {
int deleteByPrimaryKey(Integer id);
int insertOrUpdate(SmartDeviceStatus record);
int insertSelective(SmartDeviceStatus record);
List<SmartDeviceStatus> selectByExample(SmartDeviceStatus example);
SmartDeviceStatus selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(SmartDeviceStatus record);
int updateBatchSelective(List<SmartDeviceStatus> list);
int batchInsert(List<SmartDeviceStatus> list);
}
package com.glsx.smart.service;
import java.util.List;
import com.glsx.smart.dao.entity.SmartDevideStatus;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-15
*/
public interface SmartDevideStatusService {
int deleteByExample(SmartDevideStatus example);
int deleteByPrimaryKey(Integer id);
int insert(SmartDevideStatus record);
int insertOrUpdate(SmartDevideStatus record);
int insertOrUpdateSelective(SmartDevideStatus record);
int insertSelective(SmartDevideStatus record);
List<SmartDevideStatus> selectByExample(SmartDevideStatus example);
SmartDevideStatus selectByPrimaryKey(Integer id);
int updateByExampleSelective(SmartDevideStatus record, SmartDevideStatus example);
int updateByExample(SmartDevideStatus record, SmartDevideStatus example);
int updateByPrimaryKeySelective(SmartDevideStatus record);
int updateByPrimaryKey(SmartDevideStatus record);
int updateBatch(List<SmartDevideStatus> list);
int updateBatchSelective(List<SmartDevideStatus> list);
int batchInsert(List<SmartDevideStatus> list);
}
package com.glsx.smart.service.impl;
import javax.annotation.Resource;
import java.util.List;
import com.glsx.smart.dao.entity.SmartDeviceStatus;
import com.glsx.smart.dao.mapper.SmartDeviceStatusMapper;
import com.glsx.smart.service.SmartDeviceStatusService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-15
*/
@Slf4j
@Service
public class SmartDeviceStatusServiceImpl implements SmartDeviceStatusService {
@Resource
private SmartDeviceStatusMapper smartDeviceStatusMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return smartDeviceStatusMapper.deleteByPrimaryKey(id);
}
@Override
public int insertOrUpdate(SmartDeviceStatus record) {
return smartDeviceStatusMapper.insertOrUpdate(record);
}
@Override
public int insertSelective(SmartDeviceStatus record) {
return smartDeviceStatusMapper.insertSelective(record);
}
@Override
public List<SmartDeviceStatus> selectByExample(SmartDeviceStatus example) {
return smartDeviceStatusMapper.selectByExample(example);
}
@Override
public SmartDeviceStatus selectByPrimaryKey(Integer id) {
return smartDeviceStatusMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(SmartDeviceStatus record) {
return smartDeviceStatusMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateBatchSelective(List<SmartDeviceStatus> list) {
return smartDeviceStatusMapper.updateBatchSelective(list);
}
@Override
public int batchInsert(List<SmartDeviceStatus> list) {
return smartDeviceStatusMapper.batchInsert(list);
}
}
package com.glsx.smart.service.impl;
import javax.annotation.Resource;
import java.util.List;
import com.glsx.smart.dao.entity.SmartDevideStatus;
import com.glsx.smart.dao.mapper.SmartDevideStatusMapper;
import com.glsx.smart.service.SmartDevideStatusService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-15
*/
@Slf4j
@Service
public class SmartDevideStatusServiceImpl implements SmartDevideStatusService {
@Resource
private SmartDevideStatusMapper smartDevideStatusMapper;
@Override
public int deleteByExample(SmartDevideStatus example) {
return smartDevideStatusMapper.deleteByExample(example);
}
@Override
public int deleteByPrimaryKey(Integer id) {
return smartDevideStatusMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(SmartDevideStatus record) {
return smartDevideStatusMapper.insert(record);
}
@Override
public int insertOrUpdate(SmartDevideStatus record) {
return smartDevideStatusMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(SmartDevideStatus record) {
return smartDevideStatusMapper.insertOrUpdateSelective(record);
}
@Override
public int insertSelective(SmartDevideStatus record) {
return smartDevideStatusMapper.insertSelective(record);
}
@Override
public List<SmartDevideStatus> selectByExample(SmartDevideStatus example) {
return smartDevideStatusMapper.selectByExample(example);
}
@Override
public SmartDevideStatus selectByPrimaryKey(Integer id) {
return smartDevideStatusMapper.selectByPrimaryKey(id);
}
@Override
public int updateByExampleSelective(SmartDevideStatus record, SmartDevideStatus example) {
return smartDevideStatusMapper.updateByExampleSelective(record, example);
}
@Override
public int updateByExample(SmartDevideStatus record, SmartDevideStatus example) {
return smartDevideStatusMapper.updateByExample(record, example);
}
@Override
public int updateByPrimaryKeySelective(SmartDevideStatus record) {
return smartDevideStatusMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(SmartDevideStatus record) {
return smartDevideStatusMapper.updateByPrimaryKey(record);
}
@Override
public int updateBatch(List<SmartDevideStatus> list) {
return smartDevideStatusMapper.updateBatch(list);
}
@Override
public int updateBatchSelective(List<SmartDevideStatus> list) {
return smartDevideStatusMapper.updateBatchSelective(list);
}
@Override
public int batchInsert(List<SmartDevideStatus> list) {
return smartDevideStatusMapper.batchInsert(list);
}
}
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glsx.smart.dao.mapper.SmartDevideStatusMapper"> <mapper namespace="com.glsx.smart.dao.mapper.SmartDeviceStatusMapper">
<resultMap id="BaseResultMap" type="com.glsx.smart.dao.entity.SmartDevideStatus"> <resultMap id="BaseResultMap" type="com.glsx.smart.dao.entity.SmartDeviceStatus">
<!--@mbg.generated--> <!--@mbg.generated-->
<!--@Table smart_devide_status--> <!--@Table smart_device_status-->
<id column="id" jdbcType="INTEGER" property="id"/> <id column="id" jdbcType="INTEGER" property="id"/>
<result column="device_id" jdbcType="VARCHAR" property="deviceId"/> <result column="device_id" jdbcType="VARCHAR" property="deviceId"/>
<result column="uid" jdbcType="VARCHAR" property="uid"/>
<result column="device_order_code" jdbcType="VARCHAR" property="deviceOrderCode"/> <result column="device_order_code" jdbcType="VARCHAR" property="deviceOrderCode"/>
<result column="device_order_value" jdbcType="VARCHAR" property="deviceOrderValue"/> <result column="device_order_value" jdbcType="VARCHAR" property="deviceOrderValue"/>
<result column="createtime" jdbcType="TIMESTAMP" property="createtime"/> <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/>
...@@ -16,23 +15,18 @@ ...@@ -16,23 +15,18 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!--@mbg.generated--> <!--@mbg.generated-->
id, device_id, `uid`, device_order_code, device_order_value, createtime, updatetime, id, device_id, device_order_code, device_order_value, createtime, updatetime,
product_key product_key
</sql> </sql>
<update id="updateBatch" parameterType="java.util.List"> <update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated--> <!--@mbg.generated-->
update smart_devide_status update smart_device_status
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<trim prefix="device_id = case" suffix="end,"> <trim prefix="device_id = case" suffix="end,">
<foreach collection="list" index="index" item="item"> <foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceId,jdbcType=VARCHAR} when id = #{item.id,jdbcType=INTEGER} then #{item.deviceId,jdbcType=VARCHAR}
</foreach> </foreach>
</trim> </trim>
<trim prefix="`uid` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.uid,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="device_order_code = case" suffix="end,"> <trim prefix="device_order_code = case" suffix="end,">
<foreach collection="list" index="index" item="item"> <foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then when id = #{item.id,jdbcType=INTEGER} then
...@@ -68,7 +62,7 @@ ...@@ -68,7 +62,7 @@
</update> </update>
<update id="updateBatchSelective" parameterType="java.util.List"> <update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated--> <!--@mbg.generated-->
update smart_devide_status update smart_device_status
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<trim prefix="device_id = case" suffix="end,"> <trim prefix="device_id = case" suffix="end,">
<foreach collection="list" index="index" item="item"> <foreach collection="list" index="index" item="item">
...@@ -77,13 +71,6 @@ ...@@ -77,13 +71,6 @@
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="`uid` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.uid != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.uid,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="device_order_code = case" suffix="end,"> <trim prefix="device_order_code = case" suffix="end,">
<foreach collection="list" index="index" item="item"> <foreach collection="list" index="index" item="item">
<if test="item.deviceOrderCode != null"> <if test="item.deviceOrderCode != null">
...@@ -133,27 +120,26 @@ ...@@ -133,27 +120,26 @@
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map"
useGeneratedKeys="true"> useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
insert into smart_devide_status insert into smart_device_status
(device_id, `uid`, device_order_code, device_order_value, createtime, updatetime, (device_id, device_order_code, device_order_value, createtime, updatetime,
product_key) product_key)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.deviceId,jdbcType=VARCHAR}, #{item.uid,jdbcType=VARCHAR}, (#{item.deviceId,jdbcType=VARCHAR},
#{item.deviceOrderCode,jdbcType=VARCHAR}, #{item.deviceOrderCode,jdbcType=VARCHAR},
#{item.deviceOrderValue,jdbcType=VARCHAR}, #{item.createtime,jdbcType=TIMESTAMP}, #{item.deviceOrderValue,jdbcType=VARCHAR}, #{item.createtime,jdbcType=TIMESTAMP},
#{item.updatetime,jdbcType=TIMESTAMP}, #{item.productKey,jdbcType=VARCHAR}) #{item.updatetime,jdbcType=TIMESTAMP}, #{item.productKey,jdbcType=VARCHAR})
</foreach> </foreach>
</insert> </insert>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" <insert id="insertOrUpdate" keyColumn="id" keyProperty="id"
parameterType="com.glsx.smart.dao.entity.SmartDevideStatus" useGeneratedKeys="true"> parameterType="com.glsx.smart.dao.entity.SmartDeviceStatus" useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
insert into smart_devide_status insert into smart_device_status
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
id, id,
</if> </if>
device_id, device_id,
`uid`,
device_order_code, device_order_code,
device_order_value, device_order_value,
createtime, createtime,
...@@ -166,7 +152,6 @@ ...@@ -166,7 +152,6 @@
#{id,jdbcType=INTEGER}, #{id,jdbcType=INTEGER},
</if> </if>
#{deviceId,jdbcType=VARCHAR}, #{deviceId,jdbcType=VARCHAR},
#{uid,jdbcType=VARCHAR},
#{deviceOrderCode,jdbcType=VARCHAR}, #{deviceOrderCode,jdbcType=VARCHAR},
#{deviceOrderValue,jdbcType=VARCHAR}, #{deviceOrderValue,jdbcType=VARCHAR},
#{createtime,jdbcType=TIMESTAMP}, #{createtime,jdbcType=TIMESTAMP},
...@@ -179,7 +164,6 @@ ...@@ -179,7 +164,6 @@
id = #{id,jdbcType=INTEGER}, id = #{id,jdbcType=INTEGER},
</if> </if>
device_id = #{deviceId,jdbcType=VARCHAR}, device_id = #{deviceId,jdbcType=VARCHAR},
`uid` = #{uid,jdbcType=VARCHAR},
device_order_code = #{deviceOrderCode,jdbcType=VARCHAR}, device_order_code = #{deviceOrderCode,jdbcType=VARCHAR},
device_order_value = #{deviceOrderValue,jdbcType=VARCHAR}, device_order_value = #{deviceOrderValue,jdbcType=VARCHAR},
createtime = #{createtime,jdbcType=TIMESTAMP}, createtime = #{createtime,jdbcType=TIMESTAMP},
...@@ -188,9 +172,9 @@ ...@@ -188,9 +172,9 @@
</trim> </trim>
</insert> </insert>
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" <insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id"
parameterType="com.glsx.smart.dao.entity.SmartDevideStatus" useGeneratedKeys="true"> parameterType="com.glsx.smart.dao.entity.SmartDeviceStatus" useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
insert into smart_devide_status insert into smart_device_status
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
id, id,
...@@ -198,9 +182,6 @@ ...@@ -198,9 +182,6 @@
<if test="deviceId != null and deviceId != ''"> <if test="deviceId != null and deviceId != ''">
device_id, device_id,
</if> </if>
<if test="uid != null and uid != ''">
`uid`,
</if>
<if test="deviceOrderCode != null and deviceOrderCode != ''"> <if test="deviceOrderCode != null and deviceOrderCode != ''">
device_order_code, device_order_code,
</if> </if>
...@@ -225,9 +206,6 @@ ...@@ -225,9 +206,6 @@
<if test="deviceId != null and deviceId != ''"> <if test="deviceId != null and deviceId != ''">
#{deviceId,jdbcType=VARCHAR}, #{deviceId,jdbcType=VARCHAR},
</if> </if>
<if test="uid != null and uid != ''">
#{uid,jdbcType=VARCHAR},
</if>
<if test="deviceOrderCode != null and deviceOrderCode != ''"> <if test="deviceOrderCode != null and deviceOrderCode != ''">
#{deviceOrderCode,jdbcType=VARCHAR}, #{deviceOrderCode,jdbcType=VARCHAR},
</if> </if>
...@@ -252,9 +230,6 @@ ...@@ -252,9 +230,6 @@
<if test="deviceId != null and deviceId != ''"> <if test="deviceId != null and deviceId != ''">
device_id = #{deviceId,jdbcType=VARCHAR}, device_id = #{deviceId,jdbcType=VARCHAR},
</if> </if>
<if test="uid != null and uid != ''">
`uid` = #{uid,jdbcType=VARCHAR},
</if>
<if test="deviceOrderCode != null and deviceOrderCode != ''"> <if test="deviceOrderCode != null and deviceOrderCode != ''">
device_order_code = #{deviceOrderCode,jdbcType=VARCHAR}, device_order_code = #{deviceOrderCode,jdbcType=VARCHAR},
</if> </if>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!