From a6fb88d74c20cc28043d75e8a5097fce49cf9a78 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期五, 15 十月 2021 15:19:42 +0800 Subject: [PATCH] update [重大更新]全业务 增加 接口文档注解 格式化代码 --- ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java | 18 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java | 22 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java | 57 ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java | 58 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java | 10 ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java | 72 ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java | 10 ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java | 59 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java | 80 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java | 3 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java | 188 +- ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java | 49 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java | 12 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java | 378 ++-- ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java | 64 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java | 10 ruoyi-system/src/main/java/com/ruoyi/system/service/SysRegisterService.java | 2 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssServiceImpl.java | 102 ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysOssConfigVo.java | 59 ruoyi-admin/src/main/resources/application.yml | 4 ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserExportVo.java | 116 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java | 2 ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java | 17 ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java | 30 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java | 14 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOssService.java | 6 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java | 12 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java | 84 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java | 36 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/RegisterBody.java | 10 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java | 2 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssConfigServiceImpl.java | 177 ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java | 31 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java | 24 ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java | 59 ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java | 64 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java | 24 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java | 52 ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SysOssConfigBo.java | 52 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java | 28 ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SysOssBo.java | 90 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java | 2 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java | 28 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java | 72 ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserImportVo.java | 86 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java | 45 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java | 16 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java | 2 ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java | 22 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java | 46 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java | 47 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java | 17 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java | 85 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java | 59 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java | 33 ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleDept.java | 10 ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java | 103 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java | 166 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java | 42 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java | 18 ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysOssVo.java | 82 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java | 18 ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java | 41 ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java | 56 ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java | 4 ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java | 31 ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java | 8 ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java | 3 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java | 41 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java | 2 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java | 66 ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java | 48 ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java | 92 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java | 2 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java | 366 +- ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java | 22 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java | 2 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java | 10 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TokenServiceImpl.java | 18 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOssConfigService.java | 63 ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserRole.java | 10 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java | 55 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java | 6 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java | 79 ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserPost.java | 10 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java | 14 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java | 14 ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java | 4 ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java | 44 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/OperLogDTO.java | 5 ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java | 14 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java | 12 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java | 64 ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java | 188 - ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java | 26 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java | 58 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java | 6 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java | 16 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java | 136 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java | 91 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java | 2 ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java | 4 ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java | 10 ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java | 10 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java | 2 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java | 125 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java | 107 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java | 55 ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java | 34 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java | 27 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java | 32 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java | 2 ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java | 60 ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java | 34 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java | 51 115 files changed, 2,600 insertions(+), 2,868 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java index 3a1a4ae..f389ff4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -10,12 +10,12 @@ */ @SpringBootApplication -public class RuoYiApplication -{ - public static void main(String[] args) - { +public class RuoYiApplication { + + public static void main(String[] args) { System.setProperty("spring.devtools.restart.enabled", "false"); SpringApplication.run(RuoYiApplication.class, args); System.out.println("(鈾モ棤鈥库棤)锞夛緸 RuoYi-Vue-Plus鍚姩鎴愬姛 醿�(麓凇`醿�)锞�"); } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java index 6de67dc..dd05626 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java @@ -5,14 +5,14 @@ /** * web瀹瑰櫒涓繘琛岄儴缃� - * + * * @author ruoyi */ -public class RuoYiServletInitializer extends SpringBootServletInitializer -{ +public class RuoYiServletInitializer extends SpringBootServletInitializer { + @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder application) - { + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(RuoYiApplication.class); } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java index b6f8a50..4a2bf30 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java @@ -13,6 +13,9 @@ import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.framework.config.properties.CaptchaProperties; import com.ruoyi.system.service.ISysConfigService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @@ -24,61 +27,61 @@ /** * 楠岃瘉鐮佹搷浣滃鐞� * - * @author ruoyi + * @author Lion Li */ +@Api(value = "楠岃瘉鐮佹搷浣滃鐞�", tags = {"楠岃瘉鐮佺鐞�"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController public class CaptchaController { - @Autowired - private CaptchaProperties captchaProperties; + private final CaptchaProperties captchaProperties; + private final ISysConfigService configService; - @Autowired - private ISysConfigService configService; + /** + * 鐢熸垚楠岃瘉鐮� + */ + @ApiOperation("鐢熸垚楠岃瘉鐮�") + @GetMapping("/captchaImage") + public AjaxResult<Map<String, Object>> getCode() { + Map<String, Object> ajax = new HashMap<>(); + boolean captchaOnOff = configService.selectCaptchaOnOff(); + ajax.put("captchaOnOff", captchaOnOff); + if (!captchaOnOff) { + return AjaxResult.success(ajax); + } + // 淇濆瓨楠岃瘉鐮佷俊鎭� + String uuid = IdUtil.simpleUUID(); + String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; + // 鐢熸垚楠岃瘉鐮� + CaptchaType captchaType = captchaProperties.getType(); + boolean isMath = CaptchaType.MATH == captchaType; + Integer length = isMath ? captchaProperties.getNumberLength() : captchaProperties.getCharLength(); + CodeGenerator codeGenerator = ReflectUtils.newInstance(captchaType.getClazz(), length); + AbstractCaptcha captcha = SpringUtils.getBean(captchaProperties.getCategory().getClazz()); + captcha.setGenerator(codeGenerator); + captcha.createCode(); + String code = isMath ? getCodeResult(captcha.getCode()) : captcha.getCode(); + RedisUtils.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); + ajax.put("uuid", uuid); + ajax.put("img", captcha.getImageBase64()); + return AjaxResult.success(ajax); + } - /** - * 鐢熸垚楠岃瘉鐮� - */ - @GetMapping("/captchaImage") - public AjaxResult getCode() { - Map<String, Object> ajax = new HashMap<>(); - boolean captchaOnOff = configService.selectCaptchaOnOff(); - ajax.put("captchaOnOff", captchaOnOff); - if (!captchaOnOff) { - return AjaxResult.success(ajax); - } - // 淇濆瓨楠岃瘉鐮佷俊鎭� - String uuid = IdUtil.simpleUUID(); - String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; - // 鐢熸垚楠岃瘉鐮� - CaptchaType captchaType = captchaProperties.getType(); - boolean isMath = CaptchaType.MATH == captchaType; - Integer length = isMath ? captchaProperties.getNumberLength() : captchaProperties.getCharLength(); - CodeGenerator codeGenerator = ReflectUtils.newInstance(captchaType.getClazz(), length); - AbstractCaptcha captcha = SpringUtils.getBean(captchaProperties.getCategory().getClazz()); - captcha.setGenerator(codeGenerator); - captcha.createCode(); - String code = isMath ? getCodeResult(captcha.getCode()) : captcha.getCode(); - RedisUtils.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); - ajax.put("uuid", uuid); - ajax.put("img", captcha.getImageBase64()); - return AjaxResult.success(ajax); - } - - private String getCodeResult(String capStr) { - int numberLength = captchaProperties.getNumberLength(); - int a = Convert.toInt(StringUtils.substring(capStr, 0, numberLength).trim()); - char operator = capStr.charAt(numberLength); - int b = Convert.toInt(StringUtils.substring(capStr, numberLength + 1, numberLength + 1 + numberLength).trim()); - switch (operator) { - case '*': - return Convert.toStr(a * b); - case '+': - return Convert.toStr(a + b); - case '-': - return Convert.toStr(a - b); - default: - return StringUtils.EMPTY; - } - } + private String getCodeResult(String capStr) { + int numberLength = captchaProperties.getNumberLength(); + int a = Convert.toInt(StringUtils.substring(capStr, 0, numberLength).trim()); + char operator = capStr.charAt(numberLength); + int b = Convert.toInt(StringUtils.substring(capStr, numberLength + 1, numberLength + 1 + numberLength).trim()); + switch (operator) { + case '*': + return Convert.toStr(a * b); + case '+': + return Convert.toStr(a + b); + case '-': + return Convert.toStr(a - b); + default: + return StringUtils.EMPTY; + } + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java index 66749ef..ef81c99 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java @@ -1,8 +1,12 @@ package com.ruoyi.web.controller.monitor; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.StringUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.connection.RedisServerCommands; import org.springframework.data.redis.core.RedisCallback; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.security.access.prepost.PreAuthorize; @@ -15,35 +19,38 @@ /** * 缂撳瓨鐩戞帶 * - * @author ruoyi + * @author Lion Li */ +@Api(value = "缂撳瓨鐩戞帶", tags = {"缂撳瓨鐩戞帶绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/monitor/cache") -public class CacheController -{ - @Autowired - private RedisTemplate<String, String> redisTemplate; +public class CacheController { + private final RedisTemplate<String, String> redisTemplate; + + @ApiOperation("鑾峰彇缂撳瓨鐩戞帶璇︾粏淇℃伅") @PreAuthorize("@ss.hasPermi('monitor:cache:list')") @GetMapping() - public AjaxResult getInfo() throws Exception - { - Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info()); + public AjaxResult<Map<String, Object>> getInfo() throws Exception { + Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) RedisServerCommands::info); Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats")); - Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize()); + Object dbSize = redisTemplate.execute((RedisCallback<Object>) RedisServerCommands::dbSize); Map<String, Object> result = new HashMap<>(3); result.put("info", info); result.put("dbSize", dbSize); List<Map<String, String>> pieList = new ArrayList<>(); - commandStats.stringPropertyNames().forEach(key -> { - Map<String, String> data = new HashMap<>(2); - String property = commandStats.getProperty(key); - data.put("name", StringUtils.removeStart(key, "cmdstat_")); - data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); - pieList.add(data); - }); + if (commandStats != null) { + commandStats.stringPropertyNames().forEach(key -> { + Map<String, String> data = new HashMap<>(2); + String property = commandStats.getProperty(key); + data.put("name", StringUtils.removeStart(key, "cmdstat_")); + data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); + pieList.add(data); + }); + } result.put("commandStats", pieList); return AjaxResult.success(result); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java index fb0b002..d971ca7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java @@ -8,8 +8,12 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.SysLogininfor; import com.ruoyi.system.service.ISysLogininforService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; @@ -18,44 +22,46 @@ /** * 绯荤粺璁块棶璁板綍 * - * @author ruoyi + * @author Lion Li */ +@Validated +@Api(value = "绯荤粺璁块棶璁板綍", tags = {"绯荤粺璁块棶璁板綍绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/monitor/logininfor") -public class SysLogininforController extends BaseController -{ - @Autowired - private ISysLogininforService logininforService; +public class SysLogininforController extends BaseController { + private final ISysLogininforService logininforService; + + @ApiOperation("鏌ヨ绯荤粺璁块棶璁板綍鍒楄〃") @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") @GetMapping("/list") - public TableDataInfo list(SysLogininfor logininfor) - { + public TableDataInfo<SysLogininfor> list(SysLogininfor logininfor) { return logininforService.selectPageLogininforList(logininfor); } + @ApiOperation("瀵煎嚭绯荤粺璁块棶璁板綍鍒楄〃") @Log(title = "鐧诲綍鏃ュ織", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") @GetMapping("/export") - public void export(SysLogininfor logininfor, HttpServletResponse response) - { + public void export(SysLogininfor logininfor, HttpServletResponse response) { List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); - ExcelUtil.exportExcel(list, "鐧诲綍鏃ュ織", SysLogininfor.class, response); + ExcelUtil.exportExcel(list, "鐧诲綍鏃ュ織", SysLogininfor.class, response); } + @ApiOperation("鍒犻櫎绯荤粺璁块棶璁板綍") @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @Log(title = "鐧诲綍鏃ュ織", businessType = BusinessType.DELETE) @DeleteMapping("/{infoIds}") - public AjaxResult remove(@PathVariable Long[] infoIds) - { + public AjaxResult<Void> remove(@PathVariable Long[] infoIds) { return toAjax(logininforService.deleteLogininforByIds(infoIds)); } + @ApiOperation("娓呯┖绯荤粺璁块棶璁板綍") @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @Log(title = "鐧诲綍鏃ュ織", businessType = BusinessType.CLEAN) @DeleteMapping("/clean") - public AjaxResult clean() - { + public AjaxResult<Void> clean() { logininforService.cleanLogininfor(); return AjaxResult.success(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java index 02a926d..f0f090b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java @@ -8,8 +8,12 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.SysOperLog; import com.ruoyi.system.service.ISysOperLogService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; @@ -18,44 +22,46 @@ /** * 鎿嶄綔鏃ュ織璁板綍 * - * @author ruoyi + * @author Lion Li */ +@Validated +@Api(value = "鎿嶄綔鏃ュ織璁板綍", tags = {"鎿嶄綔鏃ュ織璁板綍绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/monitor/operlog") -public class SysOperlogController extends BaseController -{ - @Autowired - private ISysOperLogService operLogService; +public class SysOperlogController extends BaseController { + private final ISysOperLogService operLogService; + + @ApiOperation("鏌ヨ鎿嶄綔鏃ュ織璁板綍鍒楄〃") @PreAuthorize("@ss.hasPermi('monitor:operlog:list')") @GetMapping("/list") - public TableDataInfo list(SysOperLog operLog) - { + public TableDataInfo<SysOperLog> list(SysOperLog operLog) { return operLogService.selectPageOperLogList(operLog); } + @ApiOperation("瀵煎嚭鎿嶄綔鏃ュ織璁板綍鍒楄〃") @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('monitor:operlog:export')") @GetMapping("/export") - public void export(SysOperLog operLog, HttpServletResponse response) - { + public void export(SysOperLog operLog, HttpServletResponse response) { List<SysOperLog> list = operLogService.selectOperLogList(operLog); - ExcelUtil.exportExcel(list, "鎿嶄綔鏃ュ織", SysOperLog.class, response); + ExcelUtil.exportExcel(list, "鎿嶄綔鏃ュ織", SysOperLog.class, response); } + @ApiOperation("鍒犻櫎鎿嶄綔鏃ュ織璁板綍") @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.DELETE) @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") @DeleteMapping("/{operIds}") - public AjaxResult remove(@PathVariable Long[] operIds) - { + public AjaxResult<Void> remove(@PathVariable Long[] operIds) { return toAjax(operLogService.deleteOperLogByIds(operIds)); } + @ApiOperation("娓呯┖鎿嶄綔鏃ュ織璁板綍") @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.CLEAN) @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") @DeleteMapping("/clean") - public AjaxResult clean() - { + public AjaxResult<Void> clean() { operLogService.cleanOperLog(); return AjaxResult.success(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java index 9c83609..728bfd0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java @@ -12,6 +12,9 @@ import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysUserOnline; import com.ruoyi.system.service.ISysUserOnlineService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -24,47 +27,37 @@ /** * 鍦ㄧ嚎鐢ㄦ埛鐩戞帶 * - * @author ruoyi + * @author Lion Li */ +@Api(value = "鍦ㄧ嚎鐢ㄦ埛鐩戞帶", tags = {"鍦ㄧ嚎鐢ㄦ埛鐩戞帶绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/monitor/online") -public class SysUserOnlineController extends BaseController -{ - @Autowired - private ISysUserOnlineService userOnlineService; +public class SysUserOnlineController extends BaseController { + private final ISysUserOnlineService userOnlineService; + + @ApiOperation("鍦ㄧ嚎鐢ㄦ埛鍒楄〃") @PreAuthorize("@ss.hasPermi('monitor:online:list')") @GetMapping("/list") - public TableDataInfo list(String ipaddr, String userName) - { + public TableDataInfo<SysUserOnline> list(String ipaddr, String userName) { Collection<String> keys = RedisUtils.keys(Constants.LOGIN_TOKEN_KEY + "*"); List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>(); - for (String key : keys) - { + for (String key : keys) { LoginUser user = RedisUtils.getCacheObject(key); - if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) - { - if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername())) - { + if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) { + if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername())) { userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user)); } - } - else if (StringUtils.isNotEmpty(ipaddr)) - { - if (StringUtils.equals(ipaddr, user.getIpaddr())) - { + } else if (StringUtils.isNotEmpty(ipaddr)) { + if (StringUtils.equals(ipaddr, user.getIpaddr())) { userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user)); } - } - else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) - { - if (StringUtils.equals(userName, user.getUsername())) - { + } else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) { + if (StringUtils.equals(userName, user.getUsername())) { userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user)); } - } - else - { + } else { userOnlineList.add(userOnlineService.loginUserToUserOnline(user)); } } @@ -76,11 +69,11 @@ /** * 寮洪��鐢ㄦ埛 */ + @ApiOperation("寮洪��鐢ㄦ埛") @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')") @Log(title = "鍦ㄧ嚎鐢ㄦ埛", businessType = BusinessType.FORCE) @DeleteMapping("/{tokenId}") - public AjaxResult forceLogout(@PathVariable String tokenId) - { + public AjaxResult<Void> forceLogout(@PathVariable String tokenId) { RedisUtils.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId); return AjaxResult.success(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java index 13fdc67..42bba01 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java @@ -10,6 +10,9 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.SysConfig; import com.ruoyi.system.service.ISysConfigService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -21,64 +24,65 @@ /** * 鍙傛暟閰嶇疆 淇℃伅鎿嶄綔澶勭悊 * - * @author ruoyi + * @author Lion Li */ +@Validated +@Api(value = "鍙傛暟閰嶇疆鎺у埗鍣�", tags = {"鍙傛暟閰嶇疆绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/config") -public class SysConfigController extends BaseController -{ - @Autowired - private ISysConfigService configService; +public class SysConfigController extends BaseController { + + private final ISysConfigService configService; /** * 鑾峰彇鍙傛暟閰嶇疆鍒楄〃 */ + @ApiOperation("鑾峰彇鍙傛暟閰嶇疆鍒楄〃") @PreAuthorize("@ss.hasPermi('system:config:list')") @GetMapping("/list") - public TableDataInfo list(SysConfig config) - { + public TableDataInfo<SysConfig> list(SysConfig config) { return configService.selectPageConfigList(config); } + @ApiOperation("瀵煎嚭鍙傛暟閰嶇疆鍒楄〃") @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:config:export')") @GetMapping("/export") - public void export(SysConfig config, HttpServletResponse response) - { + public void export(SysConfig config, HttpServletResponse response) { List<SysConfig> list = configService.selectConfigList(config); - ExcelUtil.exportExcel(list, "鍙傛暟鏁版嵁", SysConfig.class, response); + ExcelUtil.exportExcel(list, "鍙傛暟鏁版嵁", SysConfig.class, response); } /** * 鏍规嵁鍙傛暟缂栧彿鑾峰彇璇︾粏淇℃伅 */ + @ApiOperation("鏍规嵁鍙傛暟缂栧彿鑾峰彇璇︾粏淇℃伅") @PreAuthorize("@ss.hasPermi('system:config:query')") @GetMapping(value = "/{configId}") - public AjaxResult getInfo(@PathVariable Long configId) - { + public AjaxResult<SysConfig> getInfo(@PathVariable Long configId) { return AjaxResult.success(configService.selectConfigById(configId)); } /** * 鏍规嵁鍙傛暟閿悕鏌ヨ鍙傛暟鍊� */ + @ApiOperation("鏍规嵁鍙傛暟閿悕鏌ヨ鍙傛暟鍊�") @GetMapping(value = "/configKey/{configKey}") - public AjaxResult getConfigKey(@PathVariable String configKey) - { + public AjaxResult<Void> getConfigKey(@PathVariable String configKey) { return AjaxResult.success(configService.selectConfigByKey(configKey)); } /** * 鏂板鍙傛暟閰嶇疆 */ + @ApiOperation("鏂板鍙傛暟閰嶇疆") @PreAuthorize("@ss.hasPermi('system:config:add')") @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.INSERT) @PostMapping @RepeatSubmit - public AjaxResult add(@Validated @RequestBody SysConfig config) - { - if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) - { + public AjaxResult<Void> add(@Validated @RequestBody SysConfig config) { + if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) { return AjaxResult.error("鏂板鍙傛暟'" + config.getConfigName() + "'澶辫触锛屽弬鏁伴敭鍚嶅凡瀛樺湪"); } config.setCreateBy(getUsername()); @@ -88,13 +92,12 @@ /** * 淇敼鍙傛暟閰嶇疆 */ + @ApiOperation("淇敼鍙傛暟閰嶇疆") @PreAuthorize("@ss.hasPermi('system:config:edit')") @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysConfig config) - { - if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) - { + public AjaxResult<Void> edit(@Validated @RequestBody SysConfig config) { + if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) { return AjaxResult.error("淇敼鍙傛暟'" + config.getConfigName() + "'澶辫触锛屽弬鏁伴敭鍚嶅凡瀛樺湪"); } config.setUpdateBy(getUsername()); @@ -104,11 +107,11 @@ /** * 鍒犻櫎鍙傛暟閰嶇疆 */ + @ApiOperation("鍒犻櫎鍙傛暟閰嶇疆") @PreAuthorize("@ss.hasPermi('system:config:remove')") @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{configIds}") - public AjaxResult remove(@PathVariable Long[] configIds) - { + public AjaxResult<Void> remove(@PathVariable Long[] configIds) { configService.deleteConfigByIds(configIds); return success(); } @@ -116,11 +119,11 @@ /** * 鍒锋柊鍙傛暟缂撳瓨 */ + @ApiOperation("鍒锋柊鍙傛暟缂撳瓨") @PreAuthorize("@ss.hasPermi('system:config:remove')") @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.CLEAN) @DeleteMapping("/refreshCache") - public AjaxResult refreshCache() - { + public AjaxResult<Void> refreshCache() { configService.resetConfigCache(); return AjaxResult.success(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java index fc26e97..9616004 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -5,39 +5,44 @@ import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.service.ISysDeptService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; /** * 閮ㄩ棬淇℃伅 * - * @author ruoyi + * @author Lion Li */ +@Validated +@Api(value = "閮ㄩ棬鎺у埗鍣�", tags = {"閮ㄩ棬绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/dept") -public class SysDeptController extends BaseController -{ - @Autowired - private ISysDeptService deptService; +public class SysDeptController extends BaseController { + + private final ISysDeptService deptService; /** * 鑾峰彇閮ㄩ棬鍒楄〃 */ + @ApiOperation("鑾峰彇閮ㄩ棬鍒楄〃") @PreAuthorize("@ss.hasPermi('system:dept:list')") @GetMapping("/list") - public AjaxResult list(SysDept dept) - { + public AjaxResult<List<SysDept>> list(SysDept dept) { List<SysDept> depts = deptService.selectDeptList(dept); return AjaxResult.success(depts); } @@ -45,31 +50,23 @@ /** * 鏌ヨ閮ㄩ棬鍒楄〃锛堟帓闄よ妭鐐癸級 */ + @ApiOperation("鏌ヨ閮ㄩ棬鍒楄〃锛堟帓闄よ妭鐐癸級") @PreAuthorize("@ss.hasPermi('system:dept:list')") @GetMapping("/list/exclude/{deptId}") - public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) - { + public AjaxResult<List<SysDept>> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) { List<SysDept> depts = deptService.selectDeptList(new SysDept()); - Iterator<SysDept> it = depts.iterator(); - while (it.hasNext()) - { - SysDept d = (SysDept) it.next(); - if (d.getDeptId().intValue() == deptId - || ArrayUtil.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")) - { - it.remove(); - } - } + depts.removeIf(d -> d.getDeptId().equals(deptId) + || ArrayUtil.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); return AjaxResult.success(depts); } /** * 鏍规嵁閮ㄩ棬缂栧彿鑾峰彇璇︾粏淇℃伅 */ + @ApiOperation("鏍规嵁閮ㄩ棬缂栧彿鑾峰彇璇︾粏淇℃伅") @PreAuthorize("@ss.hasPermi('system:dept:query')") @GetMapping(value = "/{deptId}") - public AjaxResult getInfo(@PathVariable Long deptId) - { + public AjaxResult<SysDept> getInfo(@PathVariable Long deptId) { deptService.checkDeptDataScope(deptId); return AjaxResult.success(deptService.selectDeptById(deptId)); } @@ -77,9 +74,9 @@ /** * 鑾峰彇閮ㄩ棬涓嬫媺鏍戝垪琛� */ + @ApiOperation("鑾峰彇閮ㄩ棬涓嬫媺鏍戝垪琛�") @GetMapping("/treeselect") - public AjaxResult treeselect(SysDept dept) - { + public AjaxResult<List<TreeSelect>> treeselect(SysDept dept) { List<SysDept> depts = deptService.selectDeptList(dept); return AjaxResult.success(deptService.buildDeptTreeSelect(depts)); } @@ -87,11 +84,11 @@ /** * 鍔犺浇瀵瑰簲瑙掕壊閮ㄩ棬鍒楄〃鏍� */ + @ApiOperation("鍔犺浇瀵瑰簲瑙掕壊閮ㄩ棬鍒楄〃鏍�") @GetMapping(value = "/roleDeptTreeselect/{roleId}") - public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId) - { + public AjaxResult<Map<String, Object>> roleDeptTreeselect(@PathVariable("roleId") Long roleId) { List<SysDept> depts = deptService.selectDeptList(new SysDept()); - Map<String,Object> ajax = new HashMap<>(); + Map<String, Object> ajax = new HashMap<>(); ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); ajax.put("depts", deptService.buildDeptTreeSelect(depts)); return AjaxResult.success(ajax); @@ -100,13 +97,12 @@ /** * 鏂板閮ㄩ棬 */ + @ApiOperation("鏂板閮ㄩ棬") @PreAuthorize("@ss.hasPermi('system:dept:add')") @Log(title = "閮ㄩ棬绠$悊", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysDept dept) - { - if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) - { + public AjaxResult<Void> add(@Validated @RequestBody SysDept dept) { + if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) { return AjaxResult.error("鏂板閮ㄩ棬'" + dept.getDeptName() + "'澶辫触锛岄儴闂ㄥ悕绉板凡瀛樺湪"); } dept.setCreateBy(getUsername()); @@ -116,22 +112,17 @@ /** * 淇敼閮ㄩ棬 */ + @ApiOperation("淇敼閮ㄩ棬") @PreAuthorize("@ss.hasPermi('system:dept:edit')") @Log(title = "閮ㄩ棬绠$悊", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysDept dept) - { - if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) - { + public AjaxResult<Void> edit(@Validated @RequestBody SysDept dept) { + if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) { return AjaxResult.error("淇敼閮ㄩ棬'" + dept.getDeptName() + "'澶辫触锛岄儴闂ㄥ悕绉板凡瀛樺湪"); - } - else if (dept.getParentId().equals(dept.getDeptId())) - { + } else if (dept.getParentId().equals(dept.getDeptId())) { return AjaxResult.error("淇敼閮ㄩ棬'" + dept.getDeptName() + "'澶辫触锛屼笂绾ч儴闂ㄤ笉鑳芥槸鑷繁"); - } - else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) - && deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0) - { + } else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) + && deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0) { return AjaxResult.error("璇ラ儴闂ㄥ寘鍚湭鍋滅敤鐨勫瓙閮ㄩ棬锛�"); } dept.setUpdateBy(getUsername()); @@ -141,17 +132,15 @@ /** * 鍒犻櫎閮ㄩ棬 */ + @ApiOperation("鍒犻櫎閮ㄩ棬") @PreAuthorize("@ss.hasPermi('system:dept:remove')") @Log(title = "閮ㄩ棬绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{deptId}") - public AjaxResult remove(@PathVariable Long deptId) - { - if (deptService.hasChildByDeptId(deptId)) - { + public AjaxResult<Void> remove(@PathVariable Long deptId) { + if (deptService.hasChildByDeptId(deptId)) { return AjaxResult.error("瀛樺湪涓嬬骇閮ㄩ棬,涓嶅厑璁稿垹闄�"); } - if (deptService.checkDeptExistUser(deptId)) - { + if (deptService.checkDeptExistUser(deptId)) { return AjaxResult.error("閮ㄩ棬瀛樺湪鐢ㄦ埛,涓嶅厑璁稿垹闄�"); } return toAjax(deptService.deleteDeptById(deptId)); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java index 6462a0c..fca1a20 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java @@ -10,6 +10,9 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.service.ISysDictDataService; import com.ruoyi.system.service.ISysDictTypeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -22,54 +25,53 @@ /** * 鏁版嵁瀛楀吀淇℃伅 * - * @author ruoyi + * @author Lion Li */ +@Validated +@Api(value = "鏁版嵁瀛楀吀淇℃伅鎺у埗鍣�", tags = {"鏁版嵁瀛楀吀淇℃伅绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/dict/data") -public class SysDictDataController extends BaseController -{ - @Autowired - private ISysDictDataService dictDataService; +public class SysDictDataController extends BaseController { - @Autowired - private ISysDictTypeService dictTypeService; + private final ISysDictDataService dictDataService; + private final ISysDictTypeService dictTypeService; + @ApiOperation("鏌ヨ瀛楀吀鏁版嵁鍒楄〃") @PreAuthorize("@ss.hasPermi('system:dict:list')") @GetMapping("/list") - public TableDataInfo list(SysDictData dictData) - { + public TableDataInfo<SysDictData> list(SysDictData dictData) { return dictDataService.selectPageDictDataList(dictData); } + @ApiOperation("瀵煎嚭瀛楀吀鏁版嵁鍒楄〃") @Log(title = "瀛楀吀鏁版嵁", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:dict:export')") @GetMapping("/export") - public void export(SysDictData dictData, HttpServletResponse response) - { + public void export(SysDictData dictData, HttpServletResponse response) { List<SysDictData> list = dictDataService.selectDictDataList(dictData); - ExcelUtil.exportExcel(list, "瀛楀吀鏁版嵁", SysDictData.class, response); + ExcelUtil.exportExcel(list, "瀛楀吀鏁版嵁", SysDictData.class, response); } /** * 鏌ヨ瀛楀吀鏁版嵁璇︾粏 */ + @ApiOperation("鏌ヨ瀛楀吀鏁版嵁璇︾粏") @PreAuthorize("@ss.hasPermi('system:dict:query')") @GetMapping(value = "/{dictCode}") - public AjaxResult getInfo(@PathVariable Long dictCode) - { + public AjaxResult<SysDictData> getInfo(@PathVariable Long dictCode) { return AjaxResult.success(dictDataService.selectDictDataById(dictCode)); } /** * 鏍规嵁瀛楀吀绫诲瀷鏌ヨ瀛楀吀鏁版嵁淇℃伅 */ + @ApiOperation("鏍规嵁瀛楀吀绫诲瀷鏌ヨ瀛楀吀鏁版嵁淇℃伅") @GetMapping(value = "/type/{dictType}") - public AjaxResult dictType(@PathVariable String dictType) - { + public AjaxResult<List<SysDictData>> dictType(@PathVariable String dictType) { List<SysDictData> data = dictTypeService.selectDictDataByType(dictType); - if (StringUtils.isNull(data)) - { - data = new ArrayList<SysDictData>(); + if (StringUtils.isNull(data)) { + data = new ArrayList<>(); } return AjaxResult.success(data); } @@ -77,11 +79,11 @@ /** * 鏂板瀛楀吀绫诲瀷 */ + @ApiOperation("鏂板瀛楀吀绫诲瀷") @PreAuthorize("@ss.hasPermi('system:dict:add')") @Log(title = "瀛楀吀鏁版嵁", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysDictData dict) - { + public AjaxResult<Void> add(@Validated @RequestBody SysDictData dict) { dict.setCreateBy(getUsername()); return toAjax(dictDataService.insertDictData(dict)); } @@ -89,11 +91,11 @@ /** * 淇敼淇濆瓨瀛楀吀绫诲瀷 */ + @ApiOperation("淇敼淇濆瓨瀛楀吀绫诲瀷") @PreAuthorize("@ss.hasPermi('system:dict:edit')") @Log(title = "瀛楀吀鏁版嵁", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysDictData dict) - { + public AjaxResult<Void> edit(@Validated @RequestBody SysDictData dict) { dict.setUpdateBy(getUsername()); return toAjax(dictDataService.updateDictData(dict)); } @@ -101,11 +103,11 @@ /** * 鍒犻櫎瀛楀吀绫诲瀷 */ + @ApiOperation("鍒犻櫎瀛楀吀绫诲瀷") @PreAuthorize("@ss.hasPermi('system:dict:remove')") @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.DELETE) @DeleteMapping("/{dictCodes}") - public AjaxResult remove(@PathVariable Long[] dictCodes) - { + public AjaxResult<Void> remove(@PathVariable Long[] dictCodes) { dictDataService.deleteDictDataByIds(dictCodes); return success(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java index eb5c0b5..1e21a41 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java @@ -9,6 +9,9 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.service.ISysDictTypeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -20,51 +23,52 @@ /** * 鏁版嵁瀛楀吀淇℃伅 * - * @author ruoyi + * @author Lion Li */ +@Validated +@Api(value = "鏁版嵁瀛楀吀淇℃伅鎺у埗鍣�", tags = {"鏁版嵁瀛楀吀淇℃伅绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/dict/type") -public class SysDictTypeController extends BaseController -{ - @Autowired - private ISysDictTypeService dictTypeService; +public class SysDictTypeController extends BaseController { + private final ISysDictTypeService dictTypeService; + + @ApiOperation("鏌ヨ瀛楀吀绫诲瀷鍒楄〃") @PreAuthorize("@ss.hasPermi('system:dict:list')") @GetMapping("/list") - public TableDataInfo list(SysDictType dictType) - { + public TableDataInfo<SysDictType> list(SysDictType dictType) { return dictTypeService.selectPageDictTypeList(dictType); } + @ApiOperation("瀵煎嚭瀛楀吀绫诲瀷鍒楄〃") @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:dict:export')") @GetMapping("/export") - public void export(SysDictType dictType, HttpServletResponse response) - { + public void export(SysDictType dictType, HttpServletResponse response) { List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); - ExcelUtil.exportExcel(list, "瀛楀吀绫诲瀷", SysDictType.class, response); + ExcelUtil.exportExcel(list, "瀛楀吀绫诲瀷", SysDictType.class, response); } /** * 鏌ヨ瀛楀吀绫诲瀷璇︾粏 */ + @ApiOperation("鏌ヨ瀛楀吀绫诲瀷璇︾粏") @PreAuthorize("@ss.hasPermi('system:dict:query')") @GetMapping(value = "/{dictId}") - public AjaxResult getInfo(@PathVariable Long dictId) - { + public AjaxResult<SysDictType> getInfo(@PathVariable Long dictId) { return AjaxResult.success(dictTypeService.selectDictTypeById(dictId)); } /** * 鏂板瀛楀吀绫诲瀷 */ + @ApiOperation("鏂板瀛楀吀绫诲瀷") @PreAuthorize("@ss.hasPermi('system:dict:add')") @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysDictType dict) - { - if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) - { + public AjaxResult<Void> add(@Validated @RequestBody SysDictType dict) { + if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { return AjaxResult.error("鏂板瀛楀吀'" + dict.getDictName() + "'澶辫触锛屽瓧鍏哥被鍨嬪凡瀛樺湪"); } dict.setCreateBy(getUsername()); @@ -74,13 +78,12 @@ /** * 淇敼瀛楀吀绫诲瀷 */ + @ApiOperation("淇敼瀛楀吀绫诲瀷") @PreAuthorize("@ss.hasPermi('system:dict:edit')") @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysDictType dict) - { - if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) - { + public AjaxResult<Void> edit(@Validated @RequestBody SysDictType dict) { + if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { return AjaxResult.error("淇敼瀛楀吀'" + dict.getDictName() + "'澶辫触锛屽瓧鍏哥被鍨嬪凡瀛樺湪"); } dict.setUpdateBy(getUsername()); @@ -90,11 +93,11 @@ /** * 鍒犻櫎瀛楀吀绫诲瀷 */ + @ApiOperation("鍒犻櫎瀛楀吀绫诲瀷") @PreAuthorize("@ss.hasPermi('system:dict:remove')") @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.DELETE) @DeleteMapping("/{dictIds}") - public AjaxResult remove(@PathVariable Long[] dictIds) - { + public AjaxResult<Void> remove(@PathVariable Long[] dictIds) { dictTypeService.deleteDictTypeByIds(dictIds); return success(); } @@ -102,11 +105,11 @@ /** * 鍒锋柊瀛楀吀缂撳瓨 */ + @ApiOperation("鍒锋柊瀛楀吀缂撳瓨") @PreAuthorize("@ss.hasPermi('system:dict:remove')") @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.CLEAN) @DeleteMapping("/refreshCache") - public AjaxResult refreshCache() - { + public AjaxResult<Void> refreshCache() { dictTypeService.resetDictCache(); return AjaxResult.success(); } @@ -114,9 +117,9 @@ /** * 鑾峰彇瀛楀吀閫夋嫨妗嗗垪琛� */ + @ApiOperation("鑾峰彇瀛楀吀閫夋嫨妗嗗垪琛�") @GetMapping("/optionselect") - public AjaxResult optionselect() - { + public AjaxResult<List<SysDictType>> optionselect() { List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll(); return AjaxResult.success(dictTypes); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java index bfb532e..5413336 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java @@ -1,29 +1,35 @@ package com.ruoyi.web.controller.system; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.utils.StringUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; /** * 棣栭〉 * - * @author ruoyi + * @author Lion Li */ +@Api(value = "棣栭〉鎺у埗鍣�", tags = {"棣栭〉绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController -public class SysIndexController -{ - /** 绯荤粺鍩虹閰嶇疆 */ - @Autowired - private RuoYiConfig ruoyiConfig; +public class SysIndexController { + + /** + * 绯荤粺鍩虹閰嶇疆 + */ + private final RuoYiConfig ruoyiConfig; /** * 璁块棶棣栭〉锛屾彁绀鸿 */ - @RequestMapping("/") - public String index() - { + @ApiOperation("璁块棶棣栭〉锛屾彁绀鸿") + @GetMapping("/") + public String index() { return StringUtils.format("娆㈣繋浣跨敤{}鍚庡彴绠$悊妗嗘灦锛屽綋鍓嶇増鏈細v{}锛岃閫氳繃鍓嶇鍦板潃璁块棶銆�", ruoyiConfig.getName(), ruoyiConfig.getVersion()); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index 287d4c5..c231acb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -6,10 +6,15 @@ import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginBody; import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.system.domain.vo.RouterVo; +import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.system.service.SysLoginService; import com.ruoyi.system.service.SysPermissionService; -import com.ruoyi.system.service.ISysMenuService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -23,19 +28,17 @@ /** * 鐧诲綍楠岃瘉 * - * @author ruoyi + * @author Lion Li */ +@Validated +@Api(value = "鏁版嵁瀛楀吀淇℃伅鎺у埗鍣�", tags = {"鏁版嵁瀛楀吀淇℃伅绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController -public class SysLoginController -{ - @Autowired - private SysLoginService loginService; +public class SysLoginController { - @Autowired - private ISysMenuService menuService; - - @Autowired - private SysPermissionService permissionService; + private final SysLoginService loginService; + private final ISysMenuService menuService; + private final SysPermissionService permissionService; /** * 鐧诲綍鏂规硶 @@ -43,10 +46,10 @@ * @param loginBody 鐧诲綍淇℃伅 * @return 缁撴灉 */ + @ApiOperation("鐧诲綍鏂规硶") @PostMapping("/login") - public AjaxResult login(@RequestBody LoginBody loginBody) - { - Map<String,Object> ajax = new HashMap<>(); + public AjaxResult<Map<String, Object>> login(@RequestBody LoginBody loginBody) { + Map<String, Object> ajax = new HashMap<>(); // 鐢熸垚浠ょ墝 String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), loginBody.getUuid()); @@ -59,15 +62,15 @@ * * @return 鐢ㄦ埛淇℃伅 */ + @ApiOperation("鑾峰彇鐢ㄦ埛淇℃伅") @GetMapping("getInfo") - public AjaxResult getInfo() - { + public AjaxResult<Map<String, Object>> getInfo() { SysUser user = SecurityUtils.getLoginUser().getUser(); // 瑙掕壊闆嗗悎 Set<String> roles = permissionService.getRolePermission(user); // 鏉冮檺闆嗗悎 Set<String> permissions = permissionService.getMenuPermission(user); - Map<String,Object> ajax = new HashMap<>(); + Map<String, Object> ajax = new HashMap<>(); ajax.put("user", user); ajax.put("roles", roles); ajax.put("permissions", permissions); @@ -79,9 +82,9 @@ * * @return 璺敱淇℃伅 */ + @ApiOperation("鑾峰彇璺敱淇℃伅") @GetMapping("getRouters") - public AjaxResult getRouters() - { + public AjaxResult<List<RouterVo>> getRouters() { Long userId = SecurityUtils.getUserId(); List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId); return AjaxResult.success(menuService.buildMenus(menus)); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java index d679bfb..b0537f2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java @@ -4,10 +4,14 @@ import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.service.ISysMenuService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -20,22 +24,24 @@ /** * 鑿滃崟淇℃伅 * - * @author ruoyi + * @author Lion Li */ +@Validated +@Api(value = "鑿滃崟淇℃伅鎺у埗鍣�", tags = {"鑿滃崟淇℃伅绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/menu") -public class SysMenuController extends BaseController -{ - @Autowired - private ISysMenuService menuService; +public class SysMenuController extends BaseController { + + private final ISysMenuService menuService; /** * 鑾峰彇鑿滃崟鍒楄〃 */ + @ApiOperation("鑾峰彇鑿滃崟鍒楄〃") @PreAuthorize("@ss.hasPermi('system:menu:list')") @GetMapping("/list") - public AjaxResult list(SysMenu menu) - { + public AjaxResult<List<SysMenu>> list(SysMenu menu) { List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); return AjaxResult.success(menus); } @@ -43,19 +49,19 @@ /** * 鏍规嵁鑿滃崟缂栧彿鑾峰彇璇︾粏淇℃伅 */ + @ApiOperation("鏍规嵁鑿滃崟缂栧彿鑾峰彇璇︾粏淇℃伅") @PreAuthorize("@ss.hasPermi('system:menu:query')") @GetMapping(value = "/{menuId}") - public AjaxResult getInfo(@PathVariable Long menuId) - { + public AjaxResult<SysMenu> getInfo(@PathVariable Long menuId) { return AjaxResult.success(menuService.selectMenuById(menuId)); } /** * 鑾峰彇鑿滃崟涓嬫媺鏍戝垪琛� */ + @ApiOperation("鑾峰彇鑿滃崟涓嬫媺鏍戝垪琛�") @GetMapping("/treeselect") - public AjaxResult treeselect(SysMenu menu) - { + public AjaxResult<List<TreeSelect>> treeselect(SysMenu menu) { List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); return AjaxResult.success(menuService.buildMenuTreeSelect(menus)); } @@ -63,11 +69,11 @@ /** * 鍔犺浇瀵瑰簲瑙掕壊鑿滃崟鍒楄〃鏍� */ + @ApiOperation("鍔犺浇瀵瑰簲瑙掕壊鑿滃崟鍒楄〃鏍�") @GetMapping(value = "/roleMenuTreeselect/{roleId}") - public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) - { - List<SysMenu> menus = menuService.selectMenuList(getUserId()); - Map<String,Object> ajax = new HashMap<>(); + public AjaxResult<Map<String, Object>> roleMenuTreeselect(@PathVariable("roleId") Long roleId) { + List<SysMenu> menus = menuService.selectMenuList(getUserId()); + Map<String, Object> ajax = new HashMap<>(); ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); ajax.put("menus", menuService.buildMenuTreeSelect(menus)); return AjaxResult.success(ajax); @@ -76,17 +82,14 @@ /** * 鏂板鑿滃崟 */ + @ApiOperation("鏂板鑿滃崟") @PreAuthorize("@ss.hasPermi('system:menu:add')") @Log(title = "鑿滃崟绠$悊", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysMenu menu) - { - if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) - { + public AjaxResult<Void> add(@Validated @RequestBody SysMenu menu) { + if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) { return AjaxResult.error("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪"); - } - else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) - { + } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { return AjaxResult.error("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧�蹇呴』浠ttp(s)://寮�澶�"); } menu.setCreateBy(getUsername()); @@ -96,21 +99,16 @@ /** * 淇敼鑿滃崟 */ + @ApiOperation("淇敼鑿滃崟") @PreAuthorize("@ss.hasPermi('system:menu:edit')") @Log(title = "鑿滃崟绠$悊", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysMenu menu) - { - if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) - { + public AjaxResult<Void> edit(@Validated @RequestBody SysMenu menu) { + if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) { return AjaxResult.error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪"); - } - else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) - { + } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { return AjaxResult.error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧�蹇呴』浠ttp(s)://寮�澶�"); - } - else if (menu.getMenuId().equals(menu.getParentId())) - { + } else if (menu.getMenuId().equals(menu.getParentId())) { return AjaxResult.error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屼笂绾ц彍鍗曚笉鑳介�夋嫨鑷繁"); } menu.setUpdateBy(getUsername()); @@ -120,17 +118,15 @@ /** * 鍒犻櫎鑿滃崟 */ + @ApiOperation("鍒犻櫎鑿滃崟") @PreAuthorize("@ss.hasPermi('system:menu:remove')") @Log(title = "鑿滃崟绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{menuId}") - public AjaxResult remove(@PathVariable("menuId") Long menuId) - { - if (menuService.hasChildByMenuId(menuId)) - { + public AjaxResult<Void> remove(@PathVariable("menuId") Long menuId) { + if (menuService.hasChildByMenuId(menuId)) { return AjaxResult.error("瀛樺湪瀛愯彍鍗�,涓嶅厑璁稿垹闄�"); } - if (menuService.checkMenuExistRole(menuId)) - { + if (menuService.checkMenuExistRole(menuId)) { return AjaxResult.error("鑿滃崟宸插垎閰�,涓嶅厑璁稿垹闄�"); } return toAjax(menuService.deleteMenuById(menuId)); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java index 55375a9..c288347 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java @@ -1,17 +1,5 @@ package com.ruoyi.web.controller.system; -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -19,47 +7,56 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.service.ISysNoticeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; /** * 鍏憡 淇℃伅鎿嶄綔澶勭悊 * - * @author ruoyi + * @author Lion Li */ +@Validated +@Api(value = "鍏憡淇℃伅鎺у埗鍣�", tags = {"鍏憡淇℃伅绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/notice") -public class SysNoticeController extends BaseController -{ - @Autowired - private ISysNoticeService noticeService; +public class SysNoticeController extends BaseController { + + private final ISysNoticeService noticeService; /** * 鑾峰彇閫氱煡鍏憡鍒楄〃 */ + @ApiOperation("鑾峰彇閫氱煡鍏憡鍒楄〃") @PreAuthorize("@ss.hasPermi('system:notice:list')") @GetMapping("/list") - public TableDataInfo list(SysNotice notice) - { + public TableDataInfo<SysNotice> list(SysNotice notice) { return noticeService.selectPageNoticeList(notice); } /** * 鏍规嵁閫氱煡鍏憡缂栧彿鑾峰彇璇︾粏淇℃伅 */ + @ApiOperation("鏍规嵁閫氱煡鍏憡缂栧彿鑾峰彇璇︾粏淇℃伅") @PreAuthorize("@ss.hasPermi('system:notice:query')") @GetMapping(value = "/{noticeId}") - public AjaxResult getInfo(@PathVariable Long noticeId) - { + public AjaxResult<SysNotice> getInfo(@PathVariable Long noticeId) { return AjaxResult.success(noticeService.selectNoticeById(noticeId)); } /** * 鏂板閫氱煡鍏憡 */ + @ApiOperation("鏂板閫氱煡鍏憡") @PreAuthorize("@ss.hasPermi('system:notice:add')") @Log(title = "閫氱煡鍏憡", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysNotice notice) - { + public AjaxResult<Void> add(@Validated @RequestBody SysNotice notice) { notice.setCreateBy(getUsername()); return toAjax(noticeService.insertNotice(notice)); } @@ -67,11 +64,11 @@ /** * 淇敼閫氱煡鍏憡 */ + @ApiOperation("淇敼閫氱煡鍏憡") @PreAuthorize("@ss.hasPermi('system:notice:edit')") @Log(title = "閫氱煡鍏憡", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysNotice notice) - { + public AjaxResult<Void> edit(@Validated @RequestBody SysNotice notice) { notice.setUpdateBy(getUsername()); return toAjax(noticeService.updateNotice(notice)); } @@ -79,11 +76,11 @@ /** * 鍒犻櫎閫氱煡鍏憡 */ + @ApiOperation("鍒犻櫎閫氱煡鍏憡") @PreAuthorize("@ss.hasPermi('system:notice:remove')") @Log(title = "閫氱煡鍏憡", businessType = BusinessType.DELETE) @DeleteMapping("/{noticeIds}") - public AjaxResult remove(@PathVariable Long[] noticeIds) - { + public AjaxResult<Void> remove(@PathVariable Long[] noticeIds) { return toAjax(noticeService.deleteNoticeByIds(noticeIds)); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java index e72bd1f..1756ce7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java @@ -38,72 +38,73 @@ @RequestMapping("/system/oss/config") public class SysOssConfigController extends BaseController { - private final ISysOssConfigService iSysOssConfigService; + private final ISysOssConfigService iSysOssConfigService; - /** - * 鏌ヨ瀵硅薄瀛樺偍閰嶇疆鍒楄〃 - */ - @ApiOperation("鏌ヨ瀵硅薄瀛樺偍閰嶇疆鍒楄〃") - @PreAuthorize("@ss.hasPermi('system:oss:list')") - @GetMapping("/list") - public TableDataInfo<SysOssConfigVo> list(@Validated(QueryGroup.class) SysOssConfigBo bo) { - return iSysOssConfigService.queryPageList(bo); - } + /** + * 鏌ヨ瀵硅薄瀛樺偍閰嶇疆鍒楄〃 + */ + @ApiOperation("鏌ヨ瀵硅薄瀛樺偍閰嶇疆鍒楄〃") + @PreAuthorize("@ss.hasPermi('system:oss:list')") + @GetMapping("/list") + public TableDataInfo<SysOssConfigVo> list(@Validated(QueryGroup.class) SysOssConfigBo bo) { + return iSysOssConfigService.queryPageList(bo); + } - /** - * 鑾峰彇瀵硅薄瀛樺偍閰嶇疆璇︾粏淇℃伅 - */ - @ApiOperation("鑾峰彇瀵硅薄瀛樺偍閰嶇疆璇︾粏淇℃伅") - @PreAuthorize("@ss.hasPermi('system:oss:query')") - @GetMapping("/{ossConfigId}") - public AjaxResult<SysOssConfigVo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖") - @PathVariable("ossConfigId") Integer ossConfigId) { - return AjaxResult.success(iSysOssConfigService.queryById(ossConfigId)); - } + /** + * 鑾峰彇瀵硅薄瀛樺偍閰嶇疆璇︾粏淇℃伅 + */ + @ApiOperation("鑾峰彇瀵硅薄瀛樺偍閰嶇疆璇︾粏淇℃伅") + @PreAuthorize("@ss.hasPermi('system:oss:query')") + @GetMapping("/{ossConfigId}") + public AjaxResult<SysOssConfigVo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable("ossConfigId") Integer ossConfigId) { + return AjaxResult.success(iSysOssConfigService.queryById(ossConfigId)); + } - /** - * 鏂板瀵硅薄瀛樺偍閰嶇疆 - */ - @ApiOperation("鏂板瀵硅薄瀛樺偍閰嶇疆") - @PreAuthorize("@ss.hasPermi('system:oss:add')") - @Log(title = "瀵硅薄瀛樺偍閰嶇疆", businessType = BusinessType.INSERT) - @RepeatSubmit() - @PostMapping() - public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody SysOssConfigBo bo) { - return toAjax(iSysOssConfigService.insertByBo(bo) ? 1 : 0); - } + /** + * 鏂板瀵硅薄瀛樺偍閰嶇疆 + */ + @ApiOperation("鏂板瀵硅薄瀛樺偍閰嶇疆") + @PreAuthorize("@ss.hasPermi('system:oss:add')") + @Log(title = "瀵硅薄瀛樺偍閰嶇疆", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody SysOssConfigBo bo) { + return toAjax(iSysOssConfigService.insertByBo(bo) ? 1 : 0); + } - /** - * 淇敼瀵硅薄瀛樺偍閰嶇疆 - */ - @ApiOperation("淇敼瀵硅薄瀛樺偍閰嶇疆") - @PreAuthorize("@ss.hasPermi('system:oss:edit')") - @Log(title = "瀵硅薄瀛樺偍閰嶇疆", businessType = BusinessType.UPDATE) - @RepeatSubmit() - @PutMapping() - public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody SysOssConfigBo bo) { - return toAjax(iSysOssConfigService.updateByBo(bo) ? 1 : 0); - } + /** + * 淇敼瀵硅薄瀛樺偍閰嶇疆 + */ + @ApiOperation("淇敼瀵硅薄瀛樺偍閰嶇疆") + @PreAuthorize("@ss.hasPermi('system:oss:edit')") + @Log(title = "瀵硅薄瀛樺偍閰嶇疆", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody SysOssConfigBo bo) { + return toAjax(iSysOssConfigService.updateByBo(bo) ? 1 : 0); + } - /** - * 鍒犻櫎瀵硅薄瀛樺偍閰嶇疆 - */ - @ApiOperation("鍒犻櫎瀵硅薄瀛樺偍閰嶇疆") - @PreAuthorize("@ss.hasPermi('system:oss:remove')") - @Log(title = "瀵硅薄瀛樺偍閰嶇疆", businessType = BusinessType.DELETE) - @DeleteMapping("/{ossConfigIds}") - public AjaxResult<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") - @PathVariable Long[] ossConfigIds) { - return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true) ? 1 : 0); - } + /** + * 鍒犻櫎瀵硅薄瀛樺偍閰嶇疆 + */ + @ApiOperation("鍒犻櫎瀵硅薄瀛樺偍閰嶇疆") + @PreAuthorize("@ss.hasPermi('system:oss:remove')") + @Log(title = "瀵硅薄瀛樺偍閰嶇疆", businessType = BusinessType.DELETE) + @DeleteMapping("/{ossConfigIds}") + public AjaxResult<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long[] ossConfigIds) { + return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true) ? 1 : 0); + } - /** - * 鐘舵�佷慨鏀� - */ - @PreAuthorize("@ss.hasPermi('system:oss:edit')") - @Log(title = "瀵硅薄瀛樺偍鐘舵�佷慨鏀�", businessType = BusinessType.UPDATE) - @PutMapping("/changeStatus") - public AjaxResult changeStatus(@RequestBody SysOssConfigBo bo) { - return toAjax(iSysOssConfigService.updateOssConfigStatus(bo)); - } + /** + * 鐘舵�佷慨鏀� + */ + @ApiOperation("鐘舵�佷慨鏀�") + @PreAuthorize("@ss.hasPermi('system:oss:edit')") + @Log(title = "瀵硅薄瀛樺偍鐘舵�佷慨鏀�", businessType = BusinessType.UPDATE) + @PutMapping("/changeStatus") + public AjaxResult<Void> changeStatus(@RequestBody SysOssConfigBo bo) { + return toAjax(iSysOssConfigService.updateOssConfigStatus(bo)); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java index 3c04353..cfa4c7b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java @@ -38,8 +38,6 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.NotEmpty; import java.io.IOException; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -56,92 +54,92 @@ @RequestMapping("/system/oss") public class SysOssController extends BaseController { - private final ISysOssService iSysOssService; - private final ISysConfigService iSysConfigService; + private final ISysOssService iSysOssService; + private final ISysConfigService iSysConfigService; - /** - * 鏌ヨOSS瀵硅薄瀛樺偍鍒楄〃 - */ - @ApiOperation("鏌ヨOSS瀵硅薄瀛樺偍鍒楄〃") - @PreAuthorize("@ss.hasPermi('system:oss:list')") - @GetMapping("/list") - public TableDataInfo<SysOssVo> list(@Validated(QueryGroup.class) SysOssBo bo) { - return iSysOssService.queryPageList(bo); - } + /** + * 鏌ヨOSS瀵硅薄瀛樺偍鍒楄〃 + */ + @ApiOperation("鏌ヨOSS瀵硅薄瀛樺偍鍒楄〃") + @PreAuthorize("@ss.hasPermi('system:oss:list')") + @GetMapping("/list") + public TableDataInfo<SysOssVo> list(@Validated(QueryGroup.class) SysOssBo bo) { + return iSysOssService.queryPageList(bo); + } - /** - * 涓婁紶OSS瀵硅薄瀛樺偍 - */ - @ApiOperation("涓婁紶OSS瀵硅薄瀛樺偍") - @ApiImplicitParams({ - @ApiImplicitParam(name = "file", value = "鏂囦欢", dataType = "java.io.File", required = true), - }) - @PreAuthorize("@ss.hasPermi('system:oss:upload')") - @Log(title = "OSS瀵硅薄瀛樺偍", businessType = BusinessType.INSERT) - @RepeatSubmit - @PostMapping("/upload") - public AjaxResult<Map<String, String>> upload(@RequestPart("file") MultipartFile file) { - if (ObjectUtil.isNull(file)) { - throw new ServiceException("涓婁紶鏂囦欢涓嶈兘涓虹┖"); - } - SysOss oss = iSysOssService.upload(file); - Map<String, String> map = new HashMap<>(2); - map.put("url", oss.getUrl()); - map.put("fileName", oss.getFileName()); - return AjaxResult.success(map); - } + /** + * 涓婁紶OSS瀵硅薄瀛樺偍 + */ + @ApiOperation("涓婁紶OSS瀵硅薄瀛樺偍") + @ApiImplicitParams({ + @ApiImplicitParam(name = "file", value = "鏂囦欢", dataType = "java.io.File", required = true), + }) + @PreAuthorize("@ss.hasPermi('system:oss:upload')") + @Log(title = "OSS瀵硅薄瀛樺偍", businessType = BusinessType.INSERT) + @RepeatSubmit + @PostMapping("/upload") + public AjaxResult<Map<String, String>> upload(@RequestPart("file") MultipartFile file) { + if (ObjectUtil.isNull(file)) { + throw new ServiceException("涓婁紶鏂囦欢涓嶈兘涓虹┖"); + } + SysOss oss = iSysOssService.upload(file); + Map<String, String> map = new HashMap<>(2); + map.put("url", oss.getUrl()); + map.put("fileName", oss.getFileName()); + return AjaxResult.success(map); + } - @ApiOperation("涓嬭浇OSS瀵硅薄瀛樺偍") - @PreAuthorize("@ss.hasPermi('system:oss:download')") - @GetMapping("/download/{ossId}") - public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException { - SysOss sysOss = iSysOssService.getById(ossId); - if (ObjectUtil.isNull(sysOss)) { - throw new ServiceException("鏂囦欢鏁版嵁涓嶅瓨鍦�!"); - } - response.reset(); - response.addHeader("Access-Control-Allow-Origin", "*"); - response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); - FileUtils.setAttachmentResponseHeader(response, sysOss.getOriginalName()); - response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8"); - long data; - try { - data = HttpUtil.download(sysOss.getUrl(), response.getOutputStream(), false); - } catch (HttpException e) { - if (e.getMessage().contains("403")) { - throw new ServiceException("鏃犺鍙栨潈闄�, 璇峰湪瀵瑰簲鐨凮SS寮�鍚�'鍏湁璇�'鏉冮檺!"); - } else { - throw new ServiceException(e.getMessage()); - } - } - response.setContentLength(Convert.toInt(data)); - } + @ApiOperation("涓嬭浇OSS瀵硅薄瀛樺偍") + @PreAuthorize("@ss.hasPermi('system:oss:download')") + @GetMapping("/download/{ossId}") + public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException { + SysOss sysOss = iSysOssService.getById(ossId); + if (ObjectUtil.isNull(sysOss)) { + throw new ServiceException("鏂囦欢鏁版嵁涓嶅瓨鍦�!"); + } + response.reset(); + response.addHeader("Access-Control-Allow-Origin", "*"); + response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); + FileUtils.setAttachmentResponseHeader(response, sysOss.getOriginalName()); + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8"); + long data; + try { + data = HttpUtil.download(sysOss.getUrl(), response.getOutputStream(), false); + } catch (HttpException e) { + if (e.getMessage().contains("403")) { + throw new ServiceException("鏃犺鍙栨潈闄�, 璇峰湪瀵瑰簲鐨凮SS寮�鍚�'鍏湁璇�'鏉冮檺!"); + } else { + throw new ServiceException(e.getMessage()); + } + } + response.setContentLength(Convert.toInt(data)); + } - /** - * 鍒犻櫎OSS瀵硅薄瀛樺偍 - */ - @ApiOperation("鍒犻櫎OSS瀵硅薄瀛樺偍") - @PreAuthorize("@ss.hasPermi('system:oss:remove')") - @Log(title = "OSS瀵硅薄瀛樺偍" , businessType = BusinessType.DELETE) - @DeleteMapping("/{ossIds}") - public AjaxResult<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") - @PathVariable Long[] ossIds) { - return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0); - } + /** + * 鍒犻櫎OSS瀵硅薄瀛樺偍 + */ + @ApiOperation("鍒犻櫎OSS瀵硅薄瀛樺偍") + @PreAuthorize("@ss.hasPermi('system:oss:remove')") + @Log(title = "OSS瀵硅薄瀛樺偍", businessType = BusinessType.DELETE) + @DeleteMapping("/{ossIds}") + public AjaxResult<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long[] ossIds) { + return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0); + } - /** - * 鍙樻洿鍥剧墖鍒楄〃棰勮鐘舵�� - */ - @ApiOperation("鍙樻洿鍥剧墖鍒楄〃棰勮鐘舵��") - @PreAuthorize("@ss.hasPermi('system:oss:edit')") - @Log(title = "OSS瀵硅薄瀛樺偍" , businessType = BusinessType.UPDATE) - @PutMapping("/changePreviewListResource") - public AjaxResult<Void> changePreviewListResource(@RequestBody String body) { - Map<String, Boolean> map = JsonUtils.parseMap(body); - SysConfig config = iSysConfigService.getOne(new LambdaQueryWrapper<SysConfig>() - .eq(SysConfig::getConfigKey, CloudConstant.PEREVIEW_LIST_RESOURCE_KEY)); - config.setConfigValue(map.get("previewListResource").toString()); - return toAjax(iSysConfigService.updateConfig(config)); - } + /** + * 鍙樻洿鍥剧墖鍒楄〃棰勮鐘舵�� + */ + @ApiOperation("鍙樻洿鍥剧墖鍒楄〃棰勮鐘舵��") + @PreAuthorize("@ss.hasPermi('system:oss:edit')") + @Log(title = "OSS瀵硅薄瀛樺偍", businessType = BusinessType.UPDATE) + @PutMapping("/changePreviewListResource") + public AjaxResult<Void> changePreviewListResource(@RequestBody String body) { + Map<String, Boolean> map = JsonUtils.parseMap(body); + SysConfig config = iSysConfigService.getOne(new LambdaQueryWrapper<SysConfig>() + .eq(SysConfig::getConfigKey, CloudConstant.PEREVIEW_LIST_RESOURCE_KEY)); + config.setConfigValue(map.get("previewListResource").toString()); + return toAjax(iSysConfigService.updateConfig(config)); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java index 93d4d46..d90cabe 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java @@ -9,6 +9,9 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.SysPost; import com.ruoyi.system.service.ISysPostService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -20,58 +23,57 @@ /** * 宀椾綅淇℃伅鎿嶄綔澶勭悊 * - * @author ruoyi + * @author Lion Li */ +@Validated +@Api(value = "宀椾綅淇℃伅鎺у埗鍣�", tags = {"宀椾綅淇℃伅绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/post") -public class SysPostController extends BaseController -{ - @Autowired - private ISysPostService postService; +public class SysPostController extends BaseController { + + private final ISysPostService postService; /** * 鑾峰彇宀椾綅鍒楄〃 */ + @ApiOperation("鑾峰彇宀椾綅鍒楄〃") @PreAuthorize("@ss.hasPermi('system:post:list')") @GetMapping("/list") - public TableDataInfo list(SysPost post) - { + public TableDataInfo<SysPost> list(SysPost post) { return postService.selectPagePostList(post); } + @ApiOperation("瀵煎嚭宀椾綅鍒楄〃") @Log(title = "宀椾綅绠$悊", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:post:export')") @GetMapping("/export") - public void export(SysPost post, HttpServletResponse response) - { + public void export(SysPost post, HttpServletResponse response) { List<SysPost> list = postService.selectPostList(post); - ExcelUtil.exportExcel(list, "宀椾綅鏁版嵁", SysPost.class, response); + ExcelUtil.exportExcel(list, "宀椾綅鏁版嵁", SysPost.class, response); } /** * 鏍规嵁宀椾綅缂栧彿鑾峰彇璇︾粏淇℃伅 */ + @ApiOperation("鏍规嵁宀椾綅缂栧彿鑾峰彇璇︾粏淇℃伅") @PreAuthorize("@ss.hasPermi('system:post:query')") @GetMapping(value = "/{postId}") - public AjaxResult getInfo(@PathVariable Long postId) - { + public AjaxResult<SysPost> getInfo(@PathVariable Long postId) { return AjaxResult.success(postService.selectPostById(postId)); } /** * 鏂板宀椾綅 */ + @ApiOperation("鏂板宀椾綅") @PreAuthorize("@ss.hasPermi('system:post:add')") @Log(title = "宀椾綅绠$悊", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysPost post) - { - if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) - { + public AjaxResult<Void> add(@Validated @RequestBody SysPost post) { + if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) { return AjaxResult.error("鏂板宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶅悕绉板凡瀛樺湪"); - } - else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) - { + } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) { return AjaxResult.error("鏂板宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶇紪鐮佸凡瀛樺湪"); } post.setCreateBy(getUsername()); @@ -81,17 +83,14 @@ /** * 淇敼宀椾綅 */ + @ApiOperation("淇敼宀椾綅") @PreAuthorize("@ss.hasPermi('system:post:edit')") @Log(title = "宀椾綅绠$悊", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysPost post) - { - if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) - { + public AjaxResult<Void> edit(@Validated @RequestBody SysPost post) { + if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) { return AjaxResult.error("淇敼宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶅悕绉板凡瀛樺湪"); - } - else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) - { + } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) { return AjaxResult.error("淇敼宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶇紪鐮佸凡瀛樺湪"); } post.setUpdateBy(getUsername()); @@ -101,20 +100,20 @@ /** * 鍒犻櫎宀椾綅 */ + @ApiOperation("鍒犻櫎宀椾綅") @PreAuthorize("@ss.hasPermi('system:post:remove')") @Log(title = "宀椾綅绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{postIds}") - public AjaxResult remove(@PathVariable Long[] postIds) - { + public AjaxResult<Void> remove(@PathVariable Long[] postIds) { return toAjax(postService.deletePostByIds(postIds)); } /** * 鑾峰彇宀椾綅閫夋嫨妗嗗垪琛� */ + @ApiOperation("鑾峰彇宀椾綅閫夋嫨妗嗗垪琛�") @GetMapping("/optionselect") - public AjaxResult optionselect() - { + public AjaxResult<List<SysPost>> optionselect() { List<SysPost> posts = postService.selectPostAll(); return AjaxResult.success(posts); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java index 66dfd07..d037e79 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java @@ -6,49 +6,49 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.core.service.TokenService; +import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysOss; import com.ruoyi.system.service.ISysOssService; import com.ruoyi.system.service.ISysUserService; +import io.swagger.annotations.*; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.HashMap; import java.util.Map; /** * 涓汉淇℃伅 涓氬姟澶勭悊 * - * @author ruoyi + * @author Lion Li */ +@Validated +@Api(value = "涓汉淇℃伅鎺у埗鍣�", tags = {"涓汉淇℃伅绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/user/profile") -public class SysProfileController extends BaseController -{ - @Autowired - private ISysUserService userService; +public class SysProfileController extends BaseController { - @Autowired - private TokenService tokenService; - - @Autowired - private ISysOssService iSysOssService; + private final ISysUserService userService; + private final TokenService tokenService; + private final ISysOssService iSysOssService; /** * 涓汉淇℃伅 */ + @ApiOperation("涓汉淇℃伅") @GetMapping - public AjaxResult profile() - { + public AjaxResult<Map<String, Object>> profile() { LoginUser loginUser = getLoginUser(); SysUser user = loginUser.getUser(); - Map<String,Object> ajax = new HashMap<>(); - ajax.put("user", user); + Map<String, Object> ajax = new HashMap<>(); + ajax.put("user", user); ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); return AjaxResult.success(ajax); @@ -57,26 +57,23 @@ /** * 淇敼鐢ㄦ埛 */ + @ApiOperation("淇敼鐢ㄦ埛") @Log(title = "涓汉淇℃伅", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult updateProfile(@RequestBody SysUser user) - { + public AjaxResult<Void> updateProfile(@RequestBody SysUser user) { if (StringUtils.isNotEmpty(user.getPhonenumber()) - && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) - { + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { return AjaxResult.error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛屾墜鏈哄彿鐮佸凡瀛樺湪"); } if (StringUtils.isNotEmpty(user.getEmail()) - && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) - { + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { return AjaxResult.error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪"); } LoginUser loginUser = getLoginUser(); SysUser sysUser = loginUser.getUser(); user.setUserId(sysUser.getUserId()); user.setPassword(null); - if (userService.updateUserProfile(user) > 0) - { + if (userService.updateUserProfile(user) > 0) { // 鏇存柊缂撳瓨鐢ㄦ埛淇℃伅 sysUser.setNickName(user.getNickName()); sysUser.setPhonenumber(user.getPhonenumber()); @@ -91,23 +88,20 @@ /** * 閲嶇疆瀵嗙爜 */ + @ApiOperation("閲嶇疆瀵嗙爜") @Log(title = "涓汉淇℃伅", businessType = BusinessType.UPDATE) @PutMapping("/updatePwd") - public AjaxResult updatePwd(String oldPassword, String newPassword) - { + public AjaxResult<Void> updatePwd(String oldPassword, String newPassword) { LoginUser loginUser = getLoginUser(); String userName = loginUser.getUsername(); String password = loginUser.getPassword(); - if (!SecurityUtils.matchesPassword(oldPassword, password)) - { + if (!SecurityUtils.matchesPassword(oldPassword, password)) { return AjaxResult.error("淇敼瀵嗙爜澶辫触锛屾棫瀵嗙爜閿欒"); } - if (SecurityUtils.matchesPassword(newPassword, password)) - { + if (SecurityUtils.matchesPassword(newPassword, password)) { return AjaxResult.error("鏂板瘑鐮佷笉鑳戒笌鏃у瘑鐮佺浉鍚�"); } - if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) - { + if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) { // 鏇存柊缂撳瓨鐢ㄦ埛瀵嗙爜 loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword)); tokenService.setLoginUser(loginUser); @@ -119,18 +113,19 @@ /** * 澶村儚涓婁紶 */ + @ApiOperation("澶村儚涓婁紶") + @ApiImplicitParams({ + @ApiImplicitParam(name = "file", value = "鐢ㄦ埛澶村儚", dataType = "java.io.File", required = true), + }) @Log(title = "鐢ㄦ埛澶村儚", businessType = BusinessType.UPDATE) @PostMapping("/avatar") - public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws IOException - { - if (!file.isEmpty()) - { + public AjaxResult<Map<String, Object>> avatar(@RequestPart("avatarfile") MultipartFile file) { + Map<String, Object> ajax = new HashMap<>(); + if (!file.isEmpty()) { LoginUser loginUser = getLoginUser(); - SysOss oss = iSysOssService.upload(file); - String avatar = oss.getUrl(); - if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) - { - Map<String,Object> ajax = new HashMap<>(); + SysOss oss = iSysOssService.upload(file); + String avatar = oss.getUrl(); + if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) { ajax.put("imgUrl", avatar); // 鏇存柊缂撳瓨鐢ㄦ埛澶村儚 loginUser.getUser().setAvatar(avatar); @@ -138,6 +133,6 @@ return AjaxResult.success(ajax); } } - return AjaxResult.error("涓婁紶鍥剧墖寮傚父锛岃鑱旂郴绠$悊鍛�"); + return AjaxResult.error("涓婁紶鍥剧墖寮傚父锛岃鑱旂郴绠$悊鍛�", ajax); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java index 64904a0..11dc6eb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java @@ -4,9 +4,13 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.model.RegisterBody; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.system.service.SysRegisterService; import com.ruoyi.system.service.ISysConfigService; +import com.ruoyi.system.service.SysRegisterService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; @@ -14,22 +18,21 @@ /** * 娉ㄥ唽楠岃瘉 * - * @author ruoyi + * @author Lion Li */ +@Validated +@Api(value = "娉ㄥ唽楠岃瘉鎺у埗鍣�", tags = {"娉ㄥ唽楠岃瘉绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController -public class SysRegisterController extends BaseController -{ - @Autowired - private SysRegisterService registerService; +public class SysRegisterController extends BaseController { - @Autowired - private ISysConfigService configService; + private final SysRegisterService registerService; + private final ISysConfigService configService; + @ApiOperation("鐢ㄦ埛娉ㄥ唽") @PostMapping("/register") - public AjaxResult register(@RequestBody RegisterBody user) - { - if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) - { + public AjaxResult<Void> register(@RequestBody RegisterBody user) { + if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) { return error("褰撳墠绯荤粺娌℃湁寮�鍚敞鍐屽姛鑳斤紒"); } String msg = registerService.register(user); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index e5f4032..cd525c4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -8,14 +8,17 @@ import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.core.service.TokenService; +import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.SysUserRole; import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.SysPermissionService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -27,47 +30,43 @@ /** * 瑙掕壊淇℃伅 * - * @author ruoyi + * @author Lion Li */ +@Validated +@Api(value = "瑙掕壊淇℃伅鎺у埗鍣�", tags = {"瑙掕壊淇℃伅绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/role") -public class SysRoleController extends BaseController -{ - @Autowired - private ISysRoleService roleService; +public class SysRoleController extends BaseController { - @Autowired - private TokenService tokenService; + private final ISysRoleService roleService; + private final TokenService tokenService; + private final ISysUserService userService; + private final SysPermissionService permissionService; - @Autowired - private SysPermissionService permissionService; - - @Autowired - private ISysUserService userService; - + @ApiOperation("鏌ヨ瑙掕壊淇℃伅鍒楄〃") @PreAuthorize("@ss.hasPermi('system:role:list')") @GetMapping("/list") - public TableDataInfo list(SysRole role) - { + public TableDataInfo<SysRole> list(SysRole role) { return roleService.selectPageRoleList(role); } + @ApiOperation("瀵煎嚭瑙掕壊淇℃伅鍒楄〃") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:role:export')") @GetMapping("/export") - public void export(SysRole role, HttpServletResponse response) - { + public void export(SysRole role, HttpServletResponse response) { List<SysRole> list = roleService.selectRoleList(role); - ExcelUtil.exportExcel(list, "瑙掕壊鏁版嵁", SysRole.class, response); + ExcelUtil.exportExcel(list, "瑙掕壊鏁版嵁", SysRole.class, response); } /** * 鏍规嵁瑙掕壊缂栧彿鑾峰彇璇︾粏淇℃伅 */ + @ApiOperation("鏍规嵁瑙掕壊缂栧彿鑾峰彇璇︾粏淇℃伅") @PreAuthorize("@ss.hasPermi('system:role:query')") @GetMapping(value = "/{roleId}") - public AjaxResult getInfo(@PathVariable Long roleId) - { + public AjaxResult<SysRole> getInfo(@PathVariable Long roleId) { roleService.checkRoleDataScope(roleId); return AjaxResult.success(roleService.selectRoleById(roleId)); } @@ -75,17 +74,14 @@ /** * 鏂板瑙掕壊 */ + @ApiOperation("鏂板瑙掕壊") @PreAuthorize("@ss.hasPermi('system:role:add')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysRole role) - { - if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) - { + public AjaxResult<Void> add(@Validated @RequestBody SysRole role) { + if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) { return AjaxResult.error("鏂板瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹插悕绉板凡瀛樺湪"); - } - else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) - { + } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) { return AjaxResult.error("鏂板瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹叉潈闄愬凡瀛樺湪"); } role.setCreateBy(getUsername()); @@ -96,28 +92,23 @@ /** * 淇敼淇濆瓨瑙掕壊 */ + @ApiOperation("淇敼淇濆瓨瑙掕壊") @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysRole role) - { + public AjaxResult<Void> edit(@Validated @RequestBody SysRole role) { roleService.checkRoleAllowed(role); - if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) - { + if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) { return AjaxResult.error("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹插悕绉板凡瀛樺湪"); - } - else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) - { + } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) { return AjaxResult.error("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹叉潈闄愬凡瀛樺湪"); } role.setUpdateBy(getUsername()); - if (roleService.updateRole(role) > 0) - { + if (roleService.updateRole(role) > 0) { // 鏇存柊缂撳瓨鐢ㄦ埛鏉冮檺 LoginUser loginUser = getLoginUser(); - if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) - { + if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) { loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); tokenService.setLoginUser(loginUser); @@ -130,11 +121,11 @@ /** * 淇敼淇濆瓨鏁版嵁鏉冮檺 */ + @ApiOperation("淇敼淇濆瓨鏁版嵁鏉冮檺") @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE) @PutMapping("/dataScope") - public AjaxResult dataScope(@RequestBody SysRole role) - { + public AjaxResult<Void> dataScope(@RequestBody SysRole role) { roleService.checkRoleAllowed(role); return toAjax(roleService.authDataScope(role)); } @@ -142,11 +133,11 @@ /** * 鐘舵�佷慨鏀� */ + @ApiOperation("鐘舵�佷慨鏀�") @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE) @PutMapping("/changeStatus") - public AjaxResult changeStatus(@RequestBody SysRole role) - { + public AjaxResult<Void> changeStatus(@RequestBody SysRole role) { roleService.checkRoleAllowed(role); role.setUpdateBy(getUsername()); return toAjax(roleService.updateRoleStatus(role)); @@ -155,74 +146,74 @@ /** * 鍒犻櫎瑙掕壊 */ + @ApiOperation("鍒犻櫎瑙掕壊") @PreAuthorize("@ss.hasPermi('system:role:remove')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{roleIds}") - public AjaxResult remove(@PathVariable Long[] roleIds) - { + public AjaxResult<Void> remove(@PathVariable Long[] roleIds) { return toAjax(roleService.deleteRoleByIds(roleIds)); } /** * 鑾峰彇瑙掕壊閫夋嫨妗嗗垪琛� */ + @ApiOperation("鑾峰彇瑙掕壊閫夋嫨妗嗗垪琛�") @PreAuthorize("@ss.hasPermi('system:role:query')") @GetMapping("/optionselect") - public AjaxResult optionselect() - { + public AjaxResult<List<SysRole>> optionselect() { return AjaxResult.success(roleService.selectRoleAll()); } /** * 鏌ヨ宸插垎閰嶇敤鎴疯鑹插垪琛� */ + @ApiOperation("鏌ヨ宸插垎閰嶇敤鎴疯鑹插垪琛�") @PreAuthorize("@ss.hasPermi('system:role:list')") @GetMapping("/authUser/allocatedList") - public TableDataInfo allocatedList(SysUser user) - { - return userService.selectAllocatedList(user); + public TableDataInfo<SysUser> allocatedList(SysUser user) { + return userService.selectAllocatedList(user); } /** * 鏌ヨ鏈垎閰嶇敤鎴疯鑹插垪琛� */ + @ApiOperation("鏌ヨ鏈垎閰嶇敤鎴疯鑹插垪琛�") @PreAuthorize("@ss.hasPermi('system:role:list')") @GetMapping("/authUser/unallocatedList") - public TableDataInfo unallocatedList(SysUser user) - { + public TableDataInfo<SysUser> unallocatedList(SysUser user) { return userService.selectUnallocatedList(user); } /** * 鍙栨秷鎺堟潈鐢ㄦ埛 */ + @ApiOperation("鍙栨秷鎺堟潈鐢ㄦ埛") @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT) @PutMapping("/authUser/cancel") - public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) - { + public AjaxResult<Void> cancelAuthUser(@RequestBody SysUserRole userRole) { return toAjax(roleService.deleteAuthUser(userRole)); } /** * 鎵归噺鍙栨秷鎺堟潈鐢ㄦ埛 */ + @ApiOperation("鎵归噺鍙栨秷鎺堟潈鐢ㄦ埛") @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT) @PutMapping("/authUser/cancelAll") - public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) - { + public AjaxResult<Void> cancelAuthUserAll(Long roleId, Long[] userIds) { return toAjax(roleService.deleteAuthUsers(roleId, userIds)); } /** * 鎵归噺閫夋嫨鐢ㄦ埛鎺堟潈 */ + @ApiOperation("鎵归噺閫夋嫨鐢ㄦ埛鎺堟潈") @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT) @PutMapping("/authUser/selectAll") - public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) - { + public AjaxResult<Void> selectAuthUserAll(Long roleId, Long[] userIds) { return toAjax(roleService.insertAuthUsers(roleId, userIds)); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index 28c9f15..77c8e36 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -20,6 +20,11 @@ import com.ruoyi.system.service.ISysPostService; import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -36,81 +41,81 @@ /** * 鐢ㄦ埛淇℃伅 * - * @author ruoyi + * @author Lion Li */ +@Validated +@Api(value = "鐢ㄦ埛淇℃伅鎺у埗鍣�", tags = {"鐢ㄦ埛淇℃伅绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/user") -public class SysUserController extends BaseController -{ - @Autowired - private ISysUserService userService; +public class SysUserController extends BaseController { - @Autowired - private ISysRoleService roleService; - - @Autowired - private ISysPostService postService; + private final ISysUserService userService; + private final ISysRoleService roleService; + private final ISysPostService postService; /** * 鑾峰彇鐢ㄦ埛鍒楄〃 */ + @ApiOperation("鑾峰彇鐢ㄦ埛鍒楄〃") @PreAuthorize("@ss.hasPermi('system:user:list')") @GetMapping("/list") - public TableDataInfo list(SysUser user) - { + public TableDataInfo<SysUser> list(SysUser user) { return userService.selectPageUserList(user); } + @ApiOperation("瀵煎嚭鐢ㄦ埛鍒楄〃") @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:user:export')") @GetMapping("/export") - public void export(SysUser user, HttpServletResponse response) - { + public void export(SysUser user, HttpServletResponse response) { List<SysUser> list = userService.selectUserList(user); - List<SysUserExportVo> listVo = BeanUtil.copyToList(list, SysUserExportVo.class); - for (int i = 0; i < list.size(); i++) { - SysDept dept = list.get(i).getDept(); - SysUserExportVo vo = listVo.get(i); - if (ObjectUtil.isNotEmpty(dept)) { - vo.setDeptName(dept.getDeptName()); - vo.setLeader(dept.getLeader()); - } - } - ExcelUtil.exportExcel(listVo, "鐢ㄦ埛鏁版嵁", SysUserExportVo.class, response); + List<SysUserExportVo> listVo = BeanUtil.copyToList(list, SysUserExportVo.class); + for (int i = 0; i < list.size(); i++) { + SysDept dept = list.get(i).getDept(); + SysUserExportVo vo = listVo.get(i); + if (ObjectUtil.isNotEmpty(dept)) { + vo.setDeptName(dept.getDeptName()); + vo.setLeader(dept.getLeader()); + } + } + ExcelUtil.exportExcel(listVo, "鐢ㄦ埛鏁版嵁", SysUserExportVo.class, response); } + @ApiOperation("瀵煎叆鐢ㄦ埛鍒楄〃") + @ApiImplicitParams({ + @ApiImplicitParam(name = "file", value = "瀵煎叆鏂囦欢", dataType = "java.io.File", required = true), + }) @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.IMPORT) @PreAuthorize("@ss.hasPermi('system:user:import')") @PostMapping("/importData") - public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception - { - List<SysUserImportVo> userListVo = ExcelUtil.importExcel(file.getInputStream(), SysUserImportVo.class); - List<SysUser> userList = BeanUtil.copyToList(userListVo, SysUser.class); + public AjaxResult<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception { + List<SysUserImportVo> userListVo = ExcelUtil.importExcel(file.getInputStream(), SysUserImportVo.class); + List<SysUser> userList = BeanUtil.copyToList(userListVo, SysUser.class); String operName = getUsername(); String message = userService.importUser(userList, updateSupport, operName); return AjaxResult.success(message); } + @ApiOperation("涓嬭浇瀵煎叆妯℃澘") @GetMapping("/importTemplate") - public void importTemplate(HttpServletResponse response) - { - ExcelUtil.exportExcel(new ArrayList<>(), "鐢ㄦ埛鏁版嵁", SysUserImportVo.class, response); + public void importTemplate(HttpServletResponse response) { + ExcelUtil.exportExcel(new ArrayList<>(), "鐢ㄦ埛鏁版嵁", SysUserImportVo.class, response); } /** * 鏍规嵁鐢ㄦ埛缂栧彿鑾峰彇璇︾粏淇℃伅 */ + @ApiOperation("鏍规嵁鐢ㄦ埛缂栧彿鑾峰彇璇︾粏淇℃伅") @PreAuthorize("@ss.hasPermi('system:user:query')") - @GetMapping(value = { "/", "/{userId}" }) - public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) - { - userService.checkUserDataScope(userId); + @GetMapping(value = {"/", "/{userId}"}) + public AjaxResult<Map<String, Object>> getInfo(@PathVariable(value = "userId", required = false) Long userId) { + userService.checkUserDataScope(userId); Map<String, Object> ajax = new HashMap<>(); List<SysRole> roles = roleService.selectRoleAll(); ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); ajax.put("posts", postService.selectPostAll()); - if (StringUtils.isNotNull(userId)) - { + if (StringUtils.isNotNull(userId)) { ajax.put("user", userService.selectUserById(userId)); ajax.put("postIds", postService.selectPostListByUserId(userId)); ajax.put("roleIds", roleService.selectRoleListByUserId(userId)); @@ -121,23 +126,18 @@ /** * 鏂板鐢ㄦ埛 */ + @ApiOperation("鏂板鐢ㄦ埛") @PreAuthorize("@ss.hasPermi('system:user:add')") @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysUser user) - { - if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) - { + public AjaxResult<Void> add(@Validated @RequestBody SysUser user) { + if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) { return AjaxResult.error("鏂板鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岀櫥褰曡处鍙峰凡瀛樺湪"); - } - else if (StringUtils.isNotEmpty(user.getPhonenumber()) - && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) - { + } else if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { return AjaxResult.error("鏂板鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛屾墜鏈哄彿鐮佸凡瀛樺湪"); - } - else if (StringUtils.isNotEmpty(user.getEmail()) - && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) - { + } else if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { return AjaxResult.error("鏂板鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪"); } user.setCreateBy(getUsername()); @@ -148,20 +148,17 @@ /** * 淇敼鐢ㄦ埛 */ + @ApiOperation("淇敼鐢ㄦ埛") @PreAuthorize("@ss.hasPermi('system:user:edit')") @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysUser user) - { + public AjaxResult<Void> edit(@Validated @RequestBody SysUser user) { userService.checkUserAllowed(user); if (StringUtils.isNotEmpty(user.getPhonenumber()) - && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) - { + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { return AjaxResult.error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛屾墜鏈哄彿鐮佸凡瀛樺湪"); - } - else if (StringUtils.isNotEmpty(user.getEmail()) - && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) - { + } else if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { return AjaxResult.error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪"); } user.setUpdateBy(getUsername()); @@ -171,13 +168,12 @@ /** * 鍒犻櫎鐢ㄦ埛 */ + @ApiOperation("鍒犻櫎鐢ㄦ埛") @PreAuthorize("@ss.hasPermi('system:user:remove')") @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{userIds}") - public AjaxResult remove(@PathVariable Long[] userIds) - { - if (ArrayUtil.contains(userIds, getUserId())) - { + public AjaxResult<Void> remove(@PathVariable Long[] userIds) { + if (ArrayUtil.contains(userIds, getUserId())) { return error("褰撳墠鐢ㄦ埛涓嶈兘鍒犻櫎"); } return toAjax(userService.deleteUserByIds(userIds)); @@ -186,11 +182,11 @@ /** * 閲嶇疆瀵嗙爜 */ + @ApiOperation("閲嶇疆瀵嗙爜") @PreAuthorize("@ss.hasPermi('system:user:resetPwd')") @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.UPDATE) @PutMapping("/resetPwd") - public AjaxResult resetPwd(@RequestBody SysUser user) - { + public AjaxResult<Void> resetPwd(@RequestBody SysUser user) { userService.checkUserAllowed(user); user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); user.setUpdateBy(getUsername()); @@ -200,11 +196,11 @@ /** * 鐘舵�佷慨鏀� */ + @ApiOperation("鐘舵�佷慨鏀�") @PreAuthorize("@ss.hasPermi('system:user:edit')") @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.UPDATE) @PutMapping("/changeStatus") - public AjaxResult changeStatus(@RequestBody SysUser user) - { + public AjaxResult<Void> changeStatus(@RequestBody SysUser user) { userService.checkUserAllowed(user); user.setUpdateBy(getUsername()); return toAjax(userService.updateUserStatus(user)); @@ -213,13 +209,13 @@ /** * 鏍规嵁鐢ㄦ埛缂栧彿鑾峰彇鎺堟潈瑙掕壊 */ + @ApiOperation("鏍规嵁鐢ㄦ埛缂栧彿鑾峰彇鎺堟潈瑙掕壊") @PreAuthorize("@ss.hasPermi('system:user:query')") @GetMapping("/authRole/{userId}") - public AjaxResult authRole(@PathVariable("userId") Long userId) - { + public AjaxResult<Map<String, Object>> authRole(@PathVariable("userId") Long userId) { SysUser user = userService.selectUserById(userId); List<SysRole> roles = roleService.selectRolesByUserId(userId); - Map<String, Object> ajax = new HashMap<>(); + Map<String, Object> ajax = new HashMap<>(); ajax.put("user", user); ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); return AjaxResult.success(ajax); @@ -228,11 +224,11 @@ /** * 鐢ㄦ埛鎺堟潈瑙掕壊 */ + @ApiOperation("鐢ㄦ埛鎺堟潈瑙掕壊") @PreAuthorize("@ss.hasPermi('system:user:edit')") @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.GRANT) @PutMapping("/authRole") - public AjaxResult insertAuthRole(Long userId, Long[] roleIds) - { + public AjaxResult<Void> insertAuthRole(Long userId, Long[] roleIds) { userService.insertUserAuth(userId, roleIds); return success(); } diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index dd1c6ba..4d2da75 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -248,10 +248,12 @@ email: crazylionli@163.com url: https://gitee.com/JavaLionLi/RuoYi-Vue-Plus groups: + - name: 浠g爜鐢熸垚妯″潡 + basePackage: com.ruoyi.generator - name: 婕旂ず妗堜緥 basePackage: com.ruoyi.demo - name: 绯荤粺妯″潡 - basePackage: com.ruoyi.admin + basePackage: com.ruoyi.web # 闃叉XSS鏀诲嚮 xss: diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java index 408295a..9343a4a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java @@ -2,7 +2,6 @@ import lombok.Data; import lombok.Getter; -import lombok.NoArgsConstructor; import lombok.experimental.Accessors; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @@ -10,34 +9,42 @@ /** * 璇诲彇椤圭洰鐩稿叧閰嶇疆 * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor @Accessors(chain = true) @Component @ConfigurationProperties(prefix = "ruoyi") -public class RuoYiConfig -{ - /** 椤圭洰鍚嶇О */ +public class RuoYiConfig { + + /** + * 椤圭洰鍚嶇О + */ private String name; - /** 鐗堟湰 */ + /** + * 鐗堟湰 + */ private String version; - /** 鐗堟潈骞翠唤 */ + /** + * 鐗堟潈骞翠唤 + */ private String copyrightYear; - /** 瀹炰緥婕旂ず寮�鍏� */ + /** + * 瀹炰緥婕旂ず寮�鍏� + */ private boolean demoEnabled; - /** 鑾峰彇鍦板潃寮�鍏� */ + /** + * 鑾峰彇鍦板潃寮�鍏� + */ @Getter private static boolean addressEnabled; - public void setAddressEnabled(boolean addressEnabled) - { + public void setAddressEnabled(boolean addressEnabled) { RuoYiConfig.addressEnabled = addressEnabled; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java index 1d3c8a5..d6502db 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java @@ -61,10 +61,10 @@ "update_time", "remark", "version" }; /** Entity鍩虹被瀛楁 */ - public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" }; + public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime" }; /** Tree鍩虹被瀛楁 */ - public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" }; + public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "children" }; /** 鏂囨湰妗� */ public static final String HTML_INPUT = "input"; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java index a5a92f4..18a8d66 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java @@ -1,9 +1,10 @@ package com.ruoyi.common.core.domain; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.NoArgsConstructor; import lombok.experimental.Accessors; import java.io.Serializable; @@ -14,11 +15,10 @@ /** * Entity鍩虹被 * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor @Accessors(chain = true) public class BaseEntity implements Serializable { @@ -28,43 +28,43 @@ * 鎼滅储鍊� */ @ApiModelProperty(value = "鎼滅储鍊�") + @TableField(exist = false) private String searchValue; /** * 鍒涘缓鑰� */ @ApiModelProperty(value = "鍒涘缓鑰�") + @TableField(fill = FieldFill.INSERT) private String createBy; /** * 鍒涘缓鏃堕棿 */ @ApiModelProperty(value = "鍒涘缓鏃堕棿") + @TableField(fill = FieldFill.INSERT) private Date createTime; /** * 鏇存柊鑰� */ @ApiModelProperty(value = "鏇存柊鑰�") + @TableField(fill = FieldFill.INSERT_UPDATE) private String updateBy; /** * 鏇存柊鏃堕棿 */ @ApiModelProperty(value = "鏇存柊鏃堕棿") + @TableField(fill = FieldFill.INSERT_UPDATE) private Date updateTime; - - /** - * 澶囨敞 - */ - @ApiModelProperty(value = "澶囨敞") - private String remark; /** * 璇锋眰鍙傛暟 */ @JsonIgnore @ApiModelProperty(value = "璇锋眰鍙傛暟") + @TableField(exist = false) private Map<String, Object> params = new HashMap<>(); } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java index 8db10aa..f192263 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java @@ -1,9 +1,9 @@ package com.ruoyi.common.core.domain; +import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; import lombok.experimental.Accessors; import java.util.ArrayList; @@ -12,12 +12,11 @@ /** * Tree鍩虹被 * - * @author ruoyi + * @author Lion Li */ -@EqualsAndHashCode(callSuper = true) @Data -@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) public class TreeEntity extends BaseEntity { @@ -26,6 +25,7 @@ /** * 鐖惰彍鍗曞悕绉� */ + @TableField(exist = false) @ApiModelProperty(value = "鐖惰彍鍗曞悕绉�") private String parentName; @@ -39,17 +39,12 @@ * 鏄剧ず椤哄簭 */ @ApiModelProperty(value = "鏄剧ず椤哄簭") - private Integer orderNum; - - /** - * 绁栫骇鍒楄〃 - */ - @ApiModelProperty(value = "绁栫骇鍒楄〃") - private String ancestors; + private String orderNum; /** * 瀛愰儴闂� */ + @TableField(exist = false) @ApiModelProperty(value = "瀛愰儴闂�") private List<?> children = new ArrayList<>(); diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java index 2049486..963ac5c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java @@ -3,7 +3,10 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysMenu; -import lombok.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; import lombok.experimental.Accessors; import java.io.Serializable; @@ -12,39 +15,53 @@ /** * Treeselect鏍戠粨鏋勫疄浣撶被 - * - * @author ruoyi + * + * @author Lion Li */ @Data @NoArgsConstructor @Accessors(chain = true) -public class TreeSelect implements Serializable -{ +@ApiModel("鏍戠粨鏋勫疄浣撶被") +public class TreeSelect implements Serializable { + private static final long serialVersionUID = 1L; - /** 鑺傜偣ID */ + /** + * 鑺傜偣ID + */ + @ApiModelProperty(value = "鑺傜偣ID") private Long id; - /** 鑺傜偣鍚嶇О */ + /** + * 鑺傜偣鍚嶇О + */ + @ApiModelProperty(value = "鑺傜偣鍚嶇О") private String label; - /** 瀛愯妭鐐� */ + /** + * 瀛愯妭鐐� + */ + @ApiModelProperty(value = "瀛愯妭鐐�") @JsonInclude(JsonInclude.Include.NON_EMPTY) private List<TreeSelect> children; - public TreeSelect(SysDept dept) - { + public TreeSelect(SysDept dept) { this.id = dept.getDeptId(); this.label = dept.getDeptName(); - this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); + this.children = dept.getChildren() + .stream() + .map(d -> new TreeSelect((SysDept) d)) + .collect(Collectors.toList()); } - public TreeSelect(SysMenu menu) - { + public TreeSelect(SysMenu menu) { this.id = menu.getMenuId(); this.label = menu.getMenuName(); - this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); + this.children = menu.getChildren() + .stream() + .map(d -> new TreeSelect((SysMenu) d)) + .collect(Collectors.toList()); } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/OperLogDTO.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/OperLogDTO.java index f5132ef..773858f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/OperLogDTO.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/OperLogDTO.java @@ -8,15 +8,16 @@ import java.util.Date; /** - * 鎿嶄綔鏃ュ織璁板綍琛� oper_log + * 閫氱敤鎿嶄綔鏃ュ織瀹炰綋 * - * @author ruoyi + * @author Lion Li */ @Data @NoArgsConstructor @Accessors(chain = true) public class OperLogDTO implements Serializable { + private static final long serialVersionUID = 1L; /** diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java index 62056e0..17ff660 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java @@ -1,48 +1,44 @@ package com.ruoyi.common.core.domain.entity; -import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.core.domain.TreeEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; -import java.io.Serializable; -import java.util.*; /** * 閮ㄩ棬琛� sys_dept * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) @TableName("sys_dept") -public class SysDept implements Serializable { +@ApiModel("閮ㄩ棬涓氬姟瀵硅薄") +public class SysDept extends TreeEntity { private static final long serialVersionUID = 1L; /** * 閮ㄩ棬ID */ - @TableId(value = "dept_id", type = IdType.AUTO) + @ApiModelProperty(value = "閮ㄩ棬id") + @TableId(value = "dept_id") private Long deptId; - - /** - * 鐖堕儴闂↖D - */ - private Long parentId; - - /** - * 绁栫骇鍒楄〃 - */ - private String ancestors; /** * 閮ㄩ棬鍚嶇О */ + @ApiModelProperty(value = "閮ㄩ棬鍚嶇О") @NotBlank(message = "閮ㄩ棬鍚嶇О涓嶈兘涓虹┖") @Size(min = 0, max = 30, message = "閮ㄩ棬鍚嶇О闀垮害涓嶈兘瓒呰繃30涓瓧绗�") private String deptName; @@ -50,23 +46,27 @@ /** * 鏄剧ず椤哄簭 */ + @ApiModelProperty(value = "鏄剧ず椤哄簭") @NotBlank(message = "鏄剧ず椤哄簭涓嶈兘涓虹┖") private String orderNum; /** * 璐熻矗浜� */ + @ApiModelProperty(value = "璐熻矗浜�") private String leader; /** * 鑱旂郴鐢佃瘽 */ + @ApiModelProperty(value = "鑱旂郴鐢佃瘽") @Size(min = 0, max = 11, message = "鑱旂郴鐢佃瘽闀垮害涓嶈兘瓒呰繃11涓瓧绗�") private String phone; /** * 閭 */ + @ApiModelProperty(value = "閭") @Email(message = "閭鏍煎紡涓嶆纭�") @Size(min = 0, max = 50, message = "閭闀垮害涓嶈兘瓒呰繃50涓瓧绗�") private String email; @@ -74,54 +74,20 @@ /** * 閮ㄩ棬鐘舵��:0姝e父,1鍋滅敤 */ + @ApiModelProperty(value = "閮ㄩ棬鐘舵��:0姝e父,1鍋滅敤") private String status; /** * 鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛� */ + @ApiModelProperty(value = "鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛�") @TableLogic private String delFlag; /** - * 鐖堕儴闂ㄥ悕绉� + * 绁栫骇鍒楄〃 */ - @TableField(exist = false) - private String parentName; - - /** - * 鍒涘缓鑰� - */ - @TableField(fill = FieldFill.INSERT) - private String createBy; - - /** - * 鍒涘缓鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT) - private Date createTime; - - /** - * 鏇存柊鑰� - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updateBy; - - /** - * 鏇存柊鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateTime; - - /** - * 瀛愰儴闂� - */ - @TableField(exist = false) - private List<SysDept> children = new ArrayList<SysDept>(); - - /** - * 璇锋眰鍙傛暟 - */ - @TableField(exist = false) - private Map<String, Object> params = new HashMap<>(); + @ApiModelProperty(value = "绁栫骇鍒楄〃") + private String ancestors; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java index 89ee1c1..3c572bd 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java @@ -2,51 +2,54 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; -import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.annotation.ExcelDictFormat; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.convert.ExcelDictConvert; +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; /** * 瀛楀吀鏁版嵁琛� sys_dict_data * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) @TableName("sys_dict_data") @ExcelIgnoreUnannotated -public class SysDictData implements Serializable { - private static final long serialVersionUID = 1L; +@ApiModel("瀛楀吀鏁版嵁涓氬姟瀵硅薄") +public class SysDictData extends BaseEntity { /** * 瀛楀吀缂栫爜 */ + @ApiModelProperty(value = "瀛楀吀缂栫爜") @ExcelProperty(value = "瀛楀吀缂栫爜") - @TableId(value = "dict_code", type = IdType.AUTO) + @TableId(value = "dict_code") private Long dictCode; /** * 瀛楀吀鎺掑簭 */ + @ApiModelProperty(value = "瀛楀吀鎺掑簭") @ExcelProperty(value = "瀛楀吀鎺掑簭") private Long dictSort; /** * 瀛楀吀鏍囩 */ + @ApiModelProperty(value = "瀛楀吀鏍囩") @ExcelProperty(value = "瀛楀吀鏍囩") @NotBlank(message = "瀛楀吀鏍囩涓嶈兘涓虹┖") @Size(min = 0, max = 100, message = "瀛楀吀鏍囩闀垮害涓嶈兘瓒呰繃100涓瓧绗�") @@ -55,6 +58,7 @@ /** * 瀛楀吀閿�� */ + @ApiModelProperty(value = "瀛楀吀閿��") @ExcelProperty(value = "瀛楀吀閿��") @NotBlank(message = "瀛楀吀閿�间笉鑳戒负绌�") @Size(min = 0, max = 100, message = "瀛楀吀閿�奸暱搴︿笉鑳借秴杩�100涓瓧绗�") @@ -63,6 +67,7 @@ /** * 瀛楀吀绫诲瀷 */ + @ApiModelProperty(value = "瀛楀吀绫诲瀷") @ExcelProperty(value = "瀛楀吀绫诲瀷") @NotBlank(message = "瀛楀吀绫诲瀷涓嶈兘涓虹┖") @Size(min = 0, max = 100, message = "瀛楀吀绫诲瀷闀垮害涓嶈兘瓒呰繃100涓瓧绗�") @@ -71,17 +76,20 @@ /** * 鏍峰紡灞炴�э紙鍏朵粬鏍峰紡鎵╁睍锛� */ + @ApiModelProperty(value = "鏍峰紡灞炴�э紙鍏朵粬鏍峰紡鎵╁睍锛�") @Size(min = 0, max = 100, message = "鏍峰紡灞炴�ч暱搴︿笉鑳借秴杩�100涓瓧绗�") private String cssClass; /** * 琛ㄦ牸瀛楀吀鏍峰紡 */ + @ApiModelProperty(value = "琛ㄦ牸瀛楀吀鏍峰紡") private String listClass; /** * 鏄惁榛樿锛圷鏄� N鍚︼級 */ + @ApiModelProperty(value = "鏄惁榛樿锛圷鏄� N鍚︼級") @ExcelProperty(value = "鏄惁榛樿", converter = ExcelDictConvert.class) @ExcelDictFormat(dictType = "sys_yes_no") private String isDefault; @@ -89,47 +97,19 @@ /** * 鐘舵�侊紙0姝e父 1鍋滅敤锛� */ + @ApiModelProperty(value = "鐘舵�侊紙0姝e父 1鍋滅敤锛�") @ExcelProperty(value = "鐘舵��", converter = ExcelDictConvert.class) @ExcelDictFormat(dictType = "sys_normal_disable") private String status; /** - * 鍒涘缓鑰� - */ - @TableField(fill = FieldFill.INSERT) - private String createBy; - - /** - * 鍒涘缓鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT) - private Date createTime; - - /** - * 鏇存柊鑰� - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updateBy; - - /** - * 鏇存柊鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateTime; - - /** * 澶囨敞 */ + @ApiModelProperty(value = "澶囨敞") private String remark; - /** - * 璇锋眰鍙傛暟 - */ - @TableField(exist = false) - private Map<String, Object> params = new HashMap<>(); - public boolean getDefault() { - return UserConstants.YES.equals(this.isDefault) ? true : false; + return UserConstants.YES.equals(this.isDefault); } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java index 35d9a60..c6c9b1a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java @@ -2,44 +2,46 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; -import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.annotation.ExcelDictFormat; import com.ruoyi.common.convert.ExcelDictConvert; +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; /** * 瀛楀吀绫诲瀷琛� sys_dict_type * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) @TableName("sys_dict_type") @ExcelIgnoreUnannotated -public class SysDictType implements Serializable { - private static final long serialVersionUID = 1L; +@ApiModel("瀛楀吀绫诲瀷涓氬姟瀵硅薄") +public class SysDictType extends BaseEntity { /** * 瀛楀吀涓婚敭 */ + @ApiModelProperty(value = "瀛楀吀涓婚敭") @ExcelProperty(value = "瀛楀吀涓婚敭") - @TableId(value = "dict_id", type = IdType.AUTO) + @TableId(value = "dict_id") private Long dictId; /** * 瀛楀吀鍚嶇О */ + @ApiModelProperty(value = "瀛楀吀鍚嶇О") @ExcelProperty(value = "瀛楀吀鍚嶇О") @NotBlank(message = "瀛楀吀鍚嶇О涓嶈兘涓虹┖") @Size(min = 0, max = 100, message = "瀛楀吀绫诲瀷鍚嶇О闀垮害涓嶈兘瓒呰繃100涓瓧绗�") @@ -48,6 +50,7 @@ /** * 瀛楀吀绫诲瀷 */ + @ApiModelProperty(value = "瀛楀吀绫诲瀷") @ExcelProperty(value = "瀛楀吀绫诲瀷") @NotBlank(message = "瀛楀吀绫诲瀷涓嶈兘涓虹┖") @Size(min = 0, max = 100, message = "瀛楀吀绫诲瀷绫诲瀷闀垮害涓嶈兘瓒呰繃100涓瓧绗�") @@ -56,43 +59,15 @@ /** * 鐘舵�侊紙0姝e父 1鍋滅敤锛� */ + @ApiModelProperty(value = "鐘舵�侊紙0姝e父 1鍋滅敤锛�") @ExcelProperty(value = "鐘舵��", converter = ExcelDictConvert.class) @ExcelDictFormat(dictType = "sys_normal_disable") private String status; /** - * 鍒涘缓鑰� - */ - @TableField(fill = FieldFill.INSERT) - private String createBy; - - /** - * 鍒涘缓鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT) - private Date createTime; - - /** - * 鏇存柊鑰� - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updateBy; - - /** - * 鏇存柊鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateTime; - - /** * 澶囨敞 */ + @ApiModelProperty(value = "澶囨敞") private String remark; - - /** - * 璇锋眰鍙傛暟 - */ - @TableField(exist = false) - private Map<String, Object> params = new HashMap<>(); } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java index d2c5bbf..30d074b 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java @@ -1,154 +1,120 @@ package com.ruoyi.common.core.domain.entity; -import com.baomidou.mybatisplus.annotation.*; -import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.core.domain.TreeEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; -import java.io.Serializable; -import java.util.*; /** * 鑿滃崟鏉冮檺琛� sys_menu * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) @TableName("sys_menu") -public class SysMenu implements Serializable { - private static final long serialVersionUID = 1L; +@ApiModel("鑿滃崟鏉冮檺涓氬姟瀵硅薄") +public class SysMenu extends TreeEntity { /** * 鑿滃崟ID */ - @TableId(value = "menu_id", type = IdType.AUTO) + @ApiModelProperty(value = "鑿滃崟ID") + @TableId(value = "menu_id") private Long menuId; /** * 鑿滃崟鍚嶇О */ + @ApiModelProperty(value = "鑿滃崟鍚嶇О") @NotBlank(message = "鑿滃崟鍚嶇О涓嶈兘涓虹┖") @Size(min = 0, max = 50, message = "鑿滃崟鍚嶇О闀垮害涓嶈兘瓒呰繃50涓瓧绗�") private String menuName; /** - * 鐖惰彍鍗曞悕绉� - */ - @TableField(exist = false) - private String parentName; - - /** - * 鐖惰彍鍗旾D - */ - private Long parentId; - - /** * 鏄剧ず椤哄簭 */ + @ApiModelProperty(value = "鏄剧ず椤哄簭") @NotBlank(message = "鏄剧ず椤哄簭涓嶈兘涓虹┖") private String orderNum; /** * 璺敱鍦板潃 */ + @ApiModelProperty(value = "璺敱鍦板潃") @Size(min = 0, max = 200, message = "璺敱鍦板潃涓嶈兘瓒呰繃200涓瓧绗�") private String path; /** * 缁勪欢璺緞 */ + @ApiModelProperty(value = "缁勪欢璺緞") @Size(min = 0, max = 200, message = "缁勪欢璺緞涓嶈兘瓒呰繃255涓瓧绗�") private String component; /** * 璺敱鍙傛暟 */ + @ApiModelProperty(value = "璺敱鍙傛暟") private String query; /** * 鏄惁涓哄閾撅紙0鏄� 1鍚︼級 */ + @ApiModelProperty(value = "鏄惁涓哄閾撅紙0鏄� 1鍚︼級") private String isFrame; /** * 鏄惁缂撳瓨锛�0缂撳瓨 1涓嶇紦瀛橈級 */ + @ApiModelProperty(value = "鏄惁缂撳瓨锛�0缂撳瓨 1涓嶇紦瀛橈級") private String isCache; /** * 绫诲瀷锛圡鐩綍 C鑿滃崟 F鎸夐挳锛� */ + @ApiModelProperty(value = "绫诲瀷锛圡鐩綍 C鑿滃崟 F鎸夐挳锛�") @NotBlank(message = "鑿滃崟绫诲瀷涓嶈兘涓虹┖") private String menuType; /** * 鏄剧ず鐘舵�侊紙0鏄剧ず 1闅愯棌锛� */ + @ApiModelProperty(value = "鏄剧ず鐘舵�侊紙0鏄剧ず 1闅愯棌锛�") private String visible; /** * 鑿滃崟鐘舵�侊紙0鏄剧ず 1闅愯棌锛� */ + @ApiModelProperty(value = "鑿滃崟鐘舵�侊紙0鏄剧ず 1闅愯棌锛�") private String status; /** * 鏉冮檺瀛楃涓� */ + @ApiModelProperty(value = "鏉冮檺瀛楃涓�") @Size(min = 0, max = 100, message = "鏉冮檺鏍囪瘑闀垮害涓嶈兘瓒呰繃100涓瓧绗�") private String perms; /** * 鑿滃崟鍥炬爣 */ + @ApiModelProperty(value = "鑿滃崟鍥炬爣") private String icon; - - /** - * 鍒涘缓鑰� - */ - @TableField(fill = FieldFill.INSERT) - private String createBy; - - /** - * 鍒涘缓鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - - /** - * 鏇存柊鑰� - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updateBy; - - /** - * 鏇存柊鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date updateTime; /** * 澶囨敞 */ + @ApiModelProperty(value = "澶囨敞") private String remark; - - /** - * 璇锋眰鍙傛暟 - */ - @TableField(exist = false) - private Map<String, Object> params = new HashMap<>(); - - /** - * 瀛愯彍鍗� - */ - @TableField(exist = false) - private List<SysMenu> children = new ArrayList<SysMenu>(); } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java index 5163524..1d186db 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java @@ -2,44 +2,48 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; -import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.annotation.ExcelDictFormat; import com.ruoyi.common.convert.ExcelDictConvert; +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; /** * 瑙掕壊琛� sys_role * - * @author ruoyi + * @author Lion Li */ @Data @NoArgsConstructor +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) @TableName("sys_role") @ExcelIgnoreUnannotated -public class SysRole implements Serializable { - private static final long serialVersionUID = 1L; +public class SysRole extends BaseEntity { /** * 瑙掕壊ID */ + @ApiModelProperty(value = "瑙掕壊ID") @ExcelProperty(value = "瑙掕壊搴忓彿") - @TableId(value = "role_id", type = IdType.AUTO) + @TableId(value = "role_id") private Long roleId; /** * 瑙掕壊鍚嶇О */ + @ApiModelProperty(value = "瑙掕壊鍚嶇О") @ExcelProperty(value = "瑙掕壊鍚嶇О") @NotBlank(message = "瑙掕壊鍚嶇О涓嶈兘涓虹┖") @Size(min = 0, max = 30, message = "瑙掕壊鍚嶇О闀垮害涓嶈兘瓒呰繃30涓瓧绗�") @@ -48,6 +52,7 @@ /** * 瑙掕壊鏉冮檺 */ + @ApiModelProperty(value = "瑙掕壊鏉冮檺") @ExcelProperty(value = "瑙掕壊鏉冮檺") @NotBlank(message = "鏉冮檺瀛楃涓嶈兘涓虹┖") @Size(min = 0, max = 100, message = "鏉冮檺瀛楃闀垮害涓嶈兘瓒呰繃100涓瓧绗�") @@ -56,6 +61,7 @@ /** * 瑙掕壊鎺掑簭 */ + @ApiModelProperty(value = "瑙掕壊鎺掑簭") @ExcelProperty(value = "瑙掕壊鎺掑簭") @NotBlank(message = "鏄剧ず椤哄簭涓嶈兘涓虹┖") private String roleSort; @@ -63,6 +69,7 @@ /** * 鏁版嵁鑼冨洿锛�1锛氭墍鏈夋暟鎹潈闄愶紱2锛氳嚜瀹氫箟鏁版嵁鏉冮檺锛�3锛氭湰閮ㄩ棬鏁版嵁鏉冮檺锛�4锛氭湰閮ㄩ棬鍙婁互涓嬫暟鎹潈闄愶紱5锛氫粎鏈汉鏁版嵁鏉冮檺锛� */ + @ApiModelProperty(value = "鏁版嵁鑼冨洿锛�1锛氭墍鏈夋暟鎹潈闄愶紱2锛氳嚜瀹氫箟鏁版嵁鏉冮檺锛�3锛氭湰閮ㄩ棬鏁版嵁鏉冮檺锛�4锛氭湰閮ㄩ棬鍙婁互涓嬫暟鎹潈闄愶紱5锛氫粎鏈汉鏁版嵁鏉冮檺锛�") @ExcelProperty(value = "鏁版嵁鑼冨洿", converter = ExcelDictConvert.class) @ExcelDictFormat(readConverterExp = "1=鎵�鏈夋暟鎹潈闄�,2=鑷畾涔夋暟鎹潈闄�,3=鏈儴闂ㄦ暟鎹潈闄�,4=鏈儴闂ㄥ強浠ヤ笅鏁版嵁鏉冮檺,5=浠呮湰浜烘暟鎹潈闄�") private String dataScope; @@ -70,16 +77,19 @@ /** * 鑿滃崟鏍戦�夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙 0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀猴級 */ + @ApiModelProperty(value = "鑿滃崟鏍戦�夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙 0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀猴級") private boolean menuCheckStrictly; /** * 閮ㄩ棬鏍戦�夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀� 锛� */ + @ApiModelProperty(value = "閮ㄩ棬鏍戦�夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀� 锛�") private boolean deptCheckStrictly; /** * 瑙掕壊鐘舵�侊紙0姝e父 1鍋滅敤锛� */ + @ApiModelProperty(value = "瑙掕壊鐘舵�侊紙0姝e父 1鍋滅敤锛�") @ExcelProperty(value = "瑙掕壊鐘舵��", converter = ExcelDictConvert.class) @ExcelDictFormat(dictType = "sys_common_status") private String status; @@ -87,59 +97,34 @@ /** * 鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛� */ + @ApiModelProperty(value = "鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛�") @TableLogic private String delFlag; /** - * 鍒涘缓鑰� - */ - @TableField(fill = FieldFill.INSERT) - private String createBy; - - /** - * 鍒涘缓鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT) - private Date createTime; - - /** - * 鏇存柊鑰� - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updateBy; - - /** - * 鏇存柊鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateTime; - - /** * 澶囨敞 */ + @ApiModelProperty(value = "澶囨敞") private String remark; - - /** - * 璇锋眰鍙傛暟 - */ - @TableField(exist = false) - private Map<String, Object> params = new HashMap<>(); /** * 鐢ㄦ埛鏄惁瀛樺湪姝よ鑹叉爣璇� 榛樿涓嶅瓨鍦� */ + @ApiModelProperty(value = "鐢ㄦ埛鏄惁瀛樺湪姝よ鑹叉爣璇� 榛樿涓嶅瓨鍦�") @TableField(exist = false) private boolean flag = false; /** * 鑿滃崟缁� */ + @ApiModelProperty(value = "鑿滃崟缁�") @TableField(exist = false) private Long[] menuIds; /** * 閮ㄩ棬缁勶紙鏁版嵁鏉冮檺锛� */ + @ApiModelProperty(value = "閮ㄩ棬缁勶紙鏁版嵁鏉冮檺锛�") @TableField(exist = false) private Long[] deptIds; @@ -147,6 +132,7 @@ this.roleId = roleId; } + @ApiModelProperty(value = "鏄惁绠$悊鍛�") public boolean isAdmin() { return isAdmin(this.roleId); } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java index 7709981..2fa57f5 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java @@ -3,46 +3,51 @@ import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; -import java.io.Serializable; import java.util.Date; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** * 鐢ㄦ埛瀵硅薄 sys_user * - * @author ruoyi + * @author Lion Li */ @Data @NoArgsConstructor +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) @TableName("sys_user") -public class SysUser implements Serializable { - private static final long serialVersionUID = 1L; +@ApiModel("鐢ㄦ埛淇℃伅涓氬姟瀵硅薄") +public class SysUser extends BaseEntity { /** * 鐢ㄦ埛ID */ - @TableId(value = "user_id", type = IdType.AUTO) + @ApiModelProperty(value = "鐢ㄦ埛ID") + @TableId(value = "user_id") private Long userId; /** * 閮ㄩ棬ID */ + @ApiModelProperty(value = "閮ㄩ棬ID") private Long deptId; /** * 鐢ㄦ埛璐﹀彿 */ + @ApiModelProperty(value = "鐢ㄦ埛璐﹀彿") @NotBlank(message = "鐢ㄦ埛璐﹀彿涓嶈兘涓虹┖") @Size(min = 0, max = 30, message = "鐢ㄦ埛璐﹀彿闀垮害涓嶈兘瓒呰繃30涓瓧绗�") private String userName; @@ -50,12 +55,14 @@ /** * 鐢ㄦ埛鏄电О */ + @ApiModelProperty(value = "鐢ㄦ埛鏄电О") @Size(min = 0, max = 30, message = "鐢ㄦ埛鏄电О闀垮害涓嶈兘瓒呰繃30涓瓧绗�") private String nickName; /** * 鐢ㄦ埛閭 */ + @ApiModelProperty(value = "鐢ㄦ埛閭") @Email(message = "閭鏍煎紡涓嶆纭�") @Size(min = 0, max = 50, message = "閭闀垮害涓嶈兘瓒呰繃50涓瓧绗�") private String email; @@ -63,21 +70,25 @@ /** * 鎵嬫満鍙风爜 */ + @ApiModelProperty(value = "鎵嬫満鍙风爜") private String phonenumber; /** * 鐢ㄦ埛鎬у埆 */ + @ApiModelProperty(value = "鐢ㄦ埛鎬у埆") private String sex; /** * 鐢ㄦ埛澶村儚 */ + @ApiModelProperty(value = "鐢ㄦ埛澶村儚") private String avatar; /** * 瀵嗙爜 */ + @ApiModelProperty(value = "瀵嗙爜") @TableField( insertStrategy = FieldStrategy.NOT_EMPTY, updateStrategy = FieldStrategy.NOT_EMPTY, @@ -94,86 +105,66 @@ /** * 甯愬彿鐘舵�侊紙0姝e父 1鍋滅敤锛� */ + @ApiModelProperty(value = "甯愬彿鐘舵�侊紙0姝e父 1鍋滅敤锛�") private String status; /** * 鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛� */ + @ApiModelProperty(value = "鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛�") @TableLogic private String delFlag; /** * 鏈�鍚庣櫥褰旾P */ + @ApiModelProperty(value = "鏈�鍚庣櫥褰旾P") private String loginIp; /** * 鏈�鍚庣櫥褰曟椂闂� */ + @ApiModelProperty(value = "鏈�鍚庣櫥褰曟椂闂�") private Date loginDate; - - /** - * 鍒涘缓鑰� - */ - @TableField(fill = FieldFill.INSERT) - private String createBy; - - /** - * 鍒涘缓鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT) - private Date createTime; - - /** - * 鏇存柊鑰� - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updateBy; - - /** - * 鏇存柊鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateTime; /** * 澶囨敞 */ + @ApiModelProperty(value = "澶囨敞") private String remark; - - /** - * 璇锋眰鍙傛暟 - */ - @TableField(exist = false) - private Map<String, Object> params = new HashMap<>(); /** * 閮ㄩ棬瀵硅薄 */ + @ApiModelProperty(value = "閮ㄩ棬瀵硅薄") @TableField(exist = false) private SysDept dept; /** * 瑙掕壊瀵硅薄 */ + @ApiModelProperty(value = "瑙掕壊瀵硅薄") @TableField(exist = false) private List<SysRole> roles; /** * 瑙掕壊缁� */ + @ApiModelProperty(value = "瑙掕壊缁�") @TableField(exist = false) private Long[] roleIds; /** * 宀椾綅缁� */ + @ApiModelProperty(value = "宀椾綅缁�") @TableField(exist = false) private Long[] postIds; /** * 瑙掕壊ID */ + @ApiModelProperty(value = "瑙掕壊ID") @TableField(exist = false) private Long roleId; @@ -181,6 +172,7 @@ this.userId = userId; } + @ApiModelProperty(value = "鏄惁绠$悊鍛�") public boolean isAdmin() { return isAdmin(this.userId); } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java index ae2c9e2..d470536 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java @@ -1,37 +1,43 @@ package com.ruoyi.common.core.domain.model; -import lombok.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; import lombok.experimental.Accessors; /** * 鐢ㄦ埛鐧诲綍瀵硅薄 - * - * @author ruoyi + * + * @author Lion Li */ @Data -@NoArgsConstructor @Accessors(chain = true) -public class LoginBody -{ +@ApiModel("鐢ㄦ埛鐧诲綍瀵硅薄") +public class LoginBody { + /** * 鐢ㄦ埛鍚� */ + @ApiModelProperty(value = "鐢ㄦ埛鍚�") private String username; /** * 鐢ㄦ埛瀵嗙爜 */ + @ApiModelProperty(value = "鐢ㄦ埛瀵嗙爜") private String password; /** * 楠岃瘉鐮� */ + @ApiModelProperty(value = "楠岃瘉鐮�") private String code; /** * 鍞竴鏍囪瘑 */ + @ApiModelProperty(value = "鍞竴鏍囪瘑") private String uuid = ""; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java index 7bc072a..9f7727a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java @@ -2,7 +2,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.ruoyi.common.core.domain.entity.SysUser; -import lombok.*; +import lombok.Data; +import lombok.NoArgsConstructor; import lombok.experimental.Accessors; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; @@ -13,14 +14,14 @@ /** * 鐧诲綍鐢ㄦ埛韬唤鏉冮檺 * - * @author ruoyi + * @author Lion Li */ @Data @NoArgsConstructor @Accessors(chain = true) -public class LoginUser implements UserDetails -{ +public class LoginUser implements UserDetails { + private static final long serialVersionUID = 1L; /** @@ -78,14 +79,12 @@ */ private SysUser user; - public LoginUser(SysUser user, Set<String> permissions) - { + public LoginUser(SysUser user, Set<String> permissions) { this.user = user; this.permissions = permissions; } - public LoginUser(Long userId, Long deptId, SysUser user, Set<String> permissions) - { + public LoginUser(Long userId, Long deptId, SysUser user, Set<String> permissions) { this.userId = userId; this.deptId = deptId; this.user = user; @@ -94,14 +93,12 @@ @JsonIgnore @Override - public String getPassword() - { + public String getPassword() { return user.getPassword(); } @Override - public String getUsername() - { + public String getUsername() { return user.getUserName(); } @@ -110,50 +107,39 @@ */ @JsonIgnore @Override - public boolean isAccountNonExpired() - { + public boolean isAccountNonExpired() { return true; } /** * 鎸囧畾鐢ㄦ埛鏄惁瑙i攣,閿佸畾鐨勭敤鎴锋棤娉曡繘琛岃韩浠介獙璇� - * - * @return */ @JsonIgnore @Override - public boolean isAccountNonLocked() - { + public boolean isAccountNonLocked() { return true; } /** * 鎸囩ず鏄惁宸茶繃鏈熺殑鐢ㄦ埛鐨勫嚟鎹�(瀵嗙爜),杩囨湡鐨勫嚟鎹槻姝㈣璇� - * - * @return */ @JsonIgnore @Override - public boolean isCredentialsNonExpired() - { + public boolean isCredentialsNonExpired() { return true; } /** * 鏄惁鍙敤 ,绂佺敤鐨勭敤鎴蜂笉鑳借韩浠介獙璇� - * - * @return */ @JsonIgnore @Override - public boolean isEnabled() - { + public boolean isEnabled() { return true; } @Override - public Collection<? extends GrantedAuthority> getAuthorities() - { + public Collection<? extends GrantedAuthority> getAuthorities() { return null; } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/RegisterBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/RegisterBody.java index 5baa887..ce6c385 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/RegisterBody.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/RegisterBody.java @@ -1,11 +1,13 @@ package com.ruoyi.common.core.domain.model; +import io.swagger.annotations.ApiModel; + /** * 鐢ㄦ埛娉ㄥ唽瀵硅薄 - * - * @author ruoyi + * + * @author Lion Li */ -public class RegisterBody extends LoginBody -{ +@ApiModel("鐢ㄦ埛娉ㄥ唽瀵硅薄") +public class RegisterBody extends LoginBody { } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java index cc4cd14..92c522f 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java @@ -7,67 +7,67 @@ /** * 璇诲彇浠g爜鐢熸垚鐩稿叧閰嶇疆 - * + * * @author ruoyi */ @Component @ConfigurationProperties(prefix = "gen") -@PropertySource(value = { "classpath:generator.yml" }) -public class GenConfig -{ - /** 浣滆�� */ +@PropertySource(value = {"classpath:generator.yml"}) +public class GenConfig { + + /** + * 浣滆�� + */ public static String author; - /** 鐢熸垚鍖呰矾寰� */ + /** + * 鐢熸垚鍖呰矾寰� + */ public static String packageName; - /** 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸false */ + /** + * 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸false + */ public static boolean autoRemovePre; - /** 琛ㄥ墠缂�(绫诲悕涓嶄細鍖呭惈琛ㄥ墠缂�) */ + /** + * 琛ㄥ墠缂�(绫诲悕涓嶄細鍖呭惈琛ㄥ墠缂�) + */ public static String tablePrefix; - public static String getAuthor() - { + public static String getAuthor() { return author; } @Value("${author}") - public void setAuthor(String author) - { + public void setAuthor(String author) { GenConfig.author = author; } - public static String getPackageName() - { + public static String getPackageName() { return packageName; } @Value("${packageName}") - public void setPackageName(String packageName) - { + public void setPackageName(String packageName) { GenConfig.packageName = packageName; } - public static boolean getAutoRemovePre() - { + public static boolean getAutoRemovePre() { return autoRemovePre; } @Value("${autoRemovePre}") - public void setAutoRemovePre(boolean autoRemovePre) - { + public void setAutoRemovePre(boolean autoRemovePre) { GenConfig.autoRemovePre = autoRemovePre; } - public static String getTablePrefix() - { + public static String getTablePrefix() { return tablePrefix; } @Value("${tablePrefix}") - public void setTablePrefix(String tablePrefix) - { + public void setTablePrefix(String tablePrefix) { GenConfig.tablePrefix = tablePrefix; } } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java index 5343834..649d1dc 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java @@ -10,6 +10,9 @@ import com.ruoyi.generator.domain.GenTableColumn; import com.ruoyi.generator.service.IGenTableColumnService; import com.ruoyi.generator.service.IGenTableService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import org.apache.commons.io.IOUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; @@ -24,36 +27,36 @@ /** * 浠g爜鐢熸垚 鎿嶄綔澶勭悊 - * - * @author ruoyi + * + * @author Lion Li */ +@Validated +@Api(value = "浠g爜鐢熸垚", tags = {"浠g爜鐢熸垚绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/tool/gen") -public class GenController extends BaseController -{ - @Autowired - private IGenTableService genTableService; +public class GenController extends BaseController { - @Autowired - private IGenTableColumnService genTableColumnService; + private final IGenTableService genTableService; + private final IGenTableColumnService genTableColumnService; /** * 鏌ヨ浠g爜鐢熸垚鍒楄〃 */ + @ApiOperation("鏌ヨ浠g爜鐢熸垚鍒楄〃") @PreAuthorize("@ss.hasPermi('tool:gen:list')") @GetMapping("/list") - public TableDataInfo genList(GenTable genTable) - { + public TableDataInfo<GenTable> genList(GenTable genTable) { return genTableService.selectPageGenTableList(genTable); } /** * 淇敼浠g爜鐢熸垚涓氬姟 */ + @ApiOperation("淇敼浠g爜鐢熸垚涓氬姟") @PreAuthorize("@ss.hasPermi('tool:gen:query')") @GetMapping(value = "/{talbleId}") - public AjaxResult getInfo(@PathVariable Long talbleId) - { + public AjaxResult<Map<String, Object>> getInfo(@PathVariable Long talbleId) { GenTable table = genTableService.selectGenTableById(talbleId); List<GenTable> tables = genTableService.selectGenTableAll(); List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(talbleId); @@ -67,21 +70,21 @@ /** * 鏌ヨ鏁版嵁搴撳垪琛� */ + @ApiOperation("鏌ヨ鏁版嵁搴撳垪琛�") @PreAuthorize("@ss.hasPermi('tool:gen:list')") @GetMapping("/db/list") - public TableDataInfo dataList(GenTable genTable) - { + public TableDataInfo<GenTable> dataList(GenTable genTable) { return genTableService.selectPageDbTableList(genTable); } /** * 鏌ヨ鏁版嵁琛ㄥ瓧娈靛垪琛� */ + @ApiOperation("鏌ヨ鏁版嵁琛ㄥ瓧娈靛垪琛�") @PreAuthorize("@ss.hasPermi('tool:gen:list')") @GetMapping(value = "/column/{talbleId}") - public TableDataInfo columnList(Long tableId) - { - TableDataInfo dataInfo = new TableDataInfo(); + public TableDataInfo<GenTableColumn> columnList(Long tableId) { + TableDataInfo<GenTableColumn> dataInfo = new TableDataInfo<>(); List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId); dataInfo.setRows(list); dataInfo.setTotal(list.size()); @@ -91,11 +94,11 @@ /** * 瀵煎叆琛ㄧ粨鏋勶紙淇濆瓨锛� */ + @ApiOperation("瀵煎叆琛ㄧ粨鏋勶紙淇濆瓨锛�") @PreAuthorize("@ss.hasPermi('tool:gen:import')") @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.IMPORT) @PostMapping("/importTable") - public AjaxResult importTableSave(String tables) - { + public AjaxResult<Void> importTableSave(String tables) { String[] tableNames = Convert.toStrArray(tables); // 鏌ヨ琛ㄤ俊鎭� List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames); @@ -106,11 +109,11 @@ /** * 淇敼淇濆瓨浠g爜鐢熸垚涓氬姟 */ + @ApiOperation("淇敼淇濆瓨浠g爜鐢熸垚涓氬姟") @PreAuthorize("@ss.hasPermi('tool:gen:edit')") @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult editSave(@Validated @RequestBody GenTable genTable) - { + public AjaxResult<Void> editSave(@Validated @RequestBody GenTable genTable) { genTableService.validateEdit(genTable); genTableService.updateGenTable(genTable); return AjaxResult.success(); @@ -119,11 +122,11 @@ /** * 鍒犻櫎浠g爜鐢熸垚 */ + @ApiOperation("鍒犻櫎浠g爜鐢熸垚") @PreAuthorize("@ss.hasPermi('tool:gen:remove')") @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.DELETE) @DeleteMapping("/{tableIds}") - public AjaxResult remove(@PathVariable Long[] tableIds) - { + public AjaxResult<Void> remove(@PathVariable Long[] tableIds) { genTableService.deleteGenTableByIds(tableIds); return AjaxResult.success(); } @@ -131,10 +134,10 @@ /** * 棰勮浠g爜 */ + @ApiOperation("棰勮浠g爜") @PreAuthorize("@ss.hasPermi('tool:gen:preview')") @GetMapping("/preview/{tableId}") - public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException - { + public AjaxResult<Map<String, String>> preview(@PathVariable("tableId") Long tableId) throws IOException { Map<String, String> dataMap = genTableService.previewCode(tableId); return AjaxResult.success(dataMap); } @@ -142,11 +145,11 @@ /** * 鐢熸垚浠g爜锛堜笅杞芥柟寮忥級 */ + @ApiOperation("鐢熸垚浠g爜锛堜笅杞芥柟寮忥級") @PreAuthorize("@ss.hasPermi('tool:gen:code')") @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE) @GetMapping("/download/{tableName}") - public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException - { + public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException { byte[] data = genTableService.downloadCode(tableName); genCode(response, data); } @@ -154,11 +157,11 @@ /** * 鐢熸垚浠g爜锛堣嚜瀹氫箟璺緞锛� */ + @ApiOperation("鐢熸垚浠g爜锛堣嚜瀹氫箟璺緞锛�") @PreAuthorize("@ss.hasPermi('tool:gen:code')") @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE) @GetMapping("/genCode/{tableName}") - public AjaxResult genCode(@PathVariable("tableName") String tableName) - { + public AjaxResult<Void> genCode(@PathVariable("tableName") String tableName) { genTableService.generatorCode(tableName); return AjaxResult.success(); } @@ -166,11 +169,11 @@ /** * 鍚屾鏁版嵁搴� */ + @ApiOperation("鍚屾鏁版嵁搴�") @PreAuthorize("@ss.hasPermi('tool:gen:edit')") @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.UPDATE) @GetMapping("/synchDb/{tableName}") - public AjaxResult synchDb(@PathVariable("tableName") String tableName) - { + public AjaxResult<Void> synchDb(@PathVariable("tableName") String tableName) { genTableService.synchDb(tableName); return AjaxResult.success(); } @@ -178,11 +181,11 @@ /** * 鎵归噺鐢熸垚浠g爜 */ + @ApiOperation("鎵归噺鐢熸垚浠g爜") @PreAuthorize("@ss.hasPermi('tool:gen:code')") @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE) @GetMapping("/batchGenCode") - public void batchGenCode(HttpServletResponse response, String tables) throws IOException - { + public void batchGenCode(HttpServletResponse response, String tables) throws IOException { String[] tableNames = Convert.toStrArray(tables); byte[] data = genTableService.downloadCode(tableNames); genCode(response, data); @@ -191,8 +194,7 @@ /** * 鐢熸垚zip鏂囦欢 */ - private void genCode(HttpServletResponse response, byte[] data) throws IOException - { + private void genCode(HttpServletResponse response, byte[] data) throws IOException { response.reset(); response.addHeader("Access-Control-Allow-Origin", "*"); response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java index 5d3217c..252f32c 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java @@ -1,38 +1,36 @@ package com.ruoyi.generator.domain; -import com.ruoyi.common.utils.StringUtils; -import com.baomidou.mybatisplus.annotation.*; -import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.constant.GenConstants; -import lombok.*; +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.utils.StringUtils; +import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import org.apache.commons.lang3.ArrayUtils; import javax.validation.Valid; import javax.validation.constraints.NotBlank; -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** * 涓氬姟琛� gen_table * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) @TableName("gen_table") -public class GenTable implements Serializable { - private static final long serialVersionUID = 1L; +public class GenTable extends BaseEntity { /** * 缂栧彿 */ - @TableId(value = "table_id", type = IdType.AUTO) + @TableId(value = "table_id") private Long tableId; /** @@ -133,41 +131,9 @@ private String options; /** - * 鍒涘缓鑰� - */ - @TableField(fill = FieldFill.INSERT) - private String createBy; - - /** - * 鍒涘缓鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - - /** - * 鏇存柊鑰� - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updateBy; - - /** - * 鏇存柊鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date updateTime; - - /** * 澶囨敞 */ private String remark; - - /** - * 璇锋眰鍙傛暟 - */ - @TableField(exist = false) - private Map<String, Object> params = new HashMap<>(); /** * 鏍戠紪鐮佸瓧娈� diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java index 2460360..2d5d106 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java @@ -1,34 +1,33 @@ package com.ruoyi.generator.domain; +import com.baomidou.mybatisplus.annotation.FieldStrategy; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.utils.StringUtils; -import com.baomidou.mybatisplus.annotation.*; -import com.fasterxml.jackson.annotation.JsonFormat; -import lombok.*; +import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; /** * 浠g爜鐢熸垚涓氬姟瀛楁琛� gen_table_column * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) @TableName("gen_table_column") -public class GenTableColumn implements Serializable { - private static final long serialVersionUID = 1L; +public class GenTableColumn extends BaseEntity { /** * 缂栧彿 */ - @TableId(value = "column_id", type = IdType.AUTO) + @TableId(value = "column_id") private Long columnId; /** @@ -125,38 +124,6 @@ */ private Integer sort; - /** - * 鍒涘缓鑰� - */ - @TableField(fill = FieldFill.INSERT) - private String createBy; - - /** - * 鍒涘缓鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - - /** - * 鏇存柊鑰� - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updateBy; - - /** - * 鏇存柊鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date updateTime; - - /** - * 璇锋眰鍙傛暟 - */ - @TableField(exist = false) - private Map<String, Object> params = new HashMap<>(); - public String getCapJavaField() { return StringUtils.uncapitalize(javaField); } @@ -224,9 +191,9 @@ public static boolean isSuperColumn(String javaField) { return StringUtils.equalsAnyIgnoreCase(javaField, // BaseEntity - "createBy", "createTime", "updateBy", "updateTime", "remark", + "createBy", "createTime", "updateBy", "updateTime", // TreeEntity - "parentName", "parentId", "orderNum", "ancestors"); + "parentName", "parentId", "orderNum"); } public boolean isUsableColumn() { diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java index dc51009..1f7e20c 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java @@ -8,7 +8,7 @@ /** * 涓氬姟瀛楁 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface GenTableColumnMapper extends BaseMapperPlus<GenTableColumn> { /** @@ -17,6 +17,6 @@ * @param tableName 琛ㄥ悕绉� * @return 鍒椾俊鎭� */ - public List<GenTableColumn> selectDbTableColumnsByName(String tableName); + List<GenTableColumn> selectDbTableColumnsByName(String tableName); } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java index 3d3e4b9..c55a9a2 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java @@ -10,7 +10,7 @@ /** * 涓氬姟 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface GenTableMapper extends BaseMapperPlus<GenTable> { @@ -25,7 +25,7 @@ * @param genTable 涓氬姟淇℃伅 * @return 涓氬姟闆嗗悎 */ - public List<GenTable> selectGenTableList(GenTable genTable); + List<GenTable> selectGenTableList(GenTable genTable); /** * 鏌ヨ鎹簱鍒楄〃 @@ -33,7 +33,7 @@ * @param genTable 涓氬姟淇℃伅 * @return 鏁版嵁搴撹〃闆嗗悎 */ - public List<GenTable> selectDbTableList(GenTable genTable); + List<GenTable> selectDbTableList(GenTable genTable); /** * 鏌ヨ鎹簱鍒楄〃 @@ -41,14 +41,14 @@ * @param tableNames 琛ㄥ悕绉扮粍 * @return 鏁版嵁搴撹〃闆嗗悎 */ - public List<GenTable> selectDbTableListByNames(String[] tableNames); + List<GenTable> selectDbTableListByNames(String[] tableNames); /** * 鏌ヨ鎵�鏈夎〃淇℃伅 * * @return 琛ㄤ俊鎭泦鍚� */ - public List<GenTable> selectGenTableAll(); + List<GenTable> selectGenTableAll(); /** * 鏌ヨ琛↖D涓氬姟淇℃伅 @@ -56,7 +56,7 @@ * @param id 涓氬姟ID * @return 涓氬姟淇℃伅 */ - public GenTable selectGenTableById(Long id); + GenTable selectGenTableById(Long id); /** * 鏌ヨ琛ㄥ悕绉颁笟鍔′俊鎭� @@ -64,6 +64,6 @@ * @param tableName 琛ㄥ悕绉� * @return 涓氬姟淇℃伅 */ - public GenTable selectGenTableByName(String tableName); + GenTable selectGenTableByName(String tableName); } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java index fff3ae2..cd4d875 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java @@ -12,7 +12,7 @@ /** * 涓氬姟瀛楁 鏈嶅姟灞傚疄鐜� * - * @author ruoyi + * @author Lion Li */ @Service public class GenTableColumnServiceImpl extends ServicePlusImpl<GenTableColumnMapper, GenTableColumn, GenTableColumn> implements IGenTableColumnService { @@ -26,7 +26,7 @@ @Override public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId) { return list(new LambdaQueryWrapper<GenTableColumn>() - .eq(GenTableColumn::getTableId,tableId) + .eq(GenTableColumn::getTableId, tableId) .orderByAsc(GenTableColumn::getSort)); } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java index 9280abc..62fe67a 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java @@ -41,7 +41,7 @@ /** * 涓氬姟 鏈嶅姟灞傚疄鐜� * - * @author ruoyi + * @author Lion Li */ @Slf4j @Service @@ -163,18 +163,18 @@ String tableName = table.getTableName(); GenUtils.initTable(table, operName); int row = baseMapper.insert(table); - if (row > 0) { - // 淇濆瓨鍒椾俊鎭� - List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); - List<GenTableColumn> saveColumns = new ArrayList<>(); - for (GenTableColumn column : genTableColumns) { - GenUtils.initColumnField(column, table); - saveColumns.add(column); - } - if (CollUtil.isNotEmpty(saveColumns)) { - genTableColumnMapper.insertAll(saveColumns); - } - } + if (row > 0) { + // 淇濆瓨鍒椾俊鎭� + List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); + List<GenTableColumn> saveColumns = new ArrayList<>(); + for (GenTableColumn column : genTableColumns) { + GenUtils.initColumnField(column, table); + saveColumns.add(column); + } + if (CollUtil.isNotEmpty(saveColumns)) { + genTableColumnMapper.insertAll(saveColumns); + } + } } } catch (Exception e) { throw new ServiceException("瀵煎叆澶辫触锛�" + e.getMessage()); @@ -253,12 +253,12 @@ StringWriter sw = new StringWriter(); Template tpl = Velocity.getTemplate(template, Constants.UTF8); tpl.merge(context, sw); - try { - String path = getGenPath(table, template); - FileUtils.writeUtf8String(sw.toString(), path); - } catch (Exception e) { - throw new ServiceException("娓叉煋妯℃澘澶辫触锛岃〃鍚嶏細" + table.getTableName()); - } + try { + String path = getGenPath(table, template); + FileUtils.writeUtf8String(sw.toString(), path); + } catch (Exception e) { + throw new ServiceException("娓叉煋妯℃澘澶辫触锛岃〃鍚嶏細" + table.getTableName()); + } } } } @@ -281,16 +281,16 @@ } List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); - List<GenTableColumn> saveColumns = new ArrayList<>(); - dbTableColumns.forEach(column -> { - if (!tableColumnNames.contains(column.getColumnName())) { - GenUtils.initColumnField(column, table); - saveColumns.add(column); - } - }); - if (CollUtil.isNotEmpty(saveColumns)) { - genTableColumnMapper.insertAll(saveColumns); - } + List<GenTableColumn> saveColumns = new ArrayList<>(); + dbTableColumns.forEach(column -> { + if (!tableColumnNames.contains(column.getColumnName())) { + GenUtils.initColumnField(column, table); + saveColumns.add(column); + } + }); + if (CollUtil.isNotEmpty(saveColumns)) { + genTableColumnMapper.insertAll(saveColumns); + } List<GenTableColumn> delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList()); if (CollUtil.isNotEmpty(delColumns)) { @@ -359,7 +359,7 @@ @Override public void validateEdit(GenTable genTable) { if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) { - Map<String, Object> paramsObj = genTable.getParams(); + Map<String, Object> paramsObj = genTable.getParams(); if (StringUtils.isEmpty(paramsObj.get(GenConstants.TREE_CODE))) { throw new ServiceException("鏍戠紪鐮佸瓧娈典笉鑳戒负绌�"); } else if (StringUtils.isEmpty(paramsObj.get(GenConstants.TREE_PARENT_CODE))) { @@ -422,7 +422,7 @@ * @param genTable 璁剧疆鍚庣殑鐢熸垚瀵硅薄 */ public void setTableFromOptions(GenTable genTable) { - Map<String, Object> paramsObj = JsonUtils.parseMap(genTable.getOptions()); + Map<String, Object> paramsObj = JsonUtils.parseMap(genTable.getOptions()); if (StringUtils.isNotNull(paramsObj)) { String treeCode = Convert.toStr(paramsObj.get(GenConstants.TREE_CODE)); String treeParentCode = Convert.toStr(paramsObj.get(GenConstants.TREE_PARENT_CODE)); @@ -441,7 +441,7 @@ /** * 鑾峰彇浠g爜鐢熸垚鍦板潃 * - * @param table 涓氬姟琛ㄤ俊鎭� + * @param table 涓氬姟琛ㄤ俊鎭� * @param template 妯℃澘鏂囦欢璺緞 * @return 鐢熸垚鍦板潃 */ diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java index e0111e5..d1b5bae 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java @@ -8,7 +8,7 @@ /** * 涓氬姟瀛楁 鏈嶅姟灞� * - * @author ruoyi + * @author Lion Li */ public interface IGenTableColumnService extends IService<GenTableColumn> { /** @@ -17,7 +17,7 @@ * @param tableId 涓氬姟瀛楁缂栧彿 * @return 涓氬姟瀛楁闆嗗悎 */ - public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId); + List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId); /** * 鏂板涓氬姟瀛楁 @@ -25,7 +25,7 @@ * @param genTableColumn 涓氬姟瀛楁淇℃伅 * @return 缁撴灉 */ - public int insertGenTableColumn(GenTableColumn genTableColumn); + int insertGenTableColumn(GenTableColumn genTableColumn); /** * 淇敼涓氬姟瀛楁 @@ -33,7 +33,7 @@ * @param genTableColumn 涓氬姟瀛楁淇℃伅 * @return 缁撴灉 */ - public int updateGenTableColumn(GenTableColumn genTableColumn); + int updateGenTableColumn(GenTableColumn genTableColumn); /** * 鍒犻櫎涓氬姟瀛楁淇℃伅 @@ -41,5 +41,5 @@ * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁ID * @return 缁撴灉 */ - public int deleteGenTableColumnByIds(String ids); + int deleteGenTableColumnByIds(String ids); } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java index 9903eca..1bf0c27 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java @@ -10,7 +10,7 @@ /** * 涓氬姟 鏈嶅姟灞� * - * @author ruoyi + * @author Lion Li */ public interface IGenTableService extends IService<GenTable> { @@ -26,7 +26,7 @@ * @param genTable 涓氬姟淇℃伅 * @return 涓氬姟闆嗗悎 */ - public List<GenTable> selectGenTableList(GenTable genTable); + List<GenTable> selectGenTableList(GenTable genTable); /** * 鏌ヨ鎹簱鍒楄〃 @@ -34,7 +34,7 @@ * @param genTable 涓氬姟淇℃伅 * @return 鏁版嵁搴撹〃闆嗗悎 */ - public List<GenTable> selectDbTableList(GenTable genTable); + List<GenTable> selectDbTableList(GenTable genTable); /** * 鏌ヨ鎹簱鍒楄〃 @@ -42,14 +42,14 @@ * @param tableNames 琛ㄥ悕绉扮粍 * @return 鏁版嵁搴撹〃闆嗗悎 */ - public List<GenTable> selectDbTableListByNames(String[] tableNames); + List<GenTable> selectDbTableListByNames(String[] tableNames); /** * 鏌ヨ鎵�鏈夎〃淇℃伅 * * @return 琛ㄤ俊鎭泦鍚� */ - public List<GenTable> selectGenTableAll(); + List<GenTable> selectGenTableAll(); /** * 鏌ヨ涓氬姟淇℃伅 @@ -57,7 +57,7 @@ * @param id 涓氬姟ID * @return 涓氬姟淇℃伅 */ - public GenTable selectGenTableById(Long id); + GenTable selectGenTableById(Long id); /** * 淇敼涓氬姟 @@ -65,7 +65,7 @@ * @param genTable 涓氬姟淇℃伅 * @return 缁撴灉 */ - public void updateGenTable(GenTable genTable); + void updateGenTable(GenTable genTable); /** * 鍒犻櫎涓氬姟淇℃伅 @@ -73,14 +73,14 @@ * @param tableIds 闇�瑕佸垹闄ょ殑琛ㄦ暟鎹甀D * @return 缁撴灉 */ - public void deleteGenTableByIds(Long[] tableIds); + void deleteGenTableByIds(Long[] tableIds); /** * 瀵煎叆琛ㄧ粨鏋� * * @param tableList 瀵煎叆琛ㄥ垪琛� */ - public void importGenTable(List<GenTable> tableList); + void importGenTable(List<GenTable> tableList); /** * 棰勮浠g爜 @@ -88,7 +88,7 @@ * @param tableId 琛ㄧ紪鍙� * @return 棰勮鏁版嵁鍒楄〃 */ - public Map<String, String> previewCode(Long tableId); + Map<String, String> previewCode(Long tableId); /** * 鐢熸垚浠g爜锛堜笅杞芥柟寮忥級 @@ -96,7 +96,7 @@ * @param tableName 琛ㄥ悕绉� * @return 鏁版嵁 */ - public byte[] downloadCode(String tableName); + byte[] downloadCode(String tableName); /** * 鐢熸垚浠g爜锛堣嚜瀹氫箟璺緞锛� @@ -104,14 +104,14 @@ * @param tableName 琛ㄥ悕绉� * @return 鏁版嵁 */ - public void generatorCode(String tableName); + void generatorCode(String tableName); /** * 鍚屾鏁版嵁搴� * * @param tableName 琛ㄥ悕绉� */ - public void synchDb(String tableName); + void synchDb(String tableName); /** * 鎵归噺鐢熸垚浠g爜锛堜笅杞芥柟寮忥級 @@ -119,12 +119,12 @@ * @param tableNames 琛ㄦ暟缁� * @return 鏁版嵁 */ - public byte[] downloadCode(String[] tableNames); + byte[] downloadCode(String[] tableNames); /** * 淇敼淇濆瓨鍙傛暟鏍¢獙 * * @param genTable 涓氬姟淇℃伅 */ - public void validateEdit(GenTable genTable); + void validateEdit(GenTable genTable); } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java index 44f5439..c434ca8 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java @@ -1,7 +1,7 @@ package com.ruoyi.generator.util; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.constant.GenConstants; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.generator.config.GenConfig; import com.ruoyi.generator.domain.GenTable; import com.ruoyi.generator.domain.GenTableColumn; @@ -14,13 +14,12 @@ * * @author ruoyi */ -public class GenUtils -{ +public class GenUtils { + /** * 鍒濆鍖栬〃淇℃伅 */ - public static void initTable(GenTable genTable, String operName) - { + public static void initTable(GenTable genTable, String operName) { genTable.setClassName(convertClassName(genTable.getTableName())); genTable.setPackageName(GenConfig.getPackageName()); genTable.setModuleName(getModuleName(GenConfig.getPackageName())); @@ -74,55 +73,45 @@ column.setIsInsert(GenConstants.REQUIRE); } // BO瀵硅薄 榛樿缂栬緫鍕鹃�� - if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName)) - { + if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName)) { column.setIsEdit(GenConstants.REQUIRE); } // BO瀵硅薄 榛樿鏄惁蹇呭~鍕鹃�� - if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName)) - { + if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName)) { column.setIsRequired(GenConstants.REQUIRE); } // VO瀵硅薄 榛樿杩斿洖鍕鹃�� - if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName)) - { + if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName)) { column.setIsList(GenConstants.REQUIRE); } // BO瀵硅薄 榛樿鏌ヨ鍕鹃�� - if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk()) - { + if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk()) { column.setIsQuery(GenConstants.REQUIRE); } // 鏌ヨ瀛楁绫诲瀷 - if (StringUtils.endsWithIgnoreCase(columnName, "name")) - { + if (StringUtils.endsWithIgnoreCase(columnName, "name")) { column.setQueryType(GenConstants.QUERY_LIKE); } // 鐘舵�佸瓧娈佃缃崟閫夋 - if (StringUtils.endsWithIgnoreCase(columnName, "status")) - { + if (StringUtils.endsWithIgnoreCase(columnName, "status")) { column.setHtmlType(GenConstants.HTML_RADIO); } // 绫诲瀷&鎬у埆瀛楁璁剧疆涓嬫媺妗� else if (StringUtils.endsWithIgnoreCase(columnName, "type") - || StringUtils.endsWithIgnoreCase(columnName, "sex")) - { + || StringUtils.endsWithIgnoreCase(columnName, "sex")) { column.setHtmlType(GenConstants.HTML_SELECT); } // 鍥剧墖瀛楁璁剧疆鍥剧墖涓婁紶鎺т欢 - else if (StringUtils.endsWithIgnoreCase(columnName, "image")) - { + else if (StringUtils.endsWithIgnoreCase(columnName, "image")) { column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD); } // 鏂囦欢瀛楁璁剧疆鏂囦欢涓婁紶鎺т欢 - else if (StringUtils.endsWithIgnoreCase(columnName, "file")) - { + else if (StringUtils.endsWithIgnoreCase(columnName, "file")) { column.setHtmlType(GenConstants.HTML_FILE_UPLOAD); } // 鍐呭瀛楁璁剧疆瀵屾枃鏈帶浠� - else if (StringUtils.endsWithIgnoreCase(columnName, "content")) - { + else if (StringUtils.endsWithIgnoreCase(columnName, "content")) { column.setHtmlType(GenConstants.HTML_EDITOR); } } @@ -130,12 +119,11 @@ /** * 鏍¢獙鏁扮粍鏄惁鍖呭惈鎸囧畾鍊� * - * @param arr 鏁扮粍 + * @param arr 鏁扮粍 * @param targetValue 鍊� * @return 鏄惁鍖呭惈 */ - public static boolean arraysContains(String[] arr, String targetValue) - { + public static boolean arraysContains(String[] arr, String targetValue) { return Arrays.asList(arr).contains(targetValue); } @@ -145,8 +133,7 @@ * @param packageName 鍖呭悕 * @return 妯″潡鍚� */ - public static String getModuleName(String packageName) - { + public static String getModuleName(String packageName) { int lastIndex = packageName.lastIndexOf("."); int nameLength = packageName.length(); String moduleName = StringUtils.substring(packageName, lastIndex + 1, nameLength); @@ -159,12 +146,11 @@ * @param tableName 琛ㄥ悕 * @return 涓氬姟鍚� */ - public static String getBusinessName(String tableName) - { + public static String getBusinessName(String tableName) { int firstIndex = tableName.indexOf("_"); int nameLength = tableName.length(); String businessName = StringUtils.substring(tableName, firstIndex + 1, nameLength); - businessName = StringUtils.toCamelCase(businessName); + businessName = StringUtils.toCamelCase(businessName); return businessName; } @@ -174,12 +160,10 @@ * @param tableName 琛ㄥ悕绉� * @return 绫诲悕 */ - public static String convertClassName(String tableName) - { + public static String convertClassName(String tableName) { boolean autoRemovePre = GenConfig.getAutoRemovePre(); String tablePrefix = GenConfig.getTablePrefix(); - if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) - { + if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) { String[] searchList = StringUtils.split(tablePrefix, ","); tableName = replaceFirst(tableName, searchList); } @@ -190,16 +174,13 @@ * 鎵归噺鏇挎崲鍓嶇紑 * * @param replacementm 鏇挎崲鍊� - * @param searchList 鏇挎崲鍒楄〃 + * @param searchList 鏇挎崲鍒楄〃 * @return */ - public static String replaceFirst(String replacementm, String[] searchList) - { + public static String replaceFirst(String replacementm, String[] searchList) { String text = replacementm; - for (String searchString : searchList) - { - if (replacementm.startsWith(searchString)) - { + for (String searchString : searchList) { + if (replacementm.startsWith(searchString)) { text = replacementm.replaceFirst(searchString, ""); break; } @@ -213,8 +194,7 @@ * @param text 闇�瑕佽鏇挎崲鐨勫悕瀛� * @return 鏇挎崲鍚庣殑鍚嶅瓧 */ - public static String replaceText(String text) - { + public static String replaceText(String text) { return RegExUtils.replaceAll(text, "(?:琛▅鑻ヤ緷)", ""); } @@ -224,14 +204,10 @@ * @param columnType 鍒楃被鍨� * @return 鎴彇鍚庣殑鍒楃被鍨� */ - public static String getDbType(String columnType) - { - if (StringUtils.indexOf(columnType, '(') > 0) - { + public static String getDbType(String columnType) { + if (StringUtils.indexOf(columnType, '(') > 0) { return StringUtils.substringBefore(columnType, "("); - } - else - { + } else { return columnType; } } @@ -242,15 +218,11 @@ * @param columnType 鍒楃被鍨� * @return 鎴彇鍚庣殑鍒楃被鍨� */ - public static Integer getColumnLength(String columnType) - { - if (StringUtils.indexOf(columnType, '(') > 0) - { + public static Integer getColumnLength(String columnType) { + if (StringUtils.indexOf(columnType, '(') > 0) { String length = StringUtils.substringBetween(columnType, "(", ")"); return Integer.valueOf(length); - } - else - { + } else { return 0; } } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java index 32452b8..461bc2c 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java @@ -1,24 +1,23 @@ package com.ruoyi.generator.util; -import java.util.Properties; -import org.apache.velocity.app.Velocity; import com.ruoyi.common.constant.Constants; +import org.apache.velocity.app.Velocity; + +import java.util.Properties; /** * VelocityEngine宸ュ巶 - * + * * @author ruoyi */ -public class VelocityInitializer -{ +public class VelocityInitializer { + /** * 鍒濆鍖杤m鏂规硶 */ - public static void initVelocity() - { + public static void initVelocity() { Properties p = new Properties(); - try - { + try { // 鍔犺浇classpath鐩綍涓嬬殑vm鏂囦欢 p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); // 瀹氫箟瀛楃闆� @@ -26,10 +25,9 @@ p.setProperty(Velocity.OUTPUT_ENCODING, Constants.UTF8); // 鍒濆鍖朧elocity寮曟搸锛屾寚瀹氶厤缃甈roperties Velocity.init(p); - } - catch (Exception e) - { + } catch (Exception e) { throw new RuntimeException(e); } } + } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java index 3876227..0a3ffbc 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java @@ -16,18 +16,24 @@ /** * 妯℃澘澶勭悊宸ュ叿绫� - * + * * @author ruoyi */ -public class VelocityUtils -{ - /** 椤圭洰绌洪棿璺緞 */ +public class VelocityUtils { + + /** + * 椤圭洰绌洪棿璺緞 + */ private static final String PROJECT_PATH = "main/java"; - /** mybatis绌洪棿璺緞 */ + /** + * mybatis绌洪棿璺緞 + */ private static final String MYBATIS_PATH = "main/resources/mapper"; - /** 榛樿涓婄骇鑿滃崟锛岀郴缁熷伐鍏� */ + /** + * 榛樿涓婄骇鑿滃崟锛岀郴缁熷伐鍏� + */ private static final String DEFAULT_PARENT_MENU_ID = "3"; /** @@ -35,8 +41,7 @@ * * @return 妯℃澘鍒楄〃 */ - public static VelocityContext prepareContext(GenTable genTable) - { + public static VelocityContext prepareContext(GenTable genTable) { String moduleName = genTable.getModuleName(); String businessName = genTable.getBusinessName(); String packageName = genTable.getPackageName(); @@ -63,29 +68,25 @@ velocityContext.put("table", genTable); velocityContext.put("dicts", getDicts(genTable)); setMenuVelocityContext(velocityContext, genTable); - if (GenConstants.TPL_TREE.equals(tplCategory)) - { + if (GenConstants.TPL_TREE.equals(tplCategory)) { setTreeVelocityContext(velocityContext, genTable); } - if (GenConstants.TPL_SUB.equals(tplCategory)) - { + if (GenConstants.TPL_SUB.equals(tplCategory)) { setSubVelocityContext(velocityContext, genTable); } return velocityContext; } - public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) - { + public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) { String options = genTable.getOptions(); - Map<String, Object> paramsObj = JsonUtils.parseMap(options); + Map<String, Object> paramsObj = JsonUtils.parseMap(options); String parentMenuId = getParentMenuId(paramsObj); context.put("parentMenuId", parentMenuId); } - public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) - { + public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) { String options = genTable.getOptions(); - Map<String, Object> paramsObj = JsonUtils.parseMap(options); + Map<String, Object> paramsObj = JsonUtils.parseMap(options); String treeCode = getTreecode(paramsObj); String treeParentCode = getTreeParentCode(paramsObj); String treeName = getTreeName(paramsObj); @@ -94,18 +95,15 @@ context.put("treeParentCode", treeParentCode); context.put("treeName", treeName); context.put("expandColumn", getExpandColumn(genTable)); - if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) - { + if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) { context.put("tree_parent_code", paramsObj.get(GenConstants.TREE_PARENT_CODE)); } - if (paramsObj.containsKey(GenConstants.TREE_NAME)) - { + if (paramsObj.containsKey(GenConstants.TREE_NAME)) { context.put("tree_name", paramsObj.get(GenConstants.TREE_NAME)); } } - public static void setSubVelocityContext(VelocityContext context, GenTable genTable) - { + public static void setSubVelocityContext(VelocityContext context, GenTable genTable) { GenTable subTable = genTable.getSubTable(); String subTableName = genTable.getSubTableName(); String subTableFkName = genTable.getSubTableFkName(); @@ -127,12 +125,11 @@ * * @return 妯℃澘鍒楄〃 */ - public static List<String> getTemplateList(String tplCategory) - { + public static List<String> getTemplateList(String tplCategory) { List<String> templates = new ArrayList<String>(); templates.add("vm/java/domain.java.vm"); templates.add("vm/java/vo.java.vm"); - templates.add("vm/java/bo.java.vm"); + templates.add("vm/java/bo.java.vm"); templates.add("vm/java/mapper.java.vm"); templates.add("vm/java/service.java.vm"); templates.add("vm/java/serviceImpl.java.vm"); @@ -140,16 +137,11 @@ templates.add("vm/xml/mapper.xml.vm"); templates.add("vm/sql/sql.vm"); templates.add("vm/js/api.js.vm"); - if (GenConstants.TPL_CRUD.equals(tplCategory)) - { + if (GenConstants.TPL_CRUD.equals(tplCategory)) { templates.add("vm/vue/index.vue.vm"); - } - else if (GenConstants.TPL_TREE.equals(tplCategory)) - { + } else if (GenConstants.TPL_TREE.equals(tplCategory)) { templates.add("vm/vue/index-tree.vue.vm"); - } - else if (GenConstants.TPL_SUB.equals(tplCategory)) - { + } else if (GenConstants.TPL_SUB.equals(tplCategory)) { templates.add("vm/vue/index.vue.vm"); templates.add("vm/java/sub-domain.java.vm"); } @@ -159,8 +151,7 @@ /** * 鑾峰彇鏂囦欢鍚� */ - public static String getFileName(String template, GenTable genTable) - { + public static String getFileName(String template, GenTable genTable) { // 鏂囦欢鍚嶇О String fileName = ""; // 鍖呰矾寰� @@ -176,56 +167,34 @@ String mybatisPath = MYBATIS_PATH + "/" + moduleName; String vuePath = "vue"; - if (template.contains("domain.java.vm")) - { + if (template.contains("domain.java.vm")) { fileName = StringUtils.format("{}/domain/{}.java", javaPath, className); } - if (template.contains("vo.java.vm")) - { + if (template.contains("vo.java.vm")) { fileName = StringUtils.format("{}/domain/vo/{}Vo.java", javaPath, className); } - if (template.contains("bo.java.vm")) - { - fileName = StringUtils.format("{}/domain/bo/{}Bo.java", javaPath, className); - } - if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory())) - { + if (template.contains("bo.java.vm")) { + fileName = StringUtils.format("{}/domain/bo/{}Bo.java", javaPath, className); + } + if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory())) { fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName()); - } - else if (template.contains("mapper.java.vm")) - { + } else if (template.contains("mapper.java.vm")) { fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className); - } - else if (template.contains("service.java.vm")) - { + } else if (template.contains("service.java.vm")) { fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className); - } - else if (template.contains("serviceImpl.java.vm")) - { + } else if (template.contains("serviceImpl.java.vm")) { fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className); - } - else if (template.contains("controller.java.vm")) - { + } else if (template.contains("controller.java.vm")) { fileName = StringUtils.format("{}/controller/{}Controller.java", javaPath, className); - } - else if (template.contains("mapper.xml.vm")) - { + } else if (template.contains("mapper.xml.vm")) { fileName = StringUtils.format("{}/{}Mapper.xml", mybatisPath, className); - } - else if (template.contains("sql.vm")) - { + } else if (template.contains("sql.vm")) { fileName = businessName + "Menu.sql"; - } - else if (template.contains("api.js.vm")) - { + } else if (template.contains("api.js.vm")) { fileName = StringUtils.format("{}/api/{}/{}.js", vuePath, moduleName, businessName); - } - else if (template.contains("index.vue.vm")) - { + } else if (template.contains("index.vue.vm")) { fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); - } - else if (template.contains("index-tree.vue.vm")) - { + } else if (template.contains("index-tree.vue.vm")) { fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); } return fileName; @@ -237,8 +206,7 @@ * @param packageName 鍖呭悕绉� * @return 鍖呭墠缂�鍚嶇О */ - public static String getPackagePrefix(String packageName) - { + public static String getPackagePrefix(String packageName) { int lastIndex = packageName.lastIndexOf("."); String basePackage = StringUtils.substring(packageName, 0, lastIndex); return basePackage; @@ -246,28 +214,22 @@ /** * 鏍规嵁鍒楃被鍨嬭幏鍙栧鍏ュ寘 - * + * * @param genTable 涓氬姟琛ㄥ璞� * @return 杩斿洖闇�瑕佸鍏ョ殑鍖呭垪琛� */ - public static HashSet<String> getImportList(GenTable genTable) - { + public static HashSet<String> getImportList(GenTable genTable) { List<GenTableColumn> columns = genTable.getColumns(); GenTable subGenTable = genTable.getSubTable(); HashSet<String> importList = new HashSet<String>(); - if (StringUtils.isNotNull(subGenTable)) - { + if (StringUtils.isNotNull(subGenTable)) { importList.add("java.util.List"); } - for (GenTableColumn column : columns) - { - if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) - { + for (GenTableColumn column : columns) { + if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) { importList.add("java.util.Date"); importList.add("com.fasterxml.jackson.annotation.JsonFormat"); - } - else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) - { + } else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) { importList.add("java.math.BigDecimal"); } } @@ -280,15 +242,12 @@ * @param genTable 涓氬姟琛ㄥ璞� * @return 杩斿洖瀛楀吀缁� */ - public static String getDicts(GenTable genTable) - { + public static String getDicts(GenTable genTable) { List<GenTableColumn> columns = genTable.getColumns(); List<String> dicts = new ArrayList<String>(); - for (GenTableColumn column : columns) - { + for (GenTableColumn column : columns) { if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny( - column.getHtmlType(), new String[] { GenConstants.HTML_SELECT, GenConstants.HTML_RADIO })) - { + column.getHtmlType(), new String[]{GenConstants.HTML_SELECT, GenConstants.HTML_RADIO})) { dicts.add("'" + column.getDictType() + "'"); } } @@ -298,12 +257,11 @@ /** * 鑾峰彇鏉冮檺鍓嶇紑 * - * @param moduleName 妯″潡鍚嶇О + * @param moduleName 妯″潡鍚嶇О * @param businessName 涓氬姟鍚嶇О * @return 杩斿洖鏉冮檺鍓嶇紑 */ - public static String getPermissionPrefix(String moduleName, String businessName) - { + public static String getPermissionPrefix(String moduleName, String businessName) { return StringUtils.format("{}:{}", moduleName, businessName); } @@ -313,11 +271,9 @@ * @param paramsObj 鐢熸垚鍏朵粬閫夐」 * @return 涓婄骇鑿滃崟ID瀛楁 */ - public static String getParentMenuId(Map<String, Object> paramsObj) - { + public static String getParentMenuId(Map<String, Object> paramsObj) { if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.PARENT_MENU_ID) - && StringUtils.isNotEmpty(Convert.toStr(paramsObj.get(GenConstants.PARENT_MENU_ID)))) - { + && StringUtils.isNotEmpty(Convert.toStr(paramsObj.get(GenConstants.PARENT_MENU_ID)))) { return Convert.toStr(paramsObj.get(GenConstants.PARENT_MENU_ID)); } return DEFAULT_PARENT_MENU_ID; @@ -329,10 +285,8 @@ * @param paramsObj 鐢熸垚鍏朵粬閫夐」 * @return 鏍戠紪鐮� */ - public static String getTreecode(Map<String, Object> paramsObj) - { - if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_CODE)) - { + public static String getTreecode(Map<String, Object> paramsObj) { + if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_CODE)) { return StringUtils.toCamelCase(Convert.toStr(paramsObj.get(GenConstants.TREE_CODE))); } return StringUtils.EMPTY; @@ -344,10 +298,8 @@ * @param paramsObj 鐢熸垚鍏朵粬閫夐」 * @return 鏍戠埗缂栫爜 */ - public static String getTreeParentCode(Map<String, Object> paramsObj) - { - if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) - { + public static String getTreeParentCode(Map<String, Object> paramsObj) { + if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) { return StringUtils.toCamelCase(Convert.toStr(paramsObj.get(GenConstants.TREE_PARENT_CODE))); } return StringUtils.EMPTY; @@ -359,10 +311,8 @@ * @param paramsObj 鐢熸垚鍏朵粬閫夐」 * @return 鏍戝悕绉� */ - public static String getTreeName(Map<String, Object> paramsObj) - { - if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_NAME)) - { + public static String getTreeName(Map<String, Object> paramsObj) { + if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_NAME)) { return StringUtils.toCamelCase(Convert.toStr(paramsObj.get(GenConstants.TREE_NAME))); } return StringUtils.EMPTY; @@ -374,20 +324,16 @@ * @param genTable 涓氬姟琛ㄥ璞� * @return 灞曞紑鎸夐挳鍒楀簭鍙� */ - public static int getExpandColumn(GenTable genTable) - { + public static int getExpandColumn(GenTable genTable) { String options = genTable.getOptions(); Map<String, Object> paramsObj = JsonUtils.parseMap(options); String treeName = Convert.toStr(paramsObj.get(GenConstants.TREE_NAME)); int num = 0; - for (GenTableColumn column : genTable.getColumns()) - { - if (column.isList()) - { + for (GenTableColumn column : genTable.getColumns()) { + if (column.isList()) { num++; String columnName = column.getColumnName(); - if (columnName.equals(treeName)) - { + if (columnName.equals(treeName)) { break; } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java index cdd7810..3b9fce0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java @@ -2,44 +2,46 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; -import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.annotation.ExcelDictFormat; import com.ruoyi.common.convert.ExcelDictConvert; +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; /** * 鍙傛暟閰嶇疆琛� sys_config * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) @TableName("sys_config") @ExcelIgnoreUnannotated -public class SysConfig implements Serializable { - private static final long serialVersionUID = 1L; +@ApiModel("鍙傛暟閰嶇疆涓氬姟瀵硅薄") +public class SysConfig extends BaseEntity { /** * 鍙傛暟涓婚敭 */ + @ApiModelProperty(value = "鍙傛暟涓婚敭") @ExcelProperty(value = "鍙傛暟涓婚敭") - @TableId(value = "config_id", type = IdType.AUTO) + @TableId(value = "config_id") private Long configId; /** * 鍙傛暟鍚嶇О */ + @ApiModelProperty(value = "鍙傛暟鍚嶇О") @ExcelProperty(value = "鍙傛暟鍚嶇О") @NotBlank(message = "鍙傛暟鍚嶇О涓嶈兘涓虹┖") @Size(min = 0, max = 100, message = "鍙傛暟鍚嶇О涓嶈兘瓒呰繃100涓瓧绗�") @@ -48,6 +50,7 @@ /** * 鍙傛暟閿悕 */ + @ApiModelProperty(value = "鍙傛暟閿悕") @ExcelProperty(value = "鍙傛暟閿悕") @NotBlank(message = "鍙傛暟閿悕闀垮害涓嶈兘涓虹┖") @Size(min = 0, max = 100, message = "鍙傛暟閿悕闀垮害涓嶈兘瓒呰繃100涓瓧绗�") @@ -56,6 +59,7 @@ /** * 鍙傛暟閿�� */ + @ApiModelProperty(value = "鍙傛暟閿��") @ExcelProperty(value = "鍙傛暟閿��") @NotBlank(message = "鍙傛暟閿�间笉鑳戒负绌�") @Size(min = 0, max = 500, message = "鍙傛暟閿�奸暱搴︿笉鑳借秴杩�500涓瓧绗�") @@ -64,43 +68,15 @@ /** * 绯荤粺鍐呯疆锛圷鏄� N鍚︼級 */ + @ApiModelProperty(value = "绯荤粺鍐呯疆锛圷鏄� N鍚︼級") @ExcelProperty(value = "绯荤粺鍐呯疆", converter = ExcelDictConvert.class) @ExcelDictFormat(dictType = "sys_yes_no") private String configType; /** - * 鍒涘缓鑰� - */ - @TableField(fill = FieldFill.INSERT) - private String createBy; - - /** - * 鍒涘缓鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT) - private Date createTime; - - /** - * 鏇存柊鑰� - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updateBy; - - /** - * 鏇存柊鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateTime; - - /** * 澶囨敞 */ + @ApiModelProperty(value = "澶囨敞") private String remark; - - /** - * 璇锋眰鍙傛暟 - */ - @TableField(exist = false) - private Map<String, Object> params = new HashMap<>(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java index 898aa8a..a157537 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java @@ -2,14 +2,14 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; -import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.annotation.ExcelDictFormat; import com.ruoyi.common.convert.ExcelDictConvert; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.NoArgsConstructor; import lombok.experimental.Accessors; import java.io.Serializable; @@ -20,76 +20,86 @@ /** * 绯荤粺璁块棶璁板綍琛� sys_logininfor * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor @Accessors(chain = true) @TableName("sys_logininfor") @ExcelIgnoreUnannotated +@ApiModel("绯荤粺璁块棶璁板綍涓氬姟瀵硅薄") public class SysLogininfor implements Serializable { private static final long serialVersionUID = 1L; /** * ID */ + @ApiModelProperty(value = "璁块棶ID") @ExcelProperty(value = "搴忓彿") - @TableId(value = "info_id", type = IdType.AUTO) + @TableId(value = "info_id") private Long infoId; /** * 鐢ㄦ埛璐﹀彿 */ + @ApiModelProperty(value = "鐢ㄦ埛璐﹀彿") @ExcelProperty(value = "鐢ㄦ埛璐﹀彿") private String userName; /** * 鐧诲綍鐘舵�� 0鎴愬姛 1澶辫触 */ + @ApiModelProperty(value = "鐧诲綍鐘舵�� 0鎴愬姛 1澶辫触") @ExcelProperty(value = "鐧诲綍鐘舵��", converter = ExcelDictConvert.class) - @ExcelDictFormat(dictType = "sys_common_status") + @ExcelDictFormat(dictType = "sys_common_status") private String status; /** * 鐧诲綍IP鍦板潃 */ + @ApiModelProperty(value = "鐧诲綍IP鍦板潃") @ExcelProperty(value = "鐧诲綍鍦板潃") private String ipaddr; /** * 鐧诲綍鍦扮偣 */ + @ApiModelProperty(value = "鐧诲綍鍦扮偣") @ExcelProperty(value = "鐧诲綍鍦扮偣") private String loginLocation; /** * 娴忚鍣ㄧ被鍨� */ + @ApiModelProperty(value = "娴忚鍣ㄧ被鍨�") @ExcelProperty(value = "娴忚鍣�") private String browser; /** * 鎿嶄綔绯荤粺 */ + @ApiModelProperty(value = "鎿嶄綔绯荤粺") @ExcelProperty(value = "鎿嶄綔绯荤粺") private String os; /** * 鎻愮ず娑堟伅 */ + @ApiModelProperty(value = "鎻愮ず娑堟伅") @ExcelProperty(value = "鎻愮ず娑堟伅") private String msg; /** * 璁块棶鏃堕棿 */ + @ApiModelProperty(value = "璁块棶鏃堕棿") @ExcelProperty(value = "璁块棶鏃堕棿") private Date loginTime; /** * 璇锋眰鍙傛暟 */ + @ApiModelProperty(value = "璇锋眰鍙傛暟") @TableField(exist = false) private Map<String, Object> params = new HashMap<>(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java index e50ecd1..2b230bf 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java @@ -1,39 +1,38 @@ package com.ruoyi.system.domain; -import com.baomidou.mybatisplus.annotation.*; -import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; /** * 閫氱煡鍏憡琛� sys_notice * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) @TableName("sys_notice") -public class SysNotice implements Serializable { - private static final long serialVersionUID = 1L; +public class SysNotice extends BaseEntity { /** * 鍏憡ID */ - @TableId(value = "notice_id", type = IdType.AUTO) + @ApiModelProperty(value = "鍏憡ID") + @TableId(value = "notice_id") private Long noticeId; /** * 鍏憡鏍囬 */ + @ApiModelProperty(value = "鍏憡鏍囬") @NotBlank(message = "鍏憡鏍囬涓嶈兘涓虹┖") @Size(min = 0, max = 50, message = "鍏憡鏍囬涓嶈兘瓒呰繃50涓瓧绗�") private String noticeTitle; @@ -41,53 +40,25 @@ /** * 鍏憡绫诲瀷锛�1閫氱煡 2鍏憡锛� */ + @ApiModelProperty(value = "鍏憡绫诲瀷锛�1閫氱煡 2鍏憡锛�") private String noticeType; /** * 鍏憡鍐呭 */ + @ApiModelProperty(value = "鍏憡鍐呭") private String noticeContent; /** * 鍏憡鐘舵�侊紙0姝e父 1鍏抽棴锛� */ + @ApiModelProperty(value = "鍏憡鐘舵�侊紙0姝e父 1鍏抽棴锛�") private String status; - - /** - * 鍒涘缓鑰� - */ - @TableField(fill = FieldFill.INSERT) - private String createBy; - - /** - * 鍒涘缓鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - - /** - * 鏇存柊鑰� - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updateBy; - - /** - * 鏇存柊鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date updateTime; /** * 澶囨敞 */ + @ApiModelProperty(value = "澶囨敞") private String remark; - - /** - * 璇锋眰鍙傛暟 - */ - @TableField(exist = false) - private Map<String, Object> params = new HashMap<>(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java index 20fc273..84ab555 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java @@ -2,14 +2,14 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; -import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.annotation.ExcelDictFormat; import com.ruoyi.common.convert.ExcelDictConvert; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.NoArgsConstructor; import lombok.experimental.Accessors; import java.io.Serializable; @@ -20,33 +20,37 @@ /** * 鎿嶄綔鏃ュ織璁板綍琛� oper_log * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor @Accessors(chain = true) @TableName("sys_oper_log") @ExcelIgnoreUnannotated +@ApiModel("鎿嶄綔鏃ュ織璁板綍涓氬姟瀵硅薄") public class SysOperLog implements Serializable { + private static final long serialVersionUID = 1L; /** * 鏃ュ織涓婚敭 */ - @ExcelProperty(value = "鎿嶄綔搴忓彿") - @TableId(value = "oper_id", type = IdType.AUTO) + @ApiModelProperty(value = "鏃ュ織涓婚敭") + @ExcelProperty(value = "鏃ュ織涓婚敭") + @TableId(value = "oper_id") private Long operId; /** * 鎿嶄綔妯″潡 */ + @ApiModelProperty(value = "鎿嶄綔妯″潡") @ExcelProperty(value = "鎿嶄綔妯″潡") private String title; /** * 涓氬姟绫诲瀷锛�0鍏跺畠 1鏂板 2淇敼 3鍒犻櫎锛� */ + @ApiModelProperty(value = "涓氬姟绫诲瀷锛�0鍏跺畠 1鏂板 2淇敼 3鍒犻櫎锛�") @ExcelProperty(value = "涓氬姟绫诲瀷", converter = ExcelDictConvert.class) @ExcelDictFormat(dictType = "sys_oper_type") private Integer businessType; @@ -54,24 +58,28 @@ /** * 涓氬姟绫诲瀷鏁扮粍 */ + @ApiModelProperty(value = "涓氬姟绫诲瀷鏁扮粍") @TableField(exist = false) private Integer[] businessTypes; /** * 璇锋眰鏂规硶 */ + @ApiModelProperty(value = "璇锋眰鏂规硶") @ExcelProperty(value = "璇锋眰鏂规硶") private String method; /** * 璇锋眰鏂瑰紡 */ + @ApiModelProperty(value = "璇锋眰鏂瑰紡") @ExcelProperty(value = "璇锋眰鏂瑰紡") private String requestMethod; /** * 鎿嶄綔绫诲埆锛�0鍏跺畠 1鍚庡彴鐢ㄦ埛 2鎵嬫満绔敤鎴凤級 */ + @ApiModelProperty(value = "鎿嶄綔绫诲埆锛�0鍏跺畠 1鍚庡彴鐢ㄦ埛 2鎵嬫満绔敤鎴凤級") @ExcelProperty(value = "鎿嶄綔绫诲埆", converter = ExcelDictConvert.class) @ExcelDictFormat(readConverterExp = "0=鍏跺畠,1=鍚庡彴鐢ㄦ埛,2=鎵嬫満绔敤鎴�") private Integer operatorType; @@ -79,48 +87,56 @@ /** * 鎿嶄綔浜哄憳 */ + @ApiModelProperty(value = "鎿嶄綔浜哄憳") @ExcelProperty(value = "鎿嶄綔浜哄憳") private String operName; /** * 閮ㄩ棬鍚嶇О */ + @ApiModelProperty(value = "閮ㄩ棬鍚嶇О") @ExcelProperty(value = "閮ㄩ棬鍚嶇О") private String deptName; /** * 璇锋眰url */ + @ApiModelProperty(value = "璇锋眰url") @ExcelProperty(value = "璇锋眰鍦板潃") private String operUrl; /** * 鎿嶄綔鍦板潃 */ + @ApiModelProperty(value = "鎿嶄綔鍦板潃") @ExcelProperty(value = "鎿嶄綔鍦板潃") private String operIp; /** * 鎿嶄綔鍦扮偣 */ + @ApiModelProperty(value = "鎿嶄綔鍦扮偣") @ExcelProperty(value = "鎿嶄綔鍦扮偣") private String operLocation; /** * 璇锋眰鍙傛暟 */ + @ApiModelProperty(value = "璇锋眰鍙傛暟") @ExcelProperty(value = "璇锋眰鍙傛暟") private String operParam; /** * 杩斿洖鍙傛暟 */ + @ApiModelProperty(value = "杩斿洖鍙傛暟") @ExcelProperty(value = "杩斿洖鍙傛暟") private String jsonResult; /** * 鎿嶄綔鐘舵�侊紙0姝e父 1寮傚父锛� */ + @ApiModelProperty(value = "鎿嶄綔鐘舵�侊紙0姝e父 1寮傚父锛�") @ExcelProperty(value = "鐘舵��", converter = ExcelDictConvert.class) @ExcelDictFormat(dictType = "sys_common_status") private Integer status; @@ -128,18 +144,21 @@ /** * 閿欒娑堟伅 */ + @ApiModelProperty(value = "閿欒娑堟伅") @ExcelProperty(value = "閿欒娑堟伅") private String errorMsg; /** * 鎿嶄綔鏃堕棿 */ + @ApiModelProperty(value = "鎿嶄綔鏃堕棿") @ExcelProperty(value = "鎿嶄綔鏃堕棿") private Date operTime; /** * 璇锋眰鍙傛暟 */ + @ApiModelProperty(value = "璇锋眰鍙傛暟") @TableField(exist = false) private Map<String, Object> params = new HashMap<>(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java index 5672250..b0b8a11 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java @@ -2,44 +2,47 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; -import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.annotation.ExcelDictFormat; import com.ruoyi.common.convert.ExcelDictConvert; +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; /** * 宀椾綅琛� sys_post * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) @TableName("sys_post") @ExcelIgnoreUnannotated -public class SysPost implements Serializable { - private static final long serialVersionUID = 1L; +@ApiModel("宀椾綅淇℃伅涓氬姟瀵硅薄") +public class SysPost extends BaseEntity { /** * 宀椾綅搴忓彿 */ + @ApiModelProperty(value = "宀椾綅搴忓彿") @ExcelProperty(value = "宀椾綅搴忓彿") - @TableId(value = "post_id", type = IdType.AUTO) + @TableId(value = "post_id") private Long postId; /** * 宀椾綅缂栫爜 */ + @ApiModelProperty(value = "宀椾綅缂栫爜") @ExcelProperty(value = "宀椾綅缂栫爜") @NotBlank(message = "宀椾綅缂栫爜涓嶈兘涓虹┖") @Size(min = 0, max = 64, message = "宀椾綅缂栫爜闀垮害涓嶈兘瓒呰繃64涓瓧绗�") @@ -48,6 +51,7 @@ /** * 宀椾綅鍚嶇О */ + @ApiModelProperty(value = "宀椾綅鍚嶇О") @ExcelProperty(value = "宀椾綅鍚嶇О") @NotBlank(message = "宀椾綅鍚嶇О涓嶈兘涓虹┖") @Size(min = 0, max = 50, message = "宀椾綅鍚嶇О闀垮害涓嶈兘瓒呰繃50涓瓧绗�") @@ -56,6 +60,7 @@ /** * 宀椾綅鎺掑簭 */ + @ApiModelProperty(value = "宀椾綅鎺掑簭") @ExcelProperty(value = "宀椾綅鎺掑簭") @NotBlank(message = "鏄剧ず椤哄簭涓嶈兘涓虹┖") private String postSort; @@ -63,48 +68,21 @@ /** * 鐘舵�侊紙0姝e父 1鍋滅敤锛� */ + @ApiModelProperty(value = "鐘舵�侊紙0姝e父 1鍋滅敤锛�") @ExcelProperty(value = "鐘舵��", converter = ExcelDictConvert.class) @ExcelDictFormat(dictType = "sys_common_status") private String status; /** - * 鍒涘缓鑰� - */ - @TableField(fill = FieldFill.INSERT) - private String createBy; - - /** - * 鍒涘缓鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT) - private Date createTime; - - /** - * 鏇存柊鑰� - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updateBy; - - /** - * 鏇存柊鏃堕棿 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateTime; - - /** * 澶囨敞 */ + @ApiModelProperty(value = "澶囨敞") private String remark; - - /** - * 璇锋眰鍙傛暟 - */ - @TableField(exist = false) - private Map<String, Object> params = new HashMap<>(); /** * 鐢ㄦ埛鏄惁瀛樺湪姝ゅ矖浣嶆爣璇� 榛樿涓嶅瓨鍦� */ + @ApiModelProperty(value = "鐢ㄦ埛鏄惁瀛樺湪姝ゅ矖浣嶆爣璇� 榛樿涓嶅瓨鍦�") @TableField(exist = false) private boolean flag = false; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleDept.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleDept.java index 703f939..8c93bad 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleDept.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleDept.java @@ -1,29 +1,33 @@ package com.ruoyi.system.domain; import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.NoArgsConstructor; import lombok.experimental.Accessors; /** * 瑙掕壊鍜岄儴闂ㄥ叧鑱� sys_role_dept * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor @Accessors(chain = true) @TableName("sys_role_dept") +@ApiModel("瑙掕壊鍜岄儴闂ㄥ叧鑱�") public class SysRoleDept { + /** * 瑙掕壊ID */ + @ApiModelProperty(value = "瑙掕壊ID") private Long roleId; /** * 閮ㄩ棬ID */ + @ApiModelProperty(value = "閮ㄩ棬ID") private Long deptId; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java index 66941a9..aa819c7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java @@ -1,29 +1,33 @@ package com.ruoyi.system.domain; import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.NoArgsConstructor; import lombok.experimental.Accessors; /** * 瑙掕壊鍜岃彍鍗曞叧鑱� sys_role_menu * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor @Accessors(chain = true) @TableName("sys_role_menu") +@ApiModel("瑙掕壊鍜岃彍鍗曞叧鑱�") public class SysRoleMenu { + /** * 瑙掕壊ID */ + @ApiModelProperty(value = "瑙掕壊ID") private Long roleId; /** * 鑿滃崟ID */ + @ApiModelProperty(value = "瑙掕壊ID") private Long menuId; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java index c204e86..f81508c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java @@ -1,56 +1,67 @@ package com.ruoyi.system.domain; -import lombok.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; import lombok.experimental.Accessors; /** * 褰撳墠鍦ㄧ嚎浼氳瘽 * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor @Accessors(chain = true) +@ApiModel("褰撳墠鍦ㄧ嚎浼氳瘽涓氬姟瀵硅薄") public class SysUserOnline { + /** * 浼氳瘽缂栧彿 */ + @ApiModelProperty(value = "浼氳瘽缂栧彿") private String tokenId; /** * 閮ㄩ棬鍚嶇О */ + @ApiModelProperty(value = "閮ㄩ棬鍚嶇О") private String deptName; /** * 鐢ㄦ埛鍚嶇О */ + @ApiModelProperty(value = "鐢ㄦ埛鍚嶇О") private String userName; /** * 鐧诲綍IP鍦板潃 */ + @ApiModelProperty(value = "鐧诲綍IP鍦板潃") private String ipaddr; /** * 鐧诲綍鍦板潃 */ + @ApiModelProperty(value = "鐧诲綍鍦板潃") private String loginLocation; /** * 娴忚鍣ㄧ被鍨� */ + @ApiModelProperty(value = "娴忚鍣ㄧ被鍨�") private String browser; /** * 鎿嶄綔绯荤粺 */ + @ApiModelProperty(value = "鎿嶄綔绯荤粺") private String os; /** * 鐧诲綍鏃堕棿 */ + @ApiModelProperty(value = "鐧诲綍鏃堕棿") private Long loginTime; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserPost.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserPost.java index 33ec0ab..f6694e3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserPost.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserPost.java @@ -1,29 +1,33 @@ package com.ruoyi.system.domain; import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.NoArgsConstructor; import lombok.experimental.Accessors; /** * 鐢ㄦ埛鍜屽矖浣嶅叧鑱� sys_user_post * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor @Accessors(chain = true) @TableName("sys_user_post") +@ApiModel("鐢ㄦ埛鍜屽矖浣嶅叧鑱�") public class SysUserPost { + /** * 鐢ㄦ埛ID */ + @ApiModelProperty(value = "鐢ㄦ埛ID") private Long userId; /** * 宀椾綅ID */ + @ApiModelProperty(value = "宀椾綅ID") private Long postId; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserRole.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserRole.java index d02bdfe..fd4e2e5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserRole.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserRole.java @@ -1,29 +1,33 @@ package com.ruoyi.system.domain; import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.NoArgsConstructor; import lombok.experimental.Accessors; /** * 鐢ㄦ埛鍜岃鑹插叧鑱� sys_user_role * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor @Accessors(chain = true) @TableName("sys_user_role") +@ApiModel("鐢ㄦ埛鍜岃鑹插叧鑱�") public class SysUserRole { + /** * 鐢ㄦ埛ID */ + @ApiModelProperty(value = "鐢ㄦ埛ID") private Long userId; /** * 瑙掕壊ID */ + @ApiModelProperty(value = "瑙掕壊ID") private Long roleId; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SysOssBo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SysOssBo.java index e41f94f..f2770ab 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SysOssBo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SysOssBo.java @@ -16,52 +16,52 @@ @ApiModel("OSS瀵硅薄瀛樺偍鍒嗛〉鏌ヨ瀵硅薄") public class SysOssBo extends BaseEntity { - /** - * 鍒嗛〉澶у皬 - */ - @ApiModelProperty("鍒嗛〉澶у皬") - private Integer pageSize; - /** - * 褰撳墠椤垫暟 - */ - @ApiModelProperty("褰撳墠椤垫暟") - private Integer pageNum; - /** - * 鎺掑簭鍒� - */ - @ApiModelProperty("鎺掑簭鍒�") - private String orderByColumn; - /** - * 鎺掑簭鐨勬柟鍚慸esc鎴栬�卆sc - */ - @ApiModelProperty(value = "鎺掑簭鐨勬柟鍚�", example = "asc,desc") - private String isAsc; + /** + * 鍒嗛〉澶у皬 + */ + @ApiModelProperty("鍒嗛〉澶у皬") + private Integer pageSize; + /** + * 褰撳墠椤垫暟 + */ + @ApiModelProperty("褰撳墠椤垫暟") + private Integer pageNum; + /** + * 鎺掑簭鍒� + */ + @ApiModelProperty("鎺掑簭鍒�") + private String orderByColumn; + /** + * 鎺掑簭鐨勬柟鍚慸esc鎴栬�卆sc + */ + @ApiModelProperty(value = "鎺掑簭鐨勬柟鍚�", example = "asc,desc") + private String isAsc; - /** - * 鏂囦欢鍚� - */ - @ApiModelProperty("鏂囦欢鍚�") - private String fileName; - /** - * 鍘熷悕 - */ - @ApiModelProperty("鍘熷悕") - private String originalName; - /** - * 鏂囦欢鍚庣紑鍚� - */ - @ApiModelProperty("鏂囦欢鍚庣紑鍚�") - private String fileSuffix; - /** - * URL鍦板潃 - */ - @ApiModelProperty("URL鍦板潃") - private String url; - /** - * 鏈嶅姟鍟� - */ - @ApiModelProperty("鏈嶅姟鍟�") - private String service; + /** + * 鏂囦欢鍚� + */ + @ApiModelProperty("鏂囦欢鍚�") + private String fileName; + /** + * 鍘熷悕 + */ + @ApiModelProperty("鍘熷悕") + private String originalName; + /** + * 鏂囦欢鍚庣紑鍚� + */ + @ApiModelProperty("鏂囦欢鍚庣紑鍚�") + private String fileSuffix; + /** + * URL鍦板潃 + */ + @ApiModelProperty("URL鍦板潃") + private String url; + /** + * 鏈嶅姟鍟� + */ + @ApiModelProperty("鏈嶅姟鍟�") + private String service; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SysOssConfigBo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SysOssConfigBo.java index 44bc7a2..9b8b378 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SysOssConfigBo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SysOssConfigBo.java @@ -25,43 +25,43 @@ @ApiModel("瀵硅薄瀛樺偍閰嶇疆涓氬姟瀵硅薄") public class SysOssConfigBo extends BaseEntity { - /** - * 涓诲缓 - */ - @ApiModelProperty(value = "涓诲缓", required = true) - @NotNull(message = "涓诲缓涓嶈兘涓虹┖", groups = { EditGroup.class }) - private Long ossConfigId; + /** + * 涓诲缓 + */ + @ApiModelProperty(value = "涓诲缓", required = true) + @NotNull(message = "涓诲缓涓嶈兘涓虹┖", groups = {EditGroup.class}) + private Long ossConfigId; /** * 閰嶇疆key */ @ApiModelProperty(value = "configKey", required = true) - @NotBlank(message = "configKey涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) - @Size(min = 2, max = 100, message = "configKey闀垮害蹇呴』浠嬩簬2鍜�20 涔嬮棿") + @NotBlank(message = "configKey涓嶈兘涓虹┖", groups = {AddGroup.class, EditGroup.class}) + @Size(min = 2, max = 100, message = "configKey闀垮害蹇呴』浠嬩簬2鍜�20 涔嬮棿") private String configKey; /** * accessKey */ @ApiModelProperty(value = "accessKey", required = true) - @NotBlank(message = "accessKey涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) - @Size(min = 2, max = 100, message = "accessKey闀垮害蹇呴』浠嬩簬2鍜�100 涔嬮棿") + @NotBlank(message = "accessKey涓嶈兘涓虹┖", groups = {AddGroup.class, EditGroup.class}) + @Size(min = 2, max = 100, message = "accessKey闀垮害蹇呴』浠嬩簬2鍜�100 涔嬮棿") private String accessKey; /** * 绉橀挜 */ @ApiModelProperty(value = "secretKey", required = true) - @NotBlank(message = "secretKey涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) - @Size(min = 2, max = 100, message = "secretKey闀垮害蹇呴』浠嬩簬2鍜�100 涔嬮棿") + @NotBlank(message = "secretKey涓嶈兘涓虹┖", groups = {AddGroup.class, EditGroup.class}) + @Size(min = 2, max = 100, message = "secretKey闀垮害蹇呴』浠嬩簬2鍜�100 涔嬮棿") private String secretKey; /** * 妗跺悕绉� */ @ApiModelProperty(value = "bucketName", required = true) - @NotBlank(message = "bucketName涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) - @Size(min = 2, max = 100, message = "bucketName闀垮害蹇呴』浠嬩簬2鍜�100涔嬮棿") + @NotBlank(message = "bucketName涓嶈兘涓虹┖", groups = {AddGroup.class, EditGroup.class}) + @Size(min = 2, max = 100, message = "bucketName闀垮害蹇呴』浠嬩簬2鍜�100涔嬮棿") private String bucketName; /** @@ -74,21 +74,21 @@ * 璁块棶绔欑偣 */ @ApiModelProperty(value = "endpoint", required = true) - @NotBlank(message = "endpoint涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) - @Size(min = 2, max = 100, message = "endpoint闀垮害蹇呴』浠嬩簬2鍜�100涔嬮棿") + @NotBlank(message = "endpoint涓嶈兘涓虹┖", groups = {AddGroup.class, EditGroup.class}) + @Size(min = 2, max = 100, message = "endpoint闀垮害蹇呴』浠嬩簬2鍜�100涔嬮棿") private String endpoint; - /** - * 鏄惁https锛圷=鏄�,N=鍚︼級 - */ - @ApiModelProperty("鏄惁https锛圷=鏄�,N=鍚︼級") - private String isHttps; + /** + * 鏄惁https锛圷=鏄�,N=鍚︼級 + */ + @ApiModelProperty("鏄惁https锛圷=鏄�,N=鍚︼級") + private String isHttps; - /** - * 鐘舵�侊紙0=姝e父,1=鍋滅敤锛� - */ - @ApiModelProperty("鐘舵�侊紙0=姝e父,1=鍋滅敤锛�") - private String status; + /** + * 鐘舵�侊紙0=姝e父,1=鍋滅敤锛� + */ + @ApiModelProperty("鐘舵�侊紙0=姝e父,1=鍋滅敤锛�") + private String status; /** * 鍩� diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java index 495db54..6a3798a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java @@ -1,8 +1,9 @@ package com.ruoyi.system.domain.vo; import com.ruoyi.common.utils.StringUtils; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.NoArgsConstructor; import lombok.experimental.Accessors; /** @@ -12,28 +13,33 @@ */ @Data -@NoArgsConstructor @Accessors(chain = true) +@ApiModel("璺敱鏄剧ず淇℃伅") public class MetaVo { + /** * 璁剧疆璇ヨ矾鐢卞湪渚ц竟鏍忓拰闈㈠寘灞戜腑灞曠ず鐨勫悕瀛� */ + @ApiModelProperty(value = "璁剧疆璇ヨ矾鐢卞湪渚ц竟鏍忓拰闈㈠寘灞戜腑灞曠ず鐨勫悕瀛�") private String title; /** * 璁剧疆璇ヨ矾鐢辩殑鍥炬爣锛屽搴旇矾寰剆rc/assets/icons/svg */ + @ApiModelProperty(value = "璁剧疆璇ヨ矾鐢辩殑鍥炬爣锛屽搴旇矾寰剆rc/assets/icons/svg") private String icon; /** * 璁剧疆涓簍rue锛屽垯涓嶄細琚� <keep-alive>缂撳瓨 */ + @ApiModelProperty(value = "璁剧疆涓簍rue锛屽垯涓嶄細琚� <keep-alive>缂撳瓨") private boolean noCache; - /** - * 鍐呴摼鍦板潃锛坔ttp(s)://寮�澶达級 - */ - private String link; + /** + * 鍐呴摼鍦板潃锛坔ttp(s)://寮�澶达級 + */ + @ApiModelProperty(value = "鍐呴摼鍦板潃锛坔ttp(s)://寮�澶达級") + private String link; public MetaVo(String title, String icon) { this.title = title; @@ -46,19 +52,19 @@ this.noCache = noCache; } - public MetaVo(String title, String icon, String link) { - this.title = title; - this.icon = icon; - this.link = link; - } + public MetaVo(String title, String icon, String link) { + this.title = title; + this.icon = icon; + this.link = link; + } - public MetaVo(String title, String icon, boolean noCache, String link) { - this.title = title; - this.icon = icon; - this.noCache = noCache; - if (StringUtils.ishttp(link)) { - this.link = link; - } - } + public MetaVo(String title, String icon, boolean noCache, String link) { + this.title = title; + this.icon = icon; + this.noCache = noCache; + if (StringUtils.ishttp(link)) { + this.link = link; + } + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java index 387adb4..05ba451 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java @@ -1,7 +1,9 @@ package com.ruoyi.system.domain.vo; import com.fasterxml.jackson.annotation.JsonInclude; -import lombok.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; import lombok.experimental.Accessors; import java.util.List; @@ -9,56 +11,66 @@ /** * 璺敱閰嶇疆淇℃伅 * - * @author ruoyi + * @author Lion Li */ @Data -@NoArgsConstructor @Accessors(chain = true) @JsonInclude(JsonInclude.Include.NON_EMPTY) +@ApiModel("璺敱閰嶇疆淇℃伅") public class RouterVo { + /** * 璺敱鍚嶅瓧 */ + @ApiModelProperty(value = "璺敱鍚嶅瓧") private String name; /** * 璺敱鍦板潃 */ + @ApiModelProperty(value = "璺敱鍦板潃") private String path; /** * 鏄惁闅愯棌璺敱锛屽綋璁剧疆 true 鐨勬椂鍊欒璺敱涓嶄細鍐嶄晶杈规爮鍑虹幇 */ + @ApiModelProperty(value = "鏄惁闅愯棌璺敱锛屽綋璁剧疆 true 鐨勬椂鍊欒璺敱涓嶄細鍐嶄晶杈规爮鍑虹幇") private boolean hidden; /** * 閲嶅畾鍚戝湴鍧�锛屽綋璁剧疆 noRedirect 鐨勬椂鍊欒璺敱鍦ㄩ潰鍖呭睉瀵艰埅涓笉鍙鐐瑰嚮 */ + @ApiModelProperty(value = "閲嶅畾鍚戝湴鍧�锛屽綋璁剧疆 noRedirect 鐨勬椂鍊欒璺敱鍦ㄩ潰鍖呭睉瀵艰埅涓笉鍙鐐瑰嚮") private String redirect; /** * 缁勪欢鍦板潃 */ + @ApiModelProperty(value = "缁勪欢鍦板潃") private String component; /** * 璺敱鍙傛暟锛氬 {"id": 1, "name": "ry"} */ + @ApiModelProperty(value = "璺敱鍙傛暟锛氬 {\"id\": 1, \"name\": \"ry\"}") private String query; /** * 褰撲綘涓�涓矾鐢变笅闈㈢殑 children 澹版槑鐨勮矾鐢卞ぇ浜�1涓椂锛岃嚜鍔ㄤ細鍙樻垚宓屽鐨勬ā寮�--濡傜粍浠堕〉闈� */ + @ApiModelProperty(value = "褰撲綘涓�涓矾鐢变笅闈㈢殑 children 澹版槑鐨勮矾鐢卞ぇ浜�1涓椂锛岃嚜鍔ㄤ細鍙樻垚宓屽鐨勬ā寮�--濡傜粍浠堕〉闈�") private Boolean alwaysShow; /** * 鍏朵粬鍏冪礌 */ + @ApiModelProperty(value = "鍏朵粬鍏冪礌") private MetaVo meta; /** * 瀛愯矾鐢� */ + @ApiModelProperty(value = "瀛愯矾鐢�") private List<RouterVo> children; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysOssConfigVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysOssConfigVo.java index 79b2b17..0fb08dd 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysOssConfigVo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysOssConfigVo.java @@ -6,7 +6,6 @@ import lombok.Data; - /** * 瀵硅薄瀛樺偍閰嶇疆瑙嗗浘瀵硅薄 sys_oss_config * @@ -19,78 +18,78 @@ @ExcelIgnoreUnannotated public class SysOssConfigVo { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** + /** * 涓诲缓 */ - @ApiModelProperty("涓诲缓") - private Long ossConfigId; + @ApiModelProperty("涓诲缓") + private Long ossConfigId; /** * 閰嶇疆key */ - @ApiModelProperty("閰嶇疆key") - private String configKey; + @ApiModelProperty("閰嶇疆key") + private String configKey; /** * accessKey */ - @ApiModelProperty("accessKey") - private String accessKey; + @ApiModelProperty("accessKey") + private String accessKey; /** * 绉橀挜 */ - @ApiModelProperty("secretKey") - private String secretKey; + @ApiModelProperty("secretKey") + private String secretKey; /** * 妗跺悕绉� */ - @ApiModelProperty("妗跺悕绉�") - private String bucketName; + @ApiModelProperty("妗跺悕绉�") + private String bucketName; /** * 鍓嶇紑 */ - @ApiModelProperty("鍓嶇紑") - private String prefix; + @ApiModelProperty("鍓嶇紑") + private String prefix; /** * 璁块棶绔欑偣 */ - @ApiModelProperty("璁块棶绔欑偣") - private String endpoint; + @ApiModelProperty("璁块棶绔欑偣") + private String endpoint; /** * 鏄惁https锛圷=鏄�,N=鍚︼級 */ - @ApiModelProperty("鏄惁https锛圷=鏄�,N=鍚︼級") - private String isHttps; + @ApiModelProperty("鏄惁https锛圷=鏄�,N=鍚︼級") + private String isHttps; /** * 鍩� */ - @ApiModelProperty("鍩�") - private String region; + @ApiModelProperty("鍩�") + private String region; /** * 鐘舵�侊紙0=姝e父,1=鍋滅敤锛� */ - @ApiModelProperty("鐘舵�侊紙0=姝e父,1=鍋滅敤锛�") - private String status; + @ApiModelProperty("鐘舵�侊紙0=姝e父,1=鍋滅敤锛�") + private String status; /** * 鎵╁睍瀛楁 */ - @ApiModelProperty("鎵╁睍瀛楁") - private String ext1; + @ApiModelProperty("鎵╁睍瀛楁") + private String ext1; - /** - * 澶囨敞 - */ - @ApiModelProperty("澶囨敞") - private String remark; + /** + * 澶囨敞 + */ + @ApiModelProperty("澶囨敞") + private String remark; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysOssVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysOssVo.java index 26e0151..eb2299e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysOssVo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysOssVo.java @@ -15,55 +15,55 @@ @ApiModel("OSS瀵硅薄瀛樺偍瑙嗗浘瀵硅薄") public class SysOssVo { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * 瀵硅薄瀛樺偍涓婚敭 - */ - @ApiModelProperty("瀵硅薄瀛樺偍涓婚敭") - private Long ossId; + /** + * 瀵硅薄瀛樺偍涓婚敭 + */ + @ApiModelProperty("瀵硅薄瀛樺偍涓婚敭") + private Long ossId; - /** - * 鏂囦欢鍚� - */ - @ApiModelProperty("鏂囦欢鍚�") - private String fileName; + /** + * 鏂囦欢鍚� + */ + @ApiModelProperty("鏂囦欢鍚�") + private String fileName; - /** - * 鍘熷悕 - */ - @ApiModelProperty("鍘熷悕") - private String originalName; + /** + * 鍘熷悕 + */ + @ApiModelProperty("鍘熷悕") + private String originalName; - /** - * 鏂囦欢鍚庣紑鍚� - */ - @ApiModelProperty("鏂囦欢鍚庣紑鍚�") - private String fileSuffix; + /** + * 鏂囦欢鍚庣紑鍚� + */ + @ApiModelProperty("鏂囦欢鍚庣紑鍚�") + private String fileSuffix; - /** - * URL鍦板潃 - */ - @ApiModelProperty("URL鍦板潃") - private String url; + /** + * URL鍦板潃 + */ + @ApiModelProperty("URL鍦板潃") + private String url; - /** - * 鍒涘缓鏃堕棿 - */ - @ApiModelProperty("鍒涘缓鏃堕棿") - private Date createTime; + /** + * 鍒涘缓鏃堕棿 + */ + @ApiModelProperty("鍒涘缓鏃堕棿") + private Date createTime; - /** - * 涓婁紶浜� - */ - @ApiModelProperty("涓婁紶浜�") - private String createBy; + /** + * 涓婁紶浜� + */ + @ApiModelProperty("涓婁紶浜�") + private String createBy; - /** - * 鏈嶅姟鍟� - */ - @ApiModelProperty("鏈嶅姟鍟�") - private String service; + /** + * 鏈嶅姟鍟� + */ + @ApiModelProperty("鏈嶅姟鍟�") + private String service; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserExportVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserExportVo.java index 6842f0a..c43c8a5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserExportVo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserExportVo.java @@ -20,74 +20,74 @@ @NoArgsConstructor @Accessors(chain = true) public class SysUserExportVo implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * 鐢ㄦ埛ID - */ - @ExcelProperty(value = "鐢ㄦ埛搴忓彿") - private Long userId; + /** + * 鐢ㄦ埛ID + */ + @ExcelProperty(value = "鐢ㄦ埛搴忓彿") + private Long userId; - /** - * 鐢ㄦ埛璐﹀彿 - */ - @ExcelProperty(value = "鐧诲綍鍚嶇О") - private String userName; + /** + * 鐢ㄦ埛璐﹀彿 + */ + @ExcelProperty(value = "鐧诲綍鍚嶇О") + private String userName; - /** - * 鐢ㄦ埛鏄电О - */ - @ExcelProperty(value = "鐢ㄦ埛鍚嶇О") - private String nickName; + /** + * 鐢ㄦ埛鏄电О + */ + @ExcelProperty(value = "鐢ㄦ埛鍚嶇О") + private String nickName; - /** - * 鐢ㄦ埛閭 - */ - @ExcelProperty(value = "鐢ㄦ埛閭") - private String email; + /** + * 鐢ㄦ埛閭 + */ + @ExcelProperty(value = "鐢ㄦ埛閭") + private String email; - /** - * 鎵嬫満鍙风爜 - */ - @ExcelProperty(value = "鎵嬫満鍙风爜") - private String phonenumber; + /** + * 鎵嬫満鍙风爜 + */ + @ExcelProperty(value = "鎵嬫満鍙风爜") + private String phonenumber; - /** - * 鐢ㄦ埛鎬у埆 - */ - @ExcelProperty(value = "鐢ㄦ埛鎬у埆", converter = ExcelDictConvert.class) - @ExcelDictFormat(dictType = "sys_user_sex") - private String sex; + /** + * 鐢ㄦ埛鎬у埆 + */ + @ExcelProperty(value = "鐢ㄦ埛鎬у埆", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "sys_user_sex") + private String sex; - /** - * 甯愬彿鐘舵�侊紙0姝e父 1鍋滅敤锛� - */ - @ExcelProperty(value = "甯愬彿鐘舵��", converter = ExcelDictConvert.class) - @ExcelDictFormat(dictType = "sys_common_status") - private String status; + /** + * 甯愬彿鐘舵�侊紙0姝e父 1鍋滅敤锛� + */ + @ExcelProperty(value = "甯愬彿鐘舵��", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "sys_common_status") + private String status; - /** - * 鏈�鍚庣櫥褰旾P - */ - @ExcelProperty(value = "鏈�鍚庣櫥褰旾P") - private String loginIp; + /** + * 鏈�鍚庣櫥褰旾P + */ + @ExcelProperty(value = "鏈�鍚庣櫥褰旾P") + private String loginIp; - /** - * 鏈�鍚庣櫥褰曟椂闂� - */ - @ExcelProperty(value = "鏈�鍚庣櫥褰曟椂闂�") - private Date loginDate; + /** + * 鏈�鍚庣櫥褰曟椂闂� + */ + @ExcelProperty(value = "鏈�鍚庣櫥褰曟椂闂�") + private Date loginDate; - /** - * 閮ㄩ棬鍚嶇О - */ - @ExcelProperty(value = "閮ㄩ棬鍚嶇О") - private String deptName; + /** + * 閮ㄩ棬鍚嶇О + */ + @ExcelProperty(value = "閮ㄩ棬鍚嶇О") + private String deptName; - /** - * 璐熻矗浜� - */ - @ExcelProperty(value = "閮ㄩ棬璐熻矗浜�") - private String leader; + /** + * 璐熻矗浜� + */ + @ExcelProperty(value = "閮ㄩ棬璐熻矗浜�") + private String leader; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserImportVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserImportVo.java index 9c1a7d3..16932ad 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserImportVo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserImportVo.java @@ -18,56 +18,56 @@ @NoArgsConstructor // @Accessors(chain = true) // 瀵煎叆涓嶅厑璁镐娇鐢� 浼氭壘涓嶅埌set鏂规硶 public class SysUserImportVo implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * 鐢ㄦ埛ID - */ - @ExcelProperty(value = "鐢ㄦ埛搴忓彿") - private Long userId; + /** + * 鐢ㄦ埛ID + */ + @ExcelProperty(value = "鐢ㄦ埛搴忓彿") + private Long userId; - /** - * 閮ㄩ棬ID - */ - @ExcelProperty(value = "閮ㄩ棬缂栧彿") - private Long deptId; + /** + * 閮ㄩ棬ID + */ + @ExcelProperty(value = "閮ㄩ棬缂栧彿") + private Long deptId; - /** - * 鐢ㄦ埛璐﹀彿 - */ - @ExcelProperty(value = "鐧诲綍鍚嶇О") - private String userName; + /** + * 鐢ㄦ埛璐﹀彿 + */ + @ExcelProperty(value = "鐧诲綍鍚嶇О") + private String userName; - /** - * 鐢ㄦ埛鏄电О - */ - @ExcelProperty(value = "鐢ㄦ埛鍚嶇О") - private String nickName; + /** + * 鐢ㄦ埛鏄电О + */ + @ExcelProperty(value = "鐢ㄦ埛鍚嶇О") + private String nickName; - /** - * 鐢ㄦ埛閭 - */ - @ExcelProperty(value = "鐢ㄦ埛閭") - private String email; + /** + * 鐢ㄦ埛閭 + */ + @ExcelProperty(value = "鐢ㄦ埛閭") + private String email; - /** - * 鎵嬫満鍙风爜 - */ - @ExcelProperty(value = "鎵嬫満鍙风爜") - private String phonenumber; + /** + * 鎵嬫満鍙风爜 + */ + @ExcelProperty(value = "鎵嬫満鍙风爜") + private String phonenumber; - /** - * 鐢ㄦ埛鎬у埆 - */ - @ExcelProperty(value = "鐢ㄦ埛鎬у埆", converter = ExcelDictConvert.class) - @ExcelDictFormat(dictType = "sys_user_sex") - private String sex; + /** + * 鐢ㄦ埛鎬у埆 + */ + @ExcelProperty(value = "鐢ㄦ埛鎬у埆", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "sys_user_sex") + private String sex; - /** - * 甯愬彿鐘舵�侊紙0姝e父 1鍋滅敤锛� - */ - @ExcelProperty(value = "甯愬彿鐘舵��", converter = ExcelDictConvert.class) - @ExcelDictFormat(dictType = "sys_common_status") - private String status; + /** + * 甯愬彿鐘舵�侊紙0姝e父 1鍋滅敤锛� + */ + @ExcelProperty(value = "甯愬彿鐘舵��", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "sys_common_status") + private String status; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java index 97aaa52..9431389 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java @@ -6,7 +6,7 @@ /** * 鍙傛暟閰嶇疆 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface SysConfigMapper extends BaseMapperPlus<SysConfig> { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java index ecee7ea..051085c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java @@ -9,7 +9,7 @@ /** * 閮ㄩ棬绠$悊 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface SysDeptMapper extends BaseMapperPlus<SysDept> { @@ -19,23 +19,23 @@ * @param dept 閮ㄩ棬淇℃伅 * @return 閮ㄩ棬淇℃伅闆嗗悎 */ - public List<SysDept> selectDeptList(SysDept dept); + List<SysDept> selectDeptList(SysDept dept); /** * 鏍规嵁瑙掕壊ID鏌ヨ閮ㄩ棬鏍戜俊鎭� * - * @param roleId 瑙掕壊ID + * @param roleId 瑙掕壊ID * @param deptCheckStrictly 閮ㄩ棬鏍戦�夋嫨椤规槸鍚﹀叧鑱旀樉绀� * @return 閫変腑閮ㄩ棬鍒楄〃 */ - public List<Integer> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly); + List<Integer> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly); - /** - * 淇敼瀛愬厓绱犲叧绯� - * - * @param depts 瀛愬厓绱� - * @return 缁撴灉 - */ - public int updateDeptChildren(@Param("depts") List<SysDept> depts); + /** + * 淇敼瀛愬厓绱犲叧绯� + * + * @param depts 瀛愬厓绱� + * @return 缁撴灉 + */ + int updateDeptChildren(@Param("depts") List<SysDept> depts); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java index db5c98e..e45c198 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java @@ -9,15 +9,15 @@ /** * 瀛楀吀琛� 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface SysDictDataMapper extends BaseMapperPlus<SysDictData> { - default List<SysDictData> selectDictDataByType(String dictType) { - return selectList( - new LambdaQueryWrapper<SysDictData>() - .eq(SysDictData::getStatus, "0") - .eq(SysDictData::getDictType, dictType) - .orderByAsc(SysDictData::getDictSort)); - } + default List<SysDictData> selectDictDataByType(String dictType) { + return selectList( + new LambdaQueryWrapper<SysDictData>() + .eq(SysDictData::getStatus, "0") + .eq(SysDictData::getDictType, dictType) + .orderByAsc(SysDictData::getDictSort)); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java index 7ff8c46..7e03a25 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java @@ -6,7 +6,7 @@ /** * 瀛楀吀琛� 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface SysDictTypeMapper extends BaseMapperPlus<SysDictType> { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java index cc99c10..fe47417 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java @@ -6,7 +6,7 @@ /** * 绯荤粺璁块棶鏃ュ織鎯呭喌淇℃伅 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface SysLogininforMapper extends BaseMapperPlus<SysLogininfor> { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java index f54ceea..8b5dcd6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java @@ -9,7 +9,7 @@ /** * 鑿滃崟琛� 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface SysMenuMapper extends BaseMapperPlus<SysMenu> { @@ -18,7 +18,7 @@ * * @return 鏉冮檺鍒楄〃 */ - public List<String> selectMenuPerms(); + List<String> selectMenuPerms(); /** * 鏍规嵁鐢ㄦ埛鏌ヨ绯荤粺鑿滃崟鍒楄〃 @@ -26,7 +26,7 @@ * @param menu 鑿滃崟淇℃伅 * @return 鑿滃崟鍒楄〃 */ - public List<SysMenu> selectMenuListByUserId(SysMenu menu); + List<SysMenu> selectMenuListByUserId(SysMenu menu); /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ鏉冮檺 @@ -34,14 +34,14 @@ * @param userId 鐢ㄦ埛ID * @return 鏉冮檺鍒楄〃 */ - public List<String> selectMenuPermsByUserId(Long userId); + List<String> selectMenuPermsByUserId(Long userId); /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ鑿滃崟 * * @return 鑿滃崟鍒楄〃 */ - public List<SysMenu> selectMenuTreeAll(); + List<SysMenu> selectMenuTreeAll(); /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ鑿滃崟 @@ -49,7 +49,7 @@ * @param userId 鐢ㄦ埛ID * @return 鑿滃崟鍒楄〃 */ - public List<SysMenu> selectMenuTreeByUserId(Long userId); + List<SysMenu> selectMenuTreeByUserId(Long userId); /** * 鏍规嵁瑙掕壊ID鏌ヨ鑿滃崟鏍戜俊鎭� @@ -58,6 +58,6 @@ * @param menuCheckStrictly 鑿滃崟鏍戦�夋嫨椤规槸鍚﹀叧鑱旀樉绀� * @return 閫変腑鑿滃崟鍒楄〃 */ - public List<Integer> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly); + List<Integer> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java index 68c2825..de972ff 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java @@ -6,7 +6,7 @@ /** * 閫氱煡鍏憡琛� 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface SysNoticeMapper extends BaseMapperPlus<SysNotice> { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java index 93d3262..c1c3b54 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java @@ -6,7 +6,7 @@ /** * 鎿嶄綔鏃ュ織 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface SysOperLogMapper extends BaseMapperPlus<SysOperLog> { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java index 8a1b309..50a5c75 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java @@ -8,7 +8,7 @@ /** * 宀椾綅淇℃伅 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface SysPostMapper extends BaseMapperPlus<SysPost> { @@ -18,7 +18,7 @@ * @param userId 鐢ㄦ埛ID * @return 閫変腑宀椾綅ID鍒楄〃 */ - public List<Integer> selectPostListByUserId(Long userId); + List<Integer> selectPostListByUserId(Long userId); /** * 鏌ヨ鐢ㄦ埛鎵�灞炲矖浣嶇粍 @@ -26,6 +26,6 @@ * @param userName 鐢ㄦ埛鍚� * @return 缁撴灉 */ - public List<SysPost> selectPostsByUserName(String userName); + List<SysPost> selectPostsByUserName(String userName); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java index af248c1..bf91a92 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java @@ -6,7 +6,7 @@ /** * 瑙掕壊涓庨儴闂ㄥ叧鑱旇〃 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface SysRoleDeptMapper extends BaseMapperPlus<SysRoleDept> { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java index 972f8f6..164a697 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java @@ -10,7 +10,7 @@ /** * 瑙掕壊琛� 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface SysRoleMapper extends BaseMapperPlus<SysRole> { @@ -22,7 +22,7 @@ * @param role 瑙掕壊淇℃伅 * @return 瑙掕壊鏁版嵁闆嗗悎淇℃伅 */ - public List<SysRole> selectRoleList(SysRole role); + List<SysRole> selectRoleList(SysRole role); /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ瑙掕壊 @@ -30,7 +30,7 @@ * @param userId 鐢ㄦ埛ID * @return 瑙掕壊鍒楄〃 */ - public List<SysRole> selectRolePermissionByUserId(Long userId); + List<SysRole> selectRolePermissionByUserId(Long userId); /** @@ -39,7 +39,7 @@ * @param userId 鐢ㄦ埛ID * @return 閫変腑瑙掕壊ID鍒楄〃 */ - public List<Integer> selectRoleListByUserId(Long userId); + List<Integer> selectRoleListByUserId(Long userId); /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ瑙掕壊 @@ -47,6 +47,6 @@ * @param userName 鐢ㄦ埛鍚� * @return 瑙掕壊鍒楄〃 */ - public List<SysRole> selectRolesByUserName(String userName); + List<SysRole> selectRolesByUserName(String userName); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java index c7e743e..f92ebbb 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java @@ -6,7 +6,7 @@ /** * 瑙掕壊涓庤彍鍗曞叧鑱旇〃 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface SysRoleMenuMapper extends BaseMapperPlus<SysRoleMenu> { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java index cba0668..e930d87 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java @@ -10,7 +10,7 @@ /** * 鐢ㄦ埛琛� 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface SysUserMapper extends BaseMapperPlus<SysUser> { @@ -22,7 +22,7 @@ * @param sysUser 鐢ㄦ埛淇℃伅 * @return 鐢ㄦ埛淇℃伅闆嗗悎淇℃伅 */ - public List<SysUser> selectUserList(SysUser sysUser); + List<SysUser> selectUserList(SysUser sysUser); /** * 鏍规嵁鏉′欢鍒嗛〉鏌ヨ鏈凡閰嶇敤鎴疯鑹插垪琛� @@ -30,7 +30,7 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 鐢ㄦ埛淇℃伅闆嗗悎淇℃伅 */ - public Page<SysUser> selectAllocatedList(@Param("page") Page<SysUser> page, @Param("user") SysUser user); + Page<SysUser> selectAllocatedList(@Param("page") Page<SysUser> page, @Param("user") SysUser user); /** * 鏍规嵁鏉′欢鍒嗛〉鏌ヨ鏈垎閰嶇敤鎴疯鑹插垪琛� @@ -38,7 +38,7 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 鐢ㄦ埛淇℃伅闆嗗悎淇℃伅 */ - public Page<SysUser> selectUnallocatedList(@Param("page") Page<SysUser> page, @Param("user") SysUser user); + Page<SysUser> selectUnallocatedList(@Param("page") Page<SysUser> page, @Param("user") SysUser user); /** * 閫氳繃鐢ㄦ埛鍚嶆煡璇㈢敤鎴� @@ -46,7 +46,7 @@ * @param userName 鐢ㄦ埛鍚� * @return 鐢ㄦ埛瀵硅薄淇℃伅 */ - public SysUser selectUserByUserName(String userName); + SysUser selectUserByUserName(String userName); /** * 閫氳繃鐢ㄦ埛ID鏌ヨ鐢ㄦ埛 @@ -54,6 +54,6 @@ * @param userId 鐢ㄦ埛ID * @return 鐢ㄦ埛瀵硅薄淇℃伅 */ - public SysUser selectUserById(Long userId); + SysUser selectUserById(Long userId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java index e5c63e3..e0f1bb0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java @@ -6,7 +6,7 @@ /** * 鐢ㄦ埛涓庡矖浣嶅叧鑱旇〃 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface SysUserPostMapper extends BaseMapperPlus<SysUserPost> { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java index 260ec32..052599c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java @@ -6,7 +6,7 @@ /** * 鐢ㄦ埛涓庤鑹插叧鑱旇〃 鏁版嵁灞� * - * @author ruoyi + * @author Lion Li */ public interface SysUserRoleMapper extends BaseMapperPlus<SysUserRole> { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java index fdc76fb..fe28387 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java @@ -9,7 +9,7 @@ /** * 鍙傛暟閰嶇疆 鏈嶅姟灞� * - * @author ruoyi + * @author Lion Li */ public interface ISysConfigService extends IService<SysConfig> { @@ -22,7 +22,7 @@ * @param configId 鍙傛暟閰嶇疆ID * @return 鍙傛暟閰嶇疆淇℃伅 */ - public SysConfig selectConfigById(Long configId); + SysConfig selectConfigById(Long configId); /** * 鏍规嵁閿悕鏌ヨ鍙傛暟閰嶇疆淇℃伅 @@ -30,14 +30,14 @@ * @param configKey 鍙傛暟閿悕 * @return 鍙傛暟閿�� */ - public String selectConfigByKey(String configKey); + String selectConfigByKey(String configKey); /** * 鑾峰彇楠岃瘉鐮佸紑鍏� * * @return true寮�鍚紝false鍏抽棴 */ - public boolean selectCaptchaOnOff(); + boolean selectCaptchaOnOff(); /** * 鏌ヨ鍙傛暟閰嶇疆鍒楄〃 @@ -45,7 +45,7 @@ * @param config 鍙傛暟閰嶇疆淇℃伅 * @return 鍙傛暟閰嶇疆闆嗗悎 */ - public List<SysConfig> selectConfigList(SysConfig config); + List<SysConfig> selectConfigList(SysConfig config); /** * 鏂板鍙傛暟閰嶇疆 @@ -53,7 +53,7 @@ * @param config 鍙傛暟閰嶇疆淇℃伅 * @return 缁撴灉 */ - public int insertConfig(SysConfig config); + int insertConfig(SysConfig config); /** * 淇敼鍙傛暟閰嶇疆 @@ -61,7 +61,7 @@ * @param config 鍙傛暟閰嶇疆淇℃伅 * @return 缁撴灉 */ - public int updateConfig(SysConfig config); + int updateConfig(SysConfig config); /** * 鎵归噺鍒犻櫎鍙傛暟淇℃伅 @@ -69,22 +69,22 @@ * @param configIds 闇�瑕佸垹闄ょ殑鍙傛暟ID * @return 缁撴灉 */ - public void deleteConfigByIds(Long[] configIds); + void deleteConfigByIds(Long[] configIds); /** * 鍔犺浇鍙傛暟缂撳瓨鏁版嵁 */ - public void loadingConfigCache(); + void loadingConfigCache(); /** * 娓呯┖鍙傛暟缂撳瓨鏁版嵁 */ - public void clearConfigCache(); + void clearConfigCache(); /** * 閲嶇疆鍙傛暟缂撳瓨鏁版嵁 */ - public void resetConfigCache(); + void resetConfigCache(); /** * 鏍¢獙鍙傛暟閿悕鏄惁鍞竴 @@ -92,5 +92,5 @@ * @param config 鍙傛暟淇℃伅 * @return 缁撴灉 */ - public String checkConfigKeyUnique(SysConfig config); + String checkConfigKeyUnique(SysConfig config); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java index 38bccc9..ea6afa2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java @@ -9,7 +9,7 @@ /** * 閮ㄩ棬绠$悊 鏈嶅姟灞� * - * @author ruoyi + * @author Lion Li */ public interface ISysDeptService extends IService<SysDept> { /** @@ -18,7 +18,7 @@ * @param dept 閮ㄩ棬淇℃伅 * @return 閮ㄩ棬淇℃伅闆嗗悎 */ - public List<SysDept> selectDeptList(SysDept dept); + List<SysDept> selectDeptList(SysDept dept); /** * 鏋勫缓鍓嶇鎵�闇�瑕佹爲缁撴瀯 @@ -26,7 +26,7 @@ * @param depts 閮ㄩ棬鍒楄〃 * @return 鏍戠粨鏋勫垪琛� */ - public List<SysDept> buildDeptTree(List<SysDept> depts); + List<SysDept> buildDeptTree(List<SysDept> depts); /** * 鏋勫缓鍓嶇鎵�闇�瑕佷笅鎷夋爲缁撴瀯 @@ -34,7 +34,7 @@ * @param depts 閮ㄩ棬鍒楄〃 * @return 涓嬫媺鏍戠粨鏋勫垪琛� */ - public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts); + List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts); /** * 鏍规嵁瑙掕壊ID鏌ヨ閮ㄩ棬鏍戜俊鎭� @@ -42,7 +42,7 @@ * @param roleId 瑙掕壊ID * @return 閫変腑閮ㄩ棬鍒楄〃 */ - public List<Integer> selectDeptListByRoleId(Long roleId); + List<Integer> selectDeptListByRoleId(Long roleId); /** * 鏍规嵁閮ㄩ棬ID鏌ヨ淇℃伅 @@ -50,7 +50,7 @@ * @param deptId 閮ㄩ棬ID * @return 閮ㄩ棬淇℃伅 */ - public SysDept selectDeptById(Long deptId); + SysDept selectDeptById(Long deptId); /** * 鏍规嵁ID鏌ヨ鎵�鏈夊瓙閮ㄩ棬锛堟甯哥姸鎬侊級 @@ -58,7 +58,7 @@ * @param deptId 閮ㄩ棬ID * @return 瀛愰儴闂ㄦ暟 */ - public long selectNormalChildrenDeptById(Long deptId); + long selectNormalChildrenDeptById(Long deptId); /** * 鏄惁瀛樺湪閮ㄩ棬瀛愯妭鐐� @@ -66,7 +66,7 @@ * @param deptId 閮ㄩ棬ID * @return 缁撴灉 */ - public boolean hasChildByDeptId(Long deptId); + boolean hasChildByDeptId(Long deptId); /** * 鏌ヨ閮ㄩ棬鏄惁瀛樺湪鐢ㄦ埛 @@ -74,7 +74,7 @@ * @param deptId 閮ㄩ棬ID * @return 缁撴灉 true 瀛樺湪 false 涓嶅瓨鍦� */ - public boolean checkDeptExistUser(Long deptId); + boolean checkDeptExistUser(Long deptId); /** * 鏍¢獙閮ㄩ棬鍚嶇О鏄惁鍞竴 @@ -82,14 +82,14 @@ * @param dept 閮ㄩ棬淇℃伅 * @return 缁撴灉 */ - public String checkDeptNameUnique(SysDept dept); + String checkDeptNameUnique(SysDept dept); /** * 鏍¢獙閮ㄩ棬鏄惁鏈夋暟鎹潈闄� * * @param deptId 閮ㄩ棬id */ - public void checkDeptDataScope(Long deptId); + void checkDeptDataScope(Long deptId); /** * 鏂板淇濆瓨閮ㄩ棬淇℃伅 @@ -97,7 +97,7 @@ * @param dept 閮ㄩ棬淇℃伅 * @return 缁撴灉 */ - public int insertDept(SysDept dept); + int insertDept(SysDept dept); /** * 淇敼淇濆瓨閮ㄩ棬淇℃伅 @@ -105,7 +105,7 @@ * @param dept 閮ㄩ棬淇℃伅 * @return 缁撴灉 */ - public int updateDept(SysDept dept); + int updateDept(SysDept dept); /** * 鍒犻櫎閮ㄩ棬绠$悊淇℃伅 @@ -113,5 +113,5 @@ * @param deptId 閮ㄩ棬ID * @return 缁撴灉 */ - public int deleteDeptById(Long deptId); + int deleteDeptById(Long deptId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java index 25daa1a..ce6898e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java @@ -9,7 +9,7 @@ /** * 瀛楀吀 涓氬姟灞� * - * @author ruoyi + * @author Lion Li */ public interface ISysDictDataService extends IService<SysDictData> { @@ -22,7 +22,7 @@ * @param dictData 瀛楀吀鏁版嵁淇℃伅 * @return 瀛楀吀鏁版嵁闆嗗悎淇℃伅 */ - public List<SysDictData> selectDictDataList(SysDictData dictData); + List<SysDictData> selectDictDataList(SysDictData dictData); /** * 鏍规嵁瀛楀吀绫诲瀷鍜屽瓧鍏搁敭鍊兼煡璇㈠瓧鍏告暟鎹俊鎭� @@ -31,7 +31,7 @@ * @param dictValue 瀛楀吀閿�� * @return 瀛楀吀鏍囩 */ - public String selectDictLabel(String dictType, String dictValue); + String selectDictLabel(String dictType, String dictValue); /** * 鏍规嵁瀛楀吀鏁版嵁ID鏌ヨ淇℃伅 @@ -39,7 +39,7 @@ * @param dictCode 瀛楀吀鏁版嵁ID * @return 瀛楀吀鏁版嵁 */ - public SysDictData selectDictDataById(Long dictCode); + SysDictData selectDictDataById(Long dictCode); /** * 鎵归噺鍒犻櫎瀛楀吀鏁版嵁淇℃伅 @@ -47,7 +47,7 @@ * @param dictCodes 闇�瑕佸垹闄ょ殑瀛楀吀鏁版嵁ID * @return 缁撴灉 */ - public void deleteDictDataByIds(Long[] dictCodes); + void deleteDictDataByIds(Long[] dictCodes); /** * 鏂板淇濆瓨瀛楀吀鏁版嵁淇℃伅 @@ -55,7 +55,7 @@ * @param dictData 瀛楀吀鏁版嵁淇℃伅 * @return 缁撴灉 */ - public int insertDictData(SysDictData dictData); + int insertDictData(SysDictData dictData); /** * 淇敼淇濆瓨瀛楀吀鏁版嵁淇℃伅 @@ -63,5 +63,5 @@ * @param dictData 瀛楀吀鏁版嵁淇℃伅 * @return 缁撴灉 */ - public int updateDictData(SysDictData dictData); + int updateDictData(SysDictData dictData); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java index ac1d6c9..9599c4f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java @@ -10,7 +10,7 @@ /** * 瀛楀吀 涓氬姟灞� * - * @author ruoyi + * @author Lion Li */ public interface ISysDictTypeService extends IService<SysDictType> { @@ -23,14 +23,14 @@ * @param dictType 瀛楀吀绫诲瀷淇℃伅 * @return 瀛楀吀绫诲瀷闆嗗悎淇℃伅 */ - public List<SysDictType> selectDictTypeList(SysDictType dictType); + List<SysDictType> selectDictTypeList(SysDictType dictType); /** * 鏍规嵁鎵�鏈夊瓧鍏哥被鍨� * * @return 瀛楀吀绫诲瀷闆嗗悎淇℃伅 */ - public List<SysDictType> selectDictTypeAll(); + List<SysDictType> selectDictTypeAll(); /** * 鏍规嵁瀛楀吀绫诲瀷鏌ヨ瀛楀吀鏁版嵁 @@ -38,7 +38,7 @@ * @param dictType 瀛楀吀绫诲瀷 * @return 瀛楀吀鏁版嵁闆嗗悎淇℃伅 */ - public List<SysDictData> selectDictDataByType(String dictType); + List<SysDictData> selectDictDataByType(String dictType); /** * 鏍规嵁瀛楀吀绫诲瀷ID鏌ヨ淇℃伅 @@ -46,7 +46,7 @@ * @param dictId 瀛楀吀绫诲瀷ID * @return 瀛楀吀绫诲瀷 */ - public SysDictType selectDictTypeById(Long dictId); + SysDictType selectDictTypeById(Long dictId); /** * 鏍规嵁瀛楀吀绫诲瀷鏌ヨ淇℃伅 @@ -54,7 +54,7 @@ * @param dictType 瀛楀吀绫诲瀷 * @return 瀛楀吀绫诲瀷 */ - public SysDictType selectDictTypeByType(String dictType); + SysDictType selectDictTypeByType(String dictType); /** * 鎵归噺鍒犻櫎瀛楀吀淇℃伅 @@ -62,22 +62,22 @@ * @param dictIds 闇�瑕佸垹闄ょ殑瀛楀吀ID * @return 缁撴灉 */ - public void deleteDictTypeByIds(Long[] dictIds); + void deleteDictTypeByIds(Long[] dictIds); /** * 鍔犺浇瀛楀吀缂撳瓨鏁版嵁 */ - public void loadingDictCache(); + void loadingDictCache(); /** * 娓呯┖瀛楀吀缂撳瓨鏁版嵁 */ - public void clearDictCache(); + void clearDictCache(); /** * 閲嶇疆瀛楀吀缂撳瓨鏁版嵁 */ - public void resetDictCache(); + void resetDictCache(); /** * 鏂板淇濆瓨瀛楀吀绫诲瀷淇℃伅 @@ -85,7 +85,7 @@ * @param dictType 瀛楀吀绫诲瀷淇℃伅 * @return 缁撴灉 */ - public int insertDictType(SysDictType dictType); + int insertDictType(SysDictType dictType); /** * 淇敼淇濆瓨瀛楀吀绫诲瀷淇℃伅 @@ -93,7 +93,7 @@ * @param dictType 瀛楀吀绫诲瀷淇℃伅 * @return 缁撴灉 */ - public int updateDictType(SysDictType dictType); + int updateDictType(SysDictType dictType); /** * 鏍¢獙瀛楀吀绫诲瀷绉版槸鍚﹀敮涓� @@ -101,5 +101,5 @@ * @param dictType 瀛楀吀绫诲瀷 * @return 缁撴灉 */ - public String checkDictTypeUnique(SysDictType dictType); + String checkDictTypeUnique(SysDictType dictType); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java index 5a7d970..5d4a66e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java @@ -9,7 +9,7 @@ /** * 绯荤粺璁块棶鏃ュ織鎯呭喌淇℃伅 鏈嶅姟灞� * - * @author ruoyi + * @author Lion Li */ public interface ISysLogininforService extends IService<SysLogininfor> { @@ -21,7 +21,7 @@ * * @param logininfor 璁块棶鏃ュ織瀵硅薄 */ - public void insertLogininfor(SysLogininfor logininfor); + void insertLogininfor(SysLogininfor logininfor); /** * 鏌ヨ绯荤粺鐧诲綍鏃ュ織闆嗗悎 @@ -29,7 +29,7 @@ * @param logininfor 璁块棶鏃ュ織瀵硅薄 * @return 鐧诲綍璁板綍闆嗗悎 */ - public List<SysLogininfor> selectLogininforList(SysLogininfor logininfor); + List<SysLogininfor> selectLogininforList(SysLogininfor logininfor); /** * 鎵归噺鍒犻櫎绯荤粺鐧诲綍鏃ュ織 @@ -37,10 +37,10 @@ * @param infoIds 闇�瑕佸垹闄ょ殑鐧诲綍鏃ュ織ID * @return */ - public int deleteLogininforByIds(Long[] infoIds); + int deleteLogininforByIds(Long[] infoIds); /** * 娓呯┖绯荤粺鐧诲綍鏃ュ織 */ - public void cleanLogininfor(); + void cleanLogininfor(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java index 391cf19..eea882e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java @@ -11,16 +11,17 @@ /** * 鑿滃崟 涓氬姟灞� * - * @author ruoyi + * @author Lion Li */ public interface ISysMenuService extends IService<SysMenu> { + /** * 鏍规嵁鐢ㄦ埛鏌ヨ绯荤粺鑿滃崟鍒楄〃 * * @param userId 鐢ㄦ埛ID * @return 鑿滃崟鍒楄〃 */ - public List<SysMenu> selectMenuList(Long userId); + List<SysMenu> selectMenuList(Long userId); /** * 鏍规嵁鐢ㄦ埛鏌ヨ绯荤粺鑿滃崟鍒楄〃 @@ -29,7 +30,7 @@ * @param userId 鐢ㄦ埛ID * @return 鑿滃崟鍒楄〃 */ - public List<SysMenu> selectMenuList(SysMenu menu, Long userId); + List<SysMenu> selectMenuList(SysMenu menu, Long userId); /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ鏉冮檺 @@ -37,7 +38,7 @@ * @param userId 鐢ㄦ埛ID * @return 鏉冮檺鍒楄〃 */ - public Set<String> selectMenuPermsByUserId(Long userId); + Set<String> selectMenuPermsByUserId(Long userId); /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ鑿滃崟鏍戜俊鎭� @@ -45,7 +46,7 @@ * @param userId 鐢ㄦ埛ID * @return 鑿滃崟鍒楄〃 */ - public List<SysMenu> selectMenuTreeByUserId(Long userId); + List<SysMenu> selectMenuTreeByUserId(Long userId); /** * 鏍规嵁瑙掕壊ID鏌ヨ鑿滃崟鏍戜俊鎭� @@ -53,7 +54,7 @@ * @param roleId 瑙掕壊ID * @return 閫変腑鑿滃崟鍒楄〃 */ - public List<Integer> selectMenuListByRoleId(Long roleId); + List<Integer> selectMenuListByRoleId(Long roleId); /** * 鏋勫缓鍓嶇璺敱鎵�闇�瑕佺殑鑿滃崟 @@ -61,7 +62,7 @@ * @param menus 鑿滃崟鍒楄〃 * @return 璺敱鍒楄〃 */ - public List<RouterVo> buildMenus(List<SysMenu> menus); + List<RouterVo> buildMenus(List<SysMenu> menus); /** * 鏋勫缓鍓嶇鎵�闇�瑕佹爲缁撴瀯 @@ -69,7 +70,7 @@ * @param menus 鑿滃崟鍒楄〃 * @return 鏍戠粨鏋勫垪琛� */ - public List<SysMenu> buildMenuTree(List<SysMenu> menus); + List<SysMenu> buildMenuTree(List<SysMenu> menus); /** * 鏋勫缓鍓嶇鎵�闇�瑕佷笅鎷夋爲缁撴瀯 @@ -77,7 +78,7 @@ * @param menus 鑿滃崟鍒楄〃 * @return 涓嬫媺鏍戠粨鏋勫垪琛� */ - public List<TreeSelect> buildMenuTreeSelect(List<SysMenu> menus); + List<TreeSelect> buildMenuTreeSelect(List<SysMenu> menus); /** * 鏍规嵁鑿滃崟ID鏌ヨ淇℃伅 @@ -85,7 +86,7 @@ * @param menuId 鑿滃崟ID * @return 鑿滃崟淇℃伅 */ - public SysMenu selectMenuById(Long menuId); + SysMenu selectMenuById(Long menuId); /** * 鏄惁瀛樺湪鑿滃崟瀛愯妭鐐� @@ -93,7 +94,7 @@ * @param menuId 鑿滃崟ID * @return 缁撴灉 true 瀛樺湪 false 涓嶅瓨鍦� */ - public boolean hasChildByMenuId(Long menuId); + boolean hasChildByMenuId(Long menuId); /** * 鏌ヨ鑿滃崟鏄惁瀛樺湪瑙掕壊 @@ -101,7 +102,7 @@ * @param menuId 鑿滃崟ID * @return 缁撴灉 true 瀛樺湪 false 涓嶅瓨鍦� */ - public boolean checkMenuExistRole(Long menuId); + boolean checkMenuExistRole(Long menuId); /** * 鏂板淇濆瓨鑿滃崟淇℃伅 @@ -109,7 +110,7 @@ * @param menu 鑿滃崟淇℃伅 * @return 缁撴灉 */ - public int insertMenu(SysMenu menu); + int insertMenu(SysMenu menu); /** * 淇敼淇濆瓨鑿滃崟淇℃伅 @@ -117,7 +118,7 @@ * @param menu 鑿滃崟淇℃伅 * @return 缁撴灉 */ - public int updateMenu(SysMenu menu); + int updateMenu(SysMenu menu); /** * 鍒犻櫎鑿滃崟绠$悊淇℃伅 @@ -125,7 +126,7 @@ * @param menuId 鑿滃崟ID * @return 缁撴灉 */ - public int deleteMenuById(Long menuId); + int deleteMenuById(Long menuId); /** * 鏍¢獙鑿滃崟鍚嶇О鏄惁鍞竴 @@ -133,5 +134,5 @@ * @param menu 鑿滃崟淇℃伅 * @return 缁撴灉 */ - public String checkMenuNameUnique(SysMenu menu); + String checkMenuNameUnique(SysMenu menu); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java index 535e760..7db68da 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java @@ -9,7 +9,7 @@ /** * 鍏憡 鏈嶅姟灞� * - * @author ruoyi + * @author Lion Li */ public interface ISysNoticeService extends IService<SysNotice> { @@ -22,7 +22,7 @@ * @param noticeId 鍏憡ID * @return 鍏憡淇℃伅 */ - public SysNotice selectNoticeById(Long noticeId); + SysNotice selectNoticeById(Long noticeId); /** * 鏌ヨ鍏憡鍒楄〃 @@ -30,7 +30,7 @@ * @param notice 鍏憡淇℃伅 * @return 鍏憡闆嗗悎 */ - public List<SysNotice> selectNoticeList(SysNotice notice); + List<SysNotice> selectNoticeList(SysNotice notice); /** * 鏂板鍏憡 @@ -38,7 +38,7 @@ * @param notice 鍏憡淇℃伅 * @return 缁撴灉 */ - public int insertNotice(SysNotice notice); + int insertNotice(SysNotice notice); /** * 淇敼鍏憡 @@ -46,7 +46,7 @@ * @param notice 鍏憡淇℃伅 * @return 缁撴灉 */ - public int updateNotice(SysNotice notice); + int updateNotice(SysNotice notice); /** * 鍒犻櫎鍏憡淇℃伅 @@ -54,7 +54,7 @@ * @param noticeId 鍏憡ID * @return 缁撴灉 */ - public int deleteNoticeById(Long noticeId); + int deleteNoticeById(Long noticeId); /** * 鎵归噺鍒犻櫎鍏憡淇℃伅 @@ -62,5 +62,5 @@ * @param noticeIds 闇�瑕佸垹闄ょ殑鍏憡ID * @return 缁撴灉 */ - public int deleteNoticeByIds(Long[] noticeIds); + int deleteNoticeByIds(Long[] noticeIds); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java index ecfadb1..531f639 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java @@ -9,7 +9,7 @@ /** * 鎿嶄綔鏃ュ織 鏈嶅姟灞� * - * @author ruoyi + * @author Lion Li */ public interface ISysOperLogService extends IService<SysOperLog> { @@ -20,7 +20,7 @@ * * @param operLog 鎿嶄綔鏃ュ織瀵硅薄 */ - public void insertOperlog(SysOperLog operLog); + void insertOperlog(SysOperLog operLog); /** * 鏌ヨ绯荤粺鎿嶄綔鏃ュ織闆嗗悎 @@ -28,7 +28,7 @@ * @param operLog 鎿嶄綔鏃ュ織瀵硅薄 * @return 鎿嶄綔鏃ュ織闆嗗悎 */ - public List<SysOperLog> selectOperLogList(SysOperLog operLog); + List<SysOperLog> selectOperLogList(SysOperLog operLog); /** * 鎵归噺鍒犻櫎绯荤粺鎿嶄綔鏃ュ織 @@ -36,7 +36,7 @@ * @param operIds 闇�瑕佸垹闄ょ殑鎿嶄綔鏃ュ織ID * @return 缁撴灉 */ - public int deleteOperLogByIds(Long[] operIds); + int deleteOperLogByIds(Long[] operIds); /** * 鏌ヨ鎿嶄綔鏃ュ織璇︾粏 @@ -44,10 +44,10 @@ * @param operId 鎿嶄綔ID * @return 鎿嶄綔鏃ュ織瀵硅薄 */ - public SysOperLog selectOperLogById(Long operId); + SysOperLog selectOperLogById(Long operId); /** * 娓呯┖鎿嶄綔鏃ュ織 */ - public void cleanOperLog(); + void cleanOperLog(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOssConfigService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOssConfigService.java index 2748078..759ec5b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOssConfigService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOssConfigService.java @@ -17,42 +17,45 @@ */ public interface ISysOssConfigService extends IServicePlus<SysOssConfig, SysOssConfigVo> { - /** - * 鏌ヨ鍗曚釜 - */ - SysOssConfigVo queryById(Integer ossConfigId); + /** + * 鏌ヨ鍗曚釜 + */ + SysOssConfigVo queryById(Integer ossConfigId); - /** - * 鏌ヨ鍒楄〃 - */ + /** + * 鏌ヨ鍒楄〃 + */ TableDataInfo<SysOssConfigVo> queryPageList(SysOssConfigBo bo); - /** - * 鏍规嵁鏂板涓氬姟瀵硅薄鎻掑叆瀵硅薄瀛樺偍閰嶇疆 - * @param bo 瀵硅薄瀛樺偍閰嶇疆鏂板涓氬姟瀵硅薄 - * @return - */ - Boolean insertByBo(SysOssConfigBo bo); + /** + * 鏍规嵁鏂板涓氬姟瀵硅薄鎻掑叆瀵硅薄瀛樺偍閰嶇疆 + * + * @param bo 瀵硅薄瀛樺偍閰嶇疆鏂板涓氬姟瀵硅薄 + * @return + */ + Boolean insertByBo(SysOssConfigBo bo); - /** - * 鏍规嵁缂栬緫涓氬姟瀵硅薄淇敼瀵硅薄瀛樺偍閰嶇疆 - * @param bo 瀵硅薄瀛樺偍閰嶇疆缂栬緫涓氬姟瀵硅薄 - * @return - */ - Boolean updateByBo(SysOssConfigBo bo); + /** + * 鏍规嵁缂栬緫涓氬姟瀵硅薄淇敼瀵硅薄瀛樺偍閰嶇疆 + * + * @param bo 瀵硅薄瀛樺偍閰嶇疆缂栬緫涓氬姟瀵硅薄 + * @return + */ + Boolean updateByBo(SysOssConfigBo bo); - /** - * 鏍¢獙骞跺垹闄ゆ暟鎹� - * @param ids 涓婚敭闆嗗悎 - * @param isValid 鏄惁鏍¢獙,true-鍒犻櫎鍓嶆牎楠�,false-涓嶆牎楠� - * @return - */ - Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); + /** + * 鏍¢獙骞跺垹闄ゆ暟鎹� + * + * @param ids 涓婚敭闆嗗悎 + * @param isValid 鏄惁鏍¢獙,true-鍒犻櫎鍓嶆牎楠�,false-涓嶆牎楠� + * @return + */ + Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); - /** - * 鍚敤鍋滅敤鐘舵�� - */ - int updateOssConfigStatus(SysOssConfigBo bo); + /** + * 鍚敤鍋滅敤鐘舵�� + */ + int updateOssConfigStatus(SysOssConfigBo bo); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOssService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOssService.java index b5dc078..948e8f7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOssService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOssService.java @@ -16,9 +16,9 @@ */ public interface ISysOssService extends IServicePlus<SysOss, SysOssVo> { - TableDataInfo<SysOssVo> queryPageList(SysOssBo sysOss); + TableDataInfo<SysOssVo> queryPageList(SysOssBo sysOss); - SysOss upload(MultipartFile file); + SysOss upload(MultipartFile file); - Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); + Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java index 3f9db85..a049928 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java @@ -9,7 +9,7 @@ /** * 宀椾綅淇℃伅 鏈嶅姟灞� * - * @author ruoyi + * @author Lion Li */ public interface ISysPostService extends IService<SysPost> { @@ -22,14 +22,14 @@ * @param post 宀椾綅淇℃伅 * @return 宀椾綅鍒楄〃 */ - public List<SysPost> selectPostList(SysPost post); + List<SysPost> selectPostList(SysPost post); /** * 鏌ヨ鎵�鏈夊矖浣� * * @return 宀椾綅鍒楄〃 */ - public List<SysPost> selectPostAll(); + List<SysPost> selectPostAll(); /** * 閫氳繃宀椾綅ID鏌ヨ宀椾綅淇℃伅 @@ -37,7 +37,7 @@ * @param postId 宀椾綅ID * @return 瑙掕壊瀵硅薄淇℃伅 */ - public SysPost selectPostById(Long postId); + SysPost selectPostById(Long postId); /** * 鏍规嵁鐢ㄦ埛ID鑾峰彇宀椾綅閫夋嫨妗嗗垪琛� @@ -45,7 +45,7 @@ * @param userId 鐢ㄦ埛ID * @return 閫変腑宀椾綅ID鍒楄〃 */ - public List<Integer> selectPostListByUserId(Long userId); + List<Integer> selectPostListByUserId(Long userId); /** * 鏍¢獙宀椾綅鍚嶇О @@ -53,7 +53,7 @@ * @param post 宀椾綅淇℃伅 * @return 缁撴灉 */ - public String checkPostNameUnique(SysPost post); + String checkPostNameUnique(SysPost post); /** * 鏍¢獙宀椾綅缂栫爜 @@ -61,7 +61,7 @@ * @param post 宀椾綅淇℃伅 * @return 缁撴灉 */ - public String checkPostCodeUnique(SysPost post); + String checkPostCodeUnique(SysPost post); /** * 閫氳繃宀椾綅ID鏌ヨ宀椾綅浣跨敤鏁伴噺 @@ -69,7 +69,7 @@ * @param postId 宀椾綅ID * @return 缁撴灉 */ - public long countUserPostById(Long postId); + long countUserPostById(Long postId); /** * 鍒犻櫎宀椾綅淇℃伅 @@ -77,7 +77,7 @@ * @param postId 宀椾綅ID * @return 缁撴灉 */ - public int deletePostById(Long postId); + int deletePostById(Long postId); /** * 鎵归噺鍒犻櫎宀椾綅淇℃伅 @@ -86,7 +86,7 @@ * @return 缁撴灉 * @throws Exception 寮傚父 */ - public int deletePostByIds(Long[] postIds); + int deletePostByIds(Long[] postIds); /** * 鏂板淇濆瓨宀椾綅淇℃伅 @@ -94,7 +94,7 @@ * @param post 宀椾綅淇℃伅 * @return 缁撴灉 */ - public int insertPost(SysPost post); + int insertPost(SysPost post); /** * 淇敼淇濆瓨宀椾綅淇℃伅 @@ -102,5 +102,5 @@ * @param post 宀椾綅淇℃伅 * @return 缁撴灉 */ - public int updatePost(SysPost post); + int updatePost(SysPost post); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java index 84e6478..c97d2a6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java @@ -11,7 +11,7 @@ /** * 瑙掕壊涓氬姟灞� * - * @author ruoyi + * @author Lion Li */ public interface ISysRoleService extends IService<SysRole> { @@ -24,7 +24,7 @@ * @param role 瑙掕壊淇℃伅 * @return 瑙掕壊鏁版嵁闆嗗悎淇℃伅 */ - public List<SysRole> selectRoleList(SysRole role); + List<SysRole> selectRoleList(SysRole role); /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ瑙掕壊鍒楄〃 @@ -32,7 +32,7 @@ * @param userId 鐢ㄦ埛ID * @return 瑙掕壊鍒楄〃 */ - public List<SysRole> selectRolesByUserId(Long userId); + List<SysRole> selectRolesByUserId(Long userId); /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ瑙掕壊鏉冮檺 @@ -40,14 +40,14 @@ * @param userId 鐢ㄦ埛ID * @return 鏉冮檺鍒楄〃 */ - public Set<String> selectRolePermissionByUserId(Long userId); + Set<String> selectRolePermissionByUserId(Long userId); /** * 鏌ヨ鎵�鏈夎鑹� * * @return 瑙掕壊鍒楄〃 */ - public List<SysRole> selectRoleAll(); + List<SysRole> selectRoleAll(); /** * 鏍规嵁鐢ㄦ埛ID鑾峰彇瑙掕壊閫夋嫨妗嗗垪琛� @@ -55,7 +55,7 @@ * @param userId 鐢ㄦ埛ID * @return 閫変腑瑙掕壊ID鍒楄〃 */ - public List<Integer> selectRoleListByUserId(Long userId); + List<Integer> selectRoleListByUserId(Long userId); /** * 閫氳繃瑙掕壊ID鏌ヨ瑙掕壊 @@ -63,7 +63,7 @@ * @param roleId 瑙掕壊ID * @return 瑙掕壊瀵硅薄淇℃伅 */ - public SysRole selectRoleById(Long roleId); + SysRole selectRoleById(Long roleId); /** * 鏍¢獙瑙掕壊鍚嶇О鏄惁鍞竴 @@ -71,7 +71,7 @@ * @param role 瑙掕壊淇℃伅 * @return 缁撴灉 */ - public String checkRoleNameUnique(SysRole role); + String checkRoleNameUnique(SysRole role); /** * 鏍¢獙瑙掕壊鏉冮檺鏄惁鍞竴 @@ -79,21 +79,21 @@ * @param role 瑙掕壊淇℃伅 * @return 缁撴灉 */ - public String checkRoleKeyUnique(SysRole role); + String checkRoleKeyUnique(SysRole role); /** * 鏍¢獙瑙掕壊鏄惁鍏佽鎿嶄綔 * * @param role 瑙掕壊淇℃伅 */ - public void checkRoleAllowed(SysRole role); + void checkRoleAllowed(SysRole role); /** * 鏍¢獙瑙掕壊鏄惁鏈夋暟鎹潈闄� * * @param roleId 瑙掕壊id */ - public void checkRoleDataScope(Long roleId); + void checkRoleDataScope(Long roleId); /** * 閫氳繃瑙掕壊ID鏌ヨ瑙掕壊浣跨敤鏁伴噺 @@ -101,7 +101,7 @@ * @param roleId 瑙掕壊ID * @return 缁撴灉 */ - public long countUserRoleByRoleId(Long roleId); + long countUserRoleByRoleId(Long roleId); /** * 鏂板淇濆瓨瑙掕壊淇℃伅 @@ -109,7 +109,7 @@ * @param role 瑙掕壊淇℃伅 * @return 缁撴灉 */ - public int insertRole(SysRole role); + int insertRole(SysRole role); /** * 淇敼淇濆瓨瑙掕壊淇℃伅 @@ -117,7 +117,7 @@ * @param role 瑙掕壊淇℃伅 * @return 缁撴灉 */ - public int updateRole(SysRole role); + int updateRole(SysRole role); /** * 淇敼瑙掕壊鐘舵�� @@ -125,7 +125,7 @@ * @param role 瑙掕壊淇℃伅 * @return 缁撴灉 */ - public int updateRoleStatus(SysRole role); + int updateRoleStatus(SysRole role); /** * 淇敼鏁版嵁鏉冮檺淇℃伅 @@ -133,7 +133,7 @@ * @param role 瑙掕壊淇℃伅 * @return 缁撴灉 */ - public int authDataScope(SysRole role); + int authDataScope(SysRole role); /** * 閫氳繃瑙掕壊ID鍒犻櫎瑙掕壊 @@ -141,7 +141,7 @@ * @param roleId 瑙掕壊ID * @return 缁撴灉 */ - public int deleteRoleById(Long roleId); + int deleteRoleById(Long roleId); /** * 鎵归噺鍒犻櫎瑙掕壊淇℃伅 @@ -149,7 +149,7 @@ * @param roleIds 闇�瑕佸垹闄ょ殑瑙掕壊ID * @return 缁撴灉 */ - public int deleteRoleByIds(Long[] roleIds); + int deleteRoleByIds(Long[] roleIds); /** * 鍙栨秷鎺堟潈鐢ㄦ埛瑙掕壊 @@ -157,23 +157,23 @@ * @param userRole 鐢ㄦ埛鍜岃鑹插叧鑱斾俊鎭� * @return 缁撴灉 */ - public int deleteAuthUser(SysUserRole userRole); + int deleteAuthUser(SysUserRole userRole); /** * 鎵归噺鍙栨秷鎺堟潈鐢ㄦ埛瑙掕壊 * - * @param roleId 瑙掕壊ID + * @param roleId 瑙掕壊ID * @param userIds 闇�瑕佸彇娑堟巿鏉冪殑鐢ㄦ埛鏁版嵁ID * @return 缁撴灉 */ - public int deleteAuthUsers(Long roleId, Long[] userIds); + int deleteAuthUsers(Long roleId, Long[] userIds); /** * 鎵归噺閫夋嫨鎺堟潈鐢ㄦ埛瑙掕壊 * - * @param roleId 瑙掕壊ID + * @param roleId 瑙掕壊ID * @param userIds 闇�瑕佸垹闄ょ殑鐢ㄦ埛鏁版嵁ID * @return 缁撴灉 */ - public int insertAuthUsers(Long roleId, Long[] userIds); + int insertAuthUsers(Long roleId, Long[] userIds); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java index 4e00649..aefc3c7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java @@ -6,7 +6,7 @@ /** * 鍦ㄧ嚎鐢ㄦ埛 鏈嶅姟灞� * - * @author ruoyi + * @author Lion Li */ public interface ISysUserOnlineService { /** @@ -16,7 +16,7 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 鍦ㄧ嚎鐢ㄦ埛淇℃伅 */ - public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user); + SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user); /** * 閫氳繃鐢ㄦ埛鍚嶇О鏌ヨ淇℃伅 @@ -25,7 +25,7 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 鍦ㄧ嚎鐢ㄦ埛淇℃伅 */ - public SysUserOnline selectOnlineByUserName(String userName, LoginUser user); + SysUserOnline selectOnlineByUserName(String userName, LoginUser user); /** * 閫氳繃鐧诲綍鍦板潃/鐢ㄦ埛鍚嶇О鏌ヨ淇℃伅 @@ -35,7 +35,7 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 鍦ㄧ嚎鐢ㄦ埛淇℃伅 */ - public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user); + SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user); /** * 璁剧疆鍦ㄧ嚎鐢ㄦ埛淇℃伅 @@ -43,5 +43,5 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 鍦ㄧ嚎鐢ㄦ埛 */ - public SysUserOnline loginUserToUserOnline(LoginUser user); + SysUserOnline loginUserToUserOnline(LoginUser user); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java index 24096c3..d6e8d9d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java @@ -9,7 +9,7 @@ /** * 鐢ㄦ埛 涓氬姟灞� * - * @author ruoyi + * @author Lion Li */ public interface ISysUserService extends IService<SysUser> { @@ -22,7 +22,7 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 鐢ㄦ埛淇℃伅闆嗗悎淇℃伅 */ - public List<SysUser> selectUserList(SysUser user); + List<SysUser> selectUserList(SysUser user); /** * 鏍规嵁鏉′欢鍒嗛〉鏌ヨ宸插垎閰嶇敤鎴疯鑹插垪琛� @@ -30,7 +30,7 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 鐢ㄦ埛淇℃伅闆嗗悎淇℃伅 */ - public TableDataInfo<SysUser> selectAllocatedList(SysUser user); + TableDataInfo<SysUser> selectAllocatedList(SysUser user); /** * 鏍规嵁鏉′欢鍒嗛〉鏌ヨ鏈垎閰嶇敤鎴疯鑹插垪琛� @@ -38,7 +38,7 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 鐢ㄦ埛淇℃伅闆嗗悎淇℃伅 */ - public TableDataInfo<SysUser> selectUnallocatedList(SysUser user); + TableDataInfo<SysUser> selectUnallocatedList(SysUser user); /** * 閫氳繃鐢ㄦ埛鍚嶆煡璇㈢敤鎴� @@ -46,7 +46,7 @@ * @param userName 鐢ㄦ埛鍚� * @return 鐢ㄦ埛瀵硅薄淇℃伅 */ - public SysUser selectUserByUserName(String userName); + SysUser selectUserByUserName(String userName); /** * 閫氳繃鐢ㄦ埛ID鏌ヨ鐢ㄦ埛 @@ -54,7 +54,7 @@ * @param userId 鐢ㄦ埛ID * @return 鐢ㄦ埛瀵硅薄淇℃伅 */ - public SysUser selectUserById(Long userId); + SysUser selectUserById(Long userId); /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ鐢ㄦ埛鎵�灞炶鑹茬粍 @@ -62,7 +62,7 @@ * @param userName 鐢ㄦ埛鍚� * @return 缁撴灉 */ - public String selectUserRoleGroup(String userName); + String selectUserRoleGroup(String userName); /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ鐢ㄦ埛鎵�灞炲矖浣嶇粍 @@ -70,7 +70,7 @@ * @param userName 鐢ㄦ埛鍚� * @return 缁撴灉 */ - public String selectUserPostGroup(String userName); + String selectUserPostGroup(String userName); /** * 鏍¢獙鐢ㄦ埛鍚嶇О鏄惁鍞竴 @@ -78,7 +78,7 @@ * @param userName 鐢ㄦ埛鍚嶇О * @return 缁撴灉 */ - public String checkUserNameUnique(String userName); + String checkUserNameUnique(String userName); /** * 鏍¢獙鎵嬫満鍙风爜鏄惁鍞竴 @@ -86,7 +86,7 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 缁撴灉 */ - public String checkPhoneUnique(SysUser user); + String checkPhoneUnique(SysUser user); /** * 鏍¢獙email鏄惁鍞竴 @@ -94,21 +94,21 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 缁撴灉 */ - public String checkEmailUnique(SysUser user); + String checkEmailUnique(SysUser user); /** * 鏍¢獙鐢ㄦ埛鏄惁鍏佽鎿嶄綔 * * @param user 鐢ㄦ埛淇℃伅 */ - public void checkUserAllowed(SysUser user); + void checkUserAllowed(SysUser user); /** * 鏍¢獙鐢ㄦ埛鏄惁鏈夋暟鎹潈闄� * * @param userId 鐢ㄦ埛id */ - public void checkUserDataScope(Long userId); + void checkUserDataScope(Long userId); /** * 鏂板鐢ㄦ埛淇℃伅 @@ -116,7 +116,7 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 缁撴灉 */ - public int insertUser(SysUser user); + int insertUser(SysUser user); /** * 娉ㄥ唽鐢ㄦ埛淇℃伅 @@ -124,7 +124,7 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 缁撴灉 */ - public boolean registerUser(SysUser user); + boolean registerUser(SysUser user); /** * 淇敼鐢ㄦ埛淇℃伅 @@ -132,15 +132,15 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 缁撴灉 */ - public int updateUser(SysUser user); + int updateUser(SysUser user); /** * 鐢ㄦ埛鎺堟潈瑙掕壊 * - * @param userId 鐢ㄦ埛ID + * @param userId 鐢ㄦ埛ID * @param roleIds 瑙掕壊缁� */ - public void insertUserAuth(Long userId, Long[] roleIds); + void insertUserAuth(Long userId, Long[] roleIds); /** * 淇敼鐢ㄦ埛鐘舵�� @@ -148,7 +148,7 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 缁撴灉 */ - public int updateUserStatus(SysUser user); + int updateUserStatus(SysUser user); /** * 淇敼鐢ㄦ埛鍩烘湰淇℃伅 @@ -156,16 +156,16 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 缁撴灉 */ - public int updateUserProfile(SysUser user); + int updateUserProfile(SysUser user); /** * 淇敼鐢ㄦ埛澶村儚 * * @param userName 鐢ㄦ埛鍚� - * @param avatar 澶村儚鍦板潃 + * @param avatar 澶村儚鍦板潃 * @return 缁撴灉 */ - public boolean updateUserAvatar(String userName, String avatar); + boolean updateUserAvatar(String userName, String avatar); /** * 閲嶇疆鐢ㄦ埛瀵嗙爜 @@ -173,7 +173,7 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 缁撴灉 */ - public int resetPwd(SysUser user); + int resetPwd(SysUser user); /** * 閲嶇疆鐢ㄦ埛瀵嗙爜 @@ -182,7 +182,7 @@ * @param password 瀵嗙爜 * @return 缁撴灉 */ - public int resetUserPwd(String userName, String password); + int resetUserPwd(String userName, String password); /** * 閫氳繃鐢ㄦ埛ID鍒犻櫎鐢ㄦ埛 @@ -190,7 +190,7 @@ * @param userId 鐢ㄦ埛ID * @return 缁撴灉 */ - public int deleteUserById(Long userId); + int deleteUserById(Long userId); /** * 鎵归噺鍒犻櫎鐢ㄦ埛淇℃伅 @@ -198,15 +198,15 @@ * @param userIds 闇�瑕佸垹闄ょ殑鐢ㄦ埛ID * @return 缁撴灉 */ - public int deleteUserByIds(Long[] userIds); + int deleteUserByIds(Long[] userIds); /** * 瀵煎叆鐢ㄦ埛鏁版嵁 * - * @param userList 鐢ㄦ埛鏁版嵁鍒楄〃 + * @param userList 鐢ㄦ埛鏁版嵁鍒楄〃 * @param isUpdateSupport 鏄惁鏇存柊鏀寔锛屽鏋滃凡瀛樺湪锛屽垯杩涜鏇存柊鏁版嵁 - * @param operName 鎿嶄綔鐢ㄦ埛 + * @param operName 鎿嶄綔鐢ㄦ埛 * @return 缁撴灉 */ - public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName); + String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java index 59cba7f..70f6601 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java @@ -26,10 +26,11 @@ /** * 鐧诲綍鏍¢獙鏂规硶 * - * @author ruoyi + * @author Lion Li */ @Service public class SysLoginService { + @Autowired private TokenService tokenService; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/SysRegisterService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/SysRegisterService.java index 045c680..1712249 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/SysRegisterService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/SysRegisterService.java @@ -14,7 +14,7 @@ /** * 娉ㄥ唽鏍¢獙鏂规硶 * - * @author ruoyi + * @author Lion Li */ @Service public class SysRegisterService { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java index 7aba69d..a01bcd1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java @@ -26,204 +26,204 @@ /** * 鍙傛暟閰嶇疆 鏈嶅姟灞傚疄鐜� * - * @author ruoyi + * @author Lion Li */ @Service public class SysConfigServiceImpl extends ServicePlusImpl<SysConfigMapper, SysConfig, SysConfig> implements ISysConfigService { - /** - * 椤圭洰鍚姩鏃讹紝鍒濆鍖栧弬鏁板埌缂撳瓨 - */ - @PostConstruct - public void init() { - loadingConfigCache(); - } + /** + * 椤圭洰鍚姩鏃讹紝鍒濆鍖栧弬鏁板埌缂撳瓨 + */ + @PostConstruct + public void init() { + loadingConfigCache(); + } - @Override - public TableDataInfo<SysConfig> selectPageConfigList(SysConfig config) { - Map<String, Object> params = config.getParams(); - LambdaQueryWrapper<SysConfig> lqw = new LambdaQueryWrapper<SysConfig>() - .like(StringUtils.isNotBlank(config.getConfigName()), SysConfig::getConfigName, config.getConfigName()) - .eq(StringUtils.isNotBlank(config.getConfigType()), SysConfig::getConfigType, config.getConfigType()) - .like(StringUtils.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey()) - .apply(StringUtils.isNotEmpty(params.get("beginTime")), - "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", - params.get("beginTime")) - .apply(StringUtils.isNotEmpty(params.get("endTime")), - "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", - params.get("endTime")); - return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); - } + @Override + public TableDataInfo<SysConfig> selectPageConfigList(SysConfig config) { + Map<String, Object> params = config.getParams(); + LambdaQueryWrapper<SysConfig> lqw = new LambdaQueryWrapper<SysConfig>() + .like(StringUtils.isNotBlank(config.getConfigName()), SysConfig::getConfigName, config.getConfigName()) + .eq(StringUtils.isNotBlank(config.getConfigType()), SysConfig::getConfigType, config.getConfigType()) + .like(StringUtils.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey()) + .apply(StringUtils.isNotEmpty(params.get("beginTime")), + "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", + params.get("beginTime")) + .apply(StringUtils.isNotEmpty(params.get("endTime")), + "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", + params.get("endTime")); + return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); + } - /** - * 鏌ヨ鍙傛暟閰嶇疆淇℃伅 - * - * @param configId 鍙傛暟閰嶇疆ID - * @return 鍙傛暟閰嶇疆淇℃伅 - */ - @Override - @DataSource(DataSourceType.MASTER) - public SysConfig selectConfigById(Long configId) { - return baseMapper.selectById(configId); - } + /** + * 鏌ヨ鍙傛暟閰嶇疆淇℃伅 + * + * @param configId 鍙傛暟閰嶇疆ID + * @return 鍙傛暟閰嶇疆淇℃伅 + */ + @Override + @DataSource(DataSourceType.MASTER) + public SysConfig selectConfigById(Long configId) { + return baseMapper.selectById(configId); + } - /** - * 鏍规嵁閿悕鏌ヨ鍙傛暟閰嶇疆淇℃伅 - * - * @param configKey 鍙傛暟key - * @return 鍙傛暟閿�� - */ - @Override - public String selectConfigByKey(String configKey) { - String configValue = Convert.toStr(RedisUtils.getCacheObject(getCacheKey(configKey))); - if (StringUtils.isNotEmpty(configValue)) { - return configValue; - } - SysConfig retConfig = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>() - .eq(SysConfig::getConfigKey, configKey)); - if (StringUtils.isNotNull(retConfig)) { - RedisUtils.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue()); - return retConfig.getConfigValue(); - } - return StringUtils.EMPTY; - } + /** + * 鏍规嵁閿悕鏌ヨ鍙傛暟閰嶇疆淇℃伅 + * + * @param configKey 鍙傛暟key + * @return 鍙傛暟閿�� + */ + @Override + public String selectConfigByKey(String configKey) { + String configValue = Convert.toStr(RedisUtils.getCacheObject(getCacheKey(configKey))); + if (StringUtils.isNotEmpty(configValue)) { + return configValue; + } + SysConfig retConfig = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>() + .eq(SysConfig::getConfigKey, configKey)); + if (StringUtils.isNotNull(retConfig)) { + RedisUtils.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue()); + return retConfig.getConfigValue(); + } + return StringUtils.EMPTY; + } - /** - * 鑾峰彇楠岃瘉鐮佸紑鍏� - * - * @return true寮�鍚紝false鍏抽棴 - */ - @Override - public boolean selectCaptchaOnOff() { - String captchaOnOff = selectConfigByKey("sys.account.captchaOnOff"); - if (StringUtils.isEmpty(captchaOnOff)) { - return true; - } - return Convert.toBool(captchaOnOff); - } + /** + * 鑾峰彇楠岃瘉鐮佸紑鍏� + * + * @return true寮�鍚紝false鍏抽棴 + */ + @Override + public boolean selectCaptchaOnOff() { + String captchaOnOff = selectConfigByKey("sys.account.captchaOnOff"); + if (StringUtils.isEmpty(captchaOnOff)) { + return true; + } + return Convert.toBool(captchaOnOff); + } - /** - * 鏌ヨ鍙傛暟閰嶇疆鍒楄〃 - * - * @param config 鍙傛暟閰嶇疆淇℃伅 - * @return 鍙傛暟閰嶇疆闆嗗悎 - */ - @Override - public List<SysConfig> selectConfigList(SysConfig config) { - Map<String, Object> params = config.getParams(); - LambdaQueryWrapper<SysConfig> lqw = new LambdaQueryWrapper<SysConfig>() - .like(StringUtils.isNotBlank(config.getConfigName()), SysConfig::getConfigName, config.getConfigName()) - .eq(StringUtils.isNotBlank(config.getConfigType()), SysConfig::getConfigType, config.getConfigType()) - .like(StringUtils.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey()) - .apply(StringUtils.isNotEmpty(params.get("beginTime")), - "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", - params.get("beginTime")) - .apply(StringUtils.isNotEmpty(params.get("endTime")), - "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", - params.get("endTime")); - return baseMapper.selectList(lqw); - } + /** + * 鏌ヨ鍙傛暟閰嶇疆鍒楄〃 + * + * @param config 鍙傛暟閰嶇疆淇℃伅 + * @return 鍙傛暟閰嶇疆闆嗗悎 + */ + @Override + public List<SysConfig> selectConfigList(SysConfig config) { + Map<String, Object> params = config.getParams(); + LambdaQueryWrapper<SysConfig> lqw = new LambdaQueryWrapper<SysConfig>() + .like(StringUtils.isNotBlank(config.getConfigName()), SysConfig::getConfigName, config.getConfigName()) + .eq(StringUtils.isNotBlank(config.getConfigType()), SysConfig::getConfigType, config.getConfigType()) + .like(StringUtils.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey()) + .apply(StringUtils.isNotEmpty(params.get("beginTime")), + "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", + params.get("beginTime")) + .apply(StringUtils.isNotEmpty(params.get("endTime")), + "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", + params.get("endTime")); + return baseMapper.selectList(lqw); + } - /** - * 鏂板鍙傛暟閰嶇疆 - * - * @param config 鍙傛暟閰嶇疆淇℃伅 - * @return 缁撴灉 - */ - @Override - public int insertConfig(SysConfig config) { - int row = baseMapper.insert(config); - if (row > 0) { - RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); - } - return row; - } + /** + * 鏂板鍙傛暟閰嶇疆 + * + * @param config 鍙傛暟閰嶇疆淇℃伅 + * @return 缁撴灉 + */ + @Override + public int insertConfig(SysConfig config) { + int row = baseMapper.insert(config); + if (row > 0) { + RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); + } + return row; + } - /** - * 淇敼鍙傛暟閰嶇疆 - * - * @param config 鍙傛暟閰嶇疆淇℃伅 - * @return 缁撴灉 - */ - @Override - public int updateConfig(SysConfig config) { - int row = baseMapper.updateById(config); - if (row > 0) { - RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); - } - return row; - } + /** + * 淇敼鍙傛暟閰嶇疆 + * + * @param config 鍙傛暟閰嶇疆淇℃伅 + * @return 缁撴灉 + */ + @Override + public int updateConfig(SysConfig config) { + int row = baseMapper.updateById(config); + if (row > 0) { + RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); + } + return row; + } - /** - * 鎵归噺鍒犻櫎鍙傛暟淇℃伅 - * - * @param configIds 闇�瑕佸垹闄ょ殑鍙傛暟ID - * @return 缁撴灉 - */ - @Override - public void deleteConfigByIds(Long[] configIds) { - for (Long configId : configIds) { - SysConfig config = selectConfigById(configId); - if (StringUtils.equals(UserConstants.YES, config.getConfigType())) { - throw new ServiceException(String.format("鍐呯疆鍙傛暟銆�%1$s銆戜笉鑳藉垹闄� ", config.getConfigKey())); - } - RedisUtils.deleteObject(getCacheKey(config.getConfigKey())); - } - baseMapper.deleteBatchIds(Arrays.asList(configIds)); - } + /** + * 鎵归噺鍒犻櫎鍙傛暟淇℃伅 + * + * @param configIds 闇�瑕佸垹闄ょ殑鍙傛暟ID + * @return 缁撴灉 + */ + @Override + public void deleteConfigByIds(Long[] configIds) { + for (Long configId : configIds) { + SysConfig config = selectConfigById(configId); + if (StringUtils.equals(UserConstants.YES, config.getConfigType())) { + throw new ServiceException(String.format("鍐呯疆鍙傛暟銆�%1$s銆戜笉鑳藉垹闄� ", config.getConfigKey())); + } + RedisUtils.deleteObject(getCacheKey(config.getConfigKey())); + } + baseMapper.deleteBatchIds(Arrays.asList(configIds)); + } - /** - * 鍔犺浇鍙傛暟缂撳瓨鏁版嵁 - */ - @Override - public void loadingConfigCache() { - List<SysConfig> configsList = selectConfigList(new SysConfig()); - for (SysConfig config : configsList) { - RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); - } - } + /** + * 鍔犺浇鍙傛暟缂撳瓨鏁版嵁 + */ + @Override + public void loadingConfigCache() { + List<SysConfig> configsList = selectConfigList(new SysConfig()); + for (SysConfig config : configsList) { + RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); + } + } - /** - * 娓呯┖鍙傛暟缂撳瓨鏁版嵁 - */ - @Override - public void clearConfigCache() { - Collection<String> keys = RedisUtils.keys(Constants.SYS_CONFIG_KEY + "*"); - RedisUtils.deleteObject(keys); - } + /** + * 娓呯┖鍙傛暟缂撳瓨鏁版嵁 + */ + @Override + public void clearConfigCache() { + Collection<String> keys = RedisUtils.keys(Constants.SYS_CONFIG_KEY + "*"); + RedisUtils.deleteObject(keys); + } - /** - * 閲嶇疆鍙傛暟缂撳瓨鏁版嵁 - */ - @Override - public void resetConfigCache() { - clearConfigCache(); - loadingConfigCache(); - } + /** + * 閲嶇疆鍙傛暟缂撳瓨鏁版嵁 + */ + @Override + public void resetConfigCache() { + clearConfigCache(); + loadingConfigCache(); + } - /** - * 鏍¢獙鍙傛暟閿悕鏄惁鍞竴 - * - * @param config 鍙傛暟閰嶇疆淇℃伅 - * @return 缁撴灉 - */ - @Override - public String checkConfigKeyUnique(SysConfig config) { - Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId(); - SysConfig info = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>().eq(SysConfig::getConfigKey, config.getConfigKey())); - if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) { - return UserConstants.NOT_UNIQUE; - } - return UserConstants.UNIQUE; - } + /** + * 鏍¢獙鍙傛暟閿悕鏄惁鍞竴 + * + * @param config 鍙傛暟閰嶇疆淇℃伅 + * @return 缁撴灉 + */ + @Override + public String checkConfigKeyUnique(SysConfig config) { + Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId(); + SysConfig info = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>().eq(SysConfig::getConfigKey, config.getConfigKey())); + if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } - /** - * 璁剧疆cache key - * - * @param configKey 鍙傛暟閿� - * @return 缂撳瓨閿甼ey - */ - private String getCacheKey(String configKey) { - return Constants.SYS_CONFIG_KEY + configKey; - } + /** + * 璁剧疆cache key + * + * @param configKey 鍙傛暟閿� + * @return 缂撳瓨閿甼ey + */ + private String getCacheKey(String configKey) { + return Constants.SYS_CONFIG_KEY + configKey; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index cbafcf4..45c6fae 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -29,7 +29,7 @@ /** * 閮ㄩ棬绠$悊 鏈嶅姟瀹炵幇 * - * @author ruoyi + * @author Lion Li */ @Service public class SysDeptServiceImpl extends ServicePlusImpl<SysDeptMapper, SysDept, SysDept> implements ISysDeptService { @@ -65,13 +65,13 @@ for (SysDept dept : depts) { tempList.add(dept.getDeptId()); } - for (SysDept dept : depts) { - // 濡傛灉鏄《绾ц妭鐐�, 閬嶅巻璇ョ埗鑺傜偣鐨勬墍鏈夊瓙鑺傜偣 - if (!tempList.contains(dept.getParentId())) { - recursionFn(depts, dept); - returnList.add(dept); - } - } + for (SysDept dept : depts) { + // 濡傛灉鏄《绾ц妭鐐�, 閬嶅巻璇ョ埗鑺傜偣鐨勬墍鏈夊瓙鑺傜偣 + if (!tempList.contains(dept.getParentId())) { + recursionFn(depts, dept); + returnList.add(dept); + } + } if (returnList.isEmpty()) { returnList = depts; } @@ -224,7 +224,7 @@ } int result = baseMapper.updateById(dept); if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors()) - && !StringUtils.equals("0", dept.getAncestors())) { + && !StringUtils.equals("0", dept.getAncestors())) { // 濡傛灉璇ラ儴闂ㄦ槸鍚敤鐘舵�侊紝鍒欏惎鐢ㄨ閮ㄩ棬鐨勬墍鏈変笂绾ч儴闂� updateParentDeptStatusNormal(dept); } @@ -237,8 +237,8 @@ * @param dept 褰撳墠閮ㄩ棬 */ private void updateParentDeptStatusNormal(SysDept dept) { - String ancestors = dept.getAncestors(); - Long[] deptIds = Convert.toLongArray(ancestors); + String ancestors = dept.getAncestors(); + Long[] deptIds = Convert.toLongArray(ancestors); update(null, new LambdaUpdateWrapper<SysDept>() .set(SysDept::getStatus, "0") .in(SysDept::getDeptId, Arrays.asList(deptIds))); @@ -247,13 +247,13 @@ /** * 淇敼瀛愬厓绱犲叧绯� * - * @param deptId 琚慨鏀圭殑閮ㄩ棬ID + * @param deptId 琚慨鏀圭殑閮ㄩ棬ID * @param newAncestors 鏂扮殑鐖禝D闆嗗悎 * @param oldAncestors 鏃х殑鐖禝D闆嗗悎 */ public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) { List<SysDept> children = list(new LambdaQueryWrapper<SysDept>() - .apply("find_in_set({0},ancestors)",deptId)); + .apply("find_in_set({0},ancestors)", deptId)); for (SysDept child : children) { child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors)); } @@ -292,11 +292,11 @@ */ private List<SysDept> getChildList(List<SysDept> list, SysDept t) { List<SysDept> tlist = new ArrayList<SysDept>(); - for (SysDept n : list) { - if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) { - tlist.add(n); - } - } + for (SysDept n : list) { + if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) { + tlist.add(n); + } + } return tlist; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java index fdd436f..35908e3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java @@ -1,12 +1,12 @@ package com.ruoyi.system.service.impl; -import com.ruoyi.common.utils.StringUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.utils.DictUtils; import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.mapper.SysDictDataMapper; import com.ruoyi.system.service.ISysDictDataService; import org.springframework.stereotype.Service; @@ -16,108 +16,108 @@ /** * 瀛楀吀 涓氬姟灞傚鐞� * - * @author ruoyi + * @author Lion Li */ @Service public class SysDictDataServiceImpl extends ServicePlusImpl<SysDictDataMapper, SysDictData, SysDictData> implements ISysDictDataService { - @Override - public TableDataInfo<SysDictData> selectPageDictDataList(SysDictData dictData) { - LambdaQueryWrapper<SysDictData> lqw = new LambdaQueryWrapper<SysDictData>() - .eq(StringUtils.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) - .like(StringUtils.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) - .eq(StringUtils.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) - .orderByAsc(SysDictData::getDictSort); - return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); - } + @Override + public TableDataInfo<SysDictData> selectPageDictDataList(SysDictData dictData) { + LambdaQueryWrapper<SysDictData> lqw = new LambdaQueryWrapper<SysDictData>() + .eq(StringUtils.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) + .like(StringUtils.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) + .eq(StringUtils.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) + .orderByAsc(SysDictData::getDictSort); + return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); + } - /** - * 鏍规嵁鏉′欢鍒嗛〉鏌ヨ瀛楀吀鏁版嵁 - * - * @param dictData 瀛楀吀鏁版嵁淇℃伅 - * @return 瀛楀吀鏁版嵁闆嗗悎淇℃伅 - */ - @Override - public List<SysDictData> selectDictDataList(SysDictData dictData) { - return list(new LambdaQueryWrapper<SysDictData>() - .eq(StringUtils.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) - .like(StringUtils.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) - .eq(StringUtils.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) - .orderByAsc(SysDictData::getDictSort)); - } + /** + * 鏍规嵁鏉′欢鍒嗛〉鏌ヨ瀛楀吀鏁版嵁 + * + * @param dictData 瀛楀吀鏁版嵁淇℃伅 + * @return 瀛楀吀鏁版嵁闆嗗悎淇℃伅 + */ + @Override + public List<SysDictData> selectDictDataList(SysDictData dictData) { + return list(new LambdaQueryWrapper<SysDictData>() + .eq(StringUtils.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) + .like(StringUtils.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) + .eq(StringUtils.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) + .orderByAsc(SysDictData::getDictSort)); + } - /** - * 鏍规嵁瀛楀吀绫诲瀷鍜屽瓧鍏搁敭鍊兼煡璇㈠瓧鍏告暟鎹俊鎭� - * - * @param dictType 瀛楀吀绫诲瀷 - * @param dictValue 瀛楀吀閿�� - * @return 瀛楀吀鏍囩 - */ - @Override - public String selectDictLabel(String dictType, String dictValue) { - return getOne(new LambdaQueryWrapper<SysDictData>() - .select(SysDictData::getDictLabel) - .eq(SysDictData::getDictType, dictType) - .eq(SysDictData::getDictValue, dictValue)) - .getDictLabel(); - } + /** + * 鏍规嵁瀛楀吀绫诲瀷鍜屽瓧鍏搁敭鍊兼煡璇㈠瓧鍏告暟鎹俊鎭� + * + * @param dictType 瀛楀吀绫诲瀷 + * @param dictValue 瀛楀吀閿�� + * @return 瀛楀吀鏍囩 + */ + @Override + public String selectDictLabel(String dictType, String dictValue) { + return getOne(new LambdaQueryWrapper<SysDictData>() + .select(SysDictData::getDictLabel) + .eq(SysDictData::getDictType, dictType) + .eq(SysDictData::getDictValue, dictValue)) + .getDictLabel(); + } - /** - * 鏍规嵁瀛楀吀鏁版嵁ID鏌ヨ淇℃伅 - * - * @param dictCode 瀛楀吀鏁版嵁ID - * @return 瀛楀吀鏁版嵁 - */ - @Override - public SysDictData selectDictDataById(Long dictCode) { - return getById(dictCode); - } + /** + * 鏍规嵁瀛楀吀鏁版嵁ID鏌ヨ淇℃伅 + * + * @param dictCode 瀛楀吀鏁版嵁ID + * @return 瀛楀吀鏁版嵁 + */ + @Override + public SysDictData selectDictDataById(Long dictCode) { + return getById(dictCode); + } - /** - * 鎵归噺鍒犻櫎瀛楀吀鏁版嵁淇℃伅 - * - * @param dictCodes 闇�瑕佸垹闄ょ殑瀛楀吀鏁版嵁ID - * @return 缁撴灉 - */ - @Override - public void deleteDictDataByIds(Long[] dictCodes) { - for (Long dictCode : dictCodes) { - SysDictData data = selectDictDataById(dictCode); + /** + * 鎵归噺鍒犻櫎瀛楀吀鏁版嵁淇℃伅 + * + * @param dictCodes 闇�瑕佸垹闄ょ殑瀛楀吀鏁版嵁ID + * @return 缁撴灉 + */ + @Override + public void deleteDictDataByIds(Long[] dictCodes) { + for (Long dictCode : dictCodes) { + SysDictData data = selectDictDataById(dictCode); removeById(dictCode); - List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType()); - DictUtils.setDictCache(data.getDictType(), dictDatas); - } - } + List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType()); + DictUtils.setDictCache(data.getDictType(), dictDatas); + } + } - /** - * 鏂板淇濆瓨瀛楀吀鏁版嵁淇℃伅 - * - * @param data 瀛楀吀鏁版嵁淇℃伅 - * @return 缁撴灉 - */ - @Override - public int insertDictData(SysDictData data) { - int row = baseMapper.insert(data); - if (row > 0) { - List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType()); - DictUtils.setDictCache(data.getDictType(), dictDatas); - } - return row; - } + /** + * 鏂板淇濆瓨瀛楀吀鏁版嵁淇℃伅 + * + * @param data 瀛楀吀鏁版嵁淇℃伅 + * @return 缁撴灉 + */ + @Override + public int insertDictData(SysDictData data) { + int row = baseMapper.insert(data); + if (row > 0) { + List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType()); + DictUtils.setDictCache(data.getDictType(), dictDatas); + } + return row; + } - /** - * 淇敼淇濆瓨瀛楀吀鏁版嵁淇℃伅 - * - * @param data 瀛楀吀鏁版嵁淇℃伅 - * @return 缁撴灉 - */ - @Override - public int updateDictData(SysDictData data) { - int row = baseMapper.updateById(data); - if (row > 0) { - List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType()); - DictUtils.setDictCache(data.getDictType(), dictDatas); - } - return row; - } + /** + * 淇敼淇濆瓨瀛楀吀鏁版嵁淇℃伅 + * + * @param data 瀛楀吀鏁版嵁淇℃伅 + * @return 缁撴灉 + */ + @Override + public int updateDictData(SysDictData data) { + int row = baseMapper.updateById(data); + if (row > 0) { + List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType()); + DictUtils.setDictCache(data.getDictType(), dictDatas); + } + return row; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java index e334158..bb940c2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java @@ -1,7 +1,6 @@ package com.ruoyi.system.service.impl; import cn.hutool.core.collection.CollUtil; -import com.ruoyi.common.utils.StringUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.ruoyi.common.constant.UserConstants; @@ -12,6 +11,7 @@ import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.DictUtils; import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.mapper.SysDictDataMapper; import com.ruoyi.system.mapper.SysDictTypeMapper; import com.ruoyi.system.service.ISysDictTypeService; @@ -27,210 +27,210 @@ /** * 瀛楀吀 涓氬姟灞傚鐞� * - * @author ruoyi + * @author Lion Li */ @Service public class SysDictTypeServiceImpl extends ServicePlusImpl<SysDictTypeMapper, SysDictType, SysDictType> implements ISysDictTypeService { - @Autowired - private SysDictDataMapper dictDataMapper; + @Autowired + private SysDictDataMapper dictDataMapper; - /** - * 椤圭洰鍚姩鏃讹紝鍒濆鍖栧瓧鍏稿埌缂撳瓨 - */ - @PostConstruct - public void init() { - loadingDictCache(); - } + /** + * 椤圭洰鍚姩鏃讹紝鍒濆鍖栧瓧鍏稿埌缂撳瓨 + */ + @PostConstruct + public void init() { + loadingDictCache(); + } - @Override - public TableDataInfo<SysDictType> selectPageDictTypeList(SysDictType dictType) { - Map<String, Object> params = dictType.getParams(); - LambdaQueryWrapper<SysDictType> lqw = new LambdaQueryWrapper<SysDictType>() - .like(StringUtils.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName()) - .eq(StringUtils.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus()) - .like(StringUtils.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType()) - .apply(StringUtils.isNotEmpty(params.get("beginTime")), - "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", - params.get("beginTime")) - .apply(StringUtils.isNotEmpty(params.get("endTime")), - "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", - params.get("endTime")); - return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); - } + @Override + public TableDataInfo<SysDictType> selectPageDictTypeList(SysDictType dictType) { + Map<String, Object> params = dictType.getParams(); + LambdaQueryWrapper<SysDictType> lqw = new LambdaQueryWrapper<SysDictType>() + .like(StringUtils.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName()) + .eq(StringUtils.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus()) + .like(StringUtils.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType()) + .apply(StringUtils.isNotEmpty(params.get("beginTime")), + "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", + params.get("beginTime")) + .apply(StringUtils.isNotEmpty(params.get("endTime")), + "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", + params.get("endTime")); + return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); + } - /** - * 鏍规嵁鏉′欢鍒嗛〉鏌ヨ瀛楀吀绫诲瀷 - * - * @param dictType 瀛楀吀绫诲瀷淇℃伅 - * @return 瀛楀吀绫诲瀷闆嗗悎淇℃伅 - */ - @Override - public List<SysDictType> selectDictTypeList(SysDictType dictType) { - Map<String, Object> params = dictType.getParams(); - return list(new LambdaQueryWrapper<SysDictType>() - .like(StringUtils.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName()) - .eq(StringUtils.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus()) - .like(StringUtils.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType()) - .apply(StringUtils.isNotEmpty(params.get("beginTime")), - "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", - params.get("beginTime")) - .apply(StringUtils.isNotEmpty(params.get("endTime")), - "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", - params.get("endTime"))); - } + /** + * 鏍规嵁鏉′欢鍒嗛〉鏌ヨ瀛楀吀绫诲瀷 + * + * @param dictType 瀛楀吀绫诲瀷淇℃伅 + * @return 瀛楀吀绫诲瀷闆嗗悎淇℃伅 + */ + @Override + public List<SysDictType> selectDictTypeList(SysDictType dictType) { + Map<String, Object> params = dictType.getParams(); + return list(new LambdaQueryWrapper<SysDictType>() + .like(StringUtils.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName()) + .eq(StringUtils.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus()) + .like(StringUtils.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType()) + .apply(StringUtils.isNotEmpty(params.get("beginTime")), + "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", + params.get("beginTime")) + .apply(StringUtils.isNotEmpty(params.get("endTime")), + "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", + params.get("endTime"))); + } - /** - * 鏍规嵁鎵�鏈夊瓧鍏哥被鍨� - * - * @return 瀛楀吀绫诲瀷闆嗗悎淇℃伅 - */ - @Override - public List<SysDictType> selectDictTypeAll() { - return list(); - } + /** + * 鏍规嵁鎵�鏈夊瓧鍏哥被鍨� + * + * @return 瀛楀吀绫诲瀷闆嗗悎淇℃伅 + */ + @Override + public List<SysDictType> selectDictTypeAll() { + return list(); + } - /** - * 鏍规嵁瀛楀吀绫诲瀷鏌ヨ瀛楀吀鏁版嵁 - * - * @param dictType 瀛楀吀绫诲瀷 - * @return 瀛楀吀鏁版嵁闆嗗悎淇℃伅 - */ - @Override - public List<SysDictData> selectDictDataByType(String dictType) { - List<SysDictData> dictDatas = DictUtils.getDictCache(dictType); - if (CollUtil.isNotEmpty(dictDatas)) { - return dictDatas; - } - dictDatas = dictDataMapper.selectDictDataByType(dictType); - if (CollUtil.isNotEmpty(dictDatas)) { - DictUtils.setDictCache(dictType, dictDatas); - return dictDatas; - } - return null; - } + /** + * 鏍规嵁瀛楀吀绫诲瀷鏌ヨ瀛楀吀鏁版嵁 + * + * @param dictType 瀛楀吀绫诲瀷 + * @return 瀛楀吀鏁版嵁闆嗗悎淇℃伅 + */ + @Override + public List<SysDictData> selectDictDataByType(String dictType) { + List<SysDictData> dictDatas = DictUtils.getDictCache(dictType); + if (CollUtil.isNotEmpty(dictDatas)) { + return dictDatas; + } + dictDatas = dictDataMapper.selectDictDataByType(dictType); + if (CollUtil.isNotEmpty(dictDatas)) { + DictUtils.setDictCache(dictType, dictDatas); + return dictDatas; + } + return null; + } - /** - * 鏍规嵁瀛楀吀绫诲瀷ID鏌ヨ淇℃伅 - * - * @param dictId 瀛楀吀绫诲瀷ID - * @return 瀛楀吀绫诲瀷 - */ - @Override - public SysDictType selectDictTypeById(Long dictId) { - return getById(dictId); - } + /** + * 鏍规嵁瀛楀吀绫诲瀷ID鏌ヨ淇℃伅 + * + * @param dictId 瀛楀吀绫诲瀷ID + * @return 瀛楀吀绫诲瀷 + */ + @Override + public SysDictType selectDictTypeById(Long dictId) { + return getById(dictId); + } - /** - * 鏍规嵁瀛楀吀绫诲瀷鏌ヨ淇℃伅 - * - * @param dictType 瀛楀吀绫诲瀷 - * @return 瀛楀吀绫诲瀷 - */ - @Override - public SysDictType selectDictTypeByType(String dictType) { - return getOne(new LambdaQueryWrapper<SysDictType>().eq(SysDictType::getDictType, dictType)); - } + /** + * 鏍规嵁瀛楀吀绫诲瀷鏌ヨ淇℃伅 + * + * @param dictType 瀛楀吀绫诲瀷 + * @return 瀛楀吀绫诲瀷 + */ + @Override + public SysDictType selectDictTypeByType(String dictType) { + return getOne(new LambdaQueryWrapper<SysDictType>().eq(SysDictType::getDictType, dictType)); + } - /** - * 鎵归噺鍒犻櫎瀛楀吀绫诲瀷淇℃伅 - * - * @param dictIds 闇�瑕佸垹闄ょ殑瀛楀吀ID - * @return 缁撴灉 - */ - @Override - public void deleteDictTypeByIds(Long[] dictIds) { - for (Long dictId : dictIds) { - SysDictType dictType = selectDictTypeById(dictId); - if (dictDataMapper.selectCount(new LambdaQueryWrapper<SysDictData>() - .eq(SysDictData::getDictType, dictType.getDictType())) > 0) { - throw new ServiceException(String.format("%1$s宸插垎閰�,涓嶈兘鍒犻櫎", dictType.getDictName())); - } - DictUtils.removeDictCache(dictType.getDictType()); - } - baseMapper.deleteBatchIds(Arrays.asList(dictIds)); - } + /** + * 鎵归噺鍒犻櫎瀛楀吀绫诲瀷淇℃伅 + * + * @param dictIds 闇�瑕佸垹闄ょ殑瀛楀吀ID + * @return 缁撴灉 + */ + @Override + public void deleteDictTypeByIds(Long[] dictIds) { + for (Long dictId : dictIds) { + SysDictType dictType = selectDictTypeById(dictId); + if (dictDataMapper.selectCount(new LambdaQueryWrapper<SysDictData>() + .eq(SysDictData::getDictType, dictType.getDictType())) > 0) { + throw new ServiceException(String.format("%1$s宸插垎閰�,涓嶈兘鍒犻櫎", dictType.getDictName())); + } + DictUtils.removeDictCache(dictType.getDictType()); + } + baseMapper.deleteBatchIds(Arrays.asList(dictIds)); + } - /** - * 鍔犺浇瀛楀吀缂撳瓨鏁版嵁 - */ - @Override - public void loadingDictCache() { - List<SysDictType> dictTypeList = list(); - for (SysDictType dictType : dictTypeList) { - List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType()); - DictUtils.setDictCache(dictType.getDictType(), dictDatas); - } - } + /** + * 鍔犺浇瀛楀吀缂撳瓨鏁版嵁 + */ + @Override + public void loadingDictCache() { + List<SysDictType> dictTypeList = list(); + for (SysDictType dictType : dictTypeList) { + List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType()); + DictUtils.setDictCache(dictType.getDictType(), dictDatas); + } + } - /** - * 娓呯┖瀛楀吀缂撳瓨鏁版嵁 - */ - @Override - public void clearDictCache() { - DictUtils.clearDictCache(); - } + /** + * 娓呯┖瀛楀吀缂撳瓨鏁版嵁 + */ + @Override + public void clearDictCache() { + DictUtils.clearDictCache(); + } - /** - * 閲嶇疆瀛楀吀缂撳瓨鏁版嵁 - */ - @Override - public void resetDictCache() { - clearDictCache(); - loadingDictCache(); - } + /** + * 閲嶇疆瀛楀吀缂撳瓨鏁版嵁 + */ + @Override + public void resetDictCache() { + clearDictCache(); + loadingDictCache(); + } - /** - * 鏂板淇濆瓨瀛楀吀绫诲瀷淇℃伅 - * - * @param dict 瀛楀吀绫诲瀷淇℃伅 - * @return 缁撴灉 - */ - @Override - public int insertDictType(SysDictType dict) { - int row = baseMapper.insert(dict); - if (row > 0) { - DictUtils.setDictCache(dict.getDictType(), null); - } - return row; - } + /** + * 鏂板淇濆瓨瀛楀吀绫诲瀷淇℃伅 + * + * @param dict 瀛楀吀绫诲瀷淇℃伅 + * @return 缁撴灉 + */ + @Override + public int insertDictType(SysDictType dict) { + int row = baseMapper.insert(dict); + if (row > 0) { + DictUtils.setDictCache(dict.getDictType(), null); + } + return row; + } - /** - * 淇敼淇濆瓨瀛楀吀绫诲瀷淇℃伅 - * - * @param dict 瀛楀吀绫诲瀷淇℃伅 - * @return 缁撴灉 - */ - @Override - @Transactional - public int updateDictType(SysDictType dict) { - SysDictType oldDict = getById(dict.getDictId()); - dictDataMapper.update(null, new LambdaUpdateWrapper<SysDictData>() - .set(SysDictData::getDictType, dict.getDictType()) - .eq(SysDictData::getDictType, oldDict.getDictType())); - int row = baseMapper.updateById(dict); - if (row > 0) { - List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType()); - DictUtils.setDictCache(dict.getDictType(), dictDatas); - } - return row; - } + /** + * 淇敼淇濆瓨瀛楀吀绫诲瀷淇℃伅 + * + * @param dict 瀛楀吀绫诲瀷淇℃伅 + * @return 缁撴灉 + */ + @Override + @Transactional + public int updateDictType(SysDictType dict) { + SysDictType oldDict = getById(dict.getDictId()); + dictDataMapper.update(null, new LambdaUpdateWrapper<SysDictData>() + .set(SysDictData::getDictType, dict.getDictType()) + .eq(SysDictData::getDictType, oldDict.getDictType())); + int row = baseMapper.updateById(dict); + if (row > 0) { + List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType()); + DictUtils.setDictCache(dict.getDictType(), dictDatas); + } + return row; + } - /** - * 鏍¢獙瀛楀吀绫诲瀷绉版槸鍚﹀敮涓� - * - * @param dict 瀛楀吀绫诲瀷 - * @return 缁撴灉 - */ - @Override - public String checkDictTypeUnique(SysDictType dict) { - Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId(); - SysDictType dictType = getOne(new LambdaQueryWrapper<SysDictType>() - .eq(SysDictType::getDictType, dict.getDictType()) - .last("limit 1")); - if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) { - return UserConstants.NOT_UNIQUE; - } - return UserConstants.UNIQUE; - } + /** + * 鏍¢獙瀛楀吀绫诲瀷绉版槸鍚﹀敮涓� + * + * @param dict 瀛楀吀绫诲瀷 + * @return 缁撴灉 + */ + @Override + public String checkDictTypeUnique(SysDictType dict) { + Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId(); + SysDictType dictType = getOne(new LambdaQueryWrapper<SysDictType>() + .eq(SysDictType::getDictType, dict.getDictType()) + .last("limit 1")); + if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java index ede2271..dda5b5d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java @@ -27,7 +27,7 @@ /** * 绯荤粺璁块棶鏃ュ織鎯呭喌淇℃伅 鏈嶅姟灞傚鐞� * - * @author ruoyi + * @author Lion Li */ @Slf4j @Service diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java index bd7c528..643d304 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -26,11 +26,10 @@ /** * 鑿滃崟 涓氬姟灞傚鐞� * - * @author ruoyi + * @author Lion Li */ @Service public class SysMenuServiceImpl extends ServicePlusImpl<SysMenuMapper, SysMenu, SysMenu> implements ISysMenuService { - public static final String PREMISSION_STRING = "perms[\"{0}\"]"; @Autowired private SysRoleMapper roleMapper; @@ -61,9 +60,9 @@ // 绠$悊鍛樻樉绀烘墍鏈夎彍鍗曚俊鎭� if (SysUser.isAdmin(userId)) { menuList = list(new LambdaQueryWrapper<SysMenu>() - .like(StringUtils.isNotBlank(menu.getMenuName()),SysMenu::getMenuName,menu.getMenuName()) - .eq(StringUtils.isNotBlank(menu.getVisible()),SysMenu::getVisible,menu.getVisible()) - .eq(StringUtils.isNotBlank(menu.getStatus()),SysMenu::getStatus,menu.getStatus()) + .like(StringUtils.isNotBlank(menu.getMenuName()), SysMenu::getMenuName, menu.getMenuName()) + .eq(StringUtils.isNotBlank(menu.getVisible()), SysMenu::getVisible, menu.getVisible()) + .eq(StringUtils.isNotBlank(menu.getStatus()), SysMenu::getStatus, menu.getStatus()) .orderByAsc(SysMenu::getParentId) .orderByAsc(SysMenu::getOrderNum)); } else { @@ -137,7 +136,7 @@ router.setComponent(getComponent(menu)); router.setQuery(menu.getQuery()); router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); - List<SysMenu> cMenus = menu.getChildren(); + List<SysMenu> cMenus = (List<SysMenu>) menu.getChildren(); if (!cMenus.isEmpty() && UserConstants.TYPE_DIR.equals(menu.getMenuType())) { router.setAlwaysShow(true); router.setRedirect("noRedirect"); @@ -151,18 +150,18 @@ children.setName(StringUtils.capitalize(menu.getPath())); children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); children.setQuery(menu.getQuery()); - childrenList.add(children); - router.setChildren(childrenList); - } else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) { - router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon())); - router.setPath("/inner"); - List<RouterVo> childrenList = new ArrayList<RouterVo>(); - RouterVo children = new RouterVo(); - String routerPath = StringUtils.replaceEach(menu.getPath(), new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" }); - children.setPath(routerPath); - children.setComponent(UserConstants.INNER_LINK); - children.setName(StringUtils.capitalize(routerPath)); - children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath())); + childrenList.add(children); + router.setChildren(childrenList); + } else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) { + router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon())); + router.setPath("/inner"); + List<RouterVo> childrenList = new ArrayList<RouterVo>(); + RouterVo children = new RouterVo(); + String routerPath = StringUtils.replaceEach(menu.getPath(), new String[]{Constants.HTTP, Constants.HTTPS}, new String[]{"", ""}); + children.setPath(routerPath); + children.setComponent(UserConstants.INNER_LINK); + children.setName(StringUtils.capitalize(routerPath)); + children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath())); childrenList.add(children); router.setChildren(childrenList); } @@ -184,13 +183,13 @@ for (SysMenu dept : menus) { tempList.add(dept.getMenuId()); } - for (SysMenu menu : menus) { - // 濡傛灉鏄《绾ц妭鐐�, 閬嶅巻璇ョ埗鑺傜偣鐨勬墍鏈夊瓙鑺傜偣 - if (!tempList.contains(menu.getParentId())) { - recursionFn(menus, menu); - returnList.add(menu); - } - } + for (SysMenu menu : menus) { + // 濡傛灉鏄《绾ц妭鐐�, 閬嶅巻璇ョ埗鑺傜偣鐨勬墍鏈夊瓙鑺傜偣 + if (!tempList.contains(menu.getParentId())) { + recursionFn(menus, menu); + returnList.add(menu); + } + } if (returnList.isEmpty()) { returnList = menus; } @@ -228,7 +227,7 @@ */ @Override public boolean hasChildByMenuId(Long menuId) { - long result = count(new LambdaQueryWrapper<SysMenu>().eq(SysMenu::getParentId,menuId)); + long result = count(new LambdaQueryWrapper<SysMenu>().eq(SysMenu::getParentId, menuId)); return result > 0; } @@ -240,7 +239,7 @@ */ @Override public boolean checkMenuExistRole(Long menuId) { - long result = roleMenuMapper.selectCount(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getMenuId,menuId)); + long result = roleMenuMapper.selectCount(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getMenuId, menuId)); return result > 0; } @@ -287,8 +286,8 @@ public String checkMenuNameUnique(SysMenu menu) { Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId(); SysMenu info = getOne(new LambdaQueryWrapper<SysMenu>() - .eq(SysMenu::getMenuName,menu.getMenuName()) - .eq(SysMenu::getParentId,menu.getParentId()) + .eq(SysMenu::getMenuName, menu.getMenuName()) + .eq(SysMenu::getParentId, menu.getParentId()) .last("limit 1")); if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) { return UserConstants.NOT_UNIQUE; @@ -321,7 +320,7 @@ String routerPath = menu.getPath(); // 鍐呴摼鎵撳紑澶栫綉鏂瑰紡 if (menu.getParentId().intValue() != 0 && isInnerLink(menu)) { - routerPath = StringUtils.replaceEach(routerPath, new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" }); + routerPath = StringUtils.replaceEach(routerPath, new String[]{Constants.HTTP, Constants.HTTPS}, new String[]{"", ""}); } // 闈炲閾惧苟涓旀槸涓�绾х洰褰曪紙绫诲瀷涓虹洰褰曪級 if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType()) @@ -345,9 +344,9 @@ String component = UserConstants.LAYOUT; if (StringUtils.isNotEmpty(menu.getComponent()) && !isMenuFrame(menu)) { component = menu.getComponent(); - } else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0 && isInnerLink(menu)) { - component = UserConstants.INNER_LINK; - } else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) { + } else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0 && isInnerLink(menu)) { + component = UserConstants.INNER_LINK; + } else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) { component = UserConstants.PARENT_VIEW; } return component; @@ -387,19 +386,19 @@ /** * 鏍规嵁鐖惰妭鐐圭殑ID鑾峰彇鎵�鏈夊瓙鑺傜偣 * - * @param list 鍒嗙被琛� + * @param list 鍒嗙被琛� * @param parentId 浼犲叆鐨勭埗鑺傜偣ID * @return String */ public List<SysMenu> getChildPerms(List<SysMenu> list, int parentId) { List<SysMenu> returnList = new ArrayList<SysMenu>(); - for (SysMenu t : list) { - // 涓�銆佹牴鎹紶鍏ョ殑鏌愪釜鐖惰妭鐐笽D,閬嶅巻璇ョ埗鑺傜偣鐨勬墍鏈夊瓙鑺傜偣 - if (t.getParentId() == parentId) { - recursionFn(list, t); - returnList.add(t); - } - } + for (SysMenu t : list) { + // 涓�銆佹牴鎹紶鍏ョ殑鏌愪釜鐖惰妭鐐笽D,閬嶅巻璇ョ埗鑺傜偣鐨勬墍鏈夊瓙鑺傜偣 + if (t.getParentId() == parentId) { + recursionFn(list, t); + returnList.add(t); + } + } return returnList; } @@ -425,11 +424,11 @@ */ private List<SysMenu> getChildList(List<SysMenu> list, SysMenu t) { List<SysMenu> tlist = new ArrayList<SysMenu>(); - for (SysMenu n : list) { - if (n.getParentId().longValue() == t.getMenuId().longValue()) { - tlist.add(n); - } - } + for (SysMenu n : list) { + if (n.getParentId().longValue() == t.getMenuId().longValue()) { + tlist.add(n); + } + } return tlist; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java index dd8fdbc..b4f70d7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java @@ -1,10 +1,10 @@ package com.ruoyi.system.service.impl; -import com.ruoyi.common.utils.StringUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.mapper.SysNoticeMapper; import com.ruoyi.system.service.ISysNoticeService; @@ -16,7 +16,7 @@ /** * 鍏憡 鏈嶅姟灞傚疄鐜� * - * @author ruoyi + * @author Lion Li */ @Service public class SysNoticeServiceImpl extends ServicePlusImpl<SysNoticeMapper, SysNotice, SysNotice> implements ISysNoticeService { @@ -27,7 +27,7 @@ .like(StringUtils.isNotBlank(notice.getNoticeTitle()), SysNotice::getNoticeTitle, notice.getNoticeTitle()) .eq(StringUtils.isNotBlank(notice.getNoticeType()), SysNotice::getNoticeType, notice.getNoticeType()) .like(StringUtils.isNotBlank(notice.getCreateBy()), SysNotice::getCreateBy, notice.getCreateBy()); - return PageUtils.buildDataInfo(page(PageUtils.buildPage(),lqw)); + return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); } /** @@ -50,9 +50,9 @@ @Override public List<SysNotice> selectNoticeList(SysNotice notice) { return list(new LambdaQueryWrapper<SysNotice>() - .like(StringUtils.isNotBlank(notice.getNoticeTitle()),SysNotice::getNoticeTitle,notice.getNoticeTitle()) - .eq(StringUtils.isNotBlank(notice.getNoticeType()),SysNotice::getNoticeType,notice.getNoticeType()) - .like(StringUtils.isNotBlank(notice.getCreateBy()),SysNotice::getCreateBy,notice.getCreateBy())); + .like(StringUtils.isNotBlank(notice.getNoticeTitle()), SysNotice::getNoticeTitle, notice.getNoticeTitle()) + .eq(StringUtils.isNotBlank(notice.getNoticeType()), SysNotice::getNoticeType, notice.getNoticeType()) + .like(StringUtils.isNotBlank(notice.getCreateBy()), SysNotice::getCreateBy, notice.getCreateBy())); } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java index f4c39f4..c39ced0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java @@ -3,10 +3,10 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.ArrayUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.core.domain.dto.OperLogDTO; import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.service.OperLogService; -import com.ruoyi.common.core.domain.dto.OperLogDTO; import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.ip.AddressUtils; @@ -24,7 +24,7 @@ /** * 鎿嶄綔鏃ュ織 鏈嶅姟灞傚鐞� * - * @author ruoyi + * @author Lion Li */ @Service public class SysOperLogServiceImpl extends ServicePlusImpl<SysOperLogMapper, SysOperLog, SysOperLog> implements ISysOperLogService, OperLogService { @@ -64,7 +64,7 @@ .apply(StringUtils.isNotEmpty(params.get("endTime")), "date_format(oper_time,'%y%m%d') <= date_format({0},'%y%m%d')", params.get("endTime")); - return PageUtils.buildDataInfo(page(PageUtils.buildPage("oper_id","desc"), lqw)); + return PageUtils.buildDataInfo(page(PageUtils.buildPage("oper_id", "desc"), lqw)); } /** @@ -88,17 +88,17 @@ public List<SysOperLog> selectOperLogList(SysOperLog operLog) { Map<String, Object> params = operLog.getParams(); return list(new LambdaQueryWrapper<SysOperLog>() - .like(StringUtils.isNotBlank(operLog.getTitle()),SysOperLog::getTitle,operLog.getTitle()) + .like(StringUtils.isNotBlank(operLog.getTitle()), SysOperLog::getTitle, operLog.getTitle()) .eq(operLog.getBusinessType() != null && operLog.getBusinessType() > 0, - SysOperLog::getBusinessType,operLog.getBusinessType()) + SysOperLog::getBusinessType, operLog.getBusinessType()) .func(f -> { - if (ArrayUtil.isNotEmpty(operLog.getBusinessTypes())){ + if (ArrayUtil.isNotEmpty(operLog.getBusinessTypes())) { f.in(SysOperLog::getBusinessType, Arrays.asList(operLog.getBusinessTypes())); } }) .eq(operLog.getStatus() != null && operLog.getStatus() > 0, - SysOperLog::getStatus,operLog.getStatus()) - .like(StringUtils.isNotBlank(operLog.getOperName()),SysOperLog::getOperName,operLog.getOperName()) + SysOperLog::getStatus, operLog.getStatus()) + .like(StringUtils.isNotBlank(operLog.getOperName()), SysOperLog::getOperName, operLog.getOperName()) .apply(StringUtils.isNotEmpty(params.get("beginTime")), "date_format(oper_time,'%y%m%d') >= date_format({0},'%y%m%d')", params.get("beginTime")) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssConfigServiceImpl.java index c71c65d..df3f6d1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssConfigServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssConfigServiceImpl.java @@ -43,23 +43,23 @@ @Service public class SysOssConfigServiceImpl extends ServicePlusImpl<SysOssConfigMapper, SysOssConfig, SysOssConfigVo> implements ISysOssConfigService { - /** - * 椤圭洰鍚姩鏃讹紝鍒濆鍖栧弬鏁板埌缂撳瓨锛屽姞杞介厤缃被 - */ - @PostConstruct - public void init() { - List<SysOssConfig> list = list(); - for (SysOssConfig config : list) { - String configKey = config.getConfigKey(); - if ("0".equals(config.getStatus())) { - RedisUtils.setCacheObject(CloudConstant.CACHE_CONFIG_KEY, configKey); - } - setConfigCache(true, config); - } - } + /** + * 椤圭洰鍚姩鏃讹紝鍒濆鍖栧弬鏁板埌缂撳瓨锛屽姞杞介厤缃被 + */ + @PostConstruct + public void init() { + List<SysOssConfig> list = list(); + for (SysOssConfig config : list) { + String configKey = config.getConfigKey(); + if ("0".equals(config.getStatus())) { + RedisUtils.setCacheObject(CloudConstant.CACHE_CONFIG_KEY, configKey); + } + setConfigCache(true, config); + } + } @Override - public SysOssConfigVo queryById(Integer ossConfigId){ + public SysOssConfigVo queryById(Integer ossConfigId) { return getVoById(ossConfigId); } @@ -74,46 +74,46 @@ LambdaQueryWrapper<SysOssConfig> lqw = Wrappers.lambdaQuery(); lqw.eq(StringUtils.isNotBlank(bo.getConfigKey()), SysOssConfig::getConfigKey, bo.getConfigKey()); lqw.like(StringUtils.isNotBlank(bo.getBucketName()), SysOssConfig::getBucketName, bo.getBucketName()); - lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysOssConfig::getStatus, bo.getStatus()); - return lqw; + lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysOssConfig::getStatus, bo.getStatus()); + return lqw; } @Override public Boolean insertByBo(SysOssConfigBo bo) { SysOssConfig config = BeanUtil.toBean(bo, SysOssConfig.class); validEntityBeforeSave(config); - return setConfigCache(save(config), config); + return setConfigCache(save(config), config); } @Override public Boolean updateByBo(SysOssConfigBo bo) { SysOssConfig config = BeanUtil.toBean(bo, SysOssConfig.class); validEntityBeforeSave(config); - LambdaUpdateWrapper<SysOssConfig> luw = new LambdaUpdateWrapper<>(); - luw.set(StringUtils.isBlank(config.getPrefix()), SysOssConfig::getPrefix, ""); - luw.set(StringUtils.isBlank(config.getRegion()), SysOssConfig::getRegion, ""); - luw.set(StringUtils.isBlank(config.getExt1()), SysOssConfig::getExt1, ""); - luw.eq(SysOssConfig::getOssConfigId, config.getOssConfigId()); - return setConfigCache(update(config, luw), config); + LambdaUpdateWrapper<SysOssConfig> luw = new LambdaUpdateWrapper<>(); + luw.set(StringUtils.isBlank(config.getPrefix()), SysOssConfig::getPrefix, ""); + luw.set(StringUtils.isBlank(config.getRegion()), SysOssConfig::getRegion, ""); + luw.set(StringUtils.isBlank(config.getExt1()), SysOssConfig::getExt1, ""); + luw.eq(SysOssConfig::getOssConfigId, config.getOssConfigId()); + return setConfigCache(update(config, luw), config); } /** * 淇濆瓨鍓嶇殑鏁版嵁鏍¢獙 */ - private void validEntityBeforeSave(SysOssConfig entity){ - if (StringUtils.isNotEmpty(entity.getConfigKey()) - && UserConstants.NOT_UNIQUE.equals(checkConfigKeyUnique(entity))) { - throw new ServiceException("鎿嶄綔閰嶇疆'" + entity.getConfigKey() + "'澶辫触, 閰嶇疆key宸插瓨鍦�!"); - } + private void validEntityBeforeSave(SysOssConfig entity) { + if (StringUtils.isNotEmpty(entity.getConfigKey()) + && UserConstants.NOT_UNIQUE.equals(checkConfigKeyUnique(entity))) { + throw new ServiceException("鎿嶄綔閰嶇疆'" + entity.getConfigKey() + "'澶辫触, 閰嶇疆key宸插瓨鍦�!"); + } } @Override public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { - if(isValid) { - if (CollUtil.containsAny(ids, CloudConstant.SYSTEM_DATA_IDS)) { - throw new ServiceException("绯荤粺鍐呯疆, 涓嶅彲鍒犻櫎!"); - } - } + if (isValid) { + if (CollUtil.containsAny(ids, CloudConstant.SYSTEM_DATA_IDS)) { + throw new ServiceException("绯荤粺鍐呯疆, 涓嶅彲鍒犻櫎!"); + } + } List<SysOssConfig> list = Lists.newArrayList(); for (Long configId : ids) { SysOssConfig config = getById(configId); @@ -128,61 +128,62 @@ return flag; } - /** - * 鍒ゆ柇configKey鏄惁鍞竴 - */ - private String checkConfigKeyUnique(SysOssConfig sysOssConfig) { - long ossConfigId = StringUtils.isNull(sysOssConfig.getOssConfigId()) ? -1L : sysOssConfig.getOssConfigId(); - SysOssConfig info = getOne(new LambdaQueryWrapper<SysOssConfig>() - .select(SysOssConfig::getOssConfigId, SysOssConfig::getConfigKey) - .eq(SysOssConfig::getConfigKey, sysOssConfig.getConfigKey())); - if (StringUtils.isNotNull(info) && info.getOssConfigId() != ossConfigId) { - return UserConstants.NOT_UNIQUE; - } - return UserConstants.UNIQUE; - } + /** + * 鍒ゆ柇configKey鏄惁鍞竴 + */ + private String checkConfigKeyUnique(SysOssConfig sysOssConfig) { + long ossConfigId = StringUtils.isNull(sysOssConfig.getOssConfigId()) ? -1L : sysOssConfig.getOssConfigId(); + SysOssConfig info = getOne(new LambdaQueryWrapper<SysOssConfig>() + .select(SysOssConfig::getOssConfigId, SysOssConfig::getConfigKey) + .eq(SysOssConfig::getConfigKey, sysOssConfig.getConfigKey())); + if (StringUtils.isNotNull(info) && info.getOssConfigId() != ossConfigId) { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } - /** - * 鍚敤绂佺敤鐘舵�� - */ - @Override - @Transactional(rollbackFor = Exception.class) - public int updateOssConfigStatus(SysOssConfigBo bo) { - SysOssConfig sysOssConfig = BeanUtil.toBean(bo, SysOssConfig.class); - int row = baseMapper.update(null, new LambdaUpdateWrapper<SysOssConfig>() - .set(SysOssConfig::getStatus, "1")); - row += baseMapper.updateById(sysOssConfig); - if (row > 0) { - RedisUtils.setCacheObject(CloudConstant.CACHE_CONFIG_KEY, sysOssConfig.getConfigKey()); - } - return row; - } + /** + * 鍚敤绂佺敤鐘舵�� + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int updateOssConfigStatus(SysOssConfigBo bo) { + SysOssConfig sysOssConfig = BeanUtil.toBean(bo, SysOssConfig.class); + int row = baseMapper.update(null, new LambdaUpdateWrapper<SysOssConfig>() + .set(SysOssConfig::getStatus, "1")); + row += baseMapper.updateById(sysOssConfig); + if (row > 0) { + RedisUtils.setCacheObject(CloudConstant.CACHE_CONFIG_KEY, sysOssConfig.getConfigKey()); + } + return row; + } - /** - * 璁剧疆cache key - * - * @param configKey 鍙傛暟閿� - * @return 缂撳瓨閿甼ey - */ - private String getCacheKey(String configKey) { - return CloudConstant.SYS_OSS_KEY + configKey; - } + /** + * 璁剧疆cache key + * + * @param configKey 鍙傛暟閿� + * @return 缂撳瓨閿甼ey + */ + private String getCacheKey(String configKey) { + return CloudConstant.SYS_OSS_KEY + configKey; + } - /** - * 濡傛灉鎿嶄綔鎴愬姛 鍒欐洿鏂扮紦瀛� - * @param flag 鎿嶄綔鐘舵�� - * @param config 閰嶇疆 - * @return 杩斿洖鎿嶄綔鐘舵�� - */ - private boolean setConfigCache(boolean flag, SysOssConfig config) { - if (flag) { - RedisUtils.setCacheObject( - getCacheKey(config.getConfigKey()), - JsonUtils.toJsonString(config)); - RedisUtils.publish(CloudConstant.CACHE_CONFIG_KEY, config.getConfigKey(), msg -> { - log.info("鍙戝竷鍒锋柊OSS閰嶇疆 => " + msg); - }); - } - return flag; - } + /** + * 濡傛灉鎿嶄綔鎴愬姛 鍒欐洿鏂扮紦瀛� + * + * @param flag 鎿嶄綔鐘舵�� + * @param config 閰嶇疆 + * @return 杩斿洖鎿嶄綔鐘舵�� + */ + private boolean setConfigCache(boolean flag, SysOssConfig config) { + if (flag) { + RedisUtils.setCacheObject( + getCacheKey(config.getConfigKey()), + JsonUtils.toJsonString(config)); + RedisUtils.publish(CloudConstant.CACHE_CONFIG_KEY, config.getConfigKey(), msg -> { + log.info("鍙戝竷鍒锋柊OSS閰嶇疆 => " + msg); + }); + } + return flag; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssServiceImpl.java index 13a2220..b703ff6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssServiceImpl.java @@ -32,59 +32,59 @@ @Service public class SysOssServiceImpl extends ServicePlusImpl<SysOssMapper, SysOss, SysOssVo> implements ISysOssService { - @Override - public TableDataInfo<SysOssVo> queryPageList(SysOssBo bo) { - PagePlus<SysOss, SysOssVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo)); - return PageUtils.buildDataInfo(result); - } + @Override + public TableDataInfo<SysOssVo> queryPageList(SysOssBo bo) { + PagePlus<SysOss, SysOssVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo)); + return PageUtils.buildDataInfo(result); + } - private LambdaQueryWrapper<SysOss> buildQueryWrapper(SysOssBo bo) { - Map<String, Object> params = bo.getParams(); - LambdaQueryWrapper<SysOss> lqw = Wrappers.lambdaQuery(); - lqw.like(StringUtils.isNotBlank(bo.getFileName()), SysOss::getFileName, bo.getFileName()); - lqw.like(StringUtils.isNotBlank(bo.getOriginalName()), SysOss::getOriginalName, bo.getOriginalName()); - lqw.eq(StringUtils.isNotBlank(bo.getFileSuffix()), SysOss::getFileSuffix, bo.getFileSuffix()); - lqw.eq(StringUtils.isNotBlank(bo.getUrl()), SysOss::getUrl, bo.getUrl()); - lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null, - SysOss::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime")); - lqw.eq(StringUtils.isNotBlank(bo.getCreateBy()), SysOss::getCreateBy, bo.getCreateBy()); - lqw.eq(StringUtils.isNotBlank(bo.getService()), SysOss::getService, bo.getService()); - return lqw; - } + private LambdaQueryWrapper<SysOss> buildQueryWrapper(SysOssBo bo) { + Map<String, Object> params = bo.getParams(); + LambdaQueryWrapper<SysOss> lqw = Wrappers.lambdaQuery(); + lqw.like(StringUtils.isNotBlank(bo.getFileName()), SysOss::getFileName, bo.getFileName()); + lqw.like(StringUtils.isNotBlank(bo.getOriginalName()), SysOss::getOriginalName, bo.getOriginalName()); + lqw.eq(StringUtils.isNotBlank(bo.getFileSuffix()), SysOss::getFileSuffix, bo.getFileSuffix()); + lqw.eq(StringUtils.isNotBlank(bo.getUrl()), SysOss::getUrl, bo.getUrl()); + lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null, + SysOss::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime")); + lqw.eq(StringUtils.isNotBlank(bo.getCreateBy()), SysOss::getCreateBy, bo.getCreateBy()); + lqw.eq(StringUtils.isNotBlank(bo.getService()), SysOss::getService, bo.getService()); + return lqw; + } - @Override - public SysOss upload(MultipartFile file) { - String originalfileName = file.getOriginalFilename(); - String suffix = StringUtils.substring(originalfileName, originalfileName.lastIndexOf("."), originalfileName.length()); - ICloudStorageStrategy storage = OssFactory.instance(); - UploadResult uploadResult; - try { - uploadResult = storage.uploadSuffix(file.getBytes(), suffix, file.getContentType()); - } catch (IOException e) { - throw new ServiceException(e.getMessage()); - } - // 淇濆瓨鏂囦欢淇℃伅 - SysOss oss = new SysOss() - .setUrl(uploadResult.getUrl()) - .setFileSuffix(suffix) - .setFileName(uploadResult.getFilename()) - .setOriginalName(originalfileName) - .setService(storage.getServiceType()); - save(oss); - return oss; - } + @Override + public SysOss upload(MultipartFile file) { + String originalfileName = file.getOriginalFilename(); + String suffix = StringUtils.substring(originalfileName, originalfileName.lastIndexOf("."), originalfileName.length()); + ICloudStorageStrategy storage = OssFactory.instance(); + UploadResult uploadResult; + try { + uploadResult = storage.uploadSuffix(file.getBytes(), suffix, file.getContentType()); + } catch (IOException e) { + throw new ServiceException(e.getMessage()); + } + // 淇濆瓨鏂囦欢淇℃伅 + SysOss oss = new SysOss() + .setUrl(uploadResult.getUrl()) + .setFileSuffix(suffix) + .setFileName(uploadResult.getFilename()) + .setOriginalName(originalfileName) + .setService(storage.getServiceType()); + save(oss); + return oss; + } - @Override - public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { - if (isValid) { - // 鍋氫竴浜涗笟鍔′笂鐨勬牎楠�,鍒ゆ柇鏄惁闇�瑕佹牎楠� - } - List<SysOss> list = listByIds(ids); - for (SysOss sysOss : list) { - ICloudStorageStrategy storage = OssFactory.instance(sysOss.getService()); - storage.delete(sysOss.getUrl()); - } - return removeByIds(ids); - } + @Override + public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { + if (isValid) { + // 鍋氫竴浜涗笟鍔′笂鐨勬牎楠�,鍒ゆ柇鏄惁闇�瑕佹牎楠� + } + List<SysOss> list = listByIds(ids); + for (SysOss sysOss : list) { + ICloudStorageStrategy storage = OssFactory.instance(sysOss.getService()); + storage.delete(sysOss.getUrl()); + } + return removeByIds(ids); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java index 3a3cd0f..9681b3d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java @@ -21,7 +21,7 @@ /** * 宀椾綅淇℃伅 鏈嶅姟灞傚鐞� * - * @author ruoyi + * @author Lion Li */ @Service public class SysPostServiceImpl extends ServicePlusImpl<SysPostMapper, SysPost, SysPost> implements ISysPostService { @@ -35,7 +35,7 @@ .like(StringUtils.isNotBlank(post.getPostCode()), SysPost::getPostCode, post.getPostCode()) .eq(StringUtils.isNotBlank(post.getStatus()), SysPost::getStatus, post.getStatus()) .like(StringUtils.isNotBlank(post.getPostName()), SysPost::getPostName, post.getPostName()); - return PageUtils.buildDataInfo(page(PageUtils.buildPage(),lqw)); + return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); } /** @@ -126,7 +126,7 @@ */ @Override public long countUserPostById(Long postId) { - return userPostMapper.selectCount(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getPostId,postId)); + return userPostMapper.selectCount(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getPostId, postId)); } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index eff0022..6e0ed78 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -4,9 +4,9 @@ import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.SecurityUtils; @@ -29,7 +29,7 @@ /** * 瑙掕壊 涓氬姟灞傚鐞� * - * @author ruoyi + * @author Lion Li */ @Service public class SysRoleServiceImpl extends ServicePlusImpl<SysRoleMapper, SysRole, SysRole> implements ISysRoleService { @@ -280,7 +280,7 @@ list.add(rm); } if (list.size() > 0) { - rows = roleMenuMapper.insertAll(list); + rows = roleMenuMapper.insertAll(list); } return rows; } @@ -301,7 +301,7 @@ list.add(rd); } if (list.size() > 0) { - rows = roleDeptMapper.insertAll(list); + rows = roleDeptMapper.insertAll(list); } return rows; } @@ -355,45 +355,45 @@ @Override public int deleteAuthUser(SysUserRole userRole) { return userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>() - .eq(SysUserRole::getRoleId, userRole.getRoleId()) - .eq(SysUserRole::getUserId, userRole.getUserId())); + .eq(SysUserRole::getRoleId, userRole.getRoleId()) + .eq(SysUserRole::getUserId, userRole.getUserId())); } /** * 鎵归噺鍙栨秷鎺堟潈鐢ㄦ埛瑙掕壊 * - * @param roleId 瑙掕壊ID + * @param roleId 瑙掕壊ID * @param userIds 闇�瑕佸彇娑堟巿鏉冪殑鐢ㄦ埛鏁版嵁ID * @return 缁撴灉 */ @Override public int deleteAuthUsers(Long roleId, Long[] userIds) { - return userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>() - .eq(SysUserRole::getRoleId, roleId) - .in(SysUserRole::getUserId, Arrays.asList(userIds))); + return userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>() + .eq(SysUserRole::getRoleId, roleId) + .in(SysUserRole::getUserId, Arrays.asList(userIds))); } /** * 鎵归噺閫夋嫨鎺堟潈鐢ㄦ埛瑙掕壊 * - * @param roleId 瑙掕壊ID + * @param roleId 瑙掕壊ID * @param userIds 闇�瑕佸垹闄ょ殑鐢ㄦ埛鏁版嵁ID * @return 缁撴灉 */ @Override public int insertAuthUsers(Long roleId, Long[] userIds) { // 鏂板鐢ㄦ埛涓庤鑹茬鐞� - int rows = 1; - List<SysUserRole> list = new ArrayList<SysUserRole>(); + int rows = 1; + List<SysUserRole> list = new ArrayList<SysUserRole>(); for (Long userId : userIds) { SysUserRole ur = new SysUserRole(); ur.setUserId(userId); ur.setRoleId(roleId); list.add(ur); } - if (list.size() > 0) { - rows = userRoleMapper.insertAll(list); - } + if (list.size() > 0) { + rows = userRoleMapper.insertAll(list); + } return rows; } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java index 6a41cb6..cf5afc5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java @@ -9,10 +9,11 @@ /** * 鍦ㄧ嚎鐢ㄦ埛 鏈嶅姟灞傚鐞� * - * @author ruoyi + * @author Lion Li */ @Service public class SysUserOnlineServiceImpl implements ISysUserOnlineService { + /** * 閫氳繃鐧诲綍鍦板潃鏌ヨ淇℃伅 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index 7e31821..e1bd9cc 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -31,7 +31,7 @@ /** * 鐢ㄦ埛 涓氬姟灞傚鐞� * - * @author ruoyi + * @author Lion Li */ @Slf4j @Service @@ -79,7 +79,7 @@ @Override @DataScope(deptAlias = "d", userAlias = "u", isUser = true) public TableDataInfo<SysUser> selectAllocatedList(SysUser user) { - return PageUtils.buildDataInfo(baseMapper.selectAllocatedList(PageUtils.buildPage(), user)); + return PageUtils.buildDataInfo(baseMapper.selectAllocatedList(PageUtils.buildPage(), user)); } /** @@ -91,7 +91,7 @@ @Override @DataScope(deptAlias = "d", userAlias = "u", isUser = true) public TableDataInfo<SysUser> selectUnallocatedList(SysUser user) { - return PageUtils.buildDataInfo(baseMapper.selectUnallocatedList(PageUtils.buildPage(), user)); + return PageUtils.buildDataInfo(baseMapper.selectUnallocatedList(PageUtils.buildPage(), user)); } /** @@ -258,7 +258,7 @@ * @param user 鐢ㄦ埛淇℃伅 * @return 缁撴灉 */ - @Override + @Override public boolean registerUser(SysUser user) { return baseMapper.insert(user) > 0; } @@ -274,11 +274,11 @@ public int updateUser(SysUser user) { Long userId = user.getUserId(); // 鍒犻櫎鐢ㄦ埛涓庤鑹插叧鑱� - userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId,userId)); + userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId)); // 鏂板鐢ㄦ埛涓庤鑹茬鐞� insertUserRole(user); // 鍒犻櫎鐢ㄦ埛涓庡矖浣嶅叧鑱� - userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId,userId)); + userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId, userId)); // 鏂板鐢ㄦ埛涓庡矖浣嶇鐞� insertUserPost(user); return baseMapper.updateById(user); @@ -287,15 +287,14 @@ /** * 鐢ㄦ埛鎺堟潈瑙掕壊 * - * @param userId 鐢ㄦ埛ID + * @param userId 鐢ㄦ埛ID * @param roleIds 瑙掕壊缁� */ @Override @Transactional - public void insertUserAuth(Long userId, Long[] roleIds) - { + public void insertUserAuth(Long userId, Long[] roleIds) { userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>() - .eq(SysUserRole::getUserId, userId)); + .eq(SysUserRole::getUserId, userId)); insertUserRole(userId, roleIds); } @@ -325,15 +324,15 @@ * 淇敼鐢ㄦ埛澶村儚 * * @param userName 鐢ㄦ埛鍚� - * @param avatar 澶村儚鍦板潃 + * @param avatar 澶村儚鍦板潃 * @return 缁撴灉 */ @Override public boolean updateUserAvatar(String userName, String avatar) { return baseMapper.update(null, new LambdaUpdateWrapper<SysUser>() - .set(SysUser::getAvatar,avatar) - .eq(SysUser::getUserName,userName)) > 0; + .set(SysUser::getAvatar, avatar) + .eq(SysUser::getUserName, userName)) > 0; } /** @@ -358,8 +357,8 @@ public int resetUserPwd(String userName, String password) { return baseMapper.update(null, new LambdaUpdateWrapper<SysUser>() - .set(SysUser::getPassword,password) - .eq(SysUser::getUserName,userName)); + .set(SysUser::getPassword, password) + .eq(SysUser::getUserName, userName)); } /** @@ -379,7 +378,7 @@ list.add(ur); } if (list.size() > 0) { - userRoleMapper.insertAll(list); + userRoleMapper.insertAll(list); } } } @@ -401,7 +400,7 @@ list.add(up); } if (list.size() > 0) { - userPostMapper.insertAll(list); + userPostMapper.insertAll(list); } } } @@ -409,7 +408,7 @@ /** * 鏂板鐢ㄦ埛瑙掕壊淇℃伅 * - * @param userId 鐢ㄦ埛ID + * @param userId 鐢ㄦ埛ID * @param roleIds 瑙掕壊缁� */ public void insertUserRole(Long userId, Long[] roleIds) { @@ -438,9 +437,9 @@ @Transactional public int deleteUserById(Long userId) { // 鍒犻櫎鐢ㄦ埛涓庤鑹插叧鑱� - userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId,userId)); + userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId)); // 鍒犻櫎鐢ㄦ埛涓庡矖浣嶈〃 - userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId,userId)); + userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId, userId)); return baseMapper.deleteById(userId); } @@ -458,18 +457,18 @@ } List<Long> ids = Arrays.asList(userIds); // 鍒犻櫎鐢ㄦ埛涓庤鑹插叧鑱� - userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getUserId,ids)); + userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getUserId, ids)); // 鍒犻櫎鐢ㄦ埛涓庡矖浣嶈〃 - userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().in(SysUserPost::getUserId,ids)); + userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().in(SysUserPost::getUserId, ids)); return baseMapper.deleteBatchIds(ids); } /** * 瀵煎叆鐢ㄦ埛鏁版嵁 * - * @param userList 鐢ㄦ埛鏁版嵁鍒楄〃 + * @param userList 鐢ㄦ埛鏁版嵁鍒楄〃 * @param isUpdateSupport 鏄惁鏇存柊鏀寔锛屽鏋滃凡瀛樺湪锛屽垯杩涜鏇存柊鏁版嵁 - * @param operName 鎿嶄綔鐢ㄦ埛 + * @param operName 鎿嶄綔鐢ㄦ埛 * @return 缁撴灉 */ @Override diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TokenServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TokenServiceImpl.java index f54130a..15b9759 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TokenServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TokenServiceImpl.java @@ -49,16 +49,16 @@ // 鑾峰彇璇锋眰鎼哄甫鐨勪护鐗� String token = getToken(request); if (StringUtils.isNotEmpty(token)) { - try { - Claims claims = parseToken(token); - // 瑙f瀽瀵瑰簲鐨勬潈闄愪互鍙婄敤鎴蜂俊鎭� - String uuid = (String) claims.get(Constants.LOGIN_USER_KEY); - String userKey = getTokenKey(uuid); - LoginUser user = RedisUtils.getCacheObject(userKey); - return user; - } catch (Exception e) { + try { + Claims claims = parseToken(token); + // 瑙f瀽瀵瑰簲鐨勬潈闄愪互鍙婄敤鎴蜂俊鎭� + String uuid = (String) claims.get(Constants.LOGIN_USER_KEY); + String userKey = getTokenKey(uuid); + LoginUser user = RedisUtils.getCacheObject(userKey); + return user; + } catch (Exception e) { - } + } } return null; } -- Gitblit v1.9.3