Browse Source

代码更新

master
管理员 2 years ago
parent
commit
7060ccc1ef
  1. 12
      nladmin-system/nlsso-server/pom.xml
  2. 3
      nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java
  3. 102
      nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/impl/SysParamServiceImpl.java

12
nladmin-system/nlsso-server/pom.xml

@ -27,7 +27,7 @@
<hutool.version>5.7.14</hutool.version> <hutool.version>5.7.14</hutool.version>
<jjwt.version>0.11.1</jjwt.version> <jjwt.version>0.11.1</jjwt.version>
<!-- oshi监控需要指定jna版本, 问题详见 https://github.com/oshi/oshi/issues/1040 --> <!-- oshi监控需要指定jna版本, 问题详见 https://github.com/oshi/oshi/issues/1040 -->
<jna.version>5.9.0</jna.version> <jna.version>5.8.0</jna.version>
<configuration.version>1.9</configuration.version> <configuration.version>1.9</configuration.version>
<netty.version>4.1.59.Final</netty.version> <netty.version>4.1.59.Final</netty.version>
</properties> </properties>
@ -380,6 +380,14 @@
<version>1.9.2</version> <version>1.9.2</version>
</dependency> </dependency>
<!-- 重试机制-->
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
</dependency>
<!--接口限流--> <!--接口限流-->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -472,7 +480,7 @@
<dependency> <dependency>
<groupId>com.github.oshi</groupId> <groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId> <artifactId>oshi-core</artifactId>
<version>5.0.1</version> <version>6.1.4</version>
</dependency> </dependency>
<dependency> <dependency>

3
nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java

@ -11,7 +11,7 @@ import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactor
import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory; import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; import org.springframework.retry.annotation.EnableRetry;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
@EnableMethodCache(basePackages = "org.nl") @EnableMethodCache(basePackages = "org.nl")
@EnableCreateCacheAnnotation @EnableCreateCacheAnnotation
@MapperScan("org.nl.**.mapper") @MapperScan("org.nl.**.mapper")
@EnableRetry //https://juejin.cn/post/7094613787973517343
public class AppRun { public class AppRun {
public static void main(String[] args) { public static void main(String[] args) {

102
nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/impl/SysParamServiceImpl.java

@ -12,7 +12,7 @@ import org.nl.common.aspect.exception.BadRequestException;
import org.nl.common.domain.query.PageQuery; import org.nl.common.domain.query.PageQuery;
import org.nl.common.utils.MapOf; import org.nl.common.utils.MapOf;
import org.nl.common.utils.SecurityUtils; import org.nl.common.utils.SecurityUtils;
import org.nl.system.service.param.ISysParamService; import org.nl.system.service.param.ISysParamService;
import org.nl.system.service.param.dao.Param; import org.nl.system.service.param.dao.Param;
import org.nl.system.service.param.dao.mapper.SysParamMapper; import org.nl.system.service.param.dao.mapper.SysParamMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -22,9 +22,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* <p>
* 系统参数表 服务实现类 * 系统参数表 服务实现类
* </p>
* *
* @author generator * @author generator
* @since 2022-12-14 * @since 2022-12-14
@ -33,59 +31,59 @@ import java.util.Map;
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
@Transactional @Transactional
public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param> implements ISysParamService { public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param>
implements ISysParamService {
private final SysParamMapper paramMapper; private final SysParamMapper paramMapper;
@Override @Override
public Page<Param> queryPage(Map whereJson, PageQuery page) { public Page<Param> queryPage(Map whereJson, PageQuery page) {
log.info("111"); QueryWrapper<Param> queryWrapper = new QueryWrapper<>();
QueryWrapper<Param> queryWrapper = new QueryWrapper<>(); queryWrapper.orderBy(true, true, "create_time");
queryWrapper.orderBy(true, true, "create_time"); Page<Param> paramPage = paramMapper.selectPage(page.build(), queryWrapper);
Page<Param> paramPage = paramMapper.selectPage(page.build(), queryWrapper); return paramPage;
return paramPage; }
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void create(Param param) { public void create(Param param) {
List code = paramMapper.selectByMap(MapOf.of("code", param.getCode())); List code = paramMapper.selectByMap(MapOf.of("code", param.getCode()));
if (ObjectUtil.isNotEmpty(code)) throw new BadRequestException("编码不能一致"); if (ObjectUtil.isNotEmpty(code)) throw new BadRequestException("编码不能一致");
param.setId(IdUtil.getSnowflake(1, 1).nextIdStr()); param.setId(IdUtil.getSnowflake(1, 1).nextIdStr());
String currentUserId = SecurityUtils.getCurrentUserId(); String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName(); String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now(); String now = DateUtil.now();
param.setCreateId(currentUserId); param.setCreateId(currentUserId);
param.setCreateName(nickName); param.setCreateName(nickName);
param.setCreateTime(now); param.setCreateTime(now);
param.setUpdateId(currentUserId); param.setUpdateId(currentUserId);
param.setUpdateName(nickName); param.setUpdateName(nickName);
param.setUpdateTime(now); param.setUpdateTime(now);
paramMapper.insert(param); paramMapper.insert(param);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(Param param) { public void update(Param param) {
Param paramObj = paramMapper.selectById(param.getId()); Param paramObj = paramMapper.selectById(param.getId());
if (ObjectUtil.isEmpty(paramObj)) throw new BadRequestException("被删除或无权限,操作失败!"); if (ObjectUtil.isEmpty(paramObj)) throw new BadRequestException("被删除或无权限,操作失败!");
param.setUpdateId(SecurityUtils.getCurrentUserId()); param.setUpdateId(SecurityUtils.getCurrentUserId());
param.setUpdateName(SecurityUtils.getCurrentNickName()); param.setUpdateName(SecurityUtils.getCurrentNickName());
param.setUpdateTime(DateUtil.now()); param.setUpdateTime(DateUtil.now());
paramMapper.updateById(param); paramMapper.updateById(param);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void deleteByIds(List<String> ids) { public void deleteByIds(List<String> ids) {
paramMapper.deleteBatchIds(ids); paramMapper.deleteBatchIds(ids);
} }
@Override @Override
public Param findByCode(String code) { public Param findByCode(String code) {
QueryWrapper<Param> queryWrapper = new QueryWrapper<>(); QueryWrapper<Param> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("code", code); queryWrapper.eq("code", code);
Param param = paramMapper.selectOne(queryWrapper); Param param = paramMapper.selectOne(queryWrapper);
return param; return param;
} }
} }

Loading…
Cancel
Save