开始迁移字典类型模块

This commit is contained in:
YunaiV 2021-01-12 08:44:12 +08:00
parent ba6c879ee1
commit f7f27c9693
60 changed files with 590 additions and 3176 deletions

View File

@ -1,18 +0,0 @@
package com.ruoyi;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
* web容器中进行部署
*
* @author ruoyi
*/
public class RuoYiServletInitializer extends SpringBootServletInitializer
{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
{
return application.sources(RuoYiApplication.class);
}
}

View File

@ -1,120 +0,0 @@
package com.ruoyi.web.controller.system;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysDictTypeService;
/**
* 数据字典信息
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dict/data")
public class SysDictDataController extends BaseController
{
@Autowired
private ISysDictDataService dictDataService;
@Autowired
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
public TableDataInfo list(SysDictData dictData)
{
startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list);
}
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
@GetMapping("/export")
public AjaxResult export(SysDictData dictData)
{
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
return util.exportExcel(list, "字典数据");
}
/**
* 查询字典数据详细
*/
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictCode}")
public AjaxResult getInfo(@PathVariable Long dictCode)
{
return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
}
/**
* 根据字典类型查询字典数据信息
*/
@GetMapping(value = "/type/{dictType}")
public AjaxResult dictType(@PathVariable String dictType)
{
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data))
{
data = new ArrayList<SysDictData>();
}
return AjaxResult.success(data);
}
/**
* 新增字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictData dict)
{
dict.setCreateBy(SecurityUtils.getUsername());
return toAjax(dictDataService.insertDictData(dict));
}
/**
* 修改保存字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
{
dict.setUpdateBy(SecurityUtils.getUsername());
return toAjax(dictDataService.updateDictData(dict));
}
/**
* 删除字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}")
public AjaxResult remove(@PathVariable Long[] dictCodes)
{
return toAjax(dictDataService.deleteDictDataByIds(dictCodes));
}
}

View File

@ -1,131 +0,0 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictTypeService;
/**
* 数据字典信息
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dict/type")
public class SysDictTypeController extends BaseController
{
@Autowired
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
public TableDataInfo list(SysDictType dictType)
{
startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
}
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
@GetMapping("/export")
public AjaxResult export(SysDictType dictType)
{
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
return util.exportExcel(list, "字典类型");
}
/**
* 查询字典类型详细
*/
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictId}")
public AjaxResult getInfo(@PathVariable Long dictId)
{
return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
}
/**
* 新增字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictType dict)
{
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
{
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setCreateBy(SecurityUtils.getUsername());
return toAjax(dictTypeService.insertDictType(dict));
}
/**
* 修改字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
{
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
{
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setUpdateBy(SecurityUtils.getUsername());
return toAjax(dictTypeService.updateDictType(dict));
}
/**
* 删除字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}")
public AjaxResult remove(@PathVariable Long[] dictIds)
{
return toAjax(dictTypeService.deleteDictTypeByIds(dictIds));
}
/**
* 清空缓存
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
@DeleteMapping("/clearCache")
public AjaxResult clearCache()
{
dictTypeService.clearCache();
return AjaxResult.success();
}
/**
* 获取字典选择框列表
*/
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
return AjaxResult.success(dictTypes);
}
}

View File

@ -1,175 +0,0 @@
package com.ruoyi.web.controller.tool;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
/**
* swagger 用户测试方法
*
* @author ruoyi
*/
@Api("用户信息管理")
@RestController
@RequestMapping("/test/user")
public class TestController extends BaseController
{
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
{
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
}
@ApiOperation("获取用户列表")
@GetMapping("/list")
public AjaxResult userList()
{
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
return AjaxResult.success(userList);
}
@ApiOperation("获取用户详细")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
@GetMapping("/{userId}")
public AjaxResult getUser(@PathVariable Integer userId)
{
if (!users.isEmpty() && users.containsKey(userId))
{
return AjaxResult.success(users.get(userId));
}
else
{
return AjaxResult.error("用户不存在");
}
}
@ApiOperation("新增用户")
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
@PostMapping("/save")
public AjaxResult save(UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return AjaxResult.error("用户ID不能为空");
}
return AjaxResult.success(users.put(user.getUserId(), user));
}
@ApiOperation("更新用户")
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
@PutMapping("/update")
public AjaxResult update(UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return AjaxResult.error("用户ID不能为空");
}
if (users.isEmpty() || !users.containsKey(user.getUserId()))
{
return AjaxResult.error("用户不存在");
}
users.remove(user.getUserId());
return AjaxResult.success(users.put(user.getUserId(), user));
}
@ApiOperation("删除用户信息")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
@DeleteMapping("/{userId}")
public AjaxResult delete(@PathVariable Integer userId)
{
if (!users.isEmpty() && users.containsKey(userId))
{
users.remove(userId);
return AjaxResult.success();
}
else
{
return AjaxResult.error("用户不存在");
}
}
}
@ApiModel("用户实体")
class UserEntity
{
@ApiModelProperty("用户ID")
private Integer userId;
@ApiModelProperty("用户名称")
private String username;
@ApiModelProperty("用户密码")
private String password;
@ApiModelProperty("用户手机")
private String mobile;
public UserEntity()
{
}
public UserEntity(Integer userId, String username, String password, String mobile)
{
this.userId = userId;
this.username = username;
this.password = password;
this.mobile = mobile;
}
public Integer getUserId()
{
return userId;
}
public void setUserId(Integer userId)
{
this.userId = userId;
}
public String getUsername()
{
return username;
}
public void setUsername(String username)
{
this.username = username;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
public String getMobile()
{
return mobile;
}
public void setMobile(String mobile)
{
this.mobile = mobile;
}
}

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting name="cacheEnabled" value="true" /> <!-- 全局映射器启用缓存 -->
<setting name="useGeneratedKeys" value="true" /> <!-- 允许 JDBC 支持自动生成主键 -->
<setting name="defaultExecutorType" value="REUSE" /> <!-- 配置默认的执行器 -->
<setting name="logImpl" value="SLF4J" /> <!-- 指定 MyBatis 所用日志的具体实现 -->
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> 驼峰式命名 -->
</settings>
</configuration>

View File

@ -1,58 +0,0 @@
package com.ruoyi.framework.web.service;
import java.util.HashSet;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.service.ISysMenuService;
import com.ruoyi.system.service.ISysRoleService;
/**
* 用户权限处理
*
* @author ruoyi
*/
@Component
public class SysPermissionService {
@Autowired
private ISysRoleService roleService;
@Autowired
private ISysMenuService menuService;
/**
* 获取角色数据权限
*
* @param user 用户信息
* @return 角色权限信息
*/
public Set<String> getRolePermission(SysUser user) {
Set<String> roles = new HashSet<String>();
// 管理员拥有所有权限
if (user.isAdmin()) {
roles.add("admin");
} else {
roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId()));
}
return roles;
}
/**
* 获取菜单数据权限
*
* @param user 用户信息
* @return 菜单权限信息
*/
public Set<String> getMenuPermission(SysUser user) {
Set<String> perms = new HashSet<String>();
// 管理员拥有所有权限
if (user.isAdmin()) {
perms.add("*:*:*");
} else {
perms.addAll(getMenuPermissionmenuService.selectMenuPermsByUserId(user.getUserId()));
}
return perms;
}
}

View File

@ -10,7 +10,7 @@ import com.ruoyi.common.utils.StringUtils;
/**
* 业务表 gen_table
*
*
* @author ruoyi
*/
public class GenTable extends BaseEntity
@ -86,206 +86,6 @@ public class GenTable extends BaseEntity
/** 上级菜单名称字段 */
private String parentMenuName;
public Long getTableId()
{
return tableId;
}
public void setTableId(Long tableId)
{
this.tableId = tableId;
}
public String getTableName()
{
return tableName;
}
public void setTableName(String tableName)
{
this.tableName = tableName;
}
public String getTableComment()
{
return tableComment;
}
public void setTableComment(String tableComment)
{
this.tableComment = tableComment;
}
public String getClassName()
{
return className;
}
public void setClassName(String className)
{
this.className = className;
}
public String getTplCategory()
{
return tplCategory;
}
public void setTplCategory(String tplCategory)
{
this.tplCategory = tplCategory;
}
public String getPackageName()
{
return packageName;
}
public void setPackageName(String packageName)
{
this.packageName = packageName;
}
public String getModuleName()
{
return moduleName;
}
public void setModuleName(String moduleName)
{
this.moduleName = moduleName;
}
public String getBusinessName()
{
return businessName;
}
public void setBusinessName(String businessName)
{
this.businessName = businessName;
}
public String getFunctionName()
{
return functionName;
}
public void setFunctionName(String functionName)
{
this.functionName = functionName;
}
public String getFunctionAuthor()
{
return functionAuthor;
}
public void setFunctionAuthor(String functionAuthor)
{
this.functionAuthor = functionAuthor;
}
public String getGenType()
{
return genType;
}
public void setGenType(String genType)
{
this.genType = genType;
}
public String getGenPath()
{
return genPath;
}
public void setGenPath(String genPath)
{
this.genPath = genPath;
}
public GenTableColumn getPkColumn()
{
return pkColumn;
}
public void setPkColumn(GenTableColumn pkColumn)
{
this.pkColumn = pkColumn;
}
public List<GenTableColumn> getColumns()
{
return columns;
}
public void setColumns(List<GenTableColumn> columns)
{
this.columns = columns;
}
public String getOptions()
{
return options;
}
public void setOptions(String options)
{
this.options = options;
}
public String getTreeCode()
{
return treeCode;
}
public void setTreeCode(String treeCode)
{
this.treeCode = treeCode;
}
public String getTreeParentCode()
{
return treeParentCode;
}
public void setTreeParentCode(String treeParentCode)
{
this.treeParentCode = treeParentCode;
}
public String getTreeName()
{
return treeName;
}
public void setTreeName(String treeName)
{
this.treeName = treeName;
}
public String getParentMenuId()
{
return parentMenuId;
}
public void setParentMenuId(String parentMenuId)
{
this.parentMenuId = parentMenuId;
}
public String getParentMenuName()
{
return parentMenuName;
}
public void setParentMenuName(String parentMenuName)
{
this.parentMenuName = parentMenuName;
}
public boolean isTree()
{
return isTree(this.tplCategory);
@ -320,4 +120,4 @@ public class GenTable extends BaseEntity
}
return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY);
}
}
}

View File

