Compare commits

..

No commits in common. "1d05647a73d482931dd1f40b4d843e0c34d6a099" and "7ac5ebc2d44535fb3582d1e0a38efd21c2d2fc28" have entirely different histories.

327 changed files with 871 additions and 842 deletions

30
pom.xml
View File

@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.muyu</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
<version>3.8.6</version> <version>3.8.6</version>
@ -16,7 +16,7 @@
<ruoyi.version>3.8.6</ruoyi.version> <ruoyi.version>3.8.6</ruoyi.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>17</java.version> <java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version> <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<druid.version>1.2.16</druid.version> <druid.version>1.2.16</druid.version>
<bitwalker.version>1.21</bitwalker.version> <bitwalker.version>1.21</bitwalker.version>
@ -31,6 +31,7 @@
<velocity.version>2.3</velocity.version> <velocity.version>2.3</velocity.version>
<jwt.version>0.9.1</jwt.version> <jwt.version>0.9.1</jwt.version>
<knife4j.version>4.3.0</knife4j.version> <knife4j.version>4.3.0</knife4j.version>
<mysql.version>8.0.33</mysql.version>
</properties> </properties>
<!-- 依赖声明 --> <!-- 依赖声明 -->
@ -53,6 +54,13 @@
<version>${knife4j.version}</version> <version>${knife4j.version}</version>
</dependency> </dependency>
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<!-- 阿里数据库连接池 --> <!-- 阿里数据库连接池 -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
@ -144,35 +152,35 @@
<!-- 定时任务--> <!-- 定时任务-->
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-quartz</artifactId> <artifactId>ruoyi-quartz</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- 代码生成--> <!-- 代码生成-->
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-generator</artifactId> <artifactId>ruoyi-generator</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- 核心模块--> <!-- 核心模块-->
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-framework</artifactId> <artifactId>ruoyi-framework</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- 系统模块--> <!-- 系统模块-->
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-system</artifactId> <artifactId>ruoyi-system</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- 通用工具--> <!-- 通用工具-->
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId> <artifactId>ruoyi-common</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
@ -181,8 +189,12 @@
</dependencyManagement> </dependencyManagement>
<modules> <modules>
<module>ruoyi-application</module> <module>ruoyi-admin</module>
<module>ruoyi-basic</module> <module>ruoyi-framework</module>
<module>ruoyi-system</module>
<module>ruoyi-quartz</module>
<module>ruoyi-generator</module>
<module>ruoyi-common</module>
</modules> </modules>
<packaging>pom</packaging> <packaging>pom</packaging>

View File

@ -4,12 +4,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
<groupId>com.muyu</groupId> <groupId>com.ruoyi</groupId>
<version>3.8.6</version> <version>3.8.6</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging> <packaging>jar</packaging>
<artifactId>ruoyi-application</artifactId> <artifactId>ruoyi-admin</artifactId>
<description> <description>
web服务入口 web服务入口
@ -54,25 +54,25 @@
<!-- Mysql驱动包 --> <!-- Mysql驱动包 -->
<dependency> <dependency>
<groupId>com.mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-j</artifactId> <artifactId>mysql-connector-java</artifactId>
</dependency> </dependency>
<!-- 核心模块--> <!-- 核心模块-->
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-framework</artifactId> <artifactId>ruoyi-framework</artifactId>
</dependency> </dependency>
<!-- 定时任务--> <!-- 定时任务-->
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-quartz</artifactId> <artifactId>ruoyi-quartz</artifactId>
</dependency> </dependency>
<!-- 代码生成--> <!-- 代码生成-->
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-generator</artifactId> <artifactId>ruoyi-generator</artifactId>
</dependency> </dependency>

View File

