代码提交
parent
0ec3380be2
commit
1626712cee
|
|
@ -30,8 +30,8 @@ public class Knife4jConfiguration {
|
|||
|
||||
private ApiInfo getApiInfoBuilder() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("歧义数据管理api")
|
||||
.description("# 歧义数据管理api RESTful APIs")
|
||||
.title("防汛抗旱通讯录api")
|
||||
.description("# 防汛抗旱通讯录api RESTful APIs")
|
||||
.termsOfServiceUrl("http://219.138.108.99:19000/jszx")
|
||||
.contact(new Contact("湖北纬皓端成", null, null))
|
||||
.version("1.0")
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ public class AddressBookController {
|
|||
}
|
||||
|
||||
@ApiOperation(value = "修改权限")
|
||||
@PostMapping(value = "edit")
|
||||
@PostMapping(value = "updateRole")
|
||||
public ResultJson updateRole(@RequestBody @Validated(Update.class) User model) {
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ public class OrganizationController {
|
|||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页查询")
|
||||
@PostMapping(value = "page")
|
||||
// @ApiOperation(value = "分页查询")
|
||||
// @PostMapping(value = "page")
|
||||
public ResultJson<Organization> page(@RequestBody Organization dto) {
|
||||
|
||||
return ResultJson.ok(service.page(dto));
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
|
@ -67,16 +66,16 @@ public class UserController {
|
|||
StpUtil.kickout(id);
|
||||
return ResultJson.ok("将用户[" + id + "]踢下线");
|
||||
}
|
||||
@ApiOperation(value = "查询所有")
|
||||
@PostMapping(value = "find")
|
||||
// @ApiOperation(value = "查询所有")
|
||||
// @PostMapping(value = "find")
|
||||
public ResultJson<User> find(@RequestBody User dto) {
|
||||
|
||||
return ResultJson.ok(service.find(dto));
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页查询")
|
||||
@PostMapping(value = "page")
|
||||
// @ApiOperation(value = "分页查询")
|
||||
// @PostMapping(value = "page")
|
||||
public ResultJson<User> page(@RequestBody User dto) {
|
||||
|
||||
return ResultJson.ok(service.page(dto));
|
||||
|
|
@ -102,8 +101,8 @@ public class UserController {
|
|||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改")
|
||||
@PostMapping(value = "edit")
|
||||
// @ApiOperation(value = "修改")
|
||||
// @PostMapping(value = "edit")
|
||||
public ResultJson update(@RequestBody @Validated(Update.class) User model) {
|
||||
|
||||
if (CollectionUtils.isNotEmpty(
|
||||
|
|
@ -112,7 +111,7 @@ public class UserController {
|
|||
.ne(User::getId, model.getId())
|
||||
.list())
|
||||
){
|
||||
return ResultJson.error("该名称重复");
|
||||
return ResultJson.error("用户名重复");
|
||||
}
|
||||
|
||||
return ResultJson.ok(service.updateById(model));
|
||||
|
|
|
|||
|
|
@ -44,15 +44,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|||
|
||||
|
||||
@Override
|
||||
public LoginVo login(LoginDto obj) {
|
||||
public LoginVo login(LoginDto dto) {
|
||||
|
||||
User sysUser = findByLoginName(obj.getLoginName());
|
||||
User sysUser = findByLoginName(dto.getLoginName());
|
||||
|
||||
if (sysUser == null) {
|
||||
throw new MyException("用户名或密码错误");
|
||||
}
|
||||
|
||||
if (getPassword(sysUser.getSalt() ,obj.getPassword()).equals(sysUser.getPassword())) {
|
||||
if (getPassword(sysUser.getSalt() ,dto.getPassword()).equals(sysUser.getPassword())) {
|
||||
LoginVo out = new LoginVo();
|
||||
BeanUtils.copyProperties(sysUser, out);
|
||||
return out;
|
||||
|
|
|
|||
|
|
@ -1,72 +0,0 @@
|
|||
package com.whdc.valid.bean;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xusan
|
||||
* @date 2023年3月22日10:32:54
|
||||
* @description: 雨量值时间规则
|
||||
*/
|
||||
public enum IntvType {
|
||||
|
||||
IT001(300, "0.05"),
|
||||
IT002(300, "0.08"),
|
||||
IT003(3600, "1");
|
||||
|
||||
private Integer name;
|
||||
private String value;
|
||||
|
||||
public Integer getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(Integer name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
IntvType(Integer name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static List<JSONObject> list() {
|
||||
List<JSONObject> list = new ArrayList<>();
|
||||
IntvType[] values = IntvType.values();
|
||||
for (IntvType type : values) {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("name", type.getName());
|
||||
obj.put("value", type.getValue());
|
||||
list.add(obj);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static Map<String, IntvType> map() {
|
||||
Map<String, IntvType> map = new HashMap<>();
|
||||
IntvType[] values = IntvType.values();
|
||||
for (IntvType e : values) {
|
||||
map.put(e.getValue(), e);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public static IntvType getByValue(String value) {
|
||||
if (StringUtils.isEmpty(value)) return null;
|
||||
return map().get(value);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
package com.whdc.valid.bean;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xusan
|
||||
* @date 2023年3月22日10:32:54
|
||||
* @description: 测站类型代码
|
||||
*/
|
||||
public enum ItemType {
|
||||
|
||||
YU_LIANG("雨量", "P"),
|
||||
SHUI_WEI("水位", "Z"),
|
||||
LIU_LIANG("流量", "Q"),
|
||||
TONG_YONG("通用", "ALL");
|
||||
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
ItemType(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static List<JSONObject> list() {
|
||||
List<JSONObject> list = new ArrayList<>();
|
||||
ItemType[] values = ItemType.values();
|
||||
for (ItemType type : values) {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("name", type.getName());
|
||||
obj.put("value", type.getValue());
|
||||
list.add(obj);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static Map<String, ItemType> map() {
|
||||
Map<String, ItemType> map = new HashMap<>();
|
||||
ItemType[] values = ItemType.values();
|
||||
for (ItemType e : values) {
|
||||
map.put(e.getValue(), e);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public static ItemType getByValue(String value) {
|
||||
if (StringUtils.isEmpty(value)) return null;
|
||||
return map().get(value);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
package com.whdc.valid.component;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.whdc.valid.mapper.ValidateMapper;
|
||||
import com.whdc.valid.model.ValidateVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component("ruleRedis")
|
||||
public class RuleRedisService {
|
||||
|
||||
|
||||
private static final String VALIDATE_REDIS_KEY = "validate:";
|
||||
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<String, String> ruleRedisTemplate;
|
||||
|
||||
public List<ValidateVo> getRule(String stcd,ValidateMapper validateMapper) {
|
||||
return getRule(null,null,stcd,validateMapper);
|
||||
}
|
||||
|
||||
public List<ValidateVo> getRule(String source,String countycode,String stcd,ValidateMapper validateMapper) {
|
||||
|
||||
List<ValidateVo> rules = null;
|
||||
|
||||
log.info("获取规则: {}" , stcd);
|
||||
|
||||
if (StringUtils.isBlank(source)) {
|
||||
source = "0";
|
||||
}
|
||||
if (StringUtils.isBlank(countycode)) {
|
||||
countycode = "0";
|
||||
}
|
||||
|
||||
String key = VALIDATE_REDIS_KEY + source +":"+ countycode + ":" + stcd;
|
||||
|
||||
if (Boolean.TRUE.equals(ruleRedisTemplate.hasKey(key))) {
|
||||
|
||||
List<String> json = ruleRedisTemplate.opsForList().range(key, 0, -1);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(json)) {
|
||||
|
||||
rules = json.stream()
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.map(s -> JSON.toJavaObject(JSON.parseObject(s), ValidateVo.class))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
}
|
||||
}else{
|
||||
rules = validateMapper.getRuleByStcd(source,countycode,stcd);
|
||||
|
||||
log.info("保存规则: " + rules.size());
|
||||
|
||||
if (CollectionUtils.isEmpty(rules)) {
|
||||
rules = new ArrayList<>();
|
||||
|
||||
// 添加空号缓存
|
||||
rules.add(new ValidateVo());
|
||||
}
|
||||
|
||||
Long aLong = ruleRedisTemplate.opsForList().rightPushAll(key, rules.stream().map(JSON::toJSONString).collect(Collectors.toList()));
|
||||
|
||||
if (aLong != rules.size()) {
|
||||
log.info("保存规则失败: " + key + "_" + rules.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (CollectionUtils.isNotEmpty(rules) && JSON.parseObject(JSON.toJSONString(rules.get(0))).isEmpty()){
|
||||
rules.remove(0);
|
||||
}
|
||||
|
||||
|
||||
if (CollectionUtils.isEmpty(rules)) {
|
||||
// 查询通用规则
|
||||
return this.getRule("ALL", validateMapper);
|
||||
|
||||
}
|
||||
|
||||
log.info("获取规则条数: {}" , rules.size());
|
||||
|
||||
|
||||
return rules;
|
||||
}
|
||||
|
||||
public void delRule(String stcd){
|
||||
|
||||
if (StringUtils.isBlank(stcd)){
|
||||
return;
|
||||
}
|
||||
|
||||
String key = VALIDATE_REDIS_KEY + stcd;
|
||||
|
||||
if (Boolean.TRUE.equals(ruleRedisTemplate.hasKey(key))) {
|
||||
|
||||
Boolean delete = ruleRedisTemplate.delete(key);
|
||||
if (!Boolean.TRUE.equals(delete)) {
|
||||
|
||||
log.info("删除失败, 主键: {}" ,key);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
package com.whdc.valid.conf;
|
||||
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@MapperScan("com.whdc.valid.mapper")
|
||||
public class MapperScanConfig {
|
||||
}
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
package com.whdc.valid.conf;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
import org.springframework.data.redis.connection.lettuce.LettucePoolingClientConfiguration;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
/**
|
||||
* @author xusan
|
||||
* @date 2023年9月8日11:09:47
|
||||
*/
|
||||
@Configuration
|
||||
public class RuleRestTemplateConfig {
|
||||
|
||||
/**
|
||||
|
||||
# 数据清洗专用redis
|
||||
redisRules:
|
||||
database: 0
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password:
|
||||
timeout: 60000
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 50
|
||||
max-idle: 50
|
||||
min-idle: 1
|
||||
max-wait: 50000
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@Value("${spring.redisRules.host}")
|
||||
private String host;
|
||||
|
||||
@Value("${spring.redisRules.port}")
|
||||
private Integer port;
|
||||
|
||||
@Value("${spring.redisRules.password}")
|
||||
private String password;
|
||||
|
||||
@Value("${spring.redisRules.database}")
|
||||
private int database;
|
||||
|
||||
@Value("${spring.redisRules.lettuce.pool.max-active}")
|
||||
private String maxActive;
|
||||
|
||||
@Value("${spring.redisRules.lettuce.pool.max-idle}")
|
||||
private String maxIdle;
|
||||
|
||||
@Value("${spring.redisRules.lettuce.pool.min-idle}")
|
||||
private String minIdle;
|
||||
|
||||
@Value("${spring.redisRules.lettuce.pool.max-wait}")
|
||||
private String maxWait;
|
||||
|
||||
@Value("${spring.redisRules.timeout}")
|
||||
private String timeOut;
|
||||
|
||||
|
||||
private LettuceConnectionFactory getConnectionOneFactory() {
|
||||
RedisStandaloneConfiguration redisStandaloneConfiguration =
|
||||
new RedisStandaloneConfiguration();
|
||||
redisStandaloneConfiguration.setHostName(host);
|
||||
redisStandaloneConfiguration.setDatabase(database);
|
||||
redisStandaloneConfiguration.setPassword(password);
|
||||
redisStandaloneConfiguration.setPort(port);
|
||||
|
||||
GenericObjectPoolConfig genericObjectPoolConfig =
|
||||
new GenericObjectPoolConfig();
|
||||
genericObjectPoolConfig.setMaxIdle(Integer.parseInt(maxIdle));
|
||||
genericObjectPoolConfig.setMinIdle(Integer.parseInt(minIdle));
|
||||
genericObjectPoolConfig.setMaxTotal(Integer.parseInt(maxActive));
|
||||
genericObjectPoolConfig.setMaxWait(Duration.ofMillis(Integer.parseInt(maxWait)));
|
||||
LettucePoolingClientConfiguration.LettucePoolingClientConfigurationBuilder
|
||||
builder = LettucePoolingClientConfiguration.builder().
|
||||
commandTimeout(Duration.ofMillis(Integer.parseInt(timeOut)));
|
||||
builder.poolConfig(genericObjectPoolConfig);
|
||||
LettuceClientConfiguration lettuceClientConfiguration = builder.build();
|
||||
//根据配置和客户端配置创建连接
|
||||
LettuceConnectionFactory lettuceConnectionFactory = new
|
||||
LettuceConnectionFactory(redisStandaloneConfiguration,lettuceClientConfiguration);
|
||||
lettuceConnectionFactory .afterPropertiesSet();
|
||||
return lettuceConnectionFactory;
|
||||
}
|
||||
|
||||
@Bean("ruleRedisTemplate")
|
||||
public RedisTemplate<String, String> ruleRedisTemplate() {
|
||||
LettuceConnectionFactory connectionFactory = getConnectionOneFactory();
|
||||
RedisTemplate<String, String> redisTemplate = new RedisTemplate<>();
|
||||
redisTemplate.setConnectionFactory(connectionFactory);
|
||||
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<Object>(Object.class);
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||
jackson2JsonRedisSerializer.setObjectMapper(om);
|
||||
RedisSerializer<?> stringSerializer = new StringRedisSerializer();
|
||||
redisTemplate.setKeySerializer(stringSerializer);
|
||||
redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);
|
||||
redisTemplate.afterPropertiesSet();
|
||||
redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);
|
||||
redisTemplate.setHashKeySerializer(stringSerializer);
|
||||
return redisTemplate;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
package com.whdc.valid.error;
|
||||
|
||||
/**
|
||||
* @author 李赛
|
||||
* @date 2022-06-26 10:58
|
||||
*/
|
||||
|
||||
public class MyException extends RuntimeException {
|
||||
|
||||
private final String msg;
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public MyException(String msg) {
|
||||
super(msg);
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public MyException(String msg, Throwable e) {
|
||||
super(msg, e);
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public static MyException getException(String msg) {
|
||||
return new MyException(msg);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
package com.whdc.valid.mapper;
|
||||
|
||||
import com.whdc.valid.model.ValidateVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author XuSan
|
||||
*/
|
||||
@Mapper
|
||||
public interface ValidateMapper {
|
||||
|
||||
/**
|
||||
* stcd 查询 规则
|
||||
* @param stcd
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT E.ITEM,E.MIN,E.MAX,E.DIFF_MAX,E.DURATION,E.LEADING_TIME,E.LAG_TIME,T.SORT FROM SHZH_IOT.E_STATION_RULES T LEFT JOIN SHZH_IOT.E_RULE E ON T.RULE_ID = E.ID WHERE T.DEL = 1 AND E.DEL = 1 AND T.SOURCE = #{source} AND T.COUNTYCODE = #{countycode} AND T.STCD = #{stcd} ORDER BY T.SORT ASC;")
|
||||
List<ValidateVo> getRuleByStcd(String source,String countycode, String stcd);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
package com.whdc.valid.model;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author xusan
|
||||
* @date 2023年3月20日08:57:22
|
||||
*/
|
||||
@Data
|
||||
public class ValidateDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "测站编码", dataType = "java.lang.String")
|
||||
private String stcd;
|
||||
|
||||
@ApiModelProperty(value = "所在区域", dataType = "java.lang.String")
|
||||
private String countycode;
|
||||
|
||||
@ApiModelProperty(value = "所在区域", dataType = "java.lang.String")
|
||||
private String source;
|
||||
|
||||
@ApiModelProperty(value = "监测时间", dataType = "java.lang.Date")
|
||||
private Date tm;
|
||||
|
||||
@ApiModelProperty(value = "累计时间", dataType = "java.lang.Date")
|
||||
private String intv;
|
||||
|
||||
private Data data;
|
||||
|
||||
@lombok.Data
|
||||
public static class Data {
|
||||
|
||||
/**
|
||||
* 雨量
|
||||
*/
|
||||
private BigDecimal p;
|
||||
|
||||
/**
|
||||
* 水位
|
||||
*/
|
||||
private BigDecimal q;
|
||||
|
||||
/**
|
||||
* 流量
|
||||
*/
|
||||
private BigDecimal z;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
package com.whdc.valid.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author 李赛
|
||||
* @date 2022-06-26 10:43
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true) // chain = true 实现链式调用
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) // 表示序列化非null属性
|
||||
public class ValidateVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 测站类型
|
||||
*/
|
||||
@ApiParam(value = "规则类型", required = true, example = "")
|
||||
@ApiModelProperty(value = "规则类型", required = true, dataType = "String")
|
||||
private String item;
|
||||
|
||||
|
||||
/**
|
||||
* 最小值
|
||||
*/
|
||||
@ApiParam(value = "最小值", required = false, example = "")
|
||||
@ApiModelProperty(value = "最小值", required = false, dataType = "String")
|
||||
private BigDecimal min;
|
||||
|
||||
/**
|
||||
* 最大值
|
||||
*/
|
||||
@ApiParam(value = "最大值", required = false, example = "")
|
||||
@ApiModelProperty(value = "最大值", required = false, dataType = "String")
|
||||
private BigDecimal max;
|
||||
|
||||
/**
|
||||
* 差值
|
||||
*/
|
||||
@ApiParam(value = "两条数据之间的最大差值", required = false, example = "")
|
||||
@ApiModelProperty(value = "两条数据之间的最大差值", required = false, dataType = "String")
|
||||
private BigDecimal diffMax;
|
||||
|
||||
/**
|
||||
* 接收超出时间,单位: s ,指接收时间超前范围
|
||||
*/
|
||||
@ApiParam(value = "接收超前时间,单位: s ,指接收时间超前范围", required = false, example = "")
|
||||
@ApiModelProperty(value = "接收超前时间,单位: s ,指接收时间超前范围", required = false, dataType = "Integer")
|
||||
private Integer leadingTime;
|
||||
|
||||
/**
|
||||
* 接收滞后时间,单位: s ,指接收时间滞后范围
|
||||
*/
|
||||
@ApiParam(value = "接收滞后时间,单位: s ,指接收时间滞后范围", required = false, example = "")
|
||||
@ApiModelProperty(value = "接收滞后时间,单位: s ,指接收时间滞后范围", required = false, dataType = "Integer")
|
||||
private Integer lagTime;
|
||||
|
||||
/**
|
||||
* 最大值
|
||||
*/
|
||||
@ApiParam(value = "时间段, 单位 s", required = false, example = "")
|
||||
@ApiModelProperty(value = "时间段, 单位 s", required = false, dataType = "Integer")
|
||||
private Integer duration;
|
||||
|
||||
|
||||
@ApiParam(value = "排序", required = false, example = "")
|
||||
@ApiModelProperty(value = "排序", required = false, dataType = "Integer")
|
||||
private Integer sort;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
package com.whdc.valid.service;
|
||||
|
||||
public interface ValidateService {
|
||||
|
||||
Boolean validate(String json);
|
||||
|
||||
Boolean validate(String json,String prevJson);
|
||||
|
||||
Boolean needPrev(String json);
|
||||
}
|
||||
|
|
@ -1,552 +0,0 @@
|
|||
package com.whdc.valid.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.whdc.valid.bean.IntvType;
|
||||
import com.whdc.valid.bean.ItemType;
|
||||
import com.whdc.valid.component.RuleRedisService;
|
||||
import com.whdc.valid.mapper.ValidateMapper;
|
||||
import com.whdc.valid.model.ValidateDto;
|
||||
import com.whdc.valid.model.ValidateVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.whdc.valid.bean.ItemType.getByValue;
|
||||
import static com.whdc.valid.error.MyException.getException;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ValidateServiceImpl implements ValidateService {
|
||||
|
||||
@Autowired
|
||||
private ValidateMapper validateMapper;
|
||||
|
||||
@Autowired
|
||||
private RuleRedisService ruleRedis;
|
||||
|
||||
/**
|
||||
* 正常值判断
|
||||
*
|
||||
* @param json
|
||||
* @return true: 通过 false: 不通过
|
||||
*/
|
||||
public Boolean validate(String json) {
|
||||
return validate(json, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 弃用
|
||||
*
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
public Boolean validateV1(String json) {
|
||||
|
||||
ValidateDto dto = getValidateDto(json); //正常值
|
||||
|
||||
ValidateDto.Data data = dto.getData();
|
||||
BigDecimal p = data.getP();
|
||||
BigDecimal z = data.getZ();
|
||||
BigDecimal q = data.getQ();
|
||||
|
||||
if (BigDecimal.ZERO.compareTo(p) < 0
|
||||
&& BigDecimal.ZERO.compareTo(z) < 0
|
||||
&& BigDecimal.ZERO.compareTo(q) < 0
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<ValidateVo> rule = ruleRedis.getRule(dto.getStcd(), validateMapper); // 弃用
|
||||
if (CollectionUtils.isEmpty(rule)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Map<String, List<ValidateVo>> items = rule.stream()
|
||||
// .collect(Collectors.groupingBy(ValidateVo::getItem));
|
||||
//
|
||||
// List<ValidateVo> rules = new ArrayList<>();
|
||||
//
|
||||
// if (Objects.nonNull(p)) {
|
||||
// List<ValidateVo> list = items.get("P");
|
||||
// if (CollectionUtils.isNotEmpty(list)) {
|
||||
// rules.addAll(list);
|
||||
// }
|
||||
// }
|
||||
// if (Objects.nonNull(z)) {
|
||||
// List<ValidateVo> list = items.get("Z");
|
||||
// if (CollectionUtils.isNotEmpty(list)) {
|
||||
// rules.addAll(list);
|
||||
// }
|
||||
// }
|
||||
// if (Objects.nonNull(q)) {
|
||||
// List<ValidateVo> list = items.get("Q");
|
||||
// if (CollectionUtils.isNotEmpty(list)) {
|
||||
// rules.addAll(list);
|
||||
// }
|
||||
// }
|
||||
// if (CollectionUtils.isEmpty(rules)) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
|
||||
Date tm = dto.getTm();
|
||||
long currentTime = System.currentTimeMillis();
|
||||
|
||||
|
||||
for (ValidateVo vo : rule) {
|
||||
|
||||
BigDecimal min = vo.getMin();
|
||||
BigDecimal max = vo.getMax();
|
||||
Integer leadingTime = vo.getLeadingTime();
|
||||
Integer lagTime = vo.getLagTime();
|
||||
|
||||
if (Objects.nonNull(leadingTime)) {
|
||||
if (tm.getTime() > currentTime + (leadingTime * 1000)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (Objects.nonNull(lagTime)) {
|
||||
if (tm.getTime() < currentTime - (lagTime * 1000)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
String item = vo.getItem();
|
||||
|
||||
if (StringUtils.isBlank(item)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Objects.isNull(min) && Objects.isNull(max)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemType itemType = getByValue(item);
|
||||
|
||||
if (Objects.isNull(itemType)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (itemType) {
|
||||
case YU_LIANG: { // 雨量判断 P
|
||||
if (!rangeRuleValidate(p, min, max)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SHUI_WEI: { // 水位判断 Z
|
||||
|
||||
if (!rangeRuleValidate(z, min, max)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case LIU_LIANG: { // 流量判断 Q
|
||||
|
||||
if (!rangeRuleValidate(q, min, max)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private Boolean rangeRuleValidate(BigDecimal value, BigDecimal min, BigDecimal max) {
|
||||
|
||||
if (Objects.nonNull(value)) {
|
||||
|
||||
if (Objects.nonNull(min) && value.compareTo(min) < 0) {
|
||||
log.info("对比值小于最小值: {} < {}", value, min);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Objects.nonNull(max) && value.compareTo(max) > 0) {
|
||||
log.info("对比值大于最大值: {} < {}", max, value);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断差值
|
||||
*
|
||||
* @param json
|
||||
* @param prevJson
|
||||
* @return true: 通过 false: 不通过
|
||||
*/
|
||||
public Boolean validate(String json, String prevJson) {
|
||||
|
||||
ValidateDto dto = getValidateDto(json); //正常值
|
||||
ValidateDto prevDto = null;
|
||||
|
||||
if (StringUtils.isNotBlank(prevJson)) {
|
||||
|
||||
prevDto = getValidateDto(prevJson); // 老差值
|
||||
}
|
||||
|
||||
|
||||
String intv = dto.getIntv();
|
||||
|
||||
ValidateDto.Data data = dto.getData();
|
||||
BigDecimal p = data.getP();
|
||||
BigDecimal z = data.getZ();
|
||||
BigDecimal q = data.getQ();
|
||||
|
||||
if (BigDecimal.ZERO.compareTo(p) < 0
|
||||
&& BigDecimal.ZERO.compareTo(z) < 0
|
||||
&& BigDecimal.ZERO.compareTo(q) < 0
|
||||
) {
|
||||
log.info("对比值小于0: {} {} {}", p, z, q);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
List<ValidateVo> rule = ruleRedis.getRule(dto.getSource(),dto.getCountycode(),dto.getStcd(), validateMapper);
|
||||
if (CollectionUtils.isEmpty(rule)) {
|
||||
log.info("规则为空: {}", rule);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Date tm = dto.getTm();
|
||||
long currentTime = System.currentTimeMillis();
|
||||
|
||||
|
||||
for (ValidateVo vo : rule) {
|
||||
|
||||
Integer duration = vo.getDuration();
|
||||
|
||||
BigDecimal min = vo.getMin();
|
||||
BigDecimal max = vo.getMax();
|
||||
Integer leadingTime = vo.getLeadingTime();
|
||||
Integer lagTime = vo.getLagTime();
|
||||
String item = vo.getItem();
|
||||
ItemType itemType = getByValue(item);
|
||||
|
||||
if (Objects.nonNull(leadingTime)) {
|
||||
long time = currentTime + (leadingTime * 1000);
|
||||
if (tm.getTime() > time) {
|
||||
log.info("时间大于最大差值时间: {} > {}", tm.getTime(), time);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (Objects.nonNull(lagTime)) {
|
||||
long time = currentTime - (lagTime * 1000);
|
||||
if (tm.getTime() < time) {
|
||||
log.info("时间小于最小差值时间: {} < {}", tm.getTime(), time);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (Objects.nonNull(min) || Objects.nonNull(max)) {
|
||||
|
||||
|
||||
if (StringUtils.isBlank(item)) {
|
||||
log.info("规则类型为空");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (Objects.isNull(itemType)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (itemType) {
|
||||
case YU_LIANG: { // 雨量判断 P
|
||||
|
||||
if (StringUtils.isNotBlank(intv) && Objects.nonNull(duration)){
|
||||
IntvType intvType = IntvType.getByValue(intv);
|
||||
|
||||
if (Objects.nonNull(intvType)){
|
||||
if (Objects.equals(intvType.getName(), duration)) {
|
||||
if (!rangeRuleValidate(p, min, max)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
||||
if (!rangeRuleValidate(p, min, max)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SHUI_WEI: { // 水位判断 Z
|
||||
|
||||
if (!rangeRuleValidate(z, min, max)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case LIU_LIANG: { // 流量判断 Q
|
||||
|
||||
if (!rangeRuleValidate(q, min, max)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Objects.isNull(prevDto)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ValidateDto.Data oldData = prevDto.getData();
|
||||
|
||||
BigDecimal oldP = oldData.getP();
|
||||
BigDecimal oldZ = oldData.getZ();
|
||||
BigDecimal oldQ = oldData.getQ();
|
||||
|
||||
if (BigDecimal.ZERO.compareTo(oldP) < 0
|
||||
&& BigDecimal.ZERO.compareTo(oldZ) < 0
|
||||
&& BigDecimal.ZERO.compareTo(oldQ) < 0
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 获取时间
|
||||
Date oldTm = prevDto.getTm();
|
||||
|
||||
BigDecimal diffMax = vo.getDiffMax();
|
||||
|
||||
|
||||
if (Objects.nonNull(duration)) {
|
||||
|
||||
if (Math.abs(tm.getTime() - oldTm.getTime()) > duration * 1000) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (Objects.isNull(itemType)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Objects.isNull(diffMax)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (itemType) {
|
||||
case YU_LIANG: { // 雨量判断 P
|
||||
if (Objects.nonNull(p) && Objects.nonNull(oldP) && Math.abs(p.subtract(oldP).doubleValue()) > diffMax.doubleValue()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SHUI_WEI: { // 水位判断 Z
|
||||
|
||||
if (Objects.nonNull(z) && Objects.nonNull(oldZ) && Math.abs(z.subtract(oldZ).doubleValue()) > diffMax.doubleValue()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case LIU_LIANG: { // 流量判断 Q
|
||||
|
||||
if (Objects.nonNull(q) && Objects.nonNull(oldQ) && Math.abs(q.subtract(oldQ).doubleValue()) > diffMax.doubleValue()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public Boolean validateV1(String json, String prevJson) {
|
||||
|
||||
if (!validate(json)) { // 正常值判断
|
||||
return false;
|
||||
}
|
||||
|
||||
ValidateDto dto = getValidateDto(json); // 差值
|
||||
|
||||
List<ValidateVo> rule = ruleRedis.getRule(dto.getStcd(), validateMapper); // 弃用
|
||||
if (CollectionUtils.isEmpty(rule)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
ValidateDto prevDto = getValidateDto(prevJson); // 老差值
|
||||
|
||||
|
||||
ValidateDto.Data data = dto.getData();
|
||||
|
||||
BigDecimal p = data.getP();
|
||||
BigDecimal z = data.getZ();
|
||||
BigDecimal q = data.getQ();
|
||||
|
||||
if (BigDecimal.ZERO.compareTo(p) < 0
|
||||
&& BigDecimal.ZERO.compareTo(z) < 0
|
||||
&& BigDecimal.ZERO.compareTo(q) < 0
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ValidateDto.Data oldData = prevDto.getData();
|
||||
BigDecimal oldP = oldData.getP();
|
||||
BigDecimal oldZ = oldData.getZ();
|
||||
BigDecimal oldQ = oldData.getQ();
|
||||
|
||||
if (BigDecimal.ZERO.compareTo(oldP) < 0
|
||||
&& BigDecimal.ZERO.compareTo(oldZ) < 0
|
||||
&& BigDecimal.ZERO.compareTo(oldQ) < 0
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// 获取时间
|
||||
Date tm = dto.getTm();
|
||||
Date oldTm = prevDto.getTm();
|
||||
|
||||
for (ValidateVo vo : rule) {
|
||||
|
||||
BigDecimal diffMax = vo.getDiffMax();
|
||||
Integer duration = vo.getDuration();
|
||||
|
||||
if (Objects.nonNull(duration)) {
|
||||
|
||||
if (Math.abs(tm.getTime() - oldTm.getTime()) > duration * 1000) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Objects.nonNull(p) && Objects.nonNull(oldP) && Math.abs(p.subtract(oldP).doubleValue()) > diffMax.doubleValue()) {
|
||||
return false;
|
||||
}
|
||||
if (Objects.nonNull(z) && Objects.nonNull(oldZ) && Math.abs(z.subtract(oldZ).doubleValue()) > diffMax.doubleValue()) {
|
||||
return false;
|
||||
}
|
||||
if (Objects.nonNull(q) && Objects.nonNull(oldQ) && Math.abs(q.subtract(oldQ).doubleValue()) > diffMax.doubleValue()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否需要传入多个值
|
||||
*
|
||||
* @param json
|
||||
* @return true: 需要, false: 不需要
|
||||
*/
|
||||
public Boolean needPrev(String json) {
|
||||
|
||||
ValidateDto dto = getValidateDto(json); // 多个值
|
||||
|
||||
List<ValidateVo> rule = ruleRedis.getRule(dto.getSource(),dto.getCountycode(),dto.getStcd(), validateMapper);
|
||||
|
||||
if (CollectionUtils.isEmpty(rule)) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(
|
||||
|
||||
rule.stream().map(ValidateVo::getDiffMax)
|
||||
|
||||
.filter(Objects::nonNull)
|
||||
|
||||
.collect(Collectors.toList())
|
||||
|
||||
)) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private ValidateDto getValidateDto(String json) {
|
||||
JSONObject jsonObject;
|
||||
try {
|
||||
jsonObject = JSON.parseObject(json);
|
||||
} catch (JSONException e) {
|
||||
throw getException("格式错误: " + json);
|
||||
}
|
||||
|
||||
|
||||
if (Objects.isNull(jsonObject)) {
|
||||
throw getException("空数据");
|
||||
}
|
||||
|
||||
ValidateDto validateDto = JSON.toJavaObject(jsonObject, ValidateDto.class);
|
||||
|
||||
if (Objects.isNull(validateDto.getStcd())) {
|
||||
throw getException("编码不能为空");
|
||||
}
|
||||
|
||||
Date tm = validateDto.getTm();
|
||||
if (Objects.isNull(tm)) {
|
||||
throw getException("时间不能为空");
|
||||
}
|
||||
|
||||
|
||||
ValidateDto.Data data = validateDto.getData();
|
||||
|
||||
if (Objects.isNull(data)) {
|
||||
throw getException("数据不能为空");
|
||||
} else {
|
||||
if (Objects.isNull(data.getP())
|
||||
&& Objects.isNull(data.getQ())
|
||||
&& Objects.isNull(data.getZ())
|
||||
) {
|
||||
throw getException("数据内容不能为空");
|
||||
}
|
||||
}
|
||||
|
||||
return validateDto;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -10,14 +10,14 @@
|
|||
AB_UD_R R
|
||||
LEFT JOIN ADDRESS_BOOK AB ON R.AD_ID = AB.ID
|
||||
WHERE 1=1
|
||||
<if test="obj.dictId != null and obj.dictId != '' ">
|
||||
AND R.DICT_ID = #{obj.dictId}
|
||||
<if test="dto.dictId != null and dto.dictId != '' ">
|
||||
AND R.DICT_ID = #{dto.dictId}
|
||||
</if>
|
||||
<if test="obj.name != null and obj.name != '' ">
|
||||
AND AB.NAME LIKE CONCAT('%', #{obj.name}, '%')
|
||||
<if test="dto.name != null and dto.name != '' ">
|
||||
AND AB.NAME LIKE CONCAT('%', #{dto.name}, '%')
|
||||
</if>
|
||||
<if test="obj.phone != null and obj.phone != '' ">
|
||||
AND AB.PHONE = #{obj.phone}
|
||||
<if test="dto.phone != null and dto.phone != '' ">
|
||||
AND AB.PHONE = #{dto.phone}
|
||||
</if>
|
||||
ORDER BY AB.SORT
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -3,24 +3,24 @@
|
|||
<mapper namespace="com.whdc.mapper.FcMapper">
|
||||
|
||||
|
||||
<select id="page" resultType="com.whdc.model.entity.FcVo">
|
||||
<select id="page" resultType="com.whdc.model.vo.FcVo">
|
||||
SELECT
|
||||
AB.*,F.SORT FSORT
|
||||
FROM
|
||||
FC F
|
||||
LEFT JOIN ADDRESS_BOOK AB ON F.AB_ID = AB.ID
|
||||
WHERE 1=1
|
||||
<if test="obj.userId != null and obj.userId != '' ">
|
||||
AND F.USER_ID = #{obj.userId}
|
||||
<if test="dto.userId != null and dto.userId != '' ">
|
||||
AND F.USER_ID = #{dto.userId}
|
||||
</if>
|
||||
<if test="obj.type != null and obj.userId != '' ">
|
||||
AND F.TYPE = #{obj.type}
|
||||
<if test="dto.type != null and dto.userId != '' ">
|
||||
AND F.TYPE = #{dto.type}
|
||||
</if>
|
||||
<if test="obj.name != null and obj.name != '' ">
|
||||
AND AB.NAME LIKE CONCAT('%', #{obj.name}, '%')
|
||||
<if test="dto.name != null and dto.name != '' ">
|
||||
AND AB.NAME LIKE CONCAT('%', #{dto.name}, '%')
|
||||
</if>
|
||||
<if test="obj.phone != null and obj.phone != '' ">
|
||||
AND AB.PHONE = #{obj.phone}
|
||||
<if test="dto.phone != null and dto.phone != '' ">
|
||||
AND AB.PHONE = #{dto.phone}
|
||||
</if>
|
||||
ORDER BY F.SORT
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@
|
|||
FROM
|
||||
LOGIN_INFO
|
||||
WHERE 1=1
|
||||
<if test="obj.createId != null and obj.createId != '' ">
|
||||
AND CREATE_ID = #{obj.createId}
|
||||
<if test="dto.createId != null and dto.createId != '' ">
|
||||
AND CREATE_ID = #{dto.createId}
|
||||
</if>
|
||||
<if test="obj.type != null and obj.type != '' ">
|
||||
AND TYPE= #{obj.type}
|
||||
<if test="dto.type != null and dto.type != '' ">
|
||||
AND TYPE= #{dto.type}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue