|
@@ -14,12 +14,14 @@ import com.xy.utils.R;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.core.env.Environment;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
import static com.xy.utils.Beans.copy;
|
|
@@ -35,6 +37,7 @@ import static com.xy.utils.PlusBeans.toPageBean;
|
|
|
* @author 谭斌
|
|
|
* @since 2024-10-09
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
|
@Api(tags = "字典表")
|
|
@@ -63,8 +66,10 @@ public class SysDictLogServiceImpl extends ServiceImpl<SysDictLogMapper, SysDict
|
|
|
*/
|
|
|
public boolean handleLog(SysDictLog sysDictLog, EnumSysDictOperateType operateType) {
|
|
|
// 判断当前环境是否为测试环境
|
|
|
- String activeProfile = environment.getActiveProfiles()[0];
|
|
|
- if (!activeProfile.equals("uat")) {
|
|
|
+ String[] activeProfiles = environment.getActiveProfiles();
|
|
|
+ log.info("当前环境:{}", activeProfiles);
|
|
|
+ boolean isTestEnvironment = Arrays.asList(activeProfiles).contains("uat");
|
|
|
+ if (!isTestEnvironment) {
|
|
|
return false; // 如果不是测试环境,返回false
|
|
|
}
|
|
|
sysDictLog.setId(null);
|
|
@@ -86,7 +91,8 @@ public class SysDictLogServiceImpl extends ServiceImpl<SysDictLogMapper, SysDict
|
|
|
@ApiOperation("分页查询")
|
|
|
public R<PageBean<SysDictLogDto.Vo>> page(@RequestBody SysDictLogDto.Page page) {
|
|
|
PageBean pageBean = page.getPage();
|
|
|
- LambdaQueryWrapper<SysDictLog> lambdaQueryWrapper = new MybatisPlusQuery().eqWrapper(page, SysDictLog.class).build();
|
|
|
+ LambdaQueryWrapper<SysDictLog> lambdaQueryWrapper = new MybatisPlusQuery().eqWrapper(page, SysDictLog.class).build()
|
|
|
+ .ge(page.getBeginTime() != null, SysDictLog::getCreateTime, page.getBeginTime()).le(page.getEndTime() != null, SysDictLog::getCreateTime, page.getEndTime());
|
|
|
IPage<SysDictLog> iPage = page(toIPage(pageBean), lambdaQueryWrapper);
|
|
|
return R.ok(toPageBean(SysDictLogDto.Vo.class, iPage));
|
|
|
}
|