@ -66,7 +66,7 @@ public class CommonController {
* *
*/ */
@PostMapping("/upload") @PostMapping("/upload")
public Result<UploadFileModel> uploadFile (MultipartFile file) throws Exception { public Result uploadFile (MultipartFile file) throws Exception {
try { try {
// 上传文件路径 // 上传文件路径
String filePath = RuoYiConfig.getUploadPath(); String filePath = RuoYiConfig.getUploadPath();
@ -89,7 +89,7 @@ public class CommonController {
* *
*/ */
@PostMapping("/uploads") @PostMapping("/uploads")
public Result<List<UploadFileModel>> uploadFiles (List<MultipartFile> files) throws Exception { public Result uploadFiles (List<MultipartFile> files) throws Exception {
try { try {
// 上传文件路径 // 上传文件路径
String filePath = RuoYiConfig.getUploadPath(); String filePath = RuoYiConfig.getUploadPath();

View File

@ -36,7 +36,7 @@ public class CacheController {
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping() @GetMapping()
public Result<Map<String, Object>> getInfo () throws Exception { public Result getInfo () throws Exception {
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info()); Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats")); 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>) connection -> connection.dbSize());
@ -59,20 +59,20 @@ public class CacheController {
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getNames") @GetMapping("/getNames")
public Result<List<SysCache>> cache () { public Result cache () {
return Result.success(caches); return Result.success(caches);
} }
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getKeys/{cacheName}") @GetMapping("/getKeys/{cacheName}")
public Result<Set<String>> getCacheKeys (@PathVariable String cacheName) { public Result getCacheKeys (@PathVariable String cacheName) {
Set<String> cacheKeys = redisTemplate.keys(cacheName + "*"); Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
return Result.success(cacheKeys); return Result.success(cacheKeys);
} }
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getValue/{cacheName}/{cacheKey}") @GetMapping("/getValue/{cacheName}/{cacheKey}")
public Result<SysCache> getCacheValue (@PathVariable String cacheName, @PathVariable String cacheKey) { public Result getCacheValue (@PathVariable String cacheName, @PathVariable String cacheKey) {
String cacheValue = redisTemplate.opsForValue().get(cacheKey); String cacheValue = redisTemplate.opsForValue().get(cacheKey);
SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue); SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
return Result.success(sysCache); return Result.success(sysCache);
@ -80,28 +80,24 @@ public class CacheController {
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheName/{cacheName}") @DeleteMapping("/clearCacheName/{cacheName}")
public Result<String> clearCacheName (@PathVariable String cacheName) { public Result clearCacheName (@PathVariable String cacheName) {
Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*"); Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
if (cacheKeys != null) {
redisTemplate.delete(cacheKeys); redisTemplate.delete(cacheKeys);
}
return Result.success(); return Result.success();
} }
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheKey/{cacheKey}") @DeleteMapping("/clearCacheKey/{cacheKey}")
public Result<String> clearCacheKey (@PathVariable String cacheKey) { public Result clearCacheKey (@PathVariable String cacheKey) {
redisTemplate.delete(cacheKey); redisTemplate.delete(cacheKey);
return Result.success(); return Result.success();
} }
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheAll") @DeleteMapping("/clearCacheAll")
public Result<String> clearCacheAll () { public Result clearCacheAll () {
Collection<String> cacheKeys = redisTemplate.keys("*"); Collection<String> cacheKeys = redisTemplate.keys("*");
if (cacheKeys != null) {
redisTemplate.delete(cacheKeys); redisTemplate.delete(cacheKeys);
}
return Result.success(); return Result.success();
} }
} }

View File

@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
public class ServerController { public class ServerController {
@PreAuthorize("@ss.hasPermi('monitor:server:list')") @PreAuthorize("@ss.hasPermi('monitor:server:list')")
@GetMapping() @GetMapping()
public Result<Server> getInfo () throws Exception { public Result getInfo () throws Exception {
Server server = new Server(); Server server = new Server();
server.copyTo(); server.copyTo();
return Result.success(server); return Result.success(server);

View File

@ -32,7 +32,7 @@ public class SysLogininforController extends BaseController {
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
@GetMapping("/list") @GetMapping("/list")
public Result<TableDataInfo<SysLogininfor>> list (SysLogininfor logininfor) { public Result<TableDataInfo> list (SysLogininfor logininfor) {
startPage(); startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list); return getDataTable(list);
@ -50,23 +50,23 @@ public class SysLogininforController extends BaseController {
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.DELETE) @Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{infoIds}") @DeleteMapping("/{infoIds}")
public Result<String> remove (@PathVariable Long[] infoIds) { public Result remove (@PathVariable Long[] infoIds) {
return toAjax(logininforService.deleteLogininforByIds(infoIds)); return toAjax(logininforService.deleteLogininforByIds(infoIds));
} }
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.CLEAN) @Log(title = "登录日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean") @DeleteMapping("/clean")
public Result<String> clean () { public Result clean () {
logininforService.cleanLogininfor(); logininforService.cleanLogininfor();
return Result.success(); return success();
} }
@PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
@Log(title = "账户解锁", businessType = BusinessType.OTHER) @Log(title = "账户解锁", businessType = BusinessType.OTHER)
@GetMapping("/unlock/{userName}") @GetMapping("/unlock/{userName}")
public Result<String> unlock (@PathVariable("userName") String userName) { public Result unlock (@PathVariable("userName") String userName) {
passwordService.clearLoginRecordCache(userName); passwordService.clearLoginRecordCache(userName);
return Result.success(); return success();
} }
} }

View File

@ -28,7 +28,7 @@ public class SysOperlogController extends BaseController {
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')") @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
@GetMapping("/list") @GetMapping("/list")
public Result<TableDataInfo<SysOperLog>> list (SysOperLog operLog) { public Result<TableDataInfo> list (SysOperLog operLog) {
startPage(); startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog); List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list); return getDataTable(list);
@ -46,15 +46,15 @@ public class SysOperlogController extends BaseController {
@Log(title = "操作日志", businessType = BusinessType.DELETE) @Log(title = "操作日志", businessType = BusinessType.DELETE)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/{operIds}") @DeleteMapping("/{operIds}")
public Result<String> remove (@PathVariable Long[] operIds) { public Result remove (@PathVariable Long[] operIds) {
return toAjax(operLogService.deleteOperLogByIds(operIds)); return toAjax(operLogService.deleteOperLogByIds(operIds));
} }
@Log(title = "操作日志", businessType = BusinessType.CLEAN) @Log(title = "操作日志", businessType = BusinessType.CLEAN)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/clean") @DeleteMapping("/clean")
public Result<String> clean () { public Result clean () {
operLogService.cleanOperLog(); operLogService.cleanOperLog();
return Result.success(); return success();
} }
} }

View File

@ -36,7 +36,7 @@ public class SysUserOnlineController extends BaseController {
@PreAuthorize("@ss.hasPermi('monitor:online:list')") @PreAuthorize("@ss.hasPermi('monitor:online:list')")
@GetMapping("/list") @GetMapping("/list")
public Result<TableDataInfo<SysUserOnline>> list (String ipaddr, String userName) { public Result<TableDataInfo> list (String ipaddr, String userName) {
Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>(); List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys) { for (String key : keys) {
@ -62,8 +62,8 @@ public class SysUserOnlineController extends BaseController {
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')") @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
@Log(title = "在线用户", businessType = BusinessType.FORCE) @Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/{tokenId}") @DeleteMapping("/{tokenId}")
public Result<String> forceLogout (@PathVariable String tokenId) { public Result forceLogout (@PathVariable String tokenId) {
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId); redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
return Result.success(); return success();
} }
} }

View File

@ -32,7 +32,7 @@ public class SysConfigController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:config:list')") @PreAuthorize("@ss.hasPermi('system:config:list')")
@GetMapping("/list") @GetMapping("/list")
public Result<TableDataInfo<SysConfig>> list (SysConfig config) { public Result<TableDataInfo> list (SysConfig config) {
startPage(); startPage();
List<SysConfig> list = configService.selectConfigList(config); List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list); return getDataTable(list);
@ -52,16 +52,16 @@ public class SysConfigController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:config:query')") @PreAuthorize("@ss.hasPermi('system:config:query')")
@GetMapping(value = "/{configId}") @GetMapping(value = "/{configId}")
public Result<SysConfig> getInfo (@PathVariable Long configId) { public Result getInfo (@PathVariable Long configId) {
return Result.success(configService.selectConfigById(configId)); return success(configService.selectConfigById(configId));
} }
/** /**
* *
*/ */
@GetMapping(value = "/configKey/{configKey}") @GetMapping(value = "/configKey/{configKey}")
public Result<String> getConfigKey (@PathVariable String configKey) { public Result getConfigKey (@PathVariable String configKey) {
return Result.success(configService.selectConfigByKey(configKey)); return success(configService.selectConfigByKey(configKey));
} }
/** /**
@ -70,7 +70,7 @@ public class SysConfigController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:config:add')") @PreAuthorize("@ss.hasPermi('system:config:add')")
@Log(title = "参数管理", businessType = BusinessType.INSERT) @Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public Result<String> add (@Validated @RequestBody SysConfig config) { public Result add (@Validated @RequestBody SysConfig config) {
if (!configService.checkConfigKeyUnique(config)) { if (!configService.checkConfigKeyUnique(config)) {
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
} }
@ -84,7 +84,7 @@ public class SysConfigController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:config:edit')") @PreAuthorize("@ss.hasPermi('system:config:edit')")
@Log(title = "参数管理", businessType = BusinessType.UPDATE) @Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public Result<String> edit (@Validated @RequestBody SysConfig config) { public Result edit (@Validated @RequestBody SysConfig config) {
if (!configService.checkConfigKeyUnique(config)) { if (!configService.checkConfigKeyUnique(config)) {
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
} }
@ -98,9 +98,9 @@ public class SysConfigController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:config:remove')") @PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.DELETE) @Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}") @DeleteMapping("/{configIds}")
public Result<String> remove (@PathVariable Long[] configIds) { public Result remove (@PathVariable Long[] configIds) {
configService.deleteConfigByIds(configIds); configService.deleteConfigByIds(configIds);
return Result.success(); return success();
} }
/** /**
@ -109,8 +109,8 @@ public class SysConfigController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:config:remove')") @PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.CLEAN) @Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache") @DeleteMapping("/refreshCache")
public Result<String> refreshCache () { public Result refreshCache () {
configService.resetConfigCache(); configService.resetConfigCache();
return Result.success(); return success();
} }
} }

View File

@ -32,9 +32,9 @@ public class SysDeptController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:dept:list')") @PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list") @GetMapping("/list")
public Result<List<SysDept>> list (SysDept dept) { public Result list (SysDept dept) {
List<SysDept> depts = deptService.selectDeptList(dept); List<SysDept> depts = deptService.selectDeptList(dept);
return Result.success(depts); return success(depts);
} }
/** /**
@ -42,10 +42,10 @@ public class SysDeptController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:dept:list')") @PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list/exclude/{deptId}") @GetMapping("/list/exclude/{deptId}")
public Result<List<SysDept>> excludeChild (@PathVariable(value = "deptId", required = false) Long deptId) { public Result excludeChild (@PathVariable(value = "deptId", required = false) Long deptId) {
List<SysDept> depts = deptService.selectDeptList(new SysDept()); List<SysDept> depts = deptService.selectDeptList(new SysDept());
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
return Result.success(depts); return success(depts);
} }
/** /**
@ -53,9 +53,9 @@ public class SysDeptController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:dept:query')") @PreAuthorize("@ss.hasPermi('system:dept:query')")
@GetMapping(value = "/{deptId}") @GetMapping(value = "/{deptId}")
public Result<SysDept> getInfo (@PathVariable Long deptId) { public Result getInfo (@PathVariable Long deptId) {
deptService.checkDeptDataScope(deptId); deptService.checkDeptDataScope(deptId);
return Result.success(deptService.selectDeptById(deptId)); return success(deptService.selectDeptById(deptId));
} }
/** /**
@ -64,7 +64,7 @@ public class SysDeptController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dept:add')") @PreAuthorize("@ss.hasPermi('system:dept:add')")
@Log(title = "部门管理", businessType = BusinessType.INSERT) @Log(title = "部门管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public Result<String> add (@Validated @RequestBody SysDept dept) { public Result add (@Validated @RequestBody SysDept dept) {
if (!deptService.checkDeptNameUnique(dept)) { if (!deptService.checkDeptNameUnique(dept)) {
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
} }
@ -78,7 +78,7 @@ public class SysDeptController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dept:edit')") @PreAuthorize("@ss.hasPermi('system:dept:edit')")
@Log(title = "部门管理", businessType = BusinessType.UPDATE) @Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public Result<String> edit (@Validated @RequestBody SysDept dept) { public Result edit (@Validated @RequestBody SysDept dept) {
Long deptId = dept.getDeptId(); Long deptId = dept.getDeptId();
deptService.checkDeptDataScope(deptId); deptService.checkDeptDataScope(deptId);
if (!deptService.checkDeptNameUnique(dept)) { if (!deptService.checkDeptNameUnique(dept)) {
@ -98,7 +98,7 @@ public class SysDeptController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dept:remove')") @PreAuthorize("@ss.hasPermi('system:dept:remove')")
@Log(title = "部门管理", businessType = BusinessType.DELETE) @Log(title = "部门管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{deptId}") @DeleteMapping("/{deptId}")
public Result<String> remove (@PathVariable Long deptId) { public Result remove (@PathVariable Long deptId) {
if (deptService.hasChildByDeptId(deptId)) { if (deptService.hasChildByDeptId(deptId)) {
return warn("存在下级部门,不允许删除"); return warn("存在下级部门,不允许删除");
} }

View File

@ -35,7 +35,7 @@ public class SysDictDataController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:list')") @PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list") @GetMapping("/list")
public Result<TableDataInfo<SysDictData>> list (SysDictData dictData) { public Result<TableDataInfo> list (SysDictData dictData) {
startPage(); startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData); List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list); return getDataTable(list);
@ -55,20 +55,20 @@ public class SysDictDataController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:dict:query')") @PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictCode}") @GetMapping(value = "/{dictCode}")
public Result<SysDictData> getInfo (@PathVariable Long dictCode) { public Result getInfo (@PathVariable Long dictCode) {
return Result.success(dictDataService.selectDictDataById(dictCode)); return success(dictDataService.selectDictDataById(dictCode));
} }
/** /**
* *
*/ */
@GetMapping(value = "/type/{dictType}") @GetMapping(value = "/type/{dictType}")
public Result<List<SysDictData>> dictType (@PathVariable String dictType) { public Result dictType (@PathVariable String dictType) {
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType); List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data)) { if (StringUtils.isNull(data)) {
data = new ArrayList<SysDictData>(); data = new ArrayList<SysDictData>();
} }
return Result.success(data); return success(data);
} }
/** /**
@ -77,7 +77,7 @@ public class SysDictDataController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:add')") @PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典数据", businessType = BusinessType.INSERT) @Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public Result<String> add (@Validated @RequestBody SysDictData dict) { public Result add (@Validated @RequestBody SysDictData dict) {
dict.setCreateBy(getUserId()); dict.setCreateBy(getUserId());
return toAjax(dictDataService.insertDictData(dict)); return toAjax(dictDataService.insertDictData(dict));
} }
@ -88,7 +88,7 @@ public class SysDictDataController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:edit')") @PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典数据", businessType = BusinessType.UPDATE) @Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public Result<String> edit (@Validated @RequestBody SysDictData dict) { public Result edit (@Validated @RequestBody SysDictData dict) {
dict.setUpdateBy(getUserId()); dict.setUpdateBy(getUserId());
return toAjax(dictDataService.updateDictData(dict)); return toAjax(dictDataService.updateDictData(dict));
} }
@ -99,8 +99,8 @@ public class SysDictDataController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:remove')") @PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE) @Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}") @DeleteMapping("/{dictCodes}")
public Result<String> remove (@PathVariable Long[] dictCodes) { public Result remove (@PathVariable Long[] dictCodes) {
dictDataService.deleteDictDataByIds(dictCodes); dictDataService.deleteDictDataByIds(dictCodes);
return Result.success(); return success();
} }
} }

View File

@ -29,7 +29,7 @@ public class SysDictTypeController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:list')") @PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list") @GetMapping("/list")
public Result<TableDataInfo<SysDictType>> list (SysDictType dictType) { public Result<TableDataInfo> list (SysDictType dictType) {
startPage(); startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list); return getDataTable(list);
@ -49,8 +49,8 @@ public class SysDictTypeController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:dict:query')") @PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictId}") @GetMapping(value = "/{dictId}")
public Result<SysDictType> getInfo (@PathVariable Long dictId) { public Result getInfo (@PathVariable Long dictId) {
return Result.success(dictTypeService.selectDictTypeById(dictId)); return success(dictTypeService.selectDictTypeById(dictId));
} }
/** /**
@ -59,7 +59,7 @@ public class SysDictTypeController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:add')") @PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典类型", businessType = BusinessType.INSERT) @Log(title = "字典类型", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public Result<String> add (@Validated @RequestBody SysDictType dict) { public Result add (@Validated @RequestBody SysDictType dict) {
if (!dictTypeService.checkDictTypeUnique(dict)) { if (!dictTypeService.checkDictTypeUnique(dict)) {
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
} }
@ -73,7 +73,7 @@ public class SysDictTypeController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:edit')") @PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典类型", businessType = BusinessType.UPDATE) @Log(title = "字典类型", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public Result<String> edit (@Validated @RequestBody SysDictType dict) { public Result edit (@Validated @RequestBody SysDictType dict) {
if (!dictTypeService.checkDictTypeUnique(dict)) { if (!dictTypeService.checkDictTypeUnique(dict)) {
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
} }
@ -87,9 +87,9 @@ public class SysDictTypeController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:remove')") @PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE) @Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}") @DeleteMapping("/{dictIds}")
public Result<String> remove (@PathVariable Long[] dictIds) { public Result remove (@PathVariable Long[] dictIds) {
dictTypeService.deleteDictTypeByIds(dictIds); dictTypeService.deleteDictTypeByIds(dictIds);
return Result.success(); return success();
} }
/** /**
@ -98,17 +98,17 @@ public class SysDictTypeController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:remove')") @PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.CLEAN) @Log(title = "字典类型", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache") @DeleteMapping("/refreshCache")
public Result<String> refreshCache () { public Result refreshCache () {
dictTypeService.resetDictCache(); dictTypeService.resetDictCache();
return Result.success(); return success();
} }
/** /**
* *
*/ */
@GetMapping("/optionselect") @GetMapping("/optionselect")
public Result<List<SysDictType>> optionselect () { public Result optionselect () {
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll(); List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
return Result.success(dictTypes); return success(dictTypes);
} }
} }

View File

@ -8,7 +8,6 @@ import com.ruoyi.common.core.domain.resp.UserInfoResp;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.web.service.SysLoginService; import com.ruoyi.framework.web.service.SysLoginService;
import com.ruoyi.framework.web.service.SysPermissionService; import com.ruoyi.framework.web.service.SysPermissionService;
import com.ruoyi.system.domain.vo.RouterVo;
import com.ruoyi.system.service.SysMenuService; import com.ruoyi.system.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -43,7 +42,7 @@ public class SysLoginController {
* @return * @return
*/ */
@PostMapping("/login") @PostMapping("/login")
public Result<String> login (@RequestBody LoginBody loginBody) { public Result login (@RequestBody LoginBody loginBody) {
// 生成令牌 // 生成令牌
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
loginBody.getUuid()); loginBody.getUuid());
@ -56,7 +55,7 @@ public class SysLoginController {
* @return * @return
*/ */
@GetMapping("getInfo") @GetMapping("getInfo")
public Result<UserInfoResp> getInfo () { public Result getInfo () {
SysUser user = SecurityUtils.getLoginUser().getUser(); SysUser user = SecurityUtils.getLoginUser().getUser();
// 角色集合 // 角色集合
Set<String> roles = permissionService.getRolePermission(user); Set<String> roles = permissionService.getRolePermission(user);
@ -77,7 +76,7 @@ public class SysLoginController {
* @return * @return
*/ */
@GetMapping("getRouters") @GetMapping("getRouters")
public Result<List<RouterVo>> getRouters () { public Result getRouters () {
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId); List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
return Result.success(menuService.buildMenus(menus)); return Result.success(menuService.buildMenus(menus));

View File

@ -4,7 +4,6 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.Result; import com.ruoyi.common.core.domain.Result;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.resp.RoleMenuTreeResp; import com.ruoyi.common.core.domain.resp.RoleMenuTreeResp;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
@ -33,9 +32,9 @@ public class SysMenuController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:menu:list')") @PreAuthorize("@ss.hasPermi('system:menu:list')")
@GetMapping("/list") @GetMapping("/list")
public Result<List<SysMenu>> list (SysMenu menu) { public Result list (SysMenu menu) {
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return Result.success(menus); return success(menus);
} }
/** /**
@ -43,24 +42,24 @@ public class SysMenuController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:menu:query')") @PreAuthorize("@ss.hasPermi('system:menu:query')")
@GetMapping(value = "/{menuId}") @GetMapping(value = "/{menuId}")
public Result<SysMenu> getInfo (@PathVariable Long menuId) { public Result getInfo (@PathVariable Long menuId) {
return Result.success(menuService.selectMenuById(menuId)); return success(menuService.selectMenuById(menuId));
} }
/** /**
* *
*/ */
@GetMapping("/treeselect") @GetMapping("/treeselect")
public Result<List<TreeSelect>> treeselect (SysMenu menu) { public Result treeselect (SysMenu menu) {
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return Result.success(menuService.buildMenuTreeSelect(menus)); return success(menuService.buildMenuTreeSelect(menus));
} }
/** /**
* *
*/ */
@GetMapping(value = "/roleMenuTreeselect/{roleId}") @GetMapping(value = "/roleMenuTreeselect/{roleId}")
public Result<RoleMenuTreeResp> roleMenuTreeselect (@PathVariable("roleId") Long roleId) { public Result roleMenuTreeselect (@PathVariable("roleId") Long roleId) {
List<SysMenu> menus = menuService.selectMenuList(getUserId()); List<SysMenu> menus = menuService.selectMenuList(getUserId());
return Result.success( return Result.success(
RoleMenuTreeResp.builder() RoleMenuTreeResp.builder()
@ -76,7 +75,7 @@ public class SysMenuController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:menu:add')") @PreAuthorize("@ss.hasPermi('system:menu:add')")
@Log(title = "菜单管理", businessType = BusinessType.INSERT) @Log(title = "菜单管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public Result<String> add (@Validated @RequestBody SysMenu menu) { public Result add (@Validated @RequestBody SysMenu menu) {
if (!menuService.checkMenuNameUnique(menu)) { if (!menuService.checkMenuNameUnique(menu)) {
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); return 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())) {
@ -92,7 +91,7 @@ public class SysMenuController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:menu:edit')") @PreAuthorize("@ss.hasPermi('system:menu:edit')")
@Log(title = "菜单管理", businessType = BusinessType.UPDATE) @Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public Result<String> edit (@Validated @RequestBody SysMenu menu) { public Result edit (@Validated @RequestBody SysMenu menu) {
if (!menuService.checkMenuNameUnique(menu)) { if (!menuService.checkMenuNameUnique(menu)) {
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); return 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())) {
@ -110,7 +109,7 @@ public class SysMenuController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:menu:remove')") @PreAuthorize("@ss.hasPermi('system:menu:remove')")
@Log(title = "菜单管理", businessType = BusinessType.DELETE) @Log(title = "菜单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{menuId}") @DeleteMapping("/{menuId}")
public Result<String> remove (@PathVariable("menuId") Long menuId) { public Result remove (@PathVariable("menuId") Long menuId) {
if (menuService.hasChildByMenuId(menuId)) { if (menuService.hasChildByMenuId(menuId)) {
return warn("存在子菜单,不允许删除"); return warn("存在子菜单,不允许删除");
} }

View File

@ -30,7 +30,7 @@ public class SysNoticeController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:notice:list')") @PreAuthorize("@ss.hasPermi('system:notice:list')")
@GetMapping("/list") @GetMapping("/list")
public Result<TableDataInfo<SysNotice>> list (SysNotice notice) { public Result<TableDataInfo> list (SysNotice notice) {
startPage(); startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice); List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list); return getDataTable(list);
@ -41,8 +41,8 @@ public class SysNoticeController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:notice:query')") @PreAuthorize("@ss.hasPermi('system:notice:query')")
@GetMapping(value = "/{noticeId}") @GetMapping(value = "/{noticeId}")
public Result<SysNotice> getInfo (@PathVariable Long noticeId) { public Result getInfo (@PathVariable Long noticeId) {
return Result.success(noticeService.selectNoticeById(noticeId)); return success(noticeService.selectNoticeById(noticeId));
} }
/** /**
@ -51,7 +51,7 @@ public class SysNoticeController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:notice:add')") @PreAuthorize("@ss.hasPermi('system:notice:add')")
@Log(title = "通知公告", businessType = BusinessType.INSERT) @Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public Result<String> add (@Validated @RequestBody SysNotice notice) { public Result add (@Validated @RequestBody SysNotice notice) {
notice.setCreateBy(getUserId()); notice.setCreateBy(getUserId());
return toAjax(noticeService.insertNotice(notice)); return toAjax(noticeService.insertNotice(notice));
} }
@ -62,7 +62,7 @@ public class SysNoticeController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:notice:edit')") @PreAuthorize("@ss.hasPermi('system:notice:edit')")
@Log(title = "通知公告", businessType = BusinessType.UPDATE) @Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public Result<String> edit (@Validated @RequestBody SysNotice notice) { public Result edit (@Validated @RequestBody SysNotice notice) {
notice.setUpdateBy(getUserId()); notice.setUpdateBy(getUserId());
return toAjax(noticeService.updateNotice(notice)); return toAjax(noticeService.updateNotice(notice));
} }
@ -73,7 +73,7 @@ public class SysNoticeController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:notice:remove')") @PreAuthorize("@ss.hasPermi('system:notice:remove')")
@Log(title = "通知公告", businessType = BusinessType.DELETE) @Log(title = "通知公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}") @DeleteMapping("/{noticeIds}")
public Result<String> remove (@PathVariable Long[] noticeIds) { public Result remove (@PathVariable Long[] noticeIds) {
return toAjax(noticeService.deleteNoticeByIds(noticeIds)); return toAjax(noticeService.deleteNoticeByIds(noticeIds));
} }
} }

View File

@ -32,7 +32,7 @@ public class SysPostController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:post:list')") @PreAuthorize("@ss.hasPermi('system:post:list')")
@GetMapping("/list") @GetMapping("/list")
public Result<TableDataInfo<SysPost>> list (SysPost post) { public Result<TableDataInfo> list (SysPost post) {
startPage(); startPage();
List<SysPost> list = postService.selectPostList(post); List<SysPost> list = postService.selectPostList(post);
return getDataTable(list); return getDataTable(list);
@ -52,8 +52,8 @@ public class SysPostController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:post:query')") @PreAuthorize("@ss.hasPermi('system:post:query')")
@GetMapping(value = "/{postId}") @GetMapping(value = "/{postId}")
public Result<SysPost> getInfo (@PathVariable Long postId) { public Result getInfo (@PathVariable Long postId) {
return Result.success(postService.selectPostById(postId)); return success(postService.selectPostById(postId));
} }
/** /**
@ -62,7 +62,7 @@ public class SysPostController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:post:add')") @PreAuthorize("@ss.hasPermi('system:post:add')")
@Log(title = "岗位管理", businessType = BusinessType.INSERT) @Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public Result<String> add (@Validated @RequestBody SysPost post) { public Result add (@Validated @RequestBody SysPost post) {
if (!postService.checkPostNameUnique(post)) { if (!postService.checkPostNameUnique(post)) {
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
} else if (!postService.checkPostCodeUnique(post)) { } else if (!postService.checkPostCodeUnique(post)) {
@ -78,7 +78,7 @@ public class SysPostController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:post:edit')") @PreAuthorize("@ss.hasPermi('system:post:edit')")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE) @Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public Result<String> edit (@Validated @RequestBody SysPost post) { public Result edit (@Validated @RequestBody SysPost post) {
if (!postService.checkPostNameUnique(post)) { if (!postService.checkPostNameUnique(post)) {
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
} else if (!postService.checkPostCodeUnique(post)) { } else if (!postService.checkPostCodeUnique(post)) {
@ -94,7 +94,7 @@ public class SysPostController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:post:remove')") @PreAuthorize("@ss.hasPermi('system:post:remove')")
@Log(title = "岗位管理", businessType = BusinessType.DELETE) @Log(title = "岗位管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{postIds}") @DeleteMapping("/{postIds}")
public Result<String> remove (@PathVariable Long[] postIds) { public Result remove (@PathVariable Long[] postIds) {
return toAjax(postService.deletePostByIds(postIds)); return toAjax(postService.deletePostByIds(postIds));
} }
@ -102,8 +102,8 @@ public class SysPostController extends BaseController {
* *
*/ */
@GetMapping("/optionselect") @GetMapping("/optionselect")
public Result<List<SysPost>> optionselect () { public Result optionselect () {
List<SysPost> posts = postService.selectPostAll(); List<SysPost> posts = postService.selectPostAll();
return Result.success(posts); return success(posts);
} }
} }

View File

@ -36,7 +36,7 @@ public class SysProfileController extends BaseController {
* *
*/ */
@GetMapping @GetMapping
public Result<ProfileResp> profile () { public Result profile () {
LoginUser loginUser = getLoginUser(); LoginUser loginUser = getLoginUser();
SysUser user = loginUser.getUser(); SysUser user = loginUser.getUser();
return Result.success( return Result.success(
@ -53,7 +53,7 @@ public class SysProfileController extends BaseController {
*/ */
@Log(title = "个人信息", businessType = BusinessType.UPDATE) @Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public Result<String> updateProfile (@RequestBody SysUser user) { public Result updateProfile (@RequestBody SysUser user) {
LoginUser loginUser = getLoginUser(); LoginUser loginUser = getLoginUser();
SysUser currentUser = loginUser.getUser(); SysUser currentUser = loginUser.getUser();
currentUser.setNickName(user.getNickName()); currentUser.setNickName(user.getNickName());
@ -69,7 +69,7 @@ public class SysProfileController extends BaseController {
if (userService.updateUserProfile(currentUser) > 0) { if (userService.updateUserProfile(currentUser) > 0) {
// 更新缓存用户信息 // 更新缓存用户信息
tokenService.setLoginUser(loginUser); tokenService.setLoginUser(loginUser);
return Result.success(); return success();
} }
return error("修改个人信息异常,请联系管理员"); return error("修改个人信息异常,请联系管理员");
} }
@ -79,7 +79,7 @@ public class SysProfileController extends BaseController {
*/ */
@Log(title = "个人信息", businessType = BusinessType.UPDATE) @Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd") @PutMapping("/updatePwd")
public Result<String> updatePwd (String oldPassword, String newPassword) { public Result updatePwd (String oldPassword, String newPassword) {
LoginUser loginUser = getLoginUser(); LoginUser loginUser = getLoginUser();
String userName = loginUser.getUsername(); String userName = loginUser.getUsername();
String password = loginUser.getPassword(); String password = loginUser.getPassword();
@ -93,7 +93,7 @@ public class SysProfileController extends BaseController {
// 更新缓存用户密码 // 更新缓存用户密码
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword)); loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
tokenService.setLoginUser(loginUser); tokenService.setLoginUser(loginUser);
return Result.success(); return success();
} }
return error("修改密码异常,请联系管理员"); return error("修改密码异常,请联系管理员");
} }
@ -103,7 +103,7 @@ public class SysProfileController extends BaseController {
*/ */
@Log(title = "用户头像", businessType = BusinessType.UPDATE) @Log(title = "用户头像", businessType = BusinessType.UPDATE)
@PostMapping("/avatar") @PostMapping("/avatar")
public Result<String> avatar (@RequestParam("avatarfile") MultipartFile file) throws Exception { public Result avatar (@RequestParam("avatarfile") MultipartFile file) throws Exception {
if (!file.isEmpty()) { if (!file.isEmpty()) {
LoginUser loginUser = getLoginUser(); LoginUser loginUser = getLoginUser();
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION); String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);

View File

@ -25,7 +25,7 @@ public class SysRegisterController extends BaseController {
private SysConfigServic configService; private SysConfigServic configService;
@PostMapping("/register") @PostMapping("/register")
public Result<String> register (@RequestBody RegisterBody user) { public Result register (@RequestBody RegisterBody user) {
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) { if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
return error("当前系统没有开启注册功能!"); return error("当前系统没有开启注册功能!");
} }

View File

@ -51,7 +51,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:list')") @PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/list") @GetMapping("/list")
public Result<TableDataInfo<SysRole>> list (SysRole role) { public Result<TableDataInfo> list (SysRole role) {
startPage(); startPage();
List<SysRole> list = roleService.selectRoleList(role); List<SysRole> list = roleService.selectRoleList(role);
return getDataTable(list); return getDataTable(list);
@ -71,9 +71,9 @@ public class SysRoleController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:role:query')") @PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping(value = "/{roleId}") @GetMapping(value = "/{roleId}")
public Result<SysRole> getInfo (@PathVariable Long roleId) { public Result getInfo (@PathVariable Long roleId) {
roleService.checkRoleDataScope(roleId); roleService.checkRoleDataScope(roleId);
return Result.success(roleService.selectRoleById(roleId)); return success(roleService.selectRoleById(roleId));
} }
/** /**
@ -82,7 +82,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:add')") @PreAuthorize("@ss.hasPermi('system:role:add')")
@Log(title = "角色管理", businessType = BusinessType.INSERT) @Log(title = "角色管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public Result<String> add (@Validated @RequestBody SysRole role) { public Result add (@Validated @RequestBody SysRole role) {
if (!roleService.checkRoleNameUnique(role)) { if (!roleService.checkRoleNameUnique(role)) {
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
} else if (!roleService.checkRoleKeyUnique(role)) { } else if (!roleService.checkRoleKeyUnique(role)) {
@ -99,7 +99,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:edit')") @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE) @Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public Result<String> edit (@Validated @RequestBody SysRole role) { public Result edit (@Validated @RequestBody SysRole role) {
roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId()); roleService.checkRoleDataScope(role.getRoleId());
if (!roleService.checkRoleNameUnique(role)) { if (!roleService.checkRoleNameUnique(role)) {
@ -117,7 +117,7 @@ public class SysRoleController extends BaseController {
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
tokenService.setLoginUser(loginUser); tokenService.setLoginUser(loginUser);
} }
return Result.success(); return success();
} }
return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员"); return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
} }
@ -128,7 +128,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:edit')") @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE) @Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/dataScope") @PutMapping("/dataScope")
public Result<String> dataScope (@RequestBody SysRole role) { public Result dataScope (@RequestBody SysRole role) {
roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId()); roleService.checkRoleDataScope(role.getRoleId());
return toAjax(roleService.authDataScope(role)); return toAjax(roleService.authDataScope(role));
@ -140,7 +140,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:edit')") @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE) @Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus") @PutMapping("/changeStatus")
public Result<String> changeStatus (@RequestBody SysRole role) { public Result changeStatus (@RequestBody SysRole role) {
roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId()); roleService.checkRoleDataScope(role.getRoleId());
role.setUpdateBy(getUserId()); role.setUpdateBy(getUserId());
@ -153,7 +153,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:remove')") @PreAuthorize("@ss.hasPermi('system:role:remove')")
@Log(title = "角色管理", businessType = BusinessType.DELETE) @Log(title = "角色管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{roleIds}") @DeleteMapping("/{roleIds}")
public Result<String> remove (@PathVariable Long[] roleIds) { public Result remove (@PathVariable Long[] roleIds) {
return toAjax(roleService.deleteRoleByIds(roleIds)); return toAjax(roleService.deleteRoleByIds(roleIds));
} }
@ -162,8 +162,8 @@ public class SysRoleController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:role:query')") @PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping("/optionselect") @GetMapping("/optionselect")
public Result<List<SysRole>> optionselect () { public Result optionselect () {
return Result.success(roleService.selectRoleAll()); return success(roleService.selectRoleAll());
} }
/** /**
@ -171,7 +171,7 @@ public class SysRoleController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:role:list')") @PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/authUser/allocatedList") @GetMapping("/authUser/allocatedList")
public Result<TableDataInfo<SysUser>> allocatedList (SysUser user) { public Result<TableDataInfo> allocatedList (SysUser user) {
startPage(); startPage();
List<SysUser> list = userService.selectAllocatedList(user); List<SysUser> list = userService.selectAllocatedList(user);
return getDataTable(list); return getDataTable(list);
@ -182,7 +182,7 @@ public class SysRoleController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:role:list')") @PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/authUser/unallocatedList") @GetMapping("/authUser/unallocatedList")
public Result<TableDataInfo<SysUser>> unallocatedList (SysUser user) { public Result<TableDataInfo> unallocatedList (SysUser user) {
startPage(); startPage();
List<SysUser> list = userService.selectUnallocatedList(user); List<SysUser> list = userService.selectUnallocatedList(user);
return getDataTable(list); return getDataTable(list);
@ -194,7 +194,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:edit')") @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT) @Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancel") @PutMapping("/authUser/cancel")
public Result<String> cancelAuthUser (@RequestBody SysUserRole userRole) { public Result cancelAuthUser (@RequestBody SysUserRole userRole) {
return toAjax(roleService.deleteAuthUser(userRole)); return toAjax(roleService.deleteAuthUser(userRole));
} }
@ -204,7 +204,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:edit')") @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT) @Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancelAll") @PutMapping("/authUser/cancelAll")
public Result<String> cancelAuthUserAll (Long roleId, Long[] userIds) { public Result cancelAuthUserAll (Long roleId, Long[] userIds) {
return toAjax(roleService.deleteAuthUsers(roleId, userIds)); return toAjax(roleService.deleteAuthUsers(roleId, userIds));
} }
@ -214,7 +214,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:edit')") @PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT) @Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/selectAll") @PutMapping("/authUser/selectAll")
public Result<String> selectAuthUserAll (Long roleId, Long[] userIds) { public Result selectAuthUserAll (Long roleId, Long[] userIds) {
roleService.checkRoleDataScope(roleId); roleService.checkRoleDataScope(roleId);
return toAjax(roleService.insertAuthUsers(roleId, userIds)); return toAjax(roleService.insertAuthUsers(roleId, userIds));
} }
@ -224,7 +224,7 @@ public class SysRoleController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:role:query')") @PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping(value = "/deptTree/{roleId}") @GetMapping(value = "/deptTree/{roleId}")
public Result<DeptTreeResp> deptTree (@PathVariable("roleId") Long roleId) { public Result deptTree (@PathVariable("roleId") Long roleId) {
return Result.success( return Result.success(
DeptTreeResp.builder() DeptTreeResp.builder()
.checkedKeys(deptService.selectDeptListByRoleId(roleId)) .checkedKeys(deptService.selectDeptListByRoleId(roleId))

View File

@ -3,13 +3,11 @@ package com.ruoyi.web.controller.system;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.Result; import com.ruoyi.common.core.domain.Result;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.resp.AuthRoleResp; import com.ruoyi.common.core.domain.resp.AuthRoleResp;
import com.ruoyi.common.core.domain.resp.UserDetailInfoResp; import com.ruoyi.common.core.domain.resp.UserDetailInfoResp;
import com.ruoyi.common.core.domain.resp.UserDetailInfoResp.UserDetailInfoRespBuilder;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
@ -55,7 +53,7 @@ public class SysUserController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:user:list')") @PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list") @GetMapping("/list")
public Result<TableDataInfo<SysUser>> list (SysUser user) { public Result<TableDataInfo> list (SysUser user) {
startPage(); startPage();
List<SysUser> list = userService.selectUserList(user); List<SysUser> list = userService.selectUserList(user);
return getDataTable(list); return getDataTable(list);
@ -73,12 +71,12 @@ public class SysUserController extends BaseController {
@Log(title = "用户管理", businessType = BusinessType.IMPORT) @Log(title = "用户管理", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:user:import')") @PreAuthorize("@ss.hasPermi('system:user:import')")
@PostMapping("/importData") @PostMapping("/importData")
public Result<String> importData (MultipartFile file, boolean updateSupport) throws Exception { public Result importData (MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
List<SysUser> userList = util.importExcel(file.getInputStream()); List<SysUser> userList = util.importExcel(file.getInputStream());
Long userId = getUserId(); Long userId = getUserId();
String message = userService.importUser(userList, updateSupport, userId); String message = userService.importUser(userList, updateSupport, userId);
return Result.success(message); return success(message);
} }
@PostMapping("/importTemplate") @PostMapping("/importTemplate")
@ -92,10 +90,11 @@ public class SysUserController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:user:query')") @PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping(value = {"/", "/{userId}"}) @GetMapping(value = {"/", "/{userId}"})
public Result<UserDetailInfoResp> getInfo (@PathVariable(value = "userId", required = false) Long userId) { public Result getInfo (@PathVariable(value = "userId", required = false) Long userId) {
userService.checkUserDataScope(userId); userService.checkUserDataScope(userId);
Result ajax = Result.success();
List<SysRole> roles = roleService.selectRoleAll(); List<SysRole> roles = roleService.selectRoleAll();
UserDetailInfoRespBuilder builder = UserDetailInfoResp.builder() UserDetailInfoResp.UserDetailInfoRespBuilder builder = UserDetailInfoResp.builder()
.roles(SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())) .roles(SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()))
.posts(postService.selectPostAll()); .posts(postService.selectPostAll());
if (StringUtils.isNotNull(userId)) { if (StringUtils.isNotNull(userId)) {
@ -115,7 +114,7 @@ public class SysUserController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:user:add')") @PreAuthorize("@ss.hasPermi('system:user:add')")
@Log(title = "用户管理", businessType = BusinessType.INSERT) @Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public Result<String> add (@Validated @RequestBody SysUser user) { public Result add (@Validated @RequestBody SysUser user) {
if (!userService.checkUserNameUnique(user)) { if (!userService.checkUserNameUnique(user)) {
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
@ -134,7 +133,7 @@ public class SysUserController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:user:edit')") @PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public Result<String> edit (@Validated @RequestBody SysUser user) { public Result edit (@Validated @RequestBody SysUser user) {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId()); userService.checkUserDataScope(user.getUserId());
if (!userService.checkUserNameUnique(user)) { if (!userService.checkUserNameUnique(user)) {
@ -154,7 +153,7 @@ public class SysUserController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:user:remove')") @PreAuthorize("@ss.hasPermi('system:user:remove')")
@Log(title = "用户管理", businessType = BusinessType.DELETE) @Log(title = "用户管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}") @DeleteMapping("/{userIds}")
public Result<String> remove (@PathVariable Long[] userIds) { public Result remove (@PathVariable Long[] userIds) {
if (ArrayUtils.contains(userIds, getUserId())) { if (ArrayUtils.contains(userIds, getUserId())) {
return error("当前用户不能删除"); return error("当前用户不能删除");
} }
@ -167,7 +166,7 @@ public class SysUserController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')") @PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/resetPwd") @PutMapping("/resetPwd")
public Result<String> resetPwd (@RequestBody SysUser user) { public Result resetPwd (@RequestBody SysUser user) {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId()); userService.checkUserDataScope(user.getUserId());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
@ -181,7 +180,7 @@ public class SysUserController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:user:edit')") @PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus") @PutMapping("/changeStatus")
public Result<String> changeStatus (@RequestBody SysUser user) { public Result changeStatus (@RequestBody SysUser user) {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId()); userService.checkUserDataScope(user.getUserId());
user.setUpdateBy(getUserId()); user.setUpdateBy(getUserId());
@ -193,7 +192,7 @@ public class SysUserController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:user:query')") @PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping("/authRole/{userId}") @GetMapping("/authRole/{userId}")
public Result<AuthRoleResp> authRole (@PathVariable("userId") Long userId) { public Result authRole (@PathVariable("userId") Long userId) {
SysUser user = userService.selectUserById(userId); SysUser user = userService.selectUserById(userId);
List<SysRole> roles = roleService.selectRolesByUserId(userId); List<SysRole> roles = roleService.selectRolesByUserId(userId);
return Result.success( return Result.success(
@ -210,10 +209,10 @@ public class SysUserController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:user:edit')") @PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.GRANT) @Log(title = "用户管理", businessType = BusinessType.GRANT)
@PutMapping("/authRole") @PutMapping("/authRole")
public Result<String> insertAuthRole (Long userId, Long[] roleIds) { public Result insertAuthRole (Long userId, Long[] roleIds) {
userService.checkUserDataScope(userId); userService.checkUserDataScope(userId);
userService.insertUserAuth(userId, roleIds); userService.insertUserAuth(userId, roleIds);
return Result.success(); return success();
} }
/** /**
@ -221,7 +220,7 @@ public class SysUserController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:user:list')") @PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/deptTree") @GetMapping("/deptTree")
public Result<List<TreeSelect>> deptTree (SysDept dept) { public Result deptTree (SysDept dept) {
return Result.success(deptService.selectDeptTreeList(dept)); return success(deptService.selectDeptTreeList(dept));
} }
} }

View File

@ -16,7 +16,7 @@ import java.util.Map;
* *
* @author ruoyi * @author ruoyi
*/ */
@Api(tags = "用户信息管理") @Api("用户信息管理")
@RestController @RestController
@RequestMapping("/test/user") @RequestMapping("/test/user")
public class TestController extends BaseController { public class TestController extends BaseController {

View File

@ -1,111 +0,0 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.*;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
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.Result;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysClazz;
import com.ruoyi.system.domain.req.SysClazzQueryReq;
import com.ruoyi.system.domain.req.SysClazzSaveReq;
import com.ruoyi.system.domain.req.SysClazzEditReq;
import com.ruoyi.system.service.SysClazzService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2024-04-22
*/
@Api(tags = "班级")
@RestController
@RequestMapping("/system/clazz")
public class SysClazzController extends BaseController {
@Autowired
private SysClazzService sysClazzService;
/**
*
*/
@ApiOperation("获取班级列表")
@PreAuthorize("@ss.hasPermi('system:clazz:list')")
@GetMapping("/list")
public Result<TableDataInfo<SysClazz>> list(SysClazzQueryReq sysClazzQueryReq) {
startPage();
List<SysClazz> list = sysClazzService.list(SysClazz.queryBuild(sysClazzQueryReq));
return getDataTable(list);
}
/**
*
*/
@ApiOperation("导出班级列表")
@PreAuthorize("@ss.hasPermi('system:clazz:export')")
@Log(title = "班级", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysClazz sysClazz) {
List<SysClazz> list = sysClazzService.list(sysClazz);
ExcelUtil<SysClazz> util = new ExcelUtil<SysClazz>(SysClazz.class);
util.exportExcel(response, list, "班级数据");
}
/**
*
*/
@ApiOperation("获取班级详细信息")
@PreAuthorize("@ss.hasPermi('system:clazz:query')")
@GetMapping(value = "/{clazzId}")
@ApiImplicitParam(name = "clazzId", value = "clazzId", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
public Result<SysClazz> getInfo(@PathVariable("clazzId") Long clazzId) {
return Result.success(sysClazzService.getById(clazzId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:clazz:add')")
@Log(title = "班级", businessType = BusinessType.INSERT)
@PostMapping
@ApiOperation("新增班级")
public Result<String> add(@RequestBody SysClazzSaveReq sysClazzSaveReq) {
return toAjax(sysClazzService.save(SysClazz.saveBuild(sysClazzSaveReq)));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:clazz:edit')")
@Log(title = "班级", businessType = BusinessType.UPDATE)
@PutMapping("/{clazzId}")
@ApiOperation("修改班级")
public Result<String> edit(@PathVariable Long clazzId, @RequestBody SysClazzEditReq sysClazzEditReq) {
return toAjax(sysClazzService.updateById(SysClazz.editBuild(clazzId,sysClazzEditReq)));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:clazz:remove')")
@Log(title = "班级", businessType = BusinessType.DELETE)
@DeleteMapping("/{clazzIds}")
@ApiOperation("删除班级")
@ApiImplicitParam(name = "clazzId", value = "clazzId", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
public Result<String> remove(@PathVariable List<Long> clazzIds) {
return toAjax(sysClazzService.removeBatchByIds(clazzIds));
}
}

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.muyu</groupId>
<artifactId>ruoyi</artifactId>
<version>3.8.6</version>
</parent>
<artifactId>ruoyi-basic</artifactId>
<packaging>pom</packaging>
<modules>
<module>ruoyi-plugin</module>
<module>ruoyi-framework</module>
<module>ruoyi-system</module>
<module>ruoyi-common</module>
</modules>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.muyu</groupId>
<artifactId>ruoyi-basic</artifactId>
<version>3.8.6</version>
</parent>
<description>plugin-系统插件</description>
<packaging>pom</packaging>
<artifactId>ruoyi-plugin</artifactId>
<modules>
<module>ruoyi-quartz</module>
<module>ruoyi-generator</module>
</modules>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -1,81 +0,0 @@
package com.ruoyi.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder;
import io.swagger.annotations.*;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.system.domain.req.SysClazzQueryReq;
import com.ruoyi.system.domain.req.SysClazzSaveReq;
import com.ruoyi.system.domain.req.SysClazzEditReq;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* sys_clazz
*
* @author ruoyi
* @date 2024-04-22
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName("sys_clazz")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "SysClazz", description = "班级")
public class SysClazz extends BaseEntity {
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@TableId(value = "clazz_id",type = IdType.AUTO)
@ApiModelProperty(name = "${column.columnComment}", value = "${column.columnComment}")
private Long clazzId;
/** 班级名称 */
@Excel(name = "班级名称")
@ApiModelProperty(name = "班级名称", value = "班级名称")
private String clazzName;
/** 班级状态 */
@Excel(name = "班级状态")
@ApiModelProperty(name = "班级状态", value = "班级状态")
private Long clazzState;
/**
*
*/
public static SysClazz queryBuild( SysClazzQueryReq sysClazzQueryReq){
return SysClazz.builder()
.clazzName(sysClazzQueryReq.getClazzName())
.clazzState(sysClazzQueryReq.getClazzState())
.build();
}
/**
*
*/
public static SysClazz saveBuild(SysClazzSaveReq sysClazzSaveReq){
return SysClazz.builder()
.clazzName(sysClazzSaveReq.getClazzName())
.clazzState(sysClazzSaveReq.getClazzState())
.build();
}
/**
*
*/
public static SysClazz editBuild(Long clazzId, SysClazzEditReq sysClazzEditReq){
return SysClazz.builder()
.clazzId(clazzId)
.clazzName(sysClazzEditReq.getClazzName())
.clazzState(sysClazzEditReq.getClazzState())
.build();
}
}

View File

@ -1,37 +0,0 @@
package com.ruoyi.system.domain.req;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder;
import io.swagger.annotations.*;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* sys_clazz
*
* @author ruoyi
* @date 2024-04-22
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "SysClazzEditReq", description = "班级")
public class SysClazzEditReq extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 班级名称 */
@ApiModelProperty(name = "班级名称", value = "班级名称")
private String clazzName;
/** 班级状态 */
@ApiModelProperty(name = "班级状态", value = "班级状态")
private Long clazzState;
}

View File

@ -1,37 +0,0 @@
package com.ruoyi.system.domain.req;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder;
import io.swagger.annotations.*;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* sys_clazz
*
* @author ruoyi
* @date 2024-04-22
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "SysClazzQueryReq", description = "班级")
public class SysClazzQueryReq extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 班级名称 */
@ApiModelProperty(name = "班级名称", value = "班级名称")
private String clazzName;
/** 班级状态 */
@ApiModelProperty(name = "班级状态", value = "班级状态")
private Long clazzState;
}

View File

@ -1,44 +0,0 @@
package com.ruoyi.system.domain.req;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder;
import io.swagger.annotations.*;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* sys_clazz
*
* @author ruoyi
* @date 2024-04-22
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "SysClazzSaveReq", description = "班级")
public class SysClazzSaveReq extends BaseEntity {
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@ApiModelProperty(name = "${column.columnComment}", value = "${column.columnComment}")
private Long clazzId;
/** 班级名称 */
@ApiModelProperty(name = "班级名称", value = "班级名称")
private String clazzName;
/** 班级状态 */
@ApiModelProperty(name = "班级状态", value = "班级状态")
private Long clazzState;
}

View File

@ -1,15 +0,0 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.SysClazz;
/**
* Mapper
*
* @author ruoyi
* @date 2024-04-22
*/
public interface SysClazzMapper extends BaseMapper<SysClazz> {
}

View File

@ -1,22 +0,0 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.SysClazz;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* Service
*
* @author ruoyi
* @date 2024-04-22
*/
public interface SysClazzService extends IService<SysClazz> {
/**
*
*
* @param sysClazz
* @return
*/
public List<SysClazz> list(SysClazz sysClazz);
}

View File

@ -1,44 +0,0 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.ObjUtils;
import com.ruoyi.system.mapper.SysClazzMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.ruoyi.system.domain.SysClazz;
import com.ruoyi.system.service.SysClazzService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
/**
* Service
*
* @author ruoyi
* @date 2024-04-22
*/
@Slf4j
@Service
public class SysClazzServiceImpl extends ServiceImpl<SysClazzMapper, SysClazz> implements SysClazzService {
/**
*
*
* @param sysClazz
* @return
*/
@Override
public List<SysClazz> list(SysClazz sysClazz) {
LambdaQueryWrapper<SysClazz> queryWrapper = new LambdaQueryWrapper<>();
if (ObjUtils.notNull(sysClazz.getClazzName())){
queryWrapper.like(SysClazz::getClazzName, sysClazz.getClazzName());
}
if (ObjUtils.notNull(sysClazz.getClazzState())){
queryWrapper.eq(SysClazz::getClazzState, sysClazz.getClazzState());
}
return list(queryWrapper);
}
}

View File

@ -3,8 +3,8 @@
xmlns="http://maven.apache.org/POM/4.0.0" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>ruoyi-basic</artifactId> <artifactId>ruoyi</artifactId>
<groupId>com.muyu</groupId> <groupId>com.ruoyi</groupId>
<version>3.8.6</version> <version>3.8.6</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -154,18 +154,7 @@ public @interface Excel {
Type type () default Type.ALL; Type type () default Type.ALL;
public enum Type { public enum Type {
/** ALL(0), EXPORT(1), IMPORT(2);
*
*/
ALL(0),
/**
*
*/
EXPORT(1),
/**
*
*/
IMPORT(2);
private final int value; private final int value;
Type (int value) { Type (int value) {
@ -178,37 +167,13 @@ public @interface Excel {
} }
public enum ColumnType { public enum ColumnType {
/** NUMERIC(0), STRING(1), IMAGE(2);
*
*/
NUMERIC(0),
/**
*
*/
STRING(1),
/**
*
*/
IMAGE(2);
/**
*
*/
private final int value; private final int value;
/**
*
* @param value
*/
ColumnType (int value) { ColumnType (int value) {
this.value = value; this.value = value;
} }
/**
*
* @return
*/
public int value () { public int value () {
return this.value; return this.value;
} }

View File

@ -16,6 +16,11 @@ public class GenConstants {
*/ */
public static final String TPL_TREE = "tree"; public static final String TPL_TREE = "tree";
/**
*
*/
public static final String TPL_SUB = "sub";
/** /**
* *
*/ */

View File

@ -12,7 +12,6 @@ import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.sql.SqlUtil; import com.ruoyi.common.utils.sql.SqlUtil;
import org.apache.poi.ss.formula.functions.T;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.WebDataBinder;
@ -73,9 +72,9 @@ public class BaseController {
* *
*/ */
@SuppressWarnings({"rawtypes", "unchecked"}) @SuppressWarnings({"rawtypes", "unchecked"})
protected <T> Result<TableDataInfo<T>> getDataTable (List<T> list) { protected Result<TableDataInfo> getDataTable (List<?> list) {
return Result.success( return Result.success(
TableDataInfo.<T>builder() TableDataInfo.builder()
.total(new PageInfo(list).getTotal()) .total(new PageInfo(list).getTotal())
.rows(list) .rows(list)
.build() .build()
@ -96,18 +95,31 @@ public class BaseController {
return Result.error(); return Result.error();
} }
/**
*
*/
public Result success (String message) {
return Result.success(message);
}
/**
*
*/
public Result success (Object data) {
return Result.success(data);
}
/** /**
* *
*/ */
public Result<String> error (String message) { public Result error (String message) {
return Result.error(message); return Result.error(message);
} }
/** /**
* *
*/ */
public Result<String> warn (String message) { public Result warn (String message) {
return Result.warn(message); return Result.warn(message);
} }
@ -118,7 +130,7 @@ public class BaseController {
* *
* @return * @return
*/ */
protected Result<String> toAjax (int rows) { protected Result toAjax (int rows) {
return rows > 0 ? Result.success() : Result.error(); return rows > 0 ? Result.success() : Result.error();
} }

View File

@ -40,7 +40,7 @@ public class BaseEntity implements Serializable {
/** /**
* *
*/ */
@TableField(value = "create_by" , fill = FieldFill.INSERT,exist = false) @TableField(value = "create_by" , fill = FieldFill.INSERT)
@ApiModelProperty(hidden=true) @ApiModelProperty(hidden=true)
private Long createBy; private Long createBy;
@ -48,14 +48,14 @@ public class BaseEntity implements Serializable {
* *
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(value = "create_time" , fill = FieldFill.INSERT,exist = false) @TableField(value = "create_time" , fill = FieldFill.INSERT)
@ApiModelProperty(hidden=true) @ApiModelProperty(hidden=true)
private Date createTime; private Date createTime;
/** /**
* *
*/ */
@TableField(value = "update_by" , fill = FieldFill.UPDATE ,exist = false) @TableField(value = "update_by" , fill = FieldFill.UPDATE)
@ApiModelProperty(hidden=true) @ApiModelProperty(hidden=true)
private Long updateBy; private Long updateBy;
@ -63,7 +63,7 @@ public class BaseEntity implements Serializable {
* *
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(value = "update_time" , fill = FieldFill.UPDATE,exist = false) @TableField(value = "update_time" , fill = FieldFill.UPDATE)
@ApiModelProperty(hidden=true) @ApiModelProperty(hidden=true)
private Date updateTime; private Date updateTime;

View File

@ -17,7 +17,7 @@ import java.util.List;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class TableDataInfo<T> implements Serializable { public class TableDataInfo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
@ -28,7 +28,7 @@ public class TableDataInfo<T> implements Serializable {
/** /**
* *
*/ */
private List<T> rows; private List<?> rows;
} }

Some files were not shown because too many files have changed in this diff Show More