@ -1,18 +1,18 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysConfig;
/**
* 参数配置 数据层
*
*
* @author ruoyi
*/
public interface SysConfigMapper
{
public interface SysConfigMapper {
/**
* 查询参数配置信息
*
*
* @param config 参数配置信息
* @return 参数配置信息
*/
@ -20,7 +20,7 @@ public interface SysConfigMapper
/**
* 查询参数配置列表
*
*
* @param config 参数配置信息
* @return 参数配置集合
*/
@ -28,7 +28,7 @@ public interface SysConfigMapper
/**
* 根据键名查询参数配置信息
*
*
* @param configKey 参数键名
* @return 参数配置信息
*/
@ -36,7 +36,7 @@ public interface SysConfigMapper
/**
* 新增参数配置
*
*
* @param config 参数配置信息
* @return 结果
*/
@ -44,7 +44,7 @@ public interface SysConfigMapper
/**
* 修改参数配置
*
*
* @param config 参数配置信息
* @return 结果
*/
@ -52,7 +52,7 @@ public interface SysConfigMapper
/**
* 删除参数配置
*
*
* @param configId 参数ID
* @return 结果
*/
@ -60,7 +60,7 @@ public interface SysConfigMapper
/**
* 批量删除参数信息
*
*
* @param configIds 需要删除的参数ID
* @return 结果
*/

View File

@ -1,118 +0,0 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.common.core.domain.entity.SysDept;
/**
* 部门管理 数据层
*
* @author ruoyi
*/
public interface SysDeptMapper
{
/**
* 查询部门管理数据
*
* @param dept 部门信息
* @return 部门信息集合
*/
public List<SysDept> selectDeptList(SysDept dept);
/**
* 根据角色ID查询部门树信息
*
* @param roleId 角色ID
* @param deptCheckStrictly 部门树选择项是否关联显示
* @return 选中部门列表
*/
public List<Integer> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
/**
* 根据部门ID查询信息
*
* @param deptId 部门ID
* @return 部门信息
*/
public SysDept selectDeptById(Long deptId);
/**
* 根据ID查询所有子部门
*
* @param deptId 部门ID
* @return 部门列表
*/
public List<SysDept> selectChildrenDeptById(Long deptId);
/**
* 根据ID查询所有子部门正常状态
*
* @param deptId 部门ID
* @return 子部门数
*/
public int selectNormalChildrenDeptById(Long deptId);
/**
* 是否存在子节点
*
* @param deptId 部门ID
* @return 结果
*/
public int hasChildByDeptId(Long deptId);
/**
* 查询部门是否存在用户
*
* @param deptId 部门ID
* @return 结果
*/
public int checkDeptExistUser(Long deptId);
/**
* 校验部门名称是否唯一
*
* @param deptName 部门名称
* @param parentId 父部门ID
* @return 结果
*/
public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
/**
* 新增部门信息
*
* @param dept 部门信息
* @return 结果
*/
public int insertDept(SysDept dept);
/**
* 修改部门信息
*
* @param dept 部门信息
* @return 结果
*/
public int updateDept(SysDept dept);
/**
* 修改所在部门的父级部门状态
*
* @param dept 部门
*/
public void updateDeptStatus(SysDept dept);
/**
* 修改子元素关系
*
* @param depts 子元素
* @return 结果
*/
public int updateDeptChildren(@Param("depts") List<SysDept> depts);
/**
* 删除部门管理信息
*
* @param deptId 部门ID
* @return 结果
*/
public int deleteDeptById(Long deptId);
}

View File

@ -1,95 +0,0 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.common.core.domain.entity.SysDictData;
/**
* 字典表 数据层
*
* @author ruoyi
*/
public interface SysDictDataMapper
{
/**
* 根据条件分页查询字典数据
*
* @param dictData 字典数据信息
* @return 字典数据集合信息
*/
public List<SysDictData> selectDictDataList(SysDictData dictData);
/**
* 根据字典类型查询字典数据
*
* @param dictType 字典类型
* @return 字典数据集合信息
*/
public List<SysDictData> selectDictDataByType(String dictType);
/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典标签
*/
public String selectDictLabel(@Param("dictType") String dictType, @Param("dictValue") String dictValue);
/**
* 根据字典数据ID查询信息
*
* @param dictCode 字典数据ID
* @return 字典数据
*/
public SysDictData selectDictDataById(Long dictCode);
/**
* 查询字典数据
*
* @param dictType 字典类型
* @return 字典数据
*/
public int countDictDataByType(String dictType);
/**
* 通过字典ID删除字典数据信息
*
* @param dictCode 字典数据ID
* @return 结果
*/
public int deleteDictDataById(Long dictCode);
/**
* 批量删除字典数据信息
*
* @param dictCodes 需要删除的字典数据ID
* @return 结果
*/
public int deleteDictDataByIds(Long[] dictCodes);
/**
* 新增字典数据信息
*
* @param dictData 字典数据信息
* @return 结果
*/
public int insertDictData(SysDictData dictData);
/**
* 修改字典数据信息
*
* @param dictData 字典数据信息
* @return 结果
*/
public int updateDictData(SysDictData dictData);
/**
* 同步修改字典类型
*
* @param oldDictType 旧字典类型
* @param newDictType 新旧字典类型
* @return 结果
*/
public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);
}

View File

@ -1,85 +0,0 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import com.ruoyi.common.core.domain.entity.SysDictType;
/**
* 字典表 数据层
*
* @author ruoyi
*/
@Mapper
public interface SysDictTypeMapper
{
/**
* 根据条件分页查询字典类型
*
* @param dictType 字典类型信息
* @return 字典类型集合信息
*/
public List<SysDictType> selectDictTypeList(SysDictType dictType);
/**
* 根据所有字典类型
*
* @return 字典类型集合信息
*/
public List<SysDictType> selectDictTypeAll();
/**
* 根据字典类型ID查询信息
*
* @param dictId 字典类型ID
* @return 字典类型
*/
public SysDictType selectDictTypeById(Long dictId);
/**
* 根据字典类型查询信息
*
* @param dictType 字典类型
* @return 字典类型
*/
public SysDictType selectDictTypeByType(String dictType);
/**
* 通过字典ID删除字典信息
*
* @param dictId 字典ID
* @return 结果
*/
public int deleteDictTypeById(Long dictId);
/**
* 批量删除字典类型信息
*
* @param dictIds 需要删除的字典ID
* @return 结果
*/
public int deleteDictTypeByIds(Long[] dictIds);
/**
* 新增字典类型信息
*
* @param dictType 字典类型信息
* @return 结果
*/
public int insertDictType(SysDictType dictType);
/**
* 修改字典类型信息
*
* @param dictType 字典类型信息
* @return 结果
*/
public int updateDictType(SysDictType dictType);
/**
* 校验字典类型称是否唯一
*
* @param dictType 字典类型
* @return 结果
*/
public SysDictType checkDictTypeUnique(String dictType);
}

View File

@ -1,25 +1,25 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysLogininfor;
/**
* 系统访问日志情况信息 数据层
*
*
* @author ruoyi
*/
public interface SysLogininforMapper
{
public interface SysLogininforMapper {
/**
* 新增系统登录日志
*
*
* @param logininfor 访问日志对象
*/
public void insertLogininfor(SysLogininfor logininfor);
/**
* 查询系统登录日志集合
*
*
* @param logininfor 访问日志对象
* @return 登录记录集合
*/
@ -27,7 +27,7 @@ public interface SysLogininforMapper
/**
* 批量删除系统登录日志
*
*
* @param infoIds 需要删除的登录日志ID
* @return 结果
*/
@ -35,7 +35,7 @@ public interface SysLogininforMapper
/**
* 清空系统登录日志
*
*
* @return 结果
*/
public int cleanLogininfor();

View File

@ -1,55 +0,0 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.common.core.domain.entity.SysMenu;
/**
* 菜单表 数据层
*
* @author ruoyi
*/
public interface SysMenuMapper {
/**
* 根据用户查询系统菜单列表
*
* @param menu 菜单信息
* @return 菜单列表
*/
public List<SysMenu> selectMenuListByUserId(SysMenu menu);
/**
* 根据用户ID查询权限
*
* @param userId 用户ID
* @return 权限列表
*/
public List<String> selectMenuPermsByUserId(Long userId);
/**
* 根据用户ID查询菜单
*
* @return 菜单列表
*/
public List<SysMenu> selectMenuTreeAll();
/**
* 根据用户ID查询菜单
*
* @param userId 用户ID
* @return 菜单列表
*/
public List<SysMenu> selectMenuTreeByUserId(Long userId);
/**
* 根据角色ID查询菜单树信息
*
* @param roleId 角色ID
* @param menuCheckStrictly 菜单树选择项是否关联显示
* @return 选中菜单列表
*/
public List<Integer> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly);
}

View File

@ -1,18 +1,18 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysNotice;
/**
* 通知公告表 数据层
*
*
* @author ruoyi
*/
public interface SysNoticeMapper
{
public interface SysNoticeMapper {
/**
* 查询公告信息
*
*
* @param noticeId 公告ID
* @return 公告信息
*/
@ -20,7 +20,7 @@ public interface SysNoticeMapper
/**
* 查询公告列表
*
*
* @param notice 公告信息
* @return 公告集合
*/
@ -28,7 +28,7 @@ public interface SysNoticeMapper
/**
* 新增公告
*
*
* @param notice 公告信息
* @return 结果
*/
@ -36,7 +36,7 @@ public interface SysNoticeMapper
/**
* 修改公告
*
*
* @param notice 公告信息
* @return 结果
*/
@ -44,7 +44,7 @@ public interface SysNoticeMapper
/**
* 批量删除公告
*
*
* @param noticeId 公告ID
* @return 结果
*/
@ -52,7 +52,7 @@ public interface SysNoticeMapper
/**
* 批量删除公告信息
*
*
* @param noticeIds 需要删除的公告ID
* @return 结果
*/

View File

@ -1,25 +1,25 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysOperLog;
/**
* 操作日志 数据层
*
*
* @author ruoyi
*/
public interface SysOperLogMapper
{
public interface SysOperLogMapper {
/**
* 新增操作日志
*
*
* @param operLog 操作日志对象
*/
public void insertOperlog(SysOperLog operLog);
/**
* 查询系统操作日志集合
*
*
* @param operLog 操作日志对象
* @return 操作日志集合
*/
@ -27,7 +27,7 @@ public interface SysOperLogMapper
/**
* 批量删除系统操作日志
*
*
* @param operIds 需要删除的操作日志ID
* @return 结果
*/
@ -35,7 +35,7 @@ public interface SysOperLogMapper
/**
* 查询操作日志详细
*
*
* @param operId 操作ID
* @return 操作日志对象
*/

View File

@ -1,99 +0,0 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysPost;
/**
* 岗位信息 数据层
*
* @author ruoyi
*/
public interface SysPostMapper
{
/**
* 查询岗位数据集合
*
* @param post 岗位信息
* @return 岗位数据集合
*/
public List<SysPost> selectPostList(SysPost post);
/**
* 查询所有岗位
*
* @return 岗位列表
*/
public List<SysPost> selectPostAll();
/**
* 通过岗位ID查询岗位信息
*
* @param postId 岗位ID
* @return 角色对象信息
*/
public SysPost selectPostById(Long postId);
/**
* 根据用户ID获取岗位选择框列表
*
* @param userId 用户ID
* @return 选中岗位ID列表
*/
public List<Integer> selectPostListByUserId(Long userId);
/**
* 查询用户所属岗位组
*
* @param userName 用户名
* @return 结果
*/
public List<SysPost> selectPostsByUserName(String userName);
/**
* 删除岗位信息
*
* @param postId 岗位ID
* @return 结果
*/
public int deletePostById(Long postId);
/**
* 批量删除岗位信息
*
* @param postIds 需要删除的岗位ID
* @return 结果
*/
public int deletePostByIds(Long[] postIds);
/**
* 修改岗位信息
*
* @param post 岗位信息
* @return 结果
*/
public int updatePost(SysPost post);
/**
* 新增岗位信息
*
* @param post 岗位信息
* @return 结果
*/
public int insertPost(SysPost post);
/**
* 校验岗位名称
*
* @param postName 岗位名称
* @return 结果
*/
public SysPost checkPostNameUnique(String postName);
/**
* 校验岗位编码
*
* @param postCode 岗位编码
* @return 结果
*/
public SysPost checkPostCodeUnique(String postCode);
}

View File

@ -1,44 +0,0 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysRoleDept;
/**
* 角色与部门关联表 数据层
*
* @author ruoyi
*/
public interface SysRoleDeptMapper
{
/**
* 通过角色ID删除角色和部门关联
*
* @param roleId 角色ID
* @return 结果
*/
public int deleteRoleDeptByRoleId(Long roleId);
/**
* 批量删除角色部门关联信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteRoleDept(Long[] ids);
/**
* 查询部门使用数量
*
* @param deptId 部门ID
* @return 结果
*/
public int selectCountRoleDeptByDeptId(Long deptId);
/**
* 批量新增角色部门信息
*
* @param roleDeptList 角色部门列表
* @return 结果
*/
public int batchRoleDept(List<SysRoleDept> roleDeptList);
}

View File

@ -1,46 +0,0 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysRole;
/**
* 角色表 数据层
*
* @author ruoyi
*/
public interface SysRoleMapper {
/**
* 根据条件分页查询角色数据
*
* @param role 角色信息
* @return 角色数据集合信息
*/
public List<SysRole> selectRoleList(SysRole role);
/**
* 根据用户ID查询角色
*
* @param userId 用户ID
* @return 角色列表
*/
public List<SysRole> selectRolePermissionByUserId(Long userId);
/**
* 根据用户ID获取角色选择框列表
*
* @param userId 用户ID
* @return 选中角色ID列表
*/
public List<Integer> selectRoleListByUserId(Long userId);
/**
* 根据用户ID查询角色
*
* @param userName 用户名
* @return 角色列表
*/
public List<SysRole> selectRolesByUserName(String userName);
}

View File

@ -1,22 +0,0 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.common.core.domain.entity.SysUser;
/**
* 用户表 数据层
*
* @author ruoyi
*/
public interface SysUserMapper
{
/**
* 根据条件分页查询用户列表
*
* @param sysUser 用户信息
* @return 用户信息集合信息
*/
public List<SysUser> selectUserList(SysUser sysUser);
}

View File

@ -1,44 +0,0 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysUserPost;
/**
* 用户与岗位关联表 数据层
*
* @author ruoyi
*/
public interface SysUserPostMapper
{
/**
* 通过用户ID删除用户和岗位关联
*
* @param userId 用户ID
* @return 结果
*/
public int deleteUserPostByUserId(Long userId);
/**
* 通过岗位ID查询岗位使用数量
*
* @param postId 岗位ID
* @return 结果
*/
public int countUserPostById(Long postId);
/**
* 批量删除用户和岗位关联
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteUserPost(Long[] ids);
/**
* 批量新增用户岗位信息
*
* @param userPostList 用户角色列表
* @return 结果
*/
public int batchUserPost(List<SysUserPost> userPostList);
}

View File

@ -1,61 +0,0 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysDictData;
/**
* 字典 业务层
*
* @author ruoyi
*/
public interface ISysDictDataService
{
/**
* 根据条件分页查询字典数据
*
* @param dictData 字典数据信息
* @return 字典数据集合信息
*/
public List<SysDictData> selectDictDataList(SysDictData dictData);
/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典标签
*/
public String selectDictLabel(String dictType, String dictValue);
/**
* 根据字典数据ID查询信息
*
* @param dictCode 字典数据ID
* @return 字典数据
*/
public SysDictData selectDictDataById(Long dictCode);
/**
* 批量删除字典数据信息
*
* @param dictCodes 需要删除的字典数据ID
* @return 结果
*/
public int deleteDictDataByIds(Long[] dictCodes);
/**
* 新增保存字典数据信息
*
* @param dictData 字典数据信息
* @return 结果
*/
public int insertDictData(SysDictData dictData);
/**
* 修改保存字典数据信息
*
* @param dictData 字典数据信息
* @return 结果
*/
public int updateDictData(SysDictData dictData);
}

View File

@ -1,89 +0,0 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysDictType;
/**
* 字典 业务层
*
* @author ruoyi
*/
public interface ISysDictTypeService
{
/**
* 根据条件分页查询字典类型
*
* @param dictType 字典类型信息
* @return 字典类型集合信息
*/
public List<SysDictType> selectDictTypeList(SysDictType dictType);
/**
* 根据所有字典类型
*
* @return 字典类型集合信息
*/
public List<SysDictType> selectDictTypeAll();
/**
* 根据字典类型查询字典数据
*
* @param dictType 字典类型
* @return 字典数据集合信息
*/
public List<SysDictData> selectDictDataByType(String dictType);
/**
* 根据字典类型ID查询信息
*
* @param dictId 字典类型ID
* @return 字典类型
*/
public SysDictType selectDictTypeById(Long dictId);
/**
* 根据字典类型查询信息
*
* @param dictType 字典类型
* @return 字典类型
*/
public SysDictType selectDictTypeByType(String dictType);
/**
* 批量删除字典信息
*
* @param dictIds 需要删除的字典ID
* @return 结果
*/
public int deleteDictTypeByIds(Long[] dictIds);
/**
* 清空缓存数据
*/
public void clearCache();
/**
* 新增保存字典类型信息
*
* @param dictType 字典类型信息
* @return 结果
*/
public int insertDictType(SysDictType dictType);
/**
* 修改保存字典类型信息
*
* @param dictType 字典类型信息
* @return 结果
*/
public int updateDictType(SysDictType dictType);
/**
* 校验字典类型称是否唯一
*
* @param dictType 字典类型
* @return 结果
*/
public String checkDictTypeUnique(SysDictType dictType);
}

View File

@ -1,49 +0,0 @@
package com.ruoyi.system.service;
import java.util.List;
import java.util.Set;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.system.domain.vo.RouterVo;
/**
* 菜单 业务层
*
* @author ruoyi
*/
public interface ISysMenuService
{
/**
* 根据用户查询系统菜单列表
*
* @param userId 用户ID
* @return 菜单列表
*/
public List<SysMenu> selectMenuList(Long userId);
/**
* 根据用户查询系统菜单列表
*
* @param menu 菜单信息
* @param userId 用户ID
* @return 菜单列表
*/
public List<SysMenu> selectMenuList(SysMenu menu, Long userId);
/**
* 根据用户ID查询权限
*
* @param userId 用户ID
* @return 权限列表
*/
public Set<String> selectMenuPermsByUserId(Long userId);
/**
* 查询菜单是否存在角色
*
* @param menuId 菜单ID
* @return 结果 true 存在 false 不存在
*/
public boolean checkMenuExistRole(Long menuId);
}

View File

@ -1,100 +0,0 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.SysPost;
/**
* 岗位信息 服务层
*
* @author ruoyi
*/
public interface ISysPostService
{
/**
* 查询岗位信息集合
*
* @param post 岗位信息
* @return 岗位列表
*/
public List<SysPost> selectPostList(SysPost post);
/**
* 查询所有岗位
*
* @return 岗位列表
*/
public List<SysPost> selectPostAll();
/**
* 通过岗位ID查询岗位信息
*
* @param postId 岗位ID
* @return 角色对象信息
*/
public SysPost selectPostById(Long postId);
/**
* 根据用户ID获取岗位选择框列表
*
* @param userId 用户ID
* @return 选中岗位ID列表
*/
public List<Integer> selectPostListByUserId(Long userId);
/**
* 校验岗位名称
*
* @param post 岗位信息
* @return 结果
*/
public String checkPostNameUnique(SysPost post);
/**
* 校验岗位编码
*
* @param post 岗位信息
* @return 结果
*/
public String checkPostCodeUnique(SysPost post);
/**
* 通过岗位ID查询岗位使用数量
*
* @param postId 岗位ID
* @return 结果
*/
public int countUserPostById(Long postId);
/**
* 删除岗位信息
*
* @param postId 岗位ID
* @return 结果
*/
public int deletePostById(Long postId);
/**
* 批量删除岗位信息
*
* @param postIds 需要删除的岗位ID
* @return 结果
* @throws Exception 异常
*/
public int deletePostByIds(Long[] postIds);
/**
* 新增保存岗位信息
*
* @param post 岗位信息
* @return 结果
*/
public int insertPost(SysPost post);
/**
* 修改保存岗位信息
*
* @param post 岗位信息
* @return 结果
*/
public int updatePost(SysPost post);
}

View File

@ -1,31 +0,0 @@
package com.ruoyi.system.service;
import java.util.List;
import java.util.Set;
import com.ruoyi.common.core.domain.entity.SysRole;
/**
* 角色业务层
*
* @author ruoyi
*/
public interface ISysRoleService {
/**
* 根据用户ID查询角色
*
* @param userId 用户ID
* @return 权限列表
*/
public Set<String> selectRolePermissionByUserId(Long userId);
/**
* 修改数据权限信息
*
* @param role 角色信息
* @return 结果
*/
public int authDataScope(SysRole role);
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl;
import java.util.Collection;
import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.annotation.DataSource;
@ -19,12 +20,11 @@ import com.ruoyi.system.service.ISysConfigService;
/**
* 参数配置 服务层实现
*
*
* @author ruoyi
*/
@Service
public class SysConfigServiceImpl implements ISysConfigService
{
public class SysConfigServiceImpl implements ISysConfigService {
@Autowired
private SysConfigMapper configMapper;
@ -35,25 +35,22 @@ public class SysConfigServiceImpl implements ISysConfigService
* 项目启动时初始化参数到缓存
*/
@PostConstruct
public void init()
{
public void init() {
List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig());
for (SysConfig config : configsList)
{
for (SysConfig config : configsList) {
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
}
}
/**
* 查询参数配置信息
*
*
* @param configId 参数配置ID
* @return 参数配置信息
*/
@Override
@DataSource(DataSourceType.MASTER)
public SysConfig selectConfigById(Long configId)
{
public SysConfig selectConfigById(Long configId) {
SysConfig config = new SysConfig();
config.setConfigId(configId);
return configMapper.selectConfig(config);
@ -61,23 +58,20 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 根据键名查询参数配置信息
*
*
* @param configKey 参数key
* @return 参数键值
*/
@Override
public String selectConfigByKey(String configKey)
{
public String selectConfigByKey(String configKey) {
String configValue = Convert.toStr(redisCache.getCacheObject(getCacheKey(configKey)));
if (StringUtils.isNotEmpty(configValue))
{
if (StringUtils.isNotEmpty(configValue)) {
return configValue;
}
SysConfig config = new SysConfig();
config.setConfigKey(configKey);
SysConfig retConfig = configMapper.selectConfig(config);
if (StringUtils.isNotNull(retConfig))
{
if (StringUtils.isNotNull(retConfig)) {
redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue());
return retConfig.getConfigValue();
}
@ -86,28 +80,25 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 查询参数配置列表
*
*
* @param config 参数配置信息
* @return 参数配置集合
*/
@Override
public List<SysConfig> selectConfigList(SysConfig config)
{
public List<SysConfig> selectConfigList(SysConfig config) {
return configMapper.selectConfigList(config);
}
/**
* 新增参数配置
*
*
* @param config 参数配置信息
* @return 结果
*/
@Override
public int insertConfig(SysConfig config)
{
public int insertConfig(SysConfig config) {
int row = configMapper.insertConfig(config);
if (row > 0)
{
if (row > 0) {
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
}
return row;
@ -115,16 +106,14 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 修改参数配置
*
*
* @param config 参数配置信息
* @return 结果
*/
@Override
public int updateConfig(SysConfig config)
{
public int updateConfig(SysConfig config) {
int row = configMapper.updateConfig(config);
if (row > 0)
{
if (row > 0) {
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
}
return row;
@ -132,24 +121,20 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 批量删除参数信息
*
*
* @param configIds 需要删除的参数ID
* @return 结果
*/
@Override
public int deleteConfigByIds(Long[] configIds)
{
for (Long configId : configIds)
{
public int deleteConfigByIds(Long[] configIds) {
for (Long configId : configIds) {
SysConfig config = selectConfigById(configId);
if (StringUtils.equals(UserConstants.YES, config.getConfigType()))
{
if (StringUtils.equals(UserConstants.YES, config.getConfigType())) {
throw new CustomException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
}
}
int count = configMapper.deleteConfigByIds(configIds);
if (count > 0)
{
if (count > 0) {
Collection<String> keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*");
redisCache.deleteObject(keys);
}
@ -160,25 +145,22 @@ public class SysConfigServiceImpl implements ISysConfigService
* 清空缓存数据
*/
@Override
public void clearCache()
{
public void clearCache() {
Collection<String> keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*");
redisCache.deleteObject(keys);
}
/**
* 校验参数键名是否唯一
*
*
* @param config 参数配置信息
* @return 结果
*/
@Override
public String checkConfigKeyUnique(SysConfig config)
{
public String checkConfigKeyUnique(SysConfig config) {
Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey());
if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue())
{
if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@ -186,12 +168,11 @@ public class SysConfigServiceImpl implements ISysConfigService
/**
* 设置cache key
*
*
* @param configKey 参数键
* @return 缓存键key
*/
private String getCacheKey(String configKey)
{
private String getCacheKey(String configKey) {
return Constants.SYS_CONFIG_KEY + configKey;
}
}

View File

@ -1,6 +1,7 @@
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.common.core.domain.entity.SysDictData;
@ -10,64 +11,59 @@ import com.ruoyi.system.service.ISysDictDataService;
/**
* 字典 业务层处理
*
*
* @author ruoyi
*/
@Service
public class SysDictDataServiceImpl implements ISysDictDataService
{
public class SysDictDataServiceImpl implements ISysDictDataService {
@Autowired
private SysDictDataMapper dictDataMapper;
/**
* 根据条件分页查询字典数据
*
*
* @param dictData 字典数据信息
* @return 字典数据集合信息
*/
@Override
public List<SysDictData> selectDictDataList(SysDictData dictData)
{
public List<SysDictData> selectDictDataList(SysDictData dictData) {
return dictDataMapper.selectDictDataList(dictData);
}
/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典标签
*/
@Override
public String selectDictLabel(String dictType, String dictValue)
{
public String selectDictLabel(String dictType, String dictValue) {
return dictDataMapper.selectDictLabel(dictType, dictValue);
}
/**
* 根据字典数据ID查询信息
*
*
* @param dictCode 字典数据ID
* @return 字典数据
*/
@Override
public SysDictData selectDictDataById(Long dictCode)
{
public SysDictData selectDictDataById(Long dictCode) {
return dictDataMapper.selectDictDataById(dictCode);
}
/**
* 批量删除字典数据信息
*
*
* @param dictCodes 需要删除的字典数据ID
* @return 结果
*/
@Override
public int deleteDictDataByIds(Long[] dictCodes)
{
public int deleteDictDataByIds(Long[] dictCodes) {
int row = dictDataMapper.deleteDictDataByIds(dictCodes);
if (row > 0)
{
if (row > 0) {
DictUtils.clearDictCache();
}
return row;
@ -75,16 +71,14 @@ public class SysDictDataServiceImpl implements ISysDictDataService
/**
* 新增保存字典数据信息
*
*
* @param dictData 字典数据信息
* @return 结果
*/
@Override
public int insertDictData(SysDictData dictData)
{
public int insertDictData(SysDictData dictData) {
int row = dictDataMapper.insertDictData(dictData);
if (row > 0)
{
if (row > 0) {
DictUtils.clearDictCache();
}
return row;
@ -92,16 +86,14 @@ public class SysDictDataServiceImpl implements ISysDictDataService
/**
* 修改保存字典数据信息
*
*
* @param dictData 字典数据信息
* @return 结果
*/
@Override
public int updateDictData(SysDictData dictData)
{
public int updateDictData(SysDictData dictData) {
int row = dictDataMapper.updateDictData(dictData);
if (row > 0)
{
if (row > 0) {
DictUtils.clearDictCache();
}
return row;

View File

@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -17,12 +18,11 @@ import com.ruoyi.system.service.ISysDictTypeService;
/**
* 字典 业务层处理
*
*
* @author ruoyi
*/
@Service
public class SysDictTypeServiceImpl implements ISysDictTypeService
{
public class SysDictTypeServiceImpl implements ISysDictTypeService {
@Autowired
private SysDictTypeMapper dictTypeMapper;
@ -33,11 +33,9 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
* 项目启动时初始化字典到缓存
*/
@PostConstruct
public void init()
{
public void init() {
List<SysDictType> dictTypeList = dictTypeMapper.selectDictTypeAll();
for (SysDictType dictType : dictTypeList)
{
for (SysDictType dictType : dictTypeList) {
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType());
DictUtils.setDictCache(dictType.getDictType(), dictDatas);
}
@ -45,44 +43,39 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/**
* 根据条件分页查询字典类型
*
*
* @param dictType 字典类型信息
* @return 字典类型集合信息
*/
@Override
public List<SysDictType> selectDictTypeList(SysDictType dictType)
{
public List<SysDictType> selectDictTypeList(SysDictType dictType) {
return dictTypeMapper.selectDictTypeList(dictType);
}
/**
* 根据所有字典类型
*
*
* @return 字典类型集合信息
*/
@Override
public List<SysDictType> selectDictTypeAll()
{
public List<SysDictType> selectDictTypeAll() {
return dictTypeMapper.selectDictTypeAll();
}
/**
* 根据字典类型查询字典数据
*
*
* @param dictType 字典类型
* @return 字典数据集合信息
*/
@Override
public List<SysDictData> selectDictDataByType(String dictType)
{
public List<SysDictData> selectDictDataByType(String dictType) {
List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
if (StringUtils.isNotEmpty(dictDatas))
{
if (StringUtils.isNotEmpty(dictDatas)) {
return dictDatas;
}
dictDatas = dictDataMapper.selectDictDataByType(dictType);
if (StringUtils.isNotEmpty(dictDatas))
{
if (StringUtils.isNotEmpty(dictDatas)) {
DictUtils.setDictCache(dictType, dictDatas);
return dictDatas;
}
@ -91,74 +84,58 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/**
* 根据字典类型ID查询信息
*
*
* @param dictId 字典类型ID
* @return 字典类型
*/
@Override
public SysDictType selectDictTypeById(Long dictId)
{
public SysDictType selectDictTypeById(Long dictId) {
return dictTypeMapper.selectDictTypeById(dictId);
}
/**
* 根据字典类型查询信息
*
*
* @param dictType 字典类型
* @return 字典类型
*/
@Override
public SysDictType selectDictTypeByType(String dictType)
{
public SysDictType selectDictTypeByType(String dictType) {
return dictTypeMapper.selectDictTypeByType(dictType);
}
/**
* 批量删除字典类型信息
*
*
* @param dictIds 需要删除的字典ID
* @return 结果
*/
@Override
public int deleteDictTypeByIds(Long[] dictIds)
{
for (Long dictId : dictIds)
{
public int deleteDictTypeByIds(Long[] dictIds) {
for (Long dictId : dictIds) {
SysDictType dictType = selectDictTypeById(dictId);
if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0)
{
if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0) {
throw new CustomException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
}
}
int count = dictTypeMapper.deleteDictTypeByIds(dictIds);
if (count > 0)
{
if (count > 0) {
DictUtils.clearDictCache();
}
return count;
}
/**
* 清空缓存数据
*/
@Override
public void clearCache()
{
DictUtils.clearDictCache();
}
/**
* 新增保存字典类型信息
*
*
* @param dictType 字典类型信息
* @return 结果
*/
@Override
public int insertDictType(SysDictType dictType)
{
public int insertDictType(SysDictType dictType) {
int row = dictTypeMapper.insertDictType(dictType);
if (row > 0)
{
if (row > 0) {
DictUtils.clearDictCache();
}
return row;
@ -166,19 +143,17 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/**
* 修改保存字典类型信息
*
*
* @param dictType 字典类型信息
* @return 结果
*/
@Override
@Transactional
public int updateDictType(SysDictType dictType)
{
public int updateDictType(SysDictType dictType) {
SysDictType oldDict = dictTypeMapper.selectDictTypeById(dictType.getDictId());
dictDataMapper.updateDictDataType(oldDict.getDictType(), dictType.getDictType());
int row = dictTypeMapper.updateDictType(dictType);
if (row > 0)
{
if (row > 0) {
DictUtils.clearDictCache();
}
return row;
@ -186,17 +161,15 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/**
* 校验字典类型称是否唯一
*
*
* @param dict 字典类型
* @return 结果
*/
@Override
public String checkDictTypeUnique(SysDictType dict)
{
public String checkDictTypeUnique(SysDictType dict) {
Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue())
{
if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;

View File

@ -1,6 +1,7 @@
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;
@ -9,48 +10,44 @@ import com.ruoyi.system.service.ISysLogininforService;
/**
* 系统访问日志情况信息 服务层处理
*
*
* @author ruoyi
*/
@Service
public class SysLogininforServiceImpl implements ISysLogininforService
{
public class SysLogininforServiceImpl implements ISysLogininforService {
@Autowired
private SysLogininforMapper logininforMapper;
/**
* 新增系统登录日志
*
*
* @param logininfor 访问日志对象
*/
@Override
public void insertLogininfor(SysLogininfor logininfor)
{
public void insertLogininfor(SysLogininfor logininfor) {
logininforMapper.insertLogininfor(logininfor);
}
/**
* 查询系统登录日志集合
*
*
* @param logininfor 访问日志对象
* @return 登录记录集合
*/
@Override
public List<SysLogininfor> selectLogininforList(SysLogininfor logininfor)
{
public List<SysLogininfor> selectLogininforList(SysLogininfor logininfor) {
return logininforMapper.selectLogininforList(logininfor);
}
/**
* 批量删除系统登录日志
*
*
* @param infoIds 需要删除的登录日志ID
* @return
*/
@Override
public int deleteLogininforByIds(Long[] infoIds)
{
public int deleteLogininforByIds(Long[] infoIds) {
return logininforMapper.deleteLogininforByIds(infoIds);
}
@ -58,8 +55,7 @@ public class SysLogininforServiceImpl implements ISysLogininforService
* 清空系统登录日志
*/
@Override
public void cleanLogininfor()
{
public void cleanLogininfor() {
logininforMapper.cleanLogininfor();
}
}

View File

@ -1,101 +0,0 @@
package com.ruoyi.system.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.vo.MetaVo;
import com.ruoyi.system.domain.vo.RouterVo;
import com.ruoyi.system.mapper.SysMenuMapper;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.mapper.SysRoleMenuMapper;
import com.ruoyi.system.service.ISysMenuService;
/**
* 菜单 业务层处理
*
* @author ruoyi
*/
@Service
public class SysMenuServiceImpl implements ISysMenuService {
/**
* 根据用户查询系统菜单列表
*
* @param userId 用户ID
* @return 菜单列表
*/
@Override
public List<SysMenu> selectMenuList(Long userId) {
return selectMenuList(new SysMenu(), userId);
}
/**
* 查询系统菜单列表
*
* @param menu 菜单信息
* @return 菜单列表
*/
@Override
public List<SysMenu> selectMenuList(SysMenu menu, Long userId) {
List<SysMenu> menuList = null;
// 管理员显示所有菜单信息
if (SysUser.isAdmin(userId)) {
menuList = menuMapper.selectMenuList(menu);
} else {
menu.getParams().put("userId", userId);
menuList = menuMapper.selectMenuListByUserId(menu);
}
return menuList;
}
/**
* 根据用户ID查询权限
*
* @param userId 用户ID
* @return 权限列表
*/
@Override
public Set<String> selectMenuPermsByUserId(Long userId) {
List<String> perms = menuMapper.selectMenuPermsByUserId(userId);
Set<String> permsSet = new HashSet<>();
for (String perm : perms) {
if (StringUtils.isNotEmpty(perm)) {
permsSet.addAll(Arrays.asList(perm.trim().split(",")));
}
}
return permsSet;
}
/**
* 根据用户ID查询菜单
*
* @param userId 用户名称
* @return 菜单列表
*/
@Override
public List<SysMenu> selectMenuTreeByUserId(Long userId) {
List<SysMenu> menus = null;
if (SecurityUtils.isAdmin(userId)) {
menus = menuMapper.selectMenuTreeAll();
} else {
menus = menuMapper.selectMenuTreeByUserId(userId);
}
return getChildPerms(menus, 0);
}
}

View File

@ -1,6 +1,7 @@
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.SysNotice;
@ -9,84 +10,77 @@ import com.ruoyi.system.service.ISysNoticeService;
/**
* 公告 服务层实现
*
*
* @author ruoyi
*/
@Service
public class SysNoticeServiceImpl implements ISysNoticeService
{
public class SysNoticeServiceImpl implements ISysNoticeService {
@Autowired
private SysNoticeMapper noticeMapper;
/**
* 查询公告信息
*
*
* @param noticeId 公告ID
* @return 公告信息
*/
@Override
public SysNotice selectNoticeById(Long noticeId)
{
public SysNotice selectNoticeById(Long noticeId) {
return noticeMapper.selectNoticeById(noticeId);
}
/**
* 查询公告列表
*
*
* @param notice 公告信息
* @return 公告集合
*/
@Override
public List<SysNotice> selectNoticeList(SysNotice notice)
{
public List<SysNotice> selectNoticeList(SysNotice notice) {
return noticeMapper.selectNoticeList(notice);
}
/**
* 新增公告
*
*
* @param notice 公告信息
* @return 结果
*/
@Override
public int insertNotice(SysNotice notice)
{
public int insertNotice(SysNotice notice) {
return noticeMapper.insertNotice(notice);
}
/**
* 修改公告
*
*
* @param notice 公告信息
* @return 结果
*/
@Override
public int updateNotice(SysNotice notice)
{
public int updateNotice(SysNotice notice) {
return noticeMapper.updateNotice(notice);
}
/**
* 删除公告对象
*
*
* @param noticeId 公告ID
* @return 结果
*/
@Override
public int deleteNoticeById(Long noticeId)
{
public int deleteNoticeById(Long noticeId) {
return noticeMapper.deleteNoticeById(noticeId);
}
/**
* 批量删除公告信息
*
*
* @param noticeIds 需要删除的公告ID
* @return 结果
*/
@Override
public int deleteNoticeByIds(Long[] noticeIds)
{
public int deleteNoticeByIds(Long[] noticeIds) {
return noticeMapper.deleteNoticeByIds(noticeIds);
}
}

View File

@ -1,6 +1,7 @@
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;
@ -9,59 +10,54 @@ import com.ruoyi.system.service.ISysOperLogService;
/**
* 操作日志 服务层处理
*
*
* @author ruoyi
*/
@Service
public class SysOperLogServiceImpl implements ISysOperLogService
{
public class SysOperLogServiceImpl implements ISysOperLogService {
@Autowired
private SysOperLogMapper operLogMapper;
/**
* 新增操作日志
*
*
* @param operLog 操作日志对象
*/
@Override
public void insertOperlog(SysOperLog operLog)
{
public void insertOperlog(SysOperLog operLog) {
operLogMapper.insertOperlog(operLog);
}
/**
* 查询系统操作日志集合
*
*
* @param operLog 操作日志对象
* @return 操作日志集合
*/
@Override
public List<SysOperLog> selectOperLogList(SysOperLog operLog)
{
public List<SysOperLog> selectOperLogList(SysOperLog operLog) {
return operLogMapper.selectOperLogList(operLog);
}
/**
* 批量删除系统操作日志
*
*
* @param operIds 需要删除的操作日志ID
* @return 结果
*/
@Override
public int deleteOperLogByIds(Long[] operIds)
{
public int deleteOperLogByIds(Long[] operIds) {
return operLogMapper.deleteOperLogByIds(operIds);
}
/**
* 查询操作日志详细
*
*
* @param operId 操作ID
* @return 操作日志对象
*/
@Override
public SysOperLog selectOperLogById(Long operId)
{
public SysOperLog selectOperLogById(Long operId) {
return operLogMapper.selectOperLogById(operId);
}
@ -69,8 +65,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
* 清空操作日志
*/
@Override
public void cleanOperLog()
{
public void cleanOperLog() {
operLogMapper.cleanOperLog();
}
}

View File

@ -1,179 +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.common.constant.UserConstants;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.mapper.SysPostMapper;
import com.ruoyi.system.mapper.SysUserPostMapper;
import com.ruoyi.system.service.ISysPostService;
/**
* 岗位信息 服务层处理
*
* @author ruoyi
*/
@Service
public class SysPostServiceImpl implements ISysPostService
{
@Autowired
private SysPostMapper postMapper;
@Autowired
private SysUserPostMapper userPostMapper;
/**
* 查询岗位信息集合
*
* @param post 岗位信息
* @return 岗位信息集合
*/
@Override
public List<SysPost> selectPostList(SysPost post)
{
return postMapper.selectPostList(post);
}
/**
* 查询所有岗位
*
* @return 岗位列表
*/
@Override
public List<SysPost> selectPostAll()
{
return postMapper.selectPostAll();
}
/**
* 通过岗位ID查询岗位信息
*
* @param postId 岗位ID
* @return 角色对象信息
*/
@Override
public SysPost selectPostById(Long postId)
{
return postMapper.selectPostById(postId);
}
/**
* 根据用户ID获取岗位选择框列表
*
* @param userId 用户ID
* @return 选中岗位ID列表
*/
@Override
public List<Integer> selectPostListByUserId(Long userId)
{
return postMapper.selectPostListByUserId(userId);
}
/**
* 校验岗位名称是否唯一
*
* @param post 岗位信息
* @return 结果
*/
@Override
public String checkPostNameUnique(SysPost post)
{
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
SysPost info = postMapper.checkPostNameUnique(post.getPostName());
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 校验岗位编码是否唯一
*
* @param post 岗位信息
* @return 结果
*/
@Override
public String checkPostCodeUnique(SysPost post)
{
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
SysPost info = postMapper.checkPostCodeUnique(post.getPostCode());
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 通过岗位ID查询岗位使用数量
*
* @param postId 岗位ID
* @return 结果
*/
@Override
public int countUserPostById(Long postId)
{
return userPostMapper.countUserPostById(postId);
}
/**
* 删除岗位信息
*
* @param postId 岗位ID
* @return 结果
*/
@Override
public int deletePostById(Long postId)
{
return postMapper.deletePostById(postId);
}
/**
* 批量删除岗位信息
*
* @param postIds 需要删除的岗位ID
* @return 结果
* @throws Exception 异常
*/
@Override
public int deletePostByIds(Long[] postIds)
{
for (Long postId : postIds)
{
SysPost post = selectPostById(postId);
if (countUserPostById(postId) > 0)
{
throw new CustomException(String.format("%1$s已分配,不能删除", post.getPostName()));
}
}
return postMapper.deletePostByIds(postIds);
}
/**
* 新增保存岗位信息
*
* @param post 岗位信息
* @return 结果
*/
@Override
public int insertPost(SysPost post)
{
return postMapper.insertPost(post);
}
/**
* 修改保存岗位信息
*
* @param post 岗位信息
* @return 结果
*/
@Override
public int updatePost(SysPost post)
{
return postMapper.updatePost(post);
}
}

View File

@ -8,24 +8,21 @@ import com.ruoyi.system.service.ISysUserOnlineService;
/**
* 在线用户 服务层处理
*
*
* @author ruoyi
*/
@Service
public class SysUserOnlineServiceImpl implements ISysUserOnlineService
{
public class SysUserOnlineServiceImpl implements ISysUserOnlineService {
/**
* 通过登录地址查询信息
*
*
* @param ipaddr 登录地址
* @param user 用户信息
* @param user 用户信息
* @return 在线用户信息
*/
@Override
public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user)
{
if (StringUtils.equals(ipaddr, user.getIpaddr()))
{
public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user) {
if (StringUtils.equals(ipaddr, user.getIpaddr())) {
return loginUserToUserOnline(user);
}
return null;
@ -33,16 +30,14 @@ public class SysUserOnlineServiceImpl implements ISysUserOnlineService
/**
* 通过用户名称查询信息
*
*
* @param userName 用户名称
* @param user 用户信息
* @param user 用户信息
* @return 在线用户信息
*/
@Override
public SysUserOnline selectOnlineByUserName(String userName, LoginUser user)
{
if (StringUtils.equals(userName, user.getUsername()))
{
public SysUserOnline selectOnlineByUserName(String userName, LoginUser user) {
if (StringUtils.equals(userName, user.getUsername())) {
return loginUserToUserOnline(user);
}
return null;
@ -50,17 +45,15 @@ public class SysUserOnlineServiceImpl implements ISysUserOnlineService
/**
* 通过登录地址/用户名称查询信息
*
* @param ipaddr 登录地址
*
* @param ipaddr 登录地址
* @param userName 用户名称
* @param user 用户信息
* @param user 用户信息
* @return 在线用户信息
*/
@Override
public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user)
{
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
{
public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user) {
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername())) {
return loginUserToUserOnline(user);
}
return null;
@ -68,15 +61,13 @@ public class SysUserOnlineServiceImpl implements ISysUserOnlineService
/**
* 设置在线用户信息
*
*
* @param user 用户信息
* @return 在线用户
*/
@Override
public SysUserOnline loginUserToUserOnline(LoginUser user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUser()))
{
public SysUserOnline loginUserToUserOnline(LoginUser user) {
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUser())) {
return null;
}
SysUserOnline sysUserOnline = new SysUserOnline();
@ -87,8 +78,7 @@ public class SysUserOnlineServiceImpl implements ISysUserOnlineService
sysUserOnline.setBrowser(user.getBrowser());
sysUserOnline.setOs(user.getOs());
sysUserOnline.setLoginTime(user.getLoginTime());
if (StringUtils.isNotNull(user.getUser().getDept()))
{
if (StringUtils.isNotNull(user.getUser().getDept())) {
sysUserOnline.setDeptName(user.getUser().getDept().getDeptName());
}
return sysUserOnline;

View File

@ -1,157 +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.SysDeptMapper">
<resultMap type="SysDept" id="SysDeptResult">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="parentName" column="parent_name" />
<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="selectDeptVo">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
from sys_dept d
</sql>
<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0'
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by d.parent_id, d.order_num
</select>
<select id="selectDeptListByRoleId" resultType="Integer">
select d.dept_id
from sys_dept d
left join sys_role_dept rd on d.dept_id = rd.dept_id
where rd.role_id = #{roleId}
<if test="deptCheckStrictly">
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
</if>
order by d.parent_id, d.order_num
</select>
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where dept_id = #{deptId}
</select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
</select>
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
select count(1) from sys_dept
where del_flag = '0' and parent_id = #{deptId} limit 1
</select>
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
select * from sys_dept where find_in_set(#{deptId}, ancestors)
</select>
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
</select>
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} limit 1
</select>
<insert id="insertDept" parameterType="SysDept">
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null and orderNum != ''">order_num,</if>
<if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateDept" parameterType="SysDept">
update sys_dept
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where dept_id = #{deptId}
</update>
<update id="updateDeptChildren" parameterType="java.util.List">
update sys_dept set ancestors =
<foreach collection="depts" item="item" index="index"
separator=" " open="case dept_id" close="end">
when #{item.deptId} then #{item.ancestors}
</foreach>
where dept_id in
<foreach collection="depts" item="item" index="index"
separator="," open="(" close=")">
#{item.deptId}
</foreach>
</update>
<update id="updateDeptStatus" parameterType="SysDept">
update sys_dept
<set>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where dept_id in (${ancestors})
</update>
<delete id="deleteDeptById" parameterType="Long">
update sys_dept set del_flag = '2' where dept_id = #{deptId}
</delete>
</mapper>

View File

@ -1,124 +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.SysDictDataMapper">
<resultMap type="SysDictData" id="SysDictDataResult">
<id property="dictCode" column="dict_code" />
<result property="dictSort" column="dict_sort" />
<result property="dictLabel" column="dict_label" />
<result property="dictValue" column="dict_value" />
<result property="dictType" column="dict_type" />
<result property="cssClass" column="css_class" />
<result property="listClass" column="list_class" />
<result property="isDefault" column="is_default" />
<result property="status" column="status" />
<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="selectDictDataVo">
select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
from sys_dict_data
</sql>
<select id="selectDictDataList" parameterType="SysDictData" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/>
<where>
<if test="dictType != null and dictType != ''">
AND dict_type = #{dictType}
</if>
<if test="dictLabel != null and dictLabel != ''">
AND dict_label like concat('%', #{dictLabel}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
</where>
order by dict_sort asc
</select>
<select id="selectDictDataByType" parameterType="SysDictData" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/>
where status = '0' and dict_type = #{dictType} order by dict_sort asc
</select>
<select id="selectDictLabel" resultType="String">
select dict_label from sys_dict_data
where dict_type = #{dictType} and dict_value = #{dictValue}
</select>
<select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/>
where dict_code = #{dictCode}
</select>
<select id="countDictDataByType" resultType="Integer">
select count(1) from sys_dict_data where dict_type=#{dictType}
</select>
<delete id="deleteDictDataById" parameterType="Long">
delete from sys_dict_data where dict_code = #{dictCode}
</delete>
<delete id="deleteDictDataByIds" parameterType="Long">
delete from sys_dict_data where dict_code in
<foreach collection="array" item="dictCode" open="(" separator="," close=")">
#{dictCode}
</foreach>
</delete>
<update id="updateDictData" parameterType="SysDictData">
update sys_dict_data
<set>
<if test="dictSort != null">dict_sort = #{dictSort},</if>
<if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
<if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
<if test="cssClass != null">css_class = #{cssClass},</if>
<if test="listClass != null">list_class = #{listClass},</if>
<if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where dict_code = #{dictCode}
</update>
<update id="updateDictDataType" parameterType="String">
update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
</update>
<insert id="insertDictData" parameterType="SysDictData">
insert into sys_dict_data(
<if test="dictSort != null">dict_sort,</if>
<if test="dictLabel != null and dictLabel != ''">dict_label,</if>
<if test="dictValue != null and dictValue != ''">dict_value,</if>
<if test="dictType != null and dictType != ''">dict_type,</if>
<if test="cssClass != null and cssClass != ''">css_class,</if>
<if test="listClass != null and listClass != ''">list_class,</if>
<if test="isDefault != null and isDefault != ''">is_default,</if>
<if test="status != null">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="dictSort != null">#{dictSort},</if>
<if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
<if test="dictValue != null and dictValue != ''">#{dictValue},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="cssClass != null and cssClass != ''">#{cssClass},</if>
<if test="listClass != null and listClass != ''">#{listClass},</if>
<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
<if test="status != null">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
</mapper>

View File

@ -1,105 +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.SysDictTypeMapper">
<resultMap type="SysDictType" id="SysDictTypeResult">
<id property="dictId" column="dict_id" />
<result property="dictName" column="dict_name" />
<result property="dictType" column="dict_type" />
<result property="status" column="status" />
<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="selectDictTypeVo">
select dict_id, dict_name, dict_type, status, create_by, create_time, remark
from sys_dict_type
</sql>
<select id="selectDictTypeList" parameterType="SysDictType" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
<where>
<if test="dictName != null and dictName != ''">
AND dict_name like concat('%', #{dictName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="dictType != null and dictType != ''">
AND dict_type like concat('%', #{dictType}, '%')
</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="selectDictTypeAll" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
</select>
<select id="selectDictTypeById" parameterType="Long" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_id = #{dictId}
</select>
<select id="selectDictTypeByType" parameterType="String" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_type = #{dictType}
</select>
<select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_type = #{dictType} limit 1
</select>
<delete id="deleteDictTypeById" parameterType="Long">
delete from sys_dict_type where dict_id = #{dictId}
</delete>
<delete id="deleteDictTypeByIds" parameterType="Long">
delete from sys_dict_type where dict_id in
<foreach collection="array" item="dictId" open="(" separator="," close=")">
#{dictId}
</foreach>
</delete>
<update id="updateDictType" parameterType="SysDictType">
update sys_dict_type
<set>
<if test="dictName != null and dictName != ''">dict_name = #{dictName},</if>
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where dict_id = #{dictId}
</update>
<insert id="insertDictType" parameterType="SysDictType">
insert into sys_dict_type(
<if test="dictName != null and dictName != ''">dict_name,</if>
<if test="dictType != null and dictType != ''">dict_type,</if>
<if test="status != null">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="dictName != null and dictName != ''">#{dictName},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="status != null">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
</mapper>

View File

@ -1,63 +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.SysMenuMapper">
<select id="selectMenuTreeAll" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0
order by m.parent_id, m.order_num
</select>
<select id="selectMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role ro on ur.role_id = ro.role_id
where ur.user_id = #{params.userId}
<if test="menuName != null and menuName != ''">
AND menu_name like concat('%', #{menuName}, '%')
</if>
<if test="visible != null and visible != ''">
AND visible = #{visible}
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
order by m.parent_id, m.order_num
</select>
<select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role ro on ur.role_id = ro.role_id
left join sys_user u on ur.user_id = u.user_id
where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0 AND ro.status = 0
order by m.parent_id, m.order_num
</select>
<select id="selectMenuListByRoleId" resultType="Integer">
select m.menu_id
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
where rm.role_id = #{roleId}
<if test="menuCheckStrictly">
and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_role_menu rm on m.menu_id = rm.menu_id and rm.role_id = #{roleId})
</if>
order by m.parent_id, m.order_num
</select>
<select id="selectMenuPermsByUserId" parameterType="Long" resultType="String">
select distinct m.perms
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role r on r.role_id = ur.role_id
where m.status = '0' and r.status = '0' and ur.user_id = #{userId}
</select>
</mapper>

View File

@ -1,122 +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.SysPostMapper">
<resultMap type="SysPost" id="SysPostResult">
<id property="postId" column="post_id" />
<result property="postCode" column="post_code" />
<result property="postName" column="post_name" />
<result property="postSort" column="post_sort" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectPostVo">
select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
from sys_post
</sql>
<select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult">
<include refid="selectPostVo"/>
<where>
<if test="postCode != null and postCode != ''">
AND post_code like concat('%', #{postCode}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="postName != null and postName != ''">
AND post_name like concat('%', #{postName}, '%')
</if>
</where>
</select>
<select id="selectPostAll" resultMap="SysPostResult">
<include refid="selectPostVo"/>
</select>
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_id = #{postId}
</select>
<select id="selectPostListByUserId" parameterType="Long" resultType="Integer">
select p.post_id
from sys_post p
left join sys_user_post up on up.post_id = p.post_id
left join sys_user u on u.user_id = up.user_id
where u.user_id = #{userId}
</select>
<select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult">
select p.post_id, p.post_name, p.post_code
from sys_post p
left join sys_user_post up on up.post_id = p.post_id
left join sys_user u on u.user_id = up.user_id
where u.user_name = #{userName}
</select>
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_name=#{postName} limit 1
</select>
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_code=#{postCode} limit 1
</select>
<update id="updatePost" parameterType="SysPost">
update sys_post
<set>
<if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
<if test="postName != null and postName != ''">post_name = #{postName},</if>
<if test="postSort != null and postSort != ''">post_sort = #{postSort},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where post_id = #{postId}
</update>
<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId">
insert into sys_post(
<if test="postId != null and postId != 0">post_id,</if>
<if test="postCode != null and postCode != ''">post_code,</if>
<if test="postName != null and postName != ''">post_name,</if>
<if test="postSort != null and postSort != ''">post_sort,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="postId != null and postId != 0">#{postId},</if>
<if test="postCode != null and postCode != ''">#{postCode},</if>
<if test="postName != null and postName != ''">#{postName},</if>
<if test="postSort != null and postSort != ''">#{postSort},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<delete id="deletePostById" parameterType="Long">
delete from sys_post where post_id = #{postId}
</delete>
<delete id="deletePostByIds" parameterType="Long">
delete from sys_post where post_id in
<foreach collection="array" item="postId" open="(" separator="," close=")">
#{postId}
</foreach>
</delete>
</mapper>

View File

@ -1,34 +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.SysRoleDeptMapper">
<resultMap type="SysRoleDept" id="SysRoleDeptResult">
<result property="roleId" column="role_id" />
<result property="deptId" column="dept_id" />
</resultMap>
<delete id="deleteRoleDeptByRoleId" parameterType="Long">
delete from sys_role_dept where role_id=#{roleId}
</delete>
<select id="selectCountRoleDeptByDeptId" resultType="Integer">
select count(1) from sys_role_dept where dept_id=#{deptId}
</select>
<delete id="deleteRoleDept" parameterType="Long">
delete from sys_role_dept where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
<insert id="batchRoleDept">
insert into sys_role_dept(role_id, dept_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.roleId},#{item.deptId})
</foreach>
</insert>
</mapper>

View File

@ -1,153 +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.SysRoleMapper">
<resultMap type="SysRole" id="SysRoleResult">
<id property="roleId" column="role_id" />
<result property="roleName" column="role_name" />
<result property="roleKey" column="role_key" />
<result property="roleSort" column="role_sort" />
<result property="dataScope" column="data_scope" />
<result property="menuCheckStrictly" column="menu_check_strictly" />
<result property="deptCheckStrictly" column="dept_check_strictly" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectRoleVo">
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
r.status, r.del_flag, r.create_time, r.remark
from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id
left join sys_dept d on u.dept_id = d.dept_id
</sql>
<select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.del_flag = '0'
<if test="roleName != null and roleName != ''">
AND r.role_name like concat('%', #{roleName}, '%')
</if>
<if test="status != null and status != ''">
AND r.status = #{status}
</if>
<if test="roleKey != null and roleKey != ''">
AND r.role_key like concat('%', #{roleKey}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(r.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(r.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by r.role_sort
</select>
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and ur.user_id = #{userId}
</select>
<select id="selectRoleAll" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
</select>
<select id="selectRoleListByUserId" parameterType="Long" resultType="Integer">
select r.role_id
from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id
where u.user_id = #{userId}
</select>
<select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.role_id = #{roleId}
</select>
<select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and u.user_name = #{userName}
</select>
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.role_name=#{roleName} limit 1
</select>
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.role_key=#{roleKey} limit 1
</select>
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
insert into sys_role(
<if test="roleId != null and roleId != 0">role_id,</if>
<if test="roleName != null and roleName != ''">role_name,</if>
<if test="roleKey != null and roleKey != ''">role_key,</if>
<if test="roleSort != null and roleSort != ''">role_sort,</if>
<if test="dataScope != null and dataScope != ''">data_scope,</if>
<if test="menuCheckStrictly != null">menu_check_strictly,</if>
<if test="deptCheckStrictly != null">dept_check_strictly,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="roleId != null and roleId != 0">#{roleId},</if>
<if test="roleName != null and roleName != ''">#{roleName},</if>
<if test="roleKey != null and roleKey != ''">#{roleKey},</if>
<if test="roleSort != null and roleSort != ''">#{roleSort},</if>
<if test="dataScope != null and dataScope != ''">#{dataScope},</if>
<if test="menuCheckStrictly != null">#{menuCheckStrictly},</if>
<if test="deptCheckStrictly != null">#{deptCheckStrictly},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateRole" parameterType="SysRole">
update sys_role
<set>
<if test="roleName != null and roleName != ''">role_name = #{roleName},</if>
<if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if>
<if test="roleSort != null and roleSort != ''">role_sort = #{roleSort},</if>
<if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if>
<if test="menuCheckStrictly != null">menu_check_strictly = #{menuCheckStrictly},</if>
<if test="deptCheckStrictly != null">dept_check_strictly = #{deptCheckStrictly},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where role_id = #{roleId}
</update>
<update id="updateRoleStatus" parameterType="SysRole">
update sys_user set status = #{status} where user_id = #{userId}
</update>
<delete id="deleteRoleById" parameterType="Long">
delete from sys_role where role_id = #{roleId}
</delete>
<delete id="deleteRoleByIds" parameterType="Long">
update sys_role set del_flag = '2' where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
</mapper>

View File

@ -1,182 +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.SysUserMapper">
<resultMap type="SysUser" id="SysUserResult">
<id property="userId" column="user_id" />
<result property="deptId" column="dept_id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="email" column="email" />
<result property="phonenumber" column="phonenumber" />
<result property="sex" column="sex" />
<result property="avatar" column="avatar" />
<result property="password" column="password" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="loginIp" column="login_ip" />
<result property="loginDate" column="login_date" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap>
<resultMap id="deptResult" type="SysDept">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="deptName" column="dept_name" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="status" column="dept_status" />
</resultMap>
<resultMap id="RoleResult" type="SysRole">
<id property="roleId" column="role_id" />
<result property="roleName" column="role_name" />
<result property="roleKey" column="role_key" />
<result property="roleSort" column="role_sort" />
<result property="dataScope" column="data_scope" />
<result property="status" column="role_status" />
</resultMap>
<sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role r on r.role_id = ur.role_id
</sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0'
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="status != null and status != ''">
AND u.status = #{status}
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(u.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(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
<if test="deptId != null and deptId != 0">
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.user_name = #{userName}
</select>
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.user_id = #{userId}
</select>
<select id="checkUserNameUnique" parameterType="String" resultType="int">
select count(1) from sys_user where user_name = #{userName} limit 1
</select>
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1
</select>
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
select user_id, email from sys_user where email = #{email} limit 1
</select>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_user(
<if test="userId != null and userId != 0">user_id,</if>
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="nickName != null and nickName != ''">nick_name,</if>
<if test="email != null and email != ''">email,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
<if test="sex != null and sex != ''">sex,</if>
<if test="password != null and password != ''">password,</if>
<if test="status != null and status != ''">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
<if test="sex != null and sex != ''">#{sex},</if>
<if test="password != null and password != ''">#{password},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
<update id="updateUser" parameterType="SysUser">
update sys_user
<set>
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="email != null ">email = #{email},</if>
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if>
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
<if test="password != null and password != ''">password = #{password},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
<if test="loginDate != null">login_date = #{loginDate},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where user_id = #{userId}
</update>
<update id="updateUserStatus" parameterType="SysUser">
update sys_user set status = #{status} where user_id = #{userId}
</update>
<update id="updateUserAvatar" parameterType="SysUser">
update sys_user set avatar = #{avatar} where user_name = #{userName}
</update>
<update id="resetUserPwd" parameterType="SysUser">
update sys_user set password = #{password} where user_name = #{userName}
</update>
<delete id="deleteUserById" parameterType="Long">
delete from sys_user where user_id = #{userId}
</delete>
<delete id="deleteUserByIds" parameterType="Long">
update sys_user set del_flag = '2' where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
</mapper>

View File

@ -1,34 +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.SysUserPostMapper">
<resultMap type="SysUserPost" id="SysUserPostResult">
<result property="userId" column="user_id" />
<result property="postId" column="post_id" />
</resultMap>
<delete id="deleteUserPostByUserId" parameterType="Long">
delete from sys_user_post where user_id=#{userId}
</delete>
<select id="countUserPostById" resultType="Integer">
select count(1) from sys_user_post where post_id=#{postId}
</select>
<delete id="deleteUserPost" parameterType="Long">
delete from sys_user_post where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<insert id="batchUserPost">
insert into sys_user_post(user_id, post_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.userId},#{item.postId})
</foreach>
</insert>
</mapper>

View File

@ -0,0 +1,35 @@
package cn.iocoder.dashboard.framework.dict.core.service;
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictDataDO;
import java.util.List;
public interface DictDataFrameworkService {
/**
* 获得指定的字典数据从缓存中
*
* @param type 字典类型
* @param value 字典数据值
* @return 字典数据
*/
SysDictDataDO getDictDataFromCache(String type, String value);
/**
* 解析获得指定的字典数据从缓存中
*
* @param type 字典类型
* @param label 字典数据标签
* @return 字典数据
*/
SysDictDataDO parseDictDataFromCache(String type, String label);
/**
* 获得指定类型的字典数据从缓存中
*
* @param type 字典类型
* @return 字典数据列表
*/
List<SysDictDataDO> listDictDatasFromCache(String type);
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.dashboard.framework.dict.core.util;
import cn.iocoder.dashboard.framework.dict.core.service.DictDataFrameworkService;
import lombok.extern.slf4j.Slf4j;
/**
* 字典工具类
*/
@Slf4j
public class DictUtils {
private static DictDataFrameworkService service;
public static void init(DictDataFrameworkService service) {
DictUtils.service = service;
log.info("[init][初始化 DictUtils 成功]");
}
}

View File

@ -0,0 +1,6 @@
/**
* 字典数据模块
*
* 通过将字典缓存在内存中保证性能
*/
package cn.iocoder.dashboard.framework.dict;

View File

@ -1,7 +1,7 @@
package cn.iocoder.dashboard.modules.system.controller.dict;
import cn.iocoder.dashboard.common.pojo.CommonResult;
import cn.iocoder.dashboard.modules.system.controller.dict.vo.SysDataDictSimpleVO;
import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDataDictSimpleVO;
import cn.iocoder.dashboard.modules.system.convert.dict.SysDictDataConvert;
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictDataDO;
import cn.iocoder.dashboard.modules.system.service.dict.SysDictDataService;
@ -16,7 +16,7 @@ import java.util.List;
import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
@Api(tags = "数据字典 API")
@Api(tags = "字典数据 API")
@RestController
@RequestMapping("/system/dict-data")
public class SysDictDataController {
@ -32,4 +32,74 @@ public class SysDictDataController {
return success(SysDictDataConvert.INSTANCE.convertList(list));
}
// @PreAuthorize("@ss.hasPermi('system:dict:list')")
// @GetMapping("/list")
// public TableDataInfo list(SysDictData dictData) {
// startPage();
// List<SysDictData> list = dictDataService.selectDictDataList(dictData);
// return getDataTable(list);
// }
//
// @Log(title = "字典数据", businessType = BusinessType.EXPORT)
// @PreAuthorize("@ss.hasPermi('system:dict:export')")
// @GetMapping("/export")
// public AjaxResult export(SysDictData dictData) {
// List<SysDictData> list = dictDataService.selectDictDataList(dictData);
// ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
// return util.exportExcel(list, "字典数据");
// }
//
// /**
// * 查询字典数据详细
// */
// @PreAuthorize("@ss.hasPermi('system:dict:query')")
// @GetMapping(value = "/{dictCode}")
// public AjaxResult getInfo(@PathVariable Long dictCode) {
// return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
// }
//
// /**
// * 根据字典类型查询字典数据信息
// */
// @GetMapping(value = "/type/{dictType}")
// public AjaxResult dictType(@PathVariable String dictType) {
// List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
// if (StringUtils.isNull(data)) {
// data = new ArrayList<SysDictData>();
// }
// return AjaxResult.success(data);
// }
//
// /**
// * 新增字典类型
// */
// @PreAuthorize("@ss.hasPermi('system:dict:add')")
// @Log(title = "字典数据", businessType = BusinessType.INSERT)
// @PostMapping
// public AjaxResult add(@Validated @RequestBody SysDictData dict) {
// dict.setCreateBy(SecurityUtils.getUsername());
// return toAjax(dictDataService.insertDictData(dict));
// }
//
// /**
// * 修改保存字典类型
// */
// @PreAuthorize("@ss.hasPermi('system:dict:edit')")
// @Log(title = "字典数据", businessType = BusinessType.UPDATE)
// @PutMapping
// public AjaxResult edit(@Validated @RequestBody SysDictData dict) {
// dict.setUpdateBy(SecurityUtils.getUsername());
// return toAjax(dictDataService.updateDictData(dict));
// }
//
// /**
// * 删除字典类型
// */
// @PreAuthorize("@ss.hasPermi('system:dict:remove')")
// @Log(title = "字典类型", businessType = BusinessType.DELETE)
// @DeleteMapping("/{dictCodes}")
// public AjaxResult remove(@PathVariable Long[] dictCodes) {
// return toAjax(dictDataService.deleteDictDataByIds(dictCodes));
// }
}

View File

@ -0,0 +1,91 @@
package cn.iocoder.dashboard.modules.system.controller.dict;
import cn.iocoder.dashboard.common.pojo.CommonResult;
import cn.iocoder.dashboard.common.pojo.PageResult;
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeCreateReqVO;
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypePageReqVO;
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeRespVO;
import cn.iocoder.dashboard.modules.system.controller.user.vo.user.SysUserUpdateReqVO;
import cn.iocoder.dashboard.modules.system.convert.dict.SysDictTypeConvert;
import cn.iocoder.dashboard.modules.system.service.dict.SysDictTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
@Api(tags = "字典类型 API")
@RestController
@RequestMapping("/system/dict-type")
public class SysDictTypeController {
@Resource
private SysDictTypeService dictTypeService;
@ApiOperation("/page")
@GetMapping("/list")
// @PreAuthorize("@ss.hasPermi('system:dict:list')")
public CommonResult<PageResult<SysDictTypeRespVO>> pageDictTypes(@Validated SysDictTypePageReqVO reqVO) {
return success(SysDictTypeConvert.INSTANCE.convertPage(dictTypeService.pageDictTypes(reqVO)));
}
@ApiOperation("/查询字典详细")
@ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024")
@GetMapping(value = "/get")
// @PreAuthorize("@ss.hasPermi('system:dict:query')")
public CommonResult<SysDictTypeRespVO> getDictType(@RequestParam("id") Long id) {
return success(SysDictTypeConvert.INSTANCE.convert(dictTypeService.getDictType(id)));
}
@ApiOperation("新增字典类型")
@PostMapping("/create")
// @PreAuthorize("@ss.hasPermi('system:dict:add')")
// @Log(title = "字典类型", businessType = BusinessType.INSERT)
public CommonResult<Long> createDictType(@Validated @RequestBody SysDictTypeCreateReqVO reqVO) {
Long dictTypeId = dictTypeService.createDictType(reqVO);
return success(dictTypeId);
}
@ApiOperation("修改字典类型")
@PostMapping("update")
// @PreAuthorize("@ss.hasPermi('system:dict:edit')")
// @Log(title = "字典类型", businessType = BusinessType.UPDATE)
public CommonResult<Boolean> updateDictType(@Validated @RequestBody SysUserUpdateReqVO reqVO) {
dictTypeService.updateDictType(reqVO);
return success(true);
}
@ApiOperation("删除字典类型")
@ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024")
@PostMapping("/delete")
// @PreAuthorize("@ss.hasPermi('system:dict:remove')")
public CommonResult<Boolean> deleteDictType(Long id) {
dictTypeService.deleteDictType(id);
return success(true);
}
// /**
// * 获取字典选择框列表
// */
// @GetMapping("/optionselect")
// public AjaxResult optionselect() {
// List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
// return AjaxResult.success(dictTypes);
// }
//
// @Log(title = "字典类型", businessType = BusinessType.EXPORT)
// @PreAuthorize("@ss.hasPermi('system:dict:export')")
// @GetMapping("/export")
// public AjaxResult export(SysDictType dictType) {
// List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
// ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
// return util.exportExcel(list, "字典类型");
// }
}

View File

@ -1,4 +1,4 @@
package cn.iocoder.dashboard.modules.system.controller.dict.vo;
package cn.iocoder.dashboard.modules.system.controller.dict.vo.data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

View File

@ -0,0 +1,32 @@
package cn.iocoder.dashboard.modules.system.controller.dict.vo.type;
import cn.iocoder.dashboard.framework.excel.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
/**
* 字典类型 Base VO提供给添加修改详细的子 VO 使用
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/
@Data
public class SysDictTypeBaseVO {
@ApiModelProperty(value = "字典名称", required = true, example = "性别")
@NotBlank(message = "字典名称不能为空")
@Size(max = 100, message = "字典类型名称长度不能超过100个字符")
private String name;
@ApiModelProperty(value = "字典类型", required = true, example = "sys_common_sex")
@NotBlank(message = "字典类型不能为空")
@Size(max = 100, message = "字典类型类型长度不能超过100个字符")
private String type;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举类")
@NotBlank(message = "状态不能为空")
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private Integer status;
}

View File

@ -0,0 +1,11 @@
package cn.iocoder.dashboard.modules.system.controller.dict.vo.type;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("字典类型创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class SysDictTypeCreateReqVO extends SysDictTypeBaseVO {
}

View File

@ -0,0 +1,24 @@
package cn.iocoder.dashboard.modules.system.controller.dict.vo.type;
import cn.iocoder.dashboard.framework.excel.Excel;
import lombok.Data;
/**
* 字典类型 Excel 导出响应 VO
*/
@Data
public class SysDictTypeExcelRespVO {
@Excel(name = "字典主键", cellType = Excel.ColumnType.NUMERIC)
private Long id;
@Excel(name = "字典名称")
private String name;
@Excel(name = "字典类型")
private String type;
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private Integer status;
}

View File

@ -0,0 +1,17 @@
package cn.iocoder.dashboard.modules.system.controller.dict.vo.type;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("字典类型分页列表 Request VO")
@Data
public class SysDictTypePageReqVO {
@ApiModelProperty(value = "字典类型名称", example = "芋道", notes = "模糊匹配")
private String name;
@ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
private Integer status;
}

View File

@ -0,0 +1,25 @@
package cn.iocoder.dashboard.modules.system.controller.dict.vo.type;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.util.Date;
@ApiModel("字典类型信息 Response VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SysDictTypeRespVO extends SysDictTypeBaseVO {
@ApiModelProperty(value = "字典类型编号", required = true, example = "1024")
private Integer id;
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
private Date createTime;
}

View File

@ -0,0 +1,21 @@
package cn.iocoder.dashboard.modules.system.controller.dict.vo.type;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel("字典类型精简信息 Response VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SysDictTypeSimpleRespVO {
@ApiModelProperty(value = "字典类型编号", required = true, example = "1024")
private Integer id;
@ApiModelProperty(value = "字典类型名称", required = true, example = "芋道")
private String name;
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.dashboard.modules.system.controller.dict.vo.type;
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 SysDictTypeUpdateReqVO extends SysDictTypeBaseVO {
@ApiModelProperty(value = "字典类型编号", required = true, example = "1024")
@NotNull(message = "字典类型编号不能为空")
private Long id;
}

View File

@ -1,6 +1,6 @@
package cn.iocoder.dashboard.modules.system.convert.dict;
import cn.iocoder.dashboard.modules.system.controller.dict.vo.SysDataDictSimpleVO;
import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDataDictSimpleVO;
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictDataDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

View File

@ -0,0 +1,18 @@
package cn.iocoder.dashboard.modules.system.convert.dict;
import cn.iocoder.dashboard.common.pojo.PageResult;
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeRespVO;
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface SysDictTypeConvert {
SysDictTypeConvert INSTANCE = Mappers.getMapper(SysDictTypeConvert.class);
PageResult<SysDictTypeRespVO> convertPage(PageResult<SysDictTypeDO> bean);
SysDictTypeRespVO convert(SysDictTypeDO bean);
}

View File

@ -1,7 +1,6 @@
package cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict;
import cn.iocoder.dashboard.common.enums.CommonStatusEnum;
import cn.iocoder.dashboard.framework.excel.Excel;
import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
@ -9,9 +8,6 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
/**
* 字典类型表
*
@ -26,29 +22,21 @@ public class SysDictTypeDO extends BaseDO {
* 字典主键
*/
@TableId
@Excel(name = "字典主键", cellType = Excel.ColumnType.NUMERIC)
private Long id;
/**
* 字典名称
*/
@Excel(name = "字典名称")
@NotBlank(message = "字典名称不能为空")
@Size(max = 100, message = "字典类型名称长度不能超过100个字符")
private String name;
/**
* 字典类型
*/
@TableField("dict_type")
@Excel(name = "字典类型")
@NotBlank(message = "字典类型不能为空")
@Size(max = 100, message = "字典类型类型长度不能超过100个字符")
private String type;
/**
* 状态
*
* 枚举 {@link CommonStatusEnum}
*/
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private Integer status;
}

View File

@ -0,0 +1,26 @@
package cn.iocoder.dashboard.modules.system.service.dict;
import cn.iocoder.dashboard.common.pojo.PageResult;
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeCreateReqVO;
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypePageReqVO;
import cn.iocoder.dashboard.modules.system.controller.user.vo.user.SysUserUpdateReqVO;
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO;
/**
* 字典类型 Service 接口
*
* @author 芋道源码
*/
public interface SysDictTypeService {
PageResult<SysDictTypeDO> pageDictTypes(SysDictTypePageReqVO reqVO);
SysDictTypeDO getDictType(Long id);
Long createDictType(SysDictTypeCreateReqVO reqVO);
void updateDictType(SysUserUpdateReqVO reqVO);
void deleteDictType(Long id);
}