提交 e928e6ba authored 作者: 林业通's avatar 林业通

智能车钥匙

上级 7bbd06b7
package tech.glinfo.enbao.modules.sh.controller;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import tech.glinfo.enbao.common.annotation.ApiLog;
import tech.glinfo.enbao.common.annotation.Login;
import tech.glinfo.enbao.common.validator.ValidatorUtils;
import tech.glinfo.enbao.modules.sh.entity.ShCarLockEntity;
import tech.glinfo.enbao.modules.sh.form.ShCarLockForm;
import tech.glinfo.enbao.modules.sh.service.ShCarLockService;
import tech.glinfo.enbao.common.utils.PageUtils;
import tech.glinfo.enbao.common.utils.R;
/**
* 智能车门钥匙
*
* @author linyetong
* @email linyetong@glinfo.com
* @date 2022-05-24 10:27:45
*/
@RestController
@RequestMapping("/shCarLock")
public class ShCarLockController {
@Autowired
private ShCarLockService shCarLockService;
/**
* 列表
*/
@Login
@GetMapping("list/{id}")
@ApiOperation("列表")
@ApiLog("列表")
public R list(@PathVariable("id") Integer id){
List<ShCarLockEntity> list = shCarLockService.list(new QueryWrapper<ShCarLockEntity>().eq("device_id", id));
return R.ok().put("list", list);
}
@Login
@PostMapping("save")
@ApiOperation("保存")
@ApiLog("保存")
public R save(@RequestBody ShCarLockForm form) throws InvocationTargetException, IllegalAccessException {
ValidatorUtils.validateEntity(form);
ShCarLockEntity shCarLock = new ShCarLockEntity();
BeanUtils.copyProperties(shCarLock, form);
boolean flag = shCarLockService.save(shCarLock);
return flag ? R.ok() : R.error("保存失败");
}
/**
* 删除
*/
@Login
@PostMapping("delete")
@ApiOperation("删除")
@ApiLog("删除")
public R delete(@RequestBody Map<String, Object> params){
Integer id = (Integer) params.get("id");
boolean flag = shCarLockService.removeById(id);
return flag ? R.ok() : R.error("删除失败");
}
}
package tech.glinfo.enbao.modules.sh.form;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @author lyt
* @date 2022/5/24 10:34
*/
@Data
public class ShCarLockForm {
@ApiModelProperty(value = "设备ID")
@NotBlank(message="设备不能为空")
private Integer deviceId;
@ApiModelProperty(value = "名称")
@NotBlank(message="名称不能为空")
private String name;
@ApiModelProperty(value = "编号")
@NotBlank(message="编号不能为空")
private String number;
}
package tech.glinfo.enbao.modules.sh.dao;
import tech.glinfo.enbao.modules.sh.entity.ShCarLockEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 智能车门钥匙
*
* @author linyetong
* @email linyetong@glinfo.com
* @date 2022-05-24 10:27:45
*/
@Mapper
public interface ShCarLockDao extends BaseMapper<ShCarLockEntity> {
}
package tech.glinfo.enbao.modules.sh.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 智能车门钥匙
*
* @author linyetong
* @email linyetong@glinfo.com
* @date 2022-05-24 10:27:45
*/
@Data
@TableName("sh_car_lock")
public class ShCarLockEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId
private Integer id;
/**
* 设备ID
*/
private Integer deviceId;
/**
* 名称
*/
private String name;
/**
* 编号
*/
private String number;
/**
* 创建时间
*/
private Date createDate;
}
package tech.glinfo.enbao.modules.sh.service;
import com.baomidou.mybatisplus.extension.service.IService;
import tech.glinfo.enbao.common.utils.PageUtils;
import tech.glinfo.enbao.modules.sh.entity.ShCarLockEntity;
import java.util.Map;
/**
* 智能车门钥匙
*
* @author linyetong
* @email linyetong@glinfo.com
* @date 2022-05-24 10:27:45
*/
public interface ShCarLockService extends IService<ShCarLockEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package tech.glinfo.enbao.modules.sh.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import tech.glinfo.enbao.common.utils.PageUtils;
import tech.glinfo.enbao.common.utils.Query;
import tech.glinfo.enbao.modules.sh.dao.ShCarLockDao;
import tech.glinfo.enbao.modules.sh.entity.ShCarLockEntity;
import tech.glinfo.enbao.modules.sh.service.ShCarLockService;
@Service("shCarLockService")
public class ShCarLockServiceImpl extends ServiceImpl<ShCarLockDao, ShCarLockEntity> implements ShCarLockService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<ShCarLockEntity> page = this.page(
new Query<ShCarLockEntity>().getPage(params),
new QueryWrapper<ShCarLockEntity>()
);
return new PageUtils(page);
}
}
\ 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="tech.glinfo.enbao.modules.sh.dao.ShCarLockDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="tech.glinfo.enbao.modules.sh.entity.ShCarLockEntity" id="shCarLockMap">
<result property="id" column="id"/>
<result property="deviceId" column="device_id"/>
<result property="name" column="name"/>
<result property="number" column="number"/>
<result property="createDate" column="create_date"/>
</resultMap>
</mapper>
\ No newline at end of file
DROP TABLE IF EXISTS `app_user`;
CREATE TABLE `app_user` (
CREATE TABLE `app_user`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`phone` varchar(11) DEFAULT NULL COMMENT '手机号码',
`third_id` varchar(64) DEFAULT NULL COMMENT '第三方ID',
......@@ -17,7 +18,8 @@ CREATE TABLE `app_user` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='APP用户';
DROP TABLE IF EXISTS `app_api_log`;
CREATE TABLE `app_api_log` (
CREATE TABLE `app_api_log`
(
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`userid` int(11) COMMENT '用户',
`phone` varchar(11) COMMENT '手机号码',
......@@ -31,14 +33,16 @@ CREATE TABLE `app_api_log` (
KEY `app_api_log_phone` (`phone`) USING BTREE
) ENGINE=`InnoDB` DEFAULT CHARACTER SET utf8mb4 COMMENT='API日志';
CREATE TABLE `sh_category` (
CREATE TABLE `sh_category`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(64) DEFAULT NULL COMMENT '分类名称',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品分类';
CREATE TABLE `sh_product` (
CREATE TABLE `sh_product`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`category_id` int(11) NOT NULL COMMENT '分类ID',
`name` varchar(64) DEFAULT NULL COMMENT '产品名称',
......@@ -51,7 +55,8 @@ CREATE TABLE `sh_product` (
KEY `sh_product_device_flag` (`device_flag`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品';
CREATE TABLE `sh_instruction_parsing` (
CREATE TABLE `sh_instruction_parsing`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`product_id` int(11) DEFAULT NULL COMMENT '所属产品',
`name` varchar(30) DEFAULT NULL COMMENT '名称',
......@@ -66,7 +71,8 @@ CREATE TABLE `sh_instruction_parsing` (
KEY `sh_instruction_parsing_product_id` (`product_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='指令解析';
CREATE TABLE `sh_family` (
CREATE TABLE `sh_family`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(64) DEFAULT NULL COMMENT '家庭名称',
`user_id` int(11) DEFAULT NULL COMMENT '创建人',
......@@ -75,7 +81,8 @@ CREATE TABLE `sh_family` (
KEY `sh_family_user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='家庭管理';
CREATE TABLE `sh_family_member` (
CREATE TABLE `sh_family_member`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`family_id` int(11) DEFAULT NULL COMMENT '家庭ID',
`user_id` int(11) DEFAULT NULL COMMENT '成员ID',
......@@ -86,7 +93,8 @@ CREATE TABLE `sh_family_member` (
KEY `sh_family_member_user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='家庭成员';
CREATE TABLE `sh_family_room` (
CREATE TABLE `sh_family_room`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`family_id` int(11) DEFAULT NULL COMMENT '家庭ID',
`name` varchar(64) DEFAULT NULL COMMENT '家庭名称',
......@@ -97,7 +105,8 @@ CREATE TABLE `sh_family_room` (
KEY `sh_family_room_family_id` (`family_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='家庭房间管理';
CREATE TABLE `sh_device` (
CREATE TABLE `sh_device`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`user_id` int(11) DEFAULT NULL COMMENT '发布人',
`family_id` int(11) DEFAULT NULL COMMENT '家庭ID',
......@@ -120,7 +129,8 @@ CREATE TABLE `sh_device` (
KEY `sh_device_room_id` (`room_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='智能家居设备管理';
CREATE TABLE `sh_device_data` (
CREATE TABLE `sh_device_data`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`device_id` int(11) NOT NULL COMMENT '设备ID',
`value` varchar(1000) NOT NULL COMMENT '值',
......@@ -130,7 +140,8 @@ CREATE TABLE `sh_device_data` (
KEY `sh_device_data_device_id` (`device_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备数据';
CREATE TABLE `sh_device_password` (
CREATE TABLE `sh_device_password`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`device_id` int(11) NOT NULL COMMENT '设备ID',
`password` varchar(55) DEFAULT NULL COMMENT '临时密码',
......@@ -142,7 +153,8 @@ CREATE TABLE `sh_device_password` (
KEY `sh_device_password_device_id` (`device_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='智能锁临时密码';
CREATE TABLE `sh_device_power` (
CREATE TABLE `sh_device_power`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`device_id` int(11) DEFAULT NULL COMMENT '设备ID',
`total_duration` int(11) DEFAULT NULL COMMENT '总时长',
......@@ -152,7 +164,8 @@ CREATE TABLE `sh_device_power` (
KEY `sh_device_power_device_id` (`device_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='智能家居电量表';
CREATE TABLE `sh_device_record` (
CREATE TABLE `sh_device_record`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`device_id` int(11) DEFAULT NULL COMMENT '设备ID',
`action` tinyint(2) DEFAULT NULL COMMENT '2:密码开锁 3:卡片开锁 14:人脸开锁 15:掌纹开锁 ',
......@@ -164,7 +177,8 @@ CREATE TABLE `sh_device_record` (
KEY `sh_device_record_remark` (`remark`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='智能家居记录表';
CREATE TABLE `sh_device_temp` (
CREATE TABLE `sh_device_temp`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`device_id` int(11) DEFAULT NULL COMMENT '设备ID',
`temp_h` int(10) DEFAULT NULL COMMENT '高温',
......@@ -179,7 +193,8 @@ CREATE TABLE `sh_device_temp` (
KEY `sh_device_temp_device_id` (`device_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备温度控制';
CREATE TABLE `sh_device_timing` (
CREATE TABLE `sh_device_timing`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`device_id` int(11) DEFAULT NULL COMMENT '设备ID',
`repeats` tinyint(2) DEFAULT '0' COMMENT '状态 0:一次 1:多次',
......@@ -194,7 +209,8 @@ CREATE TABLE `sh_device_timing` (
KEY `sh_device_timing_device_id` (`device_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='智能家居定时表';
CREATE TABLE `sh_speaker_song` (
CREATE TABLE `sh_speaker_song`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`device_id` int(11) DEFAULT NULL COMMENT '设备ID',
`user_id` int(11) DEFAULT NULL COMMENT '用户ID',
......@@ -206,14 +222,16 @@ CREATE TABLE `sh_speaker_song` (
KEY `sh_speaker_song_user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='智能音箱歌曲';
CREATE TABLE `sh_speaker_first_keywords` (
CREATE TABLE `sh_speaker_first_keywords`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`keyword` varchar(55) NOT NULL COMMENT '关键字',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='智能音箱一级关键字';
CREATE TABLE `sh_speaker_secondary_keywords` (
CREATE TABLE `sh_speaker_secondary_keywords`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`parent_id` int(11) DEFAULT NULL COMMENT '父ID',
`keyword` varchar(55) NOT NULL COMMENT '关键字',
......@@ -223,7 +241,8 @@ CREATE TABLE `sh_speaker_secondary_keywords` (
KEY `secondary_keywords_parent_id` (`parent_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='智能音箱二级关键字';
CREATE TABLE `parse_class` (
CREATE TABLE `parse_class`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`type` varchar(55) NOT NULL COMMENT '类型',
`class_name` varchar(55) DEFAULT NULL COMMENT '类名',
......@@ -232,7 +251,8 @@ CREATE TABLE `parse_class` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='接收设备消息对应类';
CREATE TABLE `sh_dlink` (
CREATE TABLE `sh_dlink`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL COMMENT '用户ID',
`title` varchar(50) DEFAULT NULL COMMENT '标题',
......@@ -246,7 +266,8 @@ CREATE TABLE `sh_dlink` (
KEY `sh_dlink_device_id` (`device_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='智能家居场景';
CREATE TABLE `sh_dlink_device` (
CREATE TABLE `sh_dlink_device`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`dlink_id` int(11) DEFAULT NULL COMMENT '场景ID',
`device_id` int(11) DEFAULT NULL COMMENT '关联设备ID',
......@@ -261,14 +282,16 @@ CREATE TABLE `sh_dlink_device` (
CREATE TABLE `help_center` (
CREATE TABLE `help_center`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`title` varchar(64) DEFAULT NULL COMMENT '标题',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='帮助中心';
CREATE TABLE `help_center_content` (
CREATE TABLE `help_center_content`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`help_id` int(11) DEFAULT NULL COMMENT '帮助中心ID',
`type` varchar(50) DEFAULT NULL COMMENT '类型'
......@@ -276,7 +299,8 @@ CREATE TABLE `help_center_content` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='帮助中心内容';
CREATE TABLE `feed_back` (
CREATE TABLE `feed_back`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`name` varchar(50) DEFAULT NULL COMMENT '联系人',
`phone` varchar(11) DEFAULT NULL COMMENT '联系电话',
......@@ -286,7 +310,8 @@ CREATE TABLE `feed_back` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='意见反馈';
CREATE TABLE `business_cooperation` (
CREATE TABLE `business_cooperation`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`name` varchar(50) DEFAULT NULL COMMENT '联系人',
`phone` varchar(11) DEFAULT NULL COMMENT '联系电话',
......@@ -295,12 +320,17 @@ CREATE TABLE `business_cooperation` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商务合作';
alter table sh_family_member add `status` tinyint(2) DEFAULT '1' COMMENT '状态[1待确认,2已加入,2已拒绝]' after `is_admin` ;
alter table sh_family_member add `invite_id` int(11) DEFAULT NULL COMMENT '邀请人ID' after `status` ;
alter table sh_dlink add `status_o` tinyint(2) DEFAULT NULL COMMENT '开关发起状态1[1开启,2关闭]' after `status` ;
alter table sh_dlink add `status_t` tinyint(2) DEFAULT NULL COMMENT '开关发起状态2[1开启,2关闭]' after `status` ;
CREATE TABLE `infrared_control` (
alter table sh_family_member
add `status` tinyint(2) DEFAULT '1' COMMENT '状态[1待确认,2已加入,2已拒绝]' after `is_admin`;
alter table sh_family_member
add `invite_id` int(11) DEFAULT NULL COMMENT '邀请人ID' after `status`;
alter table sh_dlink
add `status_o` tinyint(2) DEFAULT NULL COMMENT '开关发起状态1[1开启,2关闭]' after `status`;
alter table sh_dlink
add `status_t` tinyint(2) DEFAULT NULL COMMENT '开关发起状态2[1开启,2关闭]' after `status`;
CREATE TABLE `infrared_control`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`device_id` int(11) DEFAULT NULL COMMENT '设备ID',
`user_id` int(11) NOT NULL COMMENT '用户ID',
......@@ -313,7 +343,8 @@ CREATE TABLE `infrared_control` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户遥控器';
CREATE TABLE `sh_lock_user` (
CREATE TABLE `sh_lock_user`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`user_id` int(11) DEFAULT NULL COMMENT '用户',
`lock_id` int(11) DEFAULT NULL COMMENT '锁ID',
......@@ -324,5 +355,18 @@ CREATE TABLE `sh_lock_user` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='锁用户';
alter table sh_lock_user add `face_param` varchar(255) DEFAULT NULL COMMENT '锁人脸参数' after `user_name` ;
alter table sh_lock_user add `face_img` varchar(255) DEFAULT NULL COMMENT '锁人脸图片' after `user_name` ;
alter table sh_lock_user
add `face_param` varchar(255) DEFAULT NULL COMMENT '锁人脸参数' after `user_name`;
alter table sh_lock_user
add `face_img` varchar(255) DEFAULT NULL COMMENT '锁人脸图片' after `user_name`;
--未更新20220524
CREATE TABLE `sh_car_lock`
(
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`device_id` int(11) DEFAULT NULL COMMENT '设备ID',
`name` varchar(50) DEFAULT NULL COMMENT '名称',
`number` varchar(10) DEFAULT NULL COMMENT '编号',
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='智能车门钥匙';
\ No newline at end of file
......@@ -11,6 +11,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.6.RELEASE</version>
<relativePath/>
</parent>
<properties>
......
......@@ -14,6 +14,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.4.RELEASE</version>
<relativePath/>
</parent>
<properties>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论