update [重大更新]全业务 增加 接口文档注解 格式化代码
| | |
| | | */ |
| | | |
| | | @SpringBootApplication |
| | | public class RuoYiApplication |
| | | { |
| | | public static void main(String[] args) |
| | | { |
| | | public class RuoYiApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | System.setProperty("spring.devtools.restart.enabled", "false"); |
| | | SpringApplication.run(RuoYiApplication.class, args); |
| | | System.out.println("(♥◠‿◠)ノ゙ RuoYi-Vue-Plus启动成功 ლ(´ڡ`ლ)゙"); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * web容器中进行部署 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class RuoYiServletInitializer extends SpringBootServletInitializer |
| | | { |
| | | public class RuoYiServletInitializer extends SpringBootServletInitializer { |
| | | |
| | | @Override |
| | | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) |
| | | { |
| | | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |
| | | return application.sources(RuoYiApplication.class); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.framework.config.properties.CaptchaProperties; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | /** |
| | | * 验证码操作处理 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Api(value = "验证码操作处理", tags = {"验证码管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | public class CaptchaController { |
| | | |
| | | @Autowired |
| | | private CaptchaProperties captchaProperties; |
| | | private final CaptchaProperties captchaProperties; |
| | | private final ISysConfigService configService; |
| | | |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | /** |
| | | * 生成验证码 |
| | | */ |
| | | @ApiOperation("生成验证码") |
| | | @GetMapping("/captchaImage") |
| | | public AjaxResult<Map<String, Object>> getCode() { |
| | | Map<String, Object> ajax = new HashMap<>(); |
| | | boolean captchaOnOff = configService.selectCaptchaOnOff(); |
| | | ajax.put("captchaOnOff", captchaOnOff); |
| | | if (!captchaOnOff) { |
| | | return AjaxResult.success(ajax); |
| | | } |
| | | // 保存验证码信息 |
| | | String uuid = IdUtil.simpleUUID(); |
| | | String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; |
| | | // 生成验证码 |
| | | CaptchaType captchaType = captchaProperties.getType(); |
| | | boolean isMath = CaptchaType.MATH == captchaType; |
| | | Integer length = isMath ? captchaProperties.getNumberLength() : captchaProperties.getCharLength(); |
| | | CodeGenerator codeGenerator = ReflectUtils.newInstance(captchaType.getClazz(), length); |
| | | AbstractCaptcha captcha = SpringUtils.getBean(captchaProperties.getCategory().getClazz()); |
| | | captcha.setGenerator(codeGenerator); |
| | | captcha.createCode(); |
| | | String code = isMath ? getCodeResult(captcha.getCode()) : captcha.getCode(); |
| | | RedisUtils.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); |
| | | ajax.put("uuid", uuid); |
| | | ajax.put("img", captcha.getImageBase64()); |
| | | return AjaxResult.success(ajax); |
| | | } |
| | | |
| | | /** |
| | | * 生成验证码 |
| | | */ |
| | | @GetMapping("/captchaImage") |
| | | public AjaxResult getCode() { |
| | | Map<String, Object> ajax = new HashMap<>(); |
| | | boolean captchaOnOff = configService.selectCaptchaOnOff(); |
| | | ajax.put("captchaOnOff", captchaOnOff); |
| | | if (!captchaOnOff) { |
| | | return AjaxResult.success(ajax); |
| | | } |
| | | // 保存验证码信息 |
| | | String uuid = IdUtil.simpleUUID(); |
| | | String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; |
| | | // 生成验证码 |
| | | CaptchaType captchaType = captchaProperties.getType(); |
| | | boolean isMath = CaptchaType.MATH == captchaType; |
| | | Integer length = isMath ? captchaProperties.getNumberLength() : captchaProperties.getCharLength(); |
| | | CodeGenerator codeGenerator = ReflectUtils.newInstance(captchaType.getClazz(), length); |
| | | AbstractCaptcha captcha = SpringUtils.getBean(captchaProperties.getCategory().getClazz()); |
| | | captcha.setGenerator(codeGenerator); |
| | | captcha.createCode(); |
| | | String code = isMath ? getCodeResult(captcha.getCode()) : captcha.getCode(); |
| | | RedisUtils.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); |
| | | ajax.put("uuid", uuid); |
| | | ajax.put("img", captcha.getImageBase64()); |
| | | return AjaxResult.success(ajax); |
| | | } |
| | | |
| | | private String getCodeResult(String capStr) { |
| | | int numberLength = captchaProperties.getNumberLength(); |
| | | int a = Convert.toInt(StringUtils.substring(capStr, 0, numberLength).trim()); |
| | | char operator = capStr.charAt(numberLength); |
| | | int b = Convert.toInt(StringUtils.substring(capStr, numberLength + 1, numberLength + 1 + numberLength).trim()); |
| | | switch (operator) { |
| | | case '*': |
| | | return Convert.toStr(a * b); |
| | | case '+': |
| | | return Convert.toStr(a + b); |
| | | case '-': |
| | | return Convert.toStr(a - b); |
| | | default: |
| | | return StringUtils.EMPTY; |
| | | } |
| | | } |
| | | private String getCodeResult(String capStr) { |
| | | int numberLength = captchaProperties.getNumberLength(); |
| | | int a = Convert.toInt(StringUtils.substring(capStr, 0, numberLength).trim()); |
| | | char operator = capStr.charAt(numberLength); |
| | | int b = Convert.toInt(StringUtils.substring(capStr, numberLength + 1, numberLength + 1 + numberLength).trim()); |
| | | switch (operator) { |
| | | case '*': |
| | | return Convert.toStr(a * b); |
| | | case '+': |
| | | return Convert.toStr(a + b); |
| | | case '-': |
| | | return Convert.toStr(a - b); |
| | | default: |
| | | return StringUtils.EMPTY; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.connection.RedisServerCommands; |
| | | import org.springframework.data.redis.core.RedisCallback; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | /** |
| | | * 缓存监控 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Api(value = "缓存监控", tags = {"缓存监控管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | @RequestMapping("/monitor/cache") |
| | | public class CacheController |
| | | { |
| | | @Autowired |
| | | private RedisTemplate<String, String> redisTemplate; |
| | | public class CacheController { |
| | | |
| | | private final RedisTemplate<String, String> redisTemplate; |
| | | |
| | | @ApiOperation("获取缓存监控详细信息") |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping() |
| | | public AjaxResult getInfo() throws Exception |
| | | { |
| | | Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info()); |
| | | public AjaxResult<Map<String, Object>> getInfo() throws Exception { |
| | | Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) RedisServerCommands::info); |
| | | Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats")); |
| | | Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize()); |
| | | Object dbSize = redisTemplate.execute((RedisCallback<Object>) RedisServerCommands::dbSize); |
| | | |
| | | Map<String, Object> result = new HashMap<>(3); |
| | | result.put("info", info); |
| | | result.put("dbSize", dbSize); |
| | | |
| | | List<Map<String, String>> pieList = new ArrayList<>(); |
| | | commandStats.stringPropertyNames().forEach(key -> { |
| | | Map<String, String> data = new HashMap<>(2); |
| | | String property = commandStats.getProperty(key); |
| | | data.put("name", StringUtils.removeStart(key, "cmdstat_")); |
| | | data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); |
| | | pieList.add(data); |
| | | }); |
| | | if (commandStats != null) { |
| | | commandStats.stringPropertyNames().forEach(key -> { |
| | | Map<String, String> data = new HashMap<>(2); |
| | | String property = commandStats.getProperty(key); |
| | | data.put("name", StringUtils.removeStart(key, "cmdstat_")); |
| | | data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); |
| | | pieList.add(data); |
| | | }); |
| | | } |
| | | result.put("commandStats", pieList); |
| | | return AjaxResult.success(result); |
| | | } |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.domain.SysLogininfor; |
| | | import com.ruoyi.system.service.ISysLogininforService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | /** |
| | | * 系统访问记录 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Validated |
| | | @Api(value = "系统访问记录", tags = {"系统访问记录管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | @RequestMapping("/monitor/logininfor") |
| | | public class SysLogininforController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysLogininforService logininforService; |
| | | public class SysLogininforController extends BaseController { |
| | | |
| | | private final ISysLogininforService logininforService; |
| | | |
| | | @ApiOperation("查询系统访问记录列表") |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysLogininfor logininfor) |
| | | { |
| | | public TableDataInfo<SysLogininfor> list(SysLogininfor logininfor) { |
| | | return logininforService.selectPageLogininforList(logininfor); |
| | | } |
| | | |
| | | @ApiOperation("导出系统访问记录列表") |
| | | @Log(title = "登录日志", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") |
| | | @GetMapping("/export") |
| | | public void export(SysLogininfor logininfor, HttpServletResponse response) |
| | | { |
| | | public void export(SysLogininfor logininfor, HttpServletResponse response) { |
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); |
| | | ExcelUtil.exportExcel(list, "登录日志", SysLogininfor.class, response); |
| | | ExcelUtil.exportExcel(list, "登录日志", SysLogininfor.class, response); |
| | | } |
| | | |
| | | @ApiOperation("删除系统访问记录") |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") |
| | | @Log(title = "登录日志", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{infoIds}") |
| | | public AjaxResult remove(@PathVariable Long[] infoIds) |
| | | { |
| | | public AjaxResult<Void> remove(@PathVariable Long[] infoIds) { |
| | | return toAjax(logininforService.deleteLogininforByIds(infoIds)); |
| | | } |
| | | |
| | | @ApiOperation("清空系统访问记录") |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") |
| | | @Log(title = "登录日志", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/clean") |
| | | public AjaxResult clean() |
| | | { |
| | | public AjaxResult<Void> clean() { |
| | | logininforService.cleanLogininfor(); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.domain.SysOperLog; |
| | | import com.ruoyi.system.service.ISysOperLogService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | /** |
| | | * 操作日志记录 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Validated |
| | | @Api(value = "操作日志记录", tags = {"操作日志记录管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | @RequestMapping("/monitor/operlog") |
| | | public class SysOperlogController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysOperLogService operLogService; |
| | | public class SysOperlogController extends BaseController { |
| | | |
| | | private final ISysOperLogService operLogService; |
| | | |
| | | @ApiOperation("查询操作日志记录列表") |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysOperLog operLog) |
| | | { |
| | | public TableDataInfo<SysOperLog> list(SysOperLog operLog) { |
| | | return operLogService.selectPageOperLogList(operLog); |
| | | } |
| | | |
| | | @ApiOperation("导出操作日志记录列表") |
| | | @Log(title = "操作日志", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:export')") |
| | | @GetMapping("/export") |
| | | public void export(SysOperLog operLog, HttpServletResponse response) |
| | | { |
| | | public void export(SysOperLog operLog, HttpServletResponse response) { |
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog); |
| | | ExcelUtil.exportExcel(list, "操作日志", SysOperLog.class, response); |
| | | ExcelUtil.exportExcel(list, "操作日志", SysOperLog.class, response); |
| | | } |
| | | |
| | | @ApiOperation("删除操作日志记录") |
| | | @Log(title = "操作日志", businessType = BusinessType.DELETE) |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") |
| | | @DeleteMapping("/{operIds}") |
| | | public AjaxResult remove(@PathVariable Long[] operIds) |
| | | { |
| | | public AjaxResult<Void> remove(@PathVariable Long[] operIds) { |
| | | return toAjax(operLogService.deleteOperLogByIds(operIds)); |
| | | } |
| | | |
| | | @ApiOperation("清空操作日志记录") |
| | | @Log(title = "操作日志", businessType = BusinessType.CLEAN) |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") |
| | | @DeleteMapping("/clean") |
| | | public AjaxResult clean() |
| | | { |
| | | public AjaxResult<Void> clean() { |
| | | operLogService.cleanOperLog(); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.domain.SysUserOnline; |
| | | import com.ruoyi.system.service.ISysUserOnlineService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | /** |
| | | * 在线用户监控 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Api(value = "在线用户监控", tags = {"在线用户监控管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | @RequestMapping("/monitor/online") |
| | | public class SysUserOnlineController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysUserOnlineService userOnlineService; |
| | | public class SysUserOnlineController extends BaseController { |
| | | |
| | | private final ISysUserOnlineService userOnlineService; |
| | | |
| | | @ApiOperation("在线用户列表") |
| | | @PreAuthorize("@ss.hasPermi('monitor:online:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(String ipaddr, String userName) |
| | | { |
| | | public TableDataInfo<SysUserOnline> list(String ipaddr, String userName) { |
| | | Collection<String> keys = RedisUtils.keys(Constants.LOGIN_TOKEN_KEY + "*"); |
| | | List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>(); |
| | | for (String key : keys) |
| | | { |
| | | for (String key : keys) { |
| | | LoginUser user = RedisUtils.getCacheObject(key); |
| | | if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) |
| | | { |
| | | if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername())) |
| | | { |
| | | if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) { |
| | | if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername())) { |
| | | userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user)); |
| | | } |
| | | } |
| | | else if (StringUtils.isNotEmpty(ipaddr)) |
| | | { |
| | | if (StringUtils.equals(ipaddr, user.getIpaddr())) |
| | | { |
| | | } else if (StringUtils.isNotEmpty(ipaddr)) { |
| | | if (StringUtils.equals(ipaddr, user.getIpaddr())) { |
| | | userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user)); |
| | | } |
| | | } |
| | | else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) |
| | | { |
| | | if (StringUtils.equals(userName, user.getUsername())) |
| | | { |
| | | } else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) { |
| | | if (StringUtils.equals(userName, user.getUsername())) { |
| | | userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user)); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | userOnlineList.add(userOnlineService.loginUserToUserOnline(user)); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 强退用户 |
| | | */ |
| | | @ApiOperation("强退用户") |
| | | @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')") |
| | | @Log(title = "在线用户", businessType = BusinessType.FORCE) |
| | | @DeleteMapping("/{tokenId}") |
| | | public AjaxResult forceLogout(@PathVariable String tokenId) |
| | | { |
| | | public AjaxResult<Void> forceLogout(@PathVariable String tokenId) { |
| | | RedisUtils.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | /** |
| | | * 参数配置 信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Validated |
| | | @Api(value = "参数配置控制器", tags = {"参数配置管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | @RequestMapping("/system/config") |
| | | public class SysConfigController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | public class SysConfigController extends BaseController { |
| | | |
| | | private final ISysConfigService configService; |
| | | |
| | | /** |
| | | * 获取参数配置列表 |
| | | */ |
| | | @ApiOperation("获取参数配置列表") |
| | | @PreAuthorize("@ss.hasPermi('system:config:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysConfig config) |
| | | { |
| | | public TableDataInfo<SysConfig> list(SysConfig config) { |
| | | return configService.selectPageConfigList(config); |
| | | } |
| | | |
| | | @ApiOperation("导出参数配置列表") |
| | | @Log(title = "参数管理", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:config:export')") |
| | | @GetMapping("/export") |
| | | public void export(SysConfig config, HttpServletResponse response) |
| | | { |
| | | public void export(SysConfig config, HttpServletResponse response) { |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | ExcelUtil.exportExcel(list, "参数数据", SysConfig.class, response); |
| | | ExcelUtil.exportExcel(list, "参数数据", SysConfig.class, response); |
| | | } |
| | | |
| | | /** |
| | | * 根据参数编号获取详细信息 |
| | | */ |
| | | @ApiOperation("根据参数编号获取详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:config:query')") |
| | | @GetMapping(value = "/{configId}") |
| | | public AjaxResult getInfo(@PathVariable Long configId) |
| | | { |
| | | public AjaxResult<SysConfig> getInfo(@PathVariable Long configId) { |
| | | return AjaxResult.success(configService.selectConfigById(configId)); |
| | | } |
| | | |
| | | /** |
| | | * 根据参数键名查询参数值 |
| | | */ |
| | | @ApiOperation("根据参数键名查询参数值") |
| | | @GetMapping(value = "/configKey/{configKey}") |
| | | public AjaxResult getConfigKey(@PathVariable String configKey) |
| | | { |
| | | public AjaxResult<Void> getConfigKey(@PathVariable String configKey) { |
| | | return AjaxResult.success(configService.selectConfigByKey(configKey)); |
| | | } |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | */ |
| | | @ApiOperation("新增参数配置") |
| | | @PreAuthorize("@ss.hasPermi('system:config:add')") |
| | | @Log(title = "参数管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | @RepeatSubmit |
| | | public AjaxResult add(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) |
| | | { |
| | | public AjaxResult<Void> add(@Validated @RequestBody SysConfig config) { |
| | | if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) { |
| | | return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setCreateBy(getUsername()); |
| | |
| | | /** |
| | | * 修改参数配置 |
| | | */ |
| | | @ApiOperation("修改参数配置") |
| | | @PreAuthorize("@ss.hasPermi('system:config:edit')") |
| | | @Log(title = "参数管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) |
| | | { |
| | | public AjaxResult<Void> edit(@Validated @RequestBody SysConfig config) { |
| | | if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) { |
| | | return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setUpdateBy(getUsername()); |
| | |
| | | /** |
| | | * 删除参数配置 |
| | | */ |
| | | @ApiOperation("删除参数配置") |
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')") |
| | | @Log(title = "参数管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{configIds}") |
| | | public AjaxResult remove(@PathVariable Long[] configIds) |
| | | { |
| | | public AjaxResult<Void> remove(@PathVariable Long[] configIds) { |
| | | configService.deleteConfigByIds(configIds); |
| | | return success(); |
| | | } |
| | |
| | | /** |
| | | * 刷新参数缓存 |
| | | */ |
| | | @ApiOperation("刷新参数缓存") |
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')") |
| | | @Log(title = "参数管理", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public AjaxResult refreshCache() |
| | | { |
| | | public AjaxResult<Void> refreshCache() { |
| | | configService.resetConfigCache(); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.TreeSelect; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 部门信息 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Validated |
| | | @Api(value = "部门控制器", tags = {"部门管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | @RequestMapping("/system/dept") |
| | | public class SysDeptController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysDeptService deptService; |
| | | public class SysDeptController extends BaseController { |
| | | |
| | | private final ISysDeptService deptService; |
| | | |
| | | /** |
| | | * 获取部门列表 |
| | | */ |
| | | @ApiOperation("获取部门列表") |
| | | @PreAuthorize("@ss.hasPermi('system:dept:list')") |
| | | @GetMapping("/list") |
| | | public AjaxResult list(SysDept dept) |
| | | { |
| | | public AjaxResult<List<SysDept>> list(SysDept dept) { |
| | | List<SysDept> depts = deptService.selectDeptList(dept); |
| | | return AjaxResult.success(depts); |
| | | } |
| | |
| | | /** |
| | | * 查询部门列表(排除节点) |
| | | */ |
| | | @ApiOperation("查询部门列表(排除节点)") |
| | | @PreAuthorize("@ss.hasPermi('system:dept:list')") |
| | | @GetMapping("/list/exclude/{deptId}") |
| | | public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) |
| | | { |
| | | public AjaxResult<List<SysDept>> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) { |
| | | List<SysDept> depts = deptService.selectDeptList(new SysDept()); |
| | | Iterator<SysDept> it = depts.iterator(); |
| | | while (it.hasNext()) |
| | | { |
| | | SysDept d = (SysDept) it.next(); |
| | | if (d.getDeptId().intValue() == deptId |
| | | || ArrayUtil.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")) |
| | | { |
| | | it.remove(); |
| | | } |
| | | } |
| | | depts.removeIf(d -> d.getDeptId().equals(deptId) |
| | | || ArrayUtil.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); |
| | | return AjaxResult.success(depts); |
| | | } |
| | | |
| | | /** |
| | | * 根据部门编号获取详细信息 |
| | | */ |
| | | @ApiOperation("根据部门编号获取详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:dept:query')") |
| | | @GetMapping(value = "/{deptId}") |
| | | public AjaxResult getInfo(@PathVariable Long deptId) |
| | | { |
| | | public AjaxResult<SysDept> getInfo(@PathVariable Long deptId) { |
| | | deptService.checkDeptDataScope(deptId); |
| | | return AjaxResult.success(deptService.selectDeptById(deptId)); |
| | | } |
| | |
| | | /** |
| | | * 获取部门下拉树列表 |
| | | */ |
| | | @ApiOperation("获取部门下拉树列表") |
| | | @GetMapping("/treeselect") |
| | | public AjaxResult treeselect(SysDept dept) |
| | | { |
| | | public AjaxResult<List<TreeSelect>> treeselect(SysDept dept) { |
| | | List<SysDept> depts = deptService.selectDeptList(dept); |
| | | return AjaxResult.success(deptService.buildDeptTreeSelect(depts)); |
| | | } |
| | |
| | | /** |
| | | * 加载对应角色部门列表树 |
| | | */ |
| | | @ApiOperation("加载对应角色部门列表树") |
| | | @GetMapping(value = "/roleDeptTreeselect/{roleId}") |
| | | public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId) |
| | | { |
| | | public AjaxResult<Map<String, Object>> roleDeptTreeselect(@PathVariable("roleId") Long roleId) { |
| | | List<SysDept> depts = deptService.selectDeptList(new SysDept()); |
| | | Map<String,Object> ajax = new HashMap<>(); |
| | | Map<String, Object> ajax = new HashMap<>(); |
| | | ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); |
| | | ajax.put("depts", deptService.buildDeptTreeSelect(depts)); |
| | | return AjaxResult.success(ajax); |
| | |
| | | /** |
| | | * 新增部门 |
| | | */ |
| | | @ApiOperation("新增部门") |
| | | @PreAuthorize("@ss.hasPermi('system:dept:add')") |
| | | @Log(title = "部门管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysDept dept) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) |
| | | { |
| | | public AjaxResult<Void> add(@Validated @RequestBody SysDept dept) { |
| | | if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) { |
| | | return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } |
| | | dept.setCreateBy(getUsername()); |
| | |
| | | /** |
| | | * 修改部门 |
| | | */ |
| | | @ApiOperation("修改部门") |
| | | @PreAuthorize("@ss.hasPermi('system:dept:edit')") |
| | | @Log(title = "部门管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysDept dept) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) |
| | | { |
| | | public AjaxResult<Void> edit(@Validated @RequestBody SysDept dept) { |
| | | if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) { |
| | | return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } |
| | | else if (dept.getParentId().equals(dept.getDeptId())) |
| | | { |
| | | } else if (dept.getParentId().equals(dept.getDeptId())) { |
| | | return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); |
| | | } |
| | | else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) |
| | | && deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0) |
| | | { |
| | | } else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) |
| | | && deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0) { |
| | | return AjaxResult.error("该部门包含未停用的子部门!"); |
| | | } |
| | | dept.setUpdateBy(getUsername()); |
| | |
| | | /** |
| | | * 删除部门 |
| | | */ |
| | | @ApiOperation("删除部门") |
| | | @PreAuthorize("@ss.hasPermi('system:dept:remove')") |
| | | @Log(title = "部门管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{deptId}") |
| | | public AjaxResult remove(@PathVariable Long deptId) |
| | | { |
| | | if (deptService.hasChildByDeptId(deptId)) |
| | | { |
| | | public AjaxResult<Void> remove(@PathVariable Long deptId) { |
| | | if (deptService.hasChildByDeptId(deptId)) { |
| | | return AjaxResult.error("存在下级部门,不允许删除"); |
| | | } |
| | | if (deptService.checkDeptExistUser(deptId)) |
| | | { |
| | | if (deptService.checkDeptExistUser(deptId)) { |
| | | return AjaxResult.error("部门存在用户,不允许删除"); |
| | | } |
| | | return toAjax(deptService.deleteDeptById(deptId)); |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.service.ISysDictDataService; |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | /** |
| | | * 数据字典信息 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Validated |
| | | @Api(value = "数据字典信息控制器", tags = {"数据字典信息管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | @RequestMapping("/system/dict/data") |
| | | public class SysDictDataController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysDictDataService dictDataService; |
| | | public class SysDictDataController extends BaseController { |
| | | |
| | | @Autowired |
| | | private ISysDictTypeService dictTypeService; |
| | | private final ISysDictDataService dictDataService; |
| | | private final ISysDictTypeService dictTypeService; |
| | | |
| | | @ApiOperation("查询字典数据列表") |
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysDictData dictData) |
| | | { |
| | | public TableDataInfo<SysDictData> list(SysDictData dictData) { |
| | | return dictDataService.selectPageDictDataList(dictData); |
| | | } |
| | | |
| | | @ApiOperation("导出字典数据列表") |
| | | @Log(title = "字典数据", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')") |
| | | @GetMapping("/export") |
| | | public void export(SysDictData dictData, HttpServletResponse response) |
| | | { |
| | | public void export(SysDictData dictData, HttpServletResponse response) { |
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | ExcelUtil.exportExcel(list, "字典数据", SysDictData.class, response); |
| | | ExcelUtil.exportExcel(list, "字典数据", SysDictData.class, response); |
| | | } |
| | | |
| | | /** |
| | | * 查询字典数据详细 |
| | | */ |
| | | @ApiOperation("查询字典数据详细") |
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')") |
| | | @GetMapping(value = "/{dictCode}") |
| | | public AjaxResult getInfo(@PathVariable Long dictCode) |
| | | { |
| | | public AjaxResult<SysDictData> getInfo(@PathVariable Long dictCode) { |
| | | return AjaxResult.success(dictDataService.selectDictDataById(dictCode)); |
| | | } |
| | | |
| | | /** |
| | | * 根据字典类型查询字典数据信息 |
| | | */ |
| | | @ApiOperation("根据字典类型查询字典数据信息") |
| | | @GetMapping(value = "/type/{dictType}") |
| | | public AjaxResult dictType(@PathVariable String dictType) |
| | | { |
| | | public AjaxResult<List<SysDictData>> dictType(@PathVariable String dictType) { |
| | | List<SysDictData> data = dictTypeService.selectDictDataByType(dictType); |
| | | if (StringUtils.isNull(data)) |
| | | { |
| | | data = new ArrayList<SysDictData>(); |
| | | if (StringUtils.isNull(data)) { |
| | | data = new ArrayList<>(); |
| | | } |
| | | return AjaxResult.success(data); |
| | | } |
| | |
| | | /** |
| | | * 新增字典类型 |
| | | */ |
| | | @ApiOperation("新增字典类型") |
| | | @PreAuthorize("@ss.hasPermi('system:dict:add')") |
| | | @Log(title = "字典数据", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysDictData dict) |
| | | { |
| | | public AjaxResult<Void> add(@Validated @RequestBody SysDictData dict) { |
| | | dict.setCreateBy(getUsername()); |
| | | return toAjax(dictDataService.insertDictData(dict)); |
| | | } |
| | |
| | | /** |
| | | * 修改保存字典类型 |
| | | */ |
| | | @ApiOperation("修改保存字典类型") |
| | | @PreAuthorize("@ss.hasPermi('system:dict:edit')") |
| | | @Log(title = "字典数据", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysDictData dict) |
| | | { |
| | | public AjaxResult<Void> edit(@Validated @RequestBody SysDictData dict) { |
| | | dict.setUpdateBy(getUsername()); |
| | | return toAjax(dictDataService.updateDictData(dict)); |
| | | } |
| | |
| | | /** |
| | | * 删除字典类型 |
| | | */ |
| | | @ApiOperation("删除字典类型") |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "字典类型", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictCodes}") |
| | | public AjaxResult remove(@PathVariable Long[] dictCodes) |
| | | { |
| | | public AjaxResult<Void> remove(@PathVariable Long[] dictCodes) { |
| | | dictDataService.deleteDictDataByIds(dictCodes); |
| | | return success(); |
| | | } |
| | |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | /** |
| | | * 数据字典信息 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Validated |
| | | @Api(value = "数据字典信息控制器", tags = {"数据字典信息管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | @RequestMapping("/system/dict/type") |
| | | public class SysDictTypeController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysDictTypeService dictTypeService; |
| | | public class SysDictTypeController extends BaseController { |
| | | |
| | | private final ISysDictTypeService dictTypeService; |
| | | |
| | | @ApiOperation("查询字典类型列表") |
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysDictType dictType) |
| | | { |
| | | public TableDataInfo<SysDictType> list(SysDictType dictType) { |
| | | return dictTypeService.selectPageDictTypeList(dictType); |
| | | } |
| | | |
| | | @ApiOperation("导出字典类型列表") |
| | | @Log(title = "字典类型", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')") |
| | | @GetMapping("/export") |
| | | public void export(SysDictType dictType, HttpServletResponse response) |
| | | { |
| | | public void export(SysDictType dictType, HttpServletResponse response) { |
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); |
| | | ExcelUtil.exportExcel(list, "字典类型", SysDictType.class, response); |
| | | ExcelUtil.exportExcel(list, "字典类型", SysDictType.class, response); |
| | | } |
| | | |
| | | /** |
| | | * 查询字典类型详细 |
| | | */ |
| | | @ApiOperation("查询字典类型详细") |
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')") |
| | | @GetMapping(value = "/{dictId}") |
| | | public AjaxResult getInfo(@PathVariable Long dictId) |
| | | { |
| | | public AjaxResult<SysDictType> getInfo(@PathVariable Long dictId) { |
| | | return AjaxResult.success(dictTypeService.selectDictTypeById(dictId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增字典类型 |
| | | */ |
| | | @ApiOperation("新增字典类型") |
| | | @PreAuthorize("@ss.hasPermi('system:dict:add')") |
| | | @Log(title = "字典类型", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysDictType dict) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) |
| | | { |
| | | public AjaxResult<Void> add(@Validated @RequestBody SysDictType dict) { |
| | | if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { |
| | | return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); |
| | | } |
| | | dict.setCreateBy(getUsername()); |
| | |
| | | /** |
| | | * 修改字典类型 |
| | | */ |
| | | @ApiOperation("修改字典类型") |
| | | @PreAuthorize("@ss.hasPermi('system:dict:edit')") |
| | | @Log(title = "字典类型", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysDictType dict) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) |
| | | { |
| | | public AjaxResult<Void> edit(@Validated @RequestBody SysDictType dict) { |
| | | if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { |
| | | return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); |
| | | } |
| | | dict.setUpdateBy(getUsername()); |
| | |
| | | /** |
| | | * 删除字典类型 |
| | | */ |
| | | @ApiOperation("删除字典类型") |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "字典类型", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictIds}") |
| | | public AjaxResult remove(@PathVariable Long[] dictIds) |
| | | { |
| | | public AjaxResult<Void> remove(@PathVariable Long[] dictIds) { |
| | | dictTypeService.deleteDictTypeByIds(dictIds); |
| | | return success(); |
| | | } |
| | |
| | | /** |
| | | * 刷新字典缓存 |
| | | */ |
| | | @ApiOperation("刷新字典缓存") |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "字典类型", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public AjaxResult refreshCache() |
| | | { |
| | | public AjaxResult<Void> refreshCache() { |
| | | dictTypeService.resetDictCache(); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | /** |
| | | * 获取字典选择框列表 |
| | | */ |
| | | @ApiOperation("获取字典选择框列表") |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult optionselect() |
| | | { |
| | | public AjaxResult<List<SysDictType>> optionselect() { |
| | | List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll(); |
| | | return AjaxResult.success(dictTypes); |
| | | } |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * 首页 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Api(value = "首页控制器", tags = {"首页管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | public class SysIndexController |
| | | { |
| | | /** 系统基础配置 */ |
| | | @Autowired |
| | | private RuoYiConfig ruoyiConfig; |
| | | public class SysIndexController { |
| | | |
| | | /** |
| | | * 系统基础配置 |
| | | */ |
| | | private final RuoYiConfig ruoyiConfig; |
| | | |
| | | /** |
| | | * 访问首页,提示语 |
| | | */ |
| | | @RequestMapping("/") |
| | | public String index() |
| | | { |
| | | @ApiOperation("访问首页,提示语") |
| | | @GetMapping("/") |
| | | public String index() { |
| | | return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion()); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginBody; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.system.domain.vo.RouterVo; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | import com.ruoyi.system.service.SysLoginService; |
| | | import com.ruoyi.system.service.SysPermissionService; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | /** |
| | | * 登录验证 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Validated |
| | | @Api(value = "数据字典信息控制器", tags = {"数据字典信息管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | public class SysLoginController |
| | | { |
| | | @Autowired |
| | | private SysLoginService loginService; |
| | | public class SysLoginController { |
| | | |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | |
| | | @Autowired |
| | | private SysPermissionService permissionService; |
| | | private final SysLoginService loginService; |
| | | private final ISysMenuService menuService; |
| | | private final SysPermissionService permissionService; |
| | | |
| | | /** |
| | | * 登录方法 |
| | |
| | | * @param loginBody 登录信息 |
| | | * @return 结果 |
| | | */ |
| | | @ApiOperation("登录方法") |
| | | @PostMapping("/login") |
| | | public AjaxResult login(@RequestBody LoginBody loginBody) |
| | | { |
| | | Map<String,Object> ajax = new HashMap<>(); |
| | | public AjaxResult<Map<String, Object>> login(@RequestBody LoginBody loginBody) { |
| | | Map<String, Object> ajax = new HashMap<>(); |
| | | // 生成令牌 |
| | | String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), |
| | | loginBody.getUuid()); |
| | |
| | | * |
| | | * @return 用户信息 |
| | | */ |
| | | @ApiOperation("获取用户信息") |
| | | @GetMapping("getInfo") |
| | | public AjaxResult getInfo() |
| | | { |
| | | public AjaxResult<Map<String, Object>> getInfo() { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | // 角色集合 |
| | | Set<String> roles = permissionService.getRolePermission(user); |
| | | // 权限集合 |
| | | Set<String> permissions = permissionService.getMenuPermission(user); |
| | | Map<String,Object> ajax = new HashMap<>(); |
| | | Map<String, Object> ajax = new HashMap<>(); |
| | | ajax.put("user", user); |
| | | ajax.put("roles", roles); |
| | | ajax.put("permissions", permissions); |
| | |
| | | * |
| | | * @return 路由信息 |
| | | */ |
| | | @ApiOperation("获取路由信息") |
| | | @GetMapping("getRouters") |
| | | public AjaxResult getRouters() |
| | | { |
| | | public AjaxResult<List<RouterVo>> getRouters() { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId); |
| | | return AjaxResult.success(menuService.buildMenus(menus)); |
| | |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.TreeSelect; |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | /** |
| | | * 菜单信息 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Validated |
| | | @Api(value = "菜单信息控制器", tags = {"菜单信息管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | @RequestMapping("/system/menu") |
| | | public class SysMenuController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | public class SysMenuController extends BaseController { |
| | | |
| | | private final ISysMenuService menuService; |
| | | |
| | | /** |
| | | * 获取菜单列表 |
| | | */ |
| | | @ApiOperation("获取菜单列表") |
| | | @PreAuthorize("@ss.hasPermi('system:menu:list')") |
| | | @GetMapping("/list") |
| | | public AjaxResult list(SysMenu menu) |
| | | { |
| | | public AjaxResult<List<SysMenu>> list(SysMenu menu) { |
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); |
| | | return AjaxResult.success(menus); |
| | | } |
| | |
| | | /** |
| | | * 根据菜单编号获取详细信息 |
| | | */ |
| | | @ApiOperation("根据菜单编号获取详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:menu:query')") |
| | | @GetMapping(value = "/{menuId}") |
| | | public AjaxResult getInfo(@PathVariable Long menuId) |
| | | { |
| | | public AjaxResult<SysMenu> getInfo(@PathVariable Long menuId) { |
| | | return AjaxResult.success(menuService.selectMenuById(menuId)); |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单下拉树列表 |
| | | */ |
| | | @ApiOperation("获取菜单下拉树列表") |
| | | @GetMapping("/treeselect") |
| | | public AjaxResult treeselect(SysMenu menu) |
| | | { |
| | | public AjaxResult<List<TreeSelect>> treeselect(SysMenu menu) { |
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); |
| | | return AjaxResult.success(menuService.buildMenuTreeSelect(menus)); |
| | | } |
| | |
| | | /** |
| | | * 加载对应角色菜单列表树 |
| | | */ |
| | | @ApiOperation("加载对应角色菜单列表树") |
| | | @GetMapping(value = "/roleMenuTreeselect/{roleId}") |
| | | public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(getUserId()); |
| | | Map<String,Object> ajax = new HashMap<>(); |
| | | public AjaxResult<Map<String, Object>> roleMenuTreeselect(@PathVariable("roleId") Long roleId) { |
| | | List<SysMenu> menus = menuService.selectMenuList(getUserId()); |
| | | Map<String, Object> ajax = new HashMap<>(); |
| | | ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); |
| | | ajax.put("menus", menuService.buildMenuTreeSelect(menus)); |
| | | return AjaxResult.success(ajax); |
| | |
| | | /** |
| | | * 新增菜单 |
| | | */ |
| | | @ApiOperation("新增菜单") |
| | | @PreAuthorize("@ss.hasPermi('system:menu:add')") |
| | | @Log(title = "菜单管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysMenu menu) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) |
| | | { |
| | | public AjaxResult<Void> add(@Validated @RequestBody SysMenu menu) { |
| | | if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) { |
| | | return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); |
| | | } |
| | | else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) |
| | | { |
| | | } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { |
| | | return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); |
| | | } |
| | | menu.setCreateBy(getUsername()); |
| | |
| | | /** |
| | | * 修改菜单 |
| | | */ |
| | | @ApiOperation("修改菜单") |
| | | @PreAuthorize("@ss.hasPermi('system:menu:edit')") |
| | | @Log(title = "菜单管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysMenu menu) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) |
| | | { |
| | | public AjaxResult<Void> edit(@Validated @RequestBody SysMenu menu) { |
| | | if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) { |
| | | return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); |
| | | } |
| | | else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) |
| | | { |
| | | } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { |
| | | return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); |
| | | } |
| | | else if (menu.getMenuId().equals(menu.getParentId())) |
| | | { |
| | | } else if (menu.getMenuId().equals(menu.getParentId())) { |
| | | return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己"); |
| | | } |
| | | menu.setUpdateBy(getUsername()); |
| | |
| | | /** |
| | | * 删除菜单 |
| | | */ |
| | | @ApiOperation("删除菜单") |
| | | @PreAuthorize("@ss.hasPermi('system:menu:remove')") |
| | | @Log(title = "菜单管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{menuId}") |
| | | public AjaxResult remove(@PathVariable("menuId") Long menuId) |
| | | { |
| | | if (menuService.hasChildByMenuId(menuId)) |
| | | { |
| | | public AjaxResult<Void> remove(@PathVariable("menuId") Long menuId) { |
| | | if (menuService.hasChildByMenuId(menuId)) { |
| | | return AjaxResult.error("存在子菜单,不允许删除"); |
| | | } |
| | | if (menuService.checkMenuExistRole(menuId)) |
| | | { |
| | | if (menuService.checkMenuExistRole(menuId)) { |
| | | return AjaxResult.error("菜单已分配,不允许删除"); |
| | | } |
| | | return toAjax(menuService.deleteMenuById(menuId)); |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.domain.SysNotice; |
| | | import com.ruoyi.system.service.ISysNoticeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * 公告 信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Validated |
| | | @Api(value = "公告信息控制器", tags = {"公告信息管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | @RequestMapping("/system/notice") |
| | | public class SysNoticeController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysNoticeService noticeService; |
| | | public class SysNoticeController extends BaseController { |
| | | |
| | | private final ISysNoticeService noticeService; |
| | | |
| | | /** |
| | | * 获取通知公告列表 |
| | | */ |
| | | @ApiOperation("获取通知公告列表") |
| | | @PreAuthorize("@ss.hasPermi('system:notice:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysNotice notice) |
| | | { |
| | | public TableDataInfo<SysNotice> list(SysNotice notice) { |
| | | return noticeService.selectPageNoticeList(notice); |
| | | } |
| | | |
| | | /** |
| | | * 根据通知公告编号获取详细信息 |
| | | */ |
| | | @ApiOperation("根据通知公告编号获取详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:notice:query')") |
| | | @GetMapping(value = "/{noticeId}") |
| | | public AjaxResult getInfo(@PathVariable Long noticeId) |
| | | { |
| | | public AjaxResult<SysNotice> getInfo(@PathVariable Long noticeId) { |
| | | return AjaxResult.success(noticeService.selectNoticeById(noticeId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增通知公告 |
| | | */ |
| | | @ApiOperation("新增通知公告") |
| | | @PreAuthorize("@ss.hasPermi('system:notice:add')") |
| | | @Log(title = "通知公告", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysNotice notice) |
| | | { |
| | | public AjaxResult<Void> add(@Validated @RequestBody SysNotice notice) { |
| | | notice.setCreateBy(getUsername()); |
| | | return toAjax(noticeService.insertNotice(notice)); |
| | | } |
| | |
| | | /** |
| | | * 修改通知公告 |
| | | */ |
| | | @ApiOperation("修改通知公告") |
| | | @PreAuthorize("@ss.hasPermi('system:notice:edit')") |
| | | @Log(title = "通知公告", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysNotice notice) |
| | | { |
| | | public AjaxResult<Void> edit(@Validated @RequestBody SysNotice notice) { |
| | | notice.setUpdateBy(getUsername()); |
| | | return toAjax(noticeService.updateNotice(notice)); |
| | | } |
| | |
| | | /** |
| | | * 删除通知公告 |
| | | */ |
| | | @ApiOperation("删除通知公告") |
| | | @PreAuthorize("@ss.hasPermi('system:notice:remove')") |
| | | @Log(title = "通知公告", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{noticeIds}") |
| | | public AjaxResult remove(@PathVariable Long[] noticeIds) |
| | | { |
| | | public AjaxResult<Void> remove(@PathVariable Long[] noticeIds) { |
| | | return toAjax(noticeService.deleteNoticeByIds(noticeIds)); |
| | | } |
| | | } |
| | |
| | | @RequestMapping("/system/oss/config") |
| | | public class SysOssConfigController extends BaseController { |
| | | |
| | | private final ISysOssConfigService iSysOssConfigService; |
| | | private final ISysOssConfigService iSysOssConfigService; |
| | | |
| | | /** |
| | | * 查询对象存储配置列表 |
| | | */ |
| | | @ApiOperation("查询对象存储配置列表") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<SysOssConfigVo> list(@Validated(QueryGroup.class) SysOssConfigBo bo) { |
| | | return iSysOssConfigService.queryPageList(bo); |
| | | } |
| | | /** |
| | | * 查询对象存储配置列表 |
| | | */ |
| | | @ApiOperation("查询对象存储配置列表") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<SysOssConfigVo> list(@Validated(QueryGroup.class) SysOssConfigBo bo) { |
| | | return iSysOssConfigService.queryPageList(bo); |
| | | } |
| | | |
| | | /** |
| | | * 获取对象存储配置详细信息 |
| | | */ |
| | | @ApiOperation("获取对象存储配置详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:query')") |
| | | @GetMapping("/{ossConfigId}") |
| | | public AjaxResult<SysOssConfigVo> getInfo(@NotNull(message = "主键不能为空") |
| | | @PathVariable("ossConfigId") Integer ossConfigId) { |
| | | return AjaxResult.success(iSysOssConfigService.queryById(ossConfigId)); |
| | | } |
| | | /** |
| | | * 获取对象存储配置详细信息 |
| | | */ |
| | | @ApiOperation("获取对象存储配置详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:query')") |
| | | @GetMapping("/{ossConfigId}") |
| | | public AjaxResult<SysOssConfigVo> getInfo(@NotNull(message = "主键不能为空") |
| | | @PathVariable("ossConfigId") Integer ossConfigId) { |
| | | return AjaxResult.success(iSysOssConfigService.queryById(ossConfigId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增对象存储配置 |
| | | */ |
| | | @ApiOperation("新增对象存储配置") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:add')") |
| | | @Log(title = "对象存储配置", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody SysOssConfigBo bo) { |
| | | return toAjax(iSysOssConfigService.insertByBo(bo) ? 1 : 0); |
| | | } |
| | | /** |
| | | * 新增对象存储配置 |
| | | */ |
| | | @ApiOperation("新增对象存储配置") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:add')") |
| | | @Log(title = "对象存储配置", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody SysOssConfigBo bo) { |
| | | return toAjax(iSysOssConfigService.insertByBo(bo) ? 1 : 0); |
| | | } |
| | | |
| | | /** |
| | | * 修改对象存储配置 |
| | | */ |
| | | @ApiOperation("修改对象存储配置") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:edit')") |
| | | @Log(title = "对象存储配置", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody SysOssConfigBo bo) { |
| | | return toAjax(iSysOssConfigService.updateByBo(bo) ? 1 : 0); |
| | | } |
| | | /** |
| | | * 修改对象存储配置 |
| | | */ |
| | | @ApiOperation("修改对象存储配置") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:edit')") |
| | | @Log(title = "对象存储配置", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody SysOssConfigBo bo) { |
| | | return toAjax(iSysOssConfigService.updateByBo(bo) ? 1 : 0); |
| | | } |
| | | |
| | | /** |
| | | * 删除对象存储配置 |
| | | */ |
| | | @ApiOperation("删除对象存储配置") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:remove')") |
| | | @Log(title = "对象存储配置", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ossConfigIds}") |
| | | public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空") |
| | | @PathVariable Long[] ossConfigIds) { |
| | | return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true) ? 1 : 0); |
| | | } |
| | | /** |
| | | * 删除对象存储配置 |
| | | */ |
| | | @ApiOperation("删除对象存储配置") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:remove')") |
| | | @Log(title = "对象存储配置", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ossConfigIds}") |
| | | public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空") |
| | | @PathVariable Long[] ossConfigIds) { |
| | | return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true) ? 1 : 0); |
| | | } |
| | | |
| | | /** |
| | | * 状态修改 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:oss:edit')") |
| | | @Log(title = "对象存储状态修改", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody SysOssConfigBo bo) { |
| | | return toAjax(iSysOssConfigService.updateOssConfigStatus(bo)); |
| | | } |
| | | /** |
| | | * 状态修改 |
| | | */ |
| | | @ApiOperation("状态修改") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:edit')") |
| | | @Log(title = "对象存储状态修改", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public AjaxResult<Void> changeStatus(@RequestBody SysOssConfigBo bo) { |
| | | return toAjax(iSysOssConfigService.updateOssConfigStatus(bo)); |
| | | } |
| | | } |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | |
| | | @RequestMapping("/system/oss") |
| | | public class SysOssController extends BaseController { |
| | | |
| | | private final ISysOssService iSysOssService; |
| | | private final ISysConfigService iSysConfigService; |
| | | private final ISysOssService iSysOssService; |
| | | private final ISysConfigService iSysConfigService; |
| | | |
| | | /** |
| | | * 查询OSS对象存储列表 |
| | | */ |
| | | @ApiOperation("查询OSS对象存储列表") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<SysOssVo> list(@Validated(QueryGroup.class) SysOssBo bo) { |
| | | return iSysOssService.queryPageList(bo); |
| | | } |
| | | /** |
| | | * 查询OSS对象存储列表 |
| | | */ |
| | | @ApiOperation("查询OSS对象存储列表") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<SysOssVo> list(@Validated(QueryGroup.class) SysOssBo bo) { |
| | | return iSysOssService.queryPageList(bo); |
| | | } |
| | | |
| | | /** |
| | | * 上传OSS对象存储 |
| | | */ |
| | | @ApiOperation("上传OSS对象存储") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file", value = "文件", dataType = "java.io.File", required = true), |
| | | }) |
| | | @PreAuthorize("@ss.hasPermi('system:oss:upload')") |
| | | @Log(title = "OSS对象存储", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit |
| | | @PostMapping("/upload") |
| | | public AjaxResult<Map<String, String>> upload(@RequestPart("file") MultipartFile file) { |
| | | if (ObjectUtil.isNull(file)) { |
| | | throw new ServiceException("上传文件不能为空"); |
| | | } |
| | | SysOss oss = iSysOssService.upload(file); |
| | | Map<String, String> map = new HashMap<>(2); |
| | | map.put("url", oss.getUrl()); |
| | | map.put("fileName", oss.getFileName()); |
| | | return AjaxResult.success(map); |
| | | } |
| | | /** |
| | | * 上传OSS对象存储 |
| | | */ |
| | | @ApiOperation("上传OSS对象存储") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file", value = "文件", dataType = "java.io.File", required = true), |
| | | }) |
| | | @PreAuthorize("@ss.hasPermi('system:oss:upload')") |
| | | @Log(title = "OSS对象存储", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit |
| | | @PostMapping("/upload") |
| | | public AjaxResult<Map<String, String>> upload(@RequestPart("file") MultipartFile file) { |
| | | if (ObjectUtil.isNull(file)) { |
| | | throw new ServiceException("上传文件不能为空"); |
| | | } |
| | | SysOss oss = iSysOssService.upload(file); |
| | | Map<String, String> map = new HashMap<>(2); |
| | | map.put("url", oss.getUrl()); |
| | | map.put("fileName", oss.getFileName()); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | @ApiOperation("下载OSS对象存储") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:download')") |
| | | @GetMapping("/download/{ossId}") |
| | | public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException { |
| | | SysOss sysOss = iSysOssService.getById(ossId); |
| | | if (ObjectUtil.isNull(sysOss)) { |
| | | throw new ServiceException("文件数据不存在!"); |
| | | } |
| | | response.reset(); |
| | | response.addHeader("Access-Control-Allow-Origin", "*"); |
| | | response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
| | | FileUtils.setAttachmentResponseHeader(response, sysOss.getOriginalName()); |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8"); |
| | | long data; |
| | | try { |
| | | data = HttpUtil.download(sysOss.getUrl(), response.getOutputStream(), false); |
| | | } catch (HttpException e) { |
| | | if (e.getMessage().contains("403")) { |
| | | throw new ServiceException("无读取权限, 请在对应的OSS开启'公有读'权限!"); |
| | | } else { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | response.setContentLength(Convert.toInt(data)); |
| | | } |
| | | @ApiOperation("下载OSS对象存储") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:download')") |
| | | @GetMapping("/download/{ossId}") |
| | | public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException { |
| | | SysOss sysOss = iSysOssService.getById(ossId); |
| | | if (ObjectUtil.isNull(sysOss)) { |
| | | throw new ServiceException("文件数据不存在!"); |
| | | } |
| | | response.reset(); |
| | | response.addHeader("Access-Control-Allow-Origin", "*"); |
| | | response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
| | | FileUtils.setAttachmentResponseHeader(response, sysOss.getOriginalName()); |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8"); |
| | | long data; |
| | | try { |
| | | data = HttpUtil.download(sysOss.getUrl(), response.getOutputStream(), false); |
| | | } catch (HttpException e) { |
| | | if (e.getMessage().contains("403")) { |
| | | throw new ServiceException("无读取权限, 请在对应的OSS开启'公有读'权限!"); |
| | | } else { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | response.setContentLength(Convert.toInt(data)); |
| | | } |
| | | |
| | | /** |
| | | * 删除OSS对象存储 |
| | | */ |
| | | @ApiOperation("删除OSS对象存储") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:remove')") |
| | | @Log(title = "OSS对象存储" , businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ossIds}") |
| | | public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空") |
| | | @PathVariable Long[] ossIds) { |
| | | return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0); |
| | | } |
| | | /** |
| | | * 删除OSS对象存储 |
| | | */ |
| | | @ApiOperation("删除OSS对象存储") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:remove')") |
| | | @Log(title = "OSS对象存储", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ossIds}") |
| | | public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空") |
| | | @PathVariable Long[] ossIds) { |
| | | return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0); |
| | | } |
| | | |
| | | /** |
| | | * 变更图片列表预览状态 |
| | | */ |
| | | @ApiOperation("变更图片列表预览状态") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:edit')") |
| | | @Log(title = "OSS对象存储" , businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changePreviewListResource") |
| | | public AjaxResult<Void> changePreviewListResource(@RequestBody String body) { |
| | | Map<String, Boolean> map = JsonUtils.parseMap(body); |
| | | SysConfig config = iSysConfigService.getOne(new LambdaQueryWrapper<SysConfig>() |
| | | .eq(SysConfig::getConfigKey, CloudConstant.PEREVIEW_LIST_RESOURCE_KEY)); |
| | | config.setConfigValue(map.get("previewListResource").toString()); |
| | | return toAjax(iSysConfigService.updateConfig(config)); |
| | | } |
| | | /** |
| | | * 变更图片列表预览状态 |
| | | */ |
| | | @ApiOperation("变更图片列表预览状态") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:edit')") |
| | | @Log(title = "OSS对象存储", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changePreviewListResource") |
| | | public AjaxResult<Void> changePreviewListResource(@RequestBody String body) { |
| | | Map<String, Boolean> map = JsonUtils.parseMap(body); |
| | | SysConfig config = iSysConfigService.getOne(new LambdaQueryWrapper<SysConfig>() |
| | | .eq(SysConfig::getConfigKey, CloudConstant.PEREVIEW_LIST_RESOURCE_KEY)); |
| | | config.setConfigValue(map.get("previewListResource").toString()); |
| | | return toAjax(iSysConfigService.updateConfig(config)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.domain.SysPost; |
| | | import com.ruoyi.system.service.ISysPostService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | /** |
| | | * 岗位信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Validated |
| | | @Api(value = "岗位信息控制器", tags = {"岗位信息管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | @RequestMapping("/system/post") |
| | | public class SysPostController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysPostService postService; |
| | | public class SysPostController extends BaseController { |
| | | |
| | | private final ISysPostService postService; |
| | | |
| | | /** |
| | | * 获取岗位列表 |
| | | */ |
| | | @ApiOperation("获取岗位列表") |
| | | @PreAuthorize("@ss.hasPermi('system:post:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysPost post) |
| | | { |
| | | public TableDataInfo<SysPost> list(SysPost post) { |
| | | return postService.selectPagePostList(post); |
| | | } |
| | | |
| | | @ApiOperation("导出岗位列表") |
| | | @Log(title = "岗位管理", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:post:export')") |
| | | @GetMapping("/export") |
| | | public void export(SysPost post, HttpServletResponse response) |
| | | { |
| | | public void export(SysPost post, HttpServletResponse response) { |
| | | List<SysPost> list = postService.selectPostList(post); |
| | | ExcelUtil.exportExcel(list, "岗位数据", SysPost.class, response); |
| | | ExcelUtil.exportExcel(list, "岗位数据", SysPost.class, response); |
| | | } |
| | | |
| | | /** |
| | | * 根据岗位编号获取详细信息 |
| | | */ |
| | | @ApiOperation("根据岗位编号获取详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:post:query')") |
| | | @GetMapping(value = "/{postId}") |
| | | public AjaxResult getInfo(@PathVariable Long postId) |
| | | { |
| | | public AjaxResult<SysPost> getInfo(@PathVariable Long postId) { |
| | | return AjaxResult.success(postService.selectPostById(postId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增岗位 |
| | | */ |
| | | @ApiOperation("新增岗位") |
| | | @PreAuthorize("@ss.hasPermi('system:post:add')") |
| | | @Log(title = "岗位管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysPost post) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) |
| | | { |
| | | public AjaxResult<Void> add(@Validated @RequestBody SysPost post) { |
| | | if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) { |
| | | return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); |
| | | } |
| | | else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) |
| | | { |
| | | } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) { |
| | | return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |
| | | } |
| | | post.setCreateBy(getUsername()); |
| | |
| | | /** |
| | | * 修改岗位 |
| | | */ |
| | | @ApiOperation("修改岗位") |
| | | @PreAuthorize("@ss.hasPermi('system:post:edit')") |
| | | @Log(title = "岗位管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysPost post) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) |
| | | { |
| | | public AjaxResult<Void> edit(@Validated @RequestBody SysPost post) { |
| | | if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) { |
| | | return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); |
| | | } |
| | | else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) |
| | | { |
| | | } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) { |
| | | return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |
| | | } |
| | | post.setUpdateBy(getUsername()); |
| | |
| | | /** |
| | | * 删除岗位 |
| | | */ |
| | | @ApiOperation("删除岗位") |
| | | @PreAuthorize("@ss.hasPermi('system:post:remove')") |
| | | @Log(title = "岗位管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{postIds}") |
| | | public AjaxResult remove(@PathVariable Long[] postIds) |
| | | { |
| | | public AjaxResult<Void> remove(@PathVariable Long[] postIds) { |
| | | return toAjax(postService.deletePostByIds(postIds)); |
| | | } |
| | | |
| | | /** |
| | | * 获取岗位选择框列表 |
| | | */ |
| | | @ApiOperation("获取岗位选择框列表") |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult optionselect() |
| | | { |
| | | public AjaxResult<List<SysPost>> optionselect() { |
| | | List<SysPost> posts = postService.selectPostAll(); |
| | | return AjaxResult.success(posts); |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.core.service.TokenService; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.domain.SysOss; |
| | | import com.ruoyi.system.service.ISysOssService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.swagger.annotations.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 个人信息 业务处理 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Validated |
| | | @Api(value = "个人信息控制器", tags = {"个人信息管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | @RequestMapping("/system/user/profile") |
| | | public class SysProfileController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | public class SysProfileController extends BaseController { |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | @Autowired |
| | | private ISysOssService iSysOssService; |
| | | private final ISysUserService userService; |
| | | private final TokenService tokenService; |
| | | private final ISysOssService iSysOssService; |
| | | |
| | | /** |
| | | * 个人信息 |
| | | */ |
| | | @ApiOperation("个人信息") |
| | | @GetMapping |
| | | public AjaxResult profile() |
| | | { |
| | | public AjaxResult<Map<String, Object>> profile() { |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysUser user = loginUser.getUser(); |
| | | Map<String,Object> ajax = new HashMap<>(); |
| | | ajax.put("user", user); |
| | | Map<String, Object> ajax = new HashMap<>(); |
| | | ajax.put("user", user); |
| | | ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); |
| | | ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); |
| | | return AjaxResult.success(ajax); |
| | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @ApiOperation("修改用户") |
| | | @Log(title = "个人信息", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult updateProfile(@RequestBody SysUser user) |
| | | { |
| | | public AjaxResult<Void> updateProfile(@RequestBody SysUser user) { |
| | | if (StringUtils.isNotEmpty(user.getPhonenumber()) |
| | | && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) |
| | | { |
| | | && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { |
| | | return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); |
| | | } |
| | | if (StringUtils.isNotEmpty(user.getEmail()) |
| | | && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) |
| | | { |
| | | && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { |
| | | return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); |
| | | } |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysUser sysUser = loginUser.getUser(); |
| | | user.setUserId(sysUser.getUserId()); |
| | | user.setPassword(null); |
| | | if (userService.updateUserProfile(user) > 0) |
| | | { |
| | | if (userService.updateUserProfile(user) > 0) { |
| | | // 更新缓存用户信息 |
| | | sysUser.setNickName(user.getNickName()); |
| | | sysUser.setPhonenumber(user.getPhonenumber()); |
| | |
| | | /** |
| | | * 重置密码 |
| | | */ |
| | | @ApiOperation("重置密码") |
| | | @Log(title = "个人信息", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/updatePwd") |
| | | public AjaxResult updatePwd(String oldPassword, String newPassword) |
| | | { |
| | | public AjaxResult<Void> updatePwd(String oldPassword, String newPassword) { |
| | | LoginUser loginUser = getLoginUser(); |
| | | String userName = loginUser.getUsername(); |
| | | String password = loginUser.getPassword(); |
| | | if (!SecurityUtils.matchesPassword(oldPassword, password)) |
| | | { |
| | | if (!SecurityUtils.matchesPassword(oldPassword, password)) { |
| | | return AjaxResult.error("修改密码失败,旧密码错误"); |
| | | } |
| | | if (SecurityUtils.matchesPassword(newPassword, password)) |
| | | { |
| | | if (SecurityUtils.matchesPassword(newPassword, password)) { |
| | | return AjaxResult.error("新密码不能与旧密码相同"); |
| | | } |
| | | if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) |
| | | { |
| | | if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) { |
| | | // 更新缓存用户密码 |
| | | loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword)); |
| | | tokenService.setLoginUser(loginUser); |
| | |
| | | /** |
| | | * 头像上传 |
| | | */ |
| | | @ApiOperation("头像上传") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file", value = "用户头像", dataType = "java.io.File", required = true), |
| | | }) |
| | | @Log(title = "用户头像", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/avatar") |
| | | public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws IOException |
| | | { |
| | | if (!file.isEmpty()) |
| | | { |
| | | public AjaxResult<Map<String, Object>> avatar(@RequestPart("avatarfile") MultipartFile file) { |
| | | Map<String, Object> ajax = new HashMap<>(); |
| | | if (!file.isEmpty()) { |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysOss oss = iSysOssService.upload(file); |
| | | String avatar = oss.getUrl(); |
| | | if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) |
| | | { |
| | | Map<String,Object> ajax = new HashMap<>(); |
| | | SysOss oss = iSysOssService.upload(file); |
| | | String avatar = oss.getUrl(); |
| | | if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) { |
| | | ajax.put("imgUrl", avatar); |
| | | // 更新缓存用户头像 |
| | | loginUser.getUser().setAvatar(avatar); |
| | |
| | | return AjaxResult.success(ajax); |
| | | } |
| | | } |
| | | return AjaxResult.error("上传图片异常,请联系管理员"); |
| | | return AjaxResult.error("上传图片异常,请联系管理员", ajax); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.model.RegisterBody; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.service.SysRegisterService; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.SysRegisterService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | /** |
| | | * 注册验证 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Validated |
| | | @Api(value = "注册验证控制器", tags = {"注册验证管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | public class SysRegisterController extends BaseController |
| | | { |
| | | @Autowired |
| | | private SysRegisterService registerService; |
| | | public class SysRegisterController extends BaseController { |
| | | |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | private final SysRegisterService registerService; |
| | | private final ISysConfigService configService; |
| | | |
| | | @ApiOperation("用户注册") |
| | | @PostMapping("/register") |
| | | public AjaxResult register(@RequestBody RegisterBody user) |
| | | { |
| | | if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) |
| | | { |
| | | public AjaxResult<Void> register(@RequestBody RegisterBody user) { |
| | | if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) { |
| | | return error("当前系统没有开启注册功能!"); |
| | | } |
| | | String msg = registerService.register(user); |
| | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.core.service.TokenService; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.SysPermissionService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | /** |
| | | * 角色信息 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Validated |
| | | @Api(value = "角色信息控制器", tags = {"角色信息管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | @RequestMapping("/system/role") |
| | | public class SysRoleController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | public class SysRoleController extends BaseController { |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | private final ISysRoleService roleService; |
| | | private final TokenService tokenService; |
| | | private final ISysUserService userService; |
| | | private final SysPermissionService permissionService; |
| | | |
| | | @Autowired |
| | | private SysPermissionService permissionService; |
| | | |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @ApiOperation("查询角色信息列表") |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysRole role) |
| | | { |
| | | public TableDataInfo<SysRole> list(SysRole role) { |
| | | return roleService.selectPageRoleList(role); |
| | | } |
| | | |
| | | @ApiOperation("导出角色信息列表") |
| | | @Log(title = "角色管理", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:role:export')") |
| | | @GetMapping("/export") |
| | | public void export(SysRole role, HttpServletResponse response) |
| | | { |
| | | public void export(SysRole role, HttpServletResponse response) { |
| | | List<SysRole> list = roleService.selectRoleList(role); |
| | | ExcelUtil.exportExcel(list, "角色数据", SysRole.class, response); |
| | | ExcelUtil.exportExcel(list, "角色数据", SysRole.class, response); |
| | | } |
| | | |
| | | /** |
| | | * 根据角色编号获取详细信息 |
| | | */ |
| | | @ApiOperation("根据角色编号获取详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping(value = "/{roleId}") |
| | | public AjaxResult getInfo(@PathVariable Long roleId) |
| | | { |
| | | public AjaxResult<SysRole> getInfo(@PathVariable Long roleId) { |
| | | roleService.checkRoleDataScope(roleId); |
| | | return AjaxResult.success(roleService.selectRoleById(roleId)); |
| | | } |
| | |
| | | /** |
| | | * 新增角色 |
| | | */ |
| | | @ApiOperation("新增角色") |
| | | @PreAuthorize("@ss.hasPermi('system:role:add')") |
| | | @Log(title = "角色管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysRole role) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) |
| | | { |
| | | public AjaxResult<Void> add(@Validated @RequestBody SysRole role) { |
| | | if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) { |
| | | return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); |
| | | } |
| | | else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) |
| | | { |
| | | } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) { |
| | | return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); |
| | | } |
| | | role.setCreateBy(getUsername()); |
| | |
| | | /** |
| | | * 修改保存角色 |
| | | */ |
| | | @ApiOperation("修改保存角色") |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysRole role) |
| | | { |
| | | public AjaxResult<Void> edit(@Validated @RequestBody SysRole role) { |
| | | roleService.checkRoleAllowed(role); |
| | | if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) { |
| | | return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); |
| | | } |
| | | else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) |
| | | { |
| | | } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) { |
| | | return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); |
| | | } |
| | | role.setUpdateBy(getUsername()); |
| | | |
| | | if (roleService.updateRole(role) > 0) |
| | | { |
| | | if (roleService.updateRole(role) > 0) { |
| | | // 更新缓存用户权限 |
| | | LoginUser loginUser = getLoginUser(); |
| | | if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) |
| | | { |
| | | if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) { |
| | | loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); |
| | | loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); |
| | | tokenService.setLoginUser(loginUser); |
| | |
| | | /** |
| | | * 修改保存数据权限 |
| | | */ |
| | | @ApiOperation("修改保存数据权限") |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/dataScope") |
| | | public AjaxResult dataScope(@RequestBody SysRole role) |
| | | { |
| | | public AjaxResult<Void> dataScope(@RequestBody SysRole role) { |
| | | roleService.checkRoleAllowed(role); |
| | | return toAjax(roleService.authDataScope(role)); |
| | | } |
| | |
| | | /** |
| | | * 状态修改 |
| | | */ |
| | | @ApiOperation("状态修改") |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody SysRole role) |
| | | { |
| | | public AjaxResult<Void> changeStatus(@RequestBody SysRole role) { |
| | | roleService.checkRoleAllowed(role); |
| | | role.setUpdateBy(getUsername()); |
| | | return toAjax(roleService.updateRoleStatus(role)); |
| | |
| | | /** |
| | | * 删除角色 |
| | | */ |
| | | @ApiOperation("删除角色") |
| | | @PreAuthorize("@ss.hasPermi('system:role:remove')") |
| | | @Log(title = "角色管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{roleIds}") |
| | | public AjaxResult remove(@PathVariable Long[] roleIds) |
| | | { |
| | | public AjaxResult<Void> remove(@PathVariable Long[] roleIds) { |
| | | return toAjax(roleService.deleteRoleByIds(roleIds)); |
| | | } |
| | | |
| | | /** |
| | | * 获取角色选择框列表 |
| | | */ |
| | | @ApiOperation("获取角色选择框列表") |
| | | @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult optionselect() |
| | | { |
| | | public AjaxResult<List<SysRole>> optionselect() { |
| | | return AjaxResult.success(roleService.selectRoleAll()); |
| | | } |
| | | |
| | | /** |
| | | * 查询已分配用户角色列表 |
| | | */ |
| | | @ApiOperation("查询已分配用户角色列表") |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/authUser/allocatedList") |
| | | public TableDataInfo allocatedList(SysUser user) |
| | | { |
| | | return userService.selectAllocatedList(user); |
| | | public TableDataInfo<SysUser> allocatedList(SysUser user) { |
| | | return userService.selectAllocatedList(user); |
| | | } |
| | | |
| | | /** |
| | | * 查询未分配用户角色列表 |
| | | */ |
| | | @ApiOperation("查询未分配用户角色列表") |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/authUser/unallocatedList") |
| | | public TableDataInfo unallocatedList(SysUser user) |
| | | { |
| | | public TableDataInfo<SysUser> unallocatedList(SysUser user) { |
| | | return userService.selectUnallocatedList(user); |
| | | } |
| | | |
| | | /** |
| | | * 取消授权用户 |
| | | */ |
| | | @ApiOperation("取消授权用户") |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancel") |
| | | public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) |
| | | { |
| | | public AjaxResult<Void> cancelAuthUser(@RequestBody SysUserRole userRole) { |
| | | return toAjax(roleService.deleteAuthUser(userRole)); |
| | | } |
| | | |
| | | /** |
| | | * 批量取消授权用户 |
| | | */ |
| | | @ApiOperation("批量取消授权用户") |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancelAll") |
| | | public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) |
| | | { |
| | | public AjaxResult<Void> cancelAuthUserAll(Long roleId, Long[] userIds) { |
| | | return toAjax(roleService.deleteAuthUsers(roleId, userIds)); |
| | | } |
| | | |
| | | /** |
| | | * 批量选择用户授权 |
| | | */ |
| | | @ApiOperation("批量选择用户授权") |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/selectAll") |
| | | public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) |
| | | { |
| | | public AjaxResult<Void> selectAuthUserAll(Long roleId, Long[] userIds) { |
| | | return toAjax(roleService.insertAuthUsers(roleId, userIds)); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.system.service.ISysPostService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | /** |
| | | * 用户信息 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Validated |
| | | @Api(value = "用户信息控制器", tags = {"用户信息管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | @RequestMapping("/system/user") |
| | | public class SysUserController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | public class SysUserController extends BaseController { |
| | | |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | |
| | | @Autowired |
| | | private ISysPostService postService; |
| | | private final ISysUserService userService; |
| | | private final ISysRoleService roleService; |
| | | private final ISysPostService postService; |
| | | |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | | @ApiOperation("获取用户列表") |
| | | @PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysUser user) |
| | | { |
| | | public TableDataInfo<SysUser> list(SysUser user) { |
| | | return userService.selectPageUserList(user); |
| | | } |
| | | |
| | | @ApiOperation("导出用户列表") |
| | | @Log(title = "用户管理", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:user:export')") |
| | | @GetMapping("/export") |
| | | public void export(SysUser user, HttpServletResponse response) |
| | | { |
| | | public void export(SysUser user, HttpServletResponse response) { |
| | | List<SysUser> list = userService.selectUserList(user); |
| | | List<SysUserExportVo> listVo = BeanUtil.copyToList(list, SysUserExportVo.class); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | SysDept dept = list.get(i).getDept(); |
| | | SysUserExportVo vo = listVo.get(i); |
| | | if (ObjectUtil.isNotEmpty(dept)) { |
| | | vo.setDeptName(dept.getDeptName()); |
| | | vo.setLeader(dept.getLeader()); |
| | | } |
| | | } |
| | | ExcelUtil.exportExcel(listVo, "用户数据", SysUserExportVo.class, response); |
| | | List<SysUserExportVo> listVo = BeanUtil.copyToList(list, SysUserExportVo.class); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | SysDept dept = list.get(i).getDept(); |
| | | SysUserExportVo vo = listVo.get(i); |
| | | if (ObjectUtil.isNotEmpty(dept)) { |
| | | vo.setDeptName(dept.getDeptName()); |
| | | vo.setLeader(dept.getLeader()); |
| | | } |
| | | } |
| | | ExcelUtil.exportExcel(listVo, "用户数据", SysUserExportVo.class, response); |
| | | } |
| | | |
| | | @ApiOperation("导入用户列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file", value = "导入文件", dataType = "java.io.File", required = true), |
| | | }) |
| | | @Log(title = "用户管理", businessType = BusinessType.IMPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:user:import')") |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception |
| | | { |
| | | List<SysUserImportVo> userListVo = ExcelUtil.importExcel(file.getInputStream(), SysUserImportVo.class); |
| | | List<SysUser> userList = BeanUtil.copyToList(userListVo, SysUser.class); |
| | | public AjaxResult<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception { |
| | | List<SysUserImportVo> userListVo = ExcelUtil.importExcel(file.getInputStream(), SysUserImportVo.class); |
| | | List<SysUser> userList = BeanUtil.copyToList(userListVo, SysUser.class); |
| | | String operName = getUsername(); |
| | | String message = userService.importUser(userList, updateSupport, operName); |
| | | return AjaxResult.success(message); |
| | | } |
| | | |
| | | @ApiOperation("下载导入模板") |
| | | @GetMapping("/importTemplate") |
| | | public void importTemplate(HttpServletResponse response) |
| | | { |
| | | ExcelUtil.exportExcel(new ArrayList<>(), "用户数据", SysUserImportVo.class, response); |
| | | public void importTemplate(HttpServletResponse response) { |
| | | ExcelUtil.exportExcel(new ArrayList<>(), "用户数据", SysUserImportVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户编号获取详细信息 |
| | | */ |
| | | @ApiOperation("根据用户编号获取详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:user:query')") |
| | | @GetMapping(value = { "/", "/{userId}" }) |
| | | public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) |
| | | { |
| | | userService.checkUserDataScope(userId); |
| | | @GetMapping(value = {"/", "/{userId}"}) |
| | | public AjaxResult<Map<String, Object>> getInfo(@PathVariable(value = "userId", required = false) Long userId) { |
| | | userService.checkUserDataScope(userId); |
| | | Map<String, Object> ajax = new HashMap<>(); |
| | | List<SysRole> roles = roleService.selectRoleAll(); |
| | | ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
| | | ajax.put("posts", postService.selectPostAll()); |
| | | if (StringUtils.isNotNull(userId)) |
| | | { |
| | | if (StringUtils.isNotNull(userId)) { |
| | | ajax.put("user", userService.selectUserById(userId)); |
| | | ajax.put("postIds", postService.selectPostListByUserId(userId)); |
| | | ajax.put("roleIds", roleService.selectRoleListByUserId(userId)); |
| | |
| | | /** |
| | | * 新增用户 |
| | | */ |
| | | @ApiOperation("新增用户") |
| | | @PreAuthorize("@ss.hasPermi('system:user:add')") |
| | | @Log(title = "用户管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysUser user) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) |
| | | { |
| | | public AjaxResult<Void> add(@Validated @RequestBody SysUser user) { |
| | | if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) { |
| | | return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) |
| | | && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) |
| | | { |
| | | } else if (StringUtils.isNotEmpty(user.getPhonenumber()) |
| | | && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { |
| | | return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getEmail()) |
| | | && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) |
| | | { |
| | | } else if (StringUtils.isNotEmpty(user.getEmail()) |
| | | && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { |
| | | return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); |
| | | } |
| | | user.setCreateBy(getUsername()); |
| | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @ApiOperation("修改用户") |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysUser user) |
| | | { |
| | | public AjaxResult<Void> edit(@Validated @RequestBody SysUser user) { |
| | | userService.checkUserAllowed(user); |
| | | if (StringUtils.isNotEmpty(user.getPhonenumber()) |
| | | && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) |
| | | { |
| | | && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { |
| | | return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getEmail()) |
| | | && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) |
| | | { |
| | | } else if (StringUtils.isNotEmpty(user.getEmail()) |
| | | && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { |
| | | return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); |
| | | } |
| | | user.setUpdateBy(getUsername()); |
| | |
| | | /** |
| | | * 删除用户 |
| | | */ |
| | | @ApiOperation("删除用户") |
| | | @PreAuthorize("@ss.hasPermi('system:user:remove')") |
| | | @Log(title = "用户管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{userIds}") |
| | | public AjaxResult remove(@PathVariable Long[] userIds) |
| | | { |
| | | if (ArrayUtil.contains(userIds, getUserId())) |
| | | { |
| | | public AjaxResult<Void> remove(@PathVariable Long[] userIds) { |
| | | if (ArrayUtil.contains(userIds, getUserId())) { |
| | | return error("当前用户不能删除"); |
| | | } |
| | | return toAjax(userService.deleteUserByIds(userIds)); |
| | |
| | | /** |
| | | * 重置密码 |
| | | */ |
| | | @ApiOperation("重置密码") |
| | | @PreAuthorize("@ss.hasPermi('system:user:resetPwd')") |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/resetPwd") |
| | | public AjaxResult resetPwd(@RequestBody SysUser user) |
| | | { |
| | | public AjaxResult<Void> resetPwd(@RequestBody SysUser user) { |
| | | userService.checkUserAllowed(user); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setUpdateBy(getUsername()); |
| | |
| | | /** |
| | | * 状态修改 |
| | | */ |
| | | @ApiOperation("状态修改") |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody SysUser user) |
| | | { |
| | | public AjaxResult<Void> changeStatus(@RequestBody SysUser user) { |
| | | userService.checkUserAllowed(user); |
| | | user.setUpdateBy(getUsername()); |
| | | return toAjax(userService.updateUserStatus(user)); |
| | |
| | | /** |
| | | * 根据用户编号获取授权角色 |
| | | */ |
| | | @ApiOperation("根据用户编号获取授权角色") |
| | | @PreAuthorize("@ss.hasPermi('system:user:query')") |
| | | @GetMapping("/authRole/{userId}") |
| | | public AjaxResult authRole(@PathVariable("userId") Long userId) |
| | | { |
| | | public AjaxResult<Map<String, Object>> authRole(@PathVariable("userId") Long userId) { |
| | | SysUser user = userService.selectUserById(userId); |
| | | List<SysRole> roles = roleService.selectRolesByUserId(userId); |
| | | Map<String, Object> ajax = new HashMap<>(); |
| | | Map<String, Object> ajax = new HashMap<>(); |
| | | ajax.put("user", user); |
| | | ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
| | | return AjaxResult.success(ajax); |
| | |
| | | /** |
| | | * 用户授权角色 |
| | | */ |
| | | @ApiOperation("用户授权角色") |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "用户管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authRole") |
| | | public AjaxResult insertAuthRole(Long userId, Long[] roleIds) |
| | | { |
| | | public AjaxResult<Void> insertAuthRole(Long userId, Long[] roleIds) { |
| | | userService.insertUserAuth(userId, roleIds); |
| | | return success(); |
| | | } |
| | |
| | | email: crazylionli@163.com |
| | | url: https://gitee.com/JavaLionLi/RuoYi-Vue-Plus |
| | | groups: |
| | | - name: 代码生成模块 |
| | | basePackage: com.ruoyi.generator |
| | | - name: 演示案例 |
| | | basePackage: com.ruoyi.demo |
| | | - name: 系统模块 |
| | | basePackage: com.ruoyi.admin |
| | | basePackage: com.ruoyi.web |
| | | |
| | | # 防止XSS攻击 |
| | | xss: |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | /** |
| | | * 读取项目相关配置 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | @Component |
| | | @ConfigurationProperties(prefix = "ruoyi") |
| | | public class RuoYiConfig |
| | | { |
| | | /** 项目名称 */ |
| | | public class RuoYiConfig { |
| | | |
| | | /** |
| | | * 项目名称 |
| | | */ |
| | | private String name; |
| | | |
| | | /** 版本 */ |
| | | /** |
| | | * 版本 |
| | | */ |
| | | private String version; |
| | | |
| | | /** 版权年份 */ |
| | | /** |
| | | * 版权年份 |
| | | */ |
| | | private String copyrightYear; |
| | | |
| | | /** 实例演示开关 */ |
| | | /** |
| | | * 实例演示开关 |
| | | */ |
| | | private boolean demoEnabled; |
| | | |
| | | /** 获取地址开关 */ |
| | | /** |
| | | * 获取地址开关 |
| | | */ |
| | | @Getter |
| | | private static boolean addressEnabled; |
| | | |
| | | public void setAddressEnabled(boolean addressEnabled) |
| | | { |
| | | public void setAddressEnabled(boolean addressEnabled) { |
| | | RuoYiConfig.addressEnabled = addressEnabled; |
| | | } |
| | | |
| | |
| | | "update_time", "remark", "version" }; |
| | | |
| | | /** Entity基类字段 */ |
| | | public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" }; |
| | | public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime" }; |
| | | |
| | | /** Tree基类字段 */ |
| | | public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" }; |
| | | public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "children" }; |
| | | |
| | | /** 文本框 */ |
| | | public static final String HTML_INPUT = "input"; |
| | |
| | | package com.ruoyi.common.core.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | /** |
| | | * Entity基类 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | public class BaseEntity implements Serializable { |
| | | |
| | |
| | | * 搜索值 |
| | | */ |
| | | @ApiModelProperty(value = "搜索值") |
| | | @TableField(exist = false) |
| | | private String searchValue; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @ApiModelProperty(value = "创建者") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新者 |
| | | */ |
| | | @ApiModelProperty(value = "更新者") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @ApiModelProperty(value = "更新时间") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @JsonIgnore |
| | | @ApiModelProperty(value = "请求参数") |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params = new HashMap<>(); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.common.core.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | /** |
| | | * Tree基类 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | @NoArgsConstructor |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | public class TreeEntity extends BaseEntity { |
| | | |
| | |
| | | /** |
| | | * 父菜单名称 |
| | | */ |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "父菜单名称") |
| | | private String parentName; |
| | | |
| | |
| | | * 显示顺序 |
| | | */ |
| | | @ApiModelProperty(value = "显示顺序") |
| | | private Integer orderNum; |
| | | |
| | | /** |
| | | * 祖级列表 |
| | | */ |
| | | @ApiModelProperty(value = "祖级列表") |
| | | private String ancestors; |
| | | private String orderNum; |
| | | |
| | | /** |
| | | * 子部门 |
| | | */ |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "子部门") |
| | | private List<?> children = new ArrayList<>(); |
| | | |
| | |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | | import lombok.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | |
| | | /** |
| | | * Treeselect树结构实体类 |
| | | * |
| | | * @author ruoyi |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | public class TreeSelect implements Serializable |
| | | { |
| | | @ApiModel("树结构实体类") |
| | | public class TreeSelect implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 节点ID */ |
| | | /** |
| | | * 节点ID |
| | | */ |
| | | @ApiModelProperty(value = "节点ID") |
| | | private Long id; |
| | | |
| | | /** 节点名称 */ |
| | | /** |
| | | * 节点名称 |
| | | */ |
| | | @ApiModelProperty(value = "节点名称") |
| | | private String label; |
| | | |
| | | /** 子节点 */ |
| | | /** |
| | | * 子节点 |
| | | */ |
| | | @ApiModelProperty(value = "子节点") |
| | | @JsonInclude(JsonInclude.Include.NON_EMPTY) |
| | | private List<TreeSelect> children; |
| | | |
| | | public TreeSelect(SysDept dept) |
| | | { |
| | | public TreeSelect(SysDept dept) { |
| | | this.id = dept.getDeptId(); |
| | | this.label = dept.getDeptName(); |
| | | this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); |
| | | this.children = dept.getChildren() |
| | | .stream() |
| | | .map(d -> new TreeSelect((SysDept) d)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | public TreeSelect(SysMenu menu) |
| | | { |
| | | public TreeSelect(SysMenu menu) { |
| | | this.id = menu.getMenuId(); |
| | | this.label = menu.getMenuName(); |
| | | this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); |
| | | this.children = menu.getChildren() |
| | | .stream() |
| | | .map(d -> new TreeSelect((SysMenu) d)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | } |
| | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 操作日志记录表 oper_log |
| | | * 通用操作日志实体 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | public class OperLogDTO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | |
| | | package com.ruoyi.common.core.domain.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.domain.TreeEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.Email; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import java.io.Serializable; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 部门表 sys_dept |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | @TableName("sys_dept") |
| | | public class SysDept implements Serializable { |
| | | @ApiModel("部门业务对象") |
| | | public class SysDept extends TreeEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 部门ID |
| | | */ |
| | | @TableId(value = "dept_id", type = IdType.AUTO) |
| | | @ApiModelProperty(value = "部门id") |
| | | @TableId(value = "dept_id") |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * 父部门ID |
| | | */ |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * 祖级列表 |
| | | */ |
| | | private String ancestors; |
| | | |
| | | /** |
| | | * 部门名称 |
| | | */ |
| | | @ApiModelProperty(value = "部门名称") |
| | | @NotBlank(message = "部门名称不能为空") |
| | | @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") |
| | | private String deptName; |
| | |
| | | /** |
| | | * 显示顺序 |
| | | */ |
| | | @ApiModelProperty(value = "显示顺序") |
| | | @NotBlank(message = "显示顺序不能为空") |
| | | private String orderNum; |
| | | |
| | | /** |
| | | * 负责人 |
| | | */ |
| | | @ApiModelProperty(value = "负责人") |
| | | private String leader; |
| | | |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | @ApiModelProperty(value = "联系电话") |
| | | @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") |
| | | private String phone; |
| | | |
| | | /** |
| | | * 邮箱 |
| | | */ |
| | | @ApiModelProperty(value = "邮箱") |
| | | @Email(message = "邮箱格式不正确") |
| | | @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") |
| | | private String email; |
| | |
| | | /** |
| | | * 部门状态:0正常,1停用 |
| | | */ |
| | | @ApiModelProperty(value = "部门状态:0正常,1停用") |
| | | private String status; |
| | | |
| | | /** |
| | | * 删除标志(0代表存在 2代表删除) |
| | | */ |
| | | @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)") |
| | | @TableLogic |
| | | private String delFlag; |
| | | |
| | | /** |
| | | * 父部门名称 |
| | | * 祖级列表 |
| | | */ |
| | | @TableField(exist = false) |
| | | private String parentName; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 子部门 |
| | | */ |
| | | @TableField(exist = false) |
| | | private List<SysDept> children = new ArrayList<SysDept>(); |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params = new HashMap<>(); |
| | | @ApiModelProperty(value = "祖级列表") |
| | | private String ancestors; |
| | | |
| | | } |
| | |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.annotation.ExcelDictFormat; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.convert.ExcelDictConvert; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 字典数据表 sys_dict_data |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | @TableName("sys_dict_data") |
| | | @ExcelIgnoreUnannotated |
| | | public class SysDictData implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | @ApiModel("字典数据业务对象") |
| | | public class SysDictData extends BaseEntity { |
| | | |
| | | /** |
| | | * 字典编码 |
| | | */ |
| | | @ApiModelProperty(value = "字典编码") |
| | | @ExcelProperty(value = "字典编码") |
| | | @TableId(value = "dict_code", type = IdType.AUTO) |
| | | @TableId(value = "dict_code") |
| | | private Long dictCode; |
| | | |
| | | /** |
| | | * 字典排序 |
| | | */ |
| | | @ApiModelProperty(value = "字典排序") |
| | | @ExcelProperty(value = "字典排序") |
| | | private Long dictSort; |
| | | |
| | | /** |
| | | * 字典标签 |
| | | */ |
| | | @ApiModelProperty(value = "字典标签") |
| | | @ExcelProperty(value = "字典标签") |
| | | @NotBlank(message = "字典标签不能为空") |
| | | @Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符") |
| | |
| | | /** |
| | | * 字典键值 |
| | | */ |
| | | @ApiModelProperty(value = "字典键值") |
| | | @ExcelProperty(value = "字典键值") |
| | | @NotBlank(message = "字典键值不能为空") |
| | | @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") |
| | |
| | | /** |
| | | * 字典类型 |
| | | */ |
| | | @ApiModelProperty(value = "字典类型") |
| | | @ExcelProperty(value = "字典类型") |
| | | @NotBlank(message = "字典类型不能为空") |
| | | @Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符") |
| | |
| | | /** |
| | | * 样式属性(其他样式扩展) |
| | | */ |
| | | @ApiModelProperty(value = "样式属性(其他样式扩展)") |
| | | @Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符") |
| | | private String cssClass; |
| | | |
| | | /** |
| | | * 表格字典样式 |
| | | */ |
| | | @ApiModelProperty(value = "表格字典样式") |
| | | private String listClass; |
| | | |
| | | /** |
| | | * 是否默认(Y是 N否) |
| | | */ |
| | | @ApiModelProperty(value = "是否默认(Y是 N否)") |
| | | @ExcelProperty(value = "是否默认", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_yes_no") |
| | | private String isDefault; |
| | |
| | | /** |
| | | * 状态(0正常 1停用) |
| | | */ |
| | | @ApiModelProperty(value = "状态(0正常 1停用)") |
| | | @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_normal_disable") |
| | | private String status; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params = new HashMap<>(); |
| | | |
| | | public boolean getDefault() { |
| | | return UserConstants.YES.equals(this.isDefault) ? true : false; |
| | | return UserConstants.YES.equals(this.isDefault); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.annotation.ExcelDictFormat; |
| | | import com.ruoyi.common.convert.ExcelDictConvert; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 字典类型表 sys_dict_type |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | @TableName("sys_dict_type") |
| | | @ExcelIgnoreUnannotated |
| | | public class SysDictType implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | @ApiModel("字典类型业务对象") |
| | | public class SysDictType extends BaseEntity { |
| | | |
| | | /** |
| | | * 字典主键 |
| | | */ |
| | | @ApiModelProperty(value = "字典主键") |
| | | @ExcelProperty(value = "字典主键") |
| | | @TableId(value = "dict_id", type = IdType.AUTO) |
| | | @TableId(value = "dict_id") |
| | | private Long dictId; |
| | | |
| | | /** |
| | | * 字典名称 |
| | | */ |
| | | @ApiModelProperty(value = "字典名称") |
| | | @ExcelProperty(value = "字典名称") |
| | | @NotBlank(message = "字典名称不能为空") |
| | | @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符") |
| | |
| | | /** |
| | | * 字典类型 |
| | | */ |
| | | @ApiModelProperty(value = "字典类型") |
| | | @ExcelProperty(value = "字典类型") |
| | | @NotBlank(message = "字典类型不能为空") |
| | | @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") |
| | |
| | | /** |
| | | * 状态(0正常 1停用) |
| | | */ |
| | | @ApiModelProperty(value = "状态(0正常 1停用)") |
| | | @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_normal_disable") |
| | | private String status; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params = new HashMap<>(); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.common.core.domain.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.domain.TreeEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import java.io.Serializable; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 菜单权限表 sys_menu |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | @TableName("sys_menu") |
| | | public class SysMenu implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | @ApiModel("菜单权限业务对象") |
| | | public class SysMenu extends TreeEntity { |
| | | |
| | | /** |
| | | * 菜单ID |
| | | */ |
| | | @TableId(value = "menu_id", type = IdType.AUTO) |
| | | @ApiModelProperty(value = "菜单ID") |
| | | @TableId(value = "menu_id") |
| | | private Long menuId; |
| | | |
| | | /** |
| | | * 菜单名称 |
| | | */ |
| | | @ApiModelProperty(value = "菜单名称") |
| | | @NotBlank(message = "菜单名称不能为空") |
| | | @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符") |
| | | private String menuName; |
| | | |
| | | /** |
| | | * 父菜单名称 |
| | | */ |
| | | @TableField(exist = false) |
| | | private String parentName; |
| | | |
| | | /** |
| | | * 父菜单ID |
| | | */ |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * 显示顺序 |
| | | */ |
| | | @ApiModelProperty(value = "显示顺序") |
| | | @NotBlank(message = "显示顺序不能为空") |
| | | private String orderNum; |
| | | |
| | | /** |
| | | * 路由地址 |
| | | */ |
| | | @ApiModelProperty(value = "路由地址") |
| | | @Size(min = 0, max = 200, message = "路由地址不能超过200个字符") |
| | | private String path; |
| | | |
| | | /** |
| | | * 组件路径 |
| | | */ |
| | | @ApiModelProperty(value = "组件路径") |
| | | @Size(min = 0, max = 200, message = "组件路径不能超过255个字符") |
| | | private String component; |
| | | |
| | | /** |
| | | * 路由参数 |
| | | */ |
| | | @ApiModelProperty(value = "路由参数") |
| | | private String query; |
| | | |
| | | /** |
| | | * 是否为外链(0是 1否) |
| | | */ |
| | | @ApiModelProperty(value = "是否为外链(0是 1否)") |
| | | private String isFrame; |
| | | |
| | | /** |
| | | * 是否缓存(0缓存 1不缓存) |
| | | */ |
| | | @ApiModelProperty(value = "是否缓存(0缓存 1不缓存)") |
| | | private String isCache; |
| | | |
| | | /** |
| | | * 类型(M目录 C菜单 F按钮) |
| | | */ |
| | | @ApiModelProperty(value = "类型(M目录 C菜单 F按钮)") |
| | | @NotBlank(message = "菜单类型不能为空") |
| | | private String menuType; |
| | | |
| | | /** |
| | | * 显示状态(0显示 1隐藏) |
| | | */ |
| | | @ApiModelProperty(value = "显示状态(0显示 1隐藏)") |
| | | private String visible; |
| | | |
| | | /** |
| | | * 菜单状态(0显示 1隐藏) |
| | | */ |
| | | @ApiModelProperty(value = "菜单状态(0显示 1隐藏)") |
| | | private String status; |
| | | |
| | | /** |
| | | * 权限字符串 |
| | | */ |
| | | @ApiModelProperty(value = "权限字符串") |
| | | @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") |
| | | private String perms; |
| | | |
| | | /** |
| | | * 菜单图标 |
| | | */ |
| | | @ApiModelProperty(value = "菜单图标") |
| | | private String icon; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params = new HashMap<>(); |
| | | |
| | | /** |
| | | * 子菜单 |
| | | */ |
| | | @TableField(exist = false) |
| | | private List<SysMenu> children = new ArrayList<SysMenu>(); |
| | | |
| | | } |
| | |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.annotation.ExcelDictFormat; |
| | | import com.ruoyi.common.convert.ExcelDictConvert; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 角色表 sys_role |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | @TableName("sys_role") |
| | | @ExcelIgnoreUnannotated |
| | | public class SysRole implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | public class SysRole extends BaseEntity { |
| | | |
| | | /** |
| | | * 角色ID |
| | | */ |
| | | @ApiModelProperty(value = "角色ID") |
| | | @ExcelProperty(value = "角色序号") |
| | | @TableId(value = "role_id", type = IdType.AUTO) |
| | | @TableId(value = "role_id") |
| | | private Long roleId; |
| | | |
| | | /** |
| | | * 角色名称 |
| | | */ |
| | | @ApiModelProperty(value = "角色名称") |
| | | @ExcelProperty(value = "角色名称") |
| | | @NotBlank(message = "角色名称不能为空") |
| | | @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") |
| | |
| | | /** |
| | | * 角色权限 |
| | | */ |
| | | @ApiModelProperty(value = "角色权限") |
| | | @ExcelProperty(value = "角色权限") |
| | | @NotBlank(message = "权限字符不能为空") |
| | | @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") |
| | |
| | | /** |
| | | * 角色排序 |
| | | */ |
| | | @ApiModelProperty(value = "角色排序") |
| | | @ExcelProperty(value = "角色排序") |
| | | @NotBlank(message = "显示顺序不能为空") |
| | | private String roleSort; |
| | |
| | | /** |
| | | * 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) |
| | | */ |
| | | @ApiModelProperty(value = "数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)") |
| | | @ExcelProperty(value = "数据范围", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") |
| | | private String dataScope; |
| | |
| | | /** |
| | | * 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) |
| | | */ |
| | | @ApiModelProperty(value = "菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示)") |
| | | private boolean menuCheckStrictly; |
| | | |
| | | /** |
| | | * 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) |
| | | */ |
| | | @ApiModelProperty(value = "部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 )") |
| | | private boolean deptCheckStrictly; |
| | | |
| | | /** |
| | | * 角色状态(0正常 1停用) |
| | | */ |
| | | @ApiModelProperty(value = "角色状态(0正常 1停用)") |
| | | @ExcelProperty(value = "角色状态", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_common_status") |
| | | private String status; |
| | |
| | | /** |
| | | * 删除标志(0代表存在 2代表删除) |
| | | */ |
| | | @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)") |
| | | @TableLogic |
| | | private String delFlag; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params = new HashMap<>(); |
| | | |
| | | /** |
| | | * 用户是否存在此角色标识 默认不存在 |
| | | */ |
| | | @ApiModelProperty(value = "用户是否存在此角色标识 默认不存在") |
| | | @TableField(exist = false) |
| | | private boolean flag = false; |
| | | |
| | | /** |
| | | * 菜单组 |
| | | */ |
| | | @ApiModelProperty(value = "菜单组") |
| | | @TableField(exist = false) |
| | | private Long[] menuIds; |
| | | |
| | | /** |
| | | * 部门组(数据权限) |
| | | */ |
| | | @ApiModelProperty(value = "部门组(数据权限)") |
| | | @TableField(exist = false) |
| | | private Long[] deptIds; |
| | | |
| | |
| | | this.roleId = roleId; |
| | | } |
| | | |
| | | @ApiModelProperty(value = "是否管理员") |
| | | public boolean isAdmin() { |
| | | return isAdmin(this.roleId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.Email; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 用户对象 sys_user |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | @TableName("sys_user") |
| | | public class SysUser implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | @ApiModel("用户信息业务对象") |
| | | public class SysUser extends BaseEntity { |
| | | |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | @TableId(value = "user_id", type = IdType.AUTO) |
| | | @ApiModelProperty(value = "用户ID") |
| | | @TableId(value = "user_id") |
| | | private Long userId; |
| | | |
| | | /** |
| | | * 部门ID |
| | | */ |
| | | @ApiModelProperty(value = "部门ID") |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * 用户账号 |
| | | */ |
| | | @ApiModelProperty(value = "用户账号") |
| | | @NotBlank(message = "用户账号不能为空") |
| | | @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") |
| | | private String userName; |
| | |
| | | /** |
| | | * 用户昵称 |
| | | */ |
| | | @ApiModelProperty(value = "用户昵称") |
| | | @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") |
| | | private String nickName; |
| | | |
| | | /** |
| | | * 用户邮箱 |
| | | */ |
| | | @ApiModelProperty(value = "用户邮箱") |
| | | @Email(message = "邮箱格式不正确") |
| | | @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") |
| | | private String email; |
| | |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | @ApiModelProperty(value = "手机号码") |
| | | private String phonenumber; |
| | | |
| | | /** |
| | | * 用户性别 |
| | | */ |
| | | @ApiModelProperty(value = "用户性别") |
| | | private String sex; |
| | | |
| | | /** |
| | | * 用户头像 |
| | | */ |
| | | @ApiModelProperty(value = "用户头像") |
| | | private String avatar; |
| | | |
| | | /** |
| | | * 密码 |
| | | */ |
| | | @ApiModelProperty(value = "密码") |
| | | @TableField( |
| | | insertStrategy = FieldStrategy.NOT_EMPTY, |
| | | updateStrategy = FieldStrategy.NOT_EMPTY, |
| | |
| | | /** |
| | | * 帐号状态(0正常 1停用) |
| | | */ |
| | | @ApiModelProperty(value = "帐号状态(0正常 1停用)") |
| | | private String status; |
| | | |
| | | /** |
| | | * 删除标志(0代表存在 2代表删除) |
| | | */ |
| | | @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)") |
| | | @TableLogic |
| | | private String delFlag; |
| | | |
| | | /** |
| | | * 最后登录IP |
| | | */ |
| | | @ApiModelProperty(value = "最后登录IP") |
| | | private String loginIp; |
| | | |
| | | /** |
| | | * 最后登录时间 |
| | | */ |
| | | @ApiModelProperty(value = "最后登录时间") |
| | | private Date loginDate; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params = new HashMap<>(); |
| | | |
| | | /** |
| | | * 部门对象 |
| | | */ |
| | | @ApiModelProperty(value = "部门对象") |
| | | @TableField(exist = false) |
| | | private SysDept dept; |
| | | |
| | | /** |
| | | * 角色对象 |
| | | */ |
| | | @ApiModelProperty(value = "角色对象") |
| | | @TableField(exist = false) |
| | | private List<SysRole> roles; |
| | | |
| | | /** |
| | | * 角色组 |
| | | */ |
| | | @ApiModelProperty(value = "角色组") |
| | | @TableField(exist = false) |
| | | private Long[] roleIds; |
| | | |
| | | /** |
| | | * 岗位组 |
| | | */ |
| | | @ApiModelProperty(value = "岗位组") |
| | | @TableField(exist = false) |
| | | private Long[] postIds; |
| | | |
| | | /** |
| | | * 角色ID |
| | | */ |
| | | @ApiModelProperty(value = "角色ID") |
| | | @TableField(exist = false) |
| | | private Long roleId; |
| | | |
| | |
| | | this.userId = userId; |
| | | } |
| | | |
| | | @ApiModelProperty(value = "是否管理员") |
| | | public boolean isAdmin() { |
| | | return isAdmin(this.userId); |
| | | } |
| | |
| | | package com.ruoyi.common.core.domain.model;
|
| | |
|
| | | import lombok.*;
|
| | | import io.swagger.annotations.ApiModel;
|
| | | import io.swagger.annotations.ApiModelProperty;
|
| | | import lombok.Data;
|
| | | import lombok.experimental.Accessors;
|
| | |
|
| | | /**
|
| | | * 用户登录对象
|
| | | * |
| | | * @author ruoyi
|
| | | *
|
| | | * @author Lion Li
|
| | | */
|
| | |
|
| | | @Data
|
| | | @NoArgsConstructor
|
| | | @Accessors(chain = true)
|
| | | public class LoginBody
|
| | | {
|
| | | @ApiModel("用户登录对象")
|
| | | public class LoginBody {
|
| | |
|
| | | /**
|
| | | * 用户名
|
| | | */
|
| | | @ApiModelProperty(value = "用户名")
|
| | | private String username;
|
| | |
|
| | | /**
|
| | | * 用户密码
|
| | | */
|
| | | @ApiModelProperty(value = "用户密码")
|
| | | private String password;
|
| | |
|
| | | /**
|
| | | * 验证码
|
| | | */
|
| | | @ApiModelProperty(value = "验证码")
|
| | | private String code;
|
| | |
|
| | | /**
|
| | | * 唯一标识
|
| | | */
|
| | | @ApiModelProperty(value = "唯一标识")
|
| | | private String uuid = "";
|
| | |
|
| | | }
|
| | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import lombok.*; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.security.core.GrantedAuthority; |
| | | import org.springframework.security.core.userdetails.UserDetails; |
| | |
| | | /** |
| | | * 登录用户身份权限 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | public class LoginUser implements UserDetails |
| | | { |
| | | public class LoginUser implements UserDetails { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private SysUser user; |
| | | |
| | | public LoginUser(SysUser user, Set<String> permissions) |
| | | { |
| | | public LoginUser(SysUser user, Set<String> permissions) { |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | } |
| | | |
| | | public LoginUser(Long userId, Long deptId, SysUser user, Set<String> permissions) |
| | | { |
| | | public LoginUser(Long userId, Long deptId, SysUser user, Set<String> permissions) { |
| | | this.userId = userId; |
| | | this.deptId = deptId; |
| | | this.user = user; |
| | |
| | | |
| | | @JsonIgnore |
| | | @Override |
| | | public String getPassword() |
| | | { |
| | | public String getPassword() { |
| | | return user.getPassword(); |
| | | } |
| | | |
| | | @Override |
| | | public String getUsername() |
| | | { |
| | | public String getUsername() { |
| | | return user.getUserName(); |
| | | } |
| | | |
| | |
| | | */ |
| | | @JsonIgnore |
| | | @Override |
| | | public boolean isAccountNonExpired() |
| | | { |
| | | public boolean isAccountNonExpired() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 指定用户是否解锁,锁定的用户无法进行身份验证 |
| | | * |
| | | * @return |
| | | */ |
| | | @JsonIgnore |
| | | @Override |
| | | public boolean isAccountNonLocked() |
| | | { |
| | | public boolean isAccountNonLocked() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证 |
| | | * |
| | | * @return |
| | | */ |
| | | @JsonIgnore |
| | | @Override |
| | | public boolean isCredentialsNonExpired() |
| | | { |
| | | public boolean isCredentialsNonExpired() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 是否可用 ,禁用的用户不能身份验证 |
| | | * |
| | | * @return |
| | | */ |
| | | @JsonIgnore |
| | | @Override |
| | | public boolean isEnabled() |
| | | { |
| | | public boolean isEnabled() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Collection<? extends GrantedAuthority> getAuthorities() |
| | | { |
| | | public Collection<? extends GrantedAuthority> getAuthorities() { |
| | | return null; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.common.core.domain.model;
|
| | |
|
| | | import io.swagger.annotations.ApiModel;
|
| | |
|
| | | /**
|
| | | * 用户注册对象
|
| | | * |
| | | * @author ruoyi
|
| | | *
|
| | | * @author Lion Li
|
| | | */
|
| | | public class RegisterBody extends LoginBody
|
| | | {
|
| | | @ApiModel("用户注册对象")
|
| | | public class RegisterBody extends LoginBody {
|
| | |
|
| | | }
|
| | |
| | | |
| | | /** |
| | | * 读取代码生成相关配置 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | @ConfigurationProperties(prefix = "gen") |
| | | @PropertySource(value = { "classpath:generator.yml" }) |
| | | public class GenConfig |
| | | { |
| | | /** 作者 */ |
| | | @PropertySource(value = {"classpath:generator.yml"}) |
| | | public class GenConfig { |
| | | |
| | | /** |
| | | * 作者 |
| | | */ |
| | | public static String author; |
| | | |
| | | /** 生成包路径 */ |
| | | /** |
| | | * 生成包路径 |
| | | */ |
| | | public static String packageName; |
| | | |
| | | /** 自动去除表前缀,默认是false */ |
| | | /** |
| | | * 自动去除表前缀,默认是false |
| | | */ |
| | | public static boolean autoRemovePre; |
| | | |
| | | /** 表前缀(类名不会包含表前缀) */ |
| | | /** |
| | | * 表前缀(类名不会包含表前缀) |
| | | */ |
| | | public static String tablePrefix; |
| | | |
| | | public static String getAuthor() |
| | | { |
| | | public static String getAuthor() { |
| | | return author; |
| | | } |
| | | |
| | | @Value("${author}") |
| | | public void setAuthor(String author) |
| | | { |
| | | public void setAuthor(String author) { |
| | | GenConfig.author = author; |
| | | } |
| | | |
| | | public static String getPackageName() |
| | | { |
| | | public static String getPackageName() { |
| | | return packageName; |
| | | } |
| | | |
| | | @Value("${packageName}") |
| | | public void setPackageName(String packageName) |
| | | { |
| | | public void setPackageName(String packageName) { |
| | | GenConfig.packageName = packageName; |
| | | } |
| | | |
| | | public static boolean getAutoRemovePre() |
| | | { |
| | | public static boolean getAutoRemovePre() { |
| | | return autoRemovePre; |
| | | } |
| | | |
| | | @Value("${autoRemovePre}") |
| | | public void setAutoRemovePre(boolean autoRemovePre) |
| | | { |
| | | public void setAutoRemovePre(boolean autoRemovePre) { |
| | | GenConfig.autoRemovePre = autoRemovePre; |
| | | } |
| | | |
| | | public static String getTablePrefix() |
| | | { |
| | | public static String getTablePrefix() { |
| | | return tablePrefix; |
| | | } |
| | | |
| | | @Value("${tablePrefix}") |
| | | public void setTablePrefix(String tablePrefix) |
| | | { |
| | | public void setTablePrefix(String tablePrefix) { |
| | | GenConfig.tablePrefix = tablePrefix; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.generator.domain.GenTableColumn; |
| | | import com.ruoyi.generator.service.IGenTableColumnService; |
| | | import com.ruoyi.generator.service.IGenTableService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | |
| | | /** |
| | | * 代码生成 操作处理 |
| | | * |
| | | * @author ruoyi |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | @Validated |
| | | @Api(value = "代码生成", tags = {"代码生成管理"}) |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | @RestController |
| | | @RequestMapping("/tool/gen") |
| | | public class GenController extends BaseController |
| | | { |
| | | @Autowired |
| | | private IGenTableService genTableService; |
| | | public class GenController extends BaseController { |
| | | |
| | | @Autowired |
| | | private IGenTableColumnService genTableColumnService; |
| | | private final IGenTableService genTableService; |
| | | private final IGenTableColumnService genTableColumnService; |
| | | |
| | | /** |
| | | * 查询代码生成列表 |
| | | */ |
| | | @ApiOperation("查询代码生成列表") |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo genList(GenTable genTable) |
| | | { |
| | | public TableDataInfo<GenTable> genList(GenTable genTable) { |
| | | return genTableService.selectPageGenTableList(genTable); |
| | | } |
| | | |
| | | /** |
| | | * 修改代码生成业务 |
| | | */ |
| | | @ApiOperation("修改代码生成业务") |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:query')") |
| | | @GetMapping(value = "/{talbleId}") |
| | | public AjaxResult getInfo(@PathVariable Long talbleId) |
| | | { |
| | | public AjaxResult<Map<String, Object>> getInfo(@PathVariable Long talbleId) { |
| | | GenTable table = genTableService.selectGenTableById(talbleId); |
| | | List<GenTable> tables = genTableService.selectGenTableAll(); |
| | | List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(talbleId); |
| | |
| | | /** |
| | | * 查询数据库列表 |
| | | */ |
| | | @ApiOperation("查询数据库列表") |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:list')") |
| | | @GetMapping("/db/list") |
| | | public TableDataInfo dataList(GenTable genTable) |
| | | { |
| | | public TableDataInfo<GenTable> dataList(GenTable genTable) { |
| | | return genTableService.selectPageDbTableList(genTable); |
| | | } |
| | | |
| | | /** |
| | | * 查询数据表字段列表 |
| | | */ |
| | | @ApiOperation("查询数据表字段列表") |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:list')") |
| | | @GetMapping(value = "/column/{talbleId}") |
| | | public TableDataInfo columnList(Long tableId) |
| | | { |
| | | TableDataInfo dataInfo = new TableDataInfo(); |
| | | public TableDataInfo<GenTableColumn> columnList(Long tableId) { |
| | | TableDataInfo<GenTableColumn> dataInfo = new TableDataInfo<>(); |
| | | List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId); |
| | | dataInfo.setRows(list); |
| | | dataInfo.setTotal(list.size()); |
| | |
| | | /** |
| | | * 导入表结构(保存) |
| | | */ |
| | | @ApiOperation("导入表结构(保存)") |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:import')") |
| | | @Log(title = "代码生成", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importTable") |
| | | public AjaxResult importTableSave(String tables) |
| | | { |
| | | public AjaxResult<Void> importTableSave(String tables) { |
| | | String[] tableNames = Convert.toStrArray(tables); |
| | | // 查询表信息 |
| | | List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames); |
| | |
| | | /** |
| | | * 修改保存代码生成业务 |
| | | */ |
| | | @ApiOperation("修改保存代码生成业务") |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:edit')") |
| | | @Log(title = "代码生成", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult editSave(@Validated @RequestBody GenTable genTable) |
| | | { |
| | | public AjaxResult<Void> editSave(@Validated @RequestBody GenTable genTable) { |
| | | genTableService.validateEdit(genTable); |
| | | genTableService.updateGenTable(genTable); |
| | | return AjaxResult.success(); |
| | |
| | | /** |
| | | * 删除代码生成 |
| | | */ |
| | | @ApiOperation("删除代码生成") |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:remove')") |
| | | @Log(title = "代码生成", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{tableIds}") |
| | | public AjaxResult remove(@PathVariable Long[] tableIds) |
| | | { |
| | | public AjaxResult<Void> remove(@PathVariable Long[] tableIds) { |
| | | genTableService.deleteGenTableByIds(tableIds); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | /** |
| | | * 预览代码 |
| | | */ |
| | | @ApiOperation("预览代码") |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:preview')") |
| | | @GetMapping("/preview/{tableId}") |
| | | public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException |
| | | { |
| | | public AjaxResult<Map<String, String>> preview(@PathVariable("tableId") Long tableId) throws IOException { |
| | | Map<String, String> dataMap = genTableService.previewCode(tableId); |
| | | return AjaxResult.success(dataMap); |
| | | } |
| | |
| | | /** |
| | | * 生成代码(下载方式) |
| | | */ |
| | | @ApiOperation("生成代码(下载方式)") |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:code')") |
| | | @Log(title = "代码生成", businessType = BusinessType.GENCODE) |
| | | @GetMapping("/download/{tableName}") |
| | | public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException |
| | | { |
| | | public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException { |
| | | byte[] data = genTableService.downloadCode(tableName); |
| | | genCode(response, data); |
| | | } |
| | |
| | | /** |
| | | * 生成代码(自定义路径) |
| | | */ |
| | | @ApiOperation("生成代码(自定义路径)") |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:code')") |
| | | @Log(title = "代码生成", businessType = BusinessType.GENCODE) |
| | | @GetMapping("/genCode/{tableName}") |
| | | public AjaxResult genCode(@PathVariable("tableName") String tableName) |
| | | { |
| | | public AjaxResult<Void> genCode(@PathVariable("tableName") String tableName) { |
| | | genTableService.generatorCode(tableName); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | /** |
| | | * 同步数据库 |
| | | */ |
| | | @ApiOperation("同步数据库") |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:edit')") |
| | | @Log(title = "代码生成", businessType = BusinessType.UPDATE) |
| | | @GetMapping("/synchDb/{tableName}") |
| | | public AjaxResult synchDb(@PathVariable("tableName") String tableName) |
| | | { |
| | | public AjaxResult<Void> synchDb(@PathVariable("tableName") String tableName) { |
| | | genTableService.synchDb(tableName); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | /** |
| | | * 批量生成代码 |
| | | */ |
| | | @ApiOperation("批量生成代码") |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:code')") |
| | | @Log(title = "代码生成", businessType = BusinessType.GENCODE) |
| | | @GetMapping("/batchGenCode") |
| | | public void batchGenCode(HttpServletResponse response, String tables) throws IOException |
| | | { |
| | | public void batchGenCode(HttpServletResponse response, String tables) throws IOException { |
| | | String[] tableNames = Convert.toStrArray(tables); |
| | | byte[] data = genTableService.downloadCode(tableNames); |
| | | genCode(response, data); |
| | |
| | | /** |
| | | * 生成zip文件 |
| | | */ |
| | | private void genCode(HttpServletResponse response, byte[] data) throws IOException |
| | | { |
| | | private void genCode(HttpServletResponse response, byte[] data) throws IOException { |
| | | response.reset(); |
| | | response.addHeader("Access-Control-Allow-Origin", "*"); |
| | | response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
| | |
| | | package com.ruoyi.generator.domain; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.constant.GenConstants; |
| | | import lombok.*; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 业务表 gen_table |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | @TableName("gen_table") |
| | | public class GenTable implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | public class GenTable extends BaseEntity { |
| | | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @TableId(value = "table_id", type = IdType.AUTO) |
| | | @TableId(value = "table_id") |
| | | private Long tableId; |
| | | |
| | | /** |
| | |
| | | private String options; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params = new HashMap<>(); |
| | | |
| | | /** |
| | | * 树编码字段 |
| | |
| | | package com.ruoyi.generator.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldStrategy; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.*; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 代码生成业务字段表 gen_table_column |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | @TableName("gen_table_column") |
| | | public class GenTableColumn implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | public class GenTableColumn extends BaseEntity { |
| | | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @TableId(value = "column_id", type = IdType.AUTO) |
| | | @TableId(value = "column_id") |
| | | private Long columnId; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private Integer sort; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params = new HashMap<>(); |
| | | |
| | | public String getCapJavaField() { |
| | | return StringUtils.uncapitalize(javaField); |
| | | } |
| | |
| | | public static boolean isSuperColumn(String javaField) { |
| | | return StringUtils.equalsAnyIgnoreCase(javaField, |
| | | // BaseEntity |
| | | "createBy", "createTime", "updateBy", "updateTime", "remark", |
| | | "createBy", "createTime", "updateBy", "updateTime", |
| | | // TreeEntity |
| | | "parentName", "parentId", "orderNum", "ancestors"); |
| | | "parentName", "parentId", "orderNum"); |
| | | } |
| | | |
| | | public boolean isUsableColumn() { |
| | |
| | | /** |
| | | * 业务字段 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface GenTableColumnMapper extends BaseMapperPlus<GenTableColumn> { |
| | | /** |
| | |
| | | * @param tableName 表名称 |
| | | * @return 列信息 |
| | | */ |
| | | public List<GenTableColumn> selectDbTableColumnsByName(String tableName); |
| | | List<GenTableColumn> selectDbTableColumnsByName(String tableName); |
| | | |
| | | } |
| | |
| | | /** |
| | | * 业务 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface GenTableMapper extends BaseMapperPlus<GenTable> { |
| | | |
| | |
| | | * @param genTable 业务信息 |
| | | * @return 业务集合 |
| | | */ |
| | | public List<GenTable> selectGenTableList(GenTable genTable); |
| | | List<GenTable> selectGenTableList(GenTable genTable); |
| | | |
| | | /** |
| | | * 查询据库列表 |
| | |
| | | * @param genTable 业务信息 |
| | | * @return 数据库表集合 |
| | | */ |
| | | public List<GenTable> selectDbTableList(GenTable genTable); |
| | | List<GenTable> selectDbTableList(GenTable genTable); |
| | | |
| | | /** |
| | | * 查询据库列表 |
| | |
| | | * @param tableNames 表名称组 |
| | | * @return 数据库表集合 |
| | | */ |
| | | public List<GenTable> selectDbTableListByNames(String[] tableNames); |
| | | List<GenTable> selectDbTableListByNames(String[] tableNames); |
| | | |
| | | /** |
| | | * 查询所有表信息 |
| | | * |
| | | * @return 表信息集合 |
| | | */ |
| | | public List<GenTable> selectGenTableAll(); |
| | | List<GenTable> selectGenTableAll(); |
| | | |
| | | /** |
| | | * 查询表ID业务信息 |
| | |
| | | * @param id 业务ID |
| | | * @return 业务信息 |
| | | */ |
| | | public GenTable selectGenTableById(Long id); |
| | | GenTable selectGenTableById(Long id); |
| | | |
| | | /** |
| | | * 查询表名称业务信息 |
| | |
| | | * @param tableName 表名称 |
| | | * @return 业务信息 |
| | | */ |
| | | public GenTable selectGenTableByName(String tableName); |
| | | GenTable selectGenTableByName(String tableName); |
| | | |
| | | } |
| | |
| | | /** |
| | | * 业务字段 服务层实现 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Service |
| | | public class GenTableColumnServiceImpl extends ServicePlusImpl<GenTableColumnMapper, GenTableColumn, GenTableColumn> implements IGenTableColumnService { |
| | |
| | | @Override |
| | | public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId) { |
| | | return list(new LambdaQueryWrapper<GenTableColumn>() |
| | | .eq(GenTableColumn::getTableId,tableId) |
| | | .eq(GenTableColumn::getTableId, tableId) |
| | | .orderByAsc(GenTableColumn::getSort)); |
| | | } |
| | | |
| | |
| | | /** |
| | | * 业务 服务层实现 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | |
| | | String tableName = table.getTableName(); |
| | | GenUtils.initTable(table, operName); |
| | | int row = baseMapper.insert(table); |
| | | if (row > 0) { |
| | | // 保存列信息 |
| | | List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); |
| | | List<GenTableColumn> saveColumns = new ArrayList<>(); |
| | | for (GenTableColumn column : genTableColumns) { |
| | | GenUtils.initColumnField(column, table); |
| | | saveColumns.add(column); |
| | | } |
| | | if (CollUtil.isNotEmpty(saveColumns)) { |
| | | genTableColumnMapper.insertAll(saveColumns); |
| | | } |
| | | } |
| | | if (row > 0) { |
| | | // 保存列信息 |
| | | List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); |
| | | List<GenTableColumn> saveColumns = new ArrayList<>(); |
| | | for (GenTableColumn column : genTableColumns) { |
| | | GenUtils.initColumnField(column, table); |
| | | saveColumns.add(column); |
| | | } |
| | | if (CollUtil.isNotEmpty(saveColumns)) { |
| | | genTableColumnMapper.insertAll(saveColumns); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | throw new ServiceException("导入失败:" + e.getMessage()); |
| | |
| | | StringWriter sw = new StringWriter(); |
| | | Template tpl = Velocity.getTemplate(template, Constants.UTF8); |
| | | tpl.merge(context, sw); |
| | | try { |
| | | String path = getGenPath(table, template); |
| | | FileUtils.writeUtf8String(sw.toString(), path); |
| | | } catch (Exception e) { |
| | | throw new ServiceException("渲染模板失败,表名:" + table.getTableName()); |
| | | } |
| | | try { |
| | | String path = getGenPath(table, template); |
| | | FileUtils.writeUtf8String(sw.toString(), path); |
| | | } catch (Exception e) { |
| | | throw new ServiceException("渲染模板失败,表名:" + table.getTableName()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); |
| | | |
| | | List<GenTableColumn> saveColumns = new ArrayList<>(); |
| | | dbTableColumns.forEach(column -> { |
| | | if (!tableColumnNames.contains(column.getColumnName())) { |
| | | GenUtils.initColumnField(column, table); |
| | | saveColumns.add(column); |
| | | } |
| | | }); |
| | | if (CollUtil.isNotEmpty(saveColumns)) { |
| | | genTableColumnMapper.insertAll(saveColumns); |
| | | } |
| | | List<GenTableColumn> saveColumns = new ArrayList<>(); |
| | | dbTableColumns.forEach(column -> { |
| | | if (!tableColumnNames.contains(column.getColumnName())) { |
| | | GenUtils.initColumnField(column, table); |
| | | saveColumns.add(column); |
| | | } |
| | | }); |
| | | if (CollUtil.isNotEmpty(saveColumns)) { |
| | | genTableColumnMapper.insertAll(saveColumns); |
| | | } |
| | | |
| | | List<GenTableColumn> delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList()); |
| | | if (CollUtil.isNotEmpty(delColumns)) { |
| | |
| | | @Override |
| | | public void validateEdit(GenTable genTable) { |
| | | if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) { |
| | | Map<String, Object> paramsObj = genTable.getParams(); |
| | | Map<String, Object> paramsObj = genTable.getParams(); |
| | | if (StringUtils.isEmpty(paramsObj.get(GenConstants.TREE_CODE))) { |
| | | throw new ServiceException("树编码字段不能为空"); |
| | | } else if (StringUtils.isEmpty(paramsObj.get(GenConstants.TREE_PARENT_CODE))) { |
| | |
| | | * @param genTable 设置后的生成对象 |
| | | */ |
| | | public void setTableFromOptions(GenTable genTable) { |
| | | Map<String, Object> paramsObj = JsonUtils.parseMap(genTable.getOptions()); |
| | | Map<String, Object> paramsObj = JsonUtils.parseMap(genTable.getOptions()); |
| | | if (StringUtils.isNotNull(paramsObj)) { |
| | | String treeCode = Convert.toStr(paramsObj.get(GenConstants.TREE_CODE)); |
| | | String treeParentCode = Convert.toStr(paramsObj.get(GenConstants.TREE_PARENT_CODE)); |
| | |
| | | /** |
| | | * 获取代码生成地址 |
| | | * |
| | | * @param table 业务表信息 |
| | | * @param table 业务表信息 |
| | | * @param template 模板文件路径 |
| | | * @return 生成地址 |
| | | */ |
| | |
| | | /** |
| | | * 业务字段 服务层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface IGenTableColumnService extends IService<GenTableColumn> { |
| | | /** |
| | |
| | | * @param tableId 业务字段编号 |
| | | * @return 业务字段集合 |
| | | */ |
| | | public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId); |
| | | List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId); |
| | | |
| | | /** |
| | | * 新增业务字段 |
| | |
| | | * @param genTableColumn 业务字段信息 |
| | | * @return 结果 |
| | | */ |
| | | public int insertGenTableColumn(GenTableColumn genTableColumn); |
| | | int insertGenTableColumn(GenTableColumn genTableColumn); |
| | | |
| | | /** |
| | | * 修改业务字段 |
| | |
| | | * @param genTableColumn 业务字段信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updateGenTableColumn(GenTableColumn genTableColumn); |
| | | int updateGenTableColumn(GenTableColumn genTableColumn); |
| | | |
| | | /** |
| | | * 删除业务字段信息 |
| | |
| | | * @param ids 需要删除的数据ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteGenTableColumnByIds(String ids); |
| | | int deleteGenTableColumnByIds(String ids); |
| | | } |
| | |
| | | /** |
| | | * 业务 服务层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface IGenTableService extends IService<GenTable> { |
| | | |
| | |
| | | * @param genTable 业务信息 |
| | | * @return 业务集合 |
| | | */ |
| | | public List<GenTable> selectGenTableList(GenTable genTable); |
| | | List<GenTable> selectGenTableList(GenTable genTable); |
| | | |
| | | /** |
| | | * 查询据库列表 |
| | |
| | | * @param genTable 业务信息 |
| | | * @return 数据库表集合 |
| | | */ |
| | | public List<GenTable> selectDbTableList(GenTable genTable); |
| | | List<GenTable> selectDbTableList(GenTable genTable); |
| | | |
| | | /** |
| | | * 查询据库列表 |
| | |
| | | * @param tableNames 表名称组 |
| | | * @return 数据库表集合 |
| | | */ |
| | | public List<GenTable> selectDbTableListByNames(String[] tableNames); |
| | | List<GenTable> selectDbTableListByNames(String[] tableNames); |
| | | |
| | | /** |
| | | * 查询所有表信息 |
| | | * |
| | | * @return 表信息集合 |
| | | */ |
| | | public List<GenTable> selectGenTableAll(); |
| | | List<GenTable> selectGenTableAll(); |
| | | |
| | | /** |
| | | * 查询业务信息 |
| | |
| | | * @param id 业务ID |
| | | * @return 业务信息 |
| | | */ |
| | | public GenTable selectGenTableById(Long id); |
| | | GenTable selectGenTableById(Long id); |
| | | |
| | | /** |
| | | * 修改业务 |
| | |
| | | * @param genTable 业务信息 |
| | | * @return 结果 |
| | | */ |
| | | public void updateGenTable(GenTable genTable); |
| | | void updateGenTable(GenTable genTable); |
| | | |
| | | /** |
| | | * 删除业务信息 |
| | |
| | | * @param tableIds 需要删除的表数据ID |
| | | * @return 结果 |
| | | */ |
| | | public void deleteGenTableByIds(Long[] tableIds); |
| | | void deleteGenTableByIds(Long[] tableIds); |
| | | |
| | | /** |
| | | * 导入表结构 |
| | | * |
| | | * @param tableList 导入表列表 |
| | | */ |
| | | public void importGenTable(List<GenTable> tableList); |
| | | void importGenTable(List<GenTable> tableList); |
| | | |
| | | /** |
| | | * 预览代码 |
| | |
| | | * @param tableId 表编号 |
| | | * @return 预览数据列表 |
| | | */ |
| | | public Map<String, String> previewCode(Long tableId); |
| | | Map<String, String> previewCode(Long tableId); |
| | | |
| | | /** |
| | | * 生成代码(下载方式) |
| | |
| | | * @param tableName 表名称 |
| | | * @return 数据 |
| | | */ |
| | | public byte[] downloadCode(String tableName); |
| | | byte[] downloadCode(String tableName); |
| | | |
| | | /** |
| | | * 生成代码(自定义路径) |
| | |
| | | * @param tableName 表名称 |
| | | * @return 数据 |
| | | */ |
| | | public void generatorCode(String tableName); |
| | | void generatorCode(String tableName); |
| | | |
| | | /** |
| | | * 同步数据库 |
| | | * |
| | | * @param tableName 表名称 |
| | | */ |
| | | public void synchDb(String tableName); |
| | | void synchDb(String tableName); |
| | | |
| | | /** |
| | | * 批量生成代码(下载方式) |
| | |
| | | * @param tableNames 表数组 |
| | | * @return 数据 |
| | | */ |
| | | public byte[] downloadCode(String[] tableNames); |
| | | byte[] downloadCode(String[] tableNames); |
| | | |
| | | /** |
| | | * 修改保存参数校验 |
| | | * |
| | | * @param genTable 业务信息 |
| | | */ |
| | | public void validateEdit(GenTable genTable); |
| | | void validateEdit(GenTable genTable); |
| | | } |
| | |
| | | package com.ruoyi.generator.util; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.constant.GenConstants; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.generator.config.GenConfig; |
| | | import com.ruoyi.generator.domain.GenTable; |
| | | import com.ruoyi.generator.domain.GenTableColumn; |
| | |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class GenUtils |
| | | { |
| | | public class GenUtils { |
| | | |
| | | /** |
| | | * 初始化表信息 |
| | | */ |
| | | public static void initTable(GenTable genTable, String operName) |
| | | { |
| | | public static void initTable(GenTable genTable, String operName) { |
| | | genTable.setClassName(convertClassName(genTable.getTableName())); |
| | | genTable.setPackageName(GenConfig.getPackageName()); |
| | | genTable.setModuleName(getModuleName(GenConfig.getPackageName())); |
| | |
| | | column.setIsInsert(GenConstants.REQUIRE); |
| | | } |
| | | // BO对象 默认编辑勾选 |
| | | if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName)) |
| | | { |
| | | if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName)) { |
| | | column.setIsEdit(GenConstants.REQUIRE); |
| | | } |
| | | // BO对象 默认是否必填勾选 |
| | | if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName)) |
| | | { |
| | | if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName)) { |
| | | column.setIsRequired(GenConstants.REQUIRE); |
| | | } |
| | | // VO对象 默认返回勾选 |
| | | if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName)) |
| | | { |
| | | if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName)) { |
| | | column.setIsList(GenConstants.REQUIRE); |
| | | } |
| | | // BO对象 默认查询勾选 |
| | | if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk()) |
| | | { |
| | | if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk()) { |
| | | column.setIsQuery(GenConstants.REQUIRE); |
| | | } |
| | | |
| | | // 查询字段类型 |
| | | if (StringUtils.endsWithIgnoreCase(columnName, "name")) |
| | | { |
| | | if (StringUtils.endsWithIgnoreCase(columnName, "name")) { |
| | | column.setQueryType(GenConstants.QUERY_LIKE); |
| | | } |
| | | // 状态字段设置单选框 |
| | | if (StringUtils.endsWithIgnoreCase(columnName, "status")) |
| | | { |
| | | if (StringUtils.endsWithIgnoreCase(columnName, "status")) { |
| | | column.setHtmlType(GenConstants.HTML_RADIO); |
| | | } |
| | | // 类型&性别字段设置下拉框 |
| | | else if (StringUtils.endsWithIgnoreCase(columnName, "type") |
| | | || StringUtils.endsWithIgnoreCase(columnName, "sex")) |
| | | { |
| | | || StringUtils.endsWithIgnoreCase(columnName, "sex")) { |
| | | column.setHtmlType(GenConstants.HTML_SELECT); |
| | | } |
| | | // 图片字段设置图片上传控件 |
| | | else if (StringUtils.endsWithIgnoreCase(columnName, "image")) |
| | | { |
| | | else if (StringUtils.endsWithIgnoreCase(columnName, "image")) { |
| | | column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD); |
| | | } |
| | | // 文件字段设置文件上传控件 |
| | | else if (StringUtils.endsWithIgnoreCase(columnName, "file")) |
| | | { |
| | | else if (StringUtils.endsWithIgnoreCase(columnName, "file")) { |
| | | column.setHtmlType(GenConstants.HTML_FILE_UPLOAD); |
| | | } |
| | | // 内容字段设置富文本控件 |
| | | else if (StringUtils.endsWithIgnoreCase(columnName, "content")) |
| | | { |
| | | else if (StringUtils.endsWithIgnoreCase(columnName, "content")) { |
| | | column.setHtmlType(GenConstants.HTML_EDITOR); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 校验数组是否包含指定值 |
| | | * |
| | | * @param arr 数组 |
| | | * @param arr 数组 |
| | | * @param targetValue 值 |
| | | * @return 是否包含 |
| | | */ |
| | | public static boolean arraysContains(String[] arr, String targetValue) |
| | | { |
| | | public static boolean arraysContains(String[] arr, String targetValue) { |
| | | return Arrays.asList(arr).contains(targetValue); |
| | | } |
| | | |
| | |
| | | * @param packageName 包名 |
| | | * @return 模块名 |
| | | */ |
| | | public static String getModuleName(String packageName) |
| | | { |
| | | public static String getModuleName(String packageName) { |
| | | int lastIndex = packageName.lastIndexOf("."); |
| | | int nameLength = packageName.length(); |
| | | String moduleName = StringUtils.substring(packageName, lastIndex + 1, nameLength); |
| | |
| | | * @param tableName 表名 |
| | | * @return 业务名 |
| | | */ |
| | | public static String getBusinessName(String tableName) |
| | | { |
| | | public static String getBusinessName(String tableName) { |
| | | int firstIndex = tableName.indexOf("_"); |
| | | int nameLength = tableName.length(); |
| | | String businessName = StringUtils.substring(tableName, firstIndex + 1, nameLength); |
| | | businessName = StringUtils.toCamelCase(businessName); |
| | | businessName = StringUtils.toCamelCase(businessName); |
| | | return businessName; |
| | | } |
| | | |
| | |
| | | * @param tableName 表名称 |
| | | * @return 类名 |
| | | */ |
| | | public static String convertClassName(String tableName) |
| | | { |
| | | public static String convertClassName(String tableName) { |
| | | boolean autoRemovePre = GenConfig.getAutoRemovePre(); |
| | | String tablePrefix = GenConfig.getTablePrefix(); |
| | | if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) |
| | | { |
| | | if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) { |
| | | String[] searchList = StringUtils.split(tablePrefix, ","); |
| | | tableName = replaceFirst(tableName, searchList); |
| | | } |
| | |
| | | * 批量替换前缀 |
| | | * |
| | | * @param replacementm 替换值 |
| | | * @param searchList 替换列表 |
| | | * @param searchList 替换列表 |
| | | * @return |
| | | */ |
| | | public static String replaceFirst(String replacementm, String[] searchList) |
| | | { |
| | | public static String replaceFirst(String replacementm, String[] searchList) { |
| | | String text = replacementm; |
| | | for (String searchString : searchList) |
| | | { |
| | | if (replacementm.startsWith(searchString)) |
| | | { |
| | | for (String searchString : searchList) { |
| | | if (replacementm.startsWith(searchString)) { |
| | | text = replacementm.replaceFirst(searchString, ""); |
| | | break; |
| | | } |
| | |
| | | * @param text 需要被替换的名字 |
| | | * @return 替换后的名字 |
| | | */ |
| | | public static String replaceText(String text) |
| | | { |
| | | public static String replaceText(String text) { |
| | | return RegExUtils.replaceAll(text, "(?:表|若依)", ""); |
| | | } |
| | | |
| | |
| | | * @param columnType 列类型 |
| | | * @return 截取后的列类型 |
| | | */ |
| | | public static String getDbType(String columnType) |
| | | { |
| | | if (StringUtils.indexOf(columnType, '(') > 0) |
| | | { |
| | | public static String getDbType(String columnType) { |
| | | if (StringUtils.indexOf(columnType, '(') > 0) { |
| | | return StringUtils.substringBefore(columnType, "("); |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | return columnType; |
| | | } |
| | | } |
| | |
| | | * @param columnType 列类型 |
| | | * @return 截取后的列类型 |
| | | */ |
| | | public static Integer getColumnLength(String columnType) |
| | | { |
| | | if (StringUtils.indexOf(columnType, '(') > 0) |
| | | { |
| | | public static Integer getColumnLength(String columnType) { |
| | | if (StringUtils.indexOf(columnType, '(') > 0) { |
| | | String length = StringUtils.substringBetween(columnType, "(", ")"); |
| | | return Integer.valueOf(length); |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | return 0; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.generator.util; |
| | | |
| | | import java.util.Properties; |
| | | import org.apache.velocity.app.Velocity; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import org.apache.velocity.app.Velocity; |
| | | |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | | * VelocityEngine工厂 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class VelocityInitializer |
| | | { |
| | | public class VelocityInitializer { |
| | | |
| | | /** |
| | | * 初始化vm方法 |
| | | */ |
| | | public static void initVelocity() |
| | | { |
| | | public static void initVelocity() { |
| | | Properties p = new Properties(); |
| | | try |
| | | { |
| | | try { |
| | | // 加载classpath目录下的vm文件 |
| | | p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); |
| | | // 定义字符集 |
| | |
| | | p.setProperty(Velocity.OUTPUT_ENCODING, Constants.UTF8); |
| | | // 初始化Velocity引擎,指定配置Properties |
| | | Velocity.init(p); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * 模板处理工具类 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class VelocityUtils |
| | | { |
| | | /** 项目空间路径 */ |
| | | public class VelocityUtils { |
| | | |
| | | /** |
| | | * 项目空间路径 |
| | | */ |
| | | private static final String PROJECT_PATH = "main/java"; |
| | | |
| | | /** mybatis空间路径 */ |
| | | /** |
| | | * mybatis空间路径 |
| | | */ |
| | | private static final String MYBATIS_PATH = "main/resources/mapper"; |
| | | |
| | | /** 默认上级菜单,系统工具 */ |
| | | /** |
| | | * 默认上级菜单,系统工具 |
| | | */ |
| | | private static final String DEFAULT_PARENT_MENU_ID = "3"; |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return 模板列表 |
| | | */ |
| | | public static VelocityContext prepareContext(GenTable genTable) |
| | | { |
| | | public static VelocityContext prepareContext(GenTable genTable) { |
| | | String moduleName = genTable.getModuleName(); |
| | | String businessName = genTable.getBusinessName(); |
| | | String packageName = genTable.getPackageName(); |
| | |
| | | velocityContext.put("table", genTable); |
| | | velocityContext.put("dicts", getDicts(genTable)); |
| | | setMenuVelocityContext(velocityContext, genTable); |
| | | if (GenConstants.TPL_TREE.equals(tplCategory)) |
| | | { |
| | | if (GenConstants.TPL_TREE.equals(tplCategory)) { |
| | | setTreeVelocityContext(velocityContext, genTable); |
| | | } |
| | | if (GenConstants.TPL_SUB.equals(tplCategory)) |
| | | { |
| | | if (GenConstants.TPL_SUB.equals(tplCategory)) { |
| | | setSubVelocityContext(velocityContext, genTable); |
| | | } |
| | | return velocityContext; |
| | | } |
| | | |
| | | public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) |
| | | { |
| | | public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) { |
| | | String options = genTable.getOptions(); |
| | | Map<String, Object> paramsObj = JsonUtils.parseMap(options); |
| | | Map<String, Object> paramsObj = JsonUtils.parseMap(options); |
| | | String parentMenuId = getParentMenuId(paramsObj); |
| | | context.put("parentMenuId", parentMenuId); |
| | | } |
| | | |
| | | public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) |
| | | { |
| | | public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) { |
| | | String options = genTable.getOptions(); |
| | | Map<String, Object> paramsObj = JsonUtils.parseMap(options); |
| | | Map<String, Object> paramsObj = JsonUtils.parseMap(options); |
| | | String treeCode = getTreecode(paramsObj); |
| | | String treeParentCode = getTreeParentCode(paramsObj); |
| | | String treeName = getTreeName(paramsObj); |
| | |
| | | context.put("treeParentCode", treeParentCode); |
| | | context.put("treeName", treeName); |
| | | context.put("expandColumn", getExpandColumn(genTable)); |
| | | if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) |
| | | { |
| | | if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) { |
| | | context.put("tree_parent_code", paramsObj.get(GenConstants.TREE_PARENT_CODE)); |
| | | } |
| | | if (paramsObj.containsKey(GenConstants.TREE_NAME)) |
| | | { |
| | | if (paramsObj.containsKey(GenConstants.TREE_NAME)) { |
| | | context.put("tree_name", paramsObj.get(GenConstants.TREE_NAME)); |
| | | } |
| | | } |
| | | |
| | | public static void setSubVelocityContext(VelocityContext context, GenTable genTable) |
| | | { |
| | | public static void setSubVelocityContext(VelocityContext context, GenTable genTable) { |
| | | GenTable subTable = genTable.getSubTable(); |
| | | String subTableName = genTable.getSubTableName(); |
| | | String subTableFkName = genTable.getSubTableFkName(); |
| | |
| | | * |
| | | * @return 模板列表 |
| | | */ |
| | | public static List<String> getTemplateList(String tplCategory) |
| | | { |
| | | public static List<String> getTemplateList(String tplCategory) { |
| | | List<String> templates = new ArrayList<String>(); |
| | | templates.add("vm/java/domain.java.vm"); |
| | | templates.add("vm/java/vo.java.vm"); |
| | | templates.add("vm/java/bo.java.vm"); |
| | | templates.add("vm/java/bo.java.vm"); |
| | | templates.add("vm/java/mapper.java.vm"); |
| | | templates.add("vm/java/service.java.vm"); |
| | | templates.add("vm/java/serviceImpl.java.vm"); |
| | |
| | | templates.add("vm/xml/mapper.xml.vm"); |
| | | templates.add("vm/sql/sql.vm"); |
| | | templates.add("vm/js/api.js.vm"); |
| | | if (GenConstants.TPL_CRUD.equals(tplCategory)) |
| | | { |
| | | if (GenConstants.TPL_CRUD.equals(tplCategory)) { |
| | | templates.add("vm/vue/index.vue.vm"); |
| | | } |
| | | else if (GenConstants.TPL_TREE.equals(tplCategory)) |
| | | { |
| | | } else if (GenConstants.TPL_TREE.equals(tplCategory)) { |
| | | templates.add("vm/vue/index-tree.vue.vm"); |
| | | } |
| | | else if (GenConstants.TPL_SUB.equals(tplCategory)) |
| | | { |
| | | } else if (GenConstants.TPL_SUB.equals(tplCategory)) { |
| | | templates.add("vm/vue/index.vue.vm"); |
| | | templates.add("vm/java/sub-domain.java.vm"); |
| | | } |
| | |
| | | /** |
| | | * 获取文件名 |
| | | */ |
| | | public static String getFileName(String template, GenTable genTable) |
| | | { |
| | | public static String getFileName(String template, GenTable genTable) { |
| | | // 文件名称 |
| | | String fileName = ""; |
| | | // 包路径 |
| | |
| | | String mybatisPath = MYBATIS_PATH + "/" + moduleName; |
| | | String vuePath = "vue"; |
| | | |
| | | if (template.contains("domain.java.vm")) |
| | | { |
| | | if (template.contains("domain.java.vm")) { |
| | | fileName = StringUtils.format("{}/domain/{}.java", javaPath, className); |
| | | } |
| | | if (template.contains("vo.java.vm")) |
| | | { |
| | | if (template.contains("vo.java.vm")) { |
| | | fileName = StringUtils.format("{}/domain/vo/{}Vo.java", javaPath, className); |
| | | } |
| | | if (template.contains("bo.java.vm")) |
| | | { |
| | | fileName = StringUtils.format("{}/domain/bo/{}Bo.java", javaPath, className); |
| | | } |
| | | if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory())) |
| | | { |
| | | if (template.contains("bo.java.vm")) { |
| | | fileName = StringUtils.format("{}/domain/bo/{}Bo.java", javaPath, className); |
| | | } |
| | | if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory())) { |
| | | fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName()); |
| | | } |
| | | else if (template.contains("mapper.java.vm")) |
| | | { |
| | | } else if (template.contains("mapper.java.vm")) { |
| | | fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className); |
| | | } |
| | | else if (template.contains("service.java.vm")) |
| | | { |
| | | } else if (template.contains("service.java.vm")) { |
| | | fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className); |
| | | } |
| | | else if (template.contains("serviceImpl.java.vm")) |
| | | { |
| | | } else if (template.contains("serviceImpl.java.vm")) { |
| | | fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className); |
| | | } |
| | | else if (template.contains("controller.java.vm")) |
| | | { |
| | | } else if (template.contains("controller.java.vm")) { |
| | | fileName = StringUtils.format("{}/controller/{}Controller.java", javaPath, className); |
| | | } |
| | | else if (template.contains("mapper.xml.vm")) |
| | | { |
| | | } else if (template.contains("mapper.xml.vm")) { |
| | | fileName = StringUtils.format("{}/{}Mapper.xml", mybatisPath, className); |
| | | } |
| | | else if (template.contains("sql.vm")) |
| | | { |
| | | } else if (template.contains("sql.vm")) { |
| | | fileName = businessName + "Menu.sql"; |
| | | } |
| | | else if (template.contains("api.js.vm")) |
| | | { |
| | | } else if (template.contains("api.js.vm")) { |
| | | fileName = StringUtils.format("{}/api/{}/{}.js", vuePath, moduleName, businessName); |
| | | } |
| | | else if (template.contains("index.vue.vm")) |
| | | { |
| | | } else if (template.contains("index.vue.vm")) { |
| | | fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); |
| | | } |
| | | else if (template.contains("index-tree.vue.vm")) |
| | | { |
| | | } else if (template.contains("index-tree.vue.vm")) { |
| | | fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); |
| | | } |
| | | return fileName; |
| | |
| | | * @param packageName 包名称 |
| | | * @return 包前缀名称 |
| | | */ |
| | | public static String getPackagePrefix(String packageName) |
| | | { |
| | | public static String getPackagePrefix(String packageName) { |
| | | int lastIndex = packageName.lastIndexOf("."); |
| | | String basePackage = StringUtils.substring(packageName, 0, lastIndex); |
| | | return basePackage; |
| | |
| | | |
| | | /** |
| | | * 根据列类型获取导入包 |
| | | * |
| | | * |
| | | * @param genTable 业务表对象 |
| | | * @return 返回需要导入的包列表 |
| | | */ |
| | | public static HashSet<String> getImportList(GenTable genTable) |
| | | { |
| | | public static HashSet<String> getImportList(GenTable genTable) { |
| | | List<GenTableColumn> columns = genTable.getColumns(); |
| | | GenTable subGenTable = genTable.getSubTable(); |
| | | HashSet<String> importList = new HashSet<String>(); |
| | | if (StringUtils.isNotNull(subGenTable)) |
| | | { |
| | | if (StringUtils.isNotNull(subGenTable)) { |
| | | importList.add("java.util.List"); |
| | | } |
| | | for (GenTableColumn column : columns) |
| | | { |
| | | if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) |
| | | { |
| | | for (GenTableColumn column : columns) { |
| | | if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) { |
| | | importList.add("java.util.Date"); |
| | | importList.add("com.fasterxml.jackson.annotation.JsonFormat"); |
| | | } |
| | | else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) |
| | | { |
| | | } else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) { |
| | | importList.add("java.math.BigDecimal"); |
| | | } |
| | | } |
| | |
| | | * @param genTable 业务表对象 |
| | | * @return 返回字典组 |
| | | */ |
| | | public static String getDicts(GenTable genTable) |
| | | { |
| | | public static String getDicts(GenTable genTable) { |
| | | List<GenTableColumn> columns = genTable.getColumns(); |
| | | List<String> dicts = new ArrayList<String>(); |
| | | for (GenTableColumn column : columns) |
| | | { |
| | | for (GenTableColumn column : columns) { |
| | | if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny( |
| | | column.getHtmlType(), new String[] { GenConstants.HTML_SELECT, GenConstants.HTML_RADIO })) |
| | | { |
| | | column.getHtmlType(), new String[]{GenConstants.HTML_SELECT, GenConstants.HTML_RADIO})) { |
| | | dicts.add("'" + column.getDictType() + "'"); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 获取权限前缀 |
| | | * |
| | | * @param moduleName 模块名称 |
| | | * @param moduleName 模块名称 |
| | | * @param businessName 业务名称 |
| | | * @return 返回权限前缀 |
| | | */ |
| | | public static String getPermissionPrefix(String moduleName, String businessName) |
| | | { |
| | | public static String getPermissionPrefix(String moduleName, String businessName) { |
| | | return StringUtils.format("{}:{}", moduleName, businessName); |
| | | } |
| | | |
| | |
| | | * @param paramsObj 生成其他选项 |
| | | * @return 上级菜单ID字段 |
| | | */ |
| | | public static String getParentMenuId(Map<String, Object> paramsObj) |
| | | { |
| | | public static String getParentMenuId(Map<String, Object> paramsObj) { |
| | | if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.PARENT_MENU_ID) |
| | | && StringUtils.isNotEmpty(Convert.toStr(paramsObj.get(GenConstants.PARENT_MENU_ID)))) |
| | | { |
| | | && StringUtils.isNotEmpty(Convert.toStr(paramsObj.get(GenConstants.PARENT_MENU_ID)))) { |
| | | return Convert.toStr(paramsObj.get(GenConstants.PARENT_MENU_ID)); |
| | | } |
| | | return DEFAULT_PARENT_MENU_ID; |
| | |
| | | * @param paramsObj 生成其他选项 |
| | | * @return 树编码 |
| | | */ |
| | | public static String getTreecode(Map<String, Object> paramsObj) |
| | | { |
| | | if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_CODE)) |
| | | { |
| | | public static String getTreecode(Map<String, Object> paramsObj) { |
| | | if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_CODE)) { |
| | | return StringUtils.toCamelCase(Convert.toStr(paramsObj.get(GenConstants.TREE_CODE))); |
| | | } |
| | | return StringUtils.EMPTY; |
| | |
| | | * @param paramsObj 生成其他选项 |
| | | * @return 树父编码 |
| | | */ |
| | | public static String getTreeParentCode(Map<String, Object> paramsObj) |
| | | { |
| | | if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) |
| | | { |
| | | public static String getTreeParentCode(Map<String, Object> paramsObj) { |
| | | if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) { |
| | | return StringUtils.toCamelCase(Convert.toStr(paramsObj.get(GenConstants.TREE_PARENT_CODE))); |
| | | } |
| | | return StringUtils.EMPTY; |
| | |
| | | * @param paramsObj 生成其他选项 |
| | | * @return 树名称 |
| | | */ |
| | | public static String getTreeName(Map<String, Object> paramsObj) |
| | | { |
| | | if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_NAME)) |
| | | { |
| | | public static String getTreeName(Map<String, Object> paramsObj) { |
| | | if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_NAME)) { |
| | | return StringUtils.toCamelCase(Convert.toStr(paramsObj.get(GenConstants.TREE_NAME))); |
| | | } |
| | | return StringUtils.EMPTY; |
| | |
| | | * @param genTable 业务表对象 |
| | | * @return 展开按钮列序号 |
| | | */ |
| | | public static int getExpandColumn(GenTable genTable) |
| | | { |
| | | public static int getExpandColumn(GenTable genTable) { |
| | | String options = genTable.getOptions(); |
| | | Map<String, Object> paramsObj = JsonUtils.parseMap(options); |
| | | String treeName = Convert.toStr(paramsObj.get(GenConstants.TREE_NAME)); |
| | | int num = 0; |
| | | for (GenTableColumn column : genTable.getColumns()) |
| | | { |
| | | if (column.isList()) |
| | | { |
| | | for (GenTableColumn column : genTable.getColumns()) { |
| | | if (column.isList()) { |
| | | num++; |
| | | String columnName = column.getColumnName(); |
| | | if (columnName.equals(treeName)) |
| | | { |
| | | if (columnName.equals(treeName)) { |
| | | break; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.annotation.ExcelDictFormat; |
| | | import com.ruoyi.common.convert.ExcelDictConvert; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 参数配置表 sys_config |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | @TableName("sys_config") |
| | | @ExcelIgnoreUnannotated |
| | | public class SysConfig implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | @ApiModel("参数配置业务对象") |
| | | public class SysConfig extends BaseEntity { |
| | | |
| | | /** |
| | | * 参数主键 |
| | | */ |
| | | @ApiModelProperty(value = "参数主键") |
| | | @ExcelProperty(value = "参数主键") |
| | | @TableId(value = "config_id", type = IdType.AUTO) |
| | | @TableId(value = "config_id") |
| | | private Long configId; |
| | | |
| | | /** |
| | | * 参数名称 |
| | | */ |
| | | @ApiModelProperty(value = "参数名称") |
| | | @ExcelProperty(value = "参数名称") |
| | | @NotBlank(message = "参数名称不能为空") |
| | | @Size(min = 0, max = 100, message = "参数名称不能超过100个字符") |
| | |
| | | /** |
| | | * 参数键名 |
| | | */ |
| | | @ApiModelProperty(value = "参数键名") |
| | | @ExcelProperty(value = "参数键名") |
| | | @NotBlank(message = "参数键名长度不能为空") |
| | | @Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符") |
| | |
| | | /** |
| | | * 参数键值 |
| | | */ |
| | | @ApiModelProperty(value = "参数键值") |
| | | @ExcelProperty(value = "参数键值") |
| | | @NotBlank(message = "参数键值不能为空") |
| | | @Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符") |
| | |
| | | /** |
| | | * 系统内置(Y是 N否) |
| | | */ |
| | | @ApiModelProperty(value = "系统内置(Y是 N否)") |
| | | @ExcelProperty(value = "系统内置", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_yes_no") |
| | | private String configType; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params = new HashMap<>(); |
| | | |
| | | } |
| | |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.annotation.ExcelDictFormat; |
| | | import com.ruoyi.common.convert.ExcelDictConvert; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | /** |
| | | * 系统访问记录表 sys_logininfor |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | @TableName("sys_logininfor") |
| | | @ExcelIgnoreUnannotated |
| | | @ApiModel("系统访问记录业务对象") |
| | | public class SysLogininfor implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value = "访问ID") |
| | | @ExcelProperty(value = "序号") |
| | | @TableId(value = "info_id", type = IdType.AUTO) |
| | | @TableId(value = "info_id") |
| | | private Long infoId; |
| | | |
| | | /** |
| | | * 用户账号 |
| | | */ |
| | | @ApiModelProperty(value = "用户账号") |
| | | @ExcelProperty(value = "用户账号") |
| | | private String userName; |
| | | |
| | | /** |
| | | * 登录状态 0成功 1失败 |
| | | */ |
| | | @ApiModelProperty(value = "登录状态 0成功 1失败") |
| | | @ExcelProperty(value = "登录状态", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_common_status") |
| | | @ExcelDictFormat(dictType = "sys_common_status") |
| | | private String status; |
| | | |
| | | /** |
| | | * 登录IP地址 |
| | | */ |
| | | @ApiModelProperty(value = "登录IP地址") |
| | | @ExcelProperty(value = "登录地址") |
| | | private String ipaddr; |
| | | |
| | | /** |
| | | * 登录地点 |
| | | */ |
| | | @ApiModelProperty(value = "登录地点") |
| | | @ExcelProperty(value = "登录地点") |
| | | private String loginLocation; |
| | | |
| | | /** |
| | | * 浏览器类型 |
| | | */ |
| | | @ApiModelProperty(value = "浏览器类型") |
| | | @ExcelProperty(value = "浏览器") |
| | | private String browser; |
| | | |
| | | /** |
| | | * 操作系统 |
| | | */ |
| | | @ApiModelProperty(value = "操作系统") |
| | | @ExcelProperty(value = "操作系统") |
| | | private String os; |
| | | |
| | | /** |
| | | * 提示消息 |
| | | */ |
| | | @ApiModelProperty(value = "提示消息") |
| | | @ExcelProperty(value = "提示消息") |
| | | private String msg; |
| | | |
| | | /** |
| | | * 访问时间 |
| | | */ |
| | | @ApiModelProperty(value = "访问时间") |
| | | @ExcelProperty(value = "访问时间") |
| | | private Date loginTime; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @ApiModelProperty(value = "请求参数") |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params = new HashMap<>(); |
| | | |
| | |
| | | package com.ruoyi.system.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 通知公告表 sys_notice |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Data |
| | | @NoArgsConstructor |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | @TableName("sys_notice") |
| | | public class SysNotice implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | public class SysNotice extends BaseEntity { |
| | | |
| | | /** |
| | | * 公告ID |
| | | */ |
| | | @TableId(value = "notice_id", type = IdType.AUTO) |
| | | @ApiModelProperty(value = "公告ID") |
| | | @TableId(value = "notice_id") |
| | | private Long noticeId; |
| | | |
| | | /** |
| | | * 公告标题 |
| | | */ |
| | | @ApiModelProperty(value = "公告标题") |
| | | @NotBlank(message = "公告标题不能为空") |
| | | @Size(min = 0, max = 50, message = "公告标题不能超过50个字符") |
| | | private String noticeTitle; |
| | |
| | | /** |
| | | * 公告类型(1通知 2公告) |
| | | */ |
| | | @ApiModelProperty(value = "公告类型(1通知 2公告)") |
| | | private String noticeType; |
| | | |
| | | /** |
| | | * 公告内容 |
| | | */ |
| | | @ApiModelProperty(value = "公告内容") |
| | | private String noticeContent; |
| | | |
| | | /** |
| | | * 公告状态(0正常 1关闭) |
| | | */ |
| | | @ApiModelProperty(value = "公告状态(0正常 1关闭)") |
| | | private String status; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params = new HashMap<>(); |
| | | |
| | | } |
| | |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.annotation.ExcelDictFormat; |
| | | import com.ruoyi.common.convert.ExcelDictConvert; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | /** |
| | | * 操作日志记录表 oper_log |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | @TableName("sys_oper_log") |
| | | @ExcelIgnoreUnannotated |
| | | @ApiModel("操作日志记录业务对象") |
| | | public class SysOperLog implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 日志主键 |
| | | */ |
| | | @ExcelProperty(value = "操作序号") |
| | | @TableId(value = "oper_id", type = IdType.AUTO) |
| | | @ApiModelProperty(value = "日志主键") |
| | | @ExcelProperty(value = "日志主键") |
| | | @TableId(value = "oper_id") |
| | | private Long operId; |
| | | |
| | | /** |
| | | * 操作模块 |
| | | */ |
| | | @ApiModelProperty(value = "操作模块") |
| | | @ExcelProperty(value = "操作模块") |
| | | private String title; |
| | | |
| | | /** |
| | | * 业务类型(0其它 1新增 2修改 3删除) |
| | | */ |
| | | @ApiModelProperty(value = "业务类型(0其它 1新增 2修改 3删除)") |
| | | @ExcelProperty(value = "业务类型", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_oper_type") |
| | | private Integer businessType; |
| | |
| | | /** |
| | | * 业务类型数组 |
| | | */ |
| | | @ApiModelProperty(value = "业务类型数组") |
| | | @TableField(exist = false) |
| | | private Integer[] businessTypes; |
| | | |
| | | /** |
| | | * 请求方法 |
| | | */ |
| | | @ApiModelProperty(value = "请求方法") |
| | | @ExcelProperty(value = "请求方法") |
| | | private String method; |
| | | |
| | | /** |
| | | * 请求方式 |
| | | */ |
| | | @ApiModelProperty(value = "请求方式") |
| | | @ExcelProperty(value = "请求方式") |
| | | private String requestMethod; |
| | | |
| | | /** |
| | | * 操作类别(0其它 1后台用户 2手机端用户) |
| | | */ |
| | | @ApiModelProperty(value = "操作类别(0其它 1后台用户 2手机端用户)") |
| | | @ExcelProperty(value = "操作类别", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(readConverterExp = "0=其它,1=后台用户,2=手机端用户") |
| | | private Integer operatorType; |
| | |
| | | /** |
| | | * 操作人员 |
| | | */ |
| | | @ApiModelProperty(value = "操作人员") |
| | | @ExcelProperty(value = "操作人员") |
| | | private String operName; |
| | | |
| | | /** |
| | | * 部门名称 |
| | | */ |
| | | @ApiModelProperty(value = "部门名称") |
| | | @ExcelProperty(value = "部门名称") |
| | | private String deptName; |
| | | |
| | | /** |
| | | * 请求url |
| | | */ |
| | | @ApiModelProperty(value = "请求url") |
| | | @ExcelProperty(value = "请求地址") |
| | | private String operUrl; |
| | | |
| | | /** |
| | | * 操作地址 |
| | | */ |
| | | @ApiModelProperty(value = "操作地址") |
| | | @ExcelProperty(value = "操作地址") |
| | | private String operIp; |
| | | |
| | | /** |
| | | * 操作地点 |
| | | */ |
| | | @ApiModelProperty(value = "操作地点") |
| | | @ExcelProperty(value = "操作地点") |
| | | private String operLocation; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @ApiModelProperty(value = "请求参数") |
| | | @ExcelProperty(value = "请求参数") |
| | | private String operParam; |
| | | |
| | | /** |
| | | * 返回参数 |
| | | */ |
| | | @ApiModelProperty(value = "返回参数") |
| | | @ExcelProperty(value = "返回参数") |
| | | private String jsonResult; |
| | | |
| | | /** |
| | | * 操作状态(0正常 1异常) |
| | | */ |
| | | @ApiModelProperty(value = "操作状态(0正常 1异常)") |
| | | @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_common_status") |
| | | private Integer status; |
| | |
| | | /** |
| | | * 错误消息 |
| | | */ |
| | | @ApiModelProperty(value = "错误消息") |
| | | @ExcelProperty(value = "错误消息") |
| | | private String errorMsg; |
| | | |
| | | /** |
| | | * 操作时间 |
| | | */ |
| | | @ApiModelProperty(value = "操作时间") |
| | | @ExcelProperty(value = "操作时间") |
| | | private Date operTime; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @ApiModelProperty(value = "请求参数") |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params = new HashMap<>(); |
| | | |
| | |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.annotation.ExcelDictFormat; |
| | | import com.ruoyi.common.convert.ExcelDictConvert; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 岗位表 sys_post |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | @TableName("sys_post") |
| | | @ExcelIgnoreUnannotated |
| | | public class SysPost implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | @ApiModel("岗位信息业务对象") |
| | | public class SysPost extends BaseEntity { |
| | | |
| | | /** |
| | | * 岗位序号 |
| | | */ |
| | | @ApiModelProperty(value = "岗位序号") |
| | | @ExcelProperty(value = "岗位序号") |
| | | @TableId(value = "post_id", type = IdType.AUTO) |
| | | @TableId(value = "post_id") |
| | | private Long postId; |
| | | |
| | | /** |
| | | * 岗位编码 |
| | | */ |
| | | @ApiModelProperty(value = "岗位编码") |
| | | @ExcelProperty(value = "岗位编码") |
| | | @NotBlank(message = "岗位编码不能为空") |
| | | @Size(min = 0, max = 64, message = "岗位编码长度不能超过64个字符") |
| | |
| | | /** |
| | | * 岗位名称 |
| | | */ |
| | | @ApiModelProperty(value = "岗位名称") |
| | | @ExcelProperty(value = "岗位名称") |
| | | @NotBlank(message = "岗位名称不能为空") |
| | | @Size(min = 0, max = 50, message = "岗位名称长度不能超过50个字符") |
| | |
| | | /** |
| | | * 岗位排序 |
| | | */ |
| | | @ApiModelProperty(value = "岗位排序") |
| | | @ExcelProperty(value = "岗位排序") |
| | | @NotBlank(message = "显示顺序不能为空") |
| | | private String postSort; |
| | |
| | | /** |
| | | * 状态(0正常 1停用) |
| | | */ |
| | | @ApiModelProperty(value = "状态(0正常 1停用)") |
| | | @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_common_status") |
| | | private String status; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params = new HashMap<>(); |
| | | |
| | | /** |
| | | * 用户是否存在此岗位标识 默认不存在 |
| | | */ |
| | | @ApiModelProperty(value = "用户是否存在此岗位标识 默认不存在") |
| | | @TableField(exist = false) |
| | | private boolean flag = false; |
| | | |
| | |
| | | package com.ruoyi.system.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * 角色和部门关联 sys_role_dept |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | @TableName("sys_role_dept") |
| | | @ApiModel("角色和部门关联") |
| | | public class SysRoleDept { |
| | | |
| | | /** |
| | | * 角色ID |
| | | */ |
| | | @ApiModelProperty(value = "角色ID") |
| | | private Long roleId; |
| | | |
| | | /** |
| | | * 部门ID |
| | | */ |
| | | @ApiModelProperty(value = "部门ID") |
| | | private Long deptId; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * 角色和菜单关联 sys_role_menu |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | @TableName("sys_role_menu") |
| | | @ApiModel("角色和菜单关联") |
| | | public class SysRoleMenu { |
| | | |
| | | /** |
| | | * 角色ID |
| | | */ |
| | | @ApiModelProperty(value = "角色ID") |
| | | private Long roleId; |
| | | |
| | | /** |
| | | * 菜单ID |
| | | */ |
| | | @ApiModelProperty(value = "角色ID") |
| | | private Long menuId; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.domain; |
| | | |
| | | import lombok.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * 当前在线会话 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | @ApiModel("当前在线会话业务对象") |
| | | public class SysUserOnline { |
| | | |
| | | /** |
| | | * 会话编号 |
| | | */ |
| | | @ApiModelProperty(value = "会话编号") |
| | | private String tokenId; |
| | | |
| | | /** |
| | | * 部门名称 |
| | | */ |
| | | @ApiModelProperty(value = "部门名称") |
| | | private String deptName; |
| | | |
| | | /** |
| | | * 用户名称 |
| | | */ |
| | | @ApiModelProperty(value = "用户名称") |
| | | private String userName; |
| | | |
| | | /** |
| | | * 登录IP地址 |
| | | */ |
| | | @ApiModelProperty(value = "登录IP地址") |
| | | private String ipaddr; |
| | | |
| | | /** |
| | | * 登录地址 |
| | | */ |
| | | @ApiModelProperty(value = "登录地址") |
| | | private String loginLocation; |
| | | |
| | | /** |
| | | * 浏览器类型 |
| | | */ |
| | | @ApiModelProperty(value = "浏览器类型") |
| | | private String browser; |
| | | |
| | | /** |
| | | * 操作系统 |
| | | */ |
| | | @ApiModelProperty(value = "操作系统") |
| | | private String os; |
| | | |
| | | /** |
| | | * 登录时间 |
| | | */ |
| | | @ApiModelProperty(value = "登录时间") |
| | | private Long loginTime; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * 用户和岗位关联 sys_user_post |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | @TableName("sys_user_post") |
| | | @ApiModel("用户和岗位关联") |
| | | public class SysUserPost { |
| | | |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | @ApiModelProperty(value = "用户ID") |
| | | private Long userId; |
| | | |
| | | /** |
| | | * 岗位ID |
| | | */ |
| | | @ApiModelProperty(value = "岗位ID") |
| | | private Long postId; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * 用户和角色关联 sys_user_role |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | @TableName("sys_user_role") |
| | | @ApiModel("用户和角色关联") |
| | | public class SysUserRole { |
| | | |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | @ApiModelProperty(value = "用户ID") |
| | | private Long userId; |
| | | |
| | | /** |
| | | * 角色ID |
| | | */ |
| | | @ApiModelProperty(value = "角色ID") |
| | | private Long roleId; |
| | | |
| | | } |
| | |
| | | @ApiModel("OSS对象存储分页查询对象") |
| | | public class SysOssBo extends BaseEntity { |
| | | |
| | | /** |
| | | * 分页大小 |
| | | */ |
| | | @ApiModelProperty("分页大小") |
| | | private Integer pageSize; |
| | | /** |
| | | * 当前页数 |
| | | */ |
| | | @ApiModelProperty("当前页数") |
| | | private Integer pageNum; |
| | | /** |
| | | * 排序列 |
| | | */ |
| | | @ApiModelProperty("排序列") |
| | | private String orderByColumn; |
| | | /** |
| | | * 排序的方向desc或者asc |
| | | */ |
| | | @ApiModelProperty(value = "排序的方向", example = "asc,desc") |
| | | private String isAsc; |
| | | /** |
| | | * 分页大小 |
| | | */ |
| | | @ApiModelProperty("分页大小") |
| | | private Integer pageSize; |
| | | /** |
| | | * 当前页数 |
| | | */ |
| | | @ApiModelProperty("当前页数") |
| | | private Integer pageNum; |
| | | /** |
| | | * 排序列 |
| | | */ |
| | | @ApiModelProperty("排序列") |
| | | private String orderByColumn; |
| | | /** |
| | | * 排序的方向desc或者asc |
| | | */ |
| | | @ApiModelProperty(value = "排序的方向", example = "asc,desc") |
| | | private String isAsc; |
| | | |
| | | |
| | | /** |
| | | * 文件名 |
| | | */ |
| | | @ApiModelProperty("文件名") |
| | | private String fileName; |
| | | /** |
| | | * 原名 |
| | | */ |
| | | @ApiModelProperty("原名") |
| | | private String originalName; |
| | | /** |
| | | * 文件后缀名 |
| | | */ |
| | | @ApiModelProperty("文件后缀名") |
| | | private String fileSuffix; |
| | | /** |
| | | * URL地址 |
| | | */ |
| | | @ApiModelProperty("URL地址") |
| | | private String url; |
| | | /** |
| | | * 服务商 |
| | | */ |
| | | @ApiModelProperty("服务商") |
| | | private String service; |
| | | /** |
| | | * 文件名 |
| | | */ |
| | | @ApiModelProperty("文件名") |
| | | private String fileName; |
| | | /** |
| | | * 原名 |
| | | */ |
| | | @ApiModelProperty("原名") |
| | | private String originalName; |
| | | /** |
| | | * 文件后缀名 |
| | | */ |
| | | @ApiModelProperty("文件后缀名") |
| | | private String fileSuffix; |
| | | /** |
| | | * URL地址 |
| | | */ |
| | | @ApiModelProperty("URL地址") |
| | | private String url; |
| | | /** |
| | | * 服务商 |
| | | */ |
| | | @ApiModelProperty("服务商") |
| | | private String service; |
| | | |
| | | } |
| | |
| | | @ApiModel("对象存储配置业务对象") |
| | | public class SysOssConfigBo extends BaseEntity { |
| | | |
| | | /** |
| | | * 主建 |
| | | */ |
| | | @ApiModelProperty(value = "主建", required = true) |
| | | @NotNull(message = "主建不能为空", groups = { EditGroup.class }) |
| | | private Long ossConfigId; |
| | | /** |
| | | * 主建 |
| | | */ |
| | | @ApiModelProperty(value = "主建", required = true) |
| | | @NotNull(message = "主建不能为空", groups = {EditGroup.class}) |
| | | private Long ossConfigId; |
| | | |
| | | /** |
| | | * 配置key |
| | | */ |
| | | @ApiModelProperty(value = "configKey", required = true) |
| | | @NotBlank(message = "configKey不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | @Size(min = 2, max = 100, message = "configKey长度必须介于2和20 之间") |
| | | @NotBlank(message = "configKey不能为空", groups = {AddGroup.class, EditGroup.class}) |
| | | @Size(min = 2, max = 100, message = "configKey长度必须介于2和20 之间") |
| | | private String configKey; |
| | | |
| | | /** |
| | | * accessKey |
| | | */ |
| | | @ApiModelProperty(value = "accessKey", required = true) |
| | | @NotBlank(message = "accessKey不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | @Size(min = 2, max = 100, message = "accessKey长度必须介于2和100 之间") |
| | | @NotBlank(message = "accessKey不能为空", groups = {AddGroup.class, EditGroup.class}) |
| | | @Size(min = 2, max = 100, message = "accessKey长度必须介于2和100 之间") |
| | | private String accessKey; |
| | | |
| | | /** |
| | | * 秘钥 |
| | | */ |
| | | @ApiModelProperty(value = "secretKey", required = true) |
| | | @NotBlank(message = "secretKey不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | @Size(min = 2, max = 100, message = "secretKey长度必须介于2和100 之间") |
| | | @NotBlank(message = "secretKey不能为空", groups = {AddGroup.class, EditGroup.class}) |
| | | @Size(min = 2, max = 100, message = "secretKey长度必须介于2和100 之间") |
| | | private String secretKey; |
| | | |
| | | /** |
| | | * 桶名称 |
| | | */ |
| | | @ApiModelProperty(value = "bucketName", required = true) |
| | | @NotBlank(message = "bucketName不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | @Size(min = 2, max = 100, message = "bucketName长度必须介于2和100之间") |
| | | @NotBlank(message = "bucketName不能为空", groups = {AddGroup.class, EditGroup.class}) |
| | | @Size(min = 2, max = 100, message = "bucketName长度必须介于2和100之间") |
| | | private String bucketName; |
| | | |
| | | /** |
| | |
| | | * 访问站点 |
| | | */ |
| | | @ApiModelProperty(value = "endpoint", required = true) |
| | | @NotBlank(message = "endpoint不能为空", groups = { AddGroup.class, EditGroup.class }) |
| | | @Size(min = 2, max = 100, message = "endpoint长度必须介于2和100之间") |
| | | @NotBlank(message = "endpoint不能为空", groups = {AddGroup.class, EditGroup.class}) |
| | | @Size(min = 2, max = 100, message = "endpoint长度必须介于2和100之间") |
| | | private String endpoint; |
| | | |
| | | /** |
| | | * 是否https(Y=是,N=否) |
| | | */ |
| | | @ApiModelProperty("是否https(Y=是,N=否)") |
| | | private String isHttps; |
| | | /** |
| | | * 是否https(Y=是,N=否) |
| | | */ |
| | | @ApiModelProperty("是否https(Y=是,N=否)") |
| | | private String isHttps; |
| | | |
| | | /** |
| | | * 状态(0=正常,1=停用) |
| | | */ |
| | | @ApiModelProperty("状态(0=正常,1=停用)") |
| | | private String status; |
| | | /** |
| | | * 状态(0=正常,1=停用) |
| | | */ |
| | | @ApiModelProperty("状态(0=正常,1=停用)") |
| | | private String status; |
| | | |
| | | /** |
| | | * 域 |
| | |
| | | package com.ruoyi.system.domain.vo; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | @ApiModel("路由显示信息") |
| | | public class MetaVo { |
| | | |
| | | /** |
| | | * 设置该路由在侧边栏和面包屑中展示的名字 |
| | | */ |
| | | @ApiModelProperty(value = "设置该路由在侧边栏和面包屑中展示的名字") |
| | | private String title; |
| | | |
| | | /** |
| | | * 设置该路由的图标,对应路径src/assets/icons/svg |
| | | */ |
| | | @ApiModelProperty(value = "设置该路由的图标,对应路径src/assets/icons/svg") |
| | | private String icon; |
| | | |
| | | /** |
| | | * 设置为true,则不会被 <keep-alive>缓存 |
| | | */ |
| | | @ApiModelProperty(value = "设置为true,则不会被 <keep-alive>缓存") |
| | | private boolean noCache; |
| | | |
| | | /** |
| | | * 内链地址(http(s)://开头) |
| | | */ |
| | | private String link; |
| | | /** |
| | | * 内链地址(http(s)://开头) |
| | | */ |
| | | @ApiModelProperty(value = "内链地址(http(s)://开头)") |
| | | private String link; |
| | | |
| | | public MetaVo(String title, String icon) { |
| | | this.title = title; |
| | |
| | | this.noCache = noCache; |
| | | } |
| | | |
| | | public MetaVo(String title, String icon, String link) { |
| | | this.title = title; |
| | | this.icon = icon; |
| | | this.link = link; |
| | | } |
| | | public MetaVo(String title, String icon, String link) { |
| | | this.title = title; |
| | | this.icon = icon; |
| | | this.link = link; |
| | | } |
| | | |
| | | public MetaVo(String title, String icon, boolean noCache, String link) { |
| | | this.title = title; |
| | | this.icon = icon; |
| | | this.noCache = noCache; |
| | | if (StringUtils.ishttp(link)) { |
| | | this.link = link; |
| | | } |
| | | } |
| | | public MetaVo(String title, String icon, boolean noCache, String link) { |
| | | this.title = title; |
| | | this.icon = icon; |
| | | this.noCache = noCache; |
| | | if (StringUtils.ishttp(link)) { |
| | | this.link = link; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import lombok.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.util.List; |
| | |
| | | /** |
| | | * 路由配置信息 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Data |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | @JsonInclude(JsonInclude.Include.NON_EMPTY) |
| | | @ApiModel("路由配置信息") |
| | | public class RouterVo { |
| | | |
| | | /** |
| | | * 路由名字 |
| | | */ |
| | | @ApiModelProperty(value = "路由名字") |
| | | private String name; |
| | | |
| | | /** |
| | | * 路由地址 |
| | | */ |
| | | @ApiModelProperty(value = "路由地址") |
| | | private String path; |
| | | |
| | | /** |
| | | * 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现 |
| | | */ |
| | | @ApiModelProperty(value = "是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现") |
| | | private boolean hidden; |
| | | |
| | | /** |
| | | * 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击 |
| | | */ |
| | | @ApiModelProperty(value = "重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击") |
| | | private String redirect; |
| | | |
| | | /** |
| | | * 组件地址 |
| | | */ |
| | | @ApiModelProperty(value = "组件地址") |
| | | private String component; |
| | | |
| | | /** |
| | | * 路由参数:如 {"id": 1, "name": "ry"} |
| | | */ |
| | | @ApiModelProperty(value = "路由参数:如 {\"id\": 1, \"name\": \"ry\"}") |
| | | private String query; |
| | | |
| | | /** |
| | | * 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面 |
| | | */ |
| | | @ApiModelProperty(value = "当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面") |
| | | private Boolean alwaysShow; |
| | | |
| | | /** |
| | | * 其他元素 |
| | | */ |
| | | @ApiModelProperty(value = "其他元素") |
| | | private MetaVo meta; |
| | | |
| | | /** |
| | | * 子路由 |
| | | */ |
| | | @ApiModelProperty(value = "子路由") |
| | | private List<RouterVo> children; |
| | | |
| | | } |
| | |
| | | import lombok.Data; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 对象存储配置视图对象 sys_oss_config |
| | | * |
| | |
| | | @ExcelIgnoreUnannotated |
| | | public class SysOssConfigVo { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | /** |
| | | * 主建 |
| | | */ |
| | | @ApiModelProperty("主建") |
| | | private Long ossConfigId; |
| | | @ApiModelProperty("主建") |
| | | private Long ossConfigId; |
| | | |
| | | /** |
| | | * 配置key |
| | | */ |
| | | @ApiModelProperty("配置key") |
| | | private String configKey; |
| | | @ApiModelProperty("配置key") |
| | | private String configKey; |
| | | |
| | | /** |
| | | * accessKey |
| | | */ |
| | | @ApiModelProperty("accessKey") |
| | | private String accessKey; |
| | | @ApiModelProperty("accessKey") |
| | | private String accessKey; |
| | | |
| | | /** |
| | | * 秘钥 |
| | | */ |
| | | @ApiModelProperty("secretKey") |
| | | private String secretKey; |
| | | @ApiModelProperty("secretKey") |
| | | private String secretKey; |
| | | |
| | | /** |
| | | * 桶名称 |
| | | */ |
| | | @ApiModelProperty("桶名称") |
| | | private String bucketName; |
| | | @ApiModelProperty("桶名称") |
| | | private String bucketName; |
| | | |
| | | /** |
| | | * 前缀 |
| | | */ |
| | | @ApiModelProperty("前缀") |
| | | private String prefix; |
| | | @ApiModelProperty("前缀") |
| | | private String prefix; |
| | | |
| | | /** |
| | | * 访问站点 |
| | | */ |
| | | @ApiModelProperty("访问站点") |
| | | private String endpoint; |
| | | @ApiModelProperty("访问站点") |
| | | private String endpoint; |
| | | |
| | | /** |
| | | * 是否https(Y=是,N=否) |
| | | */ |
| | | @ApiModelProperty("是否https(Y=是,N=否)") |
| | | private String isHttps; |
| | | @ApiModelProperty("是否https(Y=是,N=否)") |
| | | private String isHttps; |
| | | |
| | | /** |
| | | * 域 |
| | | */ |
| | | @ApiModelProperty("域") |
| | | private String region; |
| | | @ApiModelProperty("域") |
| | | private String region; |
| | | |
| | | /** |
| | | * 状态(0=正常,1=停用) |
| | | */ |
| | | @ApiModelProperty("状态(0=正常,1=停用)") |
| | | private String status; |
| | | @ApiModelProperty("状态(0=正常,1=停用)") |
| | | private String status; |
| | | |
| | | /** |
| | | * 扩展字段 |
| | | */ |
| | | @ApiModelProperty("扩展字段") |
| | | private String ext1; |
| | | @ApiModelProperty("扩展字段") |
| | | private String ext1; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty("备注") |
| | | private String remark; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty("备注") |
| | | private String remark; |
| | | |
| | | } |
| | |
| | | @ApiModel("OSS对象存储视图对象") |
| | | public class SysOssVo { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 对象存储主键 |
| | | */ |
| | | @ApiModelProperty("对象存储主键") |
| | | private Long ossId; |
| | | /** |
| | | * 对象存储主键 |
| | | */ |
| | | @ApiModelProperty("对象存储主键") |
| | | private Long ossId; |
| | | |
| | | /** |
| | | * 文件名 |
| | | */ |
| | | @ApiModelProperty("文件名") |
| | | private String fileName; |
| | | /** |
| | | * 文件名 |
| | | */ |
| | | @ApiModelProperty("文件名") |
| | | private String fileName; |
| | | |
| | | /** |
| | | * 原名 |
| | | */ |
| | | @ApiModelProperty("原名") |
| | | private String originalName; |
| | | /** |
| | | * 原名 |
| | | */ |
| | | @ApiModelProperty("原名") |
| | | private String originalName; |
| | | |
| | | /** |
| | | * 文件后缀名 |
| | | */ |
| | | @ApiModelProperty("文件后缀名") |
| | | private String fileSuffix; |
| | | /** |
| | | * 文件后缀名 |
| | | */ |
| | | @ApiModelProperty("文件后缀名") |
| | | private String fileSuffix; |
| | | |
| | | /** |
| | | * URL地址 |
| | | */ |
| | | @ApiModelProperty("URL地址") |
| | | private String url; |
| | | /** |
| | | * URL地址 |
| | | */ |
| | | @ApiModelProperty("URL地址") |
| | | private String url; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @ApiModelProperty("创建时间") |
| | | private Date createTime; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @ApiModelProperty("创建时间") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 上传人 |
| | | */ |
| | | @ApiModelProperty("上传人") |
| | | private String createBy; |
| | | /** |
| | | * 上传人 |
| | | */ |
| | | @ApiModelProperty("上传人") |
| | | private String createBy; |
| | | |
| | | /** |
| | | * 服务商 |
| | | */ |
| | | @ApiModelProperty("服务商") |
| | | private String service; |
| | | /** |
| | | * 服务商 |
| | | */ |
| | | @ApiModelProperty("服务商") |
| | | private String service; |
| | | |
| | | |
| | | } |
| | |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | public class SysUserExportVo implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | @ExcelProperty(value = "用户序号") |
| | | private Long userId; |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | @ExcelProperty(value = "用户序号") |
| | | private Long userId; |
| | | |
| | | /** |
| | | * 用户账号 |
| | | */ |
| | | @ExcelProperty(value = "登录名称") |
| | | private String userName; |
| | | /** |
| | | * 用户账号 |
| | | */ |
| | | @ExcelProperty(value = "登录名称") |
| | | private String userName; |
| | | |
| | | /** |
| | | * 用户昵称 |
| | | */ |
| | | @ExcelProperty(value = "用户名称") |
| | | private String nickName; |
| | | /** |
| | | * 用户昵称 |
| | | */ |
| | | @ExcelProperty(value = "用户名称") |
| | | private String nickName; |
| | | |
| | | /** |
| | | * 用户邮箱 |
| | | */ |
| | | @ExcelProperty(value = "用户邮箱") |
| | | private String email; |
| | | /** |
| | | * 用户邮箱 |
| | | */ |
| | | @ExcelProperty(value = "用户邮箱") |
| | | private String email; |
| | | |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | @ExcelProperty(value = "手机号码") |
| | | private String phonenumber; |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | @ExcelProperty(value = "手机号码") |
| | | private String phonenumber; |
| | | |
| | | /** |
| | | * 用户性别 |
| | | */ |
| | | @ExcelProperty(value = "用户性别", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_user_sex") |
| | | private String sex; |
| | | /** |
| | | * 用户性别 |
| | | */ |
| | | @ExcelProperty(value = "用户性别", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_user_sex") |
| | | private String sex; |
| | | |
| | | /** |
| | | * 帐号状态(0正常 1停用) |
| | | */ |
| | | @ExcelProperty(value = "帐号状态", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_common_status") |
| | | private String status; |
| | | /** |
| | | * 帐号状态(0正常 1停用) |
| | | */ |
| | | @ExcelProperty(value = "帐号状态", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_common_status") |
| | | private String status; |
| | | |
| | | /** |
| | | * 最后登录IP |
| | | */ |
| | | @ExcelProperty(value = "最后登录IP") |
| | | private String loginIp; |
| | | /** |
| | | * 最后登录IP |
| | | */ |
| | | @ExcelProperty(value = "最后登录IP") |
| | | private String loginIp; |
| | | |
| | | /** |
| | | * 最后登录时间 |
| | | */ |
| | | @ExcelProperty(value = "最后登录时间") |
| | | private Date loginDate; |
| | | /** |
| | | * 最后登录时间 |
| | | */ |
| | | @ExcelProperty(value = "最后登录时间") |
| | | private Date loginDate; |
| | | |
| | | /** |
| | | * 部门名称 |
| | | */ |
| | | @ExcelProperty(value = "部门名称") |
| | | private String deptName; |
| | | /** |
| | | * 部门名称 |
| | | */ |
| | | @ExcelProperty(value = "部门名称") |
| | | private String deptName; |
| | | |
| | | /** |
| | | * 负责人 |
| | | */ |
| | | @ExcelProperty(value = "部门负责人") |
| | | private String leader; |
| | | /** |
| | | * 负责人 |
| | | */ |
| | | @ExcelProperty(value = "部门负责人") |
| | | private String leader; |
| | | |
| | | } |
| | |
| | | @NoArgsConstructor |
| | | // @Accessors(chain = true) // 导入不允许使用 会找不到set方法 |
| | | public class SysUserImportVo implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | @ExcelProperty(value = "用户序号") |
| | | private Long userId; |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | @ExcelProperty(value = "用户序号") |
| | | private Long userId; |
| | | |
| | | /** |
| | | * 部门ID |
| | | */ |
| | | @ExcelProperty(value = "部门编号") |
| | | private Long deptId; |
| | | /** |
| | | * 部门ID |
| | | */ |
| | | @ExcelProperty(value = "部门编号") |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * 用户账号 |
| | | */ |
| | | @ExcelProperty(value = "登录名称") |
| | | private String userName; |
| | | /** |
| | | * 用户账号 |
| | | */ |
| | | @ExcelProperty(value = "登录名称") |
| | | private String userName; |
| | | |
| | | /** |
| | | * 用户昵称 |
| | | */ |
| | | @ExcelProperty(value = "用户名称") |
| | | private String nickName; |
| | | /** |
| | | * 用户昵称 |
| | | */ |
| | | @ExcelProperty(value = "用户名称") |
| | | private String nickName; |
| | | |
| | | /** |
| | | * 用户邮箱 |
| | | */ |
| | | @ExcelProperty(value = "用户邮箱") |
| | | private String email; |
| | | /** |
| | | * 用户邮箱 |
| | | */ |
| | | @ExcelProperty(value = "用户邮箱") |
| | | private String email; |
| | | |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | @ExcelProperty(value = "手机号码") |
| | | private String phonenumber; |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | @ExcelProperty(value = "手机号码") |
| | | private String phonenumber; |
| | | |
| | | /** |
| | | * 用户性别 |
| | | */ |
| | | @ExcelProperty(value = "用户性别", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_user_sex") |
| | | private String sex; |
| | | /** |
| | | * 用户性别 |
| | | */ |
| | | @ExcelProperty(value = "用户性别", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_user_sex") |
| | | private String sex; |
| | | |
| | | /** |
| | | * 帐号状态(0正常 1停用) |
| | | */ |
| | | @ExcelProperty(value = "帐号状态", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_common_status") |
| | | private String status; |
| | | /** |
| | | * 帐号状态(0正常 1停用) |
| | | */ |
| | | @ExcelProperty(value = "帐号状态", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_common_status") |
| | | private String status; |
| | | |
| | | } |
| | |
| | | /** |
| | | * 参数配置 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface SysConfigMapper extends BaseMapperPlus<SysConfig> { |
| | | |
| | |
| | | /** |
| | | * 部门管理 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface SysDeptMapper extends BaseMapperPlus<SysDept> { |
| | | |
| | |
| | | * @param dept 部门信息 |
| | | * @return 部门信息集合 |
| | | */ |
| | | public List<SysDept> selectDeptList(SysDept dept); |
| | | List<SysDept> selectDeptList(SysDept dept); |
| | | |
| | | /** |
| | | * 根据角色ID查询部门树信息 |
| | | * |
| | | * @param roleId 角色ID |
| | | * @param roleId 角色ID |
| | | * @param deptCheckStrictly 部门树选择项是否关联显示 |
| | | * @return 选中部门列表 |
| | | */ |
| | | public List<Integer> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly); |
| | | List<Integer> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly); |
| | | |
| | | /** |
| | | * 修改子元素关系 |
| | | * |
| | | * @param depts 子元素 |
| | | * @return 结果 |
| | | */ |
| | | public int updateDeptChildren(@Param("depts") List<SysDept> depts); |
| | | /** |
| | | * 修改子元素关系 |
| | | * |
| | | * @param depts 子元素 |
| | | * @return 结果 |
| | | */ |
| | | int updateDeptChildren(@Param("depts") List<SysDept> depts); |
| | | |
| | | } |
| | |
| | | /** |
| | | * 字典表 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface SysDictDataMapper extends BaseMapperPlus<SysDictData> { |
| | | |
| | | default List<SysDictData> selectDictDataByType(String dictType) { |
| | | return selectList( |
| | | new LambdaQueryWrapper<SysDictData>() |
| | | .eq(SysDictData::getStatus, "0") |
| | | .eq(SysDictData::getDictType, dictType) |
| | | .orderByAsc(SysDictData::getDictSort)); |
| | | } |
| | | default List<SysDictData> selectDictDataByType(String dictType) { |
| | | return selectList( |
| | | new LambdaQueryWrapper<SysDictData>() |
| | | .eq(SysDictData::getStatus, "0") |
| | | .eq(SysDictData::getDictType, dictType) |
| | | .orderByAsc(SysDictData::getDictSort)); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 字典表 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface SysDictTypeMapper extends BaseMapperPlus<SysDictType> { |
| | | |
| | |
| | | /** |
| | | * 系统访问日志情况信息 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface SysLogininforMapper extends BaseMapperPlus<SysLogininfor> { |
| | | |
| | |
| | | /** |
| | | * 菜单表 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface SysMenuMapper extends BaseMapperPlus<SysMenu> { |
| | | |
| | |
| | | * |
| | | * @return 权限列表 |
| | | */ |
| | | public List<String> selectMenuPerms(); |
| | | List<String> selectMenuPerms(); |
| | | |
| | | /** |
| | | * 根据用户查询系统菜单列表 |
| | |
| | | * @param menu 菜单信息 |
| | | * @return 菜单列表 |
| | | */ |
| | | public List<SysMenu> selectMenuListByUserId(SysMenu menu); |
| | | List<SysMenu> selectMenuListByUserId(SysMenu menu); |
| | | |
| | | /** |
| | | * 根据用户ID查询权限 |
| | |
| | | * @param userId 用户ID |
| | | * @return 权限列表 |
| | | */ |
| | | public List<String> selectMenuPermsByUserId(Long userId); |
| | | List<String> selectMenuPermsByUserId(Long userId); |
| | | |
| | | /** |
| | | * 根据用户ID查询菜单 |
| | | * |
| | | * @return 菜单列表 |
| | | */ |
| | | public List<SysMenu> selectMenuTreeAll(); |
| | | List<SysMenu> selectMenuTreeAll(); |
| | | |
| | | /** |
| | | * 根据用户ID查询菜单 |
| | |
| | | * @param userId 用户ID |
| | | * @return 菜单列表 |
| | | */ |
| | | public List<SysMenu> selectMenuTreeByUserId(Long userId); |
| | | List<SysMenu> selectMenuTreeByUserId(Long userId); |
| | | |
| | | /** |
| | | * 根据角色ID查询菜单树信息 |
| | |
| | | * @param menuCheckStrictly 菜单树选择项是否关联显示 |
| | | * @return 选中菜单列表 |
| | | */ |
| | | public List<Integer> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly); |
| | | List<Integer> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly); |
| | | |
| | | } |
| | |
| | | /** |
| | | * 通知公告表 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface SysNoticeMapper extends BaseMapperPlus<SysNotice> { |
| | | |
| | |
| | | /** |
| | | * 操作日志 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface SysOperLogMapper extends BaseMapperPlus<SysOperLog> { |
| | | |
| | |
| | | /** |
| | | * 岗位信息 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface SysPostMapper extends BaseMapperPlus<SysPost> { |
| | | |
| | |
| | | * @param userId 用户ID |
| | | * @return 选中岗位ID列表 |
| | | */ |
| | | public List<Integer> selectPostListByUserId(Long userId); |
| | | List<Integer> selectPostListByUserId(Long userId); |
| | | |
| | | /** |
| | | * 查询用户所属岗位组 |
| | |
| | | * @param userName 用户名 |
| | | * @return 结果 |
| | | */ |
| | | public List<SysPost> selectPostsByUserName(String userName); |
| | | List<SysPost> selectPostsByUserName(String userName); |
| | | |
| | | } |
| | |
| | | /** |
| | | * 角色与部门关联表 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface SysRoleDeptMapper extends BaseMapperPlus<SysRoleDept> { |
| | | |
| | |
| | | /** |
| | | * 角色表 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface SysRoleMapper extends BaseMapperPlus<SysRole> { |
| | | |
| | |
| | | * @param role 角色信息 |
| | | * @return 角色数据集合信息 |
| | | */ |
| | | public List<SysRole> selectRoleList(SysRole role); |
| | | List<SysRole> selectRoleList(SysRole role); |
| | | |
| | | /** |
| | | * 根据用户ID查询角色 |
| | |
| | | * @param userId 用户ID |
| | | * @return 角色列表 |
| | | */ |
| | | public List<SysRole> selectRolePermissionByUserId(Long userId); |
| | | List<SysRole> selectRolePermissionByUserId(Long userId); |
| | | |
| | | |
| | | /** |
| | |
| | | * @param userId 用户ID |
| | | * @return 选中角色ID列表 |
| | | */ |
| | | public List<Integer> selectRoleListByUserId(Long userId); |
| | | List<Integer> selectRoleListByUserId(Long userId); |
| | | |
| | | /** |
| | | * 根据用户ID查询角色 |
| | |
| | | * @param userName 用户名 |
| | | * @return 角色列表 |
| | | */ |
| | | public List<SysRole> selectRolesByUserName(String userName); |
| | | List<SysRole> selectRolesByUserName(String userName); |
| | | |
| | | } |
| | |
| | | /** |
| | | * 角色与菜单关联表 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface SysRoleMenuMapper extends BaseMapperPlus<SysRoleMenu> { |
| | | |
| | |
| | | /** |
| | | * 用户表 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface SysUserMapper extends BaseMapperPlus<SysUser> { |
| | | |
| | |
| | | * @param sysUser 用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | | public List<SysUser> selectUserList(SysUser sysUser); |
| | | List<SysUser> selectUserList(SysUser sysUser); |
| | | |
| | | /** |
| | | * 根据条件分页查询未已配用户角色列表 |
| | |
| | | * @param user 用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | | public Page<SysUser> selectAllocatedList(@Param("page") Page<SysUser> page, @Param("user") SysUser user); |
| | | Page<SysUser> selectAllocatedList(@Param("page") Page<SysUser> page, @Param("user") SysUser user); |
| | | |
| | | /** |
| | | * 根据条件分页查询未分配用户角色列表 |
| | |
| | | * @param user 用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | | public Page<SysUser> selectUnallocatedList(@Param("page") Page<SysUser> page, @Param("user") SysUser user); |
| | | Page<SysUser> selectUnallocatedList(@Param("page") Page<SysUser> page, @Param("user") SysUser user); |
| | | |
| | | /** |
| | | * 通过用户名查询用户 |
| | |
| | | * @param userName 用户名 |
| | | * @return 用户对象信息 |
| | | */ |
| | | public SysUser selectUserByUserName(String userName); |
| | | SysUser selectUserByUserName(String userName); |
| | | |
| | | /** |
| | | * 通过用户ID查询用户 |
| | |
| | | * @param userId 用户ID |
| | | * @return 用户对象信息 |
| | | */ |
| | | public SysUser selectUserById(Long userId); |
| | | SysUser selectUserById(Long userId); |
| | | |
| | | } |
| | |
| | | /** |
| | | * 用户与岗位关联表 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface SysUserPostMapper extends BaseMapperPlus<SysUserPost> { |
| | | |
| | |
| | | /** |
| | | * 用户与角色关联表 数据层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface SysUserRoleMapper extends BaseMapperPlus<SysUserRole> { |
| | | |
| | |
| | | /** |
| | | * 参数配置 服务层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface ISysConfigService extends IService<SysConfig> { |
| | | |
| | |
| | | * @param configId 参数配置ID |
| | | * @return 参数配置信息 |
| | | */ |
| | | public SysConfig selectConfigById(Long configId); |
| | | SysConfig selectConfigById(Long configId); |
| | | |
| | | /** |
| | | * 根据键名查询参数配置信息 |
| | |
| | | * @param configKey 参数键名 |
| | | * @return 参数键值 |
| | | */ |
| | | public String selectConfigByKey(String configKey); |
| | | String selectConfigByKey(String configKey); |
| | | |
| | | /** |
| | | * 获取验证码开关 |
| | | * |
| | | * @return true开启,false关闭 |
| | | */ |
| | | public boolean selectCaptchaOnOff(); |
| | | boolean selectCaptchaOnOff(); |
| | | |
| | | /** |
| | | * 查询参数配置列表 |
| | |
| | | * @param config 参数配置信息 |
| | | * @return 参数配置集合 |
| | | */ |
| | | public List<SysConfig> selectConfigList(SysConfig config); |
| | | List<SysConfig> selectConfigList(SysConfig config); |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | public int insertConfig(SysConfig config); |
| | | int insertConfig(SysConfig config); |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updateConfig(SysConfig config); |
| | | int updateConfig(SysConfig config); |
| | | |
| | | /** |
| | | * 批量删除参数信息 |
| | |
| | | * @param configIds 需要删除的参数ID |
| | | * @return 结果 |
| | | */ |
| | | public void deleteConfigByIds(Long[] configIds); |
| | | void deleteConfigByIds(Long[] configIds); |
| | | |
| | | /** |
| | | * 加载参数缓存数据 |
| | | */ |
| | | public void loadingConfigCache(); |
| | | void loadingConfigCache(); |
| | | |
| | | /** |
| | | * 清空参数缓存数据 |
| | | */ |
| | | public void clearConfigCache(); |
| | | void clearConfigCache(); |
| | | |
| | | /** |
| | | * 重置参数缓存数据 |
| | | */ |
| | | public void resetConfigCache(); |
| | | void resetConfigCache(); |
| | | |
| | | /** |
| | | * 校验参数键名是否唯一 |
| | |
| | | * @param config 参数信息 |
| | | * @return 结果 |
| | | */ |
| | | public String checkConfigKeyUnique(SysConfig config); |
| | | String checkConfigKeyUnique(SysConfig config); |
| | | } |
| | |
| | | /** |
| | | * 部门管理 服务层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface ISysDeptService extends IService<SysDept> { |
| | | /** |
| | |
| | | * @param dept 部门信息 |
| | | * @return 部门信息集合 |
| | | */ |
| | | public List<SysDept> selectDeptList(SysDept dept); |
| | | List<SysDept> selectDeptList(SysDept dept); |
| | | |
| | | /** |
| | | * 构建前端所需要树结构 |
| | |
| | | * @param depts 部门列表 |
| | | * @return 树结构列表 |
| | | */ |
| | | public List<SysDept> buildDeptTree(List<SysDept> depts); |
| | | List<SysDept> buildDeptTree(List<SysDept> depts); |
| | | |
| | | /** |
| | | * 构建前端所需要下拉树结构 |
| | |
| | | * @param depts 部门列表 |
| | | * @return 下拉树结构列表 |
| | | */ |
| | | public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts); |
| | | List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts); |
| | | |
| | | /** |
| | | * 根据角色ID查询部门树信息 |
| | |
| | | * @param roleId 角色ID |
| | | * @return 选中部门列表 |
| | | */ |
| | | public List<Integer> selectDeptListByRoleId(Long roleId); |
| | | List<Integer> selectDeptListByRoleId(Long roleId); |
| | | |
| | | /** |
| | | * 根据部门ID查询信息 |
| | |
| | | * @param deptId 部门ID |
| | | * @return 部门信息 |
| | | */ |
| | | public SysDept selectDeptById(Long deptId); |
| | | SysDept selectDeptById(Long deptId); |
| | | |
| | | /** |
| | | * 根据ID查询所有子部门(正常状态) |
| | |
| | | * @param deptId 部门ID |
| | | * @return 子部门数 |
| | | */ |
| | | public long selectNormalChildrenDeptById(Long deptId); |
| | | long selectNormalChildrenDeptById(Long deptId); |
| | | |
| | | /** |
| | | * 是否存在部门子节点 |
| | |
| | | * @param deptId 部门ID |
| | | * @return 结果 |
| | | */ |
| | | public boolean hasChildByDeptId(Long deptId); |
| | | boolean hasChildByDeptId(Long deptId); |
| | | |
| | | /** |
| | | * 查询部门是否存在用户 |
| | |
| | | * @param deptId 部门ID |
| | | * @return 结果 true 存在 false 不存在 |
| | | */ |
| | | public boolean checkDeptExistUser(Long deptId); |
| | | boolean checkDeptExistUser(Long deptId); |
| | | |
| | | /** |
| | | * 校验部门名称是否唯一 |
| | |
| | | * @param dept 部门信息 |
| | | * @return 结果 |
| | | */ |
| | | public String checkDeptNameUnique(SysDept dept); |
| | | String checkDeptNameUnique(SysDept dept); |
| | | |
| | | /** |
| | | * 校验部门是否有数据权限 |
| | | * |
| | | * @param deptId 部门id |
| | | */ |
| | | public void checkDeptDataScope(Long deptId); |
| | | void checkDeptDataScope(Long deptId); |
| | | |
| | | /** |
| | | * 新增保存部门信息 |
| | |
| | | * @param dept 部门信息 |
| | | * @return 结果 |
| | | */ |
| | | public int insertDept(SysDept dept); |
| | | int insertDept(SysDept dept); |
| | | |
| | | /** |
| | | * 修改保存部门信息 |
| | |
| | | * @param dept 部门信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updateDept(SysDept dept); |
| | | int updateDept(SysDept dept); |
| | | |
| | | /** |
| | | * 删除部门管理信息 |
| | |
| | | * @param deptId 部门ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteDeptById(Long deptId); |
| | | int deleteDeptById(Long deptId); |
| | | } |
| | |
| | | /** |
| | | * 字典 业务层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface ISysDictDataService extends IService<SysDictData> { |
| | | |
| | |
| | | * @param dictData 字典数据信息 |
| | | * @return 字典数据集合信息 |
| | | */ |
| | | public List<SysDictData> selectDictDataList(SysDictData dictData); |
| | | List<SysDictData> selectDictDataList(SysDictData dictData); |
| | | |
| | | /** |
| | | * 根据字典类型和字典键值查询字典数据信息 |
| | |
| | | * @param dictValue 字典键值 |
| | | * @return 字典标签 |
| | | */ |
| | | public String selectDictLabel(String dictType, String dictValue); |
| | | String selectDictLabel(String dictType, String dictValue); |
| | | |
| | | /** |
| | | * 根据字典数据ID查询信息 |
| | |
| | | * @param dictCode 字典数据ID |
| | | * @return 字典数据 |
| | | */ |
| | | public SysDictData selectDictDataById(Long dictCode); |
| | | SysDictData selectDictDataById(Long dictCode); |
| | | |
| | | /** |
| | | * 批量删除字典数据信息 |
| | |
| | | * @param dictCodes 需要删除的字典数据ID |
| | | * @return 结果 |
| | | */ |
| | | public void deleteDictDataByIds(Long[] dictCodes); |
| | | void deleteDictDataByIds(Long[] dictCodes); |
| | | |
| | | /** |
| | | * 新增保存字典数据信息 |
| | |
| | | * @param dictData 字典数据信息 |
| | | * @return 结果 |
| | | */ |
| | | public int insertDictData(SysDictData dictData); |
| | | int insertDictData(SysDictData dictData); |
| | | |
| | | /** |
| | | * 修改保存字典数据信息 |
| | |
| | | * @param dictData 字典数据信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updateDictData(SysDictData dictData); |
| | | int updateDictData(SysDictData dictData); |
| | | } |
| | |
| | | /** |
| | | * 字典 业务层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface ISysDictTypeService extends IService<SysDictType> { |
| | | |
| | |
| | | * @param dictType 字典类型信息 |
| | | * @return 字典类型集合信息 |
| | | */ |
| | | public List<SysDictType> selectDictTypeList(SysDictType dictType); |
| | | List<SysDictType> selectDictTypeList(SysDictType dictType); |
| | | |
| | | /** |
| | | * 根据所有字典类型 |
| | | * |
| | | * @return 字典类型集合信息 |
| | | */ |
| | | public List<SysDictType> selectDictTypeAll(); |
| | | List<SysDictType> selectDictTypeAll(); |
| | | |
| | | /** |
| | | * 根据字典类型查询字典数据 |
| | |
| | | * @param dictType 字典类型 |
| | | * @return 字典数据集合信息 |
| | | */ |
| | | public List<SysDictData> selectDictDataByType(String dictType); |
| | | List<SysDictData> selectDictDataByType(String dictType); |
| | | |
| | | /** |
| | | * 根据字典类型ID查询信息 |
| | |
| | | * @param dictId 字典类型ID |
| | | * @return 字典类型 |
| | | */ |
| | | public SysDictType selectDictTypeById(Long dictId); |
| | | SysDictType selectDictTypeById(Long dictId); |
| | | |
| | | /** |
| | | * 根据字典类型查询信息 |
| | |
| | | * @param dictType 字典类型 |
| | | * @return 字典类型 |
| | | */ |
| | | public SysDictType selectDictTypeByType(String dictType); |
| | | SysDictType selectDictTypeByType(String dictType); |
| | | |
| | | /** |
| | | * 批量删除字典信息 |
| | |
| | | * @param dictIds 需要删除的字典ID |
| | | * @return 结果 |
| | | */ |
| | | public void deleteDictTypeByIds(Long[] dictIds); |
| | | void deleteDictTypeByIds(Long[] dictIds); |
| | | |
| | | /** |
| | | * 加载字典缓存数据 |
| | | */ |
| | | public void loadingDictCache(); |
| | | void loadingDictCache(); |
| | | |
| | | /** |
| | | * 清空字典缓存数据 |
| | | */ |
| | | public void clearDictCache(); |
| | | void clearDictCache(); |
| | | |
| | | /** |
| | | * 重置字典缓存数据 |
| | | */ |
| | | public void resetDictCache(); |
| | | void resetDictCache(); |
| | | |
| | | /** |
| | | * 新增保存字典类型信息 |
| | |
| | | * @param dictType 字典类型信息 |
| | | * @return 结果 |
| | | */ |
| | | public int insertDictType(SysDictType dictType); |
| | | int insertDictType(SysDictType dictType); |
| | | |
| | | /** |
| | | * 修改保存字典类型信息 |
| | |
| | | * @param dictType 字典类型信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updateDictType(SysDictType dictType); |
| | | int updateDictType(SysDictType dictType); |
| | | |
| | | /** |
| | | * 校验字典类型称是否唯一 |
| | |
| | | * @param dictType 字典类型 |
| | | * @return 结果 |
| | | */ |
| | | public String checkDictTypeUnique(SysDictType dictType); |
| | | String checkDictTypeUnique(SysDictType dictType); |
| | | } |
| | |
| | | /** |
| | | * 系统访问日志情况信息 服务层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface ISysLogininforService extends IService<SysLogininfor> { |
| | | |
| | |
| | | * |
| | | * @param logininfor 访问日志对象 |
| | | */ |
| | | public void insertLogininfor(SysLogininfor logininfor); |
| | | void insertLogininfor(SysLogininfor logininfor); |
| | | |
| | | /** |
| | | * 查询系统登录日志集合 |
| | |
| | | * @param logininfor 访问日志对象 |
| | | * @return 登录记录集合 |
| | | */ |
| | | public List<SysLogininfor> selectLogininforList(SysLogininfor logininfor); |
| | | List<SysLogininfor> selectLogininforList(SysLogininfor logininfor); |
| | | |
| | | /** |
| | | * 批量删除系统登录日志 |
| | |
| | | * @param infoIds 需要删除的登录日志ID |
| | | * @return |
| | | */ |
| | | public int deleteLogininforByIds(Long[] infoIds); |
| | | int deleteLogininforByIds(Long[] infoIds); |
| | | |
| | | /** |
| | | * 清空系统登录日志 |
| | | */ |
| | | public void cleanLogininfor(); |
| | | void cleanLogininfor(); |
| | | } |
| | |
| | | /** |
| | | * 菜单 业务层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface ISysMenuService extends IService<SysMenu> { |
| | | |
| | | /** |
| | | * 根据用户查询系统菜单列表 |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 菜单列表 |
| | | */ |
| | | public List<SysMenu> selectMenuList(Long userId); |
| | | List<SysMenu> selectMenuList(Long userId); |
| | | |
| | | /** |
| | | * 根据用户查询系统菜单列表 |
| | |
| | | * @param userId 用户ID |
| | | * @return 菜单列表 |
| | | */ |
| | | public List<SysMenu> selectMenuList(SysMenu menu, Long userId); |
| | | List<SysMenu> selectMenuList(SysMenu menu, Long userId); |
| | | |
| | | /** |
| | | * 根据用户ID查询权限 |
| | |
| | | * @param userId 用户ID |
| | | * @return 权限列表 |
| | | */ |
| | | public Set<String> selectMenuPermsByUserId(Long userId); |
| | | Set<String> selectMenuPermsByUserId(Long userId); |
| | | |
| | | /** |
| | | * 根据用户ID查询菜单树信息 |
| | |
| | | * @param userId 用户ID |
| | | * @return 菜单列表 |
| | | */ |
| | | public List<SysMenu> selectMenuTreeByUserId(Long userId); |
| | | List<SysMenu> selectMenuTreeByUserId(Long userId); |
| | | |
| | | /** |
| | | * 根据角色ID查询菜单树信息 |
| | |
| | | * @param roleId 角色ID |
| | | * @return 选中菜单列表 |
| | | */ |
| | | public List<Integer> selectMenuListByRoleId(Long roleId); |
| | | List<Integer> selectMenuListByRoleId(Long roleId); |
| | | |
| | | /** |
| | | * 构建前端路由所需要的菜单 |
| | |
| | | * @param menus 菜单列表 |
| | | * @return 路由列表 |
| | | */ |
| | | public List<RouterVo> buildMenus(List<SysMenu> menus); |
| | | List<RouterVo> buildMenus(List<SysMenu> menus); |
| | | |
| | | /** |
| | | * 构建前端所需要树结构 |
| | |
| | | * @param menus 菜单列表 |
| | | * @return 树结构列表 |
| | | */ |
| | | public List<SysMenu> buildMenuTree(List<SysMenu> menus); |
| | | List<SysMenu> buildMenuTree(List<SysMenu> menus); |
| | | |
| | | /** |
| | | * 构建前端所需要下拉树结构 |
| | |
| | | * @param menus 菜单列表 |
| | | * @return 下拉树结构列表 |
| | | */ |
| | | public List<TreeSelect> buildMenuTreeSelect(List<SysMenu> menus); |
| | | List<TreeSelect> buildMenuTreeSelect(List<SysMenu> menus); |
| | | |
| | | /** |
| | | * 根据菜单ID查询信息 |
| | |
| | | * @param menuId 菜单ID |
| | | * @return 菜单信息 |
| | | */ |
| | | public SysMenu selectMenuById(Long menuId); |
| | | SysMenu selectMenuById(Long menuId); |
| | | |
| | | /** |
| | | * 是否存在菜单子节点 |
| | |
| | | * @param menuId 菜单ID |
| | | * @return 结果 true 存在 false 不存在 |
| | | */ |
| | | public boolean hasChildByMenuId(Long menuId); |
| | | boolean hasChildByMenuId(Long menuId); |
| | | |
| | | /** |
| | | * 查询菜单是否存在角色 |
| | |
| | | * @param menuId 菜单ID |
| | | * @return 结果 true 存在 false 不存在 |
| | | */ |
| | | public boolean checkMenuExistRole(Long menuId); |
| | | boolean checkMenuExistRole(Long menuId); |
| | | |
| | | /** |
| | | * 新增保存菜单信息 |
| | |
| | | * @param menu 菜单信息 |
| | | * @return 结果 |
| | | */ |
| | | public int insertMenu(SysMenu menu); |
| | | int insertMenu(SysMenu menu); |
| | | |
| | | /** |
| | | * 修改保存菜单信息 |
| | |
| | | * @param menu 菜单信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updateMenu(SysMenu menu); |
| | | int updateMenu(SysMenu menu); |
| | | |
| | | /** |
| | | * 删除菜单管理信息 |
| | |
| | | * @param menuId 菜单ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteMenuById(Long menuId); |
| | | int deleteMenuById(Long menuId); |
| | | |
| | | /** |
| | | * 校验菜单名称是否唯一 |
| | |
| | | * @param menu 菜单信息 |
| | | * @return 结果 |
| | | */ |
| | | public String checkMenuNameUnique(SysMenu menu); |
| | | String checkMenuNameUnique(SysMenu menu); |
| | | } |
| | |
| | | /** |
| | | * 公告 服务层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface ISysNoticeService extends IService<SysNotice> { |
| | | |
| | |
| | | * @param noticeId 公告ID |
| | | * @return 公告信息 |
| | | */ |
| | | public SysNotice selectNoticeById(Long noticeId); |
| | | SysNotice selectNoticeById(Long noticeId); |
| | | |
| | | /** |
| | | * 查询公告列表 |
| | |
| | | * @param notice 公告信息 |
| | | * @return 公告集合 |
| | | */ |
| | | public List<SysNotice> selectNoticeList(SysNotice notice); |
| | | List<SysNotice> selectNoticeList(SysNotice notice); |
| | | |
| | | /** |
| | | * 新增公告 |
| | |
| | | * @param notice 公告信息 |
| | | * @return 结果 |
| | | */ |
| | | public int insertNotice(SysNotice notice); |
| | | int insertNotice(SysNotice notice); |
| | | |
| | | /** |
| | | * 修改公告 |
| | |
| | | * @param notice 公告信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updateNotice(SysNotice notice); |
| | | int updateNotice(SysNotice notice); |
| | | |
| | | /** |
| | | * 删除公告信息 |
| | |
| | | * @param noticeId 公告ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteNoticeById(Long noticeId); |
| | | int deleteNoticeById(Long noticeId); |
| | | |
| | | /** |
| | | * 批量删除公告信息 |
| | |
| | | * @param noticeIds 需要删除的公告ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteNoticeByIds(Long[] noticeIds); |
| | | int deleteNoticeByIds(Long[] noticeIds); |
| | | } |
| | |
| | | /** |
| | | * 操作日志 服务层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface ISysOperLogService extends IService<SysOperLog> { |
| | | |
| | |
| | | * |
| | | * @param operLog 操作日志对象 |
| | | */ |
| | | public void insertOperlog(SysOperLog operLog); |
| | | void insertOperlog(SysOperLog operLog); |
| | | |
| | | /** |
| | | * 查询系统操作日志集合 |
| | |
| | | * @param operLog 操作日志对象 |
| | | * @return 操作日志集合 |
| | | */ |
| | | public List<SysOperLog> selectOperLogList(SysOperLog operLog); |
| | | List<SysOperLog> selectOperLogList(SysOperLog operLog); |
| | | |
| | | /** |
| | | * 批量删除系统操作日志 |
| | |
| | | * @param operIds 需要删除的操作日志ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteOperLogByIds(Long[] operIds); |
| | | int deleteOperLogByIds(Long[] operIds); |
| | | |
| | | /** |
| | | * 查询操作日志详细 |
| | |
| | | * @param operId 操作ID |
| | | * @return 操作日志对象 |
| | | */ |
| | | public SysOperLog selectOperLogById(Long operId); |
| | | SysOperLog selectOperLogById(Long operId); |
| | | |
| | | /** |
| | | * 清空操作日志 |
| | | */ |
| | | public void cleanOperLog(); |
| | | void cleanOperLog(); |
| | | } |
| | |
| | | */ |
| | | public interface ISysOssConfigService extends IServicePlus<SysOssConfig, SysOssConfigVo> { |
| | | |
| | | /** |
| | | * 查询单个 |
| | | */ |
| | | SysOssConfigVo queryById(Integer ossConfigId); |
| | | /** |
| | | * 查询单个 |
| | | */ |
| | | SysOssConfigVo queryById(Integer ossConfigId); |
| | | |
| | | /** |
| | | * 查询列表 |
| | | */ |
| | | /** |
| | | * 查询列表 |
| | | */ |
| | | TableDataInfo<SysOssConfigVo> queryPageList(SysOssConfigBo bo); |
| | | |
| | | |
| | | /** |
| | | * 根据新增业务对象插入对象存储配置 |
| | | * @param bo 对象存储配置新增业务对象 |
| | | * @return |
| | | */ |
| | | Boolean insertByBo(SysOssConfigBo bo); |
| | | /** |
| | | * 根据新增业务对象插入对象存储配置 |
| | | * |
| | | * @param bo 对象存储配置新增业务对象 |
| | | * @return |
| | | */ |
| | | Boolean insertByBo(SysOssConfigBo bo); |
| | | |
| | | /** |
| | | * 根据编辑业务对象修改对象存储配置 |
| | | * @param bo 对象存储配置编辑业务对象 |
| | | * @return |
| | | */ |
| | | Boolean updateByBo(SysOssConfigBo bo); |
| | | /** |
| | | * 根据编辑业务对象修改对象存储配置 |
| | | * |
| | | * @param bo 对象存储配置编辑业务对象 |
| | | * @return |
| | | */ |
| | | Boolean updateByBo(SysOssConfigBo bo); |
| | | |
| | | /** |
| | | * 校验并删除数据 |
| | | * @param ids 主键集合 |
| | | * @param isValid 是否校验,true-删除前校验,false-不校验 |
| | | * @return |
| | | */ |
| | | Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
| | | /** |
| | | * 校验并删除数据 |
| | | * |
| | | * @param ids 主键集合 |
| | | * @param isValid 是否校验,true-删除前校验,false-不校验 |
| | | * @return |
| | | */ |
| | | Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
| | | |
| | | /** |
| | | * 启用停用状态 |
| | | */ |
| | | int updateOssConfigStatus(SysOssConfigBo bo); |
| | | /** |
| | | * 启用停用状态 |
| | | */ |
| | | int updateOssConfigStatus(SysOssConfigBo bo); |
| | | |
| | | } |
| | |
| | | */ |
| | | public interface ISysOssService extends IServicePlus<SysOss, SysOssVo> { |
| | | |
| | | TableDataInfo<SysOssVo> queryPageList(SysOssBo sysOss); |
| | | TableDataInfo<SysOssVo> queryPageList(SysOssBo sysOss); |
| | | |
| | | SysOss upload(MultipartFile file); |
| | | SysOss upload(MultipartFile file); |
| | | |
| | | Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
| | | Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
| | | } |
| | |
| | | /** |
| | | * 岗位信息 服务层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface ISysPostService extends IService<SysPost> { |
| | | |
| | |
| | | * @param post 岗位信息 |
| | | * @return 岗位列表 |
| | | */ |
| | | public List<SysPost> selectPostList(SysPost post); |
| | | List<SysPost> selectPostList(SysPost post); |
| | | |
| | | /** |
| | | * 查询所有岗位 |
| | | * |
| | | * @return 岗位列表 |
| | | */ |
| | | public List<SysPost> selectPostAll(); |
| | | List<SysPost> selectPostAll(); |
| | | |
| | | /** |
| | | * 通过岗位ID查询岗位信息 |
| | |
| | | * @param postId 岗位ID |
| | | * @return 角色对象信息 |
| | | */ |
| | | public SysPost selectPostById(Long postId); |
| | | SysPost selectPostById(Long postId); |
| | | |
| | | /** |
| | | * 根据用户ID获取岗位选择框列表 |
| | |
| | | * @param userId 用户ID |
| | | * @return 选中岗位ID列表 |
| | | */ |
| | | public List<Integer> selectPostListByUserId(Long userId); |
| | | List<Integer> selectPostListByUserId(Long userId); |
| | | |
| | | /** |
| | | * 校验岗位名称 |
| | |
| | | * @param post 岗位信息 |
| | | * @return 结果 |
| | | */ |
| | | public String checkPostNameUnique(SysPost post); |
| | | String checkPostNameUnique(SysPost post); |
| | | |
| | | /** |
| | | * 校验岗位编码 |
| | |
| | | * @param post 岗位信息 |
| | | * @return 结果 |
| | | */ |
| | | public String checkPostCodeUnique(SysPost post); |
| | | String checkPostCodeUnique(SysPost post); |
| | | |
| | | /** |
| | | * 通过岗位ID查询岗位使用数量 |
| | |
| | | * @param postId 岗位ID |
| | | * @return 结果 |
| | | */ |
| | | public long countUserPostById(Long postId); |
| | | long countUserPostById(Long postId); |
| | | |
| | | /** |
| | | * 删除岗位信息 |
| | |
| | | * @param postId 岗位ID |
| | | * @return 结果 |
| | | */ |
| | | public int deletePostById(Long postId); |
| | | int deletePostById(Long postId); |
| | | |
| | | /** |
| | | * 批量删除岗位信息 |
| | |
| | | * @return 结果 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public int deletePostByIds(Long[] postIds); |
| | | int deletePostByIds(Long[] postIds); |
| | | |
| | | /** |
| | | * 新增保存岗位信息 |
| | |
| | | * @param post 岗位信息 |
| | | * @return 结果 |
| | | */ |
| | | public int insertPost(SysPost post); |
| | | int insertPost(SysPost post); |
| | | |
| | | /** |
| | | * 修改保存岗位信息 |
| | |
| | | * @param post 岗位信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updatePost(SysPost post); |
| | | int updatePost(SysPost post); |
| | | } |
| | |
| | | /** |
| | | * 角色业务层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface ISysRoleService extends IService<SysRole> { |
| | | |
| | |
| | | * @param role 角色信息 |
| | | * @return 角色数据集合信息 |
| | | */ |
| | | public List<SysRole> selectRoleList(SysRole role); |
| | | List<SysRole> selectRoleList(SysRole role); |
| | | |
| | | /** |
| | | * 根据用户ID查询角色列表 |
| | |
| | | * @param userId 用户ID |
| | | * @return 角色列表 |
| | | */ |
| | | public List<SysRole> selectRolesByUserId(Long userId); |
| | | List<SysRole> selectRolesByUserId(Long userId); |
| | | |
| | | /** |
| | | * 根据用户ID查询角色权限 |
| | |
| | | * @param userId 用户ID |
| | | * @return 权限列表 |
| | | */ |
| | | public Set<String> selectRolePermissionByUserId(Long userId); |
| | | Set<String> selectRolePermissionByUserId(Long userId); |
| | | |
| | | /** |
| | | * 查询所有角色 |
| | | * |
| | | * @return 角色列表 |
| | | */ |
| | | public List<SysRole> selectRoleAll(); |
| | | List<SysRole> selectRoleAll(); |
| | | |
| | | /** |
| | | * 根据用户ID获取角色选择框列表 |
| | |
| | | * @param userId 用户ID |
| | | * @return 选中角色ID列表 |
| | | */ |
| | | public List<Integer> selectRoleListByUserId(Long userId); |
| | | List<Integer> selectRoleListByUserId(Long userId); |
| | | |
| | | /** |
| | | * 通过角色ID查询角色 |
| | |
| | | * @param roleId 角色ID |
| | | * @return 角色对象信息 |
| | | */ |
| | | public SysRole selectRoleById(Long roleId); |
| | | SysRole selectRoleById(Long roleId); |
| | | |
| | | /** |
| | | * 校验角色名称是否唯一 |
| | |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | public String checkRoleNameUnique(SysRole role); |
| | | String checkRoleNameUnique(SysRole role); |
| | | |
| | | /** |
| | | * 校验角色权限是否唯一 |
| | |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | public String checkRoleKeyUnique(SysRole role); |
| | | String checkRoleKeyUnique(SysRole role); |
| | | |
| | | /** |
| | | * 校验角色是否允许操作 |
| | | * |
| | | * @param role 角色信息 |
| | | */ |
| | | public void checkRoleAllowed(SysRole role); |
| | | void checkRoleAllowed(SysRole role); |
| | | |
| | | /** |
| | | * 校验角色是否有数据权限 |
| | | * |
| | | * @param roleId 角色id |
| | | */ |
| | | public void checkRoleDataScope(Long roleId); |
| | | void checkRoleDataScope(Long roleId); |
| | | |
| | | /** |
| | | * 通过角色ID查询角色使用数量 |
| | |
| | | * @param roleId 角色ID |
| | | * @return 结果 |
| | | */ |
| | | public long countUserRoleByRoleId(Long roleId); |
| | | long countUserRoleByRoleId(Long roleId); |
| | | |
| | | /** |
| | | * 新增保存角色信息 |
| | |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | public int insertRole(SysRole role); |
| | | int insertRole(SysRole role); |
| | | |
| | | /** |
| | | * 修改保存角色信息 |
| | |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updateRole(SysRole role); |
| | | int updateRole(SysRole role); |
| | | |
| | | /** |
| | | * 修改角色状态 |
| | |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updateRoleStatus(SysRole role); |
| | | int updateRoleStatus(SysRole role); |
| | | |
| | | /** |
| | | * 修改数据权限信息 |
| | |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | public int authDataScope(SysRole role); |
| | | int authDataScope(SysRole role); |
| | | |
| | | /** |
| | | * 通过角色ID删除角色 |
| | |
| | | * @param roleId 角色ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteRoleById(Long roleId); |
| | | int deleteRoleById(Long roleId); |
| | | |
| | | /** |
| | | * 批量删除角色信息 |
| | |
| | | * @param roleIds 需要删除的角色ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteRoleByIds(Long[] roleIds); |
| | | int deleteRoleByIds(Long[] roleIds); |
| | | |
| | | /** |
| | | * 取消授权用户角色 |
| | |
| | | * @param userRole 用户和角色关联信息 |
| | | * @return 结果 |
| | | */ |
| | | public int deleteAuthUser(SysUserRole userRole); |
| | | int deleteAuthUser(SysUserRole userRole); |
| | | |
| | | /** |
| | | * 批量取消授权用户角色 |
| | | * |
| | | * @param roleId 角色ID |
| | | * @param roleId 角色ID |
| | | * @param userIds 需要取消授权的用户数据ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteAuthUsers(Long roleId, Long[] userIds); |
| | | int deleteAuthUsers(Long roleId, Long[] userIds); |
| | | |
| | | /** |
| | | * 批量选择授权用户角色 |
| | | * |
| | | * @param roleId 角色ID |
| | | * @param roleId 角色ID |
| | | * @param userIds 需要删除的用户数据ID |
| | | * @return 结果 |
| | | */ |
| | | public int insertAuthUsers(Long roleId, Long[] userIds); |
| | | int insertAuthUsers(Long roleId, Long[] userIds); |
| | | } |
| | |
| | | /** |
| | | * 在线用户 服务层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface ISysUserOnlineService { |
| | | /** |
| | |
| | | * @param user 用户信息 |
| | | * @return 在线用户信息 |
| | | */ |
| | | public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user); |
| | | SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user); |
| | | |
| | | /** |
| | | * 通过用户名称查询信息 |
| | |
| | | * @param user 用户信息 |
| | | * @return 在线用户信息 |
| | | */ |
| | | public SysUserOnline selectOnlineByUserName(String userName, LoginUser user); |
| | | SysUserOnline selectOnlineByUserName(String userName, LoginUser user); |
| | | |
| | | /** |
| | | * 通过登录地址/用户名称查询信息 |
| | |
| | | * @param user 用户信息 |
| | | * @return 在线用户信息 |
| | | */ |
| | | public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user); |
| | | SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user); |
| | | |
| | | /** |
| | | * 设置在线用户信息 |
| | |
| | | * @param user 用户信息 |
| | | * @return 在线用户 |
| | | */ |
| | | public SysUserOnline loginUserToUserOnline(LoginUser user); |
| | | SysUserOnline loginUserToUserOnline(LoginUser user); |
| | | } |
| | |
| | | /** |
| | | * 用户 业务层 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | public interface ISysUserService extends IService<SysUser> { |
| | | |
| | |
| | | * @param user 用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | | public List<SysUser> selectUserList(SysUser user); |
| | | List<SysUser> selectUserList(SysUser user); |
| | | |
| | | /** |
| | | * 根据条件分页查询已分配用户角色列表 |
| | |
| | | * @param user 用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | | public TableDataInfo<SysUser> selectAllocatedList(SysUser user); |
| | | TableDataInfo<SysUser> selectAllocatedList(SysUser user); |
| | | |
| | | /** |
| | | * 根据条件分页查询未分配用户角色列表 |
| | |
| | | * @param user 用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | | public TableDataInfo<SysUser> selectUnallocatedList(SysUser user); |
| | | TableDataInfo<SysUser> selectUnallocatedList(SysUser user); |
| | | |
| | | /** |
| | | * 通过用户名查询用户 |
| | |
| | | * @param userName 用户名 |
| | | * @return 用户对象信息 |
| | | */ |
| | | public SysUser selectUserByUserName(String userName); |
| | | SysUser selectUserByUserName(String userName); |
| | | |
| | | /** |
| | | * 通过用户ID查询用户 |
| | |
| | | * @param userId 用户ID |
| | | * @return 用户对象信息 |
| | | */ |
| | | public SysUser selectUserById(Long userId); |
| | | SysUser selectUserById(Long userId); |
| | | |
| | | /** |
| | | * 根据用户ID查询用户所属角色组 |
| | |
| | | * @param userName 用户名 |
| | | * @return 结果 |
| | | */ |
| | | public String selectUserRoleGroup(String userName); |
| | | String selectUserRoleGroup(String userName); |
| | | |
| | | /** |
| | | * 根据用户ID查询用户所属岗位组 |
| | |
| | | * @param userName 用户名 |
| | | * @return 结果 |
| | | */ |
| | | public String selectUserPostGroup(String userName); |
| | | String selectUserPostGroup(String userName); |
| | | |
| | | /** |
| | | * 校验用户名称是否唯一 |
| | |
| | | * @param userName 用户名称 |
| | | * @return 结果 |
| | | */ |
| | | public String checkUserNameUnique(String userName); |
| | | String checkUserNameUnique(String userName); |
| | | |
| | | /** |
| | | * 校验手机号码是否唯一 |
| | |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | | public String checkPhoneUnique(SysUser user); |
| | | String checkPhoneUnique(SysUser user); |
| | | |
| | | /** |
| | | * 校验email是否唯一 |
| | |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | | public String checkEmailUnique(SysUser user); |
| | | String checkEmailUnique(SysUser user); |
| | | |
| | | /** |
| | | * 校验用户是否允许操作 |
| | | * |
| | | * @param user 用户信息 |
| | | */ |
| | | public void checkUserAllowed(SysUser user); |
| | | void checkUserAllowed(SysUser user); |
| | | |
| | | /** |
| | | * 校验用户是否有数据权限 |
| | | * |
| | | * @param userId 用户id |
| | | */ |
| | | public void checkUserDataScope(Long userId); |
| | | void checkUserDataScope(Long userId); |
| | | |
| | | /** |
| | | * 新增用户信息 |
| | |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | | public int insertUser(SysUser user); |
| | | int insertUser(SysUser user); |
| | | |
| | | /** |
| | | * 注册用户信息 |
| | |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | | public boolean registerUser(SysUser user); |
| | | boolean registerUser(SysUser user); |
| | | |
| | | /** |
| | | * 修改用户信息 |
| | |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updateUser(SysUser user); |
| | | int updateUser(SysUser user); |
| | | |
| | | /** |
| | | * 用户授权角色 |
| | | * |
| | | * @param userId 用户ID |
| | | * @param userId 用户ID |
| | | * @param roleIds 角色组 |
| | | */ |
| | | public void insertUserAuth(Long userId, Long[] roleIds); |
| | | void insertUserAuth(Long userId, Long[] roleIds); |
| | | |
| | | /** |
| | | * 修改用户状态 |
| | |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updateUserStatus(SysUser user); |
| | | int updateUserStatus(SysUser user); |
| | | |
| | | /** |
| | | * 修改用户基本信息 |
| | |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updateUserProfile(SysUser user); |
| | | int updateUserProfile(SysUser user); |
| | | |
| | | /** |
| | | * 修改用户头像 |
| | | * |
| | | * @param userName 用户名 |
| | | * @param avatar 头像地址 |
| | | * @param avatar 头像地址 |
| | | * @return 结果 |
| | | */ |
| | | public boolean updateUserAvatar(String userName, String avatar); |
| | | boolean updateUserAvatar(String userName, String avatar); |
| | | |
| | | /** |
| | | * 重置用户密码 |
| | |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | | public int resetPwd(SysUser user); |
| | | int resetPwd(SysUser user); |
| | | |
| | | /** |
| | | * 重置用户密码 |
| | |
| | | * @param password 密码 |
| | | * @return 结果 |
| | | */ |
| | | public int resetUserPwd(String userName, String password); |
| | | int resetUserPwd(String userName, String password); |
| | | |
| | | /** |
| | | * 通过用户ID删除用户 |
| | |
| | | * @param userId 用户ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteUserById(Long userId); |
| | | int deleteUserById(Long userId); |
| | | |
| | | /** |
| | | * 批量删除用户信息 |
| | |
| | | * @param userIds 需要删除的用户ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteUserByIds(Long[] userIds); |
| | | int deleteUserByIds(Long[] userIds); |
| | | |
| | | /** |
| | | * 导入用户数据 |
| | | * |
| | | * @param userList 用户数据列表 |
| | | * @param userList 用户数据列表 |
| | | * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 |
| | | * @param operName 操作用户 |
| | | * @param operName 操作用户 |
| | | * @return 结果 |
| | | */ |
| | | public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName); |
| | | String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName); |
| | | } |
| | |
| | | /** |
| | | * 登录校验方法 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Service |
| | | public class SysLoginService { |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | |
| | | /** |
| | | * 注册校验方法 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Service |
| | | public class SysRegisterService { |
| | |
| | | /** |
| | | * 参数配置 服务层实现 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Service |
| | | public class SysConfigServiceImpl extends ServicePlusImpl<SysConfigMapper, SysConfig, SysConfig> implements ISysConfigService { |
| | | |
| | | /** |
| | | * 项目启动时,初始化参数到缓存 |
| | | */ |
| | | @PostConstruct |
| | | public void init() { |
| | | loadingConfigCache(); |
| | | } |
| | | /** |
| | | * 项目启动时,初始化参数到缓存 |
| | | */ |
| | | @PostConstruct |
| | | public void init() { |
| | | loadingConfigCache(); |
| | | } |
| | | |
| | | @Override |
| | | public TableDataInfo<SysConfig> selectPageConfigList(SysConfig config) { |
| | | Map<String, Object> params = config.getParams(); |
| | | LambdaQueryWrapper<SysConfig> lqw = new LambdaQueryWrapper<SysConfig>() |
| | | .like(StringUtils.isNotBlank(config.getConfigName()), SysConfig::getConfigName, config.getConfigName()) |
| | | .eq(StringUtils.isNotBlank(config.getConfigType()), SysConfig::getConfigType, config.getConfigType()) |
| | | .like(StringUtils.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey()) |
| | | .apply(StringUtils.isNotEmpty(params.get("beginTime")), |
| | | "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", |
| | | params.get("beginTime")) |
| | | .apply(StringUtils.isNotEmpty(params.get("endTime")), |
| | | "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", |
| | | params.get("endTime")); |
| | | return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); |
| | | } |
| | | @Override |
| | | public TableDataInfo<SysConfig> selectPageConfigList(SysConfig config) { |
| | | Map<String, Object> params = config.getParams(); |
| | | LambdaQueryWrapper<SysConfig> lqw = new LambdaQueryWrapper<SysConfig>() |
| | | .like(StringUtils.isNotBlank(config.getConfigName()), SysConfig::getConfigName, config.getConfigName()) |
| | | .eq(StringUtils.isNotBlank(config.getConfigType()), SysConfig::getConfigType, config.getConfigType()) |
| | | .like(StringUtils.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey()) |
| | | .apply(StringUtils.isNotEmpty(params.get("beginTime")), |
| | | "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", |
| | | params.get("beginTime")) |
| | | .apply(StringUtils.isNotEmpty(params.get("endTime")), |
| | | "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", |
| | | params.get("endTime")); |
| | | return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); |
| | | } |
| | | |
| | | /** |
| | | * 查询参数配置信息 |
| | | * |
| | | * @param configId 参数配置ID |
| | | * @return 参数配置信息 |
| | | */ |
| | | @Override |
| | | @DataSource(DataSourceType.MASTER) |
| | | public SysConfig selectConfigById(Long configId) { |
| | | return baseMapper.selectById(configId); |
| | | } |
| | | /** |
| | | * 查询参数配置信息 |
| | | * |
| | | * @param configId 参数配置ID |
| | | * @return 参数配置信息 |
| | | */ |
| | | @Override |
| | | @DataSource(DataSourceType.MASTER) |
| | | public SysConfig selectConfigById(Long configId) { |
| | | return baseMapper.selectById(configId); |
| | | } |
| | | |
| | | /** |
| | | * 根据键名查询参数配置信息 |
| | | * |
| | | * @param configKey 参数key |
| | | * @return 参数键值 |
| | | */ |
| | | @Override |
| | | public String selectConfigByKey(String configKey) { |
| | | String configValue = Convert.toStr(RedisUtils.getCacheObject(getCacheKey(configKey))); |
| | | if (StringUtils.isNotEmpty(configValue)) { |
| | | return configValue; |
| | | } |
| | | SysConfig retConfig = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>() |
| | | .eq(SysConfig::getConfigKey, configKey)); |
| | | if (StringUtils.isNotNull(retConfig)) { |
| | | RedisUtils.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue()); |
| | | return retConfig.getConfigValue(); |
| | | } |
| | | return StringUtils.EMPTY; |
| | | } |
| | | /** |
| | | * 根据键名查询参数配置信息 |
| | | * |
| | | * @param configKey 参数key |
| | | * @return 参数键值 |
| | | */ |
| | | @Override |
| | | public String selectConfigByKey(String configKey) { |
| | | String configValue = Convert.toStr(RedisUtils.getCacheObject(getCacheKey(configKey))); |
| | | if (StringUtils.isNotEmpty(configValue)) { |
| | | return configValue; |
| | | } |
| | | SysConfig retConfig = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>() |
| | | .eq(SysConfig::getConfigKey, configKey)); |
| | | if (StringUtils.isNotNull(retConfig)) { |
| | | RedisUtils.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue()); |
| | | return retConfig.getConfigValue(); |
| | | } |
| | | return StringUtils.EMPTY; |
| | | } |
| | | |
| | | /** |
| | | * 获取验证码开关 |
| | | * |
| | | * @return true开启,false关闭 |
| | | */ |
| | | @Override |
| | | public boolean selectCaptchaOnOff() { |
| | | String captchaOnOff = selectConfigByKey("sys.account.captchaOnOff"); |
| | | if (StringUtils.isEmpty(captchaOnOff)) { |
| | | return true; |
| | | } |
| | | return Convert.toBool(captchaOnOff); |
| | | } |
| | | /** |
| | | * 获取验证码开关 |
| | | * |
| | | * @return true开启,false关闭 |
| | | */ |
| | | @Override |
| | | public boolean selectCaptchaOnOff() { |
| | | String captchaOnOff = selectConfigByKey("sys.account.captchaOnOff"); |
| | | if (StringUtils.isEmpty(captchaOnOff)) { |
| | | return true; |
| | | } |
| | | return Convert.toBool(captchaOnOff); |
| | | } |
| | | |
| | | /** |
| | | * 查询参数配置列表 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 参数配置集合 |
| | | */ |
| | | @Override |
| | | public List<SysConfig> selectConfigList(SysConfig config) { |
| | | Map<String, Object> params = config.getParams(); |
| | | LambdaQueryWrapper<SysConfig> lqw = new LambdaQueryWrapper<SysConfig>() |
| | | .like(StringUtils.isNotBlank(config.getConfigName()), SysConfig::getConfigName, config.getConfigName()) |
| | | .eq(StringUtils.isNotBlank(config.getConfigType()), SysConfig::getConfigType, config.getConfigType()) |
| | | .like(StringUtils.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey()) |
| | | .apply(StringUtils.isNotEmpty(params.get("beginTime")), |
| | | "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", |
| | | params.get("beginTime")) |
| | | .apply(StringUtils.isNotEmpty(params.get("endTime")), |
| | | "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", |
| | | params.get("endTime")); |
| | | return baseMapper.selectList(lqw); |
| | | } |
| | | /** |
| | | * 查询参数配置列表 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 参数配置集合 |
| | | */ |
| | | @Override |
| | | public List<SysConfig> selectConfigList(SysConfig config) { |
| | | Map<String, Object> params = config.getParams(); |
| | | LambdaQueryWrapper<SysConfig> lqw = new LambdaQueryWrapper<SysConfig>() |
| | | .like(StringUtils.isNotBlank(config.getConfigName()), SysConfig::getConfigName, config.getConfigName()) |
| | | .eq(StringUtils.isNotBlank(config.getConfigType()), SysConfig::getConfigType, config.getConfigType()) |
| | | .like(StringUtils.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey()) |
| | | .apply(StringUtils.isNotEmpty(params.get("beginTime")), |
| | | "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", |
| | | params.get("beginTime")) |
| | | .apply(StringUtils.isNotEmpty(params.get("endTime")), |
| | | "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", |
| | | params.get("endTime")); |
| | | return baseMapper.selectList(lqw); |
| | | } |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertConfig(SysConfig config) { |
| | | int row = baseMapper.insert(config); |
| | | if (row > 0) { |
| | | RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | return row; |
| | | } |
| | | /** |
| | | * 新增参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertConfig(SysConfig config) { |
| | | int row = baseMapper.insert(config); |
| | | if (row > 0) { |
| | | RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | return row; |
| | | } |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateConfig(SysConfig config) { |
| | | int row = baseMapper.updateById(config); |
| | | if (row > 0) { |
| | | RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | return row; |
| | | } |
| | | /** |
| | | * 修改参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateConfig(SysConfig config) { |
| | | int row = baseMapper.updateById(config); |
| | | if (row > 0) { |
| | | RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | return row; |
| | | } |
| | | |
| | | /** |
| | | * 批量删除参数信息 |
| | | * |
| | | * @param configIds 需要删除的参数ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public void deleteConfigByIds(Long[] configIds) { |
| | | for (Long configId : configIds) { |
| | | SysConfig config = selectConfigById(configId); |
| | | if (StringUtils.equals(UserConstants.YES, config.getConfigType())) { |
| | | throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); |
| | | } |
| | | RedisUtils.deleteObject(getCacheKey(config.getConfigKey())); |
| | | } |
| | | baseMapper.deleteBatchIds(Arrays.asList(configIds)); |
| | | } |
| | | /** |
| | | * 批量删除参数信息 |
| | | * |
| | | * @param configIds 需要删除的参数ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public void deleteConfigByIds(Long[] configIds) { |
| | | for (Long configId : configIds) { |
| | | SysConfig config = selectConfigById(configId); |
| | | if (StringUtils.equals(UserConstants.YES, config.getConfigType())) { |
| | | throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); |
| | | } |
| | | RedisUtils.deleteObject(getCacheKey(config.getConfigKey())); |
| | | } |
| | | baseMapper.deleteBatchIds(Arrays.asList(configIds)); |
| | | } |
| | | |
| | | /** |
| | | * 加载参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void loadingConfigCache() { |
| | | List<SysConfig> configsList = selectConfigList(new SysConfig()); |
| | | for (SysConfig config : configsList) { |
| | | RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | } |
| | | /** |
| | | * 加载参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void loadingConfigCache() { |
| | | List<SysConfig> configsList = selectConfigList(new SysConfig()); |
| | | for (SysConfig config : configsList) { |
| | | RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 清空参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void clearConfigCache() { |
| | | Collection<String> keys = RedisUtils.keys(Constants.SYS_CONFIG_KEY + "*"); |
| | | RedisUtils.deleteObject(keys); |
| | | } |
| | | /** |
| | | * 清空参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void clearConfigCache() { |
| | | Collection<String> keys = RedisUtils.keys(Constants.SYS_CONFIG_KEY + "*"); |
| | | RedisUtils.deleteObject(keys); |
| | | } |
| | | |
| | | /** |
| | | * 重置参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void resetConfigCache() { |
| | | clearConfigCache(); |
| | | loadingConfigCache(); |
| | | } |
| | | /** |
| | | * 重置参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void resetConfigCache() { |
| | | clearConfigCache(); |
| | | loadingConfigCache(); |
| | | } |
| | | |
| | | /** |
| | | * 校验参数键名是否唯一 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public String checkConfigKeyUnique(SysConfig config) { |
| | | Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId(); |
| | | SysConfig info = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>().eq(SysConfig::getConfigKey, config.getConfigKey())); |
| | | if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | /** |
| | | * 校验参数键名是否唯一 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public String checkConfigKeyUnique(SysConfig config) { |
| | | Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId(); |
| | | SysConfig info = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>().eq(SysConfig::getConfigKey, config.getConfigKey())); |
| | | if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | |
| | | /** |
| | | * 设置cache key |
| | | * |
| | | * @param configKey 参数键 |
| | | * @return 缓存键key |
| | | */ |
| | | private String getCacheKey(String configKey) { |
| | | return Constants.SYS_CONFIG_KEY + configKey; |
| | | } |
| | | /** |
| | | * 设置cache key |
| | | * |
| | | * @param configKey 参数键 |
| | | * @return 缓存键key |
| | | */ |
| | | private String getCacheKey(String configKey) { |
| | | return Constants.SYS_CONFIG_KEY + configKey; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 部门管理 服务实现 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Service |
| | | public class SysDeptServiceImpl extends ServicePlusImpl<SysDeptMapper, SysDept, SysDept> implements ISysDeptService { |
| | |
| | | for (SysDept dept : depts) { |
| | | tempList.add(dept.getDeptId()); |
| | | } |
| | | for (SysDept dept : depts) { |
| | | // 如果是顶级节点, 遍历该父节点的所有子节点 |
| | | if (!tempList.contains(dept.getParentId())) { |
| | | recursionFn(depts, dept); |
| | | returnList.add(dept); |
| | | } |
| | | } |
| | | for (SysDept dept : depts) { |
| | | // 如果是顶级节点, 遍历该父节点的所有子节点 |
| | | if (!tempList.contains(dept.getParentId())) { |
| | | recursionFn(depts, dept); |
| | | returnList.add(dept); |
| | | } |
| | | } |
| | | if (returnList.isEmpty()) { |
| | | returnList = depts; |
| | | } |
| | |
| | | } |
| | | int result = baseMapper.updateById(dept); |
| | | if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors()) |
| | | && !StringUtils.equals("0", dept.getAncestors())) { |
| | | && !StringUtils.equals("0", dept.getAncestors())) { |
| | | // 如果该部门是启用状态,则启用该部门的所有上级部门 |
| | | updateParentDeptStatusNormal(dept); |
| | | } |
| | |
| | | * @param dept 当前部门 |
| | | */ |
| | | private void updateParentDeptStatusNormal(SysDept dept) { |
| | | String ancestors = dept.getAncestors(); |
| | | Long[] deptIds = Convert.toLongArray(ancestors); |
| | | String ancestors = dept.getAncestors(); |
| | | Long[] deptIds = Convert.toLongArray(ancestors); |
| | | update(null, new LambdaUpdateWrapper<SysDept>() |
| | | .set(SysDept::getStatus, "0") |
| | | .in(SysDept::getDeptId, Arrays.asList(deptIds))); |
| | |
| | | /** |
| | | * 修改子元素关系 |
| | | * |
| | | * @param deptId 被修改的部门ID |
| | | * @param deptId 被修改的部门ID |
| | | * @param newAncestors 新的父ID集合 |
| | | * @param oldAncestors 旧的父ID集合 |
| | | */ |
| | | public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) { |
| | | List<SysDept> children = list(new LambdaQueryWrapper<SysDept>() |
| | | .apply("find_in_set({0},ancestors)",deptId)); |
| | | .apply("find_in_set({0},ancestors)", deptId)); |
| | | for (SysDept child : children) { |
| | | child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors)); |
| | | } |
| | |
| | | */ |
| | | private List<SysDept> getChildList(List<SysDept> list, SysDept t) { |
| | | List<SysDept> tlist = new ArrayList<SysDept>(); |
| | | for (SysDept n : list) { |
| | | if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) { |
| | | tlist.add(n); |
| | | } |
| | | } |
| | | for (SysDept n : list) { |
| | | if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) { |
| | | tlist.add(n); |
| | | } |
| | | } |
| | | return tlist; |
| | | } |
| | | |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.entity.SysDictData; |
| | | import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.mapper.SysDictDataMapper; |
| | | import com.ruoyi.system.service.ISysDictDataService; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | /** |
| | | * 字典 业务层处理 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Service |
| | | public class SysDictDataServiceImpl extends ServicePlusImpl<SysDictDataMapper, SysDictData, SysDictData> implements ISysDictDataService { |
| | | |
| | | @Override |
| | | public TableDataInfo<SysDictData> selectPageDictDataList(SysDictData dictData) { |
| | | LambdaQueryWrapper<SysDictData> lqw = new LambdaQueryWrapper<SysDictData>() |
| | | .eq(StringUtils.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) |
| | | .like(StringUtils.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) |
| | | .eq(StringUtils.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) |
| | | .orderByAsc(SysDictData::getDictSort); |
| | | return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); |
| | | } |
| | | @Override |
| | | public TableDataInfo<SysDictData> selectPageDictDataList(SysDictData dictData) { |
| | | LambdaQueryWrapper<SysDictData> lqw = new LambdaQueryWrapper<SysDictData>() |
| | | .eq(StringUtils.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) |
| | | .like(StringUtils.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) |
| | | .eq(StringUtils.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) |
| | | .orderByAsc(SysDictData::getDictSort); |
| | | return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); |
| | | } |
| | | |
| | | /** |
| | | * 根据条件分页查询字典数据 |
| | | * |
| | | * @param dictData 字典数据信息 |
| | | * @return 字典数据集合信息 |
| | | */ |
| | | @Override |
| | | public List<SysDictData> selectDictDataList(SysDictData dictData) { |
| | | return list(new LambdaQueryWrapper<SysDictData>() |
| | | .eq(StringUtils.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) |
| | | .like(StringUtils.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) |
| | | .eq(StringUtils.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) |
| | | .orderByAsc(SysDictData::getDictSort)); |
| | | } |
| | | /** |
| | | * 根据条件分页查询字典数据 |
| | | * |
| | | * @param dictData 字典数据信息 |
| | | * @return 字典数据集合信息 |
| | | */ |
| | | @Override |
| | | public List<SysDictData> selectDictDataList(SysDictData dictData) { |
| | | return list(new LambdaQueryWrapper<SysDictData>() |
| | | .eq(StringUtils.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) |
| | | .like(StringUtils.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) |
| | | .eq(StringUtils.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) |
| | | .orderByAsc(SysDictData::getDictSort)); |
| | | } |
| | | |
| | | /** |
| | | * 根据字典类型和字典键值查询字典数据信息 |
| | | * |
| | | * @param dictType 字典类型 |
| | | * @param dictValue 字典键值 |
| | | * @return 字典标签 |
| | | */ |
| | | @Override |
| | | public String selectDictLabel(String dictType, String dictValue) { |
| | | return getOne(new LambdaQueryWrapper<SysDictData>() |
| | | .select(SysDictData::getDictLabel) |
| | | .eq(SysDictData::getDictType, dictType) |
| | | .eq(SysDictData::getDictValue, dictValue)) |
| | | .getDictLabel(); |
| | | } |
| | | /** |
| | | * 根据字典类型和字典键值查询字典数据信息 |
| | | * |
| | | * @param dictType 字典类型 |
| | | * @param dictValue 字典键值 |
| | | * @return 字典标签 |
| | | */ |
| | | @Override |
| | | public String selectDictLabel(String dictType, String dictValue) { |
| | | return getOne(new LambdaQueryWrapper<SysDictData>() |
| | | .select(SysDictData::getDictLabel) |
| | | .eq(SysDictData::getDictType, dictType) |
| | | .eq(SysDictData::getDictValue, dictValue)) |
| | | .getDictLabel(); |
| | | } |
| | | |
| | | /** |
| | | * 根据字典数据ID查询信息 |
| | | * |
| | | * @param dictCode 字典数据ID |
| | | * @return 字典数据 |
| | | */ |
| | | @Override |
| | | public SysDictData selectDictDataById(Long dictCode) { |
| | | return getById(dictCode); |
| | | } |
| | | /** |
| | | * 根据字典数据ID查询信息 |
| | | * |
| | | * @param dictCode 字典数据ID |
| | | * @return 字典数据 |
| | | */ |
| | | @Override |
| | | public SysDictData selectDictDataById(Long dictCode) { |
| | | return getById(dictCode); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除字典数据信息 |
| | | * |
| | | * @param dictCodes 需要删除的字典数据ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public void deleteDictDataByIds(Long[] dictCodes) { |
| | | for (Long dictCode : dictCodes) { |
| | | SysDictData data = selectDictDataById(dictCode); |
| | | /** |
| | | * 批量删除字典数据信息 |
| | | * |
| | | * @param dictCodes 需要删除的字典数据ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public void deleteDictDataByIds(Long[] dictCodes) { |
| | | for (Long dictCode : dictCodes) { |
| | | SysDictData data = selectDictDataById(dictCode); |
| | | removeById(dictCode); |
| | | List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType()); |
| | | DictUtils.setDictCache(data.getDictType(), dictDatas); |
| | | } |
| | | } |
| | | List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType()); |
| | | DictUtils.setDictCache(data.getDictType(), dictDatas); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 新增保存字典数据信息 |
| | | * |
| | | * @param data 字典数据信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertDictData(SysDictData data) { |
| | | int row = baseMapper.insert(data); |
| | | if (row > 0) { |
| | | List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType()); |
| | | DictUtils.setDictCache(data.getDictType(), dictDatas); |
| | | } |
| | | return row; |
| | | } |
| | | /** |
| | | * 新增保存字典数据信息 |
| | | * |
| | | * @param data 字典数据信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertDictData(SysDictData data) { |
| | | int row = baseMapper.insert(data); |
| | | if (row > 0) { |
| | | List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType()); |
| | | DictUtils.setDictCache(data.getDictType(), dictDatas); |
| | | } |
| | | return row; |
| | | } |
| | | |
| | | /** |
| | | * 修改保存字典数据信息 |
| | | * |
| | | * @param data 字典数据信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateDictData(SysDictData data) { |
| | | int row = baseMapper.updateById(data); |
| | | if (row > 0) { |
| | | List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType()); |
| | | DictUtils.setDictCache(data.getDictType(), dictDatas); |
| | | } |
| | | return row; |
| | | } |
| | | /** |
| | | * 修改保存字典数据信息 |
| | | * |
| | | * @param data 字典数据信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateDictData(SysDictData data) { |
| | | int row = baseMapper.updateById(data); |
| | | if (row > 0) { |
| | | List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType()); |
| | | DictUtils.setDictCache(data.getDictType(), dictDatas); |
| | | } |
| | | return row; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.mapper.SysDictDataMapper; |
| | | import com.ruoyi.system.mapper.SysDictTypeMapper; |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | |
| | | /** |
| | | * 字典 业务层处理 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Service |
| | | public class SysDictTypeServiceImpl extends ServicePlusImpl<SysDictTypeMapper, SysDictType, SysDictType> implements ISysDictTypeService { |
| | | |
| | | @Autowired |
| | | private SysDictDataMapper dictDataMapper; |
| | | @Autowired |
| | | private SysDictDataMapper dictDataMapper; |
| | | |
| | | /** |
| | | * 项目启动时,初始化字典到缓存 |
| | | */ |
| | | @PostConstruct |
| | | public void init() { |
| | | loadingDictCache(); |
| | | } |
| | | /** |
| | | * 项目启动时,初始化字典到缓存 |
| | | */ |
| | | @PostConstruct |
| | | public void init() { |
| | | loadingDictCache(); |
| | | } |
| | | |
| | | @Override |
| | | public TableDataInfo<SysDictType> selectPageDictTypeList(SysDictType dictType) { |
| | | Map<String, Object> params = dictType.getParams(); |
| | | LambdaQueryWrapper<SysDictType> lqw = new LambdaQueryWrapper<SysDictType>() |
| | | .like(StringUtils.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName()) |
| | | .eq(StringUtils.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus()) |
| | | .like(StringUtils.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType()) |
| | | .apply(StringUtils.isNotEmpty(params.get("beginTime")), |
| | | "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", |
| | | params.get("beginTime")) |
| | | .apply(StringUtils.isNotEmpty(params.get("endTime")), |
| | | "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", |
| | | params.get("endTime")); |
| | | return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); |
| | | } |
| | | @Override |
| | | public TableDataInfo<SysDictType> selectPageDictTypeList(SysDictType dictType) { |
| | | Map<String, Object> params = dictType.getParams(); |
| | | LambdaQueryWrapper<SysDictType> lqw = new LambdaQueryWrapper<SysDictType>() |
| | | .like(StringUtils.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName()) |
| | | .eq(StringUtils.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus()) |
| | | .like(StringUtils.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType()) |
| | | .apply(StringUtils.isNotEmpty(params.get("beginTime")), |
| | | "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", |
| | | params.get("beginTime")) |
| | | .apply(StringUtils.isNotEmpty(params.get("endTime")), |
| | | "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", |
| | | params.get("endTime")); |
| | | return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); |
| | | } |
| | | |
| | | /** |
| | | * 根据条件分页查询字典类型 |
| | | * |
| | | * @param dictType 字典类型信息 |
| | | * @return 字典类型集合信息 |
| | | */ |
| | | @Override |
| | | public List<SysDictType> selectDictTypeList(SysDictType dictType) { |
| | | Map<String, Object> params = dictType.getParams(); |
| | | return list(new LambdaQueryWrapper<SysDictType>() |
| | | .like(StringUtils.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName()) |
| | | .eq(StringUtils.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus()) |
| | | .like(StringUtils.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType()) |
| | | .apply(StringUtils.isNotEmpty(params.get("beginTime")), |
| | | "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", |
| | | params.get("beginTime")) |
| | | .apply(StringUtils.isNotEmpty(params.get("endTime")), |
| | | "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", |
| | | params.get("endTime"))); |
| | | } |
| | | /** |
| | | * 根据条件分页查询字典类型 |
| | | * |
| | | * @param dictType 字典类型信息 |
| | | * @return 字典类型集合信息 |
| | | */ |
| | | @Override |
| | | public List<SysDictType> selectDictTypeList(SysDictType dictType) { |
| | | Map<String, Object> params = dictType.getParams(); |
| | | return list(new LambdaQueryWrapper<SysDictType>() |
| | | .like(StringUtils.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName()) |
| | | .eq(StringUtils.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus()) |
| | | .like(StringUtils.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType()) |
| | | .apply(StringUtils.isNotEmpty(params.get("beginTime")), |
| | | "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", |
| | | params.get("beginTime")) |
| | | .apply(StringUtils.isNotEmpty(params.get("endTime")), |
| | | "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", |
| | | params.get("endTime"))); |
| | | } |
| | | |
| | | /** |
| | | * 根据所有字典类型 |
| | | * |
| | | * @return 字典类型集合信息 |
| | | */ |
| | | @Override |
| | | public List<SysDictType> selectDictTypeAll() { |
| | | return list(); |
| | | } |
| | | /** |
| | | * 根据所有字典类型 |
| | | * |
| | | * @return 字典类型集合信息 |
| | | */ |
| | | @Override |
| | | public List<SysDictType> selectDictTypeAll() { |
| | | return list(); |
| | | } |
| | | |
| | | /** |
| | | * 根据字典类型查询字典数据 |
| | | * |
| | | * @param dictType 字典类型 |
| | | * @return 字典数据集合信息 |
| | | */ |
| | | @Override |
| | | public List<SysDictData> selectDictDataByType(String dictType) { |
| | | List<SysDictData> dictDatas = DictUtils.getDictCache(dictType); |
| | | if (CollUtil.isNotEmpty(dictDatas)) { |
| | | return dictDatas; |
| | | } |
| | | dictDatas = dictDataMapper.selectDictDataByType(dictType); |
| | | if (CollUtil.isNotEmpty(dictDatas)) { |
| | | DictUtils.setDictCache(dictType, dictDatas); |
| | | return dictDatas; |
| | | } |
| | | return null; |
| | | } |
| | | /** |
| | | * 根据字典类型查询字典数据 |
| | | * |
| | | * @param dictType 字典类型 |
| | | * @return 字典数据集合信息 |
| | | */ |
| | | @Override |
| | | public List<SysDictData> selectDictDataByType(String dictType) { |
| | | List<SysDictData> dictDatas = DictUtils.getDictCache(dictType); |
| | | if (CollUtil.isNotEmpty(dictDatas)) { |
| | | return dictDatas; |
| | | } |
| | | dictDatas = dictDataMapper.selectDictDataByType(dictType); |
| | | if (CollUtil.isNotEmpty(dictDatas)) { |
| | | DictUtils.setDictCache(dictType, dictDatas); |
| | | return dictDatas; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 根据字典类型ID查询信息 |
| | | * |
| | | * @param dictId 字典类型ID |
| | | * @return 字典类型 |
| | | */ |
| | | @Override |
| | | public SysDictType selectDictTypeById(Long dictId) { |
| | | return getById(dictId); |
| | | } |
| | | /** |
| | | * 根据字典类型ID查询信息 |
| | | * |
| | | * @param dictId 字典类型ID |
| | | * @return 字典类型 |
| | | */ |
| | | @Override |
| | | public SysDictType selectDictTypeById(Long dictId) { |
| | | return getById(dictId); |
| | | } |
| | | |
| | | /** |
| | | * 根据字典类型查询信息 |
| | | * |
| | | * @param dictType 字典类型 |
| | | * @return 字典类型 |
| | | */ |
| | | @Override |
| | | public SysDictType selectDictTypeByType(String dictType) { |
| | | return getOne(new LambdaQueryWrapper<SysDictType>().eq(SysDictType::getDictType, dictType)); |
| | | } |
| | | /** |
| | | * 根据字典类型查询信息 |
| | | * |
| | | * @param dictType 字典类型 |
| | | * @return 字典类型 |
| | | */ |
| | | @Override |
| | | public SysDictType selectDictTypeByType(String dictType) { |
| | | return getOne(new LambdaQueryWrapper<SysDictType>().eq(SysDictType::getDictType, dictType)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除字典类型信息 |
| | | * |
| | | * @param dictIds 需要删除的字典ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public void deleteDictTypeByIds(Long[] dictIds) { |
| | | for (Long dictId : dictIds) { |
| | | SysDictType dictType = selectDictTypeById(dictId); |
| | | if (dictDataMapper.selectCount(new LambdaQueryWrapper<SysDictData>() |
| | | .eq(SysDictData::getDictType, dictType.getDictType())) > 0) { |
| | | throw new ServiceException(String.format("%1$s已分配,不能删除", dictType.getDictName())); |
| | | } |
| | | DictUtils.removeDictCache(dictType.getDictType()); |
| | | } |
| | | baseMapper.deleteBatchIds(Arrays.asList(dictIds)); |
| | | } |
| | | /** |
| | | * 批量删除字典类型信息 |
| | | * |
| | | * @param dictIds 需要删除的字典ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public void deleteDictTypeByIds(Long[] dictIds) { |
| | | for (Long dictId : dictIds) { |
| | | SysDictType dictType = selectDictTypeById(dictId); |
| | | if (dictDataMapper.selectCount(new LambdaQueryWrapper<SysDictData>() |
| | | .eq(SysDictData::getDictType, dictType.getDictType())) > 0) { |
| | | throw new ServiceException(String.format("%1$s已分配,不能删除", dictType.getDictName())); |
| | | } |
| | | DictUtils.removeDictCache(dictType.getDictType()); |
| | | } |
| | | baseMapper.deleteBatchIds(Arrays.asList(dictIds)); |
| | | } |
| | | |
| | | /** |
| | | * 加载字典缓存数据 |
| | | */ |
| | | @Override |
| | | public void loadingDictCache() { |
| | | List<SysDictType> dictTypeList = list(); |
| | | for (SysDictType dictType : dictTypeList) { |
| | | List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType()); |
| | | DictUtils.setDictCache(dictType.getDictType(), dictDatas); |
| | | } |
| | | } |
| | | /** |
| | | * 加载字典缓存数据 |
| | | */ |
| | | @Override |
| | | public void loadingDictCache() { |
| | | List<SysDictType> dictTypeList = list(); |
| | | for (SysDictType dictType : dictTypeList) { |
| | | List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType()); |
| | | DictUtils.setDictCache(dictType.getDictType(), dictDatas); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 清空字典缓存数据 |
| | | */ |
| | | @Override |
| | | public void clearDictCache() { |
| | | DictUtils.clearDictCache(); |
| | | } |
| | | /** |
| | | * 清空字典缓存数据 |
| | | */ |
| | | @Override |
| | | public void clearDictCache() { |
| | | DictUtils.clearDictCache(); |
| | | } |
| | | |
| | | /** |
| | | * 重置字典缓存数据 |
| | | */ |
| | | @Override |
| | | public void resetDictCache() { |
| | | clearDictCache(); |
| | | loadingDictCache(); |
| | | } |
| | | /** |
| | | * 重置字典缓存数据 |
| | | */ |
| | | @Override |
| | | public void resetDictCache() { |
| | | clearDictCache(); |
| | | loadingDictCache(); |
| | | } |
| | | |
| | | /** |
| | | * 新增保存字典类型信息 |
| | | * |
| | | * @param dict 字典类型信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertDictType(SysDictType dict) { |
| | | int row = baseMapper.insert(dict); |
| | | if (row > 0) { |
| | | DictUtils.setDictCache(dict.getDictType(), null); |
| | | } |
| | | return row; |
| | | } |
| | | /** |
| | | * 新增保存字典类型信息 |
| | | * |
| | | * @param dict 字典类型信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertDictType(SysDictType dict) { |
| | | int row = baseMapper.insert(dict); |
| | | if (row > 0) { |
| | | DictUtils.setDictCache(dict.getDictType(), null); |
| | | } |
| | | return row; |
| | | } |
| | | |
| | | /** |
| | | * 修改保存字典类型信息 |
| | | * |
| | | * @param dict 字典类型信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int updateDictType(SysDictType dict) { |
| | | SysDictType oldDict = getById(dict.getDictId()); |
| | | dictDataMapper.update(null, new LambdaUpdateWrapper<SysDictData>() |
| | | .set(SysDictData::getDictType, dict.getDictType()) |
| | | .eq(SysDictData::getDictType, oldDict.getDictType())); |
| | | int row = baseMapper.updateById(dict); |
| | | if (row > 0) { |
| | | List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType()); |
| | | DictUtils.setDictCache(dict.getDictType(), dictDatas); |
| | | } |
| | | return row; |
| | | } |
| | | /** |
| | | * 修改保存字典类型信息 |
| | | * |
| | | * @param dict 字典类型信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int updateDictType(SysDictType dict) { |
| | | SysDictType oldDict = getById(dict.getDictId()); |
| | | dictDataMapper.update(null, new LambdaUpdateWrapper<SysDictData>() |
| | | .set(SysDictData::getDictType, dict.getDictType()) |
| | | .eq(SysDictData::getDictType, oldDict.getDictType())); |
| | | int row = baseMapper.updateById(dict); |
| | | if (row > 0) { |
| | | List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType()); |
| | | DictUtils.setDictCache(dict.getDictType(), dictDatas); |
| | | } |
| | | return row; |
| | | } |
| | | |
| | | /** |
| | | * 校验字典类型称是否唯一 |
| | | * |
| | | * @param dict 字典类型 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public String checkDictTypeUnique(SysDictType dict) { |
| | | Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId(); |
| | | SysDictType dictType = getOne(new LambdaQueryWrapper<SysDictType>() |
| | | .eq(SysDictType::getDictType, dict.getDictType()) |
| | | .last("limit 1")); |
| | | if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | /** |
| | | * 校验字典类型称是否唯一 |
| | | * |
| | | * @param dict 字典类型 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public String checkDictTypeUnique(SysDictType dict) { |
| | | Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId(); |
| | | SysDictType dictType = getOne(new LambdaQueryWrapper<SysDictType>() |
| | | .eq(SysDictType::getDictType, dict.getDictType()) |
| | | .last("limit 1")); |
| | | if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 系统访问日志情况信息 服务层处理 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | |
| | | /** |
| | | * 菜单 业务层处理 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Service |
| | | public class SysMenuServiceImpl extends ServicePlusImpl<SysMenuMapper, SysMenu, SysMenu> implements ISysMenuService { |
| | | public static final String PREMISSION_STRING = "perms[\"{0}\"]"; |
| | | |
| | | @Autowired |
| | | private SysRoleMapper roleMapper; |
| | |
| | | // 管理员显示所有菜单信息 |
| | | if (SysUser.isAdmin(userId)) { |
| | | menuList = list(new LambdaQueryWrapper<SysMenu>() |
| | | .like(StringUtils.isNotBlank(menu.getMenuName()),SysMenu::getMenuName,menu.getMenuName()) |
| | | .eq(StringUtils.isNotBlank(menu.getVisible()),SysMenu::getVisible,menu.getVisible()) |
| | | .eq(StringUtils.isNotBlank(menu.getStatus()),SysMenu::getStatus,menu.getStatus()) |
| | | .like(StringUtils.isNotBlank(menu.getMenuName()), SysMenu::getMenuName, menu.getMenuName()) |
| | | .eq(StringUtils.isNotBlank(menu.getVisible()), SysMenu::getVisible, menu.getVisible()) |
| | | .eq(StringUtils.isNotBlank(menu.getStatus()), SysMenu::getStatus, menu.getStatus()) |
| | | .orderByAsc(SysMenu::getParentId) |
| | | .orderByAsc(SysMenu::getOrderNum)); |
| | | } else { |
| | |
| | | router.setComponent(getComponent(menu)); |
| | | router.setQuery(menu.getQuery()); |
| | | router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); |
| | | List<SysMenu> cMenus = menu.getChildren(); |
| | | List<SysMenu> cMenus = (List<SysMenu>) menu.getChildren(); |
| | | if (!cMenus.isEmpty() && UserConstants.TYPE_DIR.equals(menu.getMenuType())) { |
| | | router.setAlwaysShow(true); |
| | | router.setRedirect("noRedirect"); |
| | |
| | | children.setName(StringUtils.capitalize(menu.getPath())); |
| | | children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); |
| | | children.setQuery(menu.getQuery()); |
| | | childrenList.add(children); |
| | | router.setChildren(childrenList); |
| | | } else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) { |
| | | router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon())); |
| | | router.setPath("/inner"); |
| | | List<RouterVo> childrenList = new ArrayList<RouterVo>(); |
| | | RouterVo children = new RouterVo(); |
| | | String routerPath = StringUtils.replaceEach(menu.getPath(), new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" }); |
| | | children.setPath(routerPath); |
| | | children.setComponent(UserConstants.INNER_LINK); |
| | | children.setName(StringUtils.capitalize(routerPath)); |
| | | children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath())); |
| | | childrenList.add(children); |
| | | router.setChildren(childrenList); |
| | | } else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) { |
| | | router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon())); |
| | | router.setPath("/inner"); |
| | | List<RouterVo> childrenList = new ArrayList<RouterVo>(); |
| | | RouterVo children = new RouterVo(); |
| | | String routerPath = StringUtils.replaceEach(menu.getPath(), new String[]{Constants.HTTP, Constants.HTTPS}, new String[]{"", ""}); |
| | | children.setPath(routerPath); |
| | | children.setComponent(UserConstants.INNER_LINK); |
| | | children.setName(StringUtils.capitalize(routerPath)); |
| | | children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath())); |
| | | childrenList.add(children); |
| | | router.setChildren(childrenList); |
| | | } |
| | |
| | | for (SysMenu dept : menus) { |
| | | tempList.add(dept.getMenuId()); |
| | | } |
| | | for (SysMenu menu : menus) { |
| | | // 如果是顶级节点, 遍历该父节点的所有子节点 |
| | | if (!tempList.contains(menu.getParentId())) { |
| | | recursionFn(menus, menu); |
| | | returnList.add(menu); |
| | | } |
| | | } |
| | | for (SysMenu menu : menus) { |
| | | // 如果是顶级节点, 遍历该父节点的所有子节点 |
| | | if (!tempList.contains(menu.getParentId())) { |
| | | recursionFn(menus, menu); |
| | | returnList.add(menu); |
| | | } |
| | | } |
| | | if (returnList.isEmpty()) { |
| | | returnList = menus; |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public boolean hasChildByMenuId(Long menuId) { |
| | | long result = count(new LambdaQueryWrapper<SysMenu>().eq(SysMenu::getParentId,menuId)); |
| | | long result = count(new LambdaQueryWrapper<SysMenu>().eq(SysMenu::getParentId, menuId)); |
| | | return result > 0; |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public boolean checkMenuExistRole(Long menuId) { |
| | | long result = roleMenuMapper.selectCount(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getMenuId,menuId)); |
| | | long result = roleMenuMapper.selectCount(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getMenuId, menuId)); |
| | | return result > 0; |
| | | } |
| | | |
| | |
| | | public String checkMenuNameUnique(SysMenu menu) { |
| | | Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId(); |
| | | SysMenu info = getOne(new LambdaQueryWrapper<SysMenu>() |
| | | .eq(SysMenu::getMenuName,menu.getMenuName()) |
| | | .eq(SysMenu::getParentId,menu.getParentId()) |
| | | .eq(SysMenu::getMenuName, menu.getMenuName()) |
| | | .eq(SysMenu::getParentId, menu.getParentId()) |
| | | .last("limit 1")); |
| | | if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) { |
| | | return UserConstants.NOT_UNIQUE; |
| | |
| | | String routerPath = menu.getPath(); |
| | | // 内链打开外网方式 |
| | | if (menu.getParentId().intValue() != 0 && isInnerLink(menu)) { |
| | | routerPath = StringUtils.replaceEach(routerPath, new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" }); |
| | | routerPath = StringUtils.replaceEach(routerPath, new String[]{Constants.HTTP, Constants.HTTPS}, new String[]{"", ""}); |
| | | } |
| | | // 非外链并且是一级目录(类型为目录) |
| | | if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType()) |
| | |
| | | String component = UserConstants.LAYOUT; |
| | | if (StringUtils.isNotEmpty(menu.getComponent()) && !isMenuFrame(menu)) { |
| | | component = menu.getComponent(); |
| | | } else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0 && isInnerLink(menu)) { |
| | | component = UserConstants.INNER_LINK; |
| | | } else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) { |
| | | } else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0 && isInnerLink(menu)) { |
| | | component = UserConstants.INNER_LINK; |
| | | } else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) { |
| | | component = UserConstants.PARENT_VIEW; |
| | | } |
| | | return component; |
| | |
| | | /** |
| | | * 根据父节点的ID获取所有子节点 |
| | | * |
| | | * @param list 分类表 |
| | | * @param list 分类表 |
| | | * @param parentId 传入的父节点ID |
| | | * @return String |
| | | */ |
| | | public List<SysMenu> getChildPerms(List<SysMenu> list, int parentId) { |
| | | List<SysMenu> returnList = new ArrayList<SysMenu>(); |
| | | for (SysMenu t : list) { |
| | | // 一、根据传入的某个父节点ID,遍历该父节点的所有子节点 |
| | | if (t.getParentId() == parentId) { |
| | | recursionFn(list, t); |
| | | returnList.add(t); |
| | | } |
| | | } |
| | | for (SysMenu t : list) { |
| | | // 一、根据传入的某个父节点ID,遍历该父节点的所有子节点 |
| | | if (t.getParentId() == parentId) { |
| | | recursionFn(list, t); |
| | | returnList.add(t); |
| | | } |
| | | } |
| | | return returnList; |
| | | } |
| | | |
| | |
| | | */ |
| | | private List<SysMenu> getChildList(List<SysMenu> list, SysMenu t) { |
| | | List<SysMenu> tlist = new ArrayList<SysMenu>(); |
| | | for (SysMenu n : list) { |
| | | if (n.getParentId().longValue() == t.getMenuId().longValue()) { |
| | | tlist.add(n); |
| | | } |
| | | } |
| | | for (SysMenu n : list) { |
| | | if (n.getParentId().longValue() == t.getMenuId().longValue()) { |
| | | tlist.add(n); |
| | | } |
| | | } |
| | | return tlist; |
| | | } |
| | | |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.domain.SysNotice; |
| | | import com.ruoyi.system.mapper.SysNoticeMapper; |
| | | import com.ruoyi.system.service.ISysNoticeService; |
| | |
| | | /** |
| | | * 公告 服务层实现 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Service |
| | | public class SysNoticeServiceImpl extends ServicePlusImpl<SysNoticeMapper, SysNotice, SysNotice> implements ISysNoticeService { |
| | |
| | | .like(StringUtils.isNotBlank(notice.getNoticeTitle()), SysNotice::getNoticeTitle, notice.getNoticeTitle()) |
| | | .eq(StringUtils.isNotBlank(notice.getNoticeType()), SysNotice::getNoticeType, notice.getNoticeType()) |
| | | .like(StringUtils.isNotBlank(notice.getCreateBy()), SysNotice::getCreateBy, notice.getCreateBy()); |
| | | return PageUtils.buildDataInfo(page(PageUtils.buildPage(),lqw)); |
| | | return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public List<SysNotice> selectNoticeList(SysNotice notice) { |
| | | return list(new LambdaQueryWrapper<SysNotice>() |
| | | .like(StringUtils.isNotBlank(notice.getNoticeTitle()),SysNotice::getNoticeTitle,notice.getNoticeTitle()) |
| | | .eq(StringUtils.isNotBlank(notice.getNoticeType()),SysNotice::getNoticeType,notice.getNoticeType()) |
| | | .like(StringUtils.isNotBlank(notice.getCreateBy()),SysNotice::getCreateBy,notice.getCreateBy())); |
| | | .like(StringUtils.isNotBlank(notice.getNoticeTitle()), SysNotice::getNoticeTitle, notice.getNoticeTitle()) |
| | | .eq(StringUtils.isNotBlank(notice.getNoticeType()), SysNotice::getNoticeType, notice.getNoticeType()) |
| | | .like(StringUtils.isNotBlank(notice.getCreateBy()), SysNotice::getCreateBy, notice.getCreateBy())); |
| | | } |
| | | |
| | | /** |
| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.dto.OperLogDTO; |
| | | import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.core.service.OperLogService; |
| | | import com.ruoyi.common.core.domain.dto.OperLogDTO; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.ip.AddressUtils; |
| | |
| | | /** |
| | | * 操作日志 服务层处理 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Service |
| | | public class SysOperLogServiceImpl extends ServicePlusImpl<SysOperLogMapper, SysOperLog, SysOperLog> implements ISysOperLogService, OperLogService { |
| | |
| | | .apply(StringUtils.isNotEmpty(params.get("endTime")), |
| | | "date_format(oper_time,'%y%m%d') <= date_format({0},'%y%m%d')", |
| | | params.get("endTime")); |
| | | return PageUtils.buildDataInfo(page(PageUtils.buildPage("oper_id","desc"), lqw)); |
| | | return PageUtils.buildDataInfo(page(PageUtils.buildPage("oper_id", "desc"), lqw)); |
| | | } |
| | | |
| | | /** |
| | |
| | | public List<SysOperLog> selectOperLogList(SysOperLog operLog) { |
| | | Map<String, Object> params = operLog.getParams(); |
| | | return list(new LambdaQueryWrapper<SysOperLog>() |
| | | .like(StringUtils.isNotBlank(operLog.getTitle()),SysOperLog::getTitle,operLog.getTitle()) |
| | | .like(StringUtils.isNotBlank(operLog.getTitle()), SysOperLog::getTitle, operLog.getTitle()) |
| | | .eq(operLog.getBusinessType() != null && operLog.getBusinessType() > 0, |
| | | SysOperLog::getBusinessType,operLog.getBusinessType()) |
| | | SysOperLog::getBusinessType, operLog.getBusinessType()) |
| | | .func(f -> { |
| | | if (ArrayUtil.isNotEmpty(operLog.getBusinessTypes())){ |
| | | if (ArrayUtil.isNotEmpty(operLog.getBusinessTypes())) { |
| | | f.in(SysOperLog::getBusinessType, Arrays.asList(operLog.getBusinessTypes())); |
| | | } |
| | | }) |
| | | .eq(operLog.getStatus() != null && operLog.getStatus() > 0, |
| | | SysOperLog::getStatus,operLog.getStatus()) |
| | | .like(StringUtils.isNotBlank(operLog.getOperName()),SysOperLog::getOperName,operLog.getOperName()) |
| | | SysOperLog::getStatus, operLog.getStatus()) |
| | | .like(StringUtils.isNotBlank(operLog.getOperName()), SysOperLog::getOperName, operLog.getOperName()) |
| | | .apply(StringUtils.isNotEmpty(params.get("beginTime")), |
| | | "date_format(oper_time,'%y%m%d') >= date_format({0},'%y%m%d')", |
| | | params.get("beginTime")) |
| | |
| | | @Service |
| | | public class SysOssConfigServiceImpl extends ServicePlusImpl<SysOssConfigMapper, SysOssConfig, SysOssConfigVo> implements ISysOssConfigService { |
| | | |
| | | /** |
| | | * 项目启动时,初始化参数到缓存,加载配置类 |
| | | */ |
| | | @PostConstruct |
| | | public void init() { |
| | | List<SysOssConfig> list = list(); |
| | | for (SysOssConfig config : list) { |
| | | String configKey = config.getConfigKey(); |
| | | if ("0".equals(config.getStatus())) { |
| | | RedisUtils.setCacheObject(CloudConstant.CACHE_CONFIG_KEY, configKey); |
| | | } |
| | | setConfigCache(true, config); |
| | | } |
| | | } |
| | | /** |
| | | * 项目启动时,初始化参数到缓存,加载配置类 |
| | | */ |
| | | @PostConstruct |
| | | public void init() { |
| | | List<SysOssConfig> list = list(); |
| | | for (SysOssConfig config : list) { |
| | | String configKey = config.getConfigKey(); |
| | | if ("0".equals(config.getStatus())) { |
| | | RedisUtils.setCacheObject(CloudConstant.CACHE_CONFIG_KEY, configKey); |
| | | } |
| | | setConfigCache(true, config); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public SysOssConfigVo queryById(Integer ossConfigId){ |
| | | public SysOssConfigVo queryById(Integer ossConfigId) { |
| | | return getVoById(ossConfigId); |
| | | } |
| | | |
| | |
| | | LambdaQueryWrapper<SysOssConfig> lqw = Wrappers.lambdaQuery(); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getConfigKey()), SysOssConfig::getConfigKey, bo.getConfigKey()); |
| | | lqw.like(StringUtils.isNotBlank(bo.getBucketName()), SysOssConfig::getBucketName, bo.getBucketName()); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysOssConfig::getStatus, bo.getStatus()); |
| | | return lqw; |
| | | lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysOssConfig::getStatus, bo.getStatus()); |
| | | return lqw; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean insertByBo(SysOssConfigBo bo) { |
| | | SysOssConfig config = BeanUtil.toBean(bo, SysOssConfig.class); |
| | | validEntityBeforeSave(config); |
| | | return setConfigCache(save(config), config); |
| | | return setConfigCache(save(config), config); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean updateByBo(SysOssConfigBo bo) { |
| | | SysOssConfig config = BeanUtil.toBean(bo, SysOssConfig.class); |
| | | validEntityBeforeSave(config); |
| | | LambdaUpdateWrapper<SysOssConfig> luw = new LambdaUpdateWrapper<>(); |
| | | luw.set(StringUtils.isBlank(config.getPrefix()), SysOssConfig::getPrefix, ""); |
| | | luw.set(StringUtils.isBlank(config.getRegion()), SysOssConfig::getRegion, ""); |
| | | luw.set(StringUtils.isBlank(config.getExt1()), SysOssConfig::getExt1, ""); |
| | | luw.eq(SysOssConfig::getOssConfigId, config.getOssConfigId()); |
| | | return setConfigCache(update(config, luw), config); |
| | | LambdaUpdateWrapper<SysOssConfig> luw = new LambdaUpdateWrapper<>(); |
| | | luw.set(StringUtils.isBlank(config.getPrefix()), SysOssConfig::getPrefix, ""); |
| | | luw.set(StringUtils.isBlank(config.getRegion()), SysOssConfig::getRegion, ""); |
| | | luw.set(StringUtils.isBlank(config.getExt1()), SysOssConfig::getExt1, ""); |
| | | luw.eq(SysOssConfig::getOssConfigId, config.getOssConfigId()); |
| | | return setConfigCache(update(config, luw), config); |
| | | } |
| | | |
| | | /** |
| | | * 保存前的数据校验 |
| | | */ |
| | | private void validEntityBeforeSave(SysOssConfig entity){ |
| | | if (StringUtils.isNotEmpty(entity.getConfigKey()) |
| | | && UserConstants.NOT_UNIQUE.equals(checkConfigKeyUnique(entity))) { |
| | | throw new ServiceException("操作配置'" + entity.getConfigKey() + "'失败, 配置key已存在!"); |
| | | } |
| | | private void validEntityBeforeSave(SysOssConfig entity) { |
| | | if (StringUtils.isNotEmpty(entity.getConfigKey()) |
| | | && UserConstants.NOT_UNIQUE.equals(checkConfigKeyUnique(entity))) { |
| | | throw new ServiceException("操作配置'" + entity.getConfigKey() + "'失败, 配置key已存在!"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
| | | if(isValid) { |
| | | if (CollUtil.containsAny(ids, CloudConstant.SYSTEM_DATA_IDS)) { |
| | | throw new ServiceException("系统内置, 不可删除!"); |
| | | } |
| | | } |
| | | if (isValid) { |
| | | if (CollUtil.containsAny(ids, CloudConstant.SYSTEM_DATA_IDS)) { |
| | | throw new ServiceException("系统内置, 不可删除!"); |
| | | } |
| | | } |
| | | List<SysOssConfig> list = Lists.newArrayList(); |
| | | for (Long configId : ids) { |
| | | SysOssConfig config = getById(configId); |
| | |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * 判断configKey是否唯一 |
| | | */ |
| | | private String checkConfigKeyUnique(SysOssConfig sysOssConfig) { |
| | | long ossConfigId = StringUtils.isNull(sysOssConfig.getOssConfigId()) ? -1L : sysOssConfig.getOssConfigId(); |
| | | SysOssConfig info = getOne(new LambdaQueryWrapper<SysOssConfig>() |
| | | .select(SysOssConfig::getOssConfigId, SysOssConfig::getConfigKey) |
| | | .eq(SysOssConfig::getConfigKey, sysOssConfig.getConfigKey())); |
| | | if (StringUtils.isNotNull(info) && info.getOssConfigId() != ossConfigId) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | /** |
| | | * 判断configKey是否唯一 |
| | | */ |
| | | private String checkConfigKeyUnique(SysOssConfig sysOssConfig) { |
| | | long ossConfigId = StringUtils.isNull(sysOssConfig.getOssConfigId()) ? -1L : sysOssConfig.getOssConfigId(); |
| | | SysOssConfig info = getOne(new LambdaQueryWrapper<SysOssConfig>() |
| | | .select(SysOssConfig::getOssConfigId, SysOssConfig::getConfigKey) |
| | | .eq(SysOssConfig::getConfigKey, sysOssConfig.getConfigKey())); |
| | | if (StringUtils.isNotNull(info) && info.getOssConfigId() != ossConfigId) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | |
| | | /** |
| | | * 启用禁用状态 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int updateOssConfigStatus(SysOssConfigBo bo) { |
| | | SysOssConfig sysOssConfig = BeanUtil.toBean(bo, SysOssConfig.class); |
| | | int row = baseMapper.update(null, new LambdaUpdateWrapper<SysOssConfig>() |
| | | .set(SysOssConfig::getStatus, "1")); |
| | | row += baseMapper.updateById(sysOssConfig); |
| | | if (row > 0) { |
| | | RedisUtils.setCacheObject(CloudConstant.CACHE_CONFIG_KEY, sysOssConfig.getConfigKey()); |
| | | } |
| | | return row; |
| | | } |
| | | /** |
| | | * 启用禁用状态 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int updateOssConfigStatus(SysOssConfigBo bo) { |
| | | SysOssConfig sysOssConfig = BeanUtil.toBean(bo, SysOssConfig.class); |
| | | int row = baseMapper.update(null, new LambdaUpdateWrapper<SysOssConfig>() |
| | | .set(SysOssConfig::getStatus, "1")); |
| | | row += baseMapper.updateById(sysOssConfig); |
| | | if (row > 0) { |
| | | RedisUtils.setCacheObject(CloudConstant.CACHE_CONFIG_KEY, sysOssConfig.getConfigKey()); |
| | | } |
| | | return row; |
| | | } |
| | | |
| | | /** |
| | | * 设置cache key |
| | | * |
| | | * @param configKey 参数键 |
| | | * @return 缓存键key |
| | | */ |
| | | private String getCacheKey(String configKey) { |
| | | return CloudConstant.SYS_OSS_KEY + configKey; |
| | | } |
| | | /** |
| | | * 设置cache key |
| | | * |
| | | * @param configKey 参数键 |
| | | * @return 缓存键key |
| | | */ |
| | | private String getCacheKey(String configKey) { |
| | | return CloudConstant.SYS_OSS_KEY + configKey; |
| | | } |
| | | |
| | | /** |
| | | * 如果操作成功 则更新缓存 |
| | | * @param flag 操作状态 |
| | | * @param config 配置 |
| | | * @return 返回操作状态 |
| | | */ |
| | | private boolean setConfigCache(boolean flag, SysOssConfig config) { |
| | | if (flag) { |
| | | RedisUtils.setCacheObject( |
| | | getCacheKey(config.getConfigKey()), |
| | | JsonUtils.toJsonString(config)); |
| | | RedisUtils.publish(CloudConstant.CACHE_CONFIG_KEY, config.getConfigKey(), msg -> { |
| | | log.info("发布刷新OSS配置 => " + msg); |
| | | }); |
| | | } |
| | | return flag; |
| | | } |
| | | /** |
| | | * 如果操作成功 则更新缓存 |
| | | * |
| | | * @param flag 操作状态 |
| | | * @param config 配置 |
| | | * @return 返回操作状态 |
| | | */ |
| | | private boolean setConfigCache(boolean flag, SysOssConfig config) { |
| | | if (flag) { |
| | | RedisUtils.setCacheObject( |
| | | getCacheKey(config.getConfigKey()), |
| | | JsonUtils.toJsonString(config)); |
| | | RedisUtils.publish(CloudConstant.CACHE_CONFIG_KEY, config.getConfigKey(), msg -> { |
| | | log.info("发布刷新OSS配置 => " + msg); |
| | | }); |
| | | } |
| | | return flag; |
| | | } |
| | | } |
| | |
| | | @Service |
| | | public class SysOssServiceImpl extends ServicePlusImpl<SysOssMapper, SysOss, SysOssVo> implements ISysOssService { |
| | | |
| | | @Override |
| | | public TableDataInfo<SysOssVo> queryPageList(SysOssBo bo) { |
| | | PagePlus<SysOss, SysOssVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo)); |
| | | return PageUtils.buildDataInfo(result); |
| | | } |
| | | @Override |
| | | public TableDataInfo<SysOssVo> queryPageList(SysOssBo bo) { |
| | | PagePlus<SysOss, SysOssVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo)); |
| | | return PageUtils.buildDataInfo(result); |
| | | } |
| | | |
| | | private LambdaQueryWrapper<SysOss> buildQueryWrapper(SysOssBo bo) { |
| | | Map<String, Object> params = bo.getParams(); |
| | | LambdaQueryWrapper<SysOss> lqw = Wrappers.lambdaQuery(); |
| | | lqw.like(StringUtils.isNotBlank(bo.getFileName()), SysOss::getFileName, bo.getFileName()); |
| | | lqw.like(StringUtils.isNotBlank(bo.getOriginalName()), SysOss::getOriginalName, bo.getOriginalName()); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getFileSuffix()), SysOss::getFileSuffix, bo.getFileSuffix()); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getUrl()), SysOss::getUrl, bo.getUrl()); |
| | | lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null, |
| | | SysOss::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime")); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getCreateBy()), SysOss::getCreateBy, bo.getCreateBy()); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getService()), SysOss::getService, bo.getService()); |
| | | return lqw; |
| | | } |
| | | private LambdaQueryWrapper<SysOss> buildQueryWrapper(SysOssBo bo) { |
| | | Map<String, Object> params = bo.getParams(); |
| | | LambdaQueryWrapper<SysOss> lqw = Wrappers.lambdaQuery(); |
| | | lqw.like(StringUtils.isNotBlank(bo.getFileName()), SysOss::getFileName, bo.getFileName()); |
| | | lqw.like(StringUtils.isNotBlank(bo.getOriginalName()), SysOss::getOriginalName, bo.getOriginalName()); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getFileSuffix()), SysOss::getFileSuffix, bo.getFileSuffix()); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getUrl()), SysOss::getUrl, bo.getUrl()); |
| | | lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null, |
| | | SysOss::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime")); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getCreateBy()), SysOss::getCreateBy, bo.getCreateBy()); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getService()), SysOss::getService, bo.getService()); |
| | | return lqw; |
| | | } |
| | | |
| | | @Override |
| | | public SysOss upload(MultipartFile file) { |
| | | String originalfileName = file.getOriginalFilename(); |
| | | String suffix = StringUtils.substring(originalfileName, originalfileName.lastIndexOf("."), originalfileName.length()); |
| | | ICloudStorageStrategy storage = OssFactory.instance(); |
| | | UploadResult uploadResult; |
| | | try { |
| | | uploadResult = storage.uploadSuffix(file.getBytes(), suffix, file.getContentType()); |
| | | } catch (IOException e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | // 保存文件信息 |
| | | SysOss oss = new SysOss() |
| | | .setUrl(uploadResult.getUrl()) |
| | | .setFileSuffix(suffix) |
| | | .setFileName(uploadResult.getFilename()) |
| | | .setOriginalName(originalfileName) |
| | | .setService(storage.getServiceType()); |
| | | save(oss); |
| | | return oss; |
| | | } |
| | | @Override |
| | | public SysOss upload(MultipartFile file) { |
| | | String originalfileName = file.getOriginalFilename(); |
| | | String suffix = StringUtils.substring(originalfileName, originalfileName.lastIndexOf("."), originalfileName.length()); |
| | | ICloudStorageStrategy storage = OssFactory.instance(); |
| | | UploadResult uploadResult; |
| | | try { |
| | | uploadResult = storage.uploadSuffix(file.getBytes(), suffix, file.getContentType()); |
| | | } catch (IOException e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | // 保存文件信息 |
| | | SysOss oss = new SysOss() |
| | | .setUrl(uploadResult.getUrl()) |
| | | .setFileSuffix(suffix) |
| | | .setFileName(uploadResult.getFilename()) |
| | | .setOriginalName(originalfileName) |
| | | .setService(storage.getServiceType()); |
| | | save(oss); |
| | | return oss; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
| | | if (isValid) { |
| | | // 做一些业务上的校验,判断是否需要校验 |
| | | } |
| | | List<SysOss> list = listByIds(ids); |
| | | for (SysOss sysOss : list) { |
| | | ICloudStorageStrategy storage = OssFactory.instance(sysOss.getService()); |
| | | storage.delete(sysOss.getUrl()); |
| | | } |
| | | return removeByIds(ids); |
| | | } |
| | | @Override |
| | | public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
| | | if (isValid) { |
| | | // 做一些业务上的校验,判断是否需要校验 |
| | | } |
| | | List<SysOss> list = listByIds(ids); |
| | | for (SysOss sysOss : list) { |
| | | ICloudStorageStrategy storage = OssFactory.instance(sysOss.getService()); |
| | | storage.delete(sysOss.getUrl()); |
| | | } |
| | | return removeByIds(ids); |
| | | } |
| | | |
| | | } |
| | |
| | | /** |
| | | * 岗位信息 服务层处理 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Service |
| | | public class SysPostServiceImpl extends ServicePlusImpl<SysPostMapper, SysPost, SysPost> implements ISysPostService { |
| | |
| | | .like(StringUtils.isNotBlank(post.getPostCode()), SysPost::getPostCode, post.getPostCode()) |
| | | .eq(StringUtils.isNotBlank(post.getStatus()), SysPost::getStatus, post.getStatus()) |
| | | .like(StringUtils.isNotBlank(post.getPostName()), SysPost::getPostName, post.getPostName()); |
| | | return PageUtils.buildDataInfo(page(PageUtils.buildPage(),lqw)); |
| | | return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public long countUserPostById(Long postId) { |
| | | return userPostMapper.selectCount(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getPostId,postId)); |
| | | return userPostMapper.selectCount(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getPostId, postId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.common.annotation.DataScope; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | |
| | | /** |
| | | * 角色 业务层处理 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Service |
| | | public class SysRoleServiceImpl extends ServicePlusImpl<SysRoleMapper, SysRole, SysRole> implements ISysRoleService { |
| | |
| | | list.add(rm); |
| | | } |
| | | if (list.size() > 0) { |
| | | rows = roleMenuMapper.insertAll(list); |
| | | rows = roleMenuMapper.insertAll(list); |
| | | } |
| | | return rows; |
| | | } |
| | |
| | | list.add(rd); |
| | | } |
| | | if (list.size() > 0) { |
| | | rows = roleDeptMapper.insertAll(list); |
| | | rows = roleDeptMapper.insertAll(list); |
| | | } |
| | | return rows; |
| | | } |
| | |
| | | @Override |
| | | public int deleteAuthUser(SysUserRole userRole) { |
| | | return userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>() |
| | | .eq(SysUserRole::getRoleId, userRole.getRoleId()) |
| | | .eq(SysUserRole::getUserId, userRole.getUserId())); |
| | | .eq(SysUserRole::getRoleId, userRole.getRoleId()) |
| | | .eq(SysUserRole::getUserId, userRole.getUserId())); |
| | | } |
| | | |
| | | /** |
| | | * 批量取消授权用户角色 |
| | | * |
| | | * @param roleId 角色ID |
| | | * @param roleId 角色ID |
| | | * @param userIds 需要取消授权的用户数据ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteAuthUsers(Long roleId, Long[] userIds) { |
| | | return userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>() |
| | | .eq(SysUserRole::getRoleId, roleId) |
| | | .in(SysUserRole::getUserId, Arrays.asList(userIds))); |
| | | return userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>() |
| | | .eq(SysUserRole::getRoleId, roleId) |
| | | .in(SysUserRole::getUserId, Arrays.asList(userIds))); |
| | | } |
| | | |
| | | /** |
| | | * 批量选择授权用户角色 |
| | | * |
| | | * @param roleId 角色ID |
| | | * @param roleId 角色ID |
| | | * @param userIds 需要删除的用户数据ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertAuthUsers(Long roleId, Long[] userIds) { |
| | | // 新增用户与角色管理 |
| | | int rows = 1; |
| | | List<SysUserRole> list = new ArrayList<SysUserRole>(); |
| | | int rows = 1; |
| | | List<SysUserRole> list = new ArrayList<SysUserRole>(); |
| | | for (Long userId : userIds) { |
| | | SysUserRole ur = new SysUserRole(); |
| | | ur.setUserId(userId); |
| | | ur.setRoleId(roleId); |
| | | list.add(ur); |
| | | } |
| | | if (list.size() > 0) { |
| | | rows = userRoleMapper.insertAll(list); |
| | | } |
| | | if (list.size() > 0) { |
| | | rows = userRoleMapper.insertAll(list); |
| | | } |
| | | return rows; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 在线用户 服务层处理 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Service |
| | | public class SysUserOnlineServiceImpl implements ISysUserOnlineService { |
| | | |
| | | /** |
| | | * 通过登录地址查询信息 |
| | | * |
| | |
| | | /** |
| | | * 用户 业务层处理 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | |
| | | @Override |
| | | @DataScope(deptAlias = "d", userAlias = "u", isUser = true) |
| | | public TableDataInfo<SysUser> selectAllocatedList(SysUser user) { |
| | | return PageUtils.buildDataInfo(baseMapper.selectAllocatedList(PageUtils.buildPage(), user)); |
| | | return PageUtils.buildDataInfo(baseMapper.selectAllocatedList(PageUtils.buildPage(), user)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Override |
| | | @DataScope(deptAlias = "d", userAlias = "u", isUser = true) |
| | | public TableDataInfo<SysUser> selectUnallocatedList(SysUser user) { |
| | | return PageUtils.buildDataInfo(baseMapper.selectUnallocatedList(PageUtils.buildPage(), user)); |
| | | return PageUtils.buildDataInfo(baseMapper.selectUnallocatedList(PageUtils.buildPage(), user)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Override |
| | | public boolean registerUser(SysUser user) { |
| | | return baseMapper.insert(user) > 0; |
| | | } |
| | |
| | | public int updateUser(SysUser user) { |
| | | Long userId = user.getUserId(); |
| | | // 删除用户与角色关联 |
| | | userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId,userId)); |
| | | userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId)); |
| | | // 新增用户与角色管理 |
| | | insertUserRole(user); |
| | | // 删除用户与岗位关联 |
| | | userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId,userId)); |
| | | userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId, userId)); |
| | | // 新增用户与岗位管理 |
| | | insertUserPost(user); |
| | | return baseMapper.updateById(user); |
| | |
| | | /** |
| | | * 用户授权角色 |
| | | * |
| | | * @param userId 用户ID |
| | | * @param userId 用户ID |
| | | * @param roleIds 角色组 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public void insertUserAuth(Long userId, Long[] roleIds) |
| | | { |
| | | public void insertUserAuth(Long userId, Long[] roleIds) { |
| | | userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>() |
| | | .eq(SysUserRole::getUserId, userId)); |
| | | .eq(SysUserRole::getUserId, userId)); |
| | | insertUserRole(userId, roleIds); |
| | | } |
| | | |
| | |
| | | * 修改用户头像 |
| | | * |
| | | * @param userName 用户名 |
| | | * @param avatar 头像地址 |
| | | * @param avatar 头像地址 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public boolean updateUserAvatar(String userName, String avatar) { |
| | | return baseMapper.update(null, |
| | | new LambdaUpdateWrapper<SysUser>() |
| | | .set(SysUser::getAvatar,avatar) |
| | | .eq(SysUser::getUserName,userName)) > 0; |
| | | .set(SysUser::getAvatar, avatar) |
| | | .eq(SysUser::getUserName, userName)) > 0; |
| | | } |
| | | |
| | | /** |
| | |
| | | public int resetUserPwd(String userName, String password) { |
| | | return baseMapper.update(null, |
| | | new LambdaUpdateWrapper<SysUser>() |
| | | .set(SysUser::getPassword,password) |
| | | .eq(SysUser::getUserName,userName)); |
| | | .set(SysUser::getPassword, password) |
| | | .eq(SysUser::getUserName, userName)); |
| | | } |
| | | |
| | | /** |
| | |
| | | list.add(ur); |
| | | } |
| | | if (list.size() > 0) { |
| | | userRoleMapper.insertAll(list); |
| | | userRoleMapper.insertAll(list); |
| | | } |
| | | } |
| | | } |
| | |
| | | list.add(up); |
| | | } |
| | | if (list.size() > 0) { |
| | | userPostMapper.insertAll(list); |
| | | userPostMapper.insertAll(list); |
| | | } |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 新增用户角色信息 |
| | | * |
| | | * @param userId 用户ID |
| | | * @param userId 用户ID |
| | | * @param roleIds 角色组 |
| | | */ |
| | | public void insertUserRole(Long userId, Long[] roleIds) { |
| | |
| | | @Transactional |
| | | public int deleteUserById(Long userId) { |
| | | // 删除用户与角色关联 |
| | | userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId,userId)); |
| | | userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId)); |
| | | // 删除用户与岗位表 |
| | | userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId,userId)); |
| | | userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId, userId)); |
| | | return baseMapper.deleteById(userId); |
| | | } |
| | | |
| | |
| | | } |
| | | List<Long> ids = Arrays.asList(userIds); |
| | | // 删除用户与角色关联 |
| | | userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getUserId,ids)); |
| | | userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getUserId, ids)); |
| | | // 删除用户与岗位表 |
| | | userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().in(SysUserPost::getUserId,ids)); |
| | | userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().in(SysUserPost::getUserId, ids)); |
| | | return baseMapper.deleteBatchIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * 导入用户数据 |
| | | * |
| | | * @param userList 用户数据列表 |
| | | * @param userList 用户数据列表 |
| | | * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 |
| | | * @param operName 操作用户 |
| | | * @param operName 操作用户 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | |
| | | // 获取请求携带的令牌 |
| | | String token = getToken(request); |
| | | if (StringUtils.isNotEmpty(token)) { |
| | | try { |
| | | Claims claims = parseToken(token); |
| | | // 解析对应的权限以及用户信息 |
| | | String uuid = (String) claims.get(Constants.LOGIN_USER_KEY); |
| | | String userKey = getTokenKey(uuid); |
| | | LoginUser user = RedisUtils.getCacheObject(userKey); |
| | | return user; |
| | | } catch (Exception e) { |
| | | try { |
| | | Claims claims = parseToken(token); |
| | | // 解析对应的权限以及用户信息 |
| | | String uuid = (String) claims.get(Constants.LOGIN_USER_KEY); |
| | | String userKey = getTokenKey(uuid); |
| | | LoginUser user = RedisUtils.getCacheObject(userKey); |
| | | return user; |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |