master
chentaisen 2024-09-04 12:03:49 +08:00
parent 021c2c169c
commit efeeb55953
2 changed files with 15 additions and 5 deletions

View File

@ -31,7 +31,7 @@ public class RuleController {
*/
@RequestMapping(path = "/list", method = RequestMethod.POST)
@Operation(summary = "查看规则", description = "查看规则")
public Result<List<Rule>> select(Rule rule) {
public Result<List<Rule>> select(@RequestBody Rule rule) {
return Result.success(ruleService.selects(rule));
}

View File

@ -2,6 +2,7 @@ package com.muyu.rule.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.StringUtils;
import com.muyu.common.core.utils.rule.Desensitization;
import com.muyu.rule.mapper.RuleMapper;
import com.muyu.rule.service.RuleService;
@ -37,16 +38,25 @@ public class RuleServiceImpl extends ServiceImpl<RuleMapper, Rule> implements Ru
/**
*
*
* @param rule
* @return
*/
@Override
public List<Rule> selects(Rule rule) {
LambdaQueryWrapper<Rule> ruleLambdaQueryWrapper = new LambdaQueryWrapper<>();
ruleLambdaQueryWrapper.eq(Rule::getName, rule.getName())
.like(Rule::getName, rule.getName())
.eq(Rule::getIsActivate, rule.getIsActivate())
;
//名称模糊
if (StringUtils.isNotBlank(rule.getName())) {
ruleLambdaQueryWrapper.like(Rule::getName, rule.getName());
}
//名称精确
if (StringUtils.isNotBlank(rule.getName())) {
ruleLambdaQueryWrapper.eq(Rule::getName, rule.getName());
}
//激活状态
if (StringUtils.isNotBlank(rule.getIsActivate())) {
ruleLambdaQueryWrapper.eq(Rule::getIsActivate, rule.getIsActivate());
}
List<Rule> list = this.list(ruleLambdaQueryWrapper);
return list;
}