mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-08 20:49:00 +08:00
🐛 Fixing a bug. #793 租户查询缓存问题
This commit is contained in:
1 parent
cbc584cfb2
commit
1473edae68
2 files changed
+12
-8
No files matched your search
+10
-3
@@ -28,10 +28,13 @@ import com.pig4cloud.pigx.common.security.annotation.Inner;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 租户管理
|
||||
@@ -120,9 +123,13 @@ public class SysTenantController {
|
||||
*/
|
||||
@Inner(value = false)
|
||||
@GetMapping("/list")
|
||||
@Cacheable(value = CacheConstants.TENANT_DETAILS)
|
||||
public R list() {
|
||||
return R.ok(sysTenantService.getNormal());
|
||||
final LocalDate today = LocalDate.now();
|
||||
List<SysTenant> tenants = sysTenantService.getNormal()
|
||||
.stream()
|
||||
.filter(sysTenant -> (sysTenant.getStartTime().isAfter(today) && sysTenant.getEndTime().isBefore(today)))
|
||||
.collect(Collectors.toList());
|
||||
return R.ok(tenants);
|
||||
}
|
||||
|
||||
}
|
||||
+2
-5
@@ -32,13 +32,12 @@ import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.apache.commons.configuration.PropertiesConfiguration;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import springfox.documentation.annotations.Cacheable;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -75,9 +74,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
||||
@Cacheable(value = CacheConstants.TENANT_DETAILS)
|
||||
public List<SysTenant> getNormal() {
|
||||
return list(Wrappers.<SysTenant>lambdaQuery()
|
||||
.eq(SysTenant::getStatus, CommonConstants.STATUS_NORMAL)
|
||||
.le(SysTenant::getStartTime, LocalDate.now())
|
||||
.ge(SysTenant::getEndTime, LocalDate.now()));
|
||||
.eq(SysTenant::getStatus, CommonConstants.STATUS_NORMAL));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user