迁移登陆日志完成

开始迁移参数配置
pull/2/head
YunaiV 2021-01-19 00:45:26 +08:00
parent c95f540201
commit 35a01cbf29
38 changed files with 389 additions and 571 deletions

View File

@ -1,6 +1,7 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -26,13 +27,13 @@ import com.ruoyi.system.service.ISysConfigService;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@RequestMapping("/system/config") @RequestMapping("/system/config")
public class SysConfigController extends BaseController public class SysConfigController extends BaseController {
{
@Autowired @Autowired
private ISysConfigService configService; private ISysConfigService configService;
@ -41,8 +42,7 @@ public class SysConfigController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:config:list')") @PreAuthorize("@ss.hasPermi('system:config:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysConfig config) public TableDataInfo list(SysConfig config) {
{
startPage(); startPage();
List<SysConfig> list = configService.selectConfigList(config); List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list); return getDataTable(list);
@ -51,8 +51,7 @@ public class SysConfigController extends BaseController
@Log(title = "参数管理", businessType = BusinessType.EXPORT) @Log(title = "参数管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:config:export')") @PreAuthorize("@ss.hasPermi('system:config:export')")
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysConfig config) public AjaxResult export(SysConfig config) {
{
List<SysConfig> list = configService.selectConfigList(config); List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
return util.exportExcel(list, "参数数据"); return util.exportExcel(list, "参数数据");
@ -63,8 +62,7 @@ public class SysConfigController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:config:query')") @PreAuthorize("@ss.hasPermi('system:config:query')")
@GetMapping(value = "/{configId}") @GetMapping(value = "/{configId}")
public AjaxResult getInfo(@PathVariable Long configId) public AjaxResult getInfo(@PathVariable Long configId) {
{
return AjaxResult.success(configService.selectConfigById(configId)); return AjaxResult.success(configService.selectConfigById(configId));
} }
@ -72,8 +70,7 @@ public class SysConfigController extends BaseController
* *
*/ */
@GetMapping(value = "/configKey/{configKey}") @GetMapping(value = "/configKey/{configKey}")
public AjaxResult getConfigKey(@PathVariable String configKey) public AjaxResult getConfigKey(@PathVariable String configKey) {
{
return AjaxResult.success(configService.selectConfigByKey(configKey)); return AjaxResult.success(configService.selectConfigByKey(configKey));
} }
@ -84,10 +81,8 @@ public class SysConfigController extends BaseController
@Log(title = "参数管理", businessType = BusinessType.INSERT) @Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
@RepeatSubmit @RepeatSubmit
public AjaxResult add(@Validated @RequestBody SysConfig config) public AjaxResult add(@Validated @RequestBody SysConfig config) {
{ if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
{
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
} }
config.setCreateBy(SecurityUtils.getUsername()); config.setCreateBy(SecurityUtils.getUsername());
@ -100,10 +95,8 @@ public class SysConfigController extends BaseController
@PreAuthorize("@ss.hasPermi('system:config:edit')") @PreAuthorize("@ss.hasPermi('system:config:edit')")
@Log(title = "参数管理", businessType = BusinessType.UPDATE) @Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody SysConfig config) public AjaxResult edit(@Validated @RequestBody SysConfig config) {
{ if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
{
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
} }
config.setUpdateBy(SecurityUtils.getUsername()); config.setUpdateBy(SecurityUtils.getUsername());
@ -116,20 +109,8 @@ public class SysConfigController extends BaseController
@PreAuthorize("@ss.hasPermi('system:config:remove')") @PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.DELETE) @Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}") @DeleteMapping("/{configIds}")
public AjaxResult remove(@PathVariable Long[] configIds) public AjaxResult remove(@PathVariable Long[] configIds) {
{
return toAjax(configService.deleteConfigByIds(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();
}
} }

View File

@ -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;
}
}

View File

@ -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<SysConfig> 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);
}

View File

@ -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<SysLogininfor> selectLogininforList(SysLogininfor logininfor);
/**
*
*
* @param infoIds ID
* @return
*/
public int deleteLogininforByIds(Long[] infoIds);
/**
*
*/
public void cleanLogininfor();
}

View File

@ -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<SysLogininfor> 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();
}
}

View File

@ -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<SysOperLog> selectOperLogList(SysOperLog operLog) {
return operLogMapper.selectOperLogList(operLog);
}
/**
*
*
* @param operId ID
* @return
*/
@Override
public SysOperLog selectOperLogById(Long operId) {
return operLogMapper.selectOperLogById(operId);
}
}

View File

@ -1,112 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysConfigMapper">
<resultMap type="SysConfig" id="SysConfigResult">
<id property="configId" column="config_id" />
<result property="configName" column="config_name" />
<result property="configKey" column="config_key" />
<result property="configValue" column="config_value" />
<result property="configType" column="config_type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectConfigVo">
select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark
from sys_config
</sql>
<!-- 查询条件 -->
<sql id="sqlwhereSearch">
<where>
<if test="configId !=null">
and config_id = #{configId}
</if>
<if test="configKey !=null and configKey != ''">
and config_key = #{configKey}
</if>
</where>
</sql>
<select id="selectConfig" parameterType="SysConfig" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
<include refid="sqlwhereSearch"/>
</select>
<select id="selectConfigList" parameterType="SysConfig" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
<where>
<if test="configName != null and configName != ''">
AND config_name like concat('%', #{configName}, '%')
</if>
<if test="configType != null and configType != ''">
AND config_type = #{configType}
</if>
<if test="configKey != null and configKey != ''">
AND config_key like concat('%', #{configKey}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
</select>
<select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
where config_key = #{configKey} limit 1
</select>
<insert id="insertConfig" parameterType="SysConfig">
insert into sys_config (
<if test="configName != null and configName != '' ">config_name,</if>
<if test="configKey != null and configKey != '' ">config_key,</if>
<if test="configValue != null and configValue != '' ">config_value,</if>
<if test="configType != null and configType != '' ">config_type,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
)values(
<if test="configName != null and configName != ''">#{configName},</if>
<if test="configKey != null and configKey != ''">#{configKey},</if>
<if test="configValue != null and configValue != ''">#{configValue},</if>
<if test="configType != null and configType != ''">#{configType},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
<update id="updateConfig" parameterType="SysConfig">
update sys_config
<set>
<if test="configName != null and configName != ''">config_name = #{configName},</if>
<if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
<if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
<if test="configType != null and configType != ''">config_type = #{configType},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where config_id = #{configId}
</update>
<delete id="deleteConfigById" parameterType="Long">
delete from sys_config where config_id = #{configId}
</delete>
<delete id="deleteConfigByIds" parameterType="Long">
delete from sys_config where config_id in
<foreach item="configId" collection="array" open="(" separator="," close=")">
#{configId}
</foreach>
</delete>
</mapper>

View File

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysLogininforMapper">
<resultMap type="SysLogininfor" id="SysLogininforResult">
<id property="infoId" column="info_id" />
<result property="userName" column="user_name" />
<result property="status" column="status" />
<result property="ipaddr" column="ipaddr" />
<result property="loginLocation" column="login_location" />
<result property="browser" column="browser" />
<result property="os" column="os" />
<result property="msg" column="msg" />
<result property="loginTime" column="login_time" />
</resultMap>
<insert id="insertLogininfor" parameterType="SysLogininfor">
insert into sys_logininfor (user_name, status, ipaddr, login_location, browser, os, msg, login_time)
values (#{userName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, sysdate())
</insert>
<select id="selectLogininforList" parameterType="SysLogininfor" resultMap="SysLogininforResult">
select info_id, user_name, ipaddr, login_location, browser, os, status, msg, login_time from sys_logininfor
<where>
<if test="ipaddr != null and ipaddr != ''">
AND ipaddr like concat('%', #{ipaddr}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="userName != null and userName != ''">
AND user_name like concat('%', #{userName}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(login_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(login_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
order by info_id desc
</select>
<delete id="deleteLogininforByIds" parameterType="Long">
delete from sys_logininfor where info_id in
<foreach collection="array" item="infoId" open="(" separator="," close=")">
#{infoId}
</foreach>
</delete>
<update id="cleanLogininfor">
truncate table sys_logininfor
</update>
</mapper>

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysOperLogMapper">
<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
<include refid="selectOperLogVo"/>
<where>
<if test="title != null and title != ''">
AND title like concat('%', #{title}, '%')
</if>
<if test="businessType != null and businessType != ''">
AND business_type = #{businessType}
</if>
<if test="businessTypes != null and businessTypes.length > 0">
AND business_type in
<foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
#{businessType}
</foreach>
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="operName != null and operName != ''">
AND oper_name like concat('%', #{operName}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(oper_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(oper_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
order by oper_id desc
</select>
</mapper>

View File

@ -1,6 +1,6 @@
package cn.iocoder.dashboard.framework.excel.core.annotations; 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.*; import java.lang.annotation.*;
@ -14,6 +14,6 @@ import java.lang.annotation.*;
@Inherited @Inherited
public @interface DictFormat { public @interface DictFormat {
DictTypeEnum value(); SysDictTypeEnum value();
} }

View File

@ -5,7 +5,7 @@ import cn.hutool.core.convert.Convert;
import cn.iocoder.dashboard.framework.dict.core.util.DictUtils; import cn.iocoder.dashboard.framework.dict.core.util.DictUtils;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; 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.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.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum; import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData; import com.alibaba.excel.metadata.CellData;
@ -30,7 +30,7 @@ public class DictConvert implements Converter<Object> {
public Object convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, public Object convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) { GlobalConfiguration globalConfiguration) {
// 使用字典解析 // 使用字典解析
DictTypeEnum type = getType(contentProperty); SysDictTypeEnum type = getType(contentProperty);
String label = cellData.getStringValue(); String label = cellData.getStringValue();
SysDictDataDO dictData = DictUtils.parseDictDataFromCache(type.getValue(), label); SysDictDataDO dictData = DictUtils.parseDictDataFromCache(type.getValue(), label);
if (dictData == null) { if (dictData == null) {
@ -46,7 +46,7 @@ public class DictConvert implements Converter<Object> {
public CellData<String> convertToExcelData(Object object, ExcelContentProperty contentProperty, public CellData<String> convertToExcelData(Object object, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) { GlobalConfiguration globalConfiguration) {
// 使用字典格式化 // 使用字典格式化
DictTypeEnum type = getType(contentProperty); SysDictTypeEnum type = getType(contentProperty);
String value = String.valueOf(object); String value = String.valueOf(object);
SysDictDataDO dictData = DictUtils.getDictDataFromCache(type.getValue(), value); SysDictDataDO dictData = DictUtils.getDictDataFromCache(type.getValue(), value);
if (dictData == null) { if (dictData == null) {
@ -57,7 +57,7 @@ public class DictConvert implements Converter<Object> {
return new CellData<>(dictData.getLabel()); return new CellData<>(dictData.getLabel());
} }
private static DictTypeEnum getType(ExcelContentProperty contentProperty) { private static SysDictTypeEnum getType(ExcelContentProperty contentProperty) {
return contentProperty.getField().getAnnotation(DictFormat.class).value(); return contentProperty.getField().getAnnotation(DictFormat.class).value();
} }

View File

@ -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() {
//
// }
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -1,8 +1,12 @@
package cn.iocoder.dashboard.modules.system.controller.dept.vo.post; 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 com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.SYS_COMMON_STATUS;
/** /**
* Excel VO * Excel VO
*/ */
@ -21,9 +25,8 @@ public class SysPostExcelVO {
@ExcelProperty("岗位排序") @ExcelProperty("岗位排序")
private String sort; private String sort;
// @ExcelProperty(value = "状态", converter = DictConvert.class) @ExcelProperty(value = "状态", converter = DictConvert.class)
// @DictFormat(SYS_COMMON_STATUS) @DictFormat(SYS_COMMON_STATUS)
@ExcelProperty(value = "状态")
private String status; private String status;
} }

View File

@ -5,7 +5,7 @@ import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; 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 * Excel VO

View File

@ -5,7 +5,7 @@ import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; 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 * Excel VO

View File

@ -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.CommonResult;
import cn.iocoder.dashboard.common.pojo.PageResult; 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.SysLoginLogPageReqVO;
import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogRespVO; import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogRespVO;
import cn.iocoder.dashboard.modules.system.convert.logger.SysLoginLogConvert; 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 org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@Api(tags = "登陆日志 API") @Api(tags = "登陆日志 API")
@RestController @RestController
@ -32,13 +38,17 @@ public class SysLoginLogController {
return CommonResult.success(SysLoginLogConvert.INSTANCE.convertPage(page)); return CommonResult.success(SysLoginLogConvert.INSTANCE.convertPage(page));
} }
// @GetMapping("/export") @ApiOperation("导出登陆日志 Excel")
//// @Log(title = "登录日志", businessType = BusinessType.EXPORT) @GetMapping("/export")
//// @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") // @Log(title = "登录日志", businessType = BusinessType.EXPORT)
// public void exportLoginLog(SysLogininfor logininfor) { // @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
// List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); public void exportLoginLog(HttpServletResponse response, @Validated SysLoginLogExportReqVO reqVO) throws IOException {
// ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class); List<SysLoginLogDO> list = loginLogService.getLoginLogList(reqVO);
// return util.exportExcel(list, "登录日志"); // 拼接数据
// } List<SysLoginLogExcelVO> excelDataList = SysLoginLogConvert.INSTANCE.convertList(list);
// 输出
ExcelUtils.write(response, "登陆日志.xls", "数据列表",
SysLoginLogExcelVO.class, excelDataList);
}
} }

View File

@ -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.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; 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 com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
@ -17,14 +17,11 @@ public class SysLoginLogExcelVO {
@ExcelProperty("日志主键") @ExcelProperty("日志主键")
private Long id; private Long id;
@ExcelProperty("用户编号")
private Long userId;
@ExcelProperty("用户账号") @ExcelProperty("用户账号")
private String username; private String username;
@ExcelProperty(value = "登陆结果", converter = DictConvert.class) @ExcelProperty(value = "登陆结果", converter = DictConvert.class)
@DictFormat(DictTypeEnum.SYS_LOGIN_RESULT) @DictFormat(SysDictTypeEnum.SYS_LOGIN_RESULT)
private Integer result; private Integer result;
@ExcelProperty("登陆 IP") @ExcelProperty("登陆 IP")

View File

@ -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;
}

View File

@ -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.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; 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 com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
@ -24,7 +24,7 @@ public class SysOperateLogExcelVO {
private String name; private String name;
@ExcelProperty(value = "操作类型", converter = DictConvert.class) @ExcelProperty(value = "操作类型", converter = DictConvert.class)
@DictFormat(DictTypeEnum.SYS_OPERATE_TYPE) @DictFormat(SysDictTypeEnum.SYS_OPERATE_TYPE)
private String type; private String type;
@ExcelProperty("操作人") @ExcelProperty("操作人")

View File

@ -4,7 +4,6 @@ import cn.iocoder.dashboard.common.pojo.PageParam;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
@ -13,7 +12,6 @@ import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOU
@ApiModel("操作日志分页列表 Request VO") @ApiModel("操作日志分页列表 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true)
public class SysOperateLogPageReqVO extends PageParam { public class SysOperateLogPageReqVO extends PageParam {
@ApiModelProperty(value = "操作模块", example = "订单", notes = "模拟匹配") @ApiModelProperty(value = "操作模块", example = "订单", notes = "模拟匹配")

View File

@ -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.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; 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 com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
@ -28,7 +28,7 @@ public class SysRoleExcelVO {
private Integer dataScope; private Integer dataScope;
@ExcelProperty(value = "角色状态", converter = DictConvert.class) @ExcelProperty(value = "角色状态", converter = DictConvert.class)
@DictFormat(DictTypeEnum.SYS_COMMON_STATUS) @DictFormat(SysDictTypeEnum.SYS_COMMON_STATUS)
private String status; private String status;
} }

View File

@ -7,8 +7,8 @@ import lombok.Data;
import java.util.Date; 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.SysDictTypeEnum.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_USER_SEX;
/** /**
* Excel VO * Excel VO

View File

@ -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.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; 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 com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
@ -34,11 +34,11 @@ public class SysUserImportExcelVO {
private String mobile; private String mobile;
@ExcelProperty(value = "用户性别", converter = DictConvert.class) @ExcelProperty(value = "用户性别", converter = DictConvert.class)
@DictFormat(DictTypeEnum.SYS_USER_SEX) @DictFormat(SysDictTypeEnum.SYS_USER_SEX)
private Integer sex; private Integer sex;
@ExcelProperty(value = "账号状态", converter = DictConvert.class) @ExcelProperty(value = "账号状态", converter = DictConvert.class)
@DictFormat(DictTypeEnum.SYS_COMMON_STATUS) @DictFormat(SysDictTypeEnum.SYS_COMMON_STATUS)
private Integer status; private Integer status;
} }

View File

@ -2,11 +2,14 @@ package cn.iocoder.dashboard.modules.system.convert.logger;
import cn.iocoder.dashboard.common.pojo.PageResult; 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.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.controller.logger.vo.loginlog.SysLoginLogRespVO;
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.logger.SysLoginLogDO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.logger.SysLoginLogDO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper @Mapper
public interface SysLoginLogConvert { public interface SysLoginLogConvert {
@ -16,4 +19,6 @@ public interface SysLoginLogConvert {
PageResult<SysLoginLogRespVO> convertPage(PageResult<SysLoginLogDO> page); PageResult<SysLoginLogRespVO> convertPage(PageResult<SysLoginLogDO> page);
List<SysLoginLogExcelVO> convertList(List<SysLoginLogDO> list);
} }

View File

@ -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.common.pojo.PageResult;
import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX; 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.controller.logger.vo.loginlog.SysLoginLogPageReqVO;
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.logger.SysLoginLogDO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.logger.SysLoginLogDO;
import cn.iocoder.dashboard.modules.system.enums.logger.SysLoginResultEnum; import cn.iocoder.dashboard.modules.system.enums.logger.SysLoginResultEnum;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper @Mapper
public interface SysLoginLogMapper extends BaseMapperX<SysLoginLogDO> { public interface SysLoginLogMapper extends BaseMapperX<SysLoginLogDO> {
@ -25,4 +28,18 @@ public interface SysLoginLogMapper extends BaseMapperX<SysLoginLogDO> {
return selectPage(reqVO, query); return selectPage(reqVO, query);
} }
default List<SysLoginLogDO> selectList(SysLoginLogExportReqVO reqVO) {
QueryWrapperX<SysLoginLogDO> query = new QueryWrapperX<SysLoginLogDO>()
.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);
}
} }

View File

@ -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;
}

View File

@ -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.mybatis.core.dataobject.BaseDO;
import cn.iocoder.dashboard.framework.security.core.enums.DataScopeEnum; 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.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.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
@ -52,7 +52,7 @@ public class SysRoleDO extends BaseDO {
/** /**
* *
* *
* {@link RoleTypeEnum} * {@link SysRoleTypeEnum}
*/ */
private Integer type; private Integer type;
/** /**

View File

@ -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;
}

View File

@ -8,7 +8,7 @@ import lombok.Getter;
*/ */
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum DictTypeEnum { public enum SysDictTypeEnum {
SYS_USER_SEX("sys_user_sex"), // 用户性别 SYS_USER_SEX("sys_user_sex"), // 用户性别
SYS_COMMON_STATUS("sys_common_status"), // 系统状态 SYS_COMMON_STATUS("sys_common_status"), // 系统状态

View File

@ -5,7 +5,7 @@ import lombok.Getter;
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum RoleTypeEnum { public enum SysRoleTypeEnum {
/** /**
* *

View File

@ -2,9 +2,12 @@ package cn.iocoder.dashboard.modules.system.service.logger;
import cn.iocoder.dashboard.common.pojo.PageResult; 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.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.controller.logger.vo.loginlog.SysLoginLogPageReqVO;
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.logger.SysLoginLogDO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.logger.SysLoginLogDO;
import java.util.List;
/** /**
* Service * Service
*/ */
@ -25,4 +28,12 @@ public interface SysLoginLogService {
*/ */
PageResult<SysLoginLogDO> getLoginLogPage(SysLoginLogPageReqVO reqVO); PageResult<SysLoginLogDO> getLoginLogPage(SysLoginLogPageReqVO reqVO);
/**
*
*
* @param reqVO
* @return
*/
List<SysLoginLogDO> getLoginLogList(SysLoginLogExportReqVO reqVO);
} }

View File

@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.iocoder.dashboard.common.pojo.PageResult; 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.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.controller.logger.vo.loginlog.SysLoginLogPageReqVO;
import cn.iocoder.dashboard.modules.system.convert.logger.SysLoginLogConvert; import cn.iocoder.dashboard.modules.system.convert.logger.SysLoginLogConvert;
import cn.iocoder.dashboard.modules.system.dal.mysql.dao.logger.SysLoginLogMapper; 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 javax.annotation.Resource;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import static cn.iocoder.dashboard.util.collection.CollectionUtils.convertSet; import static cn.iocoder.dashboard.util.collection.CollectionUtils.convertSet;
@ -41,4 +43,9 @@ public class SysLoginLogServiceImpl implements SysLoginLogService {
return loginLogMapper.selectPage(reqVO); return loginLogMapper.selectPage(reqVO);
} }
@Override
public List<SysLoginLogDO> getLoginLogList(SysLoginLogExportReqVO reqVO) {
return loginLogMapper.selectList(reqVO);
}
} }

View File

@ -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.dao.permission.SysRoleMapper;
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysRoleDO; 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.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.SysPermissionService;
import cn.iocoder.dashboard.modules.system.service.permission.SysRoleService; import cn.iocoder.dashboard.modules.system.service.permission.SysRoleService;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -101,7 +101,7 @@ public class SysRoleServiceImpl implements SysRoleService {
checkDuplicateRole(reqVO.getName(), reqVO.getCode(), null); checkDuplicateRole(reqVO.getName(), reqVO.getCode(), null);
// 插入到数据库 // 插入到数据库
SysRoleDO role = SysRoleConvert.INSTANCE.convert(reqVO); SysRoleDO role = SysRoleConvert.INSTANCE.convert(reqVO);
role.setType(RoleTypeEnum.CUSTOM.getType()); role.setType(SysRoleTypeEnum.CUSTOM.getType());
role.setStatus(CommonStatusEnum.ENABLE.getStatus()); role.setStatus(CommonStatusEnum.ENABLE.getStatus());
roleMapper.insert(role); roleMapper.insert(role);
// 返回 // 返回
@ -207,7 +207,7 @@ public class SysRoleServiceImpl implements SysRoleService {
throw ServiceExceptionUtil.exception(ROLE_NOT_EXISTS); 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); throw ServiceExceptionUtil.exception(ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE);
} }
} }