|
|
|
@ -3,9 +3,6 @@ package com.thing.filter.rule.service.impl; |
|
|
|
import static com.thing.filter.rule.entity.table.FilterRuleDetailEntityTableDef.FILTER_RULE_DETAIL_ENTITY; |
|
|
|
import static com.thing.filter.rule.entity.table.FilterRuleEntityTableDef.FILTER_RULE_ENTITY; |
|
|
|
|
|
|
|
import cn.hutool.core.map.MapUtil; |
|
|
|
import com.mybatisflex.core.keygen.impl.SnowFlakeIDKeyGenerator; |
|
|
|
|
|
|
|
import com.mybatisflex.core.paginate.Page; |
|
|
|
import com.mybatisflex.core.query.QueryWrapper; |
|
|
|
import com.thing.common.cache.constants.CacheNameEnum; |
|
|
|
@ -15,6 +12,7 @@ import com.thing.common.core.utils.ConvertUtils; |
|
|
|
import com.thing.common.core.utils.FormulaUtil; |
|
|
|
import com.thing.common.core.web.response.PageData; |
|
|
|
import com.thing.common.orm.service.impl.BaseServiceImpl; |
|
|
|
import com.thing.common.orm.utils.IdGenerator; |
|
|
|
import com.thing.filter.rule.dto.FilterRuleDTO; |
|
|
|
import com.thing.filter.rule.dto.FilterRuleDetailDTO; |
|
|
|
import com.thing.filter.rule.entity.FilterRuleDetailEntity; |
|
|
|
@ -22,19 +20,17 @@ import com.thing.filter.rule.entity.FilterRuleEntity; |
|
|
|
import com.thing.filter.rule.mapper.FilterRuleMapper; |
|
|
|
import com.thing.filter.rule.service.FilterRuleDetailService; |
|
|
|
import com.thing.filter.rule.service.FilterRuleService; |
|
|
|
|
|
|
|
import com.thing.sys.security.context.UserContext; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.cache.annotation.CacheEvict; |
|
|
|
import org.springframework.cache.annotation.Cacheable; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 过滤规则表 |
|
|
|
* |
|
|
|
@ -50,9 +46,9 @@ public class FilterRuleServiceImpl extends BaseServiceImpl<FilterRuleMapper, Fil |
|
|
|
|
|
|
|
@Override |
|
|
|
public QueryWrapper getWrapper(Map<String, Object> params) { |
|
|
|
String name = MapUtil.getStr(params, "name"); |
|
|
|
String thingKeyword = MapUtil.getStr(params, "thingKeyword"); |
|
|
|
String attrKeyword = MapUtil.getStr(params, "attrKeyword"); |
|
|
|
String name = MapUtils.getString(params, "name"); |
|
|
|
String thingKeyword = MapUtils.getString(params, "thingKeyword"); |
|
|
|
String attrKeyword = MapUtils.getString(params, "attrKeyword"); |
|
|
|
QueryWrapper wrapper = |
|
|
|
QueryWrapper.create() |
|
|
|
.select(FILTER_RULE_ENTITY.ALL_COLUMNS) |
|
|
|
@ -190,7 +186,7 @@ public class FilterRuleServiceImpl extends BaseServiceImpl<FilterRuleMapper, Fil |
|
|
|
* 之前与领导商量采用 {@link AggFunction} 示例中给出的公式写法,不过被否定了,认为用户是傻子,无法理解那种写法【摊手.jpg】 |
|
|
|
*/ |
|
|
|
private void generateDefaultInfo(FilterRuleDTO filterRule) { |
|
|
|
filterRule.setId(Optional.ofNullable(filterRule.getId()).orElse(new SnowFlakeIDKeyGenerator().nextId())); |
|
|
|
filterRule.setId(Optional.ofNullable(filterRule.getId()).orElse(IdGenerator.nextId())); |
|
|
|
filterRule.setEnable(Optional.ofNullable(filterRule.getEnable()).orElse(true)); |
|
|
|
// 生成过滤规则描述 |
|
|
|
List<FilterRuleDetailDTO> details = filterRule.getDetails(); |
|
|
|
|