refactor(iot): 优化 IoT 模块数据结构和接口权限
- 在 DeptMapper.xml 中添加 remark 字段映射 - 更新 DeptTree 类,将 members 类型从 List<UserTree> 改为 List<UserVo> - 移除 UserTree 类 - 在 DeviceVo、Event、Param、Product、Property 和 Serve 类中添加 @JsonInclude 注解 - 更新 ServeController 中的权限检查逻辑
This commit is contained in:
parent
7d0d0fea44
commit
05a76348f1
src/main
java/com/zsc/edu/gateway/modules
iot
device/vo
product/entity
tsl
system
resources/mappers/system
@ -1,6 +1,7 @@
|
||||
package com.zsc.edu.gateway.modules.iot.device.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.zsc.edu.gateway.framework.json.JsonbTypeHandler;
|
||||
import com.zsc.edu.gateway.modules.iot.device.entity.Device;
|
||||
import com.zsc.edu.gateway.modules.iot.product.entity.Product;
|
||||
@ -15,6 +16,7 @@ import java.util.Set;
|
||||
/**
|
||||
* @author zhuang
|
||||
*/
|
||||
@JsonInclude
|
||||
@Data
|
||||
public class DeviceVo {
|
||||
/**
|
||||
|
@ -3,6 +3,7 @@ package com.zsc.edu.gateway.modules.iot.product.entity;
|
||||
import com.baomidou.mybatisplus.annotation.IEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.zsc.edu.gateway.common.enums.IState;
|
||||
import com.zsc.edu.gateway.modules.iot.tsl.entity.Param;
|
||||
import com.zsc.edu.gateway.modules.system.entity.BaseEntity;
|
||||
@ -22,6 +23,7 @@ import java.util.Set;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("iot_product")
|
||||
@JsonInclude
|
||||
public class Product extends BaseEntity {
|
||||
/**
|
||||
* 产品名称
|
||||
|
@ -28,7 +28,7 @@ public class ServeController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping
|
||||
@PreAuthorize("hasAnyAuthority('iot:server:create')")
|
||||
@PreAuthorize("hasAnyAuthority('iot:serve:create')")
|
||||
public Serve create(@RequestBody ServeDto dto) {
|
||||
return serveService.create(dto);
|
||||
}
|
||||
@ -40,7 +40,7 @@ public class ServeController {
|
||||
* @return 更新后的服务
|
||||
*/
|
||||
@PatchMapping("{id}")
|
||||
@PreAuthorize("hasAnyAuthority('iot:server:update')")
|
||||
@PreAuthorize("hasAnyAuthority('iot:serve:update')")
|
||||
public Serve update(@RequestBody ServeDto dto, @PathVariable("id") Long id) {
|
||||
return serveService.update(dto, id);
|
||||
}
|
||||
@ -54,7 +54,7 @@ public class ServeController {
|
||||
* @return Page<Device> 服务分页数据
|
||||
*/
|
||||
@GetMapping
|
||||
@PreAuthorize("hasAnyAuthority('iot:server:query')")
|
||||
@PreAuthorize("hasAnyAuthority('iot:serve:query')")
|
||||
public Page<Serve> page(Page<Serve> page, ServeQuery query) {
|
||||
return serveService.page(page, query.wrapper());
|
||||
}
|
||||
@ -66,7 +66,7 @@ public class ServeController {
|
||||
* @return 被删除的服务
|
||||
*/
|
||||
@DeleteMapping("{id}")
|
||||
@PreAuthorize("hasAnyAuthority('iot:server:delete')")
|
||||
@PreAuthorize("hasAnyAuthority('iot:serve:delete')")
|
||||
public Boolean delete(@PathVariable("id") Long id) {
|
||||
return serveService.delete(id);
|
||||
}
|
||||
@ -79,7 +79,7 @@ public class ServeController {
|
||||
* @return 任务
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
@PreAuthorize("hasAnyAuthority('iot:server:query')")
|
||||
@PreAuthorize("hasAnyAuthority('iot:serve:query')")
|
||||
public Serve detail(@PathVariable("id") Long id) {
|
||||
return serveService.detail(id);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.zsc.edu.gateway.modules.iot.tsl.entity;
|
||||
import com.baomidou.mybatisplus.annotation.IEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.zsc.edu.gateway.common.enums.IState;
|
||||
import com.zsc.edu.gateway.modules.iot.product.entity.Product;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -23,6 +24,7 @@ import java.util.Set;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("iot_event")
|
||||
@JsonInclude
|
||||
public class Event extends BaseParam {
|
||||
|
||||
private Long productId;
|
||||
|
@ -2,6 +2,7 @@ package com.zsc.edu.gateway.modules.iot.tsl.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.zsc.edu.gateway.common.enums.IState;
|
||||
import lombok.*;
|
||||
|
||||
@ -16,6 +17,7 @@ import lombok.*;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("iot_param")
|
||||
@JsonInclude
|
||||
public class Param extends BaseParam {
|
||||
/**
|
||||
* 数据类型
|
||||
|
@ -3,6 +3,7 @@ package com.zsc.edu.gateway.modules.iot.tsl.entity;
|
||||
import com.baomidou.mybatisplus.annotation.IEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.zsc.edu.gateway.common.enums.IState;
|
||||
import com.zsc.edu.gateway.modules.iot.product.entity.Product;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -20,6 +21,7 @@ import lombok.Setter;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("iot_property")
|
||||
@JsonInclude
|
||||
public class Property extends BaseParam {
|
||||
|
||||
private Long productId;
|
||||
|
@ -2,6 +2,7 @@ package com.zsc.edu.gateway.modules.iot.tsl.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.zsc.edu.gateway.modules.iot.tsl.dto.ParamDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@ -20,6 +21,7 @@ import java.util.Set;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("iot_serve")
|
||||
@JsonInclude
|
||||
public class Serve extends BaseParam {
|
||||
|
||||
private Long productId;
|
||||
|
@ -53,5 +53,6 @@ public class MenuDto {
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
@NotBlank(message = "权限不能为空")
|
||||
private String permissions;
|
||||
}
|
||||
|
@ -18,9 +18,8 @@ import java.util.List;
|
||||
public class DeptTree {
|
||||
|
||||
private Long id;
|
||||
@JsonIgnore
|
||||
private Long pid;
|
||||
private String name;
|
||||
List<DeptTree> children = new ArrayList<>();
|
||||
List<UserTree> members = new ArrayList<>();
|
||||
List<UserVo> members = new ArrayList<>();
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
package com.zsc.edu.gateway.modules.system.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author zhuang
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserTree {
|
||||
private Long id;
|
||||
private String name;
|
||||
}
|
@ -8,6 +8,7 @@
|
||||
<result column="pid" property="pid"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="dept_sort" property="deptSort"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<collection
|
||||
property="members"
|
||||
ofType="com.zsc.edu.gateway.modules.system.vo.UserVo"
|
||||
|
Loading…
Reference in New Issue
Block a user