Commit 7c70db33 by fz

1.车钥匙解绑,用户注销,小程序解绑,分享钥匙都设置为分享关闭

2.分享钥匙添加创建时间,停用时间
1 parent 04e0e86e
...@@ -49,7 +49,7 @@ public class SmartKeyBlueSense { ...@@ -49,7 +49,7 @@ public class SmartKeyBlueSense {
/** /**
* 创建时间 * 创建时间
*/ */
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat( @JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss", pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8" timezone = "GMT+8"
......
...@@ -45,7 +45,7 @@ public class SmartKeyCommandLog implements Serializable { ...@@ -45,7 +45,7 @@ public class SmartKeyCommandLog implements Serializable {
/** /**
* 创建时间 * 创建时间
*/ */
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat( @JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss", pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8" timezone = "GMT+8"
......
...@@ -39,7 +39,7 @@ public class SmartKeyCommandShareLog { ...@@ -39,7 +39,7 @@ public class SmartKeyCommandShareLog {
/** /**
* 下发时间 * 下发时间
*/ */
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat( @JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss", pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8" timezone = "GMT+8"
......
...@@ -39,19 +39,29 @@ public class SmartShareKeyBlueKey{ ...@@ -39,19 +39,29 @@ public class SmartShareKeyBlueKey{
private Long pickUserId; private Long pickUserId;
/** /**
* 分享钥匙领取时间 * 分享状态 0:关闭 1:打开
*/ */
@DateTimeFormat(pattern="yyyy-MM-dd") private Integer shareStatus;
/**
* 创建时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat( @JsonFormat(
pattern = "yyyy-MM-dd", pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8" timezone = "GMT+8"
) )
private Date pickTime; private Date createTime;
/** /**
* 分享状态 0:关闭 1:打开 * 领取时间
*/ */
private Integer shareStatus; @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date pickTime;
/** /**
* 分享钥匙过期时间 * 分享钥匙过期时间
...@@ -63,6 +73,16 @@ public class SmartShareKeyBlueKey{ ...@@ -63,6 +73,16 @@ public class SmartShareKeyBlueKey{
) )
private Date expireTime; private Date expireTime;
/**
* 停用时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date stopTime;
/*****************主钥匙********************/ /*****************主钥匙********************/
/** /**
...@@ -111,16 +131,6 @@ public class SmartShareKeyBlueKey{ ...@@ -111,16 +131,6 @@ public class SmartShareKeyBlueKey{
private Integer isDelete; 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; private String mobileCode;
......
...@@ -69,7 +69,7 @@ public class SmartVehicleBlueKey { ...@@ -69,7 +69,7 @@ public class SmartVehicleBlueKey {
/** /**
* 创建时间 * 创建时间
*/ */
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat( @JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss", pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8" timezone = "GMT+8"
......
...@@ -48,19 +48,29 @@ public class SmartVehicleBlueShareKey implements Comparable<SmartVehicleBlueShar ...@@ -48,19 +48,29 @@ public class SmartVehicleBlueShareKey implements Comparable<SmartVehicleBlueShar
private Long pickUserId; private Long pickUserId;
/** /**
* 分享钥匙领取时间 * 分享状态 1:打开 0:关闭
*/ */
@DateTimeFormat(pattern="yyyy-MM-dd") private Integer shareStatus;
/**
* 创建时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat( @JsonFormat(
pattern = "yyyy-MM-dd", pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8" timezone = "GMT+8"
) )
private Date pickTime; private Date createTime;
/** /**
* 分享状态 0:关闭 1:打开 * 领取时间
*/ */
private Integer shareStatus; @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date pickTime;
/** /**
* 分享钥匙过期时间 * 分享钥匙过期时间
...@@ -72,8 +82,18 @@ public class SmartVehicleBlueShareKey implements Comparable<SmartVehicleBlueShar ...@@ -72,8 +82,18 @@ public class SmartVehicleBlueShareKey implements Comparable<SmartVehicleBlueShar
) )
private Date expireTime; private Date expireTime;
/**
* 停用时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date stopTime;
@Override @Override
public int compareTo(SmartVehicleBlueShareKey o) { public int compareTo(com.glsx.smart.dao.entity.SmartVehicleBlueShareKey o) {
Integer data = this.getShareStatus(); Integer data = this.getShareStatus();
Integer data2 = o.getShareStatus(); Integer data2 = o.getShareStatus();
if (null == data) if (null == data)
......
...@@ -415,123 +415,183 @@ public class SmartVehicleBlueShareKeyExample { ...@@ -415,123 +415,183 @@ public class SmartVehicleBlueShareKeyExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPickTimeIsNull() { public Criteria andShareStatusIsNull() {
addCriterion("pick_time is null"); addCriterion("share_status is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPickTimeIsNotNull() { public Criteria andShareStatusIsNotNull() {
addCriterion("pick_time is not null"); addCriterion("share_status is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPickTimeEqualTo(Date value) { public Criteria andShareStatusEqualTo(Integer value) {
addCriterion("pick_time =", value, "pickTime"); addCriterion("share_status =", value, "shareStatus");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPickTimeNotEqualTo(Date value) { public Criteria andShareStatusNotEqualTo(Integer value) {
addCriterion("pick_time <>", value, "pickTime"); addCriterion("share_status <>", value, "shareStatus");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPickTimeGreaterThan(Date value) { public Criteria andShareStatusGreaterThan(Integer value) {
addCriterion("pick_time >", value, "pickTime"); addCriterion("share_status >", value, "shareStatus");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPickTimeGreaterThanOrEqualTo(Date value) { public Criteria andShareStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("pick_time >=", value, "pickTime"); addCriterion("share_status >=", value, "shareStatus");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPickTimeLessThan(Date value) { public Criteria andShareStatusLessThan(Integer value) {
addCriterion("pick_time <", value, "pickTime"); addCriterion("share_status <", value, "shareStatus");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPickTimeLessThanOrEqualTo(Date value) { public Criteria andShareStatusLessThanOrEqualTo(Integer value) {
addCriterion("pick_time <=", value, "pickTime"); addCriterion("share_status <=", value, "shareStatus");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPickTimeIn(List<Date> values) { public Criteria andShareStatusIn(List<Integer> values) {
addCriterion("pick_time in", values, "pickTime"); addCriterion("share_status in", values, "shareStatus");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPickTimeNotIn(List<Date> values) { public Criteria andShareStatusNotIn(List<Integer> values) {
addCriterion("pick_time not in", values, "pickTime"); addCriterion("share_status not in", values, "shareStatus");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPickTimeBetween(Date value1, Date value2) { public Criteria andShareStatusBetween(Integer value1, Integer value2) {
addCriterion("pick_time between", value1, value2, "pickTime"); addCriterion("share_status between", value1, value2, "shareStatus");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPickTimeNotBetween(Date value1, Date value2) { public Criteria andShareStatusNotBetween(Integer value1, Integer value2) {
addCriterion("pick_time not between", value1, value2, "pickTime"); addCriterion("share_status not between", value1, value2, "shareStatus");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareStatusIsNull() { public Criteria andCreateTimeIsNull() {
addCriterion("share_status is null"); addCriterion("create_time is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareStatusIsNotNull() { public Criteria andCreateTimeIsNotNull() {
addCriterion("share_status is not null"); addCriterion("create_time is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareStatusEqualTo(Integer value) { public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("share_status =", value, "shareStatus"); addCriterion("create_time =", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareStatusNotEqualTo(Integer value) { public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("share_status <>", value, "shareStatus"); addCriterion("create_time <>", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareStatusGreaterThan(Integer value) { public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("share_status >", value, "shareStatus"); addCriterion("create_time >", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareStatusGreaterThanOrEqualTo(Integer value) { public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("share_status >=", value, "shareStatus"); addCriterion("create_time >=", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareStatusLessThan(Integer value) { public Criteria andCreateTimeLessThan(Date value) {
addCriterion("share_status <", value, "shareStatus"); addCriterion("create_time <", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareStatusLessThanOrEqualTo(Integer value) { public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("share_status <=", value, "shareStatus"); addCriterion("create_time <=", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareStatusIn(List<Integer> values) { public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("share_status in", values, "shareStatus"); addCriterion("create_time in", values, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareStatusNotIn(List<Integer> values) { public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("share_status not in", values, "shareStatus"); addCriterion("create_time not in", values, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareStatusBetween(Integer value1, Integer value2) { public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("share_status between", value1, value2, "shareStatus"); addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareStatusNotBetween(Integer value1, Integer value2) { public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("share_status not between", value1, value2, "shareStatus"); addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andPickTimeIsNull() {
addCriterion("pick_time is null");
return (Criteria) this;
}
public Criteria andPickTimeIsNotNull() {
addCriterion("pick_time is not null");
return (Criteria) this;
}
public Criteria andPickTimeEqualTo(Date value) {
addCriterion("pick_time =", value, "pickTime");
return (Criteria) this;
}
public Criteria andPickTimeNotEqualTo(Date value) {
addCriterion("pick_time <>", value, "pickTime");
return (Criteria) this;
}
public Criteria andPickTimeGreaterThan(Date value) {
addCriterion("pick_time >", value, "pickTime");
return (Criteria) this;
}
public Criteria andPickTimeGreaterThanOrEqualTo(Date value) {
addCriterion("pick_time >=", value, "pickTime");
return (Criteria) this;
}
public Criteria andPickTimeLessThan(Date value) {
addCriterion("pick_time <", value, "pickTime");
return (Criteria) this;
}
public Criteria andPickTimeLessThanOrEqualTo(Date value) {
addCriterion("pick_time <=", value, "pickTime");
return (Criteria) this;
}
public Criteria andPickTimeIn(List<Date> values) {
addCriterion("pick_time in", values, "pickTime");
return (Criteria) this;
}
public Criteria andPickTimeNotIn(List<Date> values) {
addCriterion("pick_time not in", values, "pickTime");
return (Criteria) this;
}
public Criteria andPickTimeBetween(Date value1, Date value2) {
addCriterion("pick_time between", value1, value2, "pickTime");
return (Criteria) this;
}
public Criteria andPickTimeNotBetween(Date value1, Date value2) {
addCriterion("pick_time not between", value1, value2, "pickTime");
return (Criteria) this; return (Criteria) this;
} }
...@@ -594,6 +654,66 @@ public class SmartVehicleBlueShareKeyExample { ...@@ -594,6 +654,66 @@ public class SmartVehicleBlueShareKeyExample {
addCriterion("expire_time not between", value1, value2, "expireTime"); addCriterion("expire_time not between", value1, value2, "expireTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStopTimeIsNull() {
addCriterion("stop_time is null");
return (Criteria) this;
}
public Criteria andStopTimeIsNotNull() {
addCriterion("stop_time is not null");
return (Criteria) this;
}
public Criteria andStopTimeEqualTo(Date value) {
addCriterion("stop_time =", value, "stopTime");
return (Criteria) this;
}
public Criteria andStopTimeNotEqualTo(Date value) {
addCriterion("stop_time <>", value, "stopTime");
return (Criteria) this;
}
public Criteria andStopTimeGreaterThan(Date value) {
addCriterion("stop_time >", value, "stopTime");
return (Criteria) this;
}
public Criteria andStopTimeGreaterThanOrEqualTo(Date value) {
addCriterion("stop_time >=", value, "stopTime");
return (Criteria) this;
}
public Criteria andStopTimeLessThan(Date value) {
addCriterion("stop_time <", value, "stopTime");
return (Criteria) this;
}
public Criteria andStopTimeLessThanOrEqualTo(Date value) {
addCriterion("stop_time <=", value, "stopTime");
return (Criteria) this;
}
public Criteria andStopTimeIn(List<Date> values) {
addCriterion("stop_time in", values, "stopTime");
return (Criteria) this;
}
public Criteria andStopTimeNotIn(List<Date> values) {
addCriterion("stop_time not in", values, "stopTime");
return (Criteria) this;
}
public Criteria andStopTimeBetween(Date value1, Date value2) {
addCriterion("stop_time between", value1, value2, "stopTime");
return (Criteria) this;
}
public Criteria andStopTimeNotBetween(Date value1, Date value2) {
addCriterion("stop_time not between", value1, value2, "stopTime");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
......
package com.glsx.smart.dao.mapper; package com.glsx.smart.dao.mapper;
import com.glsx.smart.dao.entity.SmartShareKeyBlueKey; import com.glsx.smart.dao.entity.SmartShareKeyBlueKey;import com.glsx.smart.dao.entity.SmartVehicleBlueShareKey;
import com.glsx.smart.dao.entity.SmartVehicleBlueShareKey;
import com.glsx.smart.dao.entity.SmartVehicleBlueShareKeyExample; import com.glsx.smart.dao.entity.SmartVehicleBlueShareKeyExample;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -65,7 +64,9 @@ public interface SmartVehicleBlueShareKeyMapper { ...@@ -65,7 +64,9 @@ public interface SmartVehicleBlueShareKeyMapper {
*/ */
int updateByPrimaryKey(SmartVehicleBlueShareKey record); int updateByPrimaryKey(SmartVehicleBlueShareKey record);
int updateShareStatusByIds(List<Long> ids); // int updateShareStatusByIds(List<Long> ids);
List<SmartShareKeyBlueKey> getShareKeyListByUserId(Long userId); List<SmartShareKeyBlueKey> getShareKeyListByUserId(Long userId);
int closeShareKeyByMainKeyIds(List<Long> keyIds);
} }
\ No newline at end of file \ No newline at end of file
...@@ -35,8 +35,14 @@ public interface SmartVehicleBlueShareKeyService { ...@@ -35,8 +35,14 @@ public interface SmartVehicleBlueShareKeyService {
SmartVehicleBlueShareKeyExample getBlueKeyShareExampleByID(Long id); SmartVehicleBlueShareKeyExample getBlueKeyShareExampleByID(Long id);
int updateShareStatusByIds(List<Long> ids); //int updateShareStatusByIds(List<Long> ids);
List<SmartShareKeyBlueKey> getShareKeyListByUserId(Long userId); List<SmartShareKeyBlueKey> getShareKeyListByUserId(Long userId);
int closeShareKeyByCarKeyId(Long carKeyId);
int closeShareKeyByMainKeyIds(List<Long> keyIds);
} }
...@@ -106,11 +106,26 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService { ...@@ -106,11 +106,26 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
//智能车钥匙解绑 //智能车钥匙解绑
@Override @Override
public R removeLockingKey(SmartCarKeyRequest request) { public R removeLockingKey(SmartCarKeyRequest request) {
//根据userid,sn查询主钥匙
SmartVehicleBlueKeyExample example = smartVehicleBlueKeyService.getBlueKeyExampleByUserAndSn(Long.valueOf(request.getUserId()), request.getSn());
List<SmartVehicleBlueKey> keyList = smartVehicleBlueKeyService.selectByExample(example);
if(CollectionUtils.isEmpty(keyList))
return R.ok();
SmartVehicleBlueKey blueKey = keyList.get(0);
//逻辑删除蓝牙车钥匙设备 //逻辑删除蓝牙车钥匙设备
SmartVehicleBlueKey smartVehicleBlueKey = new SmartVehicleBlueKey(); SmartVehicleBlueKey smartVehicleBlueKey = new SmartVehicleBlueKey();
smartVehicleBlueKey.setIsDelete(1); smartVehicleBlueKey.setIsDelete(1);
SmartVehicleBlueKeyExample example = smartVehicleBlueKeyService.getBlueKeyExampleByUserAndSn(Long.valueOf(request.getUserId()), request.getSn()); smartVehicleBlueKeyService.updateByPrimaryKeySelective(smartVehicleBlueKey);
smartVehicleBlueKeyService.updateByExampleSelective(smartVehicleBlueKey, example);
//主钥匙ID
long carKeyId = blueKey.getId();
//分享钥匙关闭
smartVehicleBlueShareKeyService.closeShareKeyByCarKeyId(carKeyId);
return R.ok(); return R.ok();
} }
...@@ -119,15 +134,31 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService { ...@@ -119,15 +134,31 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
@Override @Override
public R removeKeysByUser(SmartCarKeyUserRequest request) { public R removeKeysByUser(SmartCarKeyUserRequest request) {
try { try {
long userId =Long.valueOf(request.getUserId()) ;
SmartVehicleBlueKey smartVehicleBlueKey = new SmartVehicleBlueKey(); SmartVehicleBlueKey smartVehicleBlueKey = new SmartVehicleBlueKey();
smartVehicleBlueKey.setIsDelete(1); smartVehicleBlueKey.setIsDelete(1);
//逻辑删除蓝牙车钥匙设备 //逻辑删除蓝牙车钥匙设备
SmartVehicleBlueKeyExample example = new SmartVehicleBlueKeyExample(); SmartVehicleBlueKeyExample example = new SmartVehicleBlueKeyExample();
example.createCriteria() example.createCriteria()
.andUserIdEqualTo(Long.valueOf(request.getUserId())) .andUserIdEqualTo(userId)
.andIsDeleteEqualTo(0); .andIsDeleteEqualTo(0);
smartVehicleBlueKeyService.updateByExampleSelective(smartVehicleBlueKey, example); List<SmartVehicleBlueKey> blueKeys = smartVehicleBlueKeyService.selectByExample(example);
List<Long> KeyIds = new ArrayList<>();
//钥匙的ID集合
if(CollectionUtils.isNotEmpty(blueKeys)){
KeyIds = blueKeys.stream().map(SmartVehicleBlueKey::getId).collect(Collectors.toList());
}
//逻辑删除主钥匙
smartVehicleBlueKeyService.updateByExampleSelective(smartVehicleBlueKey,example);
//主钥匙的分享钥匙关闭分享
if(CollectionUtils.isNotEmpty(KeyIds)){
smartVehicleBlueShareKeyService.closeShareKeyByMainKeyIds(KeyIds);
}
} catch (Exception e) { } catch (Exception e) {
return R.error(e.getMessage()); return R.error(e.getMessage());
} }
...@@ -597,12 +628,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService { ...@@ -597,12 +628,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
} }
//主钥匙如果关闭,将所有共享钥匙设置为停止共享 //主钥匙如果关闭,将所有共享钥匙设置为停止共享
SmartVehicleBlueShareKey shareKey = new SmartVehicleBlueShareKey(); smartVehicleBlueShareKeyService.closeShareKeyByCarKeyId(smartVehicleBlueKey.getId());
shareKey.setShareStatus(0);
shareKey.setExpireTime(new Date());
SmartVehicleBlueShareKeyExample shareKeyExample = smartVehicleBlueShareKeyService.getBlueKeyShareExampleByCarKeyID(smartVehicleBlueKey.getId());
smartVehicleBlueShareKeyService.updateByExampleSelective(shareKey,shareKeyExample);
return R.ok(); return R.ok();
} }
...@@ -631,6 +657,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService { ...@@ -631,6 +657,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
.sharePickStatus(0) .sharePickStatus(0)
//分享状态默认打开 //分享状态默认打开
.shareStatus(1) .shareStatus(1)
.createTime(new Date())
.expireTime(DateUtil.parse(expireTime, "yyyy-MM-dd")) .expireTime(DateUtil.parse(expireTime, "yyyy-MM-dd"))
.build(); .build();
smartVehicleBlueShareKeyService.insert(shareKey); smartVehicleBlueShareKeyService.insert(shareKey);
......
...@@ -147,7 +147,7 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService { ...@@ -147,7 +147,7 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
//分享状态关闭 //分享状态关闭
blueKey.setShareStatus(0); blueKey.setShareStatus(0);
//更新停止时间 //更新停止时间
blueKey.setExpireTime(new Date()); blueKey.setStopTime(new Date());
SmartVehicleBlueShareKeyExample example = shareKeyService.getBlueKeyShareExampleByID(keyId); SmartVehicleBlueShareKeyExample example = shareKeyService.getBlueKeyShareExampleByID(keyId);
shareKeyService.updateByExampleSelective(blueKey, example); shareKeyService.updateByExampleSelective(blueKey, example);
return R.ok(); return R.ok();
...@@ -162,31 +162,6 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService { ...@@ -162,31 +162,6 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
if (CollectionUtils.isEmpty(keyList)) if (CollectionUtils.isEmpty(keyList))
return R.ok().data(null); return R.ok().data(null);
//校验过期时间
/* SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String nowTime = sdf.format(new Date());
Date expireDate = keyList.get(0).getExpireTime();
Date nowDate = null;
try {
nowDate = sdf.parse(nowTime);
} catch (ParseException e) {
e.printStackTrace();
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_15);
}
//如果当前时间已经超过过期时间
if (nowDate.after(expireDate)){
//修改为失效
SmartVehicleBlueShareKey blueKey = new SmartVehicleBlueShareKey();
//分享状态关闭
blueKey.setShareStatus(0);
SmartVehicleBlueShareKeyExample exampleDelete = shareKeyService.getBlueKeyShareExampleByID(Long.valueOf(keyid));
shareKeyService.updateByExampleSelective(blueKey, exampleDelete);
return R.ok().data(null);
}*/
return R.ok().data(keyList.get(0)); return R.ok().data(keyList.get(0));
} }
...@@ -203,40 +178,6 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService { ...@@ -203,40 +178,6 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
Assert.notNull(userId,"用户id不能为空"); Assert.notNull(userId,"用户id不能为空");
List<SmartShareKeyBlueKey> keys = shareKeyService.getShareKeyListByUserId(userId); List<SmartShareKeyBlueKey> keys = shareKeyService.getShareKeyListByUserId(userId);
//校验过期时间
/* SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String nowTime = sdf.format(new Date());
Date nowDate = null;
try {
nowDate = sdf.parse(nowTime);
} catch (ParseException e) {
e.printStackTrace();
return R.error("时间格式不对:yyyy-MM-dd");
}
List<SmartVehicleBlueShareKey> responseList = new ArrayList<>();
List<Long> expireList = new ArrayList<>();
//过期数据分类
Date finalNowDate = nowDate;
keys.stream().forEach(key -> {
Date expireDate = key.getExpireTime();
if (finalNowDate.after(expireDate)) {
expireList.add(key.getId());
//过期关闭
key.setShareStatus(0);
key.setExpireTime(new Date());
}else {
responseList.add(key);
}
});
//如果当前时间已经超过过期时间,更新数据
if (CollectionUtils.isNotEmpty(expireList)) {
shareKeyService.updateShareStatusByIds(expireList);
}*/
return R.ok().data(keys); return R.ok().data(keys);
} }
...@@ -245,13 +186,13 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService { ...@@ -245,13 +186,13 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
long keyShareID = Long.valueOf((String) claims.get("keyShareID")); long keyShareID = Long.valueOf((String) claims.get("keyShareID"));
//是否已领取
boolean isReceive = isKeyReceive(keyShareID); boolean isReceive = isKeyReceive(keyShareID);
if(isReceive){ if(isReceive){
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_14); throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_14);
} }
//校验过期时间 //校验过期时间
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String nowTime = sdf.format(new Date()); String nowTime = sdf.format(new Date());
...@@ -262,7 +203,6 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService { ...@@ -262,7 +203,6 @@ public class AiLockingKeyShareServiceImpl implements AiLockingKeyShareService {
throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_15); throw new BusinessException(ResultEnum.CAR_KEY_EXCEP_15);
} }
Date expireDate = shareKey.getExpireTime(); Date expireDate = shareKey.getExpireTime();
Date nowDate = null; Date nowDate = null;
......
...@@ -7,6 +7,7 @@ import com.glsx.smart.dao.mapper.SmartVehicleBlueShareKeyMapper; ...@@ -7,6 +7,7 @@ import com.glsx.smart.dao.mapper.SmartVehicleBlueShareKeyMapper;
import com.glsx.smart.service.SmartVehicleBlueShareKeyService; import com.glsx.smart.service.SmartVehicleBlueShareKeyService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
@Service @Service
...@@ -96,14 +97,36 @@ public class SmartVehicleBlueShareKeyServiceImpl implements SmartVehicleBlueShar ...@@ -96,14 +97,36 @@ public class SmartVehicleBlueShareKeyServiceImpl implements SmartVehicleBlueShar
return example; return example;
} }
//@Override
//public int updateShareStatusByIds(List<Long> ids) {
// return smartVehicleBlueShareKeyMapper.updateShareStatusByIds(ids);
//}
@Override @Override
public int updateShareStatusByIds(List<Long> ids) { public List<SmartShareKeyBlueKey> getShareKeyListByUserId(Long userId) {
return smartVehicleBlueShareKeyMapper.updateShareStatusByIds(ids); return smartVehicleBlueShareKeyMapper.getShareKeyListByUserId(userId);
} }
@Override @Override
public List<SmartShareKeyBlueKey> getShareKeyListByUserId(Long userId) { public int closeShareKeyByCarKeyId(Long carKeyId) {
return smartVehicleBlueShareKeyMapper.getShareKeyListByUserId(userId); SmartVehicleBlueShareKey shareKey = new SmartVehicleBlueShareKey();
//关闭分享状态,更新过期时间
shareKey.setShareStatus(0);
shareKey.setStopTime(new Date());
SmartVehicleBlueShareKeyExample example = new SmartVehicleBlueShareKeyExample();
example.createCriteria()
.andCarKeyIdEqualTo(carKeyId)
.andShareStatusEqualTo(1);
return smartVehicleBlueShareKeyMapper.updateByExampleSelective(shareKey, example);
}
@Override
public int closeShareKeyByMainKeyIds(List<Long> keyIds) {
//关闭分享状态,更新过期时间
return smartVehicleBlueShareKeyMapper.closeShareKeyByMainKeyIds(keyIds);
} }
} }
...@@ -9,9 +9,11 @@ ...@@ -9,9 +9,11 @@
<result column="share_key_token" jdbcType="VARCHAR" property="shareKeyToken"/> <result column="share_key_token" jdbcType="VARCHAR" property="shareKeyToken"/>
<result column="share_pick_status" jdbcType="TINYINT" property="sharePickStatus"/> <result column="share_pick_status" jdbcType="TINYINT" property="sharePickStatus"/>
<result column="pick_user_id" jdbcType="BIGINT" property="pickUserId"/> <result column="pick_user_id" jdbcType="BIGINT" property="pickUserId"/>
<result column="pick_time" jdbcType="TIMESTAMP" property="pickTime"/>
<result column="share_status" jdbcType="TINYINT" property="shareStatus"/> <result column="share_status" jdbcType="TINYINT" property="shareStatus"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="pick_time" jdbcType="TIMESTAMP" property="pickTime"/>
<result column="expire_time" jdbcType="TIMESTAMP" property="expireTime"/> <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime"/>
<result column="stop_time" jdbcType="TIMESTAMP" property="stopTime"/>
</resultMap> </resultMap>
<resultMap id="BaseMultiResultMap" type="com.glsx.smart.dao.entity.SmartShareKeyBlueKey"> <resultMap id="BaseMultiResultMap" type="com.glsx.smart.dao.entity.SmartShareKeyBlueKey">
...@@ -22,9 +24,11 @@ ...@@ -22,9 +24,11 @@
<result column="share_key_token" jdbcType="VARCHAR" property="shareKeyToken"/> <result column="share_key_token" jdbcType="VARCHAR" property="shareKeyToken"/>
<result column="share_pick_status" jdbcType="TINYINT" property="sharePickStatus"/> <result column="share_pick_status" jdbcType="TINYINT" property="sharePickStatus"/>
<result column="pick_user_id" jdbcType="BIGINT" property="pickUserId"/> <result column="pick_user_id" jdbcType="BIGINT" property="pickUserId"/>
<result column="pick_time" jdbcType="TIMESTAMP" property="pickTime"/>
<result column="share_status" jdbcType="TINYINT" property="shareStatus"/> <result column="share_status" jdbcType="TINYINT" property="shareStatus"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="pick_time" jdbcType="TIMESTAMP" property="pickTime"/>
<result column="expire_time" jdbcType="TIMESTAMP" property="expireTime"/> <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime"/>
<result column="stop_time" jdbcType="TIMESTAMP" property="stopTime"/>
<!--主钥匙字段--> <!--主钥匙字段-->
<result column="user_id" jdbcType="BIGINT" property="userId"/> <result column="user_id" jdbcType="BIGINT" property="userId"/>
...@@ -57,12 +61,13 @@ ...@@ -57,12 +61,13 @@
<when test="criterion.betweenValue"> <when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when> </when>
<!-- <when test="criterion.listValue">--> <!-- <when test="criterion.listValue">-->
<!-- and ${criterion.condition}--> <!-- and ${criterion.condition}-->
<!-- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">--> <!-- <foreach close=")" collection="criterion.value" item="listItem" open="("-->
<!-- #{listItem}--> <!-- separator=",">-->
<!-- </foreach>--> <!-- #{listItem}-->
<!-- </when>--> <!-- </foreach>-->
<!-- </when>-->
</choose> </choose>
</foreach> </foreach>
</trim> </trim>
...@@ -87,12 +92,13 @@ ...@@ -87,12 +92,13 @@
<when test="criterion.betweenValue"> <when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when> </when>
<!-- <when test="criterion.listValue">--> <!-- <when test="criterion.listValue">-->
<!-- and ${criterion.condition}--> <!-- and ${criterion.condition}-->
<!-- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">--> <!-- <foreach close=")" collection="criterion.value" item="listItem" open="("-->
<!-- #{listItem}--> <!-- separator=",">-->
<!-- </foreach>--> <!-- #{listItem}-->
<!-- </when>--> <!-- </foreach>-->
<!-- </when>-->
</choose> </choose>
</foreach> </foreach>
</trim> </trim>
...@@ -102,136 +108,52 @@ ...@@ -102,136 +108,52 @@
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!--@mbg.generated--> <!--@mbg.generated-->
id, car_key_id, share_key_token, share_pick_status, pick_user_id, pick_time, share_status, id, car_key_id, share_key_token, share_pick_status, pick_user_id, share_status, create_time,
expire_time pick_time, expire_time, stop_time
</sql> </sql>
<select id="selectByExample" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKeyExample" <select id="selectByExample" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKeyExample"
resultMap="BaseResultMap"> resultMap="BaseResultMap">
<!--@mbg.generated--> <!--@mbg.generated-->
select select
<if test="distinct"> <if test="distinct">
distinct distinct
</if> </if>
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from smart_vehicle_blue_share_key from smart_vehicle_blue_share_key
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause"/>
</if> </if>
<if test="orderByClause != null"> <if test="orderByClause != null">
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--@mbg.generated--> <!--@mbg.generated-->
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from smart_vehicle_blue_share_key from smart_vehicle_blue_share_key
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated--> <!--@mbg.generated-->
delete from smart_vehicle_blue_share_key delete from smart_vehicle_blue_share_key
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</delete> </delete>
<delete id="deleteByExample" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKeyExample"> <delete id="deleteByExample" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKeyExample">
<!--@mbg.generated--> <!--@mbg.generated-->
delete from smart_vehicle_blue_share_key delete from smart_vehicle_blue_share_key
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause"/>
</if> </if>
...@@ -240,18 +162,13 @@ ...@@ -240,18 +162,13 @@
parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKey" useGeneratedKeys="true"> parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKey" useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
insert into smart_vehicle_blue_share_key (car_key_id, share_key_token, share_pick_status, insert into smart_vehicle_blue_share_key (car_key_id, share_key_token, share_pick_status,
pick_user_id, pick_time, share_status, pick_user_id, share_status, create_time,
expire_time) pick_time, expire_time, stop_time
)
values (#{carKeyId,jdbcType=BIGINT}, #{shareKeyToken,jdbcType=VARCHAR}, #{sharePickStatus,jdbcType=TINYINT}, values (#{carKeyId,jdbcType=BIGINT}, #{shareKeyToken,jdbcType=VARCHAR}, #{sharePickStatus,jdbcType=TINYINT},
#{pickUserId,jdbcType=BIGINT}, #{pickTime,jdbcType=TIMESTAMP}, #{shareStatus,jdbcType=TINYINT}, #{pickUserId,jdbcType=BIGINT}, #{shareStatus,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP},
#{expireTime,jdbcType=TIMESTAMP}) #{pickTime,jdbcType=TIMESTAMP}, #{expireTime,jdbcType=TIMESTAMP}, #{stopTime,jdbcType=TIMESTAMP}
)
</insert> </insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" <insert id="insertSelective" keyColumn="id" keyProperty="id"
...@@ -259,590 +176,233 @@ ...@@ -259,590 +176,233 @@
<!--@mbg.generated--> <!--@mbg.generated-->
insert into smart_vehicle_blue_share_key insert into smart_vehicle_blue_share_key
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="carKeyId != null"> <if test="carKeyId != null">
car_key_id, car_key_id,
</if> </if>
<if test="shareKeyToken != null"> <if test="shareKeyToken != null">
share_key_token, share_key_token,
</if> </if>
<if test="sharePickStatus != null"> <if test="sharePickStatus != null">
share_pick_status,
</if>
<if test="pickUserId != null">
pick_user_id,
</if>
<if test="shareStatus != null">
share_status,
</if>
<if test="createTime != null">
create_time,
share_pick_status, </if>
<if test="pickTime != null">
pick_time,
</if>
<if test="expireTime != null">
expire_time,
</if>
<if test="stopTime != null">
stop_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="carKeyId != null">
#{carKeyId,jdbcType=BIGINT},
</if>
<if test="shareKeyToken != null">
#{shareKeyToken,jdbcType=VARCHAR},
</if> </if>
<if test="pickUserId != null"> <if test="sharePickStatus != null">
#{sharePickStatus,jdbcType=TINYINT},
</if>
<if test="pickUserId != null">
#{pickUserId,jdbcType=BIGINT},
</if>
<if test="shareStatus != null">
#{shareStatus,jdbcType=TINYINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
pick_user_id, </if>
<if test="pickTime != null">
#{pickTime,jdbcType=TIMESTAMP},
</if>
<if test="expireTime != null">
#{expireTime,jdbcType=TIMESTAMP},
</if>
<if test="stopTime != null">
#{stopTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKeyExample"
resultType="java.lang.Long">
<!--@mbg.generated-->
select count(*) from smart_vehicle_blue_share_key
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--@mbg.generated-->
update smart_vehicle_blue_share_key
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if> </if>
<if test="pickTime != null"> <if test="record.carKeyId != null">
car_key_id = #{record.carKeyId,jdbcType=BIGINT},
</if>
<if test="record.shareKeyToken != null">
share_key_token = #{record.shareKeyToken,jdbcType=VARCHAR},
</if>
<if test="record.sharePickStatus != null">
share_pick_status = #{record.sharePickStatus,jdbcType=TINYINT},
</if>
<if test="record.pickUserId != null">
pick_user_id = #{record.pickUserId,jdbcType=BIGINT},
pick_time, </if>
<if test="record.shareStatus != null">
share_status = #{record.shareStatus,jdbcType=TINYINT},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.pickTime != null">
pick_time = #{record.pickTime,jdbcType=TIMESTAMP},
</if>
<if test="record.expireTime != null">
expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="shareStatus != null"> <if test="record.stopTime != null">
stop_time = #{record.stopTime,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 smart_vehicle_blue_share_key
set id = #{record.id,jdbcType=BIGINT},
car_key_id = #{record.carKeyId,jdbcType=BIGINT},
share_key_token = #{record.shareKeyToken,jdbcType=VARCHAR},
share_pick_status = #{record.sharePickStatus,jdbcType=TINYINT},
pick_user_id = #{record.pickUserId,jdbcType=BIGINT},
share_status = #{record.shareStatus,jdbcType=TINYINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
pick_time = #{record.pickTime,jdbcType=TIMESTAMP},
expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
stop_time = #{record.stopTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKey">
<!--@mbg.generated-->
update smart_vehicle_blue_share_key
<set>
<if test="carKeyId != null">
car_key_id = #{carKeyId,jdbcType=BIGINT},
</if>
<if test="shareKeyToken != null">
share_key_token = #{shareKeyToken,jdbcType=VARCHAR},
</if>
<if test="sharePickStatus != null">
share_pick_status = #{sharePickStatus,jdbcType=TINYINT},
share_status, </if>
<if test="pickUserId != null">
pick_user_id = #{pickUserId,jdbcType=BIGINT},
</if>
<if test="shareStatus != null">
share_status = #{shareStatus,jdbcType=TINYINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="pickTime != null">
pick_time = #{pickTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="expireTime != null"> <if test="expireTime != null">
expire_time = #{expireTime,jdbcType=TIMESTAMP},
</if>
<if test="stopTime != null">
stop_time = #{stopTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
expire_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="carKeyId != null">
#{carKeyId,jdbcType=BIGINT},
</if>
<if test="shareKeyToken != null">
#{shareKeyToken,jdbcType=VARCHAR},
</if>
<if test="sharePickStatus != null">
#{sharePickStatus,jdbcType=TINYINT},
</if>
<if test="pickUserId != null">
#{pickUserId,jdbcType=BIGINT},
</if>
<if test="pickTime != null">
#{pickTime,jdbcType=TIMESTAMP},
</if>
<if test="shareStatus != null">
#{shareStatus,jdbcType=TINYINT},
</if>
<if test="expireTime != null">
#{expireTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKeyExample"
resultType="java.lang.Long">
<!--@mbg.generated-->
select count(*) from smart_vehicle_blue_share_key
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--@mbg.generated-->
update smart_vehicle_blue_share_key
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.carKeyId != null">
car_key_id = #{record.carKeyId,jdbcType=BIGINT},
</if>
<if test="record.shareKeyToken != null">
share_key_token = #{record.shareKeyToken,jdbcType=VARCHAR},
</if>
<if test="record.sharePickStatus != null">
share_pick_status = #{record.sharePickStatus,jdbcType=TINYINT},
</if>
<if test="record.pickUserId != null">
pick_user_id = #{record.pickUserId,jdbcType=BIGINT},
</if>
<if test="record.pickTime != null">
pick_time = #{record.pickTime,jdbcType=TIMESTAMP},
</if>
<if test="record.shareStatus != null">
share_status = #{record.shareStatus,jdbcType=TINYINT},
</if>
<if test="record.expireTime != null">
expire_time = #{record.expireTime,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 smart_vehicle_blue_share_key
set id = #{record.id,jdbcType=BIGINT},
car_key_id = #{record.carKeyId,jdbcType=BIGINT},
share_key_token = #{record.shareKeyToken,jdbcType=VARCHAR},
share_pick_status = #{record.sharePickStatus,jdbcType=TINYINT},
pick_user_id = #{record.pickUserId,jdbcType=BIGINT},
pick_time = #{record.pickTime,jdbcType=TIMESTAMP},
share_status = #{record.shareStatus,jdbcType=TINYINT},
expire_time = #{record.expireTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKey">
<!--@mbg.generated-->
update smart_vehicle_blue_share_key
<set>
<if test="carKeyId != null">
car_key_id = #{carKeyId,jdbcType=BIGINT},
</if>
<if test="shareKeyToken != null">
share_key_token = #{shareKeyToken,jdbcType=VARCHAR},
</if>
<if test="sharePickStatus != null">
share_pick_status = #{sharePickStatus,jdbcType=TINYINT},
</if>
<if test="pickUserId != null">
pick_user_id = #{pickUserId,jdbcType=BIGINT},
</if>
<if test="pickTime != null">
pick_time = #{pickTime,jdbcType=TIMESTAMP},
</if>
<if test="shareStatus != null">
share_status = #{shareStatus,jdbcType=TINYINT},
</if>
<if test="expireTime != null">
expire_time = #{expireTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKey"> <update id="updateByPrimaryKey" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKey">
...@@ -852,58 +412,39 @@ ...@@ -852,58 +412,39 @@
share_key_token = #{shareKeyToken,jdbcType=VARCHAR}, share_key_token = #{shareKeyToken,jdbcType=VARCHAR},
share_pick_status = #{sharePickStatus,jdbcType=TINYINT}, share_pick_status = #{sharePickStatus,jdbcType=TINYINT},
pick_user_id = #{pickUserId,jdbcType=BIGINT}, pick_user_id = #{pickUserId,jdbcType=BIGINT},
pick_time = #{pickTime,jdbcType=TIMESTAMP},
share_status = #{shareStatus,jdbcType=TINYINT}, share_status = #{shareStatus,jdbcType=TINYINT},
expire_time = #{expireTime,jdbcType=TIMESTAMP} create_time = #{createTime,jdbcType=TIMESTAMP},
pick_time = #{pickTime,jdbcType=TIMESTAMP},
expire_time = #{expireTime,jdbcType=TIMESTAMP},
stop_time = #{stopTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<update id="updateShareStatusByIds"> <!-- <update id="updateShareStatusByIds">-->
<!-- update smart_vehicle_blue_share_key-->
<!-- <set>-->
<!-- share_status = 1-->
<!-- </set>-->
update smart_vehicle_blue_share_key <!-- where id in-->
<!-- <foreach close=")" collection="list" index="index" item="keyId" open="(" separator=",">-->
<!-- #{keyId}-->
<!-- </foreach>-->
<!-- </update>-->
<set>
sex= now(),
share_status = 1
</set>
where id in
<foreach collection="list" item="keyId" open="(" separator="," close=")" index="index">
#{keyId}
</foreach>
</update>
<select id="getShareKeyListByUserId" resultMap="BaseMultiResultMap"> <select id="getShareKeyListByUserId" resultMap="BaseMultiResultMap">
SELECT SELECT
bsk.id as id, bsk.id as id,
bsk.share_key_token, bsk.share_key_token,
bsk.car_key_id, bsk.car_key_id,
bsk.share_pick_status, bsk.share_pick_status,
bsk.pick_user_id, bsk.pick_user_id,
bsk.pick_time,
bsk.share_status, bsk.share_status,
bsk.create_time,
bsk.pick_time,
bsk.expire_time, bsk.expire_time,
bsk.stop_time,
bk.user_id, bk.user_id,
bk.sn, bk.sn,
...@@ -926,5 +467,20 @@ ...@@ -926,5 +467,20 @@
AND bsk.share_status = 1 AND bsk.share_status = 1
AND bk.share_status = 1 AND bk.share_status = 1
and bk.is_delete = 0 and bk.is_delete = 0
</select> </select>
<update id="closeShareKeyByMainKeyIds">
update smart_vehicle_blue_share_key
<set>
stop_time = now(),
share_status = 1
</set>
where car_key_id in
<foreach close=")" collection="list" index="index" item="keyId" open="(" separator=",">
#{keyId}
</foreach>
</update>
</mapper> </mapper>
\ No newline at end of file \ 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!