diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java index 41b82098e..9748a101a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java @@ -1,6 +1,7 @@ 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; @@ -26,13 +27,13 @@ import com.ruoyi.system.service.ISysConfigService; /** * 参数配置 信息操作处理 - * + * * @author ruoyi */ @RestController @RequestMapping("/system/config") -public class SysConfigController extends BaseController -{ +public class SysConfigController extends BaseController { + @Autowired private ISysConfigService configService; @@ -41,8 +42,7 @@ public class SysConfigController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:config:list')") @GetMapping("/list") - public TableDataInfo list(SysConfig config) - { + public TableDataInfo list(SysConfig config) { startPage(); List list = configService.selectConfigList(config); return getDataTable(list); @@ -51,8 +51,7 @@ public class SysConfigController extends BaseController @Log(title = "参数管理", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:config:export')") @GetMapping("/export") - public AjaxResult export(SysConfig config) - { + public AjaxResult export(SysConfig config) { List list = configService.selectConfigList(config); ExcelUtil util = new ExcelUtil(SysConfig.class); return util.exportExcel(list, "参数数据"); @@ -63,8 +62,7 @@ public class SysConfigController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:config:query')") @GetMapping(value = "/{configId}") - public AjaxResult getInfo(@PathVariable Long configId) - { + public AjaxResult getInfo(@PathVariable Long configId) { return AjaxResult.success(configService.selectConfigById(configId)); } @@ -72,8 +70,7 @@ public class SysConfigController extends BaseController * 根据参数键名查询参数值 */ @GetMapping(value = "/configKey/{configKey}") - public AjaxResult getConfigKey(@PathVariable String configKey) - { + public AjaxResult getConfigKey(@PathVariable String configKey) { return AjaxResult.success(configService.selectConfigByKey(configKey)); } @@ -84,10 +81,8 @@ public class SysConfigController extends BaseController @Log(title = "参数管理", businessType = BusinessType.INSERT) @PostMapping @RepeatSubmit - public AjaxResult add(@Validated @RequestBody SysConfig config) - { - if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) - { + public AjaxResult add(@Validated @RequestBody SysConfig config) { + if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) { return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); } config.setCreateBy(SecurityUtils.getUsername()); @@ -100,10 +95,8 @@ public class SysConfigController extends BaseController @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 edit(@Validated @RequestBody SysConfig config) { + if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) { return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); } config.setUpdateBy(SecurityUtils.getUsername()); @@ -116,20 +109,8 @@ public class SysConfigController extends BaseController @PreAuthorize("@ss.hasPermi('system:config:remove')") @Log(title = "参数管理", businessType = BusinessType.DELETE) @DeleteMapping("/{configIds}") - public AjaxResult remove(@PathVariable Long[] configIds) - { + public AjaxResult remove(@PathVariable Long[] configIds) { return toAjax(configService.deleteConfigByIds(configIds)); } - /** - * 清空缓存 - */ - @PreAuthorize("@ss.hasPermi('system:config:remove')") - @Log(title = "参数管理", businessType = BusinessType.CLEAN) - @DeleteMapping("/clearCache") - public AjaxResult clearCache() - { - configService.clearCache(); - return AjaxResult.success(); - } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java deleted file mode 100644 index da7ae199e..000000000 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ruoyi.system.domain; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.annotation.Excel.ColumnType; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * 参数配置表 sys_config - * - * @author ruoyi - */ -public class SysConfig extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 参数主键 */ - @Excel(name = "参数主键", cellType = ColumnType.NUMERIC) - private Long configId; - - /** 参数名称 */ - @Excel(name = "参数名称") - private String configName; - - /** 参数键名 */ - @Excel(name = "参数键名") - private String configKey; - - /** 参数键值 */ - @Excel(name = "参数键值") - private String configValue; - - /** 系统内置(Y是 N否) */ - @Excel(name = "系统内置", readConverterExp = "Y=是,N=否") - private String configType; - - @NotBlank(message = "参数名称不能为空") - @Size(min = 0, max = 100, message = "参数名称不能超过100个字符") - public String getConfigName() - { - return configName; - } - - @NotBlank(message = "参数键名长度不能为空") - @Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符") - public String getConfigKey() - { - return configKey; - } - - @NotBlank(message = "参数键值不能为空") - @Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符") - public String getConfigValue() - { - return configValue; - } - -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java deleted file mode 100644 index a937e8308..000000000 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ruoyi.system.service; - -import java.util.List; -import com.ruoyi.system.domain.SysConfig; - -/** - * 参数配置 服务层 - * - * @author ruoyi - */ -public interface ISysConfigService -{ - /** - * 查询参数配置信息 - * - * @param configId 参数配置ID - * @return 参数配置信息 - */ - public SysConfig selectConfigById(Long configId); - - /** - * 根据键名查询参数配置信息 - * - * @param configKey 参数键名 - * @return 参数键值 - */ - public String selectConfigByKey(String configKey); - - /** - * 查询参数配置列表 - * - * @param config 参数配置信息 - * @return 参数配置集合 - */ - public List selectConfigList(SysConfig config); - - /** - * 新增参数配置 - * - * @param config 参数配置信息 - * @return 结果 - */ - public int insertConfig(SysConfig config); - - /** - * 修改参数配置 - * - * @param config 参数配置信息 - * @return 结果 - */ - public int updateConfig(SysConfig config); - - /** - * 批量删除参数信息 - * - * @param configIds 需要删除的参数ID - * @return 结果 - */ - public int deleteConfigByIds(Long[] configIds); - - /** - * 清空缓存数据 - */ - public void clearCache(); - - /** - * 校验参数键名是否唯一 - * - * @param config 参数信息 - * @return 结果 - */ - public String checkConfigKeyUnique(SysConfig config); -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java deleted file mode 100644 index f77aaa7e1..000000000 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ruoyi.system.service; - -import java.util.List; -import com.ruoyi.system.domain.SysLogininfor; - -/** - * 系统访问日志情况信息 服务层 - * - * @author ruoyi - */ -public interface ISysLogininforService -{ - /** - * 新增系统登录日志 - * - * @param logininfor 访问日志对象 - */ - public void insertLogininfor(SysLogininfor logininfor); - - /** - * 查询系统登录日志集合 - * - * @param logininfor 访问日志对象 - * @return 登录记录集合 - */ - public List selectLogininforList(SysLogininfor logininfor); - - /** - * 批量删除系统登录日志 - * - * @param infoIds 需要删除的登录日志ID - * @return - */ - public int deleteLogininforByIds(Long[] infoIds); - - /** - * 清空系统登录日志 - */ - public void cleanLogininfor(); -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java deleted file mode 100644 index 3bb99530c..000000000 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ruoyi.system.service.impl; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.system.domain.SysLogininfor; -import com.ruoyi.system.mapper.SysLogininforMapper; -import com.ruoyi.system.service.ISysLogininforService; - -/** - * 系统访问日志情况信息 服务层处理 - * - * @author ruoyi - */ -@Service -public class SysLogininforServiceImpl implements ISysLogininforService { - - @Autowired - private SysLogininforMapper logininforMapper; - - /** - * 新增系统登录日志 - * - * @param logininfor 访问日志对象 - */ - @Override - public void insertLogininfor(SysLogininfor logininfor) { - logininforMapper.insertLogininfor(logininfor); - } - - /** - * 查询系统登录日志集合 - * - * @param logininfor 访问日志对象 - * @return 登录记录集合 - */ - @Override - public List selectLogininforList(SysLogininfor logininfor) { - return logininforMapper.selectLogininforList(logininfor); - } - - /** - * 批量删除系统登录日志 - * - * @param infoIds 需要删除的登录日志ID - * @return - */ - @Override - public int deleteLogininforByIds(Long[] infoIds) { - return logininforMapper.deleteLogininforByIds(infoIds); - } - - /** - * 清空系统登录日志 - */ - @Override - public void cleanLogininfor() { - logininforMapper.cleanLogininfor(); - } -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java deleted file mode 100644 index 939e8d9ef..000000000 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ruoyi.system.service.impl; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.system.domain.SysOperLog; -import com.ruoyi.system.mapper.SysOperLogMapper; -import com.ruoyi.system.service.ISysOperLogService; - -/** - * 操作日志 服务层处理 - * - * @author ruoyi - */ -@Service -public class SysOperLogServiceImpl implements ISysOperLogService { - @Autowired - private SysOperLogMapper operLogMapper; - - /** - * 新增操作日志 - * - * @param operLog 操作日志对象 - */ - @Override - public void insertOperlog(SysOperLog operLog) { - operLogMapper.insertOperlog(operLog); - } - - /** - * 查询系统操作日志集合 - * - * @param operLog 操作日志对象 - * @return 操作日志集合 - */ - @Override - public List selectOperLogList(SysOperLog operLog) { - return operLogMapper.selectOperLogList(operLog); - } - - - /** - * 查询操作日志详细 - * - * @param operId 操作ID - * @return 操作日志对象 - */ - @Override - public SysOperLog selectOperLogById(Long operId) { - return operLogMapper.selectOperLogById(operId); - } - -} diff --git a/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml deleted file mode 100644 index b1570e289..000000000 --- a/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark - from sys_config - - - - - - - and config_id = #{configId} - - - and config_key = #{configKey} - - - - - - - - - - - - insert into sys_config ( - config_name, - config_key, - config_value, - config_type, - create_by, - remark, - create_time - )values( - #{configName}, - #{configKey}, - #{configValue}, - #{configType}, - #{createBy}, - #{remark}, - sysdate() - ) - - - - update sys_config - - config_name = #{configName}, - config_key = #{configKey}, - config_value = #{configValue}, - config_type = #{configType}, - update_by = #{updateBy}, - remark = #{remark}, - update_time = sysdate() - - where config_id = #{configId} - - - - delete from sys_config where config_id = #{configId} - - - - delete from sys_config where config_id in - - #{configId} - - - - \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml deleted file mode 100644 index 26d51fa39..000000000 --- a/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - insert into sys_logininfor (user_name, status, ipaddr, login_location, browser, os, msg, login_time) - values (#{userName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, sysdate()) - - - - - - delete from sys_logininfor where info_id in - - #{infoId} - - - - - truncate table sys_logininfor - - - \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml deleted file mode 100644 index 1d9e492d2..000000000 --- a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - diff --git a/src/main/java/cn/iocoder/dashboard/framework/excel/core/annotations/DictFormat.java b/src/main/java/cn/iocoder/dashboard/framework/excel/core/annotations/DictFormat.java index ae3144016..8eefcafaf 100644 --- a/src/main/java/cn/iocoder/dashboard/framework/excel/core/annotations/DictFormat.java +++ b/src/main/java/cn/iocoder/dashboard/framework/excel/core/annotations/DictFormat.java @@ -1,6 +1,6 @@ package cn.iocoder.dashboard.framework.excel.core.annotations; -import cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum; +import cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum; import java.lang.annotation.*; @@ -14,6 +14,6 @@ import java.lang.annotation.*; @Inherited public @interface DictFormat { - DictTypeEnum value(); + SysDictTypeEnum value(); } diff --git a/src/main/java/cn/iocoder/dashboard/framework/excel/core/convert/DictConvert.java b/src/main/java/cn/iocoder/dashboard/framework/excel/core/convert/DictConvert.java index f52ddca29..0d7baf115 100644 --- a/src/main/java/cn/iocoder/dashboard/framework/excel/core/convert/DictConvert.java +++ b/src/main/java/cn/iocoder/dashboard/framework/excel/core/convert/DictConvert.java @@ -5,7 +5,7 @@ import cn.hutool.core.convert.Convert; import cn.iocoder.dashboard.framework.dict.core.util.DictUtils; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictDataDO; -import cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum; +import cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum; import com.alibaba.excel.converters.Converter; import com.alibaba.excel.enums.CellDataTypeEnum; import com.alibaba.excel.metadata.CellData; @@ -30,7 +30,7 @@ public class DictConvert implements Converter { public Object convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) { // 使用字典解析 - DictTypeEnum type = getType(contentProperty); + SysDictTypeEnum type = getType(contentProperty); String label = cellData.getStringValue(); SysDictDataDO dictData = DictUtils.parseDictDataFromCache(type.getValue(), label); if (dictData == null) { @@ -46,7 +46,7 @@ public class DictConvert implements Converter { public CellData convertToExcelData(Object object, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) { // 使用字典格式化 - DictTypeEnum type = getType(contentProperty); + SysDictTypeEnum type = getType(contentProperty); String value = String.valueOf(object); SysDictDataDO dictData = DictUtils.getDictDataFromCache(type.getValue(), value); if (dictData == null) { @@ -57,7 +57,7 @@ public class DictConvert implements Converter { return new CellData<>(dictData.getLabel()); } - private static DictTypeEnum getType(ExcelContentProperty contentProperty) { + private static SysDictTypeEnum getType(ExcelContentProperty contentProperty) { return contentProperty.getField().getAnnotation(DictFormat.class).value(); } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/SysConfigController.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/SysConfigController.java new file mode 100644 index 000000000..fcdfc58d8 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/SysConfigController.java @@ -0,0 +1,27 @@ +package cn.iocoder.dashboard.modules.system.controller.config; + +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "参数配置") +@RestController +@RequestMapping("/system/config") +public class SysConfigController { + +// private SpringValueRegistry +// +// @Value("demo.test") +// private String demo; +// +// @GetMapping("/demo") +// public String demo() { +// return demo; +// } +// +// @PostMapping("/demo") +// public void setDemo() { +// +// } + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/vo/SysConfigBaseVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/vo/SysConfigBaseVO.java new file mode 100644 index 000000000..86c88b524 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/vo/SysConfigBaseVO.java @@ -0,0 +1,42 @@ +package cn.iocoder.dashboard.modules.system.controller.config.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; + +/** + * 参数配置 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class SysConfigBaseVO { + + @ApiModelProperty(value = "参数分组", required = true, example = "biz") + @NotEmpty(message = "参数分组不能为空") + @Size(max = 100, message = "参数名称不能超过50个字符") + private String group; + + @ApiModelProperty(value = "参数名称", required = true, example = "数据库名") + @NotBlank(message = "参数名称不能为空") + @Size(max = 100, message = "参数名称不能超过100个字符") + private String name; + + @ApiModelProperty(value = "参数键值", required = true, example = "1024") + @NotBlank(message = "参数键值不能为空") + @Size(max = 500, message = "参数键值长度不能超过500个字符") + private String value; + + @ApiModelProperty(value = "参数类型", required = true, example = "1", notes = "参见 SysConfigTypeEnum 枚举") + private String type; + + @ApiModelProperty(value = "是否敏感", required = true, example = "true") + @NotBlank(message = "是否敏感不能为空") + private Boolean sensitive; + + @ApiModelProperty(value = "备注", example = "备注一下很帅气!") + private String remark; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/vo/SysConfigCreateReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/vo/SysConfigCreateReqVO.java new file mode 100644 index 000000000..bf1b3246c --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/vo/SysConfigCreateReqVO.java @@ -0,0 +1,22 @@ +package cn.iocoder.dashboard.modules.system.controller.config.vo; + +import cn.iocoder.dashboard.modules.system.controller.dept.vo.dept.SysDeptBaseVO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + +@ApiModel("参数配置创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +public class SysConfigCreateReqVO extends SysDeptBaseVO { + + @ApiModelProperty(value = "参数键名", required = true, example = "yunai.db.username") + @NotBlank(message = "参数键名长度不能为空") + @Size(max = 100, message = "参数键名长度不能超过100个字符") + private String key; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/vo/SysConfigExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/vo/SysConfigExcelVO.java new file mode 100644 index 000000000..436008b54 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/vo/SysConfigExcelVO.java @@ -0,0 +1,41 @@ +package cn.iocoder.dashboard.modules.system.controller.config.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * 参数配置 Excel 导出响应 VO + */ +@Data +public class SysConfigExcelVO { + + @ExcelProperty("参数配置序号") + private Long id; + + @ExcelProperty("参数键名") + private String key; + + @ExcelProperty("参数分组") + private String group; + + @ExcelProperty("参数名称") + private String name; + + @ExcelProperty("参数键值") + private String value; + + @ExcelProperty("参数类型") + private String type; + + @ExcelProperty("是否敏感") + private Boolean sensitive; + + @ExcelProperty("备注") + private String remark; + + @ExcelProperty("创建时间") + private Date createTime; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/vo/SysConfigRespVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/vo/SysConfigRespVO.java new file mode 100644 index 000000000..6e563599a --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/vo/SysConfigRespVO.java @@ -0,0 +1,28 @@ +package cn.iocoder.dashboard.modules.system.controller.config.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.util.Date; + +@ApiModel("参数配置信息 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +public class SysConfigRespVO extends SysConfigBaseVO { + + @ApiModelProperty(value = "参数配置序号", required = true, example = "1024") + private Long id; + + @ApiModelProperty(value = "参数键名", required = true, example = "yunai.db.username") + @NotBlank(message = "参数键名长度不能为空") + @Size(max = 100, message = "参数键名长度不能超过100个字符") + private String key; + + @ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式") + private Date createTime; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/vo/SysConfigUpdateReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/vo/SysConfigUpdateReqVO.java new file mode 100644 index 000000000..d7fe37812 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/config/vo/SysConfigUpdateReqVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.dashboard.modules.system.controller.config.vo; + +import cn.iocoder.dashboard.modules.system.controller.dept.vo.dept.SysDeptBaseVO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotNull; + +@ApiModel("参数配置创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +public class SysConfigUpdateReqVO extends SysDeptBaseVO { + + @ApiModelProperty(value = "参数配置序号", required = true, example = "1024") + @NotNull(message = "参数配置编号不能为空") + private Long id; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/vo/post/SysPostExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/vo/post/SysPostExcelVO.java index 7ebbd9f93..05ac0e962 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/vo/post/SysPostExcelVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/vo/post/SysPostExcelVO.java @@ -1,8 +1,12 @@ package cn.iocoder.dashboard.modules.system.controller.dept.vo.post; +import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; +import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; +import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.SYS_COMMON_STATUS; + /** * 岗位 Excel 导出响应 VO */ @@ -21,9 +25,8 @@ public class SysPostExcelVO { @ExcelProperty("岗位排序") private String sort; -// @ExcelProperty(value = "状态", converter = DictConvert.class) -// @DictFormat(SYS_COMMON_STATUS) - @ExcelProperty(value = "状态") + @ExcelProperty(value = "状态", converter = DictConvert.class) + @DictFormat(SYS_COMMON_STATUS) private String status; } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExcelVO.java index 50f5c5956..3266d39cf 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExcelVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExcelVO.java @@ -5,7 +5,7 @@ import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; -import static cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum.SYS_COMMON_STATUS; +import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.SYS_COMMON_STATUS; /** * 字典数据 Excel 导出响应 VO diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExcelVO.java index 15922759f..b8a9d3d4e 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExcelVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExcelVO.java @@ -5,7 +5,7 @@ import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; -import static cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum.SYS_COMMON_STATUS; +import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.SYS_COMMON_STATUS; /** * 字典类型 Excel 导出响应 VO diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysLoginLogController.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysLoginLogController.java index 88638b64e..8fabe194a 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysLoginLogController.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysLoginLogController.java @@ -2,6 +2,9 @@ package cn.iocoder.dashboard.modules.system.controller.logger; import cn.iocoder.dashboard.common.pojo.CommonResult; import cn.iocoder.dashboard.common.pojo.PageResult; +import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExcelVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO; import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogPageReqVO; import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogRespVO; import cn.iocoder.dashboard.modules.system.convert.logger.SysLoginLogConvert; @@ -15,6 +18,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; @Api(tags = "登陆日志 API") @RestController @@ -32,13 +38,17 @@ public class SysLoginLogController { return CommonResult.success(SysLoginLogConvert.INSTANCE.convertPage(page)); } -// @GetMapping("/export") -//// @Log(title = "登录日志", businessType = BusinessType.EXPORT) -//// @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") -// public void exportLoginLog(SysLogininfor logininfor) { -// List list = logininforService.selectLogininforList(logininfor); -// ExcelUtil util = new ExcelUtil(SysLogininfor.class); -// return util.exportExcel(list, "登录日志"); -// } + @ApiOperation("导出登陆日志 Excel") + @GetMapping("/export") +// @Log(title = "登录日志", businessType = BusinessType.EXPORT) +// @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") + public void exportLoginLog(HttpServletResponse response, @Validated SysLoginLogExportReqVO reqVO) throws IOException { + List list = loginLogService.getLoginLogList(reqVO); + // 拼接数据 + List excelDataList = SysLoginLogConvert.INSTANCE.convertList(list); + // 输出 + ExcelUtils.write(response, "登陆日志.xls", "数据列表", + SysLoginLogExcelVO.class, excelDataList); + } } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogExcelVO.java index c88b57632..225f91b1f 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogExcelVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogExcelVO.java @@ -2,7 +2,7 @@ package cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; -import cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum; +import cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -17,14 +17,11 @@ public class SysLoginLogExcelVO { @ExcelProperty("日志主键") private Long id; - @ExcelProperty("用户编号") - private Long userId; - @ExcelProperty("用户账号") private String username; @ExcelProperty(value = "登陆结果", converter = DictConvert.class) - @DictFormat(DictTypeEnum.SYS_LOGIN_RESULT) + @DictFormat(SysDictTypeEnum.SYS_LOGIN_RESULT) private Integer result; @ExcelProperty("登陆 IP") diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogExportReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogExportReqVO.java new file mode 100644 index 000000000..478175fbb --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogExportReqVO.java @@ -0,0 +1,33 @@ +package cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@ApiModel("登陆日志分页列表 Request VO") +@Data +public class SysLoginLogExportReqVO { + + @ApiModelProperty(value = "用户 IP", example = "127.0.0.1", notes = "模拟匹配") + private String userIp; + + @ApiModelProperty(value = "用户账号", example = "芋道", notes = "模拟匹配") + private String username; + + @ApiModelProperty(value = "操作状态", example = "true") + private Boolean status; + + @ApiModelProperty(value = "开始时间", example = "2020-10-24") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private Date beginTime; + + @ApiModelProperty(value = "结束时间", example = "2020-10-24") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private Date endTime; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogExcelVO.java index 46c4722cf..475d31338 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogExcelVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogExcelVO.java @@ -2,7 +2,7 @@ package cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; -import cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum; +import cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -24,7 +24,7 @@ public class SysOperateLogExcelVO { private String name; @ExcelProperty(value = "操作类型", converter = DictConvert.class) - @DictFormat(DictTypeEnum.SYS_OPERATE_TYPE) + @DictFormat(SysDictTypeEnum.SYS_OPERATE_TYPE) private String type; @ExcelProperty("操作人") diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogPageReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogPageReqVO.java index d4b36a350..b5b05e7fe 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogPageReqVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogPageReqVO.java @@ -4,7 +4,6 @@ import cn.iocoder.dashboard.common.pojo.PageParam; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.EqualsAndHashCode; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @@ -13,7 +12,6 @@ import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOU @ApiModel("操作日志分页列表 Request VO") @Data -@EqualsAndHashCode(callSuper = true) public class SysOperateLogPageReqVO extends PageParam { @ApiModelProperty(value = "操作模块", example = "订单", notes = "模拟匹配") diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/role/SysRoleExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/role/SysRoleExcelVO.java index 3b4473d77..44d92a156 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/role/SysRoleExcelVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/role/SysRoleExcelVO.java @@ -2,7 +2,7 @@ package cn.iocoder.dashboard.modules.system.controller.permission.vo.role; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; -import cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum; +import cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -28,7 +28,7 @@ public class SysRoleExcelVO { private Integer dataScope; @ExcelProperty(value = "角色状态", converter = DictConvert.class) - @DictFormat(DictTypeEnum.SYS_COMMON_STATUS) + @DictFormat(SysDictTypeEnum.SYS_COMMON_STATUS) private String status; } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/vo/user/SysUserExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/vo/user/SysUserExcelVO.java index 149fb175c..37253ac4a 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/vo/user/SysUserExcelVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/vo/user/SysUserExcelVO.java @@ -7,8 +7,8 @@ import lombok.Data; import java.util.Date; -import static cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum.SYS_COMMON_STATUS; -import static cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum.SYS_USER_SEX; +import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.SYS_COMMON_STATUS; +import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.SYS_USER_SEX; /** * 用户 Excel 导出 VO diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/vo/user/SysUserImportExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/vo/user/SysUserImportExcelVO.java index d03ad0ed6..b50b8942d 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/vo/user/SysUserImportExcelVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/vo/user/SysUserImportExcelVO.java @@ -2,7 +2,7 @@ package cn.iocoder.dashboard.modules.system.controller.user.vo.user; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; -import cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum; +import cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum; import com.alibaba.excel.annotation.ExcelProperty; import lombok.AllArgsConstructor; import lombok.Builder; @@ -34,11 +34,11 @@ public class SysUserImportExcelVO { private String mobile; @ExcelProperty(value = "用户性别", converter = DictConvert.class) - @DictFormat(DictTypeEnum.SYS_USER_SEX) + @DictFormat(SysDictTypeEnum.SYS_USER_SEX) private Integer sex; @ExcelProperty(value = "账号状态", converter = DictConvert.class) - @DictFormat(DictTypeEnum.SYS_COMMON_STATUS) + @DictFormat(SysDictTypeEnum.SYS_COMMON_STATUS) private Integer status; } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/convert/logger/SysLoginLogConvert.java b/src/main/java/cn/iocoder/dashboard/modules/system/convert/logger/SysLoginLogConvert.java index 71a7e5093..fd20a13e5 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/convert/logger/SysLoginLogConvert.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/convert/logger/SysLoginLogConvert.java @@ -2,11 +2,14 @@ package cn.iocoder.dashboard.modules.system.convert.logger; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogCreateReqVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExcelVO; import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogRespVO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.logger.SysLoginLogDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; +import java.util.List; + @Mapper public interface SysLoginLogConvert { @@ -16,4 +19,6 @@ public interface SysLoginLogConvert { PageResult convertPage(PageResult page); + List convertList(List list); + } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/logger/SysLoginLogMapper.java b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/logger/SysLoginLogMapper.java index 8d7b0a944..e774df3a7 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/logger/SysLoginLogMapper.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/logger/SysLoginLogMapper.java @@ -3,11 +3,14 @@ package cn.iocoder.dashboard.modules.system.dal.mysql.dao.logger; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO; import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogPageReqVO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.logger.SysLoginLogDO; import cn.iocoder.dashboard.modules.system.enums.logger.SysLoginResultEnum; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + @Mapper public interface SysLoginLogMapper extends BaseMapperX { @@ -25,4 +28,18 @@ public interface SysLoginLogMapper extends BaseMapperX { return selectPage(reqVO, query); } + default List selectList(SysLoginLogExportReqVO reqVO) { + QueryWrapperX query = new QueryWrapperX() + .likeIfPresent("user_ip", reqVO.getUserIp()) + .likeIfPresent("username", reqVO.getUsername()) + .betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime()); + if (Boolean.TRUE.equals(reqVO.getStatus())) { + query.eq("result", SysLoginResultEnum.SUCCESS.getResult()); + } else if (Boolean.FALSE.equals(reqVO.getStatus())) { + query.gt("result", SysLoginResultEnum.SUCCESS.getResult()); + } + query.orderByDesc("id"); // 降序 + return selectList(query); + } + } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dataobject/config/SysConfigDO.java b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dataobject/config/SysConfigDO.java new file mode 100644 index 000000000..218950f2d --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dataobject/config/SysConfigDO.java @@ -0,0 +1,52 @@ +package cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.config; + +import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.dashboard.modules.system.enums.config.SysConfigTypeEnum; +import com.baomidou.mybatisplus.annotation.TableName; + +/** + * 参数配置表 + * + * @author ruoyi + */ +@TableName("sys_config") +public class SysConfigDO extends BaseDO { + + /** + * 参数主键 + */ + private Long id; + /** + * 参数分组 + */ + private String group; + /** + * 参数名称 + */ + private String name; + /** + * 参数键名 + */ + private String key; + /** + * 参数键值 + */ + private String value; + /** + * 参数类型 + * + * 枚举 {@link SysConfigTypeEnum} + */ + private String type; + /** + * 是否敏感 + * + * 对于敏感配置,需要管理权限才能查看 + */ + private Boolean sensitive; + /** + * 备注 + */ + private String remark; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dataobject/permission/SysRoleDO.java b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dataobject/permission/SysRoleDO.java index 7e8c375c0..4354813dd 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dataobject/permission/SysRoleDO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dataobject/permission/SysRoleDO.java @@ -4,7 +4,7 @@ import cn.iocoder.dashboard.common.enums.CommonStatusEnum; import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.dashboard.framework.security.core.enums.DataScopeEnum; import cn.iocoder.dashboard.modules.system.enums.permission.RoleCodeEnum; -import cn.iocoder.dashboard.modules.system.enums.permission.RoleTypeEnum; +import cn.iocoder.dashboard.modules.system.enums.permission.SysRoleTypeEnum; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -52,7 +52,7 @@ public class SysRoleDO extends BaseDO { /** * 角色类型 * - * 枚举 {@link RoleTypeEnum} + * 枚举 {@link SysRoleTypeEnum} */ private Integer type; /** diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/enums/config/SysConfigTypeEnum.java b/src/main/java/cn/iocoder/dashboard/modules/system/enums/config/SysConfigTypeEnum.java new file mode 100644 index 000000000..ef3a51b5e --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/enums/config/SysConfigTypeEnum.java @@ -0,0 +1,21 @@ +package cn.iocoder.dashboard.modules.system.enums.config; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum SysConfigTypeEnum { + + /** + * 系统配置 + */ + SYSTEM(1), + /** + * 自定义配置 + */ + CUSTOM(2); + + private final Integer type; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/enums/dict/DictTypeEnum.java b/src/main/java/cn/iocoder/dashboard/modules/system/enums/dict/SysDictTypeEnum.java similarity index 94% rename from src/main/java/cn/iocoder/dashboard/modules/system/enums/dict/DictTypeEnum.java rename to src/main/java/cn/iocoder/dashboard/modules/system/enums/dict/SysDictTypeEnum.java index 44c62ede0..d11dbd0ba 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/enums/dict/DictTypeEnum.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/enums/dict/SysDictTypeEnum.java @@ -8,7 +8,7 @@ import lombok.Getter; */ @Getter @AllArgsConstructor -public enum DictTypeEnum { +public enum SysDictTypeEnum { SYS_USER_SEX("sys_user_sex"), // 用户性别 SYS_COMMON_STATUS("sys_common_status"), // 系统状态 diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/enums/permission/RoleTypeEnum.java b/src/main/java/cn/iocoder/dashboard/modules/system/enums/permission/SysRoleTypeEnum.java similarity index 90% rename from src/main/java/cn/iocoder/dashboard/modules/system/enums/permission/RoleTypeEnum.java rename to src/main/java/cn/iocoder/dashboard/modules/system/enums/permission/SysRoleTypeEnum.java index 9c65483e5..2a33e2653 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/enums/permission/RoleTypeEnum.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/enums/permission/SysRoleTypeEnum.java @@ -5,7 +5,7 @@ import lombok.Getter; @Getter @AllArgsConstructor -public enum RoleTypeEnum { +public enum SysRoleTypeEnum { /** * 内置角色 diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/SysLoginLogService.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/SysLoginLogService.java index d6c67569f..757453794 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/SysLoginLogService.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/SysLoginLogService.java @@ -2,9 +2,12 @@ package cn.iocoder.dashboard.modules.system.service.logger; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogCreateReqVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO; import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogPageReqVO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.logger.SysLoginLogDO; +import java.util.List; + /** * 登陆日志 Service 接口 */ @@ -25,4 +28,12 @@ public interface SysLoginLogService { */ PageResult getLoginLogPage(SysLoginLogPageReqVO reqVO); + /** + * 获得登陆日志列表 + * + * @param reqVO 列表条件 + * @return 登陆日志列表 + */ + List getLoginLogList(SysLoginLogExportReqVO reqVO); + } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/impl/SysLoginLogServiceImpl.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/impl/SysLoginLogServiceImpl.java index 9f55354d1..1c796c07a 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/impl/SysLoginLogServiceImpl.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/impl/SysLoginLogServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogCreateReqVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO; import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogPageReqVO; import cn.iocoder.dashboard.modules.system.convert.logger.SysLoginLogConvert; import cn.iocoder.dashboard.modules.system.dal.mysql.dao.logger.SysLoginLogMapper; @@ -15,6 +16,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Collection; +import java.util.List; import static cn.iocoder.dashboard.util.collection.CollectionUtils.convertSet; @@ -41,4 +43,9 @@ public class SysLoginLogServiceImpl implements SysLoginLogService { return loginLogMapper.selectPage(reqVO); } + @Override + public List getLoginLogList(SysLoginLogExportReqVO reqVO) { + return loginLogMapper.selectList(reqVO); + } + } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/permission/impl/SysRoleServiceImpl.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/permission/impl/SysRoleServiceImpl.java index f332d56fa..1aa05485a 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/permission/impl/SysRoleServiceImpl.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/permission/impl/SysRoleServiceImpl.java @@ -12,7 +12,7 @@ import cn.iocoder.dashboard.modules.system.convert.permission.SysRoleConvert; import cn.iocoder.dashboard.modules.system.dal.mysql.dao.permission.SysRoleMapper; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysRoleDO; import cn.iocoder.dashboard.modules.system.enums.permission.RoleCodeEnum; -import cn.iocoder.dashboard.modules.system.enums.permission.RoleTypeEnum; +import cn.iocoder.dashboard.modules.system.enums.permission.SysRoleTypeEnum; import cn.iocoder.dashboard.modules.system.service.permission.SysPermissionService; import cn.iocoder.dashboard.modules.system.service.permission.SysRoleService; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -101,7 +101,7 @@ public class SysRoleServiceImpl implements SysRoleService { checkDuplicateRole(reqVO.getName(), reqVO.getCode(), null); // 插入到数据库 SysRoleDO role = SysRoleConvert.INSTANCE.convert(reqVO); - role.setType(RoleTypeEnum.CUSTOM.getType()); + role.setType(SysRoleTypeEnum.CUSTOM.getType()); role.setStatus(CommonStatusEnum.ENABLE.getStatus()); roleMapper.insert(role); // 返回 @@ -207,7 +207,7 @@ public class SysRoleServiceImpl implements SysRoleService { throw ServiceExceptionUtil.exception(ROLE_NOT_EXISTS); } // 内置角色,不允许删除 - if (RoleTypeEnum.SYSTEM.getType().equals(roleDO.getType())) { + if (SysRoleTypeEnum.SYSTEM.getType().equals(roleDO.getType())) { throw ServiceExceptionUtil.exception(ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE); } }