员工权限相关接口
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
|
||||
package com.czg.account.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import java.io.Serial;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 店铺权限 实体类。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-02-18
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ShopPermissionDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 权限类型:staff 员工,
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 权限名称
|
||||
*/
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 权限code,为了区分采用汉语拼音
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 层级
|
||||
*/
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 上级ID
|
||||
*/
|
||||
private Integer parentId;
|
||||
|
||||
/**
|
||||
* 是否重要: 重要对应页面红色
|
||||
*/
|
||||
private Integer isImportant;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
package com.czg.account.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.Serial;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 店铺员工权限关联表 实体类。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-02-18
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ShopStaffPermissionDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 权限ID
|
||||
*/
|
||||
private Integer permissionId;
|
||||
|
||||
/**
|
||||
* 员工ID
|
||||
*/
|
||||
private Integer staffId;
|
||||
|
||||
/**
|
||||
* 店铺ID
|
||||
*/
|
||||
private Integer shopId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
@@ -16,6 +17,10 @@ public class ShopStaffAddDTO {
|
||||
*/
|
||||
@NotNull(message = "角色id不为空")
|
||||
private Long roleId;
|
||||
/**
|
||||
* 店铺权限id集合
|
||||
*/
|
||||
private List<Long> shopPermissionIds;
|
||||
/**
|
||||
* 员工姓名
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,7 @@ import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
@@ -13,6 +14,10 @@ import java.math.BigDecimal;
|
||||
public class ShopStaffEditDTO {
|
||||
@NotNull(message = "id不为空")
|
||||
private Long id;
|
||||
/**
|
||||
* 店铺权限id集合
|
||||
*/
|
||||
private List<Long> shopPermissionIds;
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.czg.account.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 店铺权限 实体类。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-02-18
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_shop_permission")
|
||||
public class ShopPermission implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 权限类型:staff 员工,
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 权限名称
|
||||
*/
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 权限code,为了区分采用汉语拼音
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 层级
|
||||
*/
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 上级ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 是否重要: 重要对应页面红色
|
||||
*/
|
||||
private Integer isImportant;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Column(ignore = true)
|
||||
private List<ShopPermission> children;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.czg.account.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 店铺员工权限关联表 实体类。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-02-18
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_shop_staff_permission")
|
||||
public class ShopStaffPermission implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 权限ID
|
||||
*/
|
||||
private Long permissionId;
|
||||
|
||||
/**
|
||||
* 员工ID
|
||||
*/
|
||||
private Long staffId;
|
||||
|
||||
/**
|
||||
* 店铺ID
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.czg.account.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.account.entity.ShopPermission;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺权限 服务层。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-02-18
|
||||
*/
|
||||
public interface ShopPermissionService extends IService<ShopPermission> {
|
||||
|
||||
List<ShopPermission> getPermission();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.czg.account.service;
|
||||
|
||||
import com.czg.account.entity.ShopPermission;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.account.entity.ShopStaffPermission;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺员工权限关联表 服务层。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-02-18
|
||||
*/
|
||||
public interface ShopStaffPermissionService extends IService<ShopStaffPermission> {
|
||||
|
||||
List<ShopPermission> getPermissionByStaffId(Long shopId, Long staffId, Long userId);
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import com.czg.account.entity.ShopStaff;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺员工 服务层。
|
||||
*
|
||||
@@ -22,4 +24,6 @@ public interface ShopStaffService extends IService<ShopStaff> {
|
||||
Page<ShopStaff> get(String name, String code);
|
||||
|
||||
Boolean delete(ShopStaffRemoveDTO shopStaffRemoveDTO);
|
||||
|
||||
List<Long> permission(Long id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user