Compare commits
10 Commits
7ac5ebc2d4
...
1d05647a73
Author | SHA1 | Date |
---|---|---|
|
1d05647a73 | |
|
22498a253d | |
|
2f1728def8 | |
|
e33185856c | |
|
2d6f0a4f6f | |
|
12a1f4ac2a | |
|
dde64c7a0f | |
|
5b84a2fb17 | |
|
d56b9c120c | |
|
84f554d531 |
30
pom.xml
30
pom.xml
|
@ -4,7 +4,7 @@
|
|||
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>
|
||||
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<version>3.8.6</version>
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
|||
<ruoyi.version>3.8.6</ruoyi.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<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>
|
||||
<druid.version>1.2.16</druid.version>
|
||||
<bitwalker.version>1.21</bitwalker.version>
|
||||
|
@ -31,7 +31,6 @@
|
|||
<velocity.version>2.3</velocity.version>
|
||||
<jwt.version>0.9.1</jwt.version>
|
||||
<knife4j.version>4.3.0</knife4j.version>
|
||||
<mysql.version>8.0.33</mysql.version>
|
||||
</properties>
|
||||
|
||||
<!-- 依赖声明 -->
|
||||
|
@ -54,13 +53,6 @@
|
|||
<version>${knife4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql驱动包 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${mysql.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里数据库连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
|
@ -152,35 +144,35 @@
|
|||
|
||||
<!-- 定时任务-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>ruoyi-quartz</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>ruoyi-generator</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>ruoyi-framework</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 系统模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>ruoyi-system</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
@ -189,12 +181,8 @@
|
|||
</dependencyManagement>
|
||||
|
||||
<modules>
|
||||
<module>ruoyi-admin</module>
|
||||
<module>ruoyi-framework</module>
|
||||
<module>ruoyi-system</module>
|
||||
<module>ruoyi-quartz</module>
|
||||
<module>ruoyi-generator</module>
|
||||
<module>ruoyi-common</module>
|
||||
<module>ruoyi-application</module>
|
||||
<module>ruoyi-basic</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<groupId>com.muyu</groupId>
|
||||
<version>3.8.6</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>ruoyi-admin</artifactId>
|
||||
<artifactId>ruoyi-application</artifactId>
|
||||
|
||||
<description>
|
||||
web服务入口
|
||||
|
@ -54,25 +54,25 @@
|
|||
|
||||
<!-- Mysql驱动包 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>ruoyi-framework</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 定时任务-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>ruoyi-quartz</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>ruoyi-generator</artifactId>
|
||||
</dependency>
|
||||
|
|
@ -66,7 +66,7 @@ public class CommonController {
|
|||
* 通用上传请求(单个)
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public Result uploadFile (MultipartFile file) throws Exception {
|
||||
public Result<UploadFileModel> uploadFile (MultipartFile file) throws Exception {
|
||||
try {
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
|
@ -89,7 +89,7 @@ public class CommonController {
|
|||
* 通用上传请求(多个)
|
||||
*/
|
||||
@PostMapping("/uploads")
|
||||
public Result uploadFiles (List<MultipartFile> files) throws Exception {
|
||||
public Result<List<UploadFileModel>> uploadFiles (List<MultipartFile> files) throws Exception {
|
||||
try {
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
|
@ -36,7 +36,7 @@ public class CacheController {
|
|||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@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 commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
|
||||
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
|
||||
|
@ -59,20 +59,20 @@ public class CacheController {
|
|||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping("/getNames")
|
||||
public Result cache () {
|
||||
public Result<List<SysCache>> cache () {
|
||||
return Result.success(caches);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping("/getKeys/{cacheName}")
|
||||
public Result getCacheKeys (@PathVariable String cacheName) {
|
||||
public Result<Set<String>> getCacheKeys (@PathVariable String cacheName) {
|
||||
Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
||||
return Result.success(cacheKeys);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@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);
|
||||
SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
|
||||
return Result.success(sysCache);
|
||||
|
@ -80,24 +80,28 @@ public class CacheController {
|
|||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@DeleteMapping("/clearCacheName/{cacheName}")
|
||||
public Result clearCacheName (@PathVariable String cacheName) {
|
||||
public Result<String> clearCacheName (@PathVariable String cacheName) {
|
||||
Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
||||
redisTemplate.delete(cacheKeys);
|
||||
if (cacheKeys != null) {
|
||||
redisTemplate.delete(cacheKeys);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@DeleteMapping("/clearCacheKey/{cacheKey}")
|
||||
public Result clearCacheKey (@PathVariable String cacheKey) {
|
||||
public Result<String> clearCacheKey (@PathVariable String cacheKey) {
|
||||
redisTemplate.delete(cacheKey);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@DeleteMapping("/clearCacheAll")
|
||||
public Result clearCacheAll () {
|
||||
public Result<String> clearCacheAll () {
|
||||
Collection<String> cacheKeys = redisTemplate.keys("*");
|
||||
redisTemplate.delete(cacheKeys);
|
||||
if (cacheKeys != null) {
|
||||
redisTemplate.delete(cacheKeys);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
public class ServerController {
|
||||
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
||||
@GetMapping()
|
||||
public Result getInfo () throws Exception {
|
||||
public Result<Server> getInfo () throws Exception {
|
||||
Server server = new Server();
|
||||
server.copyTo();
|
||||
return Result.success(server);
|
|
@ -32,7 +32,7 @@ public class SysLogininforController extends BaseController {
|
|||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo> list (SysLogininfor logininfor) {
|
||||
public Result<TableDataInfo<SysLogininfor>> list (SysLogininfor logininfor) {
|
||||
startPage();
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
return getDataTable(list);
|
||||
|
@ -50,23 +50,23 @@ public class SysLogininforController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{infoIds}")
|
||||
public Result remove (@PathVariable Long[] infoIds) {
|
||||
public Result<String> remove (@PathVariable Long[] infoIds) {
|
||||
return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clean")
|
||||
public Result clean () {
|
||||
public Result<String> clean () {
|
||||
logininforService.cleanLogininfor();
|
||||
return success();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
|
||||
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/unlock/{userName}")
|
||||
public Result unlock (@PathVariable("userName") String userName) {
|
||||
public Result<String> unlock (@PathVariable("userName") String userName) {
|
||||
passwordService.clearLoginRecordCache(userName);
|
||||
return success();
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -28,7 +28,7 @@ public class SysOperlogController extends BaseController {
|
|||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo> list (SysOperLog operLog) {
|
||||
public Result<TableDataInfo<SysOperLog>> list (SysOperLog operLog) {
|
||||
startPage();
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
return getDataTable(list);
|
||||
|
@ -46,15 +46,15 @@ public class SysOperlogController extends BaseController {
|
|||
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/{operIds}")
|
||||
public Result remove (@PathVariable Long[] operIds) {
|
||||
public Result<String> remove (@PathVariable Long[] operIds) {
|
||||
return toAjax(operLogService.deleteOperLogByIds(operIds));
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/clean")
|
||||
public Result clean () {
|
||||
public Result<String> clean () {
|
||||
operLogService.cleanOperLog();
|
||||
return success();
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ public class SysUserOnlineController extends BaseController {
|
|||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:online: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 + "*");
|
||||
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
||||
for (String key : keys) {
|
||||
|
@ -62,8 +62,8 @@ public class SysUserOnlineController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@DeleteMapping("/{tokenId}")
|
||||
public Result forceLogout (@PathVariable String tokenId) {
|
||||
public Result<String> forceLogout (@PathVariable String tokenId) {
|
||||
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
|
||||
return success();
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -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));
|
||||
}
|
||||
}
|
|
@ -32,7 +32,7 @@ public class SysConfigController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:list')")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo> list (SysConfig config) {
|
||||
public Result<TableDataInfo<SysConfig>> list (SysConfig config) {
|
||||
startPage();
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
return getDataTable(list);
|
||||
|
@ -52,16 +52,16 @@ public class SysConfigController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:query')")
|
||||
@GetMapping(value = "/{configId}")
|
||||
public Result getInfo (@PathVariable Long configId) {
|
||||
return success(configService.selectConfigById(configId));
|
||||
public Result<SysConfig> getInfo (@PathVariable Long configId) {
|
||||
return Result.success(configService.selectConfigById(configId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数键名查询参数值
|
||||
*/
|
||||
@GetMapping(value = "/configKey/{configKey}")
|
||||
public Result getConfigKey (@PathVariable String configKey) {
|
||||
return success(configService.selectConfigByKey(configKey));
|
||||
public Result<String> getConfigKey (@PathVariable String configKey) {
|
||||
return Result.success(configService.selectConfigByKey(configKey));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,7 +70,7 @@ public class SysConfigController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:config:add')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysConfig config) {
|
||||
public Result<String> add (@Validated @RequestBody SysConfig config) {
|
||||
if (!configService.checkConfigKeyUnique(config)) {
|
||||
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class SysConfigController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:config:edit')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit (@Validated @RequestBody SysConfig config) {
|
||||
public Result<String> edit (@Validated @RequestBody SysConfig config) {
|
||||
if (!configService.checkConfigKeyUnique(config)) {
|
||||
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
|
@ -98,9 +98,9 @@ public class SysConfigController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{configIds}")
|
||||
public Result remove (@PathVariable Long[] configIds) {
|
||||
public Result<String> remove (@PathVariable Long[] configIds) {
|
||||
configService.deleteConfigByIds(configIds);
|
||||
return success();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -109,8 +109,8 @@ public class SysConfigController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public Result refreshCache () {
|
||||
public Result<String> refreshCache () {
|
||||
configService.resetConfigCache();
|
||||
return success();
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -32,9 +32,9 @@ public class SysDeptController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@GetMapping("/list")
|
||||
public Result list (SysDept dept) {
|
||||
public Result<List<SysDept>> list (SysDept 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')")
|
||||
@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());
|
||||
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')")
|
||||
@GetMapping(value = "/{deptId}")
|
||||
public Result getInfo (@PathVariable Long deptId) {
|
||||
public Result<SysDept> getInfo (@PathVariable Long 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')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysDept dept) {
|
||||
public Result<String> add (@Validated @RequestBody SysDept dept) {
|
||||
if (!deptService.checkDeptNameUnique(dept)) {
|
||||
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class SysDeptController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit (@Validated @RequestBody SysDept dept) {
|
||||
public Result<String> edit (@Validated @RequestBody SysDept dept) {
|
||||
Long deptId = dept.getDeptId();
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
if (!deptService.checkDeptNameUnique(dept)) {
|
||||
|
@ -98,7 +98,7 @@ public class SysDeptController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{deptId}")
|
||||
public Result remove (@PathVariable Long deptId) {
|
||||
public Result<String> remove (@PathVariable Long deptId) {
|
||||
if (deptService.hasChildByDeptId(deptId)) {
|
||||
return warn("存在下级部门,不允许删除");
|
||||
}
|
|
@ -35,7 +35,7 @@ public class SysDictDataController extends BaseController {
|
|||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo> list (SysDictData dictData) {
|
||||
public Result<TableDataInfo<SysDictData>> list (SysDictData dictData) {
|
||||
startPage();
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
return getDataTable(list);
|
||||
|
@ -55,20 +55,20 @@ public class SysDictDataController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictCode}")
|
||||
public Result getInfo (@PathVariable Long dictCode) {
|
||||
return success(dictDataService.selectDictDataById(dictCode));
|
||||
public Result<SysDictData> getInfo (@PathVariable Long dictCode) {
|
||||
return Result.success(dictDataService.selectDictDataById(dictCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据信息
|
||||
*/
|
||||
@GetMapping(value = "/type/{dictType}")
|
||||
public Result dictType (@PathVariable String dictType) {
|
||||
public Result<List<SysDictData>> dictType (@PathVariable String dictType) {
|
||||
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
||||
if (StringUtils.isNull(data)) {
|
||||
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')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysDictData dict) {
|
||||
public Result<String> add (@Validated @RequestBody SysDictData dict) {
|
||||
dict.setCreateBy(getUserId());
|
||||
return toAjax(dictDataService.insertDictData(dict));
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class SysDictDataController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit (@Validated @RequestBody SysDictData dict) {
|
||||
public Result<String> edit (@Validated @RequestBody SysDictData dict) {
|
||||
dict.setUpdateBy(getUserId());
|
||||
return toAjax(dictDataService.updateDictData(dict));
|
||||
}
|
||||
|
@ -99,8 +99,8 @@ public class SysDictDataController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictCodes}")
|
||||
public Result remove (@PathVariable Long[] dictCodes) {
|
||||
public Result<String> remove (@PathVariable Long[] dictCodes) {
|
||||
dictDataService.deleteDictDataByIds(dictCodes);
|
||||
return success();
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@ public class SysDictTypeController extends BaseController {
|
|||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo> list (SysDictType dictType) {
|
||||
public Result<TableDataInfo<SysDictType>> list (SysDictType dictType) {
|
||||
startPage();
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
return getDataTable(list);
|
||||
|
@ -49,8 +49,8 @@ public class SysDictTypeController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictId}")
|
||||
public Result getInfo (@PathVariable Long dictId) {
|
||||
return success(dictTypeService.selectDictTypeById(dictId));
|
||||
public Result<SysDictType> getInfo (@PathVariable Long dictId) {
|
||||
return Result.success(dictTypeService.selectDictTypeById(dictId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,7 +59,7 @@ public class SysDictTypeController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysDictType dict) {
|
||||
public Result<String> add (@Validated @RequestBody SysDictType dict) {
|
||||
if (!dictTypeService.checkDictTypeUnique(dict)) {
|
||||
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class SysDictTypeController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit (@Validated @RequestBody SysDictType dict) {
|
||||
public Result<String> edit (@Validated @RequestBody SysDictType dict) {
|
||||
if (!dictTypeService.checkDictTypeUnique(dict)) {
|
||||
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
|
@ -87,9 +87,9 @@ public class SysDictTypeController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictIds}")
|
||||
public Result remove (@PathVariable Long[] dictIds) {
|
||||
public Result<String> remove (@PathVariable Long[] dictIds) {
|
||||
dictTypeService.deleteDictTypeByIds(dictIds);
|
||||
return success();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -98,17 +98,17 @@ public class SysDictTypeController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public Result refreshCache () {
|
||||
public Result<String> refreshCache () {
|
||||
dictTypeService.resetDictCache();
|
||||
return success();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public Result optionselect () {
|
||||
public Result<List<SysDictType>> optionselect () {
|
||||
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
||||
return success(dictTypes);
|
||||
return Result.success(dictTypes);
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import com.ruoyi.common.core.domain.resp.UserInfoResp;
|
|||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.framework.web.service.SysLoginService;
|
||||
import com.ruoyi.framework.web.service.SysPermissionService;
|
||||
import com.ruoyi.system.domain.vo.RouterVo;
|
||||
import com.ruoyi.system.service.SysMenuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
@ -42,7 +43,7 @@ public class SysLoginController {
|
|||
* @return 结果
|
||||
*/
|
||||
@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(),
|
||||
loginBody.getUuid());
|
||||
|
@ -55,7 +56,7 @@ public class SysLoginController {
|
|||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("getInfo")
|
||||
public Result getInfo () {
|
||||
public Result<UserInfoResp> getInfo () {
|
||||
SysUser user = SecurityUtils.getLoginUser().getUser();
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getRolePermission(user);
|
||||
|
@ -76,7 +77,7 @@ public class SysLoginController {
|
|||
* @return 路由信息
|
||||
*/
|
||||
@GetMapping("getRouters")
|
||||
public Result getRouters () {
|
||||
public Result<List<RouterVo>> getRouters () {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
||||
return Result.success(menuService.buildMenus(menus));
|
|
@ -4,6 +4,7 @@ import com.ruoyi.common.annotation.Log;
|
|||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
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.resp.RoleMenuTreeResp;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
|
@ -32,9 +33,9 @@ public class SysMenuController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:list')")
|
||||
@GetMapping("/list")
|
||||
public Result list (SysMenu menu) {
|
||||
public Result<List<SysMenu>> list (SysMenu menu) {
|
||||
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')")
|
||||
@GetMapping(value = "/{menuId}")
|
||||
public Result getInfo (@PathVariable Long menuId) {
|
||||
return success(menuService.selectMenuById(menuId));
|
||||
public Result<SysMenu> getInfo (@PathVariable Long menuId) {
|
||||
return Result.success(menuService.selectMenuById(menuId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单下拉树列表
|
||||
*/
|
||||
@GetMapping("/treeselect")
|
||||
public Result treeselect (SysMenu menu) {
|
||||
public Result<List<TreeSelect>> treeselect (SysMenu menu) {
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||
return success(menuService.buildMenuTreeSelect(menus));
|
||||
return Result.success(menuService.buildMenuTreeSelect(menus));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载对应角色菜单列表树
|
||||
*/
|
||||
@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());
|
||||
return Result.success(
|
||||
RoleMenuTreeResp.builder()
|
||||
|
@ -75,7 +76,7 @@ public class SysMenuController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:menu:add')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysMenu menu) {
|
||||
public Result<String> add (@Validated @RequestBody SysMenu menu) {
|
||||
if (!menuService.checkMenuNameUnique(menu)) {
|
||||
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
} 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')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit (@Validated @RequestBody SysMenu menu) {
|
||||
public Result<String> edit (@Validated @RequestBody SysMenu menu) {
|
||||
if (!menuService.checkMenuNameUnique(menu)) {
|
||||
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
} 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')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{menuId}")
|
||||
public Result remove (@PathVariable("menuId") Long menuId) {
|
||||
public Result<String> remove (@PathVariable("menuId") Long menuId) {
|
||||
if (menuService.hasChildByMenuId(menuId)) {
|
||||
return warn("存在子菜单,不允许删除");
|
||||
}
|
|
@ -30,7 +30,7 @@ public class SysNoticeController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo> list (SysNotice notice) {
|
||||
public Result<TableDataInfo<SysNotice>> list (SysNotice notice) {
|
||||
startPage();
|
||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||
return getDataTable(list);
|
||||
|
@ -41,8 +41,8 @@ public class SysNoticeController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:query')")
|
||||
@GetMapping(value = "/{noticeId}")
|
||||
public Result getInfo (@PathVariable Long noticeId) {
|
||||
return success(noticeService.selectNoticeById(noticeId));
|
||||
public Result<SysNotice> getInfo (@PathVariable Long noticeId) {
|
||||
return Result.success(noticeService.selectNoticeById(noticeId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,7 +51,7 @@ public class SysNoticeController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:notice:add')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysNotice notice) {
|
||||
public Result<String> add (@Validated @RequestBody SysNotice notice) {
|
||||
notice.setCreateBy(getUserId());
|
||||
return toAjax(noticeService.insertNotice(notice));
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class SysNoticeController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit (@Validated @RequestBody SysNotice notice) {
|
||||
public Result<String> edit (@Validated @RequestBody SysNotice notice) {
|
||||
notice.setUpdateBy(getUserId());
|
||||
return toAjax(noticeService.updateNotice(notice));
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class SysNoticeController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{noticeIds}")
|
||||
public Result remove (@PathVariable Long[] noticeIds) {
|
||||
public Result<String> remove (@PathVariable Long[] noticeIds) {
|
||||
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
|
||||
}
|
||||
}
|
|
@ -32,7 +32,7 @@ public class SysPostController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:list')")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo> list (SysPost post) {
|
||||
public Result<TableDataInfo<SysPost>> list (SysPost post) {
|
||||
startPage();
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
return getDataTable(list);
|
||||
|
@ -52,8 +52,8 @@ public class SysPostController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:query')")
|
||||
@GetMapping(value = "/{postId}")
|
||||
public Result getInfo (@PathVariable Long postId) {
|
||||
return success(postService.selectPostById(postId));
|
||||
public Result<SysPost> getInfo (@PathVariable Long postId) {
|
||||
return Result.success(postService.selectPostById(postId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,7 +62,7 @@ public class SysPostController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:post:add')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysPost post) {
|
||||
public Result<String> add (@Validated @RequestBody SysPost post) {
|
||||
if (!postService.checkPostNameUnique(post)) {
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
} else if (!postService.checkPostCodeUnique(post)) {
|
||||
|
@ -78,7 +78,7 @@ public class SysPostController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:post:edit')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit (@Validated @RequestBody SysPost post) {
|
||||
public Result<String> edit (@Validated @RequestBody SysPost post) {
|
||||
if (!postService.checkPostNameUnique(post)) {
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
} else if (!postService.checkPostCodeUnique(post)) {
|
||||
|
@ -94,7 +94,7 @@ public class SysPostController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:post:remove')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{postIds}")
|
||||
public Result remove (@PathVariable Long[] postIds) {
|
||||
public Result<String> remove (@PathVariable Long[] postIds) {
|
||||
return toAjax(postService.deletePostByIds(postIds));
|
||||
}
|
||||
|
||||
|
@ -102,8 +102,8 @@ public class SysPostController extends BaseController {
|
|||
* 获取岗位选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public Result optionselect () {
|
||||
public Result<List<SysPost>> optionselect () {
|
||||
List<SysPost> posts = postService.selectPostAll();
|
||||
return success(posts);
|
||||
return Result.success(posts);
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ public class SysProfileController extends BaseController {
|
|||
* 个人信息
|
||||
*/
|
||||
@GetMapping
|
||||
public Result profile () {
|
||||
public Result<ProfileResp> profile () {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser user = loginUser.getUser();
|
||||
return Result.success(
|
||||
|
@ -53,7 +53,7 @@ public class SysProfileController extends BaseController {
|
|||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result updateProfile (@RequestBody SysUser user) {
|
||||
public Result<String> updateProfile (@RequestBody SysUser user) {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser currentUser = loginUser.getUser();
|
||||
currentUser.setNickName(user.getNickName());
|
||||
|
@ -69,7 +69,7 @@ public class SysProfileController extends BaseController {
|
|||
if (userService.updateUserProfile(currentUser) > 0) {
|
||||
// 更新缓存用户信息
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return success();
|
||||
return Result.success();
|
||||
}
|
||||
return error("修改个人信息异常,请联系管理员");
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class SysProfileController extends BaseController {
|
|||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updatePwd")
|
||||
public Result updatePwd (String oldPassword, String newPassword) {
|
||||
public Result<String> updatePwd (String oldPassword, String newPassword) {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
String userName = loginUser.getUsername();
|
||||
String password = loginUser.getPassword();
|
||||
|
@ -93,7 +93,7 @@ public class SysProfileController extends BaseController {
|
|||
// 更新缓存用户密码
|
||||
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return success();
|
||||
return Result.success();
|
||||
}
|
||||
return error("修改密码异常,请联系管理员");
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public class SysProfileController extends BaseController {
|
|||
*/
|
||||
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/avatar")
|
||||
public Result avatar (@RequestParam("avatarfile") MultipartFile file) throws Exception {
|
||||
public Result<String> avatar (@RequestParam("avatarfile") MultipartFile file) throws Exception {
|
||||
if (!file.isEmpty()) {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
|
|
@ -25,7 +25,7 @@ public class SysRegisterController extends BaseController {
|
|||
private SysConfigServic configService;
|
||||
|
||||
@PostMapping("/register")
|
||||
public Result register (@RequestBody RegisterBody user) {
|
||||
public Result<String> register (@RequestBody RegisterBody user) {
|
||||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
|
||||
return error("当前系统没有开启注册功能!");
|
||||
}
|
|
@ -51,7 +51,7 @@ public class SysRoleController extends BaseController {
|
|||
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo> list (SysRole role) {
|
||||
public Result<TableDataInfo<SysRole>> list (SysRole role) {
|
||||
startPage();
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
return getDataTable(list);
|
||||
|
@ -71,9 +71,9 @@ public class SysRoleController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping(value = "/{roleId}")
|
||||
public Result getInfo (@PathVariable Long roleId) {
|
||||
public Result<SysRole> getInfo (@PathVariable Long 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')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysRole role) {
|
||||
public Result<String> add (@Validated @RequestBody SysRole role) {
|
||||
if (!roleService.checkRoleNameUnique(role)) {
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
} else if (!roleService.checkRoleKeyUnique(role)) {
|
||||
|
@ -99,7 +99,7 @@ public class SysRoleController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit (@Validated @RequestBody SysRole role) {
|
||||
public Result<String> edit (@Validated @RequestBody SysRole role) {
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
if (!roleService.checkRoleNameUnique(role)) {
|
||||
|
@ -117,7 +117,7 @@ public class SysRoleController extends BaseController {
|
|||
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
|
||||
tokenService.setLoginUser(loginUser);
|
||||
}
|
||||
return success();
|
||||
return Result.success();
|
||||
}
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public class SysRoleController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/dataScope")
|
||||
public Result dataScope (@RequestBody SysRole role) {
|
||||
public Result<String> dataScope (@RequestBody SysRole role) {
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
return toAjax(roleService.authDataScope(role));
|
||||
|
@ -140,7 +140,7 @@ public class SysRoleController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public Result changeStatus (@RequestBody SysRole role) {
|
||||
public Result<String> changeStatus (@RequestBody SysRole role) {
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
role.setUpdateBy(getUserId());
|
||||
|
@ -153,7 +153,7 @@ public class SysRoleController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:role:remove')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{roleIds}")
|
||||
public Result remove (@PathVariable Long[] roleIds) {
|
||||
public Result<String> remove (@PathVariable Long[] roleIds) {
|
||||
return toAjax(roleService.deleteRoleByIds(roleIds));
|
||||
}
|
||||
|
||||
|
@ -162,8 +162,8 @@ public class SysRoleController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping("/optionselect")
|
||||
public Result optionselect () {
|
||||
return success(roleService.selectRoleAll());
|
||||
public Result<List<SysRole>> optionselect () {
|
||||
return Result.success(roleService.selectRoleAll());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -171,7 +171,7 @@ public class SysRoleController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/authUser/allocatedList")
|
||||
public Result<TableDataInfo> allocatedList (SysUser user) {
|
||||
public Result<TableDataInfo<SysUser>> allocatedList (SysUser user) {
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectAllocatedList(user);
|
||||
return getDataTable(list);
|
||||
|
@ -182,7 +182,7 @@ public class SysRoleController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/authUser/unallocatedList")
|
||||
public Result<TableDataInfo> unallocatedList (SysUser user) {
|
||||
public Result<TableDataInfo<SysUser>> unallocatedList (SysUser user) {
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUnallocatedList(user);
|
||||
return getDataTable(list);
|
||||
|
@ -194,7 +194,7 @@ public class SysRoleController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancel")
|
||||
public Result cancelAuthUser (@RequestBody SysUserRole userRole) {
|
||||
public Result<String> cancelAuthUser (@RequestBody SysUserRole userRole) {
|
||||
return toAjax(roleService.deleteAuthUser(userRole));
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ public class SysRoleController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancelAll")
|
||||
public Result cancelAuthUserAll (Long roleId, Long[] userIds) {
|
||||
public Result<String> cancelAuthUserAll (Long roleId, Long[] userIds) {
|
||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ public class SysRoleController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/selectAll")
|
||||
public Result selectAuthUserAll (Long roleId, Long[] userIds) {
|
||||
public Result<String> selectAuthUserAll (Long roleId, Long[] userIds) {
|
||||
roleService.checkRoleDataScope(roleId);
|
||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public class SysRoleController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping(value = "/deptTree/{roleId}")
|
||||
public Result deptTree (@PathVariable("roleId") Long roleId) {
|
||||
public Result<DeptTreeResp> deptTree (@PathVariable("roleId") Long roleId) {
|
||||
return Result.success(
|
||||
DeptTreeResp.builder()
|
||||
.checkedKeys(deptService.selectDeptListByRoleId(roleId))
|
|
@ -3,11 +3,13 @@ package com.ruoyi.web.controller.system;
|
|||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
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.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.resp.AuthRoleResp;
|
||||
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.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
|
@ -53,7 +55,7 @@ public class SysUserController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo> list (SysUser user) {
|
||||
public Result<TableDataInfo<SysUser>> list (SysUser user) {
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
return getDataTable(list);
|
||||
|
@ -71,12 +73,12 @@ public class SysUserController extends BaseController {
|
|||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:user:import')")
|
||||
@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);
|
||||
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||
Long userId = getUserId();
|
||||
String message = userService.importUser(userList, updateSupport, userId);
|
||||
return success(message);
|
||||
return Result.success(message);
|
||||
}
|
||||
|
||||
@PostMapping("/importTemplate")
|
||||
|
@ -90,11 +92,10 @@ public class SysUserController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||
@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);
|
||||
Result ajax = Result.success();
|
||||
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()))
|
||||
.posts(postService.selectPostAll());
|
||||
if (StringUtils.isNotNull(userId)) {
|
||||
|
@ -114,7 +115,7 @@ public class SysUserController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:user:add')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysUser user) {
|
||||
public Result<String> add (@Validated @RequestBody SysUser user) {
|
||||
if (!userService.checkUserNameUnique(user)) {
|
||||
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
||||
|
@ -133,7 +134,7 @@ public class SysUserController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit (@Validated @RequestBody SysUser user) {
|
||||
public Result<String> edit (@Validated @RequestBody SysUser user) {
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
if (!userService.checkUserNameUnique(user)) {
|
||||
|
@ -153,7 +154,7 @@ public class SysUserController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:user:remove')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{userIds}")
|
||||
public Result remove (@PathVariable Long[] userIds) {
|
||||
public Result<String> remove (@PathVariable Long[] userIds) {
|
||||
if (ArrayUtils.contains(userIds, getUserId())) {
|
||||
return error("当前用户不能删除");
|
||||
}
|
||||
|
@ -166,7 +167,7 @@ public class SysUserController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/resetPwd")
|
||||
public Result resetPwd (@RequestBody SysUser user) {
|
||||
public Result<String> resetPwd (@RequestBody SysUser user) {
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
|
@ -180,7 +181,7 @@ public class SysUserController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public Result changeStatus (@RequestBody SysUser user) {
|
||||
public Result<String> changeStatus (@RequestBody SysUser user) {
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
user.setUpdateBy(getUserId());
|
||||
|
@ -192,7 +193,7 @@ public class SysUserController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||
@GetMapping("/authRole/{userId}")
|
||||
public Result authRole (@PathVariable("userId") Long userId) {
|
||||
public Result<AuthRoleResp> authRole (@PathVariable("userId") Long userId) {
|
||||
SysUser user = userService.selectUserById(userId);
|
||||
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||
return Result.success(
|
||||
|
@ -209,10 +210,10 @@ public class SysUserController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authRole")
|
||||
public Result insertAuthRole (Long userId, Long[] roleIds) {
|
||||
public Result<String> insertAuthRole (Long userId, Long[] roleIds) {
|
||||
userService.checkUserDataScope(userId);
|
||||
userService.insertUserAuth(userId, roleIds);
|
||||
return success();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -220,7 +221,7 @@ public class SysUserController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||
@GetMapping("/deptTree")
|
||||
public Result deptTree (SysDept dept) {
|
||||
return success(deptService.selectDeptTreeList(dept));
|
||||
public Result<List<TreeSelect>> deptTree (SysDept dept) {
|
||||
return Result.success(deptService.selectDeptTreeList(dept));
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ import java.util.Map;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api("用户信息管理")
|
||||
@Api(tags = "用户信息管理")
|
||||
@RestController
|
||||
@RequestMapping("/test/user")
|
||||
public class TestController extends BaseController {
|
|
@ -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>
|
|
@ -3,8 +3,8 @@
|
|||
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">
|
||||
<parent>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-basic</artifactId>
|
||||
<groupId>com.muyu</groupId>
|
||||
<version>3.8.6</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
|
@ -154,7 +154,18 @@ public @interface Excel {
|
|||
Type type () default Type.ALL;
|
||||
|
||||
public enum Type {
|
||||
ALL(0), EXPORT(1), IMPORT(2);
|
||||
/**
|
||||
* 支持导入导出
|
||||
*/
|
||||
ALL(0),
|
||||
/**
|
||||
* 仅导出
|
||||
*/
|
||||
EXPORT(1),
|
||||
/**
|
||||
* 仅导入
|
||||
*/
|
||||
IMPORT(2);
|
||||
private final int value;
|
||||
|
||||
Type (int value) {
|
||||
|
@ -167,13 +178,37 @@ public @interface Excel {
|
|||
}
|
||||
|
||||
public enum ColumnType {
|
||||
NUMERIC(0), STRING(1), IMAGE(2);
|
||||
/**
|
||||
* 数字
|
||||
*/
|
||||
NUMERIC(0),
|
||||
/**
|
||||
* 字符串
|
||||
*/
|
||||
STRING(1),
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
IMAGE(2);
|
||||
|
||||
/**
|
||||
* 枚举类型值
|
||||
*/
|
||||
private final int value;
|
||||
|
||||
/**
|
||||
* 类类型枚举构造器
|
||||
* @param value 枚举类型值
|
||||
*/
|
||||
ColumnType (int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列枚举类型
|
||||
* @return 枚举值
|
||||
*/
|
||||
public int value () {
|
||||
return this.value;
|
||||
}
|
|
@ -16,11 +16,6 @@ public class GenConstants {
|
|||
*/
|
||||
public static final String TPL_TREE = "tree";
|
||||
|
||||
/**
|
||||
* 主子表(增删改查)
|
||||
*/
|
||||
public static final String TPL_SUB = "sub";
|
||||
|
||||
/**
|
||||
* 树编码字段
|
||||
*/
|
|
@ -12,6 +12,7 @@ import com.ruoyi.common.utils.PageUtils;
|
|||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.sql.SqlUtil;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
|
@ -72,9 +73,9 @@ public class BaseController {
|
|||
* 响应请求分页数据
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
protected Result<TableDataInfo> getDataTable (List<?> list) {
|
||||
protected <T> Result<TableDataInfo<T>> getDataTable (List<T> list) {
|
||||
return Result.success(
|
||||
TableDataInfo.builder()
|
||||
TableDataInfo.<T>builder()
|
||||
.total(new PageInfo(list).getTotal())
|
||||
.rows(list)
|
||||
.build()
|
||||
|
@ -95,31 +96,18 @@ public class BaseController {
|
|||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回警告消息
|
||||
*/
|
||||
public Result warn (String message) {
|
||||
public Result<String> warn (String message) {
|
||||
return Result.warn(message);
|
||||
}
|
||||
|
||||
|
@ -130,7 +118,7 @@ public class BaseController {
|
|||
*
|
||||
* @return 操作结果
|
||||
*/
|
||||
protected Result toAjax (int rows) {
|
||||
protected Result<String> toAjax (int rows) {
|
||||
return rows > 0 ? Result.success() : Result.error();
|
||||
}
|
||||
|
|
@ -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)
|
||||
private Long createBy;
|
||||
|
||||
|
@ -48,14 +48,14 @@ public class BaseEntity implements Serializable {
|
|||
* 创建时间
|
||||
*/
|
||||
@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)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
@TableField(value = "update_by" , fill = FieldFill.UPDATE)
|
||||
@TableField(value = "update_by" , fill = FieldFill.UPDATE ,exist = false)
|
||||
@ApiModelProperty(hidden=true)
|
||||
private Long updateBy;
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class BaseEntity implements Serializable {
|
|||
* 更新时间
|
||||
*/
|
||||
@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)
|
||||
private Date updateTime;
|
||||
|
|
@ -17,7 +17,7 @@ import java.util.List;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TableDataInfo implements Serializable {
|
||||
public class TableDataInfo<T> implements Serializable {
|
||||
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
Loading…
Reference in New Issue