Commit b270d547 by fz

Merge remote-tracking branch 'origin/dev'

# Conflicts:
#	src/main/java/com/glsx/smart/controller/AiLockingkeyController.java
#	src/main/java/com/glsx/smart/dao/entity/SmartKeyCommandLog.java
#	src/main/java/com/glsx/smart/dao/entity/SmartKeyCommandLogExample.java
#	src/main/java/com/glsx/smart/dao/entity/SmartVehicleBlueKey.java
#	src/main/java/com/glsx/smart/dao/entity/SmartVehicleBlueKeyExample.java
#	src/main/java/com/glsx/smart/dao/mapper/SmartKeyCommandLogMapper.java
#	src/main/java/com/glsx/smart/dao/mapper/SmartVehicleBlueKeyMapper.java
#	src/main/java/com/glsx/smart/pojo/request/SmartCarKeyAutoSenseRequest.java
#	src/main/java/com/glsx/smart/pojo/request/SmartCarKeyCommandRequest.java
#	src/main/java/com/glsx/smart/pojo/request/SmartCarKeyNameRequest.java
#	src/main/java/com/glsx/smart/pojo/request/SmartCarKeyRegisterRequest.java
#	src/main/java/com/glsx/smart/pojo/request/SmartCarKeyRequest.java
#	src/main/java/com/glsx/smart/pojo/request/SmartCarKeyRmRequest.java
#	src/main/java/com/glsx/smart/pojo/response/SmartCarKeyResponse.java
#	src/main/java/com/glsx/smart/service/AiLockingKeyService.java
#	src/main/java/com/glsx/smart/service/SmartKeyCommandLogService.java
#	src/main/java/com/glsx/smart/service/SmartVehicleBlueKeyService.java
#	src/main/java/com/glsx/smart/service/impl/AiLockingKeyServiceImpl.java
#	src/main/java/com/glsx/smart/service/impl/SmartKeyCommandLogServiceImpl.java
#	src/main/java/com/glsx/smart/service/impl/SmartVehicleBlueKeyServiceImpl.java
#	src/main/resources/mapper/SmartKeyCommandLogMapper.xml
#	src/main/resources/mapper/SmartVehicleBlueKeyMapper.xml
2 parents 2f79ed7e 7c5bbc22
Showing 51 changed files with 3655 additions and 76 deletions
package com.glsx.smart.config;
import kafka.javaapi.producer.Producer;
import kafka.producer.ProducerConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import kafka.producer.ProducerConfig;
import java.util.Properties;
/**
......
package com.glsx.smart.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* @author fengzhi
* @version 1.0.0
* @ClassName KafkaProductorConfig.java
* @description: kafka生产消息
* @createTime 2021年03月12日 16:21:00
*/
@Data
@Configuration
@ConfigurationProperties("snow.flake")
public class SnowFlakeConfig {
private String workerId;
private String datacenterId;
}
package com.glsx.smart.config;
import com.glsx.smart.utils.SnowflakeWorker;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author fengzhi
* @version 1.0.0
* @ClassName KafkaProductorConfig.java
* @description: kafka生产消息
* @createTime 2021年03月12日 16:21:00
*/
@Slf4j
@Configuration
public class SnowWorkerConfig {
@Autowired
private SnowFlakeConfig snowFlakeConfig;
@Bean("snowflakeWorker")
public SnowflakeWorker getSnowFlakeWorker() {
String workerId = snowFlakeConfig.getWorkerId();
String datacenterId = snowFlakeConfig.getDatacenterId();
log.info("SnowWorkerConfig====workerId:"+workerId+"====datacenterId:"+datacenterId);
SnowflakeWorker worker = new SnowflakeWorker(Long.valueOf(workerId),Long.valueOf(datacenterId));
return worker;
}
}
package com.glsx.smart.controller;
import com.glsx.plat.core.web.R;
import com.glsx.smart.pojo.request.*;
import com.glsx.smart.service.AiLockingKeyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@RequestMapping("/lockingKey")
public class AiLockingkeyController {
@Autowired
private AiLockingKeyService aiLockingKeyService;
//sn查询/新增车钥匙
@GetMapping(value = "/get")
public R getLockingKey(SmartCarKeyRequest request) {
return aiLockingKeyService.getLockingKey(request);
}
//userId查询车钥匙
@GetMapping(value = "/user/getAll")
public R getAllKeyByUser(SmartCarKeyUserRequest request) {
return aiLockingKeyService.getAllKeyByUser(request);
}
//智能车钥匙解绑
@PostMapping(value = "/remove")
public R removeLockingKey(@RequestBody SmartCarKeyRmRequest request) {
return aiLockingKeyService.removeLockingKey(request);
}
//智能车钥匙注册成功后的数据保存
@PostMapping(value = "/saveRegisterInfo")
public R saveLockingKeyRegisterInfo(@RequestBody SmartCarKeyRegisterRequest request) {
return aiLockingKeyService.saveLockingKeyRegisterInfo(request);
}
//车钥匙操作指令上报
@PostMapping(value = "/logCommand")
public R LogLockingKeyCommand(@RequestBody SmartCarKeyCommandRequest request) {
return aiLockingKeyService.LogLockingKeyCommand(request);
}
//车钥匙修改昵称
@PostMapping(value = "/setName")
public R setLockingKeyName(@RequestBody SmartCarKeyNameRequest request) {
return aiLockingKeyService.setLockingKeyName(request);
}
//车钥匙修改自动感应
@PostMapping(value = "/setAutoSense")
public R setLockingKeyAutoSense(@RequestBody SmartCarKeyAutoSenseRequest request) {
return aiLockingKeyService.setLockingKeyAutoSense(request);
}
}
package com.glsx.smart.controller;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.PageInfo;
......@@ -14,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>Description: 产品列表业务
* <p>Project: chejia-smart
......
package com.glsx.smart.controller;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartProductType;
......@@ -12,6 +11,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>Description: 产品类型业务
* <p>Project: chejia-smart
......
package com.glsx.smart.controller;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.glsx.plat.common.utils.StringUtils;
import com.glsx.plat.core.web.R;
......@@ -14,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>Description:
* <p>Project: chejia-smart
......
package com.glsx.smart.controller;
import java.util.List;
import java.util.Map;
import com.glsx.plat.core.web.R;
import com.glsx.smart.pojo.FileDTO;
import com.glsx.smart.service.SmartSysFileService;
......@@ -9,11 +7,10 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* <p>Description:
......
package com.glsx.smart.dao.entity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Data;
/**
* <p>Description:
......
package com.glsx.smart.dao.entity;
import lombok.Data;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import lombok.Data;
/**
* <p>Description:
......
package com.glsx.smart.dao.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
* 智能蓝牙车钥匙指令操作日志表
*/
@Data
@Table(name = "smart_key_command_log")
public class SmartKeyCommandLog implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 用户ID
*/
private Long userId;
/**
* 平台生成的唯一CREP信息(密文)
*/
private String crepCode;
/**
* 指令代码(1、开锁;2、关锁;3、开尾门;4、寻车;5、自动感应近;6、自动感应中;7、自动感应远;8、自动感应关)
*/
private String keyCommand;
/**
* 创建时间
*/
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date createTime;
}
\ No newline at end of file
package com.glsx.smart.dao.entity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class SmartKeyCommandLogExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public SmartKeyCommandLogExample() {
oredCriteria = new ArrayList<>();
}
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;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
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 andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(Long value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(Long value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(Long value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(Long value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(Long value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<Long> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Long> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(Long value1, Long value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(Long value1, Long value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andCrepCodeIsNull() {
addCriterion("crep_code is null");
return (Criteria) this;
}
public Criteria andCrepCodeIsNotNull() {
addCriterion("crep_code is not null");
return (Criteria) this;
}
public Criteria andCrepCodeEqualTo(String value) {
addCriterion("crep_code =", value, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeNotEqualTo(String value) {
addCriterion("crep_code <>", value, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeGreaterThan(String value) {
addCriterion("crep_code >", value, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeGreaterThanOrEqualTo(String value) {
addCriterion("crep_code >=", value, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeLessThan(String value) {
addCriterion("crep_code <", value, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeLessThanOrEqualTo(String value) {
addCriterion("crep_code <=", value, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeLike(String value) {
addCriterion("crep_code like", value, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeNotLike(String value) {
addCriterion("crep_code not like", value, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeIn(List<String> values) {
addCriterion("crep_code in", values, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeNotIn(List<String> values) {
addCriterion("crep_code not in", values, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeBetween(String value1, String value2) {
addCriterion("crep_code between", value1, value2, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeNotBetween(String value1, String value2) {
addCriterion("crep_code not between", value1, value2, "crepCode");
return (Criteria) this;
}
public Criteria andKeyCommandIsNull() {
addCriterion("key_command is null");
return (Criteria) this;
}
public Criteria andKeyCommandIsNotNull() {
addCriterion("key_command is not null");
return (Criteria) this;
}
public Criteria andKeyCommandEqualTo(String value) {
addCriterion("key_command =", value, "keyCommand");
return (Criteria) this;
}
public Criteria andKeyCommandNotEqualTo(String value) {
addCriterion("key_command <>", value, "keyCommand");
return (Criteria) this;
}
public Criteria andKeyCommandGreaterThan(String value) {
addCriterion("key_command >", value, "keyCommand");
return (Criteria) this;
}
public Criteria andKeyCommandGreaterThanOrEqualTo(String value) {
addCriterion("key_command >=", value, "keyCommand");
return (Criteria) this;
}
public Criteria andKeyCommandLessThan(String value) {
addCriterion("key_command <", value, "keyCommand");
return (Criteria) this;
}
public Criteria andKeyCommandLessThanOrEqualTo(String value) {
addCriterion("key_command <=", value, "keyCommand");
return (Criteria) this;
}
public Criteria andKeyCommandLike(String value) {
addCriterion("key_command like", value, "keyCommand");
return (Criteria) this;
}
public Criteria andKeyCommandNotLike(String value) {
addCriterion("key_command not like", value, "keyCommand");
return (Criteria) this;
}
public Criteria andKeyCommandIn(List<String> values) {
addCriterion("key_command in", values, "keyCommand");
return (Criteria) this;
}
public Criteria andKeyCommandNotIn(List<String> values) {
addCriterion("key_command not in", values, "keyCommand");
return (Criteria) this;
}
public Criteria andKeyCommandBetween(String value1, String value2) {
addCriterion("key_command between", value1, value2, "keyCommand");
return (Criteria) this;
}
public Criteria andKeyCommandNotBetween(String value1, String value2) {
addCriterion("key_command not between", value1, value2, "keyCommand");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
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);
}
}
}
\ No newline at end of file
package com.glsx.smart.dao.entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import com.glsx.smart.pojo.BaseDTO;
import lombok.Data;
import javax.persistence.*;
import java.util.Date;
/**
* <p>Description:
* <p>Project: chejia-smart
......
package com.glsx.smart.dao.entity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import lombok.Data;
/**
* <p>Description:
......
package com.glsx.smart.dao.entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
import com.glsx.smart.pojo.BaseDTO;
import lombok.Data;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
/**
* <p>Description:
* <p>Project: chejia-smart
......
package com.glsx.smart.dao.entity;
import lombok.Data;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import lombok.Data;
/**
* <p>Description:
......
......@@ -9,11 +9,12 @@ package com.glsx.smart.dao.entity;
*/
import lombok.Data;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Data;
/**
* 车家智能场景模板参数表
......
package com.glsx.smart.dao.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
* 智能蓝牙车钥匙表
*/
@Data
@Table(name = "smart_vehicle_blue_key")
public class SmartVehicleBlueKey implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 用户ID
*/
private Long userId;
/**
* 智能车钥匙设备号
*/
private String sn;
/**
* 平台生成的唯一CREP信息(密文)
*/
private String crepCode;
/**
* 注册成功后生成的密钥(密文)
*/
private String secretKey;
/**
* 手机蓝牙的MAC地址
*/
private String mobileBlueMac;
/**
* 智能车钥匙MAC地址
*/
private String smartLockMac;
/**
* 车牌号
*/
private String carNumber;
/**
* 昵称
*/
private String keyName;
/**
* 自动感应状态 0:关 1:开
*/
private Integer autoSenseStatus;
/**
* 逻辑删除 0:正常 1:删除
*/
private Integer isDelete;
/**
* 创建时间
*/
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date createTime;
/**
* 手机编号
*/
private String mobileCode;
}
\ No newline at end of file
package com.glsx.smart.dao.entity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class SmartVehicleBlueKeyExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public SmartVehicleBlueKeyExample() {
oredCriteria = new ArrayList<>();
}
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;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
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 andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(Long value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(Long value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(Long value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(Long value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(Long value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<Long> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Long> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(Long value1, Long value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(Long value1, Long value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andSnIsNull() {
addCriterion("sn is null");
return (Criteria) this;
}
public Criteria andSnIsNotNull() {
addCriterion("sn is not null");
return (Criteria) this;
}
public Criteria andSnEqualTo(String value) {
addCriterion("sn =", value, "sn");
return (Criteria) this;
}
public Criteria andSnNotEqualTo(String value) {
addCriterion("sn <>", value, "sn");
return (Criteria) this;
}
public Criteria andSnGreaterThan(String value) {
addCriterion("sn >", value, "sn");
return (Criteria) this;
}
public Criteria andSnGreaterThanOrEqualTo(String value) {
addCriterion("sn >=", value, "sn");
return (Criteria) this;
}
public Criteria andSnLessThan(String value) {
addCriterion("sn <", value, "sn");
return (Criteria) this;
}
public Criteria andSnLessThanOrEqualTo(String value) {
addCriterion("sn <=", value, "sn");
return (Criteria) this;
}
public Criteria andSnLike(String value) {
addCriterion("sn like", value, "sn");
return (Criteria) this;
}
public Criteria andSnNotLike(String value) {
addCriterion("sn not like", value, "sn");
return (Criteria) this;
}
public Criteria andSnIn(List<String> values) {
addCriterion("sn in", values, "sn");
return (Criteria) this;
}
public Criteria andSnNotIn(List<String> values) {
addCriterion("sn not in", values, "sn");
return (Criteria) this;
}
public Criteria andSnBetween(String value1, String value2) {
addCriterion("sn between", value1, value2, "sn");
return (Criteria) this;
}
public Criteria andSnNotBetween(String value1, String value2) {
addCriterion("sn not between", value1, value2, "sn");
return (Criteria) this;
}
public Criteria andCrepCodeIsNull() {
addCriterion("crep_code is null");
return (Criteria) this;
}
public Criteria andCrepCodeIsNotNull() {
addCriterion("crep_code is not null");
return (Criteria) this;
}
public Criteria andCrepCodeEqualTo(String value) {
addCriterion("crep_code =", value, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeNotEqualTo(String value) {
addCriterion("crep_code <>", value, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeGreaterThan(String value) {
addCriterion("crep_code >", value, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeGreaterThanOrEqualTo(String value) {
addCriterion("crep_code >=", value, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeLessThan(String value) {
addCriterion("crep_code <", value, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeLessThanOrEqualTo(String value) {
addCriterion("crep_code <=", value, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeLike(String value) {
addCriterion("crep_code like", value, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeNotLike(String value) {
addCriterion("crep_code not like", value, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeIn(List<String> values) {
addCriterion("crep_code in", values, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeNotIn(List<String> values) {
addCriterion("crep_code not in", values, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeBetween(String value1, String value2) {
addCriterion("crep_code between", value1, value2, "crepCode");
return (Criteria) this;
}
public Criteria andCrepCodeNotBetween(String value1, String value2) {
addCriterion("crep_code not between", value1, value2, "crepCode");
return (Criteria) this;
}
public Criteria andSecretKeyIsNull() {
addCriterion("secret_key is null");
return (Criteria) this;
}
public Criteria andSecretKeyIsNotNull() {
addCriterion("secret_key is not null");
return (Criteria) this;
}
public Criteria andSecretKeyEqualTo(String value) {
addCriterion("secret_key =", value, "secretKey");
return (Criteria) this;
}
public Criteria andSecretKeyNotEqualTo(String value) {
addCriterion("secret_key <>", value, "secretKey");
return (Criteria) this;
}
public Criteria andSecretKeyGreaterThan(String value) {
addCriterion("secret_key >", value, "secretKey");
return (Criteria) this;
}
public Criteria andSecretKeyGreaterThanOrEqualTo(String value) {
addCriterion("secret_key >=", value, "secretKey");
return (Criteria) this;
}
public Criteria andSecretKeyLessThan(String value) {
addCriterion("secret_key <", value, "secretKey");
return (Criteria) this;
}
public Criteria andSecretKeyLessThanOrEqualTo(String value) {
addCriterion("secret_key <=", value, "secretKey");
return (Criteria) this;
}
public Criteria andSecretKeyLike(String value) {
addCriterion("secret_key like", value, "secretKey");
return (Criteria) this;
}
public Criteria andSecretKeyNotLike(String value) {
addCriterion("secret_key not like", value, "secretKey");
return (Criteria) this;
}
public Criteria andSecretKeyIn(List<String> values) {
addCriterion("secret_key in", values, "secretKey");
return (Criteria) this;
}
public Criteria andSecretKeyNotIn(List<String> values) {
addCriterion("secret_key not in", values, "secretKey");
return (Criteria) this;
}
public Criteria andSecretKeyBetween(String value1, String value2) {
addCriterion("secret_key between", value1, value2, "secretKey");
return (Criteria) this;
}
public Criteria andSecretKeyNotBetween(String value1, String value2) {
addCriterion("secret_key not between", value1, value2, "secretKey");
return (Criteria) this;
}
public Criteria andMobileBlueMacIsNull() {
addCriterion("mobile_blue_mac is null");
return (Criteria) this;
}
public Criteria andMobileBlueMacIsNotNull() {
addCriterion("mobile_blue_mac is not null");
return (Criteria) this;
}
public Criteria andMobileBlueMacEqualTo(String value) {
addCriterion("mobile_blue_mac =", value, "mobileBlueMac");
return (Criteria) this;
}
public Criteria andMobileBlueMacNotEqualTo(String value) {
addCriterion("mobile_blue_mac <>", value, "mobileBlueMac");
return (Criteria) this;
}
public Criteria andMobileBlueMacGreaterThan(String value) {
addCriterion("mobile_blue_mac >", value, "mobileBlueMac");
return (Criteria) this;
}
public Criteria andMobileBlueMacGreaterThanOrEqualTo(String value) {
addCriterion("mobile_blue_mac >=", value, "mobileBlueMac");
return (Criteria) this;
}
public Criteria andMobileBlueMacLessThan(String value) {
addCriterion("mobile_blue_mac <", value, "mobileBlueMac");
return (Criteria) this;
}
public Criteria andMobileBlueMacLessThanOrEqualTo(String value) {
addCriterion("mobile_blue_mac <=", value, "mobileBlueMac");
return (Criteria) this;
}
public Criteria andMobileBlueMacLike(String value) {
addCriterion("mobile_blue_mac like", value, "mobileBlueMac");
return (Criteria) this;
}
public Criteria andMobileBlueMacNotLike(String value) {
addCriterion("mobile_blue_mac not like", value, "mobileBlueMac");
return (Criteria) this;
}
public Criteria andMobileBlueMacIn(List<String> values) {
addCriterion("mobile_blue_mac in", values, "mobileBlueMac");
return (Criteria) this;
}
public Criteria andMobileBlueMacNotIn(List<String> values) {
addCriterion("mobile_blue_mac not in", values, "mobileBlueMac");
return (Criteria) this;
}
public Criteria andMobileBlueMacBetween(String value1, String value2) {
addCriterion("mobile_blue_mac between", value1, value2, "mobileBlueMac");
return (Criteria) this;
}
public Criteria andMobileBlueMacNotBetween(String value1, String value2) {
addCriterion("mobile_blue_mac not between", value1, value2, "mobileBlueMac");
return (Criteria) this;
}
public Criteria andSmartLockMacIsNull() {
addCriterion("smart_lock_Mac is null");
return (Criteria) this;
}
public Criteria andSmartLockMacIsNotNull() {
addCriterion("smart_lock_Mac is not null");
return (Criteria) this;
}
public Criteria andSmartLockMacEqualTo(String value) {
addCriterion("smart_lock_Mac =", value, "smartLockMac");
return (Criteria) this;
}
public Criteria andSmartLockMacNotEqualTo(String value) {
addCriterion("smart_lock_Mac <>", value, "smartLockMac");
return (Criteria) this;
}
public Criteria andSmartLockMacGreaterThan(String value) {
addCriterion("smart_lock_Mac >", value, "smartLockMac");
return (Criteria) this;
}
public Criteria andSmartLockMacGreaterThanOrEqualTo(String value) {
addCriterion("smart_lock_Mac >=", value, "smartLockMac");
return (Criteria) this;
}
public Criteria andSmartLockMacLessThan(String value) {
addCriterion("smart_lock_Mac <", value, "smartLockMac");
return (Criteria) this;
}
public Criteria andSmartLockMacLessThanOrEqualTo(String value) {
addCriterion("smart_lock_Mac <=", value, "smartLockMac");
return (Criteria) this;
}
public Criteria andSmartLockMacLike(String value) {
addCriterion("smart_lock_Mac like", value, "smartLockMac");
return (Criteria) this;
}
public Criteria andSmartLockMacNotLike(String value) {
addCriterion("smart_lock_Mac not like", value, "smartLockMac");
return (Criteria) this;
}
public Criteria andSmartLockMacIn(List<String> values) {
addCriterion("smart_lock_Mac in", values, "smartLockMac");
return (Criteria) this;
}
public Criteria andSmartLockMacNotIn(List<String> values) {
addCriterion("smart_lock_Mac not in", values, "smartLockMac");
return (Criteria) this;
}
public Criteria andSmartLockMacBetween(String value1, String value2) {
addCriterion("smart_lock_Mac between", value1, value2, "smartLockMac");
return (Criteria) this;
}
public Criteria andSmartLockMacNotBetween(String value1, String value2) {
addCriterion("smart_lock_Mac not between", value1, value2, "smartLockMac");
return (Criteria) this;
}
public Criteria andCarNumberIsNull() {
addCriterion("car_number is null");
return (Criteria) this;
}
public Criteria andCarNumberIsNotNull() {
addCriterion("car_number is not null");
return (Criteria) this;
}
public Criteria andCarNumberEqualTo(String value) {
addCriterion("car_number =", value, "carNumber");
return (Criteria) this;
}
public Criteria andCarNumberNotEqualTo(String value) {
addCriterion("car_number <>", value, "carNumber");
return (Criteria) this;
}
public Criteria andCarNumberGreaterThan(String value) {
addCriterion("car_number >", value, "carNumber");
return (Criteria) this;
}
public Criteria andCarNumberGreaterThanOrEqualTo(String value) {
addCriterion("car_number >=", value, "carNumber");
return (Criteria) this;
}
public Criteria andCarNumberLessThan(String value) {
addCriterion("car_number <", value, "carNumber");
return (Criteria) this;
}
public Criteria andCarNumberLessThanOrEqualTo(String value) {
addCriterion("car_number <=", value, "carNumber");
return (Criteria) this;
}
public Criteria andCarNumberLike(String value) {
addCriterion("car_number like", value, "carNumber");
return (Criteria) this;
}
public Criteria andCarNumberNotLike(String value) {
addCriterion("car_number not like", value, "carNumber");
return (Criteria) this;
}
public Criteria andCarNumberIn(List<String> values) {
addCriterion("car_number in", values, "carNumber");
return (Criteria) this;
}
public Criteria andCarNumberNotIn(List<String> values) {
addCriterion("car_number not in", values, "carNumber");
return (Criteria) this;
}
public Criteria andCarNumberBetween(String value1, String value2) {
addCriterion("car_number between", value1, value2, "carNumber");
return (Criteria) this;
}
public Criteria andCarNumberNotBetween(String value1, String value2) {
addCriterion("car_number not between", value1, value2, "carNumber");
return (Criteria) this;
}
public Criteria andKeyNameIsNull() {
addCriterion("key_name is null");
return (Criteria) this;
}
public Criteria andKeyNameIsNotNull() {
addCriterion("key_name is not null");
return (Criteria) this;
}
public Criteria andKeyNameEqualTo(String value) {
addCriterion("key_name =", value, "keyName");
return (Criteria) this;
}
public Criteria andKeyNameNotEqualTo(String value) {
addCriterion("key_name <>", value, "keyName");
return (Criteria) this;
}
public Criteria andKeyNameGreaterThan(String value) {
addCriterion("key_name >", value, "keyName");
return (Criteria) this;
}
public Criteria andKeyNameGreaterThanOrEqualTo(String value) {
addCriterion("key_name >=", value, "keyName");
return (Criteria) this;
}
public Criteria andKeyNameLessThan(String value) {
addCriterion("key_name <", value, "keyName");
return (Criteria) this;
}
public Criteria andKeyNameLessThanOrEqualTo(String value) {
addCriterion("key_name <=", value, "keyName");
return (Criteria) this;
}
public Criteria andKeyNameLike(String value) {
addCriterion("key_name like", value, "keyName");
return (Criteria) this;
}
public Criteria andKeyNameNotLike(String value) {
addCriterion("key_name not like", value, "keyName");
return (Criteria) this;
}
public Criteria andKeyNameIn(List<String> values) {
addCriterion("key_name in", values, "keyName");
return (Criteria) this;
}
public Criteria andKeyNameNotIn(List<String> values) {
addCriterion("key_name not in", values, "keyName");
return (Criteria) this;
}
public Criteria andKeyNameBetween(String value1, String value2) {
addCriterion("key_name between", value1, value2, "keyName");
return (Criteria) this;
}
public Criteria andKeyNameNotBetween(String value1, String value2) {
addCriterion("key_name not between", value1, value2, "keyName");
return (Criteria) this;
}
public Criteria andAutoSenseStatusIsNull() {
addCriterion("auto_sense_status is null");
return (Criteria) this;
}
public Criteria andAutoSenseStatusIsNotNull() {
addCriterion("auto_sense_status is not null");
return (Criteria) this;
}
public Criteria andAutoSenseStatusEqualTo(Integer value) {
addCriterion("auto_sense_status =", value, "autoSenseStatus");
return (Criteria) this;
}
public Criteria andAutoSenseStatusNotEqualTo(Integer value) {
addCriterion("auto_sense_status <>", value, "autoSenseStatus");
return (Criteria) this;
}
public Criteria andAutoSenseStatusGreaterThan(Integer value) {
addCriterion("auto_sense_status >", value, "autoSenseStatus");
return (Criteria) this;
}
public Criteria andAutoSenseStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("auto_sense_status >=", value, "autoSenseStatus");
return (Criteria) this;
}
public Criteria andAutoSenseStatusLessThan(Integer value) {
addCriterion("auto_sense_status <", value, "autoSenseStatus");
return (Criteria) this;
}
public Criteria andAutoSenseStatusLessThanOrEqualTo(Integer value) {
addCriterion("auto_sense_status <=", value, "autoSenseStatus");
return (Criteria) this;
}
public Criteria andAutoSenseStatusIn(List<Integer> values) {
addCriterion("auto_sense_status in", values, "autoSenseStatus");
return (Criteria) this;
}
public Criteria andAutoSenseStatusNotIn(List<Integer> values) {
addCriterion("auto_sense_status not in", values, "autoSenseStatus");
return (Criteria) this;
}
public Criteria andAutoSenseStatusBetween(Integer value1, Integer value2) {
addCriterion("auto_sense_status between", value1, value2, "autoSenseStatus");
return (Criteria) this;
}
public Criteria andAutoSenseStatusNotBetween(Integer value1, Integer value2) {
addCriterion("auto_sense_status not between", value1, value2, "autoSenseStatus");
return (Criteria) this;
}
public Criteria andIsDeleteIsNull() {
addCriterion("is_delete is null");
return (Criteria) this;
}
public Criteria andIsDeleteIsNotNull() {
addCriterion("is_delete is not null");
return (Criteria) this;
}
public Criteria andIsDeleteEqualTo(Integer value) {
addCriterion("is_delete =", value, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteNotEqualTo(Integer value) {
addCriterion("is_delete <>", value, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteGreaterThan(Integer value) {
addCriterion("is_delete >", value, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteGreaterThanOrEqualTo(Integer value) {
addCriterion("is_delete >=", value, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteLessThan(Integer value) {
addCriterion("is_delete <", value, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteLessThanOrEqualTo(Integer value) {
addCriterion("is_delete <=", value, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteIn(List<Integer> values) {
addCriterion("is_delete in", values, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteNotIn(List<Integer> values) {
addCriterion("is_delete not in", values, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteBetween(Integer value1, Integer value2) {
addCriterion("is_delete between", value1, value2, "isDelete");
return (Criteria) this;
}
public Criteria andIsDeleteNotBetween(Integer value1, Integer value2) {
addCriterion("is_delete not between", value1, value2, "isDelete");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andMobileCodeIsNull() {
addCriterion("mobile_code is null");
return (Criteria) this;
}
public Criteria andMobileCodeIsNotNull() {
addCriterion("mobile_code is not null");
return (Criteria) this;
}
public Criteria andMobileCodeEqualTo(String value) {
addCriterion("mobile_code =", value, "mobileCode");
return (Criteria) this;
}
public Criteria andMobileCodeNotEqualTo(String value) {
addCriterion("mobile_code <>", value, "mobileCode");
return (Criteria) this;
}
public Criteria andMobileCodeGreaterThan(String value) {
addCriterion("mobile_code >", value, "mobileCode");
return (Criteria) this;
}
public Criteria andMobileCodeGreaterThanOrEqualTo(String value) {
addCriterion("mobile_code >=", value, "mobileCode");
return (Criteria) this;
}
public Criteria andMobileCodeLessThan(String value) {
addCriterion("mobile_code <", value, "mobileCode");
return (Criteria) this;
}
public Criteria andMobileCodeLessThanOrEqualTo(String value) {
addCriterion("mobile_code <=", value, "mobileCode");
return (Criteria) this;
}
public Criteria andMobileCodeLike(String value) {
addCriterion("mobile_code like", value, "mobileCode");
return (Criteria) this;
}
public Criteria andMobileCodeNotLike(String value) {
addCriterion("mobile_code not like", value, "mobileCode");
return (Criteria) this;
}
public Criteria andMobileCodeIn(List<String> values) {
addCriterion("mobile_code in", values, "mobileCode");
return (Criteria) this;
}
public Criteria andMobileCodeNotIn(List<String> values) {
addCriterion("mobile_code not in", values, "mobileCode");
return (Criteria) this;
}
public Criteria andMobileCodeBetween(String value1, String value2) {
addCriterion("mobile_code between", value1, value2, "mobileCode");
return (Criteria) this;
}
public Criteria andMobileCodeNotBetween(String value1, String value2) {
addCriterion("mobile_code not between", value1, value2, "mobileCode");
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);
}
}
}
\ No newline at end of file
package com.glsx.smart.dao.mapper;
import java.util.List;
import com.glsx.smart.dao.entity.SmartDeviceStatus;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>Description:
......
package com.glsx.smart.dao.mapper;
import com.glsx.smart.dao.entity.SmartKeyCommandLog;
import com.glsx.smart.dao.entity.SmartKeyCommandLogExample;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface SmartKeyCommandLogMapper {
long countByExample(SmartKeyCommandLogExample example);
int deleteByExample(SmartKeyCommandLogExample example);
int deleteByPrimaryKey(Long id);
int insert(SmartKeyCommandLog record);
int insertSelective(SmartKeyCommandLog record);
List<SmartKeyCommandLog> selectByExample(SmartKeyCommandLogExample example);
SmartKeyCommandLog selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") SmartKeyCommandLog record, @Param("example") SmartKeyCommandLogExample example);
int updateByExample(@Param("record") SmartKeyCommandLog record, @Param("example") SmartKeyCommandLogExample example);
int updateByPrimaryKeySelective(SmartKeyCommandLog record);
int updateByPrimaryKey(SmartKeyCommandLog record);
}
\ No newline at end of file
package com.glsx.smart.dao.mapper;
import java.util.List;
import com.glsx.smart.dao.entity.SmartSysCode;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>Description:
* <p>Project: chejia-smart
......
package com.glsx.smart.dao.mapper;
import com.glsx.smart.dao.entity.SmartVehicleBlueKey;
import com.glsx.smart.dao.entity.SmartVehicleBlueKeyExample;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface SmartVehicleBlueKeyMapper {
long countByExample(SmartVehicleBlueKeyExample example);
int deleteByExample(SmartVehicleBlueKeyExample example);
int deleteByPrimaryKey(Long id);
int insert(SmartVehicleBlueKey record);
int insertSelective(SmartVehicleBlueKey record);
List<SmartVehicleBlueKey> selectByExample(SmartVehicleBlueKeyExample example);
SmartVehicleBlueKey selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") SmartVehicleBlueKey record, @Param("example") SmartVehicleBlueKeyExample example);
int updateByExample(@Param("record") SmartVehicleBlueKey record, @Param("example") SmartVehicleBlueKeyExample example);
int updateByPrimaryKeySelective(SmartVehicleBlueKey record);
int updateByPrimaryKey(SmartVehicleBlueKey record);
}
\ No newline at end of file
package com.glsx.smart.filter;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Enumeration;
import com.glsx.plat.common.utils.StringUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Enumeration;
/**
* <p>Description: 跨域配置
* <p>Project: chejia-smart
......
package com.glsx.smart.pojo;
import javax.persistence.Transient;
import lombok.Data;
import javax.persistence.Transient;
/**
* @author think.wang
* @version 1.0.0
......
package com.glsx.smart.pojo.request;
import lombok.Data;
/**
* 智能车钥匙,自动感应状态
*/
@Data
public class SmartCarKeyAutoSenseRequest{
//智能车钥匙自动感应状态
private String autoSenseStatus;
private String sn;
private String userId;
}
package com.glsx.smart.pojo.request;
import lombok.Data;
/**
* 智能车钥匙,指令上报
*/
@Data
public class SmartCarKeyCommandRequest{
//平台生成的唯一CREP信息
private String crepCode;
//指令代码
//1、开锁;2、关锁;3、开尾门;4、寻车;5、自动感应近;
// 6、自动感应中;7、自动感应远;8、自动感应关
private String keyCommand;
//用户id
private String userId;
}
package com.glsx.smart.pojo.request;
import lombok.Data;
/**
* 智能车钥匙,昵称
*/
@Data
public class SmartCarKeyNameRequest{
//昵称
private String keyName;
private String sn;
private String userId;
}
package com.glsx.smart.pojo.request;
import lombok.Data;
/**
* 智能车钥匙,注册信息保存
*/
@Data
public class SmartCarKeyRegisterRequest{
//手机蓝牙的MAC地址
private String mobileMac;
//平台生成的唯一CREP信息
private String crepCode;
//注册成功后生成的密钥
private String secretKey;
//智能车钥匙MAC地址
private String smartLockMac;
//手机编号
private String mobileCode;
private String userId;
}
package com.glsx.smart.pojo.request;
import lombok.Data;
/**
* 智能车钥匙,查询车钥匙和生成crep接口
*/
@Data
public class SmartCarKeyRequest{
private String sn;
private String userId;
}
package com.glsx.smart.pojo.request;
import lombok.Data;
/**
* 智能车钥匙,解绑车钥匙接口
*/
@Data
public class SmartCarKeyRmRequest {
private String sn;
private String userId;
}
package com.glsx.smart.pojo.request;
import lombok.Data;
/**
* 智能车钥匙,指令上报
*/
@Data
public class SmartCarKeyUserRequest {
//用户id
private String userId;
}
package com.glsx.smart.pojo.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
public class SmartCarKeyResponse implements Serializable {
/**
* 用户ID
*/
private Long userId;
/**
* 智能车钥匙设备号
*/
private String sn;
/**
* 平台生成的唯一CREP信息(密文)
*/
private String crepCode;
/**
* 注册成功后生成的密钥(密文)
*/
private String secretKey;
/**
* 智能车钥匙MAC地址
*/
private String smartLockMac;
/**
* 车牌号
*/
private String carNumber;
/**
* 昵称
*/
private String keyName;
/**
* 自动感应状态 0:关 1:开
*/
private Integer autoSenseStatus;
/**
* 创建时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date createTime;
/**
* 手机编号
*/
private String mobileCode;
/**
* 手机蓝牙的MAC地址
*/
private String mobileBlueMac;
}
package com.glsx.smart.service;
import com.glsx.plat.core.web.R;
import com.glsx.smart.pojo.request.*;
/**
* <p>Description:智能车钥匙接口
* <p>Project: chejia-smart
*
* @author fenbgzhi
* @date 2021-04-19
*/
public interface AiLockingKeyService {
/**
* 通过sn获取车钥匙
*/
R getLockingKey(SmartCarKeyRequest request);
/**
* 通过sn解绑车钥匙
*/
R removeLockingKey(SmartCarKeyRmRequest request);
/**
* 车钥匙注册信息保存
*/
R saveLockingKeyRegisterInfo(SmartCarKeyRegisterRequest registerSaveRequest);
/**
* 车钥匙指令上报
*/
R LogLockingKeyCommand(SmartCarKeyCommandRequest carKeyCommandRequest);
/**
* 修改车钥匙昵称
*/
R setLockingKeyName(SmartCarKeyNameRequest name);
/**
* 修改车钥匙自动感应状态
*/
R setLockingKeyAutoSense(SmartCarKeyAutoSenseRequest autoSenseStatus);
R getAllKeyByUser(SmartCarKeyUserRequest request);
}
package com.glsx.smart.service;
import java.util.List;
import com.glsx.smart.dao.entity.SmartDeviceStatus;
import java.util.List;
/**
* <p>Description:
* <p>Project: chejia-smart
......
package com.glsx.smart.service;
import com.glsx.smart.dao.entity.SmartKeyCommandLog;
import com.glsx.smart.dao.entity.SmartKeyCommandLogExample;
import java.util.List;
public interface SmartKeyCommandLogService {
long countByExample(SmartKeyCommandLogExample example);
int deleteByExample(SmartKeyCommandLogExample example);
int deleteByPrimaryKey(Long id);
int insert(SmartKeyCommandLog record);
int insertSelective(SmartKeyCommandLog record);
List<SmartKeyCommandLog> selectByExample(SmartKeyCommandLogExample example);
SmartKeyCommandLog selectByPrimaryKey(Long id);
int updateByExampleSelective(SmartKeyCommandLog record, SmartKeyCommandLogExample example);
int updateByExample(SmartKeyCommandLog record, SmartKeyCommandLogExample example);
int updateByPrimaryKeySelective(SmartKeyCommandLog record);
int updateByPrimaryKey(SmartKeyCommandLog record);
}
......@@ -3,7 +3,6 @@ package com.glsx.smart.service;
import com.glsx.smart.dao.entity.SmartScene;
import com.glsx.smart.pojo.OrderResponse;
import java.io.IOException;
import java.util.List;
/**
......
package com.glsx.smart.service;
import com.glsx.smart.dao.entity.SmartVehicleBlueKey;
import com.glsx.smart.dao.entity.SmartVehicleBlueKeyExample;
import java.util.List;
public interface SmartVehicleBlueKeyService {
long countByExample(SmartVehicleBlueKeyExample example);
int deleteByExample(SmartVehicleBlueKeyExample example);
int deleteByPrimaryKey(Long id);
int insert(SmartVehicleBlueKey record);
int insertSelective(SmartVehicleBlueKey record);
List<SmartVehicleBlueKey> selectByExample(SmartVehicleBlueKeyExample example);
SmartVehicleBlueKey selectByPrimaryKey(Long id);
int updateByExampleSelective(SmartVehicleBlueKey record, SmartVehicleBlueKeyExample example);
int updateByExample(SmartVehicleBlueKey record, SmartVehicleBlueKeyExample example);
int updateByPrimaryKeySelective(SmartVehicleBlueKey record);
int updateByPrimaryKey(SmartVehicleBlueKey record);
}
package com.glsx.smart.service.impl;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.common.utils.StringUtils;
import com.glsx.plat.core.web.R;
import com.glsx.smart.dao.entity.SmartKeyCommandLog;
import com.glsx.smart.dao.entity.SmartVehicleBlueKey;
import com.glsx.smart.dao.entity.SmartVehicleBlueKeyExample;
import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.pojo.request.*;
import com.glsx.smart.pojo.response.SmartCarKeyResponse;
import com.glsx.smart.service.AiLockingKeyService;
import com.glsx.smart.service.SmartKeyCommandLogService;
import com.glsx.smart.service.SmartVehicleBlueKeyService;
import com.glsx.smart.utils.AesEncryptUtils;
import com.glsx.smart.utils.SnowflakeWorker;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.text.StrBuilder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* <p>Description:智能车钥匙service
* <p>Project: chejia-smart
*
* @author fengzhi
* @date 2021-04-19
*/
@Service
@Slf4j
public class AiLockingKeyServiceImpl implements AiLockingKeyService {
@Autowired
private SmartKeyCommandLogService smartKeyCommandLogService;
@Autowired
private SmartVehicleBlueKeyService smartVehicleBlueKeyService;
@Autowired
private AesEncryptUtils aesEncryptUtils;
@Autowired
private SnowflakeWorker snowflakeWorker;
//sn查询/新增车钥匙
@Override
public R getLockingKey(SmartCarKeyRequest request) {
SmartCarKeyResponse response = new SmartCarKeyResponse();
SmartVehicleBlueKeyExample example = getExampleBysn(Long.valueOf(request.getUserId()), request.getSn());
List<SmartVehicleBlueKey> smartVehicleBlueKeys = smartVehicleBlueKeyService.selectByExample(example);
if (CollectionUtils.isEmpty(smartVehicleBlueKeys)) {
//如果sn,userid没有数据,生成只含有crep钥匙信息返回
SmartVehicleBlueKey newKey = new SmartVehicleBlueKey();
//雪花算法生成crep,对称加密
String crep = getCrepCode();
String crep_encrypt = "";
//加密
try {
crep_encrypt = aesEncryptUtils.encrypt(crep);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(ResultEnum.ENCRYPT_EXCEP_1);
}
//保存,crep用明文存储
newKey.setSn(request.getSn());
newKey.setUserId(Long.valueOf(request.getUserId()));
newKey.setCrepCode(crep);
newKey.setCreateTime(new Date());
newKey.setAutoSenseStatus(0);
newKey.setIsDelete(0);
newKey.setMobileCode("0");
smartVehicleBlueKeyService.insert(newKey);
//返回,crep用密文传输
BeanUtils.copyProperties(newKey, response);
response.setCrepCode(crep_encrypt);
return R.ok().data(response);
} else {
SmartVehicleBlueKey carkey = smartVehicleBlueKeys.get(0);
String crepCode = carkey.getCrepCode();
if (StringUtils.isNotEmpty(crepCode)) {
//如果sn,userid有对应的crep,返回钥匙信息
BeanUtils.copyProperties(carkey, response);
//将数据库密钥解密成明文
String secretKey = "";
String secretKey_db = carkey.getSecretKey();
if (StringUtils.isNotEmpty(secretKey_db)) {
try {
secretKey = aesEncryptUtils.decryptSecret(secretKey_db);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(ResultEnum.ENCRYPT_EXCEP_6);
}
}
//将crep和密钥加密
String crep_encrypt = "";
String secret_key_encrypt = "";
try {
crep_encrypt = aesEncryptUtils.encrypt(crepCode);
if (StringUtils.isNotEmpty(secretKey))
secret_key_encrypt = aesEncryptUtils.encrypt(secretKey);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(ResultEnum.ENCRYPT_EXCEP_2);
}
response.setCrepCode(crep_encrypt);
response.setSecretKey(secret_key_encrypt);
return R.ok().data(response);
} else {
//如果sn,userid没有对应的crep。生成只含有crep钥匙信息返回
//雪花算法生成crep,对称加密
String crep = getCrepCode();
//将数据库密钥解密成明文
String secretKey = "";
String secretKey_db = carkey.getSecretKey();
if (StringUtils.isNotEmpty(secretKey_db)) {
try {
secretKey = aesEncryptUtils.decryptSecret(secretKey_db);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(ResultEnum.ENCRYPT_EXCEP_6);
}
}
String crep_encrypt = "";
String secret_key_encrypt = "";
//加密
try {
crep_encrypt = aesEncryptUtils.encrypt(crep);
if (StringUtils.isNotEmpty(secretKey))
secret_key_encrypt = aesEncryptUtils.encrypt(secretKey);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(ResultEnum.ENCRYPT_EXCEP_3);
}
//更新,crep用明文存储
carkey.setSn(request.getSn());
carkey.setUserId(Long.valueOf(request.getUserId()));
carkey.setCrepCode(crep);
carkey.setCreateTime(new Date());
carkey.setAutoSenseStatus(0);
carkey.setIsDelete(0);
carkey.setMobileCode("0");
smartVehicleBlueKeyService.updateByPrimaryKey(carkey);
//返回,crep用密文传输
BeanUtils.copyProperties(carkey, response);
response.setCrepCode(crep_encrypt);
response.setSecretKey(secret_key_encrypt);
return R.ok().data(response);
}
}
}
//智能车钥匙解绑
@Override
public R removeLockingKey(SmartCarKeyRmRequest request) {
SmartVehicleBlueKey smartVehicleBlueKey = new SmartVehicleBlueKey();
smartVehicleBlueKey.setIsDelete(1);
smartVehicleBlueKeyService.updateByExampleSelective(smartVehicleBlueKey, getExampleBysn(Long.valueOf(request.getUserId()), request.getSn()));
return R.ok();
}
//车钥匙操作指令上报
@Override
public R LogLockingKeyCommand(SmartCarKeyCommandRequest carKeyCommandRequest) {
SmartKeyCommandLog logData = new SmartKeyCommandLog();
logData.setUserId(Long.valueOf(carKeyCommandRequest.getUserId()));
String crep = "";
try {
crep = aesEncryptUtils.decrypt(carKeyCommandRequest.getCrepCode());
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(ResultEnum.ENCRYPT_EXCEP_4);
}
//明文存储crep
logData.setCrepCode(crep);
logData.setKeyCommand(carKeyCommandRequest.getKeyCommand());
logData.setCreateTime(new Date());
smartKeyCommandLogService.insert(logData);
return R.ok();
}
//车钥匙修改昵称
@Override
public R setLockingKeyName(SmartCarKeyNameRequest request) {
String keyName = request.getKeyName();
if (StringUtils.isBlank(keyName)) {
return R.error("keyName不能为空字符串");
}
//查询车钥匙
SmartVehicleBlueKeyExample example = new SmartVehicleBlueKeyExample();
example.createCriteria().andIsDeleteEqualTo(0)
.andSnEqualTo(request.getSn())
.andUserIdEqualTo(Long.valueOf(request.getUserId()))
;
List<SmartVehicleBlueKey> keyList = smartVehicleBlueKeyService.selectByExample(example);
if (CollectionUtils.isNotEmpty(keyList)) {
SmartVehicleBlueKey smartVehicleBlueKey = keyList.get(0);
//如果库中存在相同的昵称
String keyName_db = smartVehicleBlueKey.getKeyName();
if (StringUtils.isNotBlank(keyName_db) && keyName_db.equals(keyName)) {
return R.error("keyName重复,已存在");
}
smartVehicleBlueKey.setKeyName(keyName);
smartVehicleBlueKeyService.updateByPrimaryKeySelective(smartVehicleBlueKey);
}
return R.ok();
}
//车钥匙修改自动感应
@Override
public R setLockingKeyAutoSense(SmartCarKeyAutoSenseRequest request) {
SmartVehicleBlueKey smartVehicleBlueKey = new SmartVehicleBlueKey();
smartVehicleBlueKey.setAutoSenseStatus(Integer.valueOf(request.getAutoSenseStatus()));
smartVehicleBlueKeyService.updateByExampleSelective(smartVehicleBlueKey, getExampleBysn(Long.valueOf(request.getUserId()), request.getSn()));
return R.ok();
}
//根据用户ID查询车钥匙
@Override
public R getAllKeyByUser(SmartCarKeyUserRequest request) {
SmartVehicleBlueKeyExample example = new SmartVehicleBlueKeyExample();
example.createCriteria().andUserIdEqualTo(Long.valueOf(request.getUserId())).andIsDeleteEqualTo(0);
List<SmartVehicleBlueKey> keyList = smartVehicleBlueKeyService.selectByExample(example);
return R.ok().data(keyList);
}
//智能车钥匙注册成功后的数据保存
@Override
public R saveLockingKeyRegisterInfo(SmartCarKeyRegisterRequest request) {
//解密
String crep = "";
String keySecret = "";
try {
crep = aesEncryptUtils.decrypt(request.getCrepCode());
keySecret = aesEncryptUtils.decrypt(request.getSecretKey());
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(ResultEnum.ENCRYPT_EXCEP_5);
}
//将密钥明文加密后存入数据库
String secretKey_db = "";
if (StringUtils.isNotEmpty(keySecret)) {
try {
secretKey_db = aesEncryptUtils.encryptSecret(keySecret);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(ResultEnum.ENCRYPT_EXCEP_7);
}
}
SmartVehicleBlueKey smartVehicleBlueKey = new SmartVehicleBlueKey();
smartVehicleBlueKey.setMobileBlueMac(request.getMobileMac());
smartVehicleBlueKey.setSmartLockMac(request.getSmartLockMac());
smartVehicleBlueKey.setMobileCode(request.getMobileCode());
//明文存储
smartVehicleBlueKey.setCrepCode(crep);
smartVehicleBlueKey.setSecretKey(secretKey_db);
SmartVehicleBlueKeyExample example = new SmartVehicleBlueKeyExample();
example.createCriteria().andUserIdEqualTo(Long.valueOf(request.getUserId())).andCrepCodeEqualTo(crep).andIsDeleteEqualTo(0);
smartVehicleBlueKeyService.updateByExampleSelective(smartVehicleBlueKey, example);
return R.ok();
}
//查询车钥匙example,根据用户ID和sn查
private SmartVehicleBlueKeyExample getExampleBysn(Long userId, String sn) {
SmartVehicleBlueKeyExample example = new SmartVehicleBlueKeyExample();
example.createCriteria().andUserIdEqualTo(userId).andSnEqualTo(sn).andIsDeleteEqualTo(0);
return example;
}
//获取crep(雪花算法+userid)
private String getCrepCode() {
String snowId =Long.toHexString(snowflakeWorker.nextId());
int len = snowId.length();
if(len == 16)
return snowId;
else if(len>16){
return snowId.substring(len-16,len);
}else {
int count = 16 - len;
StrBuilder builder = new StrBuilder();
for (int i = 0;i<count;i++){
builder.append("0");
}
return builder.append(snowId).toString();
}
}
}
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;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>Description:
* <p>Project: chejia-smart
......
package com.glsx.smart.service.impl;
import com.glsx.smart.dao.entity.SmartKeyCommandLog;
import com.glsx.smart.dao.entity.SmartKeyCommandLogExample;
import com.glsx.smart.dao.mapper.SmartKeyCommandLogMapper;
import com.glsx.smart.service.SmartKeyCommandLogService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class SmartKeyCommandLogServiceImpl implements SmartKeyCommandLogService {
@Resource
private SmartKeyCommandLogMapper smartKeyCommandLogMapper;
@Override
public long countByExample(SmartKeyCommandLogExample example) {
return smartKeyCommandLogMapper.countByExample(example);
}
@Override
public int deleteByExample(SmartKeyCommandLogExample example) {
return smartKeyCommandLogMapper.deleteByExample(example);
}
@Override
public int deleteByPrimaryKey(Long id) {
return smartKeyCommandLogMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(SmartKeyCommandLog record) {
return smartKeyCommandLogMapper.insert(record);
}
@Override
public int insertSelective(SmartKeyCommandLog record) {
return smartKeyCommandLogMapper.insertSelective(record);
}
@Override
public List<SmartKeyCommandLog> selectByExample(SmartKeyCommandLogExample example) {
return smartKeyCommandLogMapper.selectByExample(example);
}
@Override
public SmartKeyCommandLog selectByPrimaryKey(Long id) {
return smartKeyCommandLogMapper.selectByPrimaryKey(id);
}
@Override
public int updateByExampleSelective(SmartKeyCommandLog record, SmartKeyCommandLogExample example) {
return smartKeyCommandLogMapper.updateByExampleSelective(record, example);
}
@Override
public int updateByExample(SmartKeyCommandLog record, SmartKeyCommandLogExample example) {
return smartKeyCommandLogMapper.updateByExample(record, example);
}
@Override
public int updateByPrimaryKeySelective(SmartKeyCommandLog record) {
return smartKeyCommandLogMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(SmartKeyCommandLog record) {
return smartKeyCommandLogMapper.updateByPrimaryKey(record);
}
}
......@@ -32,11 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
......
......@@ -11,11 +11,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
......
package com.glsx.smart.service.impl;
import com.glsx.smart.dao.entity.SmartVehicleBlueKey;
import com.glsx.smart.dao.entity.SmartVehicleBlueKeyExample;
import com.glsx.smart.dao.mapper.SmartVehicleBlueKeyMapper;
import com.glsx.smart.service.SmartVehicleBlueKeyService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class SmartVehicleBlueKeyServiceImpl implements SmartVehicleBlueKeyService {
@Resource
private SmartVehicleBlueKeyMapper smartVehicleBlueKeyMapper;
@Override
public long countByExample(SmartVehicleBlueKeyExample example) {
return smartVehicleBlueKeyMapper.countByExample(example);
}
@Override
public int deleteByExample(SmartVehicleBlueKeyExample example) {
return smartVehicleBlueKeyMapper.deleteByExample(example);
}
@Override
public int deleteByPrimaryKey(Long id) {
return smartVehicleBlueKeyMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(SmartVehicleBlueKey record) {
return smartVehicleBlueKeyMapper.insert(record);
}
@Override
public int insertSelective(SmartVehicleBlueKey record) {
return smartVehicleBlueKeyMapper.insertSelective(record);
}
@Override
public List<SmartVehicleBlueKey> selectByExample(SmartVehicleBlueKeyExample example) {
return smartVehicleBlueKeyMapper.selectByExample(example);
}
@Override
public SmartVehicleBlueKey selectByPrimaryKey(Long id) {
return smartVehicleBlueKeyMapper.selectByPrimaryKey(id);
}
@Override
public int updateByExampleSelective(SmartVehicleBlueKey record, SmartVehicleBlueKeyExample example) {
return smartVehicleBlueKeyMapper.updateByExampleSelective(record, example);
}
@Override
public int updateByExample(SmartVehicleBlueKey record, SmartVehicleBlueKeyExample example) {
return smartVehicleBlueKeyMapper.updateByExample(record, example);
}
@Override
public int updateByPrimaryKeySelective(SmartVehicleBlueKey record) {
return smartVehicleBlueKeyMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(SmartVehicleBlueKey record) {
return smartVehicleBlueKeyMapper.updateByPrimaryKey(record);
}
}
package com.glsx.smart.utils;
import org.apache.commons.codec.binary.Base64;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
@Component
public class AesEncryptUtils {
//可配置到Constant中,并读取配置文件注入,16位,自己定义
@Value("${aesencrypt.key}")
private String KEY;
//参数分别代表 算法名称/加密模式/数据填充方式
@Value("${aesencrypt.algorithmstr}")
private String ALGORITHMSTR;
//参数分别代表 算法名称/加密模式/数据填充方式
@Value("${aesencrypt.secret.key}")
private String secretKey;
/**
* 加密
*
* @param content 加密的字符串
* @param encryptKey key值
* @return
* @throws Exception
*/
public String encrypt(String content, String encryptKey) throws Exception {
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128);
Cipher cipher = Cipher.getInstance(ALGORITHMSTR);
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(encryptKey.getBytes(), "AES"));
byte[] b = cipher.doFinal(content.getBytes("utf-8"));
// 采用base64算法进行转码,避免出现中文乱码
return Base64.encodeBase64String(b);
}
/**
* 解密
*
* @param encryptStr 解密的字符串
* @param decryptKey 解密的key值
* @return
* @throws Exception
*/
public String decrypt(String encryptStr, String decryptKey) throws Exception {
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128);
Cipher cipher = Cipher.getInstance(ALGORITHMSTR);
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(decryptKey.getBytes(), "AES"));
// 采用base64算法进行转码,避免出现中文乱码
byte[] encryptBytes = Base64.decodeBase64(encryptStr);
byte[] decryptBytes = cipher.doFinal(encryptBytes);
return new String(decryptBytes);
}
public String encrypt(String content) throws Exception {
return encrypt(content, KEY);
}
public String decrypt(String encryptStr) throws Exception {
return decrypt(encryptStr, KEY);
}
public String encryptSecret(String content) throws Exception {
return encrypt(content, secretKey);
}
public String decryptSecret(String encryptStr) throws Exception {
return decrypt(encryptStr, secretKey);
}
public static void main(String[] args) throws Exception {
//Map map = new HashMap<String, String>();
//map.put("key", "value");
//map.put("中文", "汉字");
//String content = JSONObject.toJSONString(map);
//System.out.println("加密前:" + content);
//
String encrypt = encrypt1("370342948446986240110", "0BDsQu0naQF9BYGr");
System.out.println("加密后1:" + encrypt);
//
String decrypt = decrypt1("tZvuOJsVI6B8x5Yx3CBOH2MZn/3YhKbUtiVlkP9c+iU=", "0BDsQu0naQF9BYGr");
System.out.println("解密后1:" + decrypt);
String encrypt2 = encrypt1("37061517396835532890027292", "tHS9rKB161Oh9Idj");
System.out.println("加密后:" + encrypt);
////
String decrypt2 = decrypt1("pZz3WfhsWOJSxpky6q8r84EHTSL/rmlkHhcNeWR9bys=", "tHS9rKB161Oh9Idj");
System.out.println("解密后2:" + decrypt);
//
//获取16位随机密钥
String secret = getGUID();
System.out.println("生成key:" + secret);
String beginTime=new String("10:22");
String endTime=new String("10:22");
//1 直接用Date自带方法before()和after()比较
SimpleDateFormat df = new SimpleDateFormat("HH:mm");
Date sd1=df.parse(beginTime);
Date sd2=df.parse(endTime);
System.out.println(sd1.before(sd2));
System.out.println(sd1.after(sd2));
// 2 用String的compareTo()方法:
Integer i=beginTime.compareTo(endTime);
System.out.println(i);
//返回正值是代表左侧日期大于参数日期,反之亦然,日期格式必须一致
// 3 转成date格式换成秒数比较秒数大小,getTime()方法
Date sd3=df.parse(beginTime);
Date sd4=df.parse(endTime);
long long1 =sd1.getTime();
long long2= sd2.getTime();
System.out.println(long1);
System.out.println(long2);
SnowflakeWorker worker = new SnowflakeWorker(1,1);
String id = worker.nextId()+"";
String result = id.substring(id.length()-16,id.length());
System.out.println("nextid:"+id+"===res:"+result);
}
public static String decrypt1(String encryptStr, String decryptKey) throws Exception {
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128);
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(decryptKey.getBytes(), "AES"));
// 采用base64算法进行转码,避免出现中文乱码
byte[] encryptBytes = Base64.decodeBase64(encryptStr);
byte[] decryptBytes = cipher.doFinal(encryptBytes);
return new String(decryptBytes);
}
/**
* 生成16位不重复的随机数,含数字+大小写
* @return
*/
public static String getGUID() {
StringBuilder uid = new StringBuilder();
//产生16位的强随机数
Random rd = new SecureRandom();
for (int i = 0; i < 16; i++) {
//产生0-2的3位随机数
int type = rd.nextInt(3);
switch (type){
case 0:
//0-9的随机数
uid.append(rd.nextInt(10));
/*int random = ThreadLocalRandom.current().ints(0, 10)
.distinct().limit(1).findFirst().getAsInt();*/
break;
case 1:
//ASCII在65-90之间为大写,获取大写随机
uid.append((char)(rd.nextInt(25)+65));
break;
case 2:
//ASCII在97-122之间为小写,获取小写随机
uid.append((char)(rd.nextInt(25)+97));
break;
default:
break;
}
}
return uid.toString();
}
public static String encrypt1(String content, String encryptKey) throws Exception {
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128);
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(encryptKey.getBytes(), "AES"));
byte[] b = cipher.doFinal(content.getBytes("utf-8"));
// 采用base64算法进行转码,避免出现中文乱码
return Base64.encodeBase64String(b);
}
/**
* 计算中英文字符串的字节长度 <br/>
* 一个中文占3个字节
*
* @param str
* @return int 字符串的字节长度
*/
public static int getLength(String str) {
if (str == null || str.length() == 0) {
return 0;
}
try {
return str.getBytes("UTF-8").length;
} catch (UnsupportedEncodingException e) {
//logger.error("计算中英文字符串的字节长度失败,", e);
}
return 0;
}
//將10進制轉換為16進制
public static String encodeHEX(Integer numb){
String hex= Integer.toHexString(numb);
return hex;
}
//將16進制字符串轉換為10進制數字
public static int decodeHEX(String hexs){
BigInteger bigint=new BigInteger(hexs, 16);
int numb=bigint.intValue();
return numb;
}
}
package com.glsx.smart.utils;
import java.util.Date;
import java.util.Map;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.glsx.plat.common.utils.HttpUtils;
......@@ -15,6 +13,9 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.env.Environment;
import java.util.Date;
import java.util.Map;
/**
* <p>Description: 嘀加商城 API 调用工具类
* <p>Project: chejia-smart
......
......@@ -6,15 +6,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.NoHttpResponseException;
import org.apache.http.ParseException;
import org.apache.http.StatusLine;
import org.apache.http.*;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.HttpRequestRetryHandler;
......@@ -52,12 +44,7 @@ import java.io.InterruptedIOException;
import java.net.UnknownHostException;
import java.nio.charset.Charset;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
public class HttpUtil {
......
package com.glsx.smart.utils;
import cn.hutool.core.collection.CollectionUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import cn.hutool.core.collection.CollectionUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
/**
* <p>Description: 签名工具类,支持 MD5 签名和 SHA1 签名,也可以实现 {@link DigestTool} 来自定义加密方式。
......
package com.glsx.smart.utils;
/**
* @Title: SnowflakeWorker.java
* @Description: 雪花算法-生成自增长的ID,无须查库,分布式的订单编号生成算法。
* @Author saruman
* @Date 2018/5/21 16:11
* @Version V1.0
*/
public class SnowflakeWorker {
/** 时间节点,算法从2018/5/21 11:26:52这个时间点开始,可以保证69年不重复。*/
private final long epoch = 1526873212000L;
/** 机器id所占的位数 */
private final long workerIdBits = 5L;
/** 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数) */
private long maxWorkerId = -1L ^ (-1L << workerIdBits);
/** 数据中心标识id所占的位数 */
private final long dataCenterIdBits = 5L;
/** 支持的最大数据中心标识id,结果是31 */
private final long maxDataCenterId = -1L ^ (-1L << dataCenterIdBits);
/** 序列在id中占的位数 */
private final long sequenceBits = 12L;
/** 机器ID向左移12位 */
private final long workerIdShift = sequenceBits;
/** 数据标识中心id向左移17位(12+5) */
private final long dataCenterIdShift = sequenceBits + workerIdBits;
/** 时间截向左移22位(5+5+12) */
private final long timestampLeftShift = sequenceBits + workerIdBits + dataCenterIdBits;
/** 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095) */
private final long sequenceMask = -1L ^ (-1L << sequenceBits);
/** 工作机器ID(0~31)*/
private long workerId;
/** 数据中心ID(0~31) */
private long dataCenterId;
/** 毫秒内序列(0~4095) */
private long sequence = 0L;
/** 上次生成ID的时间截 */
private long lastTimestamp = -1L;
/**
* @param workerId 工作机器ID (0~31)
* @param dataCenterId 数据中心ID (0~31)
*/
public SnowflakeWorker(long workerId, long dataCenterId) {
if (workerId > maxWorkerId || workerId < 0) {
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
}
if (dataCenterId > maxDataCenterId || dataCenterId < 0) {
throw new IllegalArgumentException(String.format("dataCenter Id can't be greater than %d or less than 0", maxDataCenterId));
}
this.workerId = workerId;
this.dataCenterId = dataCenterId;
}
/**
* 获得下一个ID (该方法是线程安全的)
* @return SnowflakeId
*/
public synchronized long nextId() {
long timestamp = timeGen();
//如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常
if (timestamp < lastTimestamp) {
throw new RuntimeException(
String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
}
//如果是同一时间生成的,则进行毫秒内序列
if (lastTimestamp == timestamp) {
sequence = (sequence + 1) & sequenceMask;
//毫秒内序列溢出
if (sequence == 0) {
//阻塞到下一个毫秒,获得新的时间戳
timestamp = tilNextMillis(lastTimestamp);
}
}else { //时间戳改变,毫秒内序列重置
sequence = 0L;
}
//上次生成ID的时间截
lastTimestamp = timestamp;
//移位并通过或运算拼到一起组成64位的ID
return ((timestamp - epoch) << timestampLeftShift)
| (dataCenterId << dataCenterIdShift)
| (workerId << workerIdShift)
| sequence;
}
/**
* 阻塞到下一个毫秒,直到获得新的时间戳
* @param lastTimestamp 上次生成ID的时间截
* @return 当前时间戳
*/
private long tilNextMillis(long lastTimestamp) {
long timestamp = timeGen();
while (timestamp <= lastTimestamp) {
timestamp = timeGen();
}
return timestamp;
}
/**
* 返回以毫秒为单位的当前时间
* @return 当前时间(毫秒)
*/
private long timeGen() {
return System.currentTimeMillis();
}
//==============================Test=============================================
/** 测试 */
public static void main(String[] args) {
/*SnowflakeWorker idWorker = new SnowflakeWorker(0, 0);
for (int i = 0; i < 1000; i++) {
long id = idWorker.nextId();
System.out.println(id);
}*/
long x = -1L ^ (-1L << 63);
System.out.println(x);
System.out.println(Long.MAX_VALUE);
}
}
\ No newline at end of file
<?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="com.glsx.smart.dao.mapper.SmartKeyCommandLogMapper">
<resultMap id="BaseResultMap" type="com.glsx.smart.dao.entity.SmartKeyCommandLog">
<!--@mbg.generated-->
<!--@Table cyb_os.smart_key_command_log-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="crep_code" jdbcType="VARCHAR" property="crepCode" />
<result column="key_command" jdbcType="VARCHAR" property="keyCommand" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Example_Where_Clause">
<!--@mbg.generated-->
<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">
<!--@mbg.generated-->
<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">
<!--@mbg.generated-->
id, user_id, crep_code, key_command, create_time
</sql>
<select id="selectByExample" parameterType="com.glsx.smart.dao.entity.SmartKeyCommandLogExample" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from cyb_os.smart_key_command_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from cyb_os.smart_key_command_log
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated-->
delete from cyb_os.smart_key_command_log
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.glsx.smart.dao.entity.SmartKeyCommandLogExample">
<!--@mbg.generated-->
delete from cyb_os.smart_key_command_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.glsx.smart.dao.entity.SmartKeyCommandLog" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into cyb_os.smart_key_command_log (user_id, crep_code, key_command,
create_time)
values (#{userId,jdbcType=BIGINT}, #{crepCode,jdbcType=VARCHAR}, #{keyCommand,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.glsx.smart.dao.entity.SmartKeyCommandLog" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into cyb_os.smart_key_command_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="crepCode != null">
crep_code,
</if>
<if test="keyCommand != null">
key_command,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="crepCode != null">
#{crepCode,jdbcType=VARCHAR},
</if>
<if test="keyCommand != null">
#{keyCommand,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.glsx.smart.dao.entity.SmartKeyCommandLogExample" resultType="java.lang.Long">
<!--@mbg.generated-->
select count(*) from cyb_os.smart_key_command_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--@mbg.generated-->
update cyb_os.smart_key_command_log
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.crepCode != null">
crep_code = #{record.crepCode,jdbcType=VARCHAR},
</if>
<if test="record.keyCommand != null">
key_command = #{record.keyCommand,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--@mbg.generated-->
update cyb_os.smart_key_command_log
set id = #{record.id,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
crep_code = #{record.crepCode,jdbcType=VARCHAR},
key_command = #{record.keyCommand,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.glsx.smart.dao.entity.SmartKeyCommandLog">
<!--@mbg.generated-->
update cyb_os.smart_key_command_log
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="crepCode != null">
crep_code = #{crepCode,jdbcType=VARCHAR},
</if>
<if test="keyCommand != null">
key_command = #{keyCommand,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.glsx.smart.dao.entity.SmartKeyCommandLog">
<!--@mbg.generated-->
update cyb_os.smart_key_command_log
set user_id = #{userId,jdbcType=BIGINT},
crep_code = #{crepCode,jdbcType=VARCHAR},
key_command = #{keyCommand,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
<?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="com.glsx.smart.dao.mapper.SmartVehicleBlueKeyMapper">
<resultMap id="BaseResultMap" type="com.glsx.smart.dao.entity.SmartVehicleBlueKey">
<!--@mbg.generated-->
<!--@Table cyb_os.smart_vehicle_blue_key-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="sn" jdbcType="VARCHAR" property="sn" />
<result column="crep_code" jdbcType="VARCHAR" property="crepCode" />
<result column="secret_key" jdbcType="VARCHAR" property="secretKey" />
<result column="mobile_blue_mac" jdbcType="VARCHAR" property="mobileBlueMac" />
<result column="smart_lock_Mac" jdbcType="VARCHAR" property="smartLockMac" />
<result column="car_number" jdbcType="VARCHAR" property="carNumber" />
<result column="key_name" jdbcType="VARCHAR" property="keyName" />
<result column="auto_sense_status" jdbcType="TINYINT" property="autoSenseStatus" />
<result column="is_delete" jdbcType="TINYINT" property="isDelete" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="mobile_code" jdbcType="VARCHAR" property="mobileCode" />
</resultMap>
<sql id="Example_Where_Clause">
<!--@mbg.generated-->
<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">
<!--@mbg.generated-->
<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">
<!--@mbg.generated-->
id, user_id, sn, crep_code, secret_key, mobile_blue_mac, smart_lock_Mac, car_number,
key_name, auto_sense_status, is_delete, create_time, mobile_code
</sql>
<select id="selectByExample" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueKeyExample" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from cyb_os.smart_vehicle_blue_key
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from cyb_os.smart_vehicle_blue_key
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated-->
delete from cyb_os.smart_vehicle_blue_key
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueKeyExample">
<!--@mbg.generated-->
delete from cyb_os.smart_vehicle_blue_key
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueKey" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into cyb_os.smart_vehicle_blue_key (user_id, sn, crep_code,
secret_key, mobile_blue_mac, smart_lock_Mac,
car_number, key_name, auto_sense_status,
is_delete, create_time, mobile_code
)
values (#{userId,jdbcType=BIGINT}, #{sn,jdbcType=VARCHAR}, #{crepCode,jdbcType=VARCHAR},
#{secretKey,jdbcType=VARCHAR}, #{mobileBlueMac,jdbcType=VARCHAR}, #{smartLockMac,jdbcType=VARCHAR},
#{carNumber,jdbcType=VARCHAR}, #{keyName,jdbcType=VARCHAR}, #{autoSenseStatus,jdbcType=TINYINT},
#{isDelete,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, #{mobileCode,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueKey" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into cyb_os.smart_vehicle_blue_key
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="sn != null">
sn,
</if>
<if test="crepCode != null">
crep_code,
</if>
<if test="secretKey != null">
secret_key,
</if>
<if test="mobileBlueMac != null">
mobile_blue_mac,
</if>
<if test="smartLockMac != null">
smart_lock_Mac,
</if>
<if test="carNumber != null">
car_number,
</if>
<if test="keyName != null">
key_name,
</if>
<if test="autoSenseStatus != null">
auto_sense_status,
</if>
<if test="isDelete != null">
is_delete,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="mobileCode != null">
mobile_code,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="sn != null">
#{sn,jdbcType=VARCHAR},
</if>
<if test="crepCode != null">
#{crepCode,jdbcType=VARCHAR},
</if>
<if test="secretKey != null">
#{secretKey,jdbcType=VARCHAR},
</if>
<if test="mobileBlueMac != null">
#{mobileBlueMac,jdbcType=VARCHAR},
</if>
<if test="smartLockMac != null">
#{smartLockMac,jdbcType=VARCHAR},
</if>
<if test="carNumber != null">
#{carNumber,jdbcType=VARCHAR},
</if>
<if test="keyName != null">
#{keyName,jdbcType=VARCHAR},
</if>
<if test="autoSenseStatus != null">
#{autoSenseStatus,jdbcType=TINYINT},
</if>
<if test="isDelete != null">
#{isDelete,jdbcType=TINYINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="mobileCode != null">
#{mobileCode,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueKeyExample" resultType="java.lang.Long">
<!--@mbg.generated-->
select count(*) from cyb_os.smart_vehicle_blue_key
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--@mbg.generated-->
update cyb_os.smart_vehicle_blue_key
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.sn != null">
sn = #{record.sn,jdbcType=VARCHAR},
</if>
<if test="record.crepCode != null">
crep_code = #{record.crepCode,jdbcType=VARCHAR},
</if>
<if test="record.secretKey != null">
secret_key = #{record.secretKey,jdbcType=VARCHAR},
</if>
<if test="record.mobileBlueMac != null">
mobile_blue_mac = #{record.mobileBlueMac,jdbcType=VARCHAR},
</if>
<if test="record.smartLockMac != null">
smart_lock_Mac = #{record.smartLockMac,jdbcType=VARCHAR},
</if>
<if test="record.carNumber != null">
car_number = #{record.carNumber,jdbcType=VARCHAR},
</if>
<if test="record.keyName != null">
key_name = #{record.keyName,jdbcType=VARCHAR},
</if>
<if test="record.autoSenseStatus != null">
auto_sense_status = #{record.autoSenseStatus,jdbcType=TINYINT},
</if>
<if test="record.isDelete != null">
is_delete = #{record.isDelete,jdbcType=TINYINT},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.mobileCode != null">
mobile_code = #{record.mobileCode,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--@mbg.generated-->
update cyb_os.smart_vehicle_blue_key
set id = #{record.id,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
sn = #{record.sn,jdbcType=VARCHAR},
crep_code = #{record.crepCode,jdbcType=VARCHAR},
secret_key = #{record.secretKey,jdbcType=VARCHAR},
mobile_blue_mac = #{record.mobileBlueMac,jdbcType=VARCHAR},
smart_lock_Mac = #{record.smartLockMac,jdbcType=VARCHAR},
car_number = #{record.carNumber,jdbcType=VARCHAR},
key_name = #{record.keyName,jdbcType=VARCHAR},
auto_sense_status = #{record.autoSenseStatus,jdbcType=TINYINT},
is_delete = #{record.isDelete,jdbcType=TINYINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
mobile_code = #{record.mobileCode,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueKey">
<!--@mbg.generated-->
update cyb_os.smart_vehicle_blue_key
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="sn != null">
sn = #{sn,jdbcType=VARCHAR},
</if>
<if test="crepCode != null">
crep_code = #{crepCode,jdbcType=VARCHAR},
</if>
<if test="secretKey != null">
secret_key = #{secretKey,jdbcType=VARCHAR},
</if>
<if test="mobileBlueMac != null">
mobile_blue_mac = #{mobileBlueMac,jdbcType=VARCHAR},
</if>
<if test="smartLockMac != null">
smart_lock_Mac = #{smartLockMac,jdbcType=VARCHAR},
</if>
<if test="carNumber != null">
car_number = #{carNumber,jdbcType=VARCHAR},
</if>
<if test="keyName != null">
key_name = #{keyName,jdbcType=VARCHAR},
</if>
<if test="autoSenseStatus != null">
auto_sense_status = #{autoSenseStatus,jdbcType=TINYINT},
</if>
<if test="isDelete != null">
is_delete = #{isDelete,jdbcType=TINYINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="mobileCode != null">
mobile_code = #{mobileCode,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueKey">
<!--@mbg.generated-->
update cyb_os.smart_vehicle_blue_key
set user_id = #{userId,jdbcType=BIGINT},
sn = #{sn,jdbcType=VARCHAR},
crep_code = #{crepCode,jdbcType=VARCHAR},
secret_key = #{secretKey,jdbcType=VARCHAR},
mobile_blue_mac = #{mobileBlueMac,jdbcType=VARCHAR},
smart_lock_Mac = #{smartLockMac,jdbcType=VARCHAR},
car_number = #{carNumber,jdbcType=VARCHAR},
key_name = #{keyName,jdbcType=VARCHAR},
auto_sense_status = #{autoSenseStatus,jdbcType=TINYINT},
is_delete = #{isDelete,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
mobile_code = #{mobileCode,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!