Merge branch 'dev' into test
This commit is contained in:
commit
4c79f13c9d
@ -22,7 +22,7 @@ public interface BlackAndWhiteListApi {
|
||||
|
||||
/**
|
||||
* 创建黑名单或白名单
|
||||
* @param req 包含module和param两个字段
|
||||
* @param req 包含type,module,params三个字段
|
||||
* @return 记录id
|
||||
*/
|
||||
@PostMapping("api/black-white-list/create")
|
||||
@ -30,7 +30,7 @@ public interface BlackAndWhiteListApi {
|
||||
|
||||
/**
|
||||
* 删除黑名单或白名单
|
||||
* @param req 包含module和param两个字段
|
||||
* @param req 包含type,module,params三个字段
|
||||
* @return void
|
||||
*/
|
||||
@PostMapping("api/black-white-list/delete")
|
||||
@ -38,7 +38,7 @@ public interface BlackAndWhiteListApi {
|
||||
|
||||
/**
|
||||
* 查询黑名单或白名单
|
||||
* @param req 包含module和param两个字段
|
||||
* @param req 包含type,module,params三个字段
|
||||
* @return 黑白名单记录列表
|
||||
*/
|
||||
@PostMapping("api/black-white-list/query")
|
||||
@ -46,7 +46,7 @@ public interface BlackAndWhiteListApi {
|
||||
|
||||
/**
|
||||
* 判断指定模块、指定参数记录是否在黑名单或白名单中
|
||||
* @param req 包含module和param两个字段
|
||||
* @param req 包含type,module,params三个字段
|
||||
* @return 若记录存在则返回true,否则返回false
|
||||
*/
|
||||
@PostMapping("api/black-white-list/is-in")
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
package cn.axzo.nanopart.api.constant.enums;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author: chenwenjian
|
||||
* @date: 2023/8/17 14:17
|
||||
* @description: 名单类型枚举
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
public enum ListTypeEnum {
|
||||
|
||||
/**
|
||||
* 黑名单
|
||||
*/
|
||||
BLACK_LIST(0,"黑名单"),
|
||||
/**
|
||||
* 白名单
|
||||
*/
|
||||
WHITE_LIST(1,"白名单");
|
||||
|
||||
private final Integer value;
|
||||
private final String description;
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
ListTypeEnum(Integer value, String description) {
|
||||
this.value = value;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public static ListTypeEnum getByType(Integer value){
|
||||
return Arrays.stream(values()).filter(l -> l.getValue().equals(value)).findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,10 @@
|
||||
package cn.axzo.nanopart.api.request;
|
||||
|
||||
import cn.axzo.nanopart.api.constant.enums.ListTypeEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -15,7 +17,11 @@ import java.util.Map;
|
||||
@Data
|
||||
public class BlackAndWhiteListReq {
|
||||
|
||||
@NotNull(message = "名单类型错误")
|
||||
private ListTypeEnum type;
|
||||
|
||||
@NotBlank(message = "模块名不能为空")
|
||||
private String module;
|
||||
|
||||
private Map<String,Object> param;
|
||||
}
|
||||
|
||||
@ -20,6 +20,8 @@ import java.util.Map;
|
||||
@TableName(value = "saas_black_white_list",autoResultMap = true)
|
||||
public class SaasBlackWhiteList extends BaseEntity<SaasBlackWhiteList> {
|
||||
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 模块名
|
||||
*/
|
||||
|
||||
@ -33,7 +33,7 @@ public class BlackAndWhiteListRepository extends ServiceImpl<BlackAndWhiteListMa
|
||||
private final BlackAndWhiteListMapper blackAndWhiteListMapper;
|
||||
|
||||
public Long create(BlackAndWhiteListReq req){
|
||||
SaasBlackWhiteList blackWhiteList = BeanMapper.copyBean(req, SaasBlackWhiteList.class);
|
||||
SaasBlackWhiteList blackWhiteList = BeanMapper.copyBean(req, SaasBlackWhiteList.class, (req1, saasBlackWhiteList) -> saasBlackWhiteList.setType(req1.getType().getValue()));
|
||||
Date nowTime = new Date(System.currentTimeMillis());
|
||||
blackWhiteList.setCreateAt(nowTime);
|
||||
blackWhiteList.setUpdateAt(nowTime);
|
||||
@ -57,8 +57,9 @@ public class BlackAndWhiteListRepository extends ServiceImpl<BlackAndWhiteListMa
|
||||
|
||||
public List<SaasBlackWhiteList> detail(BlackAndWhiteListReq req) {
|
||||
QueryWrapper<SaasBlackWhiteList> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotBlank(req.getModule()),"module",req.getModule())
|
||||
.eq("is_delete",0);
|
||||
queryWrapper.eq("type",req.getType().getValue())
|
||||
.eq(StringUtils.isNotBlank(req.getModule()),"module",req.getModule())
|
||||
.eq("is_delete",0);
|
||||
buildQueryWrapper(queryWrapper, req.getParam(), "");
|
||||
return blackAndWhiteListMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user