Commit 60a56c73 by fz

1.主车钥匙关闭分享,分享钥匙全部关闭分享

1 parent 97cbdcee
......@@ -26,7 +26,7 @@ public class AiLockingkeyController {
/************************分享车钥匙相关接口************************/
//todo 主车钥匙修改分享状态
//主车钥匙修改分享状态
@PostMapping(value = "/setPrimaryShareStatus")
public R setPrimaryLockingKeyShareStatus(@RequestBody SmartKeyPrimaryShareEditReq request) {
return aiLockingKeyService.setPrimaryLockingKeyShareStatus(request);
......
......@@ -581,15 +581,21 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
/************************分享车钥匙相关接口************************/
//todo 主车钥匙修改分享状态
//主车钥匙修改分享状态
@Override
public R setPrimaryLockingKeyShareStatus(SmartKeyPrimaryShareEditReq request) {
Integer shareStatus = request.getShareStatus();
SmartVehicleBlueKeyExample example = smartVehicleBlueKeyService.getBlueKeyExampleByUserAndSn(Long.valueOf(request.getUserId()), request.getSn());
List<SmartVehicleBlueKey> smartVehicleBlueKeys =smartVehicleBlueKeyService.selectByExample(example);
if(CollectionUtils.isEmpty(smartVehicleBlueKeys))
return R.error("车钥匙不存在");
//逻辑删除蓝牙车钥匙设备
SmartVehicleBlueKey smartVehicleBlueKey = new SmartVehicleBlueKey();
SmartVehicleBlueKey smartVehicleBlueKey = smartVehicleBlueKeys.get(0);
smartVehicleBlueKey.setShareStatus(shareStatus);
SmartVehicleBlueKeyExample example = smartVehicleBlueKeyService.getBlueKeyExampleByUserAndSn(Long.valueOf(request.getUserId()), request.getSn());
smartVehicleBlueKeyService.updateByExampleSelective(smartVehicleBlueKey, example);
smartVehicleBlueKeyService.updateByPrimaryKeySelective(smartVehicleBlueKey);
if (shareStatus == 1) {
return R.ok();
......@@ -645,7 +651,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
return R.ok().data(token);
}
//todo 分享车钥匙列表获取
//分享车钥匙列表获取
@Override
public R getShareKeyList(SmartShareCarKeyPageRequest request) {
long userId = Long.valueOf(request.getUserId());
......@@ -694,6 +700,7 @@ public class AiLockingKeyServiceImpl implements AiLockingKeyService {
expireList.add(key.getId());
//过期关闭
key.setShareStatus(0);
key.setExpireTime(new Date());
}
});
......
......@@ -83,44 +83,56 @@
<!--@mbg.generated-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from smart_vehicle_blue_share_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 smart_vehicle_blue_share_key
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated-->
delete from smart_vehicle_blue_share_key
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKeyExample">
<!--@mbg.generated-->
delete from smart_vehicle_blue_share_key
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
......@@ -135,44 +147,58 @@
#{pickUserId,jdbcType=BIGINT}, #{pickTime,jdbcType=TIMESTAMP}, #{shareStatus,jdbcType=TINYINT},
#{expireTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKey" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into smart_vehicle_blue_share_key
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="carKeyId != null">
car_key_id,
</if>
<if test="shareKeyToken != null">
share_key_token,
</if>
<if test="sharePickStatus != null">
share_pick_status,
</if>
<if test="pickUserId != null">
pick_user_id,
</if>
<if test="pickTime != null">
pick_time,
</if>
<if test="shareStatus != null">
share_status,
</if>
<if test="expireTime != null">
expire_time,
</if>
</trim>
......@@ -180,34 +206,46 @@
<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>
......@@ -217,6 +255,7 @@
<!--@mbg.generated-->
select count(*) from smart_vehicle_blue_share_key
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
......@@ -225,43 +264,58 @@
<!--@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>
......@@ -281,6 +335,7 @@
share_status = #{record.shareStatus,jdbcType=TINYINT},
expire_time = #{record.expireTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
......@@ -289,44 +344,59 @@
<!--@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 id="updateByPrimaryKey" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKey">
<!--@mbg.generated-->
......@@ -340,10 +410,20 @@
expire_time = #{expireTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateShareStatusByIds">
update smart_vehicle_blue_share_key set share_status = 1 where id in
update smart_vehicle_blue_share_key
<set>
sex= now(),
share_status = 1
</set>
where id in
<foreach collection="list" item="keyId" open="(" separator="," close=")" index="index">
#{keyId}
</foreach>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!