Compare commits

...

10 Commits

Author SHA1 Message Date
lijiayao 1d05647a73 初始化 2024-04-22 17:29:49 +08:00
DongZeLiang 22498a253d 增加pom描述 2024-03-23 15:12:22 +08:00
DongZeLiang 2f1728def8 结构细节更改 2024-03-18 11:59:52 +08:00
DongZeLiang e33185856c 整体项目结构更改 2024-03-18 09:45:41 +08:00
DongZeLiang 2d6f0a4f6f 修改了代码生成,没有引入类 2023-11-03 14:43:55 +08:00
DongZeLiang 12a1f4ac2a 移除多余sql文件脚本 2023-11-03 14:34:18 +08:00
dongzeliang dde64c7a0f 适配swagger接口文档,泛型进行添加 2023-10-23 15:05:06 +08:00
DongZeLiang 5b84a2fb17 移除主子表代码生成模块 2023-10-17 08:44:05 +08:00
dongzeliang d56b9c120c 代码生成器最终bug修复 2023-10-12 09:41:13 +08:00
dongzeliang 84f554d531 更新sql脚本 2023-10-11 22:07:39 +08:00
327 changed files with 842 additions and 871 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.ruoyi</groupId> <groupId>com.muyu</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>1.8</java.version> <java.version>17</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,7 +31,6 @@
<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>
<!-- 依赖声明 --> <!-- 依赖声明 -->
@ -54,13 +53,6 @@
<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>
@ -152,35 +144,35 @@
<!-- 定时任务--> <!-- 定时任务-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.muyu</groupId>
<artifactId>ruoyi-quartz</artifactId> <artifactId>ruoyi-quartz</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- 代码生成--> <!-- 代码生成-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.muyu</groupId>
<artifactId>ruoyi-generator</artifactId> <artifactId>ruoyi-generator</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- 核心模块--> <!-- 核心模块-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.muyu</groupId>
<artifactId>ruoyi-framework</artifactId> <artifactId>ruoyi-framework</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- 系统模块--> <!-- 系统模块-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.muyu</groupId>
<artifactId>ruoyi-system</artifactId> <artifactId>ruoyi-system</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- 通用工具--> <!-- 通用工具-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.muyu</groupId>
<artifactId>ruoyi-common</artifactId> <artifactId>ruoyi-common</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
@ -189,12 +181,8 @@
</dependencyManagement> </dependencyManagement>
<modules> <modules>
<module>ruoyi-admin</module> <module>ruoyi-application</module>
<module>ruoyi-framework</module> <module>ruoyi-basic</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.ruoyi</groupId> <groupId>com.muyu</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-admin</artifactId> <artifactId>ruoyi-application</artifactId>
<description> <description>
web服务入口 web服务入口
@ -54,25 +54,25 @@
<!-- Mysql驱动包 --> <!-- Mysql驱动包 -->
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>com.mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-j</artifactId>
</dependency> </dependency>
<!-- 核心模块--> <!-- 核心模块-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.muyu</groupId>
<artifactId>ruoyi-framework</artifactId> <artifactId>ruoyi-framework</artifactId>
</dependency> </dependency>
<!-- 定时任务--> <!-- 定时任务-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.muyu</groupId>
<artifactId>ruoyi-quartz</artifactId> <artifactId>ruoyi-quartz</artifactId>
</dependency> </dependency>
<!-- 代码生成--> <!-- 代码生成-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.muyu</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 uploadFile (MultipartFile file) throws Exception { public Result<UploadFileModel> 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 uploadFiles (List<MultipartFile> files) throws Exception { public Result<List<UploadFileModel>> 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 getInfo () throws Exception { public Result<Map<String, Object>> 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 cache () { public Result<List<SysCache>> 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 getCacheKeys (@PathVariable String cacheName) { public Result<Set<String>> 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 getCacheValue (@PathVariable String cacheName, @PathVariable String cacheKey) { public Result<SysCache> 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,24 +80,28 @@ public class CacheController {
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheName/{cacheName}") @DeleteMapping("/clearCacheName/{cacheName}")
public Result clearCacheName (@PathVariable String cacheName) { public Result<String> 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 clearCacheKey (@PathVariable String cacheKey) { public Result<String> 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 clearCacheAll () { public Result<String> 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 getInfo () throws Exception { public Result<Server> 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> list (SysLogininfor logininfor) { public Result<TableDataInfo<SysLogininfor>> 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 remove (@PathVariable Long[] infoIds) { public Result<String> 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 clean () { public Result<String> clean () {
logininforService.cleanLogininfor(); logininforService.cleanLogininfor();
return success(); return Result.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 unlock (@PathVariable("userName") String userName) { public Result<String> unlock (@PathVariable("userName") String userName) {
passwordService.clearLoginRecordCache(userName); passwordService.clearLoginRecordCache(userName);
return success(); return Result.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> list (SysOperLog operLog) { public Result<TableDataInfo<SysOperLog>> 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 remove (@PathVariable Long[] operIds) { public Result<String> 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 clean () { public Result<String> clean () {
operLogService.cleanOperLog(); operLogService.cleanOperLog();
return success(); return Result.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> list (String ipaddr, String userName) { public Result<TableDataInfo<SysUserOnline>> 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 forceLogout (@PathVariable String tokenId) { public Result<String> forceLogout (@PathVariable String tokenId) {
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId); redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
return success(); return Result.success();
} }
} }

View File

@ -0,0 +1,111 @@
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

@ -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> list (SysConfig config) { public Result<TableDataInfo<SysConfig>> 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 getInfo (@PathVariable Long configId) { public Result<SysConfig> getInfo (@PathVariable Long configId) {
return success(configService.selectConfigById(configId)); return Result.success(configService.selectConfigById(configId));
} }
/** /**
* *
*/ */
@GetMapping(value = "/configKey/{configKey}") @GetMapping(value = "/configKey/{configKey}")
public Result getConfigKey (@PathVariable String configKey) { public Result<String> getConfigKey (@PathVariable String configKey) {
return success(configService.selectConfigByKey(configKey)); return Result.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 add (@Validated @RequestBody SysConfig config) { public Result<String> 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 edit (@Validated @RequestBody SysConfig config) { public Result<String> 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 remove (@PathVariable Long[] configIds) { public Result<String> remove (@PathVariable Long[] configIds) {
configService.deleteConfigByIds(configIds); configService.deleteConfigByIds(configIds);
return success(); return Result.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 refreshCache () { public Result<String> refreshCache () {
configService.resetConfigCache(); configService.resetConfigCache();
return success(); return Result.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 dept) { public Result<List<SysDept>> list (SysDept dept) {
List<SysDept> depts = deptService.selectDeptList(dept); List<SysDept> depts = deptService.selectDeptList(dept);
return success(depts); return Result.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 excludeChild (@PathVariable(value = "deptId", required = false) Long deptId) { public Result<List<SysDept>> 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 success(depts); return Result.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 getInfo (@PathVariable Long deptId) { public Result<SysDept> getInfo (@PathVariable Long deptId) {
deptService.checkDeptDataScope(deptId); deptService.checkDeptDataScope(deptId);
return success(deptService.selectDeptById(deptId)); return Result.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 add (@Validated @RequestBody SysDept dept) { public Result<String> 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 edit (@Validated @RequestBody SysDept dept) { public Result<String> 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 remove (@PathVariable Long deptId) { public Result<String> 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> list (SysDictData dictData) { public Result<TableDataInfo<SysDictData>> 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 getInfo (@PathVariable Long dictCode) { public Result<SysDictData> getInfo (@PathVariable Long dictCode) {
return success(dictDataService.selectDictDataById(dictCode)); return Result.success(dictDataService.selectDictDataById(dictCode));
} }
/** /**
* *
*/ */
@GetMapping(value = "/type/{dictType}") @GetMapping(value = "/type/{dictType}")
public Result dictType (@PathVariable String dictType) { public Result<List<SysDictData>> 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 success(data); return Result.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 add (@Validated @RequestBody SysDictData dict) { public Result<String> 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 edit (@Validated @RequestBody SysDictData dict) { public Result<String> 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 remove (@PathVariable Long[] dictCodes) { public Result<String> remove (@PathVariable Long[] dictCodes) {
dictDataService.deleteDictDataByIds(dictCodes); dictDataService.deleteDictDataByIds(dictCodes);
return success(); return Result.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> list (SysDictType dictType) { public Result<TableDataInfo<SysDictType>> 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 getInfo (@PathVariable Long dictId) { public Result<SysDictType> getInfo (@PathVariable Long dictId) {
return success(dictTypeService.selectDictTypeById(dictId)); return Result.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 add (@Validated @RequestBody SysDictType dict) { public Result<String> 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 edit (@Validated @RequestBody SysDictType dict) { public Result<String> 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 remove (@PathVariable Long[] dictIds) { public Result<String> remove (@PathVariable Long[] dictIds) {
dictTypeService.deleteDictTypeByIds(dictIds); dictTypeService.deleteDictTypeByIds(dictIds);
return success(); return Result.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 refreshCache () { public Result<String> refreshCache () {
dictTypeService.resetDictCache(); dictTypeService.resetDictCache();
return success(); return Result.success();
} }
/** /**
* *
*/ */
@GetMapping("/optionselect") @GetMapping("/optionselect")
public Result optionselect () { public Result<List<SysDictType>> optionselect () {
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll(); List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
return success(dictTypes); return Result.success(dictTypes);
} }
} }

View File

@ -8,6 +8,7 @@ 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;
@ -42,7 +43,7 @@ public class SysLoginController {
* @return * @return
*/ */
@PostMapping("/login") @PostMapping("/login")
public Result login (@RequestBody LoginBody loginBody) { public Result<String> 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());
@ -55,7 +56,7 @@ public class SysLoginController {
* @return * @return
*/ */
@GetMapping("getInfo") @GetMapping("getInfo")
public Result getInfo () { public Result<UserInfoResp> getInfo () {
SysUser user = SecurityUtils.getLoginUser().getUser(); SysUser user = SecurityUtils.getLoginUser().getUser();
// 角色集合 // 角色集合
Set<String> roles = permissionService.getRolePermission(user); Set<String> roles = permissionService.getRolePermission(user);
@ -76,7 +77,7 @@ public class SysLoginController {
* @return * @return
*/ */
@GetMapping("getRouters") @GetMapping("getRouters")
public Result getRouters () { public Result<List<RouterVo>> 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,6 +4,7 @@ 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;
@ -32,9 +33,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 menu) { public Result<List<SysMenu>> list (SysMenu menu) {
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return success(menus); return Result.success(menus);
} }
/** /**
@ -42,24 +43,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 getInfo (@PathVariable Long menuId) { public Result<SysMenu> getInfo (@PathVariable Long menuId) {
return success(menuService.selectMenuById(menuId)); return Result.success(menuService.selectMenuById(menuId));
} }
/** /**
* *
*/ */
@GetMapping("/treeselect") @GetMapping("/treeselect")
public Result treeselect (SysMenu menu) { public Result<List<TreeSelect>> treeselect (SysMenu menu) {
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return success(menuService.buildMenuTreeSelect(menus)); return Result.success(menuService.buildMenuTreeSelect(menus));
} }
/** /**
* *
*/ */
@GetMapping(value = "/roleMenuTreeselect/{roleId}") @GetMapping(value = "/roleMenuTreeselect/{roleId}")
public Result roleMenuTreeselect (@PathVariable("roleId") Long roleId) { public Result<RoleMenuTreeResp> 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()
@ -75,7 +76,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 add (@Validated @RequestBody SysMenu menu) { public Result<String> 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())) {
@ -91,7 +92,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 edit (@Validated @RequestBody SysMenu menu) { public Result<String> 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())) {
@ -109,7 +110,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 remove (@PathVariable("menuId") Long menuId) { public Result<String> 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> list (SysNotice notice) { public Result<TableDataInfo<SysNotice>> 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 getInfo (@PathVariable Long noticeId) { public Result<SysNotice> getInfo (@PathVariable Long noticeId) {
return success(noticeService.selectNoticeById(noticeId)); return Result.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 add (@Validated @RequestBody SysNotice notice) { public Result<String> 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 edit (@Validated @RequestBody SysNotice notice) { public Result<String> 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 remove (@PathVariable Long[] noticeIds) { public Result<String> 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> list (SysPost post) { public Result<TableDataInfo<SysPost>> 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 getInfo (@PathVariable Long postId) { public Result<SysPost> getInfo (@PathVariable Long postId) {
return success(postService.selectPostById(postId)); return Result.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 add (@Validated @RequestBody SysPost post) { public Result<String> 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 edit (@Validated @RequestBody SysPost post) { public Result<String> 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 remove (@PathVariable Long[] postIds) { public Result<String> 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 optionselect () { public Result<List<SysPost>> optionselect () {
List<SysPost> posts = postService.selectPostAll(); List<SysPost> posts = postService.selectPostAll();
return success(posts); return Result.success(posts);
} }
} }

View File

@ -36,7 +36,7 @@ public class SysProfileController extends BaseController {
* *
*/ */
@GetMapping @GetMapping
public Result profile () { public Result<ProfileResp> 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 updateProfile (@RequestBody SysUser user) { public Result<String> 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 success(); return Result.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 updatePwd (String oldPassword, String newPassword) { public Result<String> 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 success(); return Result.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 avatar (@RequestParam("avatarfile") MultipartFile file) throws Exception { public Result<String> 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 register (@RequestBody RegisterBody user) { public Result<String> 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> list (SysRole role) { public Result<TableDataInfo<SysRole>> 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 getInfo (@PathVariable Long roleId) { public Result<SysRole> getInfo (@PathVariable Long roleId) {
roleService.checkRoleDataScope(roleId); roleService.checkRoleDataScope(roleId);
return success(roleService.selectRoleById(roleId)); return Result.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 add (@Validated @RequestBody SysRole role) { public Result<String> 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 edit (@Validated @RequestBody SysRole role) { public Result<String> 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 success(); return Result.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 dataScope (@RequestBody SysRole role) { public Result<String> 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 changeStatus (@RequestBody SysRole role) { public Result<String> 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 remove (@PathVariable Long[] roleIds) { public Result<String> 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 optionselect () { public Result<List<SysRole>> optionselect () {
return success(roleService.selectRoleAll()); return Result.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> allocatedList (SysUser user) { public Result<TableDataInfo<SysUser>> 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> unallocatedList (SysUser user) { public Result<TableDataInfo<SysUser>> 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 cancelAuthUser (@RequestBody SysUserRole userRole) { public Result<String> 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 cancelAuthUserAll (Long roleId, Long[] userIds) { public Result<String> 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 selectAuthUserAll (Long roleId, Long[] userIds) { public Result<String> 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 deptTree (@PathVariable("roleId") Long roleId) { public Result<DeptTreeResp> 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,11 +3,13 @@ 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;
@ -53,7 +55,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> list (SysUser user) { public Result<TableDataInfo<SysUser>> list (SysUser user) {
startPage(); startPage();
List<SysUser> list = userService.selectUserList(user); List<SysUser> list = userService.selectUserList(user);
return getDataTable(list); return getDataTable(list);
@ -71,12 +73,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 importData (MultipartFile file, boolean updateSupport) throws Exception { public Result<String> 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 success(message); return Result.success(message);
} }
@PostMapping("/importTemplate") @PostMapping("/importTemplate")
@ -90,11 +92,10 @@ 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 getInfo (@PathVariable(value = "userId", required = false) Long userId) { public Result<UserDetailInfoResp> 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();
UserDetailInfoResp.UserDetailInfoRespBuilder builder = UserDetailInfoResp.builder() 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)) {
@ -114,7 +115,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 add (@Validated @RequestBody SysUser user) { public Result<String> 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)) {
@ -133,7 +134,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 edit (@Validated @RequestBody SysUser user) { public Result<String> 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)) {
@ -153,7 +154,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 remove (@PathVariable Long[] userIds) { public Result<String> remove (@PathVariable Long[] userIds) {
if (ArrayUtils.contains(userIds, getUserId())) { if (ArrayUtils.contains(userIds, getUserId())) {
return error("当前用户不能删除"); return error("当前用户不能删除");
} }
@ -166,7 +167,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 resetPwd (@RequestBody SysUser user) { public Result<String> 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()));
@ -180,7 +181,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 changeStatus (@RequestBody SysUser user) { public Result<String> changeStatus (@RequestBody SysUser user) {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId()); userService.checkUserDataScope(user.getUserId());
user.setUpdateBy(getUserId()); user.setUpdateBy(getUserId());
@ -192,7 +193,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 authRole (@PathVariable("userId") Long userId) { public Result<AuthRoleResp> 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(
@ -209,10 +210,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 insertAuthRole (Long userId, Long[] roleIds) { public Result<String> insertAuthRole (Long userId, Long[] roleIds) {
userService.checkUserDataScope(userId); userService.checkUserDataScope(userId);
userService.insertUserAuth(userId, roleIds); userService.insertUserAuth(userId, roleIds);
return success(); return Result.success();
} }
/** /**
@ -220,7 +221,7 @@ public class SysUserController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:user:list')") @PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/deptTree") @GetMapping("/deptTree")
public Result deptTree (SysDept dept) { public Result<List<TreeSelect>> deptTree (SysDept dept) {
return success(deptService.selectDeptTreeList(dept)); return Result.success(deptService.selectDeptTreeList(dept));
} }
} }

View File

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

View File

@ -0,0 +1,27 @@
<?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

@ -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</artifactId> <artifactId>ruoyi-basic</artifactId>
<groupId>com.ruoyi</groupId> <groupId>com.muyu</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,7 +154,18 @@ 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) {
@ -167,13 +178,37 @@ 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,11 +16,6 @@ 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,6 +12,7 @@ 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;
@ -72,9 +73,9 @@ public class BaseController {
* *
*/ */
@SuppressWarnings({"rawtypes", "unchecked"}) @SuppressWarnings({"rawtypes", "unchecked"})
protected Result<TableDataInfo> getDataTable (List<?> list) { protected <T> Result<TableDataInfo<T>> getDataTable (List<T> list) {
return Result.success( return Result.success(
TableDataInfo.builder() TableDataInfo.<T>builder()
.total(new PageInfo(list).getTotal()) .total(new PageInfo(list).getTotal())
.rows(list) .rows(list)
.build() .build()
@ -95,31 +96,18 @@ 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 error (String message) { public Result<String> error (String message) {
return Result.error(message); return Result.error(message);
} }
/** /**
* *
*/ */
public Result warn (String message) { public Result<String> warn (String message) {
return Result.warn(message); return Result.warn(message);
} }
@ -130,7 +118,7 @@ public class BaseController {
* *
* @return * @return
*/ */
protected Result toAjax (int rows) { protected Result<String> 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) @TableField(value = "create_by" , fill = FieldFill.INSERT,exist = false)
@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) @TableField(value = "create_time" , fill = FieldFill.INSERT,exist = false)
@ApiModelProperty(hidden=true) @ApiModelProperty(hidden=true)
private Date createTime; private Date createTime;
/** /**
* *
*/ */
@TableField(value = "update_by" , fill = FieldFill.UPDATE) @TableField(value = "update_by" , fill = FieldFill.UPDATE ,exist = false)
@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) @TableField(value = "update_time" , fill = FieldFill.UPDATE,exist = false)
@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 implements Serializable { public class TableDataInfo<T> implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
@ -28,7 +28,7 @@ public class TableDataInfo implements Serializable {
/** /**
* *
*/ */
private List<?> rows; private List<T> rows;
} }

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