From 5ac56c82c48200f5bfd82917d04279ff502a906f Mon Sep 17 00:00:00 2001 From: tj <1378534974@qq.com> Date: 星期四, 20 三月 2025 15:06:20 +0800 Subject: [PATCH] 高级安全防护 --- src/main/java/com/jsh/erp/service/configSecurity/impl/ConfigSecurityServiceImpl.java | 39 +++++++++++++++++++++++++++++++++++++-- 1 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/jsh/erp/service/configSecurity/impl/ConfigSecurityServiceImpl.java b/src/main/java/com/jsh/erp/service/configSecurity/impl/ConfigSecurityServiceImpl.java index 45d1a62..13b98bb 100644 --- a/src/main/java/com/jsh/erp/service/configSecurity/impl/ConfigSecurityServiceImpl.java +++ b/src/main/java/com/jsh/erp/service/configSecurity/impl/ConfigSecurityServiceImpl.java @@ -2,10 +2,12 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.datasource.entities.ConfigSecurity; import com.jsh.erp.datasource.entities.ConfigSecurityExample; import com.jsh.erp.datasource.mappers.ConfigSecurityMapper; +import com.jsh.erp.datasource.mappers.ConfigSecurityMapperEx; import com.jsh.erp.dto.ConfigSecurityQuery; import com.jsh.erp.exception.JshException; import com.jsh.erp.service.account.AccountService; @@ -16,11 +18,11 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.ObjectUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; -import java.util.Collections; import java.util.List; import java.util.Objects; @@ -31,6 +33,9 @@ @Resource private ConfigSecurityMapper configSecurityMapper; + + @Resource + private ConfigSecurityMapperEx configSecurityMapperEx; @Resource private LogService logService; @@ -53,7 +58,7 @@ @Override public List<ConfigSecurity> findList(ConfigSecurityQuery configSecurityQuery) { // 设置分页参数 - PageHelper.startPage(configSecurityQuery.getCurrentPage()-1, configSecurityQuery.getPageSize()); + ConfigSecurityExample example = new ConfigSecurityExample(); ConfigSecurityExample.Criteria criteria = example.createCriteria(); @@ -67,6 +72,7 @@ example.setOrderByClause(" create_time desc "); + PageHelper.startPage(configSecurityQuery.getCurrentPage(), configSecurityQuery.getPageSize()); return configSecurityMapper.selectByExample(example); } @@ -155,5 +161,34 @@ return result; } + @Override + public PageInfo<ConfigSecurity> findPageInfo(ConfigSecurityQuery configSecurityQuery) { + ConfigSecurityExample example = new ConfigSecurityExample(); + ConfigSecurityExample.Criteria criteria = example.createCriteria(); + criteria.andDeleteFlagEqualTo(false); + if (StringUtils.isNotEmpty(configSecurityQuery.getKeyword())) { + criteria.andKeywordLike("%" + configSecurityQuery.getKeyword() + "%"); + } + if (StringUtils.isNotEmpty(configSecurityQuery.getType())) { + criteria.andTypeEqualTo(configSecurityQuery.getType()); + } + if (!ObjectUtils.isEmpty(configSecurityQuery.getStatus())) { + criteria.andStatusEqualTo(configSecurityQuery.getStatus()); + } + + example.setOrderByClause(" create_time desc "); + + PageHelper.startPage(configSecurityQuery.getCurrentPage(), configSecurityQuery.getPageSize()); + List<ConfigSecurity> list = configSecurityMapper.selectByExample(example); + return new PageInfo<>(list); + + } + + @Override + public List<ConfigSecurity> getEnabledListAll() { + + return configSecurityMapperEx.getEnabledListAll(); + } + } -- Gitblit v1.9.3