Commit 60a56c73 by fz

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

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