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

智能家居修改

上级 0a2b80bd
......@@ -18,6 +18,8 @@ import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;
import tech.glinfo.enbao.modules.appuser.entity.AppUserEntity;
import tech.glinfo.enbao.modules.appuser.service.AppUserService;
/**
* 有@LoginUser注解的方法参数,注入当前登录用户
......@@ -27,12 +29,11 @@ import org.springframework.web.method.support.ModelAndViewContainer;
@Component
public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver {
@Autowired
// private AppUserService userService;
private AppUserService userService;
@Override
public boolean supportsParameter(MethodParameter parameter) {
return true;
// return parameter.getParameterType().isAssignableFrom(AppUserEntity.class) && parameter.hasParameterAnnotation(LoginUser.class);
return parameter.getParameterType().isAssignableFrom(AppUserEntity.class) && parameter.hasParameterAnnotation(LoginUser.class);
}
@Override
......@@ -45,8 +46,8 @@ public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgu
}
//获取用户信息
// AppUserEntity user = userService.getById((Long)object);
AppUserEntity user = userService.getById((Long)object);
return null;
return user;
}
}
......@@ -19,6 +19,10 @@ import tech.glinfo.enbao.modules.appuser.dto.AppUserDto;
import tech.glinfo.enbao.modules.appuser.entity.AppUserEntity;
import tech.glinfo.enbao.modules.appuser.form.*;
import tech.glinfo.enbao.modules.appuser.service.OtherAppUserService;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyEntity;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyMemberEntity;
import tech.glinfo.enbao.modules.sh.service.OtherShFamilyService;
import tech.glinfo.enbao.modules.sh.service.ShFamilyMemberService;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
......@@ -48,6 +52,12 @@ public class AppUserController extends AbstractController {
@Autowired
private RedisUtils redisUtils;
@Autowired
private OtherShFamilyService otherShFamilyService;
@Autowired
private ShFamilyMemberService shFamilyMemberService;
@PostMapping("register")
@ApiOperation("用户注册")
@ApiLog("用户注册")
......@@ -70,7 +80,16 @@ public class AppUserController extends AbstractController {
user.setNickname(form.getNickname());
user.setPassword(DigestUtils.sha256Hex(form.getPassword()));
otherAppUserService.save(user);
ShFamilyEntity family = new ShFamilyEntity();
family.setName("我的家");
family.setUserId(user.getId());
otherShFamilyService.save(family);
//新增家庭成员
ShFamilyMemberEntity member = new ShFamilyMemberEntity();
member.setFamilyId(family.getId());
member.setUserId(user.getId());
member.setIsAdmin(1);//管理员
shFamilyMemberService.save(member);
return R.ok();
}
......
......@@ -111,11 +111,12 @@ public class MqConsumer {
if ("08".equals(datas.get("cmd"))) {
//新增设备
if (redisUtils.hasKey("device:save:" + datas.get("mac"))) {
String userId = redisUtils.get("device:save:" + datas.get("mac"));
String[] userId = redisUtils.get("device:save:" + datas.get("mac")).split("-");
ShProductEntity product = shProductService.getOne(new QueryWrapper<ShProductEntity>().eq("device_flag", datas.get("receiveId").substring(0, 3)).last("LIMIT 1"));
ShDeviceEntity shDevice = new ShDeviceEntity();
shDevice.setUserId(Integer.valueOf(userId));
shDevice.setUserId(Integer.valueOf(userId[0]));
shDevice.setMac(datas.get("mac"));
shDevice.setFamilyId(Integer.valueOf(userId[1]));
shDevice.setNumbering(datas.get("receiveId"));
shDevice.setName(product.getName());
shDevice.setPic(product.getPic());
......
......@@ -23,14 +23,11 @@ import tech.glinfo.enbao.modules.sh.entity.ShDeviceDataEntity;
import tech.glinfo.enbao.modules.sh.entity.ShDeviceEntity;
import tech.glinfo.enbao.modules.sh.entity.ShDevicePasswordEntity;
import tech.glinfo.enbao.modules.sh.form.ProtocolContent;
import tech.glinfo.enbao.modules.sh.form.ShDeviceForm;
import tech.glinfo.enbao.modules.sh.service.OtherShDeviceRecordService;
import tech.glinfo.enbao.modules.sh.service.OtherShDeviceService;
import tech.glinfo.enbao.modules.sh.service.ShDeviceDataService;
import tech.glinfo.enbao.modules.sh.service.ShDevicePasswordService;
import java.lang.reflect.InvocationTargetException;
import java.text.ParseException;
import java.util.*;
/**
......@@ -95,13 +92,42 @@ public class ShDeviceController {
@Login
@GetMapping("list")
@ApiOperation("个人发布")
@ApiLog("个人发布")
@ApiOperation("设备列表")
@ApiLog("设备列表")
public R list(@RequestParam Map<String, Object> params, @LoginUser AppUserEntity user) {
return otherShDeviceService.list(params, user);
}
@Login
@GetMapping("notRelation/{familyId}")
@ApiOperation("没有关联房间的设备")
@ApiLog("没有关联房间的设备")
public R notRelation(@PathVariable("familyId") Integer familyId) {
List<ShDeviceEntity> list = otherShDeviceService.list(new QueryWrapper<ShDeviceEntity>().eq("family_id", familyId).isNull("room_id"));
return R.ok().put("data", list);
}
@Login
@PostMapping("addRelation")
@ApiOperation("添加关联房间")
@ApiLog("添加关联房间")
public R addRelation(@RequestBody Map<String, Object> params) {
Integer roomId = (Integer) params.get("roomId");
Integer deviceId = (Integer) params.get("deviceId");
if (StringUtils.isBlank(roomId, deviceId)) {
return R.error("缺少参数");
}
ShDeviceEntity device = new ShDeviceEntity();
device.setRoomId(roomId);
device.setId(deviceId);
otherShDeviceService.updateById(device);
return R.ok();
}
@Login
@PostMapping("delete")
......
package tech.glinfo.enbao.modules.sh.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.annotation.LoginUser;
import tech.glinfo.enbao.common.utils.R;
import tech.glinfo.enbao.modules.appuser.entity.AppUserEntity;
import tech.glinfo.enbao.modules.sh.service.OtherShFamilyService;
import java.util.Map;
@RestController
@RequestMapping("/shFamily")
@Api(value = "家庭管理")
public class ShFamilyController {
@Autowired
private OtherShFamilyService otherShFamilyService;
@Login
@PostMapping("add")
@ApiOperation("新增")
@ApiLog("新增")
public R add(@RequestBody Map<String, Object> params, @LoginUser AppUserEntity user) {
return otherShFamilyService.add(params, user);
}
@Login
@PostMapping("update")
@ApiOperation("修改")
@ApiLog("修改")
public R update(@RequestBody Map<String, Object> params) {
return otherShFamilyService.update(params);
}
@Login
@GetMapping("list")
@ApiOperation("列表")
@ApiLog("列表")
public R list(@LoginUser AppUserEntity user) {
return otherShFamilyService.list(user);
}
@Login
@GetMapping("info/{id}")
@ApiOperation("详情")
@ApiLog("详情")
public R info(@PathVariable("id") Integer id) {
return otherShFamilyService.info(id);
}
@Login
@PostMapping("delete")
@ApiOperation("删除")
@ApiLog("删除")
public R delete(@RequestBody Map<String, Object> params, @LoginUser AppUserEntity user) {
return otherShFamilyService.delete(params, user);
}
}
\ No newline at end of file
package tech.glinfo.enbao.modules.sh.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.glinfo.enbao.common.annotation.ApiLog;
import tech.glinfo.enbao.common.annotation.Login;
import tech.glinfo.enbao.common.annotation.LoginUser;
import tech.glinfo.enbao.common.utils.R;
import tech.glinfo.enbao.common.utils.StringUtils;
import tech.glinfo.enbao.modules.appuser.entity.AppUserEntity;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyMemberEntity;
import tech.glinfo.enbao.modules.sh.service.ShFamilyMemberService;
import java.util.Map;
@RestController
@RequestMapping("/shFamilyMember")
@Api(value = "家庭成员")
public class ShFamilyMemberController {
@Autowired
private ShFamilyMemberService shFamilyMemberService;
@Login
@PostMapping("add")
@ApiOperation("新增")
@ApiLog("新增")
public R add(@RequestBody Map<String, Object> params, @LoginUser AppUserEntity user) {
Integer familyId = (Integer) params.get("familyId");
if (StringUtils.isBlank(familyId)) {
return R.error("缺少参数");
}
ShFamilyMemberEntity member = new ShFamilyMemberEntity();
member.setFamilyId(familyId);
member.setUserId(user.getId());
member.setIsAdmin(2);
shFamilyMemberService.save(member);
return R.ok();
}
@Login
@PostMapping("delete")
@ApiOperation("删除")
@ApiLog("删除")
public R delete(@RequestBody Map<String, Object> params) {
Integer id = (Integer) params.get("id");
shFamilyMemberService.removeById(id);
return R.ok();
}
}
\ No newline at end of file
package tech.glinfo.enbao.modules.sh.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.annotation.LoginUser;
import tech.glinfo.enbao.common.utils.R;
import tech.glinfo.enbao.modules.appuser.entity.AppUserEntity;
import tech.glinfo.enbao.modules.sh.entity.ShDeviceEntity;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyRoomEntity;
import tech.glinfo.enbao.modules.sh.service.OtherShFamilyRoomService;
import java.util.Map;
@RestController
@RequestMapping("/shFamilyRoom")
@Api(value = "家庭房间")
public class ShFamilyRoomController {
@Autowired
private OtherShFamilyRoomService otherShFamilyRoomService;
@Login
@PostMapping("addOrUpdate")
@ApiOperation("新增修改")
@ApiLog("新增修改")
public R addOrUpdate(@RequestBody Map<String, Object> params, @LoginUser AppUserEntity user) {
return otherShFamilyRoomService.addOrUpdate(params, user);
}
@Login
@GetMapping("roomManage/{id}")
@ApiOperation("房间管理")
@ApiLog("房间管理")
public R roomManage(@PathVariable("id") Integer familyId) {
return otherShFamilyRoomService.list(familyId);
}
@Login
@GetMapping("indexList/{id}")
@ApiOperation("房间管理")
@ApiLog("房间管理")
public R indexList(@PathVariable("id") Integer familyId) {
return R.ok().put("data", otherShFamilyRoomService.list(new QueryWrapper<ShFamilyRoomEntity>().eq("family_id", familyId)));
}
@Login
@GetMapping("info/{id}")
@ApiOperation("详情")
@ApiLog("详情")
public R info(@PathVariable("id") Integer id) {
return otherShFamilyRoomService.info(id);
}
@Login
@PostMapping("delete")
@ApiOperation("删除")
@ApiLog("删除")
public R delete(@RequestBody Map<String, Object> params) {
return otherShFamilyRoomService.delete(params);
}
@Login
@PostMapping("removeRelation")
@ApiOperation("移除关联")
@ApiLog("移除关联")
public R removeRelation(@RequestBody Map<String, Object> params) {
Integer deviceId = (Integer) params.get("deviceId");
return otherShFamilyRoomService.removeRelation(deviceId);
}
}
\ No newline at end of file
......@@ -21,7 +21,7 @@ public interface OtherShDeviceDao extends BaseMapper<ShDeviceEntity> {
ShDeviceDataEntity getDeviceDataByNumbering(String numbering);
@Select("<script>" +
"SELECT * FROM sh_device a WHERE a.publisher_id = ${userId} AND a.relat_house = 0 AND ISNULL(filter_id) = 1 AND lease_status != 7" +
"SELECT * FROM sh_device a WHERE a.user_id = ${userId} AND a.relat_house = 0" +
" </script>")
List<ShDeviceEntity> getDeviceByFlag(Integer userId);
......
package tech.glinfo.enbao.modules.sh.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tech.glinfo.enbao.modules.sh.dto.ShFamilyDto;
import tech.glinfo.enbao.modules.sh.entity.ShDeviceEntity;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyEntity;
import java.util.List;
import java.util.Map;
/**
* @author lyt
* @date 2022/1/5 10:50
*/
@Mapper
public interface OtherShFamilyDao extends BaseMapper<ShFamilyEntity> {
@Select("<script>" +
"DELETE t1, t2, t3, t4 FROM sh_family AS t1 LEFT JOIN sh_family_member AS t2 ON t1.id = t2.family_id " +
"LEFT JOIN sh_family_room AS t3 ON t1.id = t3.family_id LEFT JOIN sh_device AS t4 ON t1.id = t4.family_id " +
"WHERE t1.id = ${id}" +
" </script>")
void delete(Integer id);
@Select("<script>" +
"SELECT a.id, a.name, COUNT(c.id) room FROM sh_family a, sh_family_member b, sh_family_room c WHERE a.id = b.family_id AND a.id = c.family_id AND b.user_id = ${userId}" +
" </script>")
List<Map<String, Object>> list(Integer userId);
ShFamilyDto familyInfo(@Param("params")Integer id);
}
package tech.glinfo.enbao.modules.sh.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyRoomEntity;
import java.util.List;
import java.util.Map;
/**
* @author lyt
* @date 2022/1/5 10:50
*/
@Mapper
public interface OtherShFamilyRoomDao extends BaseMapper<ShFamilyRoomEntity> {
@Select("<script>" +
"DELETE t1, t2 FROM sh_family_room AS t1 LEFT JOIN sh_device AS t2 ON t1.id = t2.room_id " +
"WHERE t1.id = ${id}" +
" </script>")
void delete(Integer id);
@Select("<script>" +
"SELECT a.id, a.name, COUNT(b.id) `device` FROM sh_family_room a, sh_device b WHERE a.id = b.room_id AND a.family_id = ${familyId}" +
" </script>")
List<Map<String, Object>> list(Integer familyId);
@Select("<script>" +
" update sh_device set room_id = NULL where id = ${deviceId}" +
" </script>")
void removeRelation(Integer deviceId);
}
package tech.glinfo.enbao.modules.sh.dto;
import lombok.Data;
import java.util.List;
/**
* @author lyt
* @date 2022/1/5 11:25
*/
@Data
public class ShFamilyDto {
private Integer id;
private String name;
private Integer room;
private List<ShFamilyMemberDto> members;
}
package tech.glinfo.enbao.modules.sh.dto;
import lombok.Data;
/**
* @author lyt
* @date 2022/1/5 11:26
*/
@Data
public class ShFamilyMemberDto {
private Integer id;
private String nickname;
}
package tech.glinfo.enbao.modules.sh.service;
import com.baomidou.mybatisplus.extension.service.IService;
import tech.glinfo.enbao.common.utils.R;
import tech.glinfo.enbao.modules.appuser.entity.AppUserEntity;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyRoomEntity;
import java.util.Map;
/**
* @author lyt
* @date 2022/1/5 10:49
*/
public interface OtherShFamilyRoomService extends IService<ShFamilyRoomEntity> {
R addOrUpdate(Map<String, Object> params, AppUserEntity user);
R delete(Map<String, Object> params);
R list(Integer familyId);
R info(Integer id);
R removeRelation(Integer deviceId);
}
package tech.glinfo.enbao.modules.sh.service;
import com.baomidou.mybatisplus.extension.service.IService;
import tech.glinfo.enbao.common.utils.R;
import tech.glinfo.enbao.modules.appuser.entity.AppUserEntity;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyEntity;
import java.util.Map;
/**
* @author lyt
* @date 2022/1/5 10:49
*/
public interface OtherShFamilyService extends IService<ShFamilyEntity> {
R add(Map<String, Object> params, AppUserEntity user);
R update(Map<String, Object> params);
R delete(Map<String, Object> params, AppUserEntity user);
R list(AppUserEntity user);
R info(Integer id);
}
......@@ -49,7 +49,8 @@ public class OtherShDeviceServiceImpl extends ServiceImpl<OtherShDeviceDao, ShDe
@Override
public R save(Map<String, Object> params, AppUserEntity user) {
String mac = (String) params.get("mac");
if (StringUtils.isBlank(mac)) {
Integer familyId = (Integer) params.get("familyId");
if (StringUtils.isBlank(mac, familyId)) {
return R.error();
}
int count = this.count(new QueryWrapper<ShDeviceEntity>().eq("mac", mac));
......@@ -57,23 +58,28 @@ public class OtherShDeviceServiceImpl extends ServiceImpl<OtherShDeviceDao, ShDe
return R.error();
}
//保存MAC地址
redisUtils.set("device:save:" + mac, user.getId());
redisUtils.set("device:save:" + mac, user.getId() + "-" + familyId);
return R.ok();
}
//个人发布
@Override
public R list(Map<String, Object> params, AppUserEntity user) {
String categoryId = (String)params.get("categoryId");
IPage<ShDeviceEntity> page = this.page(
String familyId = (String)params.get("familyId");
String roomId = (String)params.get("roomId");
List<ShDeviceEntity> list = this.list(new QueryWrapper<ShDeviceEntity>()
.eq(StringUtils.isNotBlank(familyId), "family_id", familyId)
.eq(StringUtils.isNotBlank(roomId), "room_id", roomId)
.orderByDesc("id"));
/* IPage<ShDeviceEntity> page = this.page(
new Query<ShDeviceEntity>().getPage(params),
new QueryWrapper<ShDeviceEntity>().eq("user_id", user.getId())
.eq(!StringUtils.isBlank(categoryId), "category_id", categoryId)
new QueryWrapper<ShDeviceEntity>()
.eq(StringUtils.isNotBlank(familyId), "family_id", familyId)
.eq(StringUtils.isNotBlank(roomId), "room_id", roomId)
.orderByDesc("id")
);
Map<String, Object> map = new HashMap<>();
map.put("page", new PageUtils(page));
return R.ok(map);
map.put("page", new PageUtils(page));*/
return R.ok().put("data", list);
}
@Override
......
package tech.glinfo.enbao.modules.sh.service.impl;
import com.baomidou.mybatisplus.extension.service.additional.query.impl.QueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import tech.glinfo.enbao.common.utils.R;
import tech.glinfo.enbao.common.utils.StringUtils;
import tech.glinfo.enbao.modules.appuser.entity.AppUserEntity;
import tech.glinfo.enbao.modules.sh.dao.OtherShFamilyRoomDao;
import tech.glinfo.enbao.modules.sh.dto.ShFamilyDto;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyMemberEntity;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyRoomEntity;
import tech.glinfo.enbao.modules.sh.service.OtherShFamilyRoomService;
import java.util.List;
import java.util.Map;
/**
* @author lyt
* @date 2022/1/5 10:49
*/
@Service("otherShFamilyRoomService")
public class OtherShFamilyRoomServiceImpl extends ServiceImpl<OtherShFamilyRoomDao, ShFamilyRoomEntity> implements OtherShFamilyRoomService {
@Override
public R addOrUpdate(Map<String, Object> params, AppUserEntity user) {
String name = (String) params.get("name");
Integer familyId = (Integer) params.get("familyId");
if (StringUtils.isBlank(name, familyId)) {
return R.error("缺少参数");
}
Integer id = (Integer) params.get("id");
ShFamilyRoomEntity familyRoom = new ShFamilyRoomEntity();
if (id != null) {
familyRoom.setId(id);
}
familyRoom.setFamilyId(familyId);
familyRoom.setName(name);
familyRoom.setUserId(user.getId());
this.saveOrUpdate(familyRoom);
return R.ok();
}
@Override
public R delete(Map<String, Object> params) {
Integer id = (Integer) params.get("id");
this.baseMapper.delete(id);
return R.ok();
}
@Override
public R list(Integer familyId) {
return R.ok().put("data", this.baseMapper.list(familyId));
}
@Override
public R info(Integer id) {
return R.ok().put("room", this.getById(id));
}
@Override
public R removeRelation(Integer deviceId) {
this.baseMapper.removeRelation(deviceId);
return R.ok();
}
}
package tech.glinfo.enbao.modules.sh.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tech.glinfo.enbao.common.utils.R;
import tech.glinfo.enbao.common.utils.StringUtils;
import tech.glinfo.enbao.modules.appuser.entity.AppUserEntity;
import tech.glinfo.enbao.modules.sh.dao.OtherShFamilyDao;
import tech.glinfo.enbao.modules.sh.dto.ShFamilyDto;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyEntity;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyMemberEntity;
import tech.glinfo.enbao.modules.sh.service.OtherShFamilyService;
import tech.glinfo.enbao.modules.sh.service.ShFamilyMemberService;
import java.util.List;
import java.util.Map;
/**
* @author lyt
* @date 2022/1/5 10:49
*/
@Service("otherShFamilyService")
public class OtherShFamilyServiceImpl extends ServiceImpl<OtherShFamilyDao, ShFamilyEntity> implements OtherShFamilyService {
@Autowired
private ShFamilyMemberService shFamilyMemberService;
@Override
public R add(Map<String, Object> params, AppUserEntity user) {
String name = (String) params.get("name");
if (StringUtils.isBlank(name)) {
return R.error("缺少参数");
}
//新增家庭
ShFamilyEntity family = new ShFamilyEntity();
family.setName(name);
family.setUserId(user.getId());
this.save(family);
//新增家庭成员
ShFamilyMemberEntity member = new ShFamilyMemberEntity();
member.setFamilyId(family.getId());
member.setUserId(user.getId());
member.setIsAdmin(1);//管理员
shFamilyMemberService.save(member);
return R.ok();
}
@Override
public R update(Map<String, Object> params) {
Integer id = (Integer) params.get("id");
String name = (String) params.get("name");
if (StringUtils.isBlank(id, name)) {
return R.error("缺少参数");
}
ShFamilyEntity family = new ShFamilyEntity();
family.setId(id);
family.setName(name);
this.updateById(family);
return R.ok();
}
@Override
public R delete(Map<String, Object> params, AppUserEntity user) {
int count = this.count(new QueryWrapper<ShFamilyEntity>().eq("user_id", user.getId()));
if (count == 1) {
return R.error("不能全部删除家庭");
}
Integer id = (Integer) params.get("id");
this.baseMapper.delete(id);
return R.ok();
}
@Override
public R list(AppUserEntity user) {
List<Map<String, Object>> list = this.baseMapper.list(user.getId());
return R.ok().put("data", list);
}
@Override
public R info(Integer id) {
ShFamilyDto family = this.baseMapper.familyInfo(id);
return R.ok().put("family", family);
}
}
<?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.OtherShFamilyDao">
<resultMap id="familyResultMap" type="tech.glinfo.enbao.modules.sh.dto.ShFamilyDto">
<result column="id" property="id"/>
<result column="name" property="name"/>
<result column="room" property="room"/>
<collection property="members" ofType="tech.glinfo.enbao.modules.sh.dto.ShFamilyMemberDto" columnPrefix="item_">
<result column="id" property="id"/>
<result column="nickname" property="nickname"/>
</collection>
</resultMap>
<select id="familyInfo" resultMap="familyResultMap">
SELECT a.id, a.name, COUNT(c.id) room,
b.id item_id,
d.nickname item_nickname
FROM
sh_family a, sh_family_member b, sh_family_room c, app_user d
WHERE
a.id = b.family_id AND a.id = c.family_id AND b.user_id = d.id AND a.id = ${id}
</select>
</mapper>
\ No newline at end of file
......@@ -9,7 +9,7 @@ import org.apache.ibatis.annotations.Mapper;
*
* @author linyetong
* @email linyetong@glinfo.com
* @date 2021-12-24 14:20:55
* @date 2022-01-05 10:24:13
*/
@Mapper
public interface ShDeviceDao extends BaseMapper<ShDeviceEntity> {
......
package tech.glinfo.enbao.modules.sh.dao;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 家庭管理
*
* @author linyetong
* @email linyetong@glinfo.com
* @date 2022-01-05 10:24:13
*/
@Mapper
public interface ShFamilyDao extends BaseMapper<ShFamilyEntity> {
}
package tech.glinfo.enbao.modules.sh.dao;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyMemberEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 家庭成员
*
* @author linyetong
* @email linyetong@glinfo.com
* @date 2022-01-05 10:24:13
*/
@Mapper
public interface ShFamilyMemberDao extends BaseMapper<ShFamilyMemberEntity> {
}
package tech.glinfo.enbao.modules.sh.dao;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyRoomEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 家庭房间管理
*
* @author linyetong
* @email linyetong@glinfo.com
* @date 2022-01-05 10:24:13
*/
@Mapper
public interface ShFamilyRoomDao extends BaseMapper<ShFamilyRoomEntity> {
}
......@@ -12,7 +12,7 @@ import lombok.Data;
*
* @author linyetong
* @email linyetong@glinfo.com
* @date 2021-12-24 14:20:55
* @date 2022-01-05 10:24:13
*/
@Data
@TableName("sh_device")
......@@ -29,11 +29,15 @@ public class ShDeviceEntity implements Serializable {
*/
private Integer userId;
/**
* 设备分类
* 家庭ID
*/
private Integer categoryId;
private Integer familyId;
/**
* 设备编号
* 房间ID
*/
private Integer roomId;
/**
* mac
*/
private String mac;
/**
......
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-01-05 10:24:13
*/
@Data
@TableName("sh_family")
public class ShFamilyEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Integer id;
/**
* 家庭名称
*/
private String name;
/**
* 创建人
*/
private Integer userId;
/**
* 创建时间
*/
private Date createTime;
}
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-01-05 10:24:13
*/
@Data
@TableName("sh_family_member")
public class ShFamilyMemberEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Integer id;
/**
* 家庭ID
*/
private Integer familyId;
/**
* 成员ID
*/
private Integer userId;
/**
* 是否管理员 1:是 2:否
*/
private Integer isAdmin;
/**
* 创建时间
*/
private Date createTime;
}
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-01-05 10:24:13
*/
@Data
@TableName("sh_family_room")
public class ShFamilyRoomEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Integer id;
/**
* 家庭ID
*/
private Integer familyId;
/**
* 家庭名称
*/
private String name;
/**
* 创建人
*/
private Integer userId;
/**
* 创建时间
*/
private Date createTime;
}
......@@ -11,7 +11,7 @@ import java.util.Map;
*
* @author linyetong
* @email linyetong@glinfo.com
* @date 2021-12-24 14:20:55
* @date 2022-01-05 10:24:13
*/
public interface ShDeviceService extends IService<ShDeviceEntity> {
......
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.ShFamilyMemberEntity;
import java.util.Map;
/**
* 家庭成员
*
* @author linyetong
* @email linyetong@glinfo.com
* @date 2022-01-05 10:24:13
*/
public interface ShFamilyMemberService extends IService<ShFamilyMemberEntity> {
PageUtils queryPage(Map<String, Object> params);
}
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.ShFamilyRoomEntity;
import java.util.Map;
/**
* 家庭房间管理
*
* @author linyetong
* @email linyetong@glinfo.com
* @date 2022-01-05 10:24:13
*/
public interface ShFamilyRoomService extends IService<ShFamilyRoomEntity> {
PageUtils queryPage(Map<String, Object> params);
}
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.ShFamilyEntity;
import java.util.Map;
/**
* 家庭管理
*
* @author linyetong
* @email linyetong@glinfo.com
* @date 2022-01-05 10:24:13
*/
public interface ShFamilyService extends IService<ShFamilyEntity> {
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.ShFamilyMemberDao;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyMemberEntity;
import tech.glinfo.enbao.modules.sh.service.ShFamilyMemberService;
@Service("shFamilyMemberService")
public class ShFamilyMemberServiceImpl extends ServiceImpl<ShFamilyMemberDao, ShFamilyMemberEntity> implements ShFamilyMemberService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<ShFamilyMemberEntity> page = this.page(
new Query<ShFamilyMemberEntity>().getPage(params),
new QueryWrapper<ShFamilyMemberEntity>()
);
return new PageUtils(page);
}
}
\ No newline at end of file
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.ShFamilyRoomDao;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyRoomEntity;
import tech.glinfo.enbao.modules.sh.service.ShFamilyRoomService;
@Service("shFamilyRoomService")
public class ShFamilyRoomServiceImpl extends ServiceImpl<ShFamilyRoomDao, ShFamilyRoomEntity> implements ShFamilyRoomService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<ShFamilyRoomEntity> page = this.page(
new Query<ShFamilyRoomEntity>().getPage(params),
new QueryWrapper<ShFamilyRoomEntity>()
);
return new PageUtils(page);
}
}
\ No newline at end of file
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.ShFamilyDao;
import tech.glinfo.enbao.modules.sh.entity.ShFamilyEntity;
import tech.glinfo.enbao.modules.sh.service.ShFamilyService;
@Service("shFamilyService")
public class ShFamilyServiceImpl extends ServiceImpl<ShFamilyDao, ShFamilyEntity> implements ShFamilyService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<ShFamilyEntity> page = this.page(
new Query<ShFamilyEntity>().getPage(params),
new QueryWrapper<ShFamilyEntity>()
);
return new PageUtils(page);
}
}
\ No newline at end of file
......@@ -7,7 +7,8 @@
<resultMap type="tech.glinfo.enbao.modules.sh.entity.ShDeviceEntity" id="shDeviceMap">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="categoryId" column="category_id"/>
<result property="familyId" column="family_id"/>
<result property="roomId" column="room_id"/>
<result property="mac" column="mac"/>
<result property="numbering" column="numbering"/>
<result property="numberingFlag" column="numbering_flag"/>
......
<?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.ShFamilyDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="tech.glinfo.enbao.modules.sh.entity.ShFamilyEntity" id="shFamilyMap">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="userId" column="user_id"/>
<result property="createTime" column="create_time"/>
</resultMap>
</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="tech.glinfo.enbao.modules.sh.dao.ShFamilyMemberDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="tech.glinfo.enbao.modules.sh.entity.ShFamilyMemberEntity" id="shFamilyMemberMap">
<result property="id" column="id"/>
<result property="familyId" column="family_id"/>
<result property="userId" column="user_id"/>
<result property="isAdmin" column="is_admin"/>
<result property="createTime" column="create_time"/>
</resultMap>
</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="tech.glinfo.enbao.modules.sh.dao.ShFamilyRoomDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="tech.glinfo.enbao.modules.sh.entity.ShFamilyRoomEntity" id="shFamilyRoomMap">
<result property="id" column="id"/>
<result property="familyId" column="family_id"/>
<result property="name" column="name"/>
<result property="userId" column="user_id"/>
<result property="createTime" column="create_time"/>
</resultMap>
</mapper>
\ No newline at end of file
......@@ -17,15 +17,15 @@ CREATE TABLE `app_user` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='APP用户';
CREATE TABLE `sh_category` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`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` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`category_id` int(20) NOT NULL COMMENT '分类ID',
`id` int(11) NOT NULL AUTO_INCREMENT,
`category_id` int(11) NOT NULL COMMENT '分类ID',
`name` varchar(64) DEFAULT NULL COMMENT '产品名称',
`category_name` varchar(64) NOT NULL COMMENT '分类名称',
`pic` varchar(255) DEFAULT NULL COMMENT '图片',
......@@ -38,7 +38,7 @@ CREATE TABLE `sh_product` (
CREATE TABLE `sh_instruction_parsing` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`product_id` int(20) DEFAULT NULL COMMENT '所属产品',
`product_id` int(11) DEFAULT NULL COMMENT '所属产品',
`name` varchar(30) DEFAULT NULL COMMENT '名称',
`length` int(11) NOT NULL COMMENT '长度',
`type` tinyint(2) DEFAULT '1' COMMENT '类型[1整数;2字符串;]',
......@@ -51,23 +51,47 @@ CREATE TABLE `sh_instruction_parsing` (
KEY `sh_instruction_parsing_product_id` (`product_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='指令解析';
CREATE TABLE `sh_device_category` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL COMMENT '发布人',
`name` varchar(64) DEFAULT NULL COMMENT '分类名称',
CREATE TABLE `sh_family` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(64) DEFAULT NULL COMMENT '家庭名称',
`user_id` int(11) DEFAULT NULL COMMENT '创建人',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备分类';
PRIMARY KEY (`id`) USING BTREE,
KEY `sh_family_user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='家庭管理';
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',
`is_admin` int(1) DEFAULT NULL COMMENT '是否管理员 1:是 2:否',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
KEY `sh_family_member_family_id` (`family_id`) USING BTREE,
KEY `sh_family_member_user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='家庭成员';
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 '家庭名称',
`user_id` int(11) DEFAULT NULL COMMENT '创建人',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
KEY `sh_family_room_user_id` (`user_id`) USING BTREE,
KEY `sh_family_room_family_id` (`family_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='家庭房间管理';
CREATE TABLE `sh_device` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`user_id` int(11) DEFAULT NULL COMMENT '发布人',
`category_id` int(11) DEFAULT NULL COMMENT '分类ID',
`family_id` int(11) DEFAULT NULL COMMENT '家庭ID',
`room_id` int(11) DEFAULT NULL COMMENT '房间ID',
`mac` varchar(255) DEFAULT NULL COMMENT 'mac',
`numbering` varchar(50) DEFAULT NULL COMMENT '设备编号',
`numbering_flag` varchar(50) DEFAULT NULL COMMENT '编号标识',
`name` varchar(50) DEFAULT NULL COMMENT '设备名称',
`product_id` int(20) DEFAULT NULL COMMENT '所属产品',
`product_id` int(11) DEFAULT NULL COMMENT '所属产品',
`online_status` tinyint(2) DEFAULT '1' COMMENT '在线状态 1:新增 2:在线 3:离线',
`pic` varchar(255) DEFAULT NULL COMMENT '主图',
`online_time` datetime DEFAULT NULL COMMENT '上线时间',
......@@ -76,7 +100,9 @@ CREATE TABLE `sh_device` (
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
KEY `sh_device_numbering` (`numbering`) USING BTREE,
KEY `sh_device_mac` (`mac`) USING BTREE
KEY `sh_device_mac` (`mac`) USING BTREE,
KEY `sh_device_family_id` (`family_id`) USING BTREE,
KEY `sh_device_room_id` (`room_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='智能家居设备管理';
CREATE TABLE `sh_device_data` (
......@@ -124,8 +150,8 @@ CREATE TABLE `sh_device_record` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='智能家居记录表';
CREATE TABLE `sh_device_temp` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`device_id` int(20) DEFAULT NULL COMMENT '设备ID',
`id` int(11) NOT NULL AUTO_INCREMENT,
`device_id` int(11) DEFAULT NULL COMMENT '设备ID',
`temp_h` int(10) DEFAULT NULL COMMENT '高温',
`minute_h` int(10) DEFAULT NULL COMMENT '分钟',
`second_h` int(10) DEFAULT NULL COMMENT '秒',
......@@ -149,11 +175,11 @@ 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:多次',
`time` varchar(50) DEFAULT NULL COMMENT '打开时间 重复一次时间:2020-04-20 15:12;重复多次时间:15:20',
`time` varchar(50) DEFAULT NULL COMMENT '打开时间 重复一次时间:1111-04-11 15:12;重复多次时间:15:11',
`repeat_time` varchar(50) DEFAULT NULL COMMENT '重复时间 1 2 3 4 5 6 7',
`action` tinyint(2) DEFAULT NULL COMMENT '开关1:1为选中,其他为不选中',
`action_two` tinyint(2) DEFAULT NULL COMMENT '开关2:1为选中,其他为不选中',
`close_time` varchar(64) DEFAULT NULL COMMENT '关闭时间 重复一次时间:2020-04-20 15:12;重复多次时间:15:20',
`close_time` varchar(64) DEFAULT NULL COMMENT '关闭时间 重复一次时间:1111-04-11 15:12;重复多次时间:15:11',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`status` tinyint(2) DEFAULT '2' COMMENT '状态 1开 2关',
PRIMARY KEY (`id`) USING BTREE,
......@@ -161,9 +187,9 @@ CREATE TABLE `sh_device_timing` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='智能家居定时表';
CREATE TABLE `sh_speaker_song` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`device_id` int(20) DEFAULT NULL COMMENT '设备ID',
`user_id` int(20) DEFAULT NULL COMMENT '用户ID',
`id` int(11) NOT NULL AUTO_INCREMENT,
`device_id` int(11) DEFAULT NULL COMMENT '设备ID',
`user_id` int(11) DEFAULT NULL COMMENT '用户ID',
`name` varchar(255) DEFAULT NULL COMMENT '歌名',
`status` tinyint(2) DEFAULT '2' COMMENT '状态 1显示 2不显示',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
......@@ -183,7 +209,7 @@ 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 '关键字',
`cmd` varchar(200) NOT NULL COMMENT '命令',
`cmd` varchar(110) NOT NULL COMMENT '命令',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
KEY `secondary_keywords_parent_id` (`parent_id`) USING BTREE
......@@ -199,12 +225,12 @@ CREATE TABLE `parse_class` (
CREATE TABLE `sh_dlink` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`user_id` int(20) DEFAULT NULL COMMENT '用户ID',
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL COMMENT '用户ID',
`title` varchar(50) DEFAULT NULL COMMENT '标题',
`start` varchar(10) DEFAULT NULL COMMENT '生效时间段-开始',
`end` varchar(10) DEFAULT NULL COMMENT '生效时间段-结束',
`device_id` int(20) DEFAULT NULL COMMENT '发起设备ID',
`device_id` int(11) DEFAULT NULL COMMENT '发起设备ID',
`status` tinyint(2) DEFAULT '1' COMMENT '状态[1开启,2关闭]',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
......@@ -213,9 +239,9 @@ CREATE TABLE `sh_dlink` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='智能家居场景';
CREATE TABLE `sh_dlink_device` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`dlink_id` int(20) DEFAULT NULL COMMENT '场景ID',
`device_id` int(20) DEFAULT NULL COMMENT '关联设备ID',
`id` int(11) NOT NULL AUTO_INCREMENT,
`dlink_id` int(11) DEFAULT NULL COMMENT '场景ID',
`device_id` int(11) DEFAULT NULL COMMENT '关联设备ID',
`cmd` text COMMENT '指令',
`status` tinyint(2) DEFAULT '1' COMMENT '状态[1开启,2关闭]',
`status2` tinyint(2) DEFAULT NULL COMMENT '状态[1开启,2关闭]',
......
package ${package}.${moduleName}.dao;
package ${package};
import ${package}.${moduleName}.entity.${className}Entity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......
package ${package}.${moduleName}.entity;
package ${package};
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
......
package ${package}.${moduleName}.service;
package ${package};
import com.baomidou.mybatisplus.extension.service.IService;
import ${mainPath}.common.utils.PageUtils;
......
package ${package}.${moduleName}.service.impl;
package ${package};
import org.springframework.stereotype.Service;
import java.util.Map;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论