Commit c9f9a6d6 by fengshuonan

整理了所有的数据库字段,初步修改完成

parent fa60bb4c
......@@ -45,7 +45,7 @@
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-core</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
</dependency>
<dependency>
......
......@@ -15,6 +15,7 @@
*/
package cn.stylefeng.guns;
import cn.stylefeng.guns.generator.config.GeneratorAutoConfiguration;
import cn.stylefeng.roses.core.config.WebAutoConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -27,7 +28,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* @author stylefeng
* @Date 2017/5/21 12:06
*/
@SpringBootApplication(exclude = WebAutoConfiguration.class)
@SpringBootApplication(exclude = {WebAutoConfiguration.class, GeneratorAutoConfiguration.class})
public class GunsApplication {
private final static Logger logger = LoggerFactory.getLogger(GunsApplication.class);
......@@ -35,5 +36,16 @@ public class GunsApplication {
public static void main(String[] args) {
SpringApplication.run(GunsApplication.class, args);
logger.info("GunsApplication is success!");
// GenerateParams generateParams = new GenerateParams();
//
// generateParams.setRemoveTablePrefix(new String[]{"sys_"});
// generateParams.setAuthor("stylefeng");
// generateParams.setJdbcUrl("jdbc:mysql://127.0.0.1:3306/guns?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT");
// generateParams.setGeneratorInterface(false);
// generateParams.setParentPackage("cn.stylefeng.guns.modular.system");
// generateParams.setGeneratorInterface(false);
//
// SimpleGenerator.doGeneration(generateParams);
}
}
......@@ -44,7 +44,7 @@ import java.util.HashMap;
@Configuration
@ConditionalOnProperty(prefix = "guns.muti-datasource", name = "open", havingValue = "true")
@EnableTransactionManagement(order = 2, proxyTargetClass = true)
@MapperScan(basePackages = {"cn.stylefeng.guns.modular.*.dao", "cn.stylefeng.guns.multi.mapper"})
@MapperScan(basePackages = {"cn.stylefeng.guns.modular.*.mapper", "cn.stylefeng.guns.multi.mapper"})
public class MultiDataSourceConfig {
/**
......
......@@ -32,7 +32,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@ConditionalOnProperty(prefix = "guns.muti-datasource", name = "open", havingValue = "false", matchIfMissing = true)
@EnableTransactionManagement
@MapperScan(basePackages = {"cn.stylefeng.guns.modular.*.dao"})
@MapperScan(basePackages = {"cn.stylefeng.guns.modular.*.mapper"})
public class SingleDataSourceConfig {
/**
......
......@@ -40,12 +40,12 @@ public interface Const {
/**
* 管理员id
*/
Integer ADMIN_ID = 1;
Long ADMIN_ID = 1L;
/**
* 超级管理员角色id
*/
Integer ADMIN_ROLE_ID = 1;
Long ADMIN_ROLE_ID = 1L;
/**
* 接口文档的菜单名
......
......@@ -22,8 +22,8 @@ import cn.stylefeng.guns.core.common.constant.cache.CacheKey;
import cn.stylefeng.guns.core.common.constant.state.ManagerStatus;
import cn.stylefeng.guns.core.common.constant.state.MenuStatus;
import cn.stylefeng.guns.core.log.LogObjectHolder;
import cn.stylefeng.guns.modular.system.dao.*;
import cn.stylefeng.guns.modular.system.model.*;
import cn.stylefeng.guns.modular.system.entity.*;
import cn.stylefeng.guns.modular.system.mapper.*;
import cn.stylefeng.roses.core.util.SpringContextHolder;
import cn.stylefeng.roses.core.util.ToolUtil;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
......@@ -63,7 +63,7 @@ public class ConstantFactory implements IConstantFactory {
* @Date 2017/5/9 23:41
*/
@Override
public String getUserNameById(Integer userId) {
public String getUserNameById(Long userId) {
User user = userMapper.selectById(userId);
if (user != null) {
return user.getName();
......@@ -79,7 +79,7 @@ public class ConstantFactory implements IConstantFactory {
* @date 2017年5月16日21:55:371
*/
@Override
public String getUserAccountById(Integer userId) {
public String getUserAccountById(Long userId) {
User user = userMapper.selectById(userId);
if (user != null) {
return user.getAccount();
......@@ -113,7 +113,7 @@ public class ConstantFactory implements IConstantFactory {
*/
@Override
@Cacheable(value = Cache.CONSTANT, key = "'" + CacheKey.SINGLE_ROLE_NAME + "'+#roleId")
public String getSingleRoleName(Integer roleId) {
public String getSingleRoleName(Long roleId) {
if (0 == roleId) {
return "--";
}
......@@ -129,13 +129,13 @@ public class ConstantFactory implements IConstantFactory {
*/
@Override
@Cacheable(value = Cache.CONSTANT, key = "'" + CacheKey.SINGLE_ROLE_TIP + "'+#roleId")
public String getSingleRoleTip(Integer roleId) {
public String getSingleRoleTip(Long roleId) {
if (0 == roleId) {
return "--";
}
Role roleObj = roleMapper.selectById(roleId);
if (ToolUtil.isNotEmpty(roleObj) && ToolUtil.isNotEmpty(roleObj.getName())) {
return roleObj.getTips();
return roleObj.getDescription();
}
return "";
}
......@@ -145,10 +145,10 @@ public class ConstantFactory implements IConstantFactory {
*/
@Override
@Cacheable(value = Cache.CONSTANT, key = "'" + CacheKey.DEPT_NAME + "'+#deptId")
public String getDeptName(Integer deptId) {
public String getDeptName(Long deptId) {
Dept dept = deptMapper.selectById(deptId);
if (ToolUtil.isNotEmpty(dept) && ToolUtil.isNotEmpty(dept.getFullname())) {
return dept.getFullname();
if (ToolUtil.isNotEmpty(dept) && ToolUtil.isNotEmpty(dept.getFullName())) {
return dept.getFullName();
}
return "";
}
......@@ -209,7 +209,7 @@ public class ConstantFactory implements IConstantFactory {
* 获取字典名称
*/
@Override
public String getDictName(Integer dictId) {
public String getDictName(Long dictId) {
if (ToolUtil.isEmpty(dictId)) {
return "";
} else {
......@@ -226,7 +226,7 @@ public class ConstantFactory implements IConstantFactory {
* 获取通知标题
*/
@Override
public String getNoticeTitle(Integer dictId) {
public String getNoticeTitle(Long dictId) {
if (ToolUtil.isEmpty(dictId)) {
return "";
} else {
......@@ -243,7 +243,7 @@ public class ConstantFactory implements IConstantFactory {
* 根据字典名称和字典中的值获取对应的名称
*/
@Override
public String getDictsByName(String name, Integer val) {
public String getDictsByName(String name, String code) {
Dict temp = new Dict();
temp.setName(name);
Dict dict = dictMapper.selectOne(temp);
......@@ -251,10 +251,10 @@ public class ConstantFactory implements IConstantFactory {
return "";
} else {
Wrapper<Dict> wrapper = new EntityWrapper<>();
wrapper = wrapper.eq("pid", dict.getId());
wrapper = wrapper.eq("PID", dict.getDictId());
List<Dict> dicts = dictMapper.selectList(wrapper);
for (Dict item : dicts) {
if (item.getNum() != null && item.getNum().equals(val)) {
if (item.getCode() != null && item.getCode().equals(code)) {
return item.getName();
}
}
......@@ -266,36 +266,36 @@ public class ConstantFactory implements IConstantFactory {
* 获取性别名称
*/
@Override
public String getSexName(Integer sex) {
return getDictsByName("性别", sex);
public String getSexName(String sexCode) {
return getDictsByName("性别", sexCode);
}
/**
* 获取用户登录状态
*/
@Override
public String getStatusName(Integer status) {
return ManagerStatus.valueOf(status);
public String getStatusName(String status) {
return ManagerStatus.getDescription(status);
}
/**
* 获取菜单状态
*/
@Override
public String getMenuStatusName(Integer status) {
return MenuStatus.valueOf(status);
public String getMenuStatusName(String status) {
return MenuStatus.getDescription(status);
}
/**
* 查询字典
*/
@Override
public List<Dict> findInDict(Integer id) {
public List<Dict> findInDict(Long id) {
if (ToolUtil.isEmpty(id)) {
return null;
} else {
EntityWrapper<Dict> wrapper = new EntityWrapper<>();
List<Dict> dicts = dictMapper.selectList(wrapper.eq("pid", id));
List<Dict> dicts = dictMapper.selectList(wrapper.eq("PID", id));
if (dicts == null || dicts.size() == 0) {
return null;
} else {
......@@ -316,16 +316,16 @@ public class ConstantFactory implements IConstantFactory {
* 获取子部门id
*/
@Override
public List<Integer> getSubDeptId(Integer deptid) {
public List<Long> getSubDeptId(Long deptid) {
Wrapper<Dept> wrapper = new EntityWrapper<>();
wrapper = wrapper.like("pids", "%[" + deptid + "]%");
wrapper = wrapper.like("PIDS", "%[" + deptid + "]%");
List<Dept> depts = this.deptMapper.selectList(wrapper);
ArrayList<Integer> deptids = new ArrayList<>();
ArrayList<Long> deptids = new ArrayList<>();
if (depts != null && depts.size() > 0) {
for (Dept dept : depts) {
deptids.add(dept.getId());
deptids.add(dept.getDeptId());
}
}
......@@ -336,13 +336,13 @@ public class ConstantFactory implements IConstantFactory {
* 获取所有父部门id
*/
@Override
public List<Integer> getParentDeptIds(Integer deptid) {
public List<Long> getParentDeptIds(Long deptid) {
Dept dept = deptMapper.selectById(deptid);
String pids = dept.getPids();
String[] split = pids.split(",");
ArrayList<Integer> parentDeptIds = new ArrayList<>();
ArrayList<Long> parentDeptIds = new ArrayList<>();
for (String s : split) {
parentDeptIds.add(Integer.valueOf(StrUtil.removeSuffix(StrUtil.removePrefix(s, "["), "]")));
parentDeptIds.add(Long.valueOf(StrUtil.removeSuffix(StrUtil.removePrefix(s, "["), "]")));
}
return parentDeptIds;
}
......
......@@ -15,7 +15,7 @@
*/
package cn.stylefeng.guns.core.common.constant.factory;
import cn.stylefeng.guns.modular.system.model.Dict;
import cn.stylefeng.guns.modular.system.entity.Dict;
import java.util.List;
......@@ -33,7 +33,7 @@ public interface IConstantFactory {
* @author stylefeng
* @Date 2017/5/9 23:41
*/
String getUserNameById(Integer userId);
String getUserNameById(Long userId);
/**
* 根据用户id获取用户账号
......@@ -41,7 +41,7 @@ public interface IConstantFactory {
* @author stylefeng
* @date 2017年5月16日21:55:371
*/
String getUserAccountById(Integer userId);
String getUserAccountById(Long userId);
/**
* 通过角色ids获取角色名称
......@@ -51,17 +51,17 @@ public interface IConstantFactory {
/**
* 通过角色id获取角色名称
*/
String getSingleRoleName(Integer roleId);
String getSingleRoleName(Long roleId);
/**
* 通过角色id获取角色英文名称
*/
String getSingleRoleTip(Integer roleId);
String getSingleRoleTip(Long roleId);
/**
* 获取部门名称
*/
String getDeptName(Integer deptId);
String getDeptName(Long deptId);
/**
* 获取菜单的名称们(多个)
......@@ -81,37 +81,37 @@ public interface IConstantFactory {
/**
* 获取字典名称
*/
String getDictName(Integer dictId);
String getDictName(Long dictId);
/**
* 获取通知标题
*/
String getNoticeTitle(Integer dictId);
String getNoticeTitle(Long dictId);
/**
* 根据字典名称和字典中的值获取对应的名称
*/
String getDictsByName(String name, Integer val);
String getDictsByName(String name, String code);
/**
* 获取性别名称
*/
String getSexName(Integer sex);
String getSexName(String sexCode);
/**
* 获取用户登录状态
*/
String getStatusName(Integer status);
String getStatusName(String status);
/**
* 获取菜单状态
*/
String getMenuStatusName(Integer status);
String getMenuStatusName(String status);
/**
* 查询字典
*/
List<Dict> findInDict(Integer id);
List<Dict> findInDict(Long id);
/**
* 获取被缓存的对象(用户删除业务)
......@@ -121,11 +121,11 @@ public interface IConstantFactory {
/**
* 获取子部门id
*/
List<Integer> getSubDeptId(Integer deptid);
List<Long> getSubDeptId(Long deptid);
/**
* 获取所有父部门id
*/
List<Integer> getParentDeptIds(Integer deptid);
List<Long> getParentDeptIds(Long deptid);
}
......@@ -15,46 +15,33 @@
*/
package cn.stylefeng.guns.core.common.constant.state;
import lombok.Getter;
/**
* 管理员的状态
*
* @author fengshuonan
* @Date 2017年1月10日 下午9:54:13
*/
@Getter
public enum ManagerStatus {
OK(1, "启用"), FREEZED(2, "冻结"), DELETED(3, "被删除");
OK("ENABLE", "启用"), FREEZED("LOCKED", "冻结"), DELETED("DELETED", "被删除");
int code;
String code;
String message;
ManagerStatus(int code, String message) {
ManagerStatus(String code, String message) {
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public static String valueOf(Integer value) {
public static String getDescription(String value) {
if (value == null) {
return "";
} else {
for (ManagerStatus ms : ManagerStatus.values()) {
if (ms.getCode() == value) {
if (ms.getCode().equals(value)) {
return ms.getMessage();
}
}
......
......@@ -15,47 +15,34 @@
*/
package cn.stylefeng.guns.core.common.constant.state;
import lombok.Getter;
/**
* 菜单的状态
*
* @author fengshuonan
* @Date 2017年1月22日 下午12:14:59
*/
@Getter
public enum MenuStatus {
ENABLE(1, "启用"),
DISABLE(0, "禁用");
ENABLE("ENABLE", "启用"),
DISABLE("DISABLE", "禁用");
int code;
String code;
String message;
MenuStatus(int code, String message) {
MenuStatus(String code, String message) {
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public static String valueOf(Integer status) {
public static String getDescription(String status) {
if (status == null) {
return "";
} else {
for (MenuStatus s : MenuStatus.values()) {
if (s.getCode() == status) {
if (s.getCode().equals(status)) {
return s.getMessage();
}
}
......
......@@ -16,6 +16,7 @@
package cn.stylefeng.guns.core.common.node;
import cn.stylefeng.roses.kernel.model.enums.YesOrNotEnum;
import lombok.Data;
import java.io.Serializable;
import java.util.*;
......@@ -25,6 +26,7 @@ import java.util.*;
* @Description 菜单的节点
* @date 2016年12月6日 上午11:34:17
*/
@Data
public class MenuNode implements Comparable, Serializable {
/**
......@@ -48,9 +50,9 @@ public class MenuNode implements Comparable, Serializable {
private Integer levels;
/**
* 按钮级别
* 按钮级别(Y N)
*/
private Integer ismenu;
private String ismenu;
/**
* 按钮的排序
......@@ -75,7 +77,7 @@ public class MenuNode implements Comparable, Serializable {
/**
* 查询子节点时候的临时集合
*/
private List<MenuNode> linkedList = new ArrayList<MenuNode>();
private List<MenuNode> linkedList = new ArrayList<>();
public MenuNode() {
super();
......@@ -87,97 +89,6 @@ public class MenuNode implements Comparable, Serializable {
this.parentId = parentId;
}
public Integer getLevels() {
return levels;
}
public void setLevels(Integer levels) {
this.levels = levels;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public static MenuNode createRoot() {
return new MenuNode(0L, -1L);
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public List<MenuNode> getChildren() {
return children;
}
public void setChildren(List<MenuNode> children) {
this.children = children;
}
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
public Integer getIsmenu() {
return ismenu;
}
public void setIsmenu(Integer ismenu) {
this.ismenu = ismenu;
}
@Override
public String toString() {
return "MenuNode{" +
"id=" + id +
", parentId=" + parentId +
", name='" + name + '\'' +
", levels=" + levels +
", num=" + num +
", url='" + url + '\'' +
", icon='" + icon + '\'' +
", children=" + children +
", linkedList=" + linkedList +
'}';
}
/**
* 重写排序比较接口,首先根据等级排序,然后更具排序字段排序
*
......@@ -210,8 +121,10 @@ public class MenuNode implements Comparable, Serializable {
if (nodes.size() <= 0) {
return nodes;
}
//剔除非菜单
nodes.removeIf(node -> !node.getIsmenu().equals(YesOrNotEnum.Y.getCode()));
nodes.removeIf(node -> !node.getIsmenu().equals(YesOrNotEnum.Y.name()));
//对菜单排序,返回列表按菜单等级,序号的排序方式排列
Collections.sort(nodes);
return mergeList(nodes, nodes.get(nodes.size() - 1).getLevels(), null);
......
......@@ -17,8 +17,8 @@ package cn.stylefeng.guns.core.log.factory;
import cn.stylefeng.guns.core.common.constant.state.LogSucceed;
import cn.stylefeng.guns.core.common.constant.state.LogType;
import cn.stylefeng.guns.modular.system.model.LoginLog;
import cn.stylefeng.guns.modular.system.model.OperationLog;
import cn.stylefeng.guns.modular.system.entity.LoginLog;
import cn.stylefeng.guns.modular.system.entity.OperationLog;
import java.util.Date;
......@@ -33,14 +33,14 @@ public class LogFactory {
/**
* 创建操作日志
*/
public static OperationLog createOperationLog(LogType logType, Integer userId, String bussinessName, String clazzName, String methodName, String msg, LogSucceed succeed) {
public static OperationLog createOperationLog(LogType logType, Long userId, String bussinessName, String clazzName, String methodName, String msg, LogSucceed succeed) {
OperationLog operationLog = new OperationLog();
operationLog.setLogtype(logType.getMessage());
operationLog.setLogname(bussinessName);
operationLog.setUserid(userId);
operationLog.setClassname(clazzName);
operationLog.setLogType(logType.getMessage());
operationLog.setLogName(bussinessName);
operationLog.setUserId(userId);
operationLog.setClassName(clazzName);
operationLog.setMethod(methodName);
operationLog.setCreatetime(new Date());
operationLog.setCreateTime(new Date());
operationLog.setSucceed(succeed.getMessage());
operationLog.setMessage(msg);
return operationLog;
......@@ -49,13 +49,13 @@ public class LogFactory {
/**
* 创建登录日志
*/
public static LoginLog createLoginLog(LogType logType, Integer userId, String msg, String ip) {
public static LoginLog createLoginLog(LogType logType, Long userId, String msg, String ip) {
LoginLog loginLog = new LoginLog();
loginLog.setLogname(logType.getMessage());
loginLog.setUserid(userId);
loginLog.setCreatetime(new Date());
loginLog.setLogName(logType.getMessage());
loginLog.setUserId(userId);
loginLog.setCreateTime(new Date());
loginLog.setSucceed(LogSucceed.SUCCESS.getMessage());
loginLog.setIp(ip);
loginLog.setIpAddress(ip);
loginLog.setMessage(msg);
return loginLog;
}
......
......@@ -18,10 +18,10 @@ package cn.stylefeng.guns.core.log.factory;
import cn.stylefeng.guns.core.common.constant.state.LogSucceed;
import cn.stylefeng.guns.core.common.constant.state.LogType;
import cn.stylefeng.guns.core.log.LogManager;
import cn.stylefeng.guns.modular.system.dao.LoginLogMapper;
import cn.stylefeng.guns.modular.system.dao.OperationLogMapper;
import cn.stylefeng.guns.modular.system.model.LoginLog;
import cn.stylefeng.guns.modular.system.model.OperationLog;
import cn.stylefeng.guns.modular.system.entity.LoginLog;
import cn.stylefeng.guns.modular.system.entity.OperationLog;
import cn.stylefeng.guns.modular.system.mapper.LoginLogMapper;
import cn.stylefeng.guns.modular.system.mapper.OperationLogMapper;
import cn.stylefeng.roses.core.util.SpringContextHolder;
import cn.stylefeng.roses.core.util.ToolUtil;
import org.slf4j.Logger;
......@@ -41,7 +41,7 @@ public class LogTaskFactory {
private static LoginLogMapper loginLogMapper = SpringContextHolder.getBean(LoginLogMapper.class);
private static OperationLogMapper operationLogMapper = SpringContextHolder.getBean(OperationLogMapper.class);
public static TimerTask loginLog(final Integer userId, final String ip) {
public static TimerTask loginLog(final Long userId, final String ip) {
return new TimerTask() {
@Override
public void run() {
......@@ -70,7 +70,7 @@ public class LogTaskFactory {
};
}
public static TimerTask exitLog(final Integer userId, final String ip) {
public static TimerTask exitLog(final Long userId, final String ip) {
return new TimerTask() {
@Override
public void run() {
......@@ -84,7 +84,7 @@ public class LogTaskFactory {
};
}
public static TimerTask bussinessLog(final Integer userId, final String bussinessName, final String clazzName, final String methodName, final String msg) {
public static TimerTask bussinessLog(final Long userId, final String bussinessName, final String clazzName, final String methodName, final String msg) {
return new TimerTask() {
@Override
public void run() {
......@@ -99,7 +99,7 @@ public class LogTaskFactory {
};
}
public static TimerTask exceptionLog(final Integer userId, final Exception exception) {
public static TimerTask exceptionLog(final Long userId, final Exception exception) {
return new TimerTask() {
@Override
public void run() {
......
......@@ -17,7 +17,7 @@ package cn.stylefeng.guns.core.shiro;
import cn.stylefeng.guns.core.shiro.service.UserAuthService;
import cn.stylefeng.guns.core.shiro.service.impl.UserAuthServiceServiceImpl;
import cn.stylefeng.guns.modular.system.model.User;
import cn.stylefeng.guns.modular.system.entity.User;
import cn.stylefeng.roses.core.util.ToolUtil;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
......@@ -56,12 +56,12 @@ public class ShiroDbRealm extends AuthorizingRealm {
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
UserAuthService shiroFactory = UserAuthServiceServiceImpl.me();
ShiroUser shiroUser = (ShiroUser) principals.getPrimaryPrincipal();
List<Integer> roleList = shiroUser.getRoleList();
List<Long> roleList = shiroUser.getRoleList();
Set<String> permissionSet = new HashSet<>();
Set<String> roleNameSet = new HashSet<>();
for (Integer roleId : roleList) {
for (Long roleId : roleList) {
List<String> permissions = shiroFactory.findPermissionsByRoleId(roleId);
if (permissions != null) {
for (String permission : permissions) {
......
......@@ -17,7 +17,7 @@ package cn.stylefeng.guns.core.shiro;
import cn.stylefeng.guns.core.common.constant.Const;
import cn.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import cn.stylefeng.guns.modular.system.model.User;
import cn.stylefeng.guns.modular.system.entity.User;
import cn.stylefeng.roses.core.util.ToolUtil;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.crypto.hash.Md5Hash;
......@@ -259,9 +259,9 @@ public class ShiroKit {
/**
* 获取当前用户的部门数据范围的集合
*/
public static List<Integer> getDeptDataScope() {
Integer deptId = getUser().getDeptId();
List<Integer> subDeptIds = ConstantFactory.me().getSubDeptId(deptId);
public static List<Long> getDeptDataScope() {
Long deptId = getUser().getDeptId();
List<Long> subDeptIds = ConstantFactory.me().getSubDeptId(deptId);
subDeptIds.add(deptId);
return subDeptIds;
}
......@@ -270,8 +270,8 @@ public class ShiroKit {
* 判断当前用户是否是超级管理员
*/
public static boolean isAdmin() {
List<Integer> roleList = ShiroKit.getUser().getRoleList();
for (Integer integer : roleList) {
List<Long> roleList = ShiroKit.getUser().getRoleList();
for (Long integer : roleList) {
String singleRoleTip = ConstantFactory.me().getSingleRoleTip(integer);
if (singleRoleTip.equals(Const.ADMIN_NAME)) {
return true;
......@@ -290,10 +290,10 @@ public class ShiroKit {
return shiroUser;
}
shiroUser.setId(user.getId());
shiroUser.setId(user.getUserId());
shiroUser.setAccount(user.getAccount());
shiroUser.setDeptId(user.getDeptid());
shiroUser.setDeptName(ConstantFactory.me().getDeptName(user.getDeptid()));
shiroUser.setDeptId(user.getDeptId());
shiroUser.setDeptName(ConstantFactory.me().getDeptName(user.getDeptId()));
shiroUser.setName(user.getName());
shiroUser.setEmail(user.getEmail());
shiroUser.setAvatar(user.getAvatar());
......
......@@ -35,7 +35,7 @@ public class ShiroUser implements Serializable {
/**
* 用户主键ID
*/
private Integer id;
private Long id;
/**
* 账号
......@@ -60,12 +60,12 @@ public class ShiroUser implements Serializable {
/**
* 部门id
*/
private Integer deptId;
private Long deptId;
/**
* 角色集
*/
private List<Integer> roleList;
private List<Long> roleList;
/**
* 部门名称
......
......@@ -16,7 +16,7 @@
package cn.stylefeng.guns.core.shiro.service;
import cn.stylefeng.guns.core.shiro.ShiroUser;
import cn.stylefeng.guns.modular.system.model.User;
import cn.stylefeng.guns.modular.system.entity.User;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import java.util.List;
......@@ -48,14 +48,14 @@ public interface UserAuthService {
*
* @param roleId 角色id
*/
List<String> findPermissionsByRoleId(Integer roleId);
List<String> findPermissionsByRoleId(Long roleId);
/**
* 根据角色id获取角色名称
*
* @param roleId 角色id
*/
String findRoleNameByRoleId(Integer roleId);
String findRoleNameByRoleId(Long roleId);
/**
* 获取shiro的认证信息
......
......@@ -21,10 +21,10 @@ import cn.stylefeng.guns.core.common.constant.state.ManagerStatus;
import cn.stylefeng.guns.core.shiro.ShiroKit;
import cn.stylefeng.guns.core.shiro.ShiroUser;
import cn.stylefeng.guns.core.shiro.service.UserAuthService;
import cn.stylefeng.guns.modular.system.dao.MenuMapper;
import cn.stylefeng.guns.modular.system.dao.UserMapper;
import cn.stylefeng.guns.modular.system.model.User;
import cn.stylefeng.guns.modular.system.service.IUserService;
import cn.stylefeng.guns.modular.system.entity.User;
import cn.stylefeng.guns.modular.system.mapper.MenuMapper;
import cn.stylefeng.guns.modular.system.mapper.UserMapper;
import cn.stylefeng.guns.modular.system.service.UserService;
import cn.stylefeng.roses.core.util.SpringContextHolder;
import org.apache.shiro.authc.CredentialsException;
import org.apache.shiro.authc.LockedAccountException;
......@@ -51,7 +51,7 @@ public class UserAuthServiceServiceImpl implements UserAuthService {
private MenuMapper menuMapper;
@Autowired
private IUserService userService;
private UserService userService;
public static UserAuthService me() {
return SpringContextHolder.getBean(UserAuthService.class);
......@@ -67,7 +67,7 @@ public class UserAuthServiceServiceImpl implements UserAuthService {
throw new CredentialsException();
}
// 账号被冻结
if (user.getStatus() != ManagerStatus.OK.getCode()) {
if (!user.getStatus().equals(ManagerStatus.OK.getCode())) {
throw new LockedAccountException();
}
return user;
......@@ -79,12 +79,12 @@ public class UserAuthServiceServiceImpl implements UserAuthService {
ShiroUser shiroUser = ShiroKit.createShiroUser(user);
//用户角色数组
Integer[] roleArray = Convert.toIntArray(user.getRoleid());
Long[] roleArray = Convert.toLongArray(user.getRoleId());
//获取用户角色列表
List<Integer> roleList = new ArrayList<>();
List<Long> roleList = new ArrayList<>();
List<String> roleNameList = new ArrayList<>();
for (int roleId : roleArray) {
for (Long roleId : roleArray) {
roleList.add(roleId);
roleNameList.add(ConstantFactory.me().getSingleRoleName(roleId));
}
......@@ -98,12 +98,12 @@ public class UserAuthServiceServiceImpl implements UserAuthService {
}
@Override
public List<String> findPermissionsByRoleId(Integer roleId) {
public List<String> findPermissionsByRoleId(Long roleId) {
return menuMapper.getResUrlsByRoleId(roleId);
}
@Override
public String findRoleNameByRoleId(Integer roleId) {
public String findRoleNameByRoleId(Long roleId) {
return ConstantFactory.me().getSingleRoleTip(roleId);
}
......
......@@ -16,8 +16,8 @@
package cn.stylefeng.guns.core.tag;
import cn.stylefeng.guns.core.common.exception.BizExceptionEnum;
import cn.stylefeng.guns.modular.system.model.Dict;
import cn.stylefeng.guns.modular.system.service.IDictService;
import cn.stylefeng.guns.modular.system.entity.Dict;
import cn.stylefeng.guns.modular.system.service.DictService;
import cn.stylefeng.roses.core.util.ToolUtil;
import cn.stylefeng.roses.kernel.model.exception.ServiceException;
import org.beetl.core.Tag;
......@@ -40,7 +40,7 @@ import java.util.Map;
public class DictSelectorTag extends Tag {
@Autowired
IDictService iDictService;
DictService dictService;
@Override
public void render() {
......@@ -79,7 +79,7 @@ public class DictSelectorTag extends Tag {
//searchnum 下拉选项数量达到多少启用搜索,默认10
int searchnum = ToolUtil.isNum(attrs.get("searchnum")) ? Integer.parseInt(attrs.get("searchnum").toString()) : 10;
//根据code查询字典数据
List<Dict> list = iDictService.selectByParentCode(code);
List<Dict> list = dictService.selectByParentCode(code);
StringBuffer html = new StringBuffer();
html.append("<div class=\"form-group\">\r\n");
......
......@@ -18,8 +18,8 @@ package cn.stylefeng.guns.modular.api;
import cn.stylefeng.guns.core.shiro.ShiroKit;
import cn.stylefeng.guns.core.shiro.ShiroUser;
import cn.stylefeng.guns.core.util.JwtTokenUtil;
import cn.stylefeng.guns.modular.system.dao.UserMapper;
import cn.stylefeng.guns.modular.system.model.User;
import cn.stylefeng.guns.modular.system.entity.User;
import cn.stylefeng.guns.modular.system.mapper.UserMapper;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ErrorResponseData;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
......@@ -76,7 +76,7 @@ public class ApiController extends BaseController {
if (passwordTrueFlag) {
HashMap<String, Object> result = new HashMap<>();
result.put("token", JwtTokenUtil.generateToken(String.valueOf(user.getId())));
result.put("token", JwtTokenUtil.generateToken(String.valueOf(user.getUserId())));
return result;
} else {
return new ErrorResponseData(500, "账号密码错误!");
......
......@@ -22,8 +22,8 @@ import cn.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import cn.stylefeng.guns.core.common.exception.BizExceptionEnum;
import cn.stylefeng.guns.core.common.node.ZTreeNode;
import cn.stylefeng.guns.core.log.LogObjectHolder;
import cn.stylefeng.guns.modular.system.model.Dept;
import cn.stylefeng.guns.modular.system.service.IDeptService;
import cn.stylefeng.guns.modular.system.entity.Dept;
import cn.stylefeng.guns.modular.system.service.DeptService;
import cn.stylefeng.guns.modular.system.warpper.DeptWarpper;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.util.ToolUtil;
......@@ -52,7 +52,7 @@ public class DeptController extends BaseController {
private String PREFIX = "/system/dept/";
@Autowired
private IDeptService deptService;
private DeptService deptService;
/**
* 跳转到部门管理首页
......@@ -75,7 +75,7 @@ public class DeptController extends BaseController {
*/
@Permission
@RequestMapping("/dept_update/{deptId}")
public String deptUpdate(@PathVariable Integer deptId, Model model) {
public String deptUpdate(@PathVariable Long deptId, Model model) {
Dept dept = deptService.selectById(deptId);
model.addAttribute(dept);
model.addAttribute("pName", ConstantFactory.me().getDeptName(dept.getPid()));
......@@ -102,9 +102,10 @@ public class DeptController extends BaseController {
@Permission
@ResponseBody
public Object add(Dept dept) {
if (ToolUtil.isOneEmpty(dept, dept.getSimplename())) {
if (ToolUtil.isOneEmpty(dept, dept.getSimpleName())) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
//完善pids,根据pid拿到pid的pids
deptSetPids(dept);
return this.deptService.insert(dept);
......@@ -127,7 +128,7 @@ public class DeptController extends BaseController {
@RequestMapping(value = "/detail/{deptId}")
@Permission
@ResponseBody
public Object detail(@PathVariable("deptId") Integer deptId) {
public Object detail(@PathVariable("deptId") Long deptId) {
return deptService.selectById(deptId);
}
......@@ -139,7 +140,7 @@ public class DeptController extends BaseController {
@Permission
@ResponseBody
public Object update(Dept dept) {
if (ToolUtil.isEmpty(dept) || dept.getId() == null) {
if (ToolUtil.isEmpty(dept) || dept.getDeptId() == null) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
deptSetPids(dept);
......@@ -154,7 +155,7 @@ public class DeptController extends BaseController {
@RequestMapping(value = "/delete")
@Permission
@ResponseBody
public Object delete(@RequestParam Integer deptId) {
public Object delete(@RequestParam Long deptId) {
//缓存被删除的部门名称
LogObjectHolder.me().set(ConstantFactory.me().getDeptName(deptId));
......@@ -165,11 +166,11 @@ public class DeptController extends BaseController {
}
private void deptSetPids(Dept dept) {
if (ToolUtil.isEmpty(dept.getPid()) || dept.getPid().equals(0)) {
dept.setPid(0);
if (ToolUtil.isEmpty(dept.getPid()) || dept.getPid().equals(0L)) {
dept.setPid(0L);
dept.setPids("[0],");
} else {
int pid = dept.getPid();
Long pid = dept.getPid();
Dept temp = deptService.selectById(pid);
String pids = temp.getPids();
dept.setPid(pid);
......
......@@ -22,8 +22,8 @@ import cn.stylefeng.guns.core.common.constant.dictmap.DictMap;
import cn.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import cn.stylefeng.guns.core.common.exception.BizExceptionEnum;
import cn.stylefeng.guns.core.log.LogObjectHolder;
import cn.stylefeng.guns.modular.system.model.Dict;
import cn.stylefeng.guns.modular.system.service.IDictService;
import cn.stylefeng.guns.modular.system.entity.Dict;
import cn.stylefeng.guns.modular.system.service.DictService;
import cn.stylefeng.guns.modular.system.warpper.DictWarpper;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.util.ToolUtil;
......@@ -53,7 +53,7 @@ public class DictController extends BaseController {
private String PREFIX = "/system/dict/";
@Autowired
private IDictService dictService;
private DictService dictService;
/**
* 跳转到字典管理首页
......@@ -79,7 +79,7 @@ public class DictController extends BaseController {
public String deptUpdate(@PathVariable Integer dictId, Model model) {
Dict dict = dictService.selectById(dictId);
model.addAttribute("dict", dict);
List<Dict> subDicts = dictService.selectList(new EntityWrapper<Dict>().eq("pid", dictId));
List<Dict> subDicts = dictService.selectList(new EntityWrapper<Dict>().eq("PID", dictId));
model.addAttribute("subDicts", subDicts);
LogObjectHolder.me().set(dict);
return PREFIX + "dict_edit.html";
......@@ -130,7 +130,7 @@ public class DictController extends BaseController {
@RequestMapping(value = "/update")
@Permission(Const.ADMIN_NAME)
@ResponseBody
public Object update(Integer dictId, String dictCode, String dictName, String dictTips, String dictValues) {
public Object update(Long dictId, String dictCode, String dictName, String dictTips, String dictValues) {
if (ToolUtil.isOneEmpty(dictId, dictCode, dictName, dictValues)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
......@@ -145,12 +145,13 @@ public class DictController extends BaseController {
@RequestMapping(value = "/delete")
@Permission(Const.ADMIN_NAME)
@ResponseBody
public Object delete(@RequestParam Integer dictId) {
public Object delete(@RequestParam Long dictId) {
//缓存被删除的名称
LogObjectHolder.me().set(ConstantFactory.me().getDictName(dictId));
this.dictService.delteDict(dictId);
return SUCCESS_TIP;
}
......
......@@ -22,8 +22,8 @@ import cn.stylefeng.guns.core.common.constant.Const;
import cn.stylefeng.guns.core.common.constant.factory.PageFactory;
import cn.stylefeng.guns.core.common.constant.state.BizLogType;
import cn.stylefeng.guns.core.common.page.PageInfoBT;
import cn.stylefeng.guns.modular.system.model.OperationLog;
import cn.stylefeng.guns.modular.system.service.IOperationLogService;
import cn.stylefeng.guns.modular.system.entity.OperationLog;
import cn.stylefeng.guns.modular.system.service.OperationLogService;
import cn.stylefeng.guns.modular.system.warpper.LogWarpper;
import cn.stylefeng.roses.core.base.controller.BaseController;
import com.baomidou.mybatisplus.mapper.SqlRunner;
......@@ -51,7 +51,7 @@ public class LogController extends BaseController {
private static String PREFIX = "/system/log/";
@Autowired
private IOperationLogService operationLogService;
private OperationLogService operationLogService;
/**
* 跳转到日志管理的首页
......@@ -80,7 +80,7 @@ public class LogController extends BaseController {
@RequestMapping("/detail/{id}")
@Permission(Const.ADMIN_NAME)
@ResponseBody
public Object detail(@PathVariable Integer id) {
public Object detail(@PathVariable Long id) {
OperationLog operationLog = operationLogService.selectById(id);
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(operationLog);
return super.warpObject(new LogWarpper(stringObjectMap));
......
......@@ -21,7 +21,7 @@ import cn.stylefeng.guns.core.log.factory.LogTaskFactory;
import cn.stylefeng.guns.core.shiro.ShiroKit;
import cn.stylefeng.guns.core.shiro.ShiroUser;
import cn.stylefeng.guns.core.util.KaptchaUtil;
import cn.stylefeng.guns.modular.system.service.INoticeService;
import cn.stylefeng.guns.modular.system.service.NoticeService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.util.ToolUtil;
import com.google.code.kaptcha.Constants;
......@@ -48,7 +48,7 @@ import static cn.stylefeng.roses.core.util.HttpContext.getIp;
public class LoginController extends BaseController {
@Autowired
private INoticeService noticeService;
private NoticeService noticeService;
/**
* 跳转到主页
......@@ -56,7 +56,7 @@ public class LoginController extends BaseController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String index(Model model) {
List<Integer> roleList = ShiroKit.getUser().getRoleList();
List<Long> roleList = ShiroKit.getUser().getRoleList();
if (roleList == null || roleList.size() == 0) {
ShiroKit.getSubject().logout();
model.addAttribute("tips", "该用户没有角色,无法登陆");
......
......@@ -20,8 +20,8 @@ import cn.stylefeng.guns.core.common.annotion.Permission;
import cn.stylefeng.guns.core.common.constant.Const;
import cn.stylefeng.guns.core.common.constant.factory.PageFactory;
import cn.stylefeng.guns.core.common.page.PageInfoBT;
import cn.stylefeng.guns.modular.system.model.LoginLog;
import cn.stylefeng.guns.modular.system.service.ILoginLogService;
import cn.stylefeng.guns.modular.system.entity.LoginLog;
import cn.stylefeng.guns.modular.system.service.LoginLogService;
import cn.stylefeng.guns.modular.system.warpper.LogWarpper;
import cn.stylefeng.roses.core.base.controller.BaseController;
import com.baomidou.mybatisplus.mapper.SqlRunner;
......@@ -48,7 +48,7 @@ public class LoginLogController extends BaseController {
private static String PREFIX = "/system/log/";
@Autowired
private ILoginLogService loginLogService;
private LoginLogService loginLogService;
/**
* 跳转到日志管理的首页
......
......@@ -25,8 +25,8 @@ import cn.stylefeng.guns.core.common.constant.state.MenuStatus;
import cn.stylefeng.guns.core.common.exception.BizExceptionEnum;
import cn.stylefeng.guns.core.common.node.ZTreeNode;
import cn.stylefeng.guns.core.log.LogObjectHolder;
import cn.stylefeng.guns.modular.system.model.Menu;
import cn.stylefeng.guns.modular.system.service.IMenuService;
import cn.stylefeng.guns.modular.system.entity.Menu;
import cn.stylefeng.guns.modular.system.service.MenuService;
import cn.stylefeng.guns.modular.system.warpper.MenuWarpper;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
......@@ -59,7 +59,7 @@ public class MenuController extends BaseController {
private static String PREFIX = "/system/menu/";
@Autowired
private IMenuService menuService;
private MenuService menuService;
/**
* 跳转到菜单列表列表页面
......@@ -98,7 +98,7 @@ public class MenuController extends BaseController {
menu.setPcode("0");
} else {
//设置父级菜单的code为父级菜单的id
menu.setPcode(String.valueOf(pMenu.getId()));
menu.setPcode(String.valueOf(pMenu.getMenuId()));
}
Map<String, Object> menuMap = BeanUtil.beanToMap(menu);
......@@ -220,7 +220,7 @@ public class MenuController extends BaseController {
*/
@RequestMapping(value = "/menuTreeListByRoleId/{roleId}")
@ResponseBody
public List<ZTreeNode> menuTreeListByRoleId(@PathVariable Integer roleId) {
public List<ZTreeNode> menuTreeListByRoleId(@PathVariable Long roleId) {
List<Long> menuIds = this.menuService.getMenuIdsByRoleId(roleId);
if (ToolUtil.isEmpty(menuIds)) {
return this.menuService.menuTreeList();
......
......@@ -21,8 +21,8 @@ import cn.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import cn.stylefeng.guns.core.common.exception.BizExceptionEnum;
import cn.stylefeng.guns.core.log.LogObjectHolder;
import cn.stylefeng.guns.core.shiro.ShiroKit;
import cn.stylefeng.guns.modular.system.model.Notice;
import cn.stylefeng.guns.modular.system.service.INoticeService;
import cn.stylefeng.guns.modular.system.entity.Notice;
import cn.stylefeng.guns.modular.system.service.NoticeService;
import cn.stylefeng.guns.modular.system.warpper.NoticeWrapper;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.util.ToolUtil;
......@@ -52,7 +52,7 @@ public class NoticeController extends BaseController {
private String PREFIX = "/system/notice/";
@Autowired
private INoticeService noticeService;
private NoticeService noticeService;
/**
* 跳转到通知列表首页
......@@ -74,7 +74,7 @@ public class NoticeController extends BaseController {
* 跳转到修改通知
*/
@RequestMapping("/notice_update/{noticeId}")
public String noticeUpdate(@PathVariable Integer noticeId, Model model) {
public String noticeUpdate(@PathVariable Long noticeId, Model model) {
Notice notice = this.noticeService.selectById(noticeId);
model.addAttribute("notice", notice);
LogObjectHolder.me().set(notice);
......@@ -111,9 +111,9 @@ public class NoticeController extends BaseController {
if (ToolUtil.isOneEmpty(notice, notice.getTitle(), notice.getContent())) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
notice.setCreater(ShiroKit.getUser().getId());
notice.setCreatetime(new Date());
notice.insert();
notice.setCreateUser(ShiroKit.getUser().getId());
notice.setCreateTime(new Date());
this.noticeService.insert(notice);
return SUCCESS_TIP;
}
......@@ -123,7 +123,7 @@ public class NoticeController extends BaseController {
@RequestMapping(value = "/delete")
@ResponseBody
@BussinessLog(value = "删除通知", key = "noticeId", dict = NoticeMap.class)
public Object delete(@RequestParam Integer noticeId) {
public Object delete(@RequestParam Long noticeId) {
//缓存通知名称
LogObjectHolder.me().set(ConstantFactory.me().getNoticeTitle(noticeId));
......@@ -140,13 +140,13 @@ public class NoticeController extends BaseController {
@ResponseBody
@BussinessLog(value = "修改通知", key = "title", dict = NoticeMap.class)
public Object update(Notice notice) {
if (ToolUtil.isOneEmpty(notice, notice.getId(), notice.getTitle(), notice.getContent())) {
if (ToolUtil.isOneEmpty(notice, notice.getNoticeId(), notice.getTitle(), notice.getContent())) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
Notice old = this.noticeService.selectById(notice.getId());
Notice old = this.noticeService.selectById(notice.getNoticeId());
old.setTitle(notice.getTitle());
old.setContent(notice.getContent());
old.updateById();
this.noticeService.updateById(old);
return SUCCESS_TIP;
}
......
......@@ -26,10 +26,10 @@ import cn.stylefeng.guns.core.common.exception.BizExceptionEnum;
import cn.stylefeng.guns.core.common.node.ZTreeNode;
import cn.stylefeng.guns.core.log.LogObjectHolder;
import cn.stylefeng.guns.core.util.CacheUtil;
import cn.stylefeng.guns.modular.system.model.Role;
import cn.stylefeng.guns.modular.system.model.User;
import cn.stylefeng.guns.modular.system.service.IRoleService;
import cn.stylefeng.guns.modular.system.service.IUserService;
import cn.stylefeng.guns.modular.system.entity.Role;
import cn.stylefeng.guns.modular.system.entity.User;
import cn.stylefeng.guns.modular.system.service.RoleService;
import cn.stylefeng.guns.modular.system.service.UserService;
import cn.stylefeng.guns.modular.system.warpper.RoleWarpper;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
......@@ -61,10 +61,10 @@ public class RoleController extends BaseController {
private static String PREFIX = "/system/role";
@Autowired
private IUserService userService;
private UserService userService;
@Autowired
private IRoleService roleService;
private RoleService roleService;
/**
* 跳转到角色列表页面
......@@ -94,7 +94,6 @@ public class RoleController extends BaseController {
Role role = this.roleService.selectById(roleId);
model.addAttribute(role);
model.addAttribute("pName", ConstantFactory.me().getSingleRoleName(role.getPid()));
model.addAttribute("deptName", ConstantFactory.me().getDeptName(role.getDeptid()));
LogObjectHolder.me().set(role);
return PREFIX + "/role_edit.html";
}
......@@ -104,7 +103,7 @@ public class RoleController extends BaseController {
*/
@Permission
@RequestMapping(value = "/role_assign/{roleId}")
public String roleAssign(@PathVariable("roleId") Integer roleId, Model model) {
public String roleAssign(@PathVariable("roleId") Long roleId, Model model) {
if (ToolUtil.isEmpty(roleId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
......@@ -135,7 +134,7 @@ public class RoleController extends BaseController {
if (result.hasErrors()) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
role.setId(null);
role.setRoleId(null);
this.roleService.insert(role);
return SUCCESS_TIP;
}
......@@ -165,7 +164,7 @@ public class RoleController extends BaseController {
@BussinessLog(value = "删除角色", key = "roleId", dict = RoleDict.class)
@Permission(Const.ADMIN_NAME)
@ResponseBody
public ResponseData remove(@RequestParam Integer roleId) {
public ResponseData remove(@RequestParam Long roleId) {
if (ToolUtil.isEmpty(roleId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
......@@ -190,20 +189,17 @@ public class RoleController extends BaseController {
*/
@RequestMapping(value = "/view/{roleId}")
@ResponseBody
public ResponseData view(@PathVariable Integer roleId) {
public ResponseData view(@PathVariable Long roleId) {
if (ToolUtil.isEmpty(roleId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
Role role = this.roleService.selectById(roleId);
Map<String, Object> roleMap = BeanUtil.beanToMap(role);
Integer pid = role.getPid();
Long pid = role.getPid();
String pName = ConstantFactory.me().getSingleRoleName(pid);
roleMap.put("pName", pName);
String deptName = ConstantFactory.me().getDeptName(role.getDeptid());
roleMap.put("deptName", deptName);
return ResponseData.success(roleMap);
}
......@@ -214,7 +210,7 @@ public class RoleController extends BaseController {
@BussinessLog(value = "配置权限", key = "roleId,ids", dict = RoleDict.class)
@Permission(Const.ADMIN_NAME)
@ResponseBody
public ResponseData setAuthority(@RequestParam("roleId") Integer roleId, @RequestParam("ids") String ids) {
public ResponseData setAuthority(@RequestParam("roleId") Long roleId, @RequestParam("ids") String ids) {
if (ToolUtil.isOneEmpty(roleId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
......@@ -238,9 +234,9 @@ public class RoleController extends BaseController {
*/
@RequestMapping(value = "/roleTreeListByUserId/{userId}")
@ResponseBody
public List<ZTreeNode> roleTreeListByUserId(@PathVariable Integer userId) {
public List<ZTreeNode> roleTreeListByUserId(@PathVariable Long userId) {
User theUser = this.userService.selectById(userId);
String roleid = theUser.getRoleid();
String roleid = theUser.getRoleId();
if (ToolUtil.isEmpty(roleid)) {
return this.roleService.roleTreeList();
} else {
......
......@@ -21,11 +21,11 @@ import cn.stylefeng.guns.core.common.constant.DefaultAvatar;
import cn.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import cn.stylefeng.guns.core.shiro.ShiroKit;
import cn.stylefeng.guns.core.shiro.ShiroUser;
import cn.stylefeng.guns.modular.system.entity.FileInfo;
import cn.stylefeng.guns.modular.system.entity.User;
import cn.stylefeng.guns.modular.system.factory.UserFactory;
import cn.stylefeng.guns.modular.system.model.FileInfo;
import cn.stylefeng.guns.modular.system.model.User;
import cn.stylefeng.guns.modular.system.service.IFileInfoService;
import cn.stylefeng.guns.modular.system.service.IUserService;
import cn.stylefeng.guns.modular.system.service.FileInfoService;
import cn.stylefeng.guns.modular.system.service.UserService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import cn.stylefeng.roses.core.util.ToolUtil;
......@@ -61,10 +61,10 @@ public class SystemController extends BaseController {
private String PREFIX = "/common/";
@Autowired
private IUserService userService;
private UserService userService;
@Autowired
private IFileInfoService fileInfoService;
private FileInfoService fileInfoService;
/**
* 通用的树列表选择器
......@@ -132,9 +132,9 @@ public class SystemController extends BaseController {
avatar = DefaultAvatar.BASE_64_AVATAR;
} else {
FileInfo fileInfo = fileInfoService.selectById(avatar);
if(fileInfo == null){
if (fileInfo == null) {
avatar = DefaultAvatar.BASE_64_AVATAR;
}else{
} else {
avatar = fileInfo.getFileData();
}
}
......@@ -169,8 +169,8 @@ public class SystemController extends BaseController {
HashMap<Object, Object> hashMap = CollectionUtil.newHashMap();
hashMap.putAll(map);
hashMap.put("roleName", ConstantFactory.me().getRoleName(user.getRoleid()));
hashMap.put("deptName", ConstantFactory.me().getDeptName(user.getDeptid()));
hashMap.put("roleName", ConstantFactory.me().getRoleName(user.getRoleId()));
hashMap.put("deptName", ConstantFactory.me().getDeptName(user.getDeptId()));
return ResponseData.success(hashMap);
}
......
......@@ -28,9 +28,9 @@ import cn.stylefeng.guns.core.common.exception.BizExceptionEnum;
import cn.stylefeng.guns.core.log.LogObjectHolder;
import cn.stylefeng.guns.core.shiro.ShiroKit;
import cn.stylefeng.guns.core.shiro.ShiroUser;
import cn.stylefeng.guns.modular.system.entity.User;
import cn.stylefeng.guns.modular.system.factory.UserFactory;
import cn.stylefeng.guns.modular.system.model.User;
import cn.stylefeng.guns.modular.system.service.IUserService;
import cn.stylefeng.guns.modular.system.service.UserService;
import cn.stylefeng.guns.modular.system.transfer.UserDto;
import cn.stylefeng.guns.modular.system.warpper.UserWarpper;
import cn.stylefeng.roses.core.base.controller.BaseController;
......@@ -70,7 +70,7 @@ public class UserMgrController extends BaseController {
private GunsProperties gunsProperties;
@Autowired
private IUserService userService;
private UserService userService;
/**
* 跳转到查看管理员列表的页面
......@@ -93,11 +93,11 @@ public class UserMgrController extends BaseController {
*/
@Permission
@RequestMapping("/role_assign")
public String roleAssign(@RequestParam Integer userId, Model model) {
public String roleAssign(@RequestParam Long userId, Model model) {
if (ToolUtil.isEmpty(userId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
User user = this.userService.selectOne(new EntityWrapper<User>().eq("id", userId));
User user = this.userService.selectOne(new EntityWrapper<User>().eq("USER_ID", userId));
model.addAttribute("userId", userId);
model.addAttribute("userAccount", user.getAccount());
return PREFIX + "user_roleassign.html";
......@@ -122,14 +122,14 @@ public class UserMgrController extends BaseController {
*/
@RequestMapping("/user_info")
public String userInfo(Model model) {
Integer userId = ShiroKit.getUser().getId();
Long userId = ShiroKit.getUser().getId();
if (ToolUtil.isEmpty(userId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
User user = this.userService.selectById(userId);
model.addAllAttributes(BeanUtil.beanToMap(user));
model.addAttribute("roleName", ConstantFactory.me().getRoleName(user.getRoleid()));
model.addAttribute("deptName", ConstantFactory.me().getDeptName(user.getDeptid()));
model.addAttribute("roleName", ConstantFactory.me().getRoleName(user.getRoleId()));
model.addAttribute("deptName", ConstantFactory.me().getDeptName(user.getDeptId()));
LogObjectHolder.me().set(user);
return PREFIX + "user_view.html";
}
......@@ -147,7 +147,7 @@ public class UserMgrController extends BaseController {
*/
@RequestMapping("/getUserInfo")
@ResponseBody
public Object getUserInfo(@RequestParam Integer userId) {
public Object getUserInfo(@RequestParam Long userId) {
if (ToolUtil.isEmpty(userId)) {
throw new RequestEmptyException();
}
......@@ -157,8 +157,8 @@ public class UserMgrController extends BaseController {
HashMap<Object, Object> hashMap = CollectionUtil.newHashMap();
hashMap.putAll(map);
hashMap.put("roleName", ConstantFactory.me().getRoleName(user.getRoleid()));
hashMap.put("deptName", ConstantFactory.me().getDeptName(user.getDeptid()));
hashMap.put("roleName", ConstantFactory.me().getRoleName(user.getRoleId()));
hashMap.put("deptName", ConstantFactory.me().getDeptName(user.getDeptId()));
return ResponseData.success(hashMap);
}
......@@ -172,13 +172,13 @@ public class UserMgrController extends BaseController {
if (ToolUtil.isOneEmpty(oldPassword, newPassword)) {
throw new RequestEmptyException();
}
Integer userId = ShiroKit.getUser().getId();
Long userId = ShiroKit.getUser().getId();
User user = userService.selectById(userId);
String oldMd5 = ShiroKit.md5(oldPassword, user.getSalt());
if (user.getPassword().equals(oldMd5)) {
String newMd5 = ShiroKit.md5(newPassword, user.getSalt());
user.setPassword(newMd5);
user.updateById();
this.userService.updateById(user);
return SUCCESS_TIP;
} else {
throw new ServiceException(BizExceptionEnum.OLD_PWD_NOT_RIGHT);
......@@ -193,7 +193,7 @@ public class UserMgrController extends BaseController {
@ResponseBody
public Object list(@RequestParam(required = false) String name,
@RequestParam(required = false) String timeLimit,
@RequestParam(required = false) Integer deptid) {
@RequestParam(required = false) Long deptid) {
//拼接查询条件
String beginTime = "";
......@@ -276,7 +276,7 @@ public class UserMgrController extends BaseController {
@BussinessLog(value = "删除管理员", key = "userId", dict = UserDict.class)
@Permission
@ResponseBody
public ResponseData delete(@RequestParam Integer userId) {
public ResponseData delete(@RequestParam Long userId) {
if (ToolUtil.isEmpty(userId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
......@@ -294,7 +294,7 @@ public class UserMgrController extends BaseController {
*/
@RequestMapping("/view/{userId}")
@ResponseBody
public User view(@PathVariable Integer userId) {
public User view(@PathVariable Long userId) {
if (ToolUtil.isEmpty(userId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
......@@ -309,7 +309,7 @@ public class UserMgrController extends BaseController {
@BussinessLog(value = "重置管理员密码", key = "userId", dict = UserDict.class)
@Permission(Const.ADMIN_NAME)
@ResponseBody
public ResponseData reset(@RequestParam Integer userId) {
public ResponseData reset(@RequestParam Long userId) {
if (ToolUtil.isEmpty(userId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
......@@ -328,7 +328,7 @@ public class UserMgrController extends BaseController {
@BussinessLog(value = "冻结用户", key = "userId", dict = UserDict.class)
@Permission(Const.ADMIN_NAME)
@ResponseBody
public ResponseData freeze(@RequestParam Integer userId) {
public ResponseData freeze(@RequestParam Long userId) {
if (ToolUtil.isEmpty(userId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
......@@ -348,7 +348,7 @@ public class UserMgrController extends BaseController {
@BussinessLog(value = "解除冻结用户", key = "userId", dict = UserDict.class)
@Permission(Const.ADMIN_NAME)
@ResponseBody
public ResponseData unfreeze(@RequestParam Integer userId) {
public ResponseData unfreeze(@RequestParam Long userId) {
if (ToolUtil.isEmpty(userId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
......@@ -364,7 +364,7 @@ public class UserMgrController extends BaseController {
@BussinessLog(value = "分配角色", key = "userId,roleIds", dict = UserDict.class)
@Permission(Const.ADMIN_NAME)
@ResponseBody
public ResponseData setRole(@RequestParam("userId") Integer userId, @RequestParam("roleIds") String roleIds) {
public ResponseData setRole(@RequestParam("userId") Long userId, @RequestParam("roleIds") String roleIds) {
if (ToolUtil.isOneEmpty(userId, roleIds)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
......@@ -397,13 +397,13 @@ public class UserMgrController extends BaseController {
/**
* 判断当前登录的用户是否有操作这个用户的权限
*/
private void assertAuth(Integer userId) {
private void assertAuth(Long userId) {
if (ShiroKit.isAdmin()) {
return;
}
List<Integer> deptDataScope = ShiroKit.getDeptDataScope();
List<Long> deptDataScope = ShiroKit.getDeptDataScope();
User user = this.userService.selectById(userId);
Integer deptid = user.getDeptid();
Long deptid = user.getDeptId();
if (deptDataScope.contains(deptid)) {
return;
} else {
......
/**
* Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng)
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.stylefeng.guns.modular.system.dao;
import cn.stylefeng.guns.modular.system.model.Expense;
import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
* <p>
* 报销表 Mapper 接口
* </p>
*
* @author stylefeng
* @since 2017-12-04
*/
public interface ExpenseMapper extends BaseMapper<Expense> {
}
\ No newline at end of file
/**
* Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng)
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.stylefeng.guns.modular.system.dao;
import cn.stylefeng.guns.modular.system.model.FileInfo;
import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
* <p>
* 文件信息 Mapper 接口
* </p>
*
* @author stylefeng
* @since 2017-07-11
*/
public interface FileInfoMapper extends BaseMapper<FileInfo> {
}
\ No newline at end of file
/**
* Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng)
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.stylefeng.guns.modular.system.dao;
import cn.stylefeng.guns.modular.system.model.Relation;
import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
* <p>
* 角色和菜单关联表 Mapper 接口
* </p>
*
* @author stylefeng
* @since 2017-07-11
*/
public interface RelationMapper extends BaseMapper<Relation> {
}
\ No newline at end of file
<?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="cn.stylefeng.guns.modular.system.dao.DeptMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.model.Dept">
<id column="id" property="id"/>
<result column="num" property="num"/>
<result column="pid" property="pid"/>
<result column="pids" property="pids"/>
<result column="simplename" property="simplename"/>
<result column="fullname" property="fullname"/>
<result column="tips" property="tips"/>
<result column="version" property="version"/>
</resultMap>
<select id="tree" resultType="cn.stylefeng.guns.core.common.node.ZTreeNode">
select id,pid as pId,simplename as name,
(
CASE
WHEN (pId = 0 OR pId IS NULL) THEN
'true'
ELSE
'false'
END
) as isOpen from sys_dept
</select>
<select id="list" resultType="map">
select * from sys_dept
<if test="condition != null and condition != ''">
where simplename like CONCAT('%',#{condition},'%') or fullname like CONCAT('%',#{condition},'%')
</if>
order by num ASC
</select>
</mapper>
<?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="cn.stylefeng.guns.modular.system.dao.DictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.model.Dict">
<id column="id" property="id"/>
<result column="num" property="num"/>
<result column="pid" property="pid"/>
<result column="name" property="name"/>
<result column="code" property="code"/>
<result column="tips" property="tips"/>
</resultMap>
<sql id="Base_Column_List">
id, num, pid, name,code,tips
</sql>
<select id="selectByCode" resultType="cn.stylefeng.guns.modular.system.model.Dict">
select
<include refid="Base_Column_List"/>
from sys_dict
where code = #{code}
</select>
<select id="selectByParentCode" resultType="cn.stylefeng.guns.modular.system.model.Dict">
select
<include refid="Base_Column_List"/>
from sys_dict
where pid in(select id from sys_dict where code = #{code}) order by num asc
</select>
<select id="list" resultType="map">
select * from sys_dict
where pid = 0
<if test="condition != null and condition != ''">
AND name like CONCAT('%',#{condition},'%')
</if>
order by id ASC
</select>
</mapper>
<?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="cn.stylefeng.guns.modular.system.dao.NoticeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.model.Notice">
<id column="id" property="id"/>
<result column="title" property="title"/>
<result column="type" property="type"/>
<result column="content" property="content"/>
<result column="createtime" property="createtime"/>
<result column="creater" property="creater"/>
</resultMap>
<select id="list" resultType="map">
select * from sys_notice
<if test="condition != null and condition != ''">
where title like CONCAT('%',#{condition},'%') or content like CONCAT('%',#{condition},'%')
</if>
order by createtime DESC
</select>
</mapper>
<?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="cn.stylefeng.guns.modular.system.dao.RelationMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.model.Relation">
<id column="id" property="id" />
<result column="menuid" property="menuid" />
<result column="roleid" property="roleid" />
</resultMap>
</mapper>
<?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="cn.stylefeng.guns.modular.system.dao.UserMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.model.User">
<id column="id" property="id" />
<result column="avatar" property="avatar" />
<result column="account" property="account" />
<result column="password" property="password" />
<result column="salt" property="salt" />
<result column="name" property="name" />
<result column="birthday" property="birthday" />
<result column="sex" property="sex" />
<result column="email" property="email" />
<result column="phone" property="phone" />
<result column="roleid" property="roleid" />
<result column="deptid" property="deptid" />
<result column="status" property="status" />
<result column="createtime" property="createtime" />
<result column="version" property="version" />
</resultMap>
<sql id="Base_Column_List">
id, account, name, birthday, sex, email, avatar,
phone, roleid,
deptid, status,
createtime, version
</sql>
<sql id="Base_Column_List_With_Pwd">
id, account, name, birthday,password, sex, email, avatar,
phone, roleid,salt,
deptid, status,
createtime, version
</sql>
<select id="selectUsers" resultType="map">
select
<include refid="Base_Column_List" />
from sys_user
where status != 3
<if test="name != null and name != ''">
and (phone like CONCAT('%',#{name},'%')
or account like CONCAT('%',#{name},'%')
or name like CONCAT('%',#{name},'%'))
</if>
<if test="deptid != null and deptid != 0">
and (deptid = #{deptid} or deptid in ( select id from sys_dept where pids like CONCAT('%[', #{deptid}, ']%') ))
</if>
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
</if>
</select>
<update id="setStatus">
update sys_user set status = #{status} where id =
#{userId}
</update>
<update id="changePwd">
update sys_user set password = #{pwd} where id =
#{userId}
</update>
<update id="setRoles">
update sys_user set roleid = #{roleIds} where id =
#{userId}
</update>
<select id="getByAccount" resultType="cn.stylefeng.guns.modular.system.model.User">
select
<include refid="Base_Column_List_With_Pwd" />
from sys_user where account = #{account} and status != 3
</select>
</mapper>
package cn.stylefeng.guns.modular.system.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 数据库链接信息
* </p>
*
* @author stylefeng
* @since 2018-12-07
*/
@TableName("code_dbinfo")
public class CodeDbinfo implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "DB_ID", type = IdType.AUTO)
private Long dbId;
/**
* 别名
*/
@TableField("NAME")
private String name;
/**
* 数据库驱动
*/
@TableField("DB_DRIVER")
private String dbDriver;
/**
* 数据库地址
*/
@TableField("DB_URL")
private String dbUrl;
/**
* 数据库账户
*/
@TableField("DB_USER_NAME")
private String dbUserName;
/**
* 连接密码
*/
@TableField("DB_PASSWORD")
private String dbPassword;
/**
* 数据库类型(字典)
*/
@TableField("DB_TYPE")
private String dbType;
/**
* 创建时间
*/
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
private Date createTime;
/**
* 修改时间
*/
@TableField(value = "UPDATE_TIME", fill = FieldFill.UPDATE)
private Date updateTime;
/**
* 创建用户
*/
@TableField(value = "CREATE_USER", fill = FieldFill.INSERT)
private Long createUser;
/**
* 修改用户
*/
@TableField(value = "UPDATE_USER", fill = FieldFill.UPDATE)
private Long updateUser;
public Long getDbId() {
return dbId;
}
public void setDbId(Long dbId) {
this.dbId = dbId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDbDriver() {
return dbDriver;
}
public void setDbDriver(String dbDriver) {
this.dbDriver = dbDriver;
}
public String getDbUrl() {
return dbUrl;
}
public void setDbUrl(String dbUrl) {
this.dbUrl = dbUrl;
}
public String getDbUserName() {
return dbUserName;
}
public void setDbUserName(String dbUserName) {
this.dbUserName = dbUserName;
}
public String getDbPassword() {
return dbPassword;
}
public void setDbPassword(String dbPassword) {
this.dbPassword = dbPassword;
}
public String getDbType() {
return dbType;
}
public void setDbType(String dbType) {
this.dbType = dbType;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
@Override
public String toString() {
return "CodeDbinfo{" +
", dbId=" + dbId +
", name=" + name +
", dbDriver=" + dbDriver +
", dbUrl=" + dbUrl +
", dbUserName=" + dbUserName +
", dbPassword=" + dbPassword +
", dbType=" + dbType +
", createTime=" + createTime +
", updateTime=" + updateTime +
", createUser=" + createUser +
", updateUser=" + updateUser +
"}";
}
}
package cn.stylefeng.guns.modular.system.model;
package cn.stylefeng.guns.modular.system.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
......@@ -13,69 +15,88 @@ import java.io.Serializable;
* </p>
*
* @author stylefeng
* @since 2017-07-11
* @since 2018-12-07
*/
@TableName("sys_dept")
public class Dept extends Model<Dept> {
public class Dept implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 排序
*/
private Integer num;
@TableId(value = "DEPT_ID", type = IdType.AUTO)
private Long deptId;
/**
* 父部门id
*/
private Integer pid;
@TableField("PID")
private Long pid;
/**
* 父级ids
*/
@TableField("PIDS")
private String pids;
/**
* 简称
*/
private String simplename;
@TableField("SIMPLE_NAME")
private String simpleName;
/**
* 全称
*/
private String fullname;
@TableField("FULL_NAME")
private String fullName;
/**
* 提示
* 描述
*/
private String tips;
@TableField("DESCRIPTION")
private String description;
/**
* 版本(乐观锁保留字段)
*/
@TableField("VERSION")
private Integer version;
/**
* 排序
*/
@TableField("SORT")
private Integer sort;
/**
* 创建时间
*/
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
private Date createTime;
/**
* 修改时间
*/
@TableField(value = "UPDATE_TIME", fill = FieldFill.UPDATE)
private Date updateTime;
/**
* 创建人
*/
@TableField(value = "CREATE_USER", fill = FieldFill.INSERT)
private Long createUser;
/**
* 修改人
*/
@TableField(value = "UPDATE_USER", fill = FieldFill.UPDATE)
private Long updateUser;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getNum() {
return num;
public Long getDeptId() {
return deptId;
}
public void setNum(Integer num) {
this.num = num;
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public Integer getPid() {
public Long getPid() {
return pid;
}
public void setPid(Integer pid) {
public void setPid(Long pid) {
this.pid = pid;
}
......@@ -87,28 +108,28 @@ public class Dept extends Model<Dept> {
this.pids = pids;
}
public String getSimplename() {
return simplename;
public String getSimpleName() {
return simpleName;
}
public void setSimplename(String simplename) {
this.simplename = simplename;
public void setSimpleName(String simpleName) {
this.simpleName = simpleName;
}
public String getFullname() {
return fullname;
public String getFullName() {
return fullName;
}
public void setFullname(String fullname) {
this.fullname = fullname;
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getTips() {
return tips;
public String getDescription() {
return description;
}
public void setTips(String tips) {
this.tips = tips;
public void setDescription(String description) {
this.description = description;
}
public Integer getVersion() {
......@@ -119,22 +140,61 @@ public class Dept extends Model<Dept> {
this.version = version;
}
@Override
protected Serializable pkVal() {
return this.id;
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
@Override
public String toString() {
return "Dept{" +
"id=" + id +
", num=" + num +
", deptId=" + deptId +
", pid=" + pid +
", pids=" + pids +
", simplename=" + simplename +
", fullname=" + fullname +
", tips=" + tips +
", simpleName=" + simpleName +
", fullName=" + fullName +
", description=" + description +
", version=" + version +
", sort=" + sort +
", createTime=" + createTime +
", updateTime=" + updateTime +
", createUser=" + createUser +
", updateUser=" + updateUser +
"}";
}
}
package cn.stylefeng.guns.modular.system.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 字典表
* </p>
*
* @author stylefeng
* @since 2018-12-07
*/
@TableName("sys_dict")
public class Dict implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "DICT_ID", type = IdType.AUTO)
private Long dictId;
/**
* 父级字典id
*/
@TableField("PID")
private Long pid;
/**
* 字典名称
*/
@TableField("NAME")
private String name;
/**
* 字典的编码
*/
@TableField("CODE")
private String code;
/**
* 字典描述
*/
@TableField("DESCRIPTION")
private String description;
/**
* 排序
*/
@TableField("SORT")
private Integer sort;
/**
* 创建时间
*/
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
private Date createTime;
/**
* 修改时间
*/
@TableField(value = "UPDATE_TIME", fill = FieldFill.UPDATE)
private Date updateTime;
/**
* 创建人
*/
@TableField(value = "CREATE_USER", fill = FieldFill.INSERT)
private Long createUser;
/**
* 修改人
*/
@TableField(value = "UPDATE_USER", fill = FieldFill.UPDATE)
private Long updateUser;
public Long getDictId() {
return dictId;
}
public void setDictId(Long dictId) {
this.dictId = dictId;
}
public Long getPid() {
return pid;
}
public void setPid(Long pid) {
this.pid = pid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
@Override
public String toString() {
return "Dict{" +
", dictId=" + dictId +
", pid=" + pid +
", name=" + name +
", code=" + code +
", description=" + description +
", sort=" + sort +
", createTime=" + createTime +
", updateTime=" + updateTime +
", createUser=" + createUser +
", updateUser=" + updateUser +
"}";
}
}
package cn.stylefeng.guns.modular.system.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 文件信息表
* </p>
*
* @author stylefeng
* @since 2018-12-07
*/
@TableName("sys_file_info")
public class FileInfo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId("FILE_ID")
private String fileId;
/**
* base64编码的文件
*/
@TableField("FILE_DATA")
private String fileData;
/**
* 创建时间
*/
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
private Date createTime;
/**
* 修改时间
*/
@TableField(value = "UPDATE_TIME", fill = FieldFill.UPDATE)
private Date updateTime;
/**
* 创建用户
*/
@TableField(value = "CREATE_USER", fill = FieldFill.INSERT)
private Long createUser;
/**
* 修改用户
*/
@TableField(value = "UPDATE_USER", fill = FieldFill.UPDATE)
private Long updateUser;
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
public String getFileData() {
return fileData;
}
public void setFileData(String fileData) {
this.fileData = fileData;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
@Override
public String toString() {
return "FileInfo{" +
", fileId=" + fileId +
", fileData=" + fileData +
", createTime=" + createTime +
", updateTime=" + updateTime +
", createUser=" + createUser +
", updateUser=" + updateUser +
"}";
}
}
package cn.stylefeng.guns.modular.system.model;
package cn.stylefeng.guns.modular.system.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import java.io.Serializable;
......@@ -14,74 +15,80 @@ import java.util.Date;
* </p>
*
* @author stylefeng
* @since 2017-07-11
* @since 2018-12-07
*/
@TableName("sys_login_log")
public class LoginLog extends Model<LoginLog> {
public class LoginLog implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableId(value = "LOGIN_LOG_ID", type = IdType.AUTO)
private Long loginLogId;
/**
* 日志名称
*/
private String logname;
@TableField("LOG_NAME")
private String logName;
/**
* 管理员id
*/
private Integer userid;
@TableField("USER_ID")
private Long userId;
/**
* 创建时间
*/
private Date createtime;
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
private Date createTime;
/**
* 是否执行成功
*/
@TableField("SUCCEED")
private String succeed;
/**
* 具体消息
*/
@TableField("MESSAGE")
private String message;
/**
* 登录ip
*/
private String ip;
@TableField("IP_ADDRESS")
private String ipAddress;
public Integer getId() {
return id;
public Long getLoginLogId() {
return loginLogId;
}
public void setId(Integer id) {
this.id = id;
public void setLoginLogId(Long loginLogId) {
this.loginLogId = loginLogId;
}
public String getLogname() {
return logname;
public String getLogName() {
return logName;
}
public void setLogname(String logname) {
this.logname = logname;
public void setLogName(String logName) {
this.logName = logName;
}
public Integer getUserid() {
return userid;
public Long getUserId() {
return userId;
}
public void setUserid(Integer userid) {
this.userid = userid;
public void setUserId(Long userId) {
this.userId = userId;
}
public Date getCreatetime() {
return createtime;
public Date getCreateTime() {
return createTime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getSucceed() {
......@@ -100,29 +107,24 @@ public class LoginLog extends Model<LoginLog> {
this.message = message;
}
public String getIp() {
return ip;
public String getIpAddress() {
return ipAddress;
}
public void setIp(String ip) {
this.ip = ip;
}
@Override
protected Serializable pkVal() {
return this.id;
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
@Override
public String toString() {
return "LoginLog{" +
"id=" + id +
", logname=" + logname +
", userid=" + userid +
", createtime=" + createtime +
", loginLogId=" + loginLogId +
", logName=" + logName +
", userId=" + userId +
", createTime=" + createTime +
", succeed=" + succeed +
", message=" + message +
", ip=" + ip +
", ipAddress=" + ipAddress +
"}";
}
}
package cn.stylefeng.guns.modular.system.model;
package cn.stylefeng.guns.modular.system.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
......@@ -14,76 +15,111 @@ import java.io.Serializable;
* </p>
*
* @author stylefeng
* @since 2017-07-11
* @since 2018-12-07
*/
@TableName("sys_menu")
public class Menu extends Model<Menu> {
public class Menu implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@TableId(value = "MENU_ID", type = IdType.AUTO)
private Long menuId;
/**
* 菜单编号
*/
@TableField("CODE")
private String code;
/**
* 菜单父编号
*/
@TableField("PCODE")
private String pcode;
/**
* 当前菜单的所有父菜单编号
*/
@TableField("PCODES")
private String pcodes;
/**
* 菜单名称
*/
@NotBlank
@TableField("NAME")
private String name;
/**
* 菜单图标
*/
@TableField("ICON")
private String icon;
/**
* url地址
*/
@NotBlank
@TableField("URL")
private String url;
/**
* 菜单排序号
*/
private Integer num;
@TableField("SORT")
private Integer sort;
/**
* 菜单层级
*/
@TableField("LEVELS")
private Integer levels;
/**
* 是否是菜单(1:是 0:不是)
* 是否是菜单(字典)
*/
private Integer ismenu;
@TableField("MENU_FLAG")
private String menuFlag;
/**
* 备注
*/
private String tips;
@TableField("DESCRIPTION")
private String description;
/**
* 菜单状态 : 1:启用 0:不启用
* 菜单状态(字典)
*/
private Integer status;
@TableField("STATUS")
private String status;
/**
* 是否打开: 1:打开 0:不打开
* 是否打开新页面的标识(字典)
*/
private Integer isopen;
@TableField("NEW_PAGE_FLAG")
private String newPageFlag;
/**
* 是否打开(字典)
*/
@TableField("OPEN_FLAG")
private String openFlag;
/**
* 创建时间
*/
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
private Date createTime;
/**
* 修改时间
*/
@TableField(value = "UPDATE_TIME", fill = FieldFill.UPDATE)
private Date updateTime;
/**
* 创建人
*/
@TableField(value = "CREATE_USER", fill = FieldFill.INSERT)
private Long createUser;
/**
* 修改人
*/
@TableField(value = "UPDATE_USER", fill = FieldFill.UPDATE)
private Long updateUser;
public Long getId() {
return id;
public Long getMenuId() {
return menuId;
}
public void setId(Long id) {
this.id = id;
public void setMenuId(Long menuId) {
this.menuId = menuId;
}
public String getCode() {
......@@ -134,12 +170,12 @@ public class Menu extends Model<Menu> {
this.url = url;
}
public Integer getNum() {
return num;
public Integer getSort() {
return sort;
}
public void setNum(Integer num) {
this.num = num;
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getLevels() {
......@@ -150,59 +186,99 @@ public class Menu extends Model<Menu> {
this.levels = levels;
}
public Integer getIsmenu() {
return ismenu;
public String getMenuFlag() {
return menuFlag;
}
public void setIsmenu(Integer ismenu) {
this.ismenu = ismenu;
public void setMenuFlag(String menuFlag) {
this.menuFlag = menuFlag;
}
public String getTips() {
return tips;
public String getDescription() {
return description;
}
public void setTips(String tips) {
this.tips = tips;
public void setDescription(String description) {
this.description = description;
}
public Integer getStatus() {
public String getStatus() {
return status;
}
public void setStatus(Integer status) {
public void setStatus(String status) {
this.status = status;
}
public Integer getIsopen() {
return isopen;
public String getNewPageFlag() {
return newPageFlag;
}
public void setIsopen(Integer isopen) {
this.isopen = isopen;
public void setNewPageFlag(String newPageFlag) {
this.newPageFlag = newPageFlag;
}
@Override
protected Serializable pkVal() {
return this.id;
public String getOpenFlag() {
return openFlag;
}
public void setOpenFlag(String openFlag) {
this.openFlag = openFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
@Override
public String toString() {
return "Menu{" +
"id=" + id +
", menuId=" + menuId +
", code=" + code +
", pcode=" + pcode +
", pcodes=" + pcodes +
", name=" + name +
", icon=" + icon +
", url=" + url +
", num=" + num +
", sort=" + sort +
", levels=" + levels +
", ismenu=" + ismenu +
", tips=" + tips +
", menuFlag=" + menuFlag +
", description=" + description +
", status=" + status +
", isopen=" + isopen +
", newPageFlag=" + newPageFlag +
", openFlag=" + openFlag +
", createTime=" + createTime +
", updateTime=" + updateTime +
", createUser=" + createUser +
", updateUser=" + updateUser +
"}";
}
}
package cn.stylefeng.guns.modular.system.model;
package cn.stylefeng.guns.modular.system.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import java.io.Serializable;
......@@ -14,46 +15,56 @@ import java.util.Date;
* </p>
*
* @author stylefeng
* @since 2017-07-11
* @since 2018-12-07
*/
@TableName("sys_notice")
public class Notice extends Model<Notice> {
public class Notice implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableId(value = "NOTICE_ID", type = IdType.AUTO)
private Long noticeId;
/**
* 标题
*/
@TableField("TITLE")
private String title;
/**
* 类型
*/
private Integer type;
/**
* 内容
*/
@TableField("CONTENT")
private String content;
/**
* 创建时间
*/
private Date createtime;
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
private Date createTime;
/**
* 创建人
*/
private Integer creater;
@TableField(value = "CREATE_USER", fill = FieldFill.INSERT)
private Long createUser;
/**
* 修改时间
*/
@TableField(value = "UPDATE_TIME", fill = FieldFill.UPDATE)
private Date updateTime;
/**
* 修改人
*/
@TableField(value = "UPDATE_USER", fill = FieldFill.UPDATE)
private Long updateUser;
public Integer getId() {
return id;
public Long getNoticeId() {
return noticeId;
}
public void setId(Integer id) {
this.id = id;
public void setNoticeId(Long noticeId) {
this.noticeId = noticeId;
}
public String getTitle() {
......@@ -64,14 +75,6 @@ public class Notice extends Model<Notice> {
this.title = title;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getContent() {
return content;
}
......@@ -80,36 +83,48 @@ public class Notice extends Model<Notice> {
this.content = content;
}
public Date getCreatetime() {
return createtime;
public Date getCreateTime() {
return createTime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getCreater() {
return creater;
public Long getCreateUser() {
return createUser;
}
public void setCreater(Integer creater) {
this.creater = creater;
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
@Override
protected Serializable pkVal() {
return this.id;
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
@Override
public String toString() {
return "Notice{" +
"id=" + id +
", noticeId=" + noticeId +
", title=" + title +
", type=" + type +
", content=" + content +
", createtime=" + createtime +
", creater=" + creater +
", createTime=" + createTime +
", createUser=" + createUser +
", updateTime=" + updateTime +
", updateUser=" + updateUser +
"}";
}
}
package cn.stylefeng.guns.modular.system.model;
package cn.stylefeng.guns.modular.system.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import java.io.Serializable;
......@@ -14,90 +15,98 @@ import java.util.Date;
* </p>
*
* @author stylefeng
* @since 2017-07-11
* @since 2018-12-07
*/
@TableName("sys_operation_log")
public class OperationLog extends Model<OperationLog> {
public class OperationLog implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableId(value = "OPERATION_LOG_ID", type = IdType.AUTO)
private Long operationLogId;
/**
* 日志类型
* 日志类型(字典)
*/
private String logtype;
@TableField("LOG_TYPE")
private String logType;
/**
* 日志名称
*/
private String logname;
@TableField("LOG_NAME")
private String logName;
/**
* 用户id
*/
private Integer userid;
@TableField("USER_ID")
private Long userId;
/**
* 类名称
*/
private String classname;
@TableField("CLASS_NAME")
private String className;
/**
* 方法名称
*/
@TableField("METHOD")
private String method;
/**
* 创建时间
*/
private Date createtime;
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
private Date createTime;
/**
* 是否成功
* 是否成功(字典)
*/
@TableField("SUCCEED")
private String succeed;
/**
* 备注
*/
@TableField("MESSAGE")
private String message;
public Integer getId() {
return id;
public Long getOperationLogId() {
return operationLogId;
}
public void setId(Integer id) {
this.id = id;
public void setOperationLogId(Long operationLogId) {
this.operationLogId = operationLogId;
}
public String getLogtype() {
return logtype;
public String getLogType() {
return logType;
}
public void setLogtype(String logtype) {
this.logtype = logtype;
public void setLogType(String logType) {
this.logType = logType;
}
public String getLogname() {
return logname;
public String getLogName() {
return logName;
}
public void setLogname(String logname) {
this.logname = logname;
public void setLogName(String logName) {
this.logName = logName;
}
public Integer getUserid() {
return userid;
public Long getUserId() {
return userId;
}
public void setUserid(Integer userid) {
this.userid = userid;
public void setUserId(Long userId) {
this.userId = userId;
}
public String getClassname() {
return classname;
public String getClassName() {
return className;
}
public void setClassname(String classname) {
this.classname = classname;
public void setClassName(String className) {
this.className = className;
}
public String getMethod() {
......@@ -108,12 +117,12 @@ public class OperationLog extends Model<OperationLog> {
this.method = method;
}
public Date getCreatetime() {
return createtime;
public Date getCreateTime() {
return createTime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getSucceed() {
......@@ -133,20 +142,15 @@ public class OperationLog extends Model<OperationLog> {
}
@Override
protected Serializable pkVal() {
return this.id;
}
@Override
public String toString() {
return "OperationLog{" +
"id=" + id +
", logtype=" + logtype +
", logname=" + logname +
", userid=" + userid +
", classname=" + classname +
", operationLogId=" + operationLogId +
", logType=" + logType +
", logName=" + logName +
", userId=" + userId +
", className=" + className +
", method=" + method +
", createtime=" + createtime +
", createTime=" + createTime +
", succeed=" + succeed +
", message=" + message +
"}";
......
package cn.stylefeng.guns.modular.system.model;
package cn.stylefeng.guns.modular.system.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import java.io.Serializable;
......@@ -13,63 +12,60 @@ import java.io.Serializable;
* </p>
*
* @author stylefeng
* @since 2017-07-11
* @since 2018-12-07
*/
@TableName("sys_relation")
public class Relation extends Model<Relation> {
public class Relation implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableId("RELATION_ID")
private Long relationId;
/**
* 菜单id
*/
private Long menuid;
@TableField("MENU_ID")
private Long menuId;
/**
* 角色id
*/
private Integer roleid;
@TableField("ROLE_ID")
private Long roleId;
public Integer getId() {
return id;
public Long getRelationId() {
return relationId;
}
public void setId(Integer id) {
this.id = id;
public void setRelationId(Long relationId) {
this.relationId = relationId;
}
public Long getMenuid() {
return menuid;
public Long getMenuId() {
return menuId;
}
public void setMenuid(Long menuid) {
this.menuid = menuid;
public void setMenuId(Long menuId) {
this.menuId = menuId;
}
public Integer getRoleid() {
return roleid;
public Long getRoleId() {
return roleId;
}
public void setRoleid(Integer roleid) {
this.roleid = roleid;
}
@Override
protected Serializable pkVal() {
return this.id;
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
@Override
public String toString() {
return "Relation{" +
"id=" + id +
", menuid=" + menuid +
", roleid=" + roleid +
", relationId=" + relationId +
", menuId=" + menuId +
", roleId=" + roleId +
"}";
}
}
package cn.stylefeng.guns.modular.system.model;
package cn.stylefeng.guns.modular.system.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
......@@ -13,65 +15,78 @@ import java.io.Serializable;
* </p>
*
* @author stylefeng
* @since 2017-07-11
* @since 2018-12-07
*/
@TableName("sys_role")
public class Role extends Model<Role> {
public class Role implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 序号
*/
private Integer num;
@TableId(value = "ROLE_ID", type = IdType.AUTO)
private Long roleId;
/**
* 父角色id
*/
private Integer pid;
@TableField("PID")
private Long pid;
/**
* 角色名称
*/
@TableField("NAME")
private String name;
/**
* 部门名称
* 提示
*/
private Integer deptid;
@TableField("DESCRIPTION")
private String description;
/**
* 提示
* 序号
*/
private String tips;
@TableField("SORT")
private Integer sort;
/**
* 保留字段(暂时没用)
* 乐观锁
*/
@TableField("VERSION")
private Integer version;
/**
* 创建时间
*/
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
private Date createTime;
/**
* 修改时间
*/
@TableField(value = "UPDATE_TIME", fill = FieldFill.UPDATE)
private Date updateTime;
/**
* 创建用户
*/
@TableField(value = "CREATE_USER", fill = FieldFill.INSERT)
private Long createUser;
/**
* 修改用户
*/
@TableField(value = "UPDATE_USER", fill = FieldFill.UPDATE)
private Long updateUser;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
public Long getRoleId() {
return roleId;
}
public Integer getNum() {
return num;
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public void setNum(Integer num) {
this.num = num;
}
public Integer getPid() {
public Long getPid() {
return pid;
}
public void setPid(Integer pid) {
public void setPid(Long pid) {
this.pid = pid;
}
......@@ -83,20 +98,20 @@ public class Role extends Model<Role> {
this.name = name;
}
public Integer getDeptid() {
return deptid;
public String getDescription() {
return description;
}
public void setDeptid(Integer deptid) {
this.deptid = deptid;
public void setDescription(String description) {
this.description = description;
}
public String getTips() {
return tips;
public Integer getSort() {
return sort;
}
public void setTips(String tips) {
this.tips = tips;
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getVersion() {
......@@ -107,21 +122,51 @@ public class Role extends Model<Role> {
this.version = version;
}
@Override
protected Serializable pkVal() {
return this.id;
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
@Override
public String toString() {
return "Role{" +
"id=" + id +
", num=" + num +
", roleId=" + roleId +
", pid=" + pid +
", name=" + name +
", deptid=" + deptid +
", tips=" + tips +
", description=" + description +
", sort=" + sort +
", version=" + version +
", createTime=" + createTime +
", updateTime=" + updateTime +
", createUser=" + createUser +
", updateUser=" + updateUser +
"}";
}
}
package cn.stylefeng.guns.modular.system.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 管理员表
* </p>
*
* @author stylefeng
* @since 2018-12-07
*/
@TableName("sys_user")
@Data
public class User implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "USER_ID", type = IdType.AUTO)
private Long userId;
/**
* 头像
*/
@TableField("AVATAR")
private String avatar;
/**
* 账号
*/
@TableField("ACCOUNT")
private String account;
/**
* 密码
*/
@TableField("PASSWORD")
private String password;
/**
* md5密码盐
*/
@TableField("SALT")
private String salt;
/**
* 名字
*/
@TableField("NAME")
private String name;
/**
* 生日
*/
@TableField("BIRTHDAY")
private Date birthday;
/**
* 性别(字典)
*/
@TableField("SEX")
private String sex;
/**
* 电子邮件
*/
@TableField("EMAIL")
private String email;
/**
* 电话
*/
@TableField("PHONE")
private String phone;
/**
* 角色id(多个逗号隔开)
*/
@TableField("ROLE_ID")
private String roleId;
/**
* 部门id(多个逗号隔开)
*/
@TableField("DEPT_ID")
private Long deptId;
/**
* 状态(字典)
*/
@TableField("STATUS")
private String status;
/**
* 创建时间
*/
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
private Date createTime;
/**
* 创建人
*/
@TableField(value = "CREATE_USER", fill = FieldFill.INSERT)
private Long createUser;
/**
* 更新时间
*/
@TableField(value = "UPDATE_TIME", fill = FieldFill.UPDATE)
private Date updateTime;
/**
* 更新人
*/
@TableField(value = "UPDATE_USER", fill = FieldFill.UPDATE)
private Long updateUser;
/**
* 乐观锁
*/
@TableField("VERSION")
private Integer version;
}
......@@ -18,7 +18,7 @@ package cn.stylefeng.guns.modular.system.factory;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.stylefeng.guns.core.common.constant.state.ManagerStatus;
import cn.stylefeng.guns.modular.system.model.User;
import cn.stylefeng.guns.modular.system.entity.User;
import cn.stylefeng.guns.modular.system.transfer.UserDto;
import cn.stylefeng.roses.core.util.ToolUtil;
import org.springframework.beans.BeanUtils;
......@@ -44,7 +44,7 @@ public class UserFactory {
} else {
User user = new User();
BeanUtils.copyProperties(userDto, user);
user.setCreatetime(new Date());
user.setCreateTime(new Date());
user.setStatus(ManagerStatus.OK.getCode());
user.setPassword(md5Password);
user.setSalt(salt);
......@@ -69,7 +69,7 @@ public class UserFactory {
oldUser.setBirthday(newUser.getBirthday());
}
if (ToolUtil.isNotEmpty(newUser.getDeptid())) {
oldUser.setDeptid(newUser.getDeptid());
oldUser.setDeptId(newUser.getDeptid());
}
if (ToolUtil.isNotEmpty(newUser.getSex())) {
oldUser.setSex(newUser.getSex());
......
package cn.stylefeng.guns.modular.system.mapper;
import cn.stylefeng.guns.modular.system.entity.CodeDbinfo;
import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
* <p>
* 数据库链接信息 Mapper 接口
* </p>
*
* @author stylefeng
* @since 2018-12-07
*/
public interface CodeDbinfoMapper extends BaseMapper<CodeDbinfo> {
}
/**
* Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng)
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.stylefeng.guns.modular.system.dao;
package cn.stylefeng.guns.modular.system.mapper;
import cn.stylefeng.guns.core.common.node.ZTreeNode;
import cn.stylefeng.guns.modular.system.model.Dept;
import cn.stylefeng.guns.modular.system.entity.Dept;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
......@@ -29,7 +14,7 @@ import java.util.Map;
* </p>
*
* @author stylefeng
* @since 2017-07-11
* @since 2018-12-07
*/
public interface DeptMapper extends BaseMapper<Dept> {
......
/**
* Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng)
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.stylefeng.guns.modular.system.dao;
package cn.stylefeng.guns.modular.system.mapper;
import cn.stylefeng.guns.modular.system.model.Dict;
import cn.stylefeng.guns.modular.system.entity.Dict;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
......@@ -28,7 +13,7 @@ import java.util.Map;
* </p>
*
* @author stylefeng
* @since 2017-07-11
* @since 2018-12-07
*/
public interface DictMapper extends BaseMapper<Dict> {
......@@ -46,4 +31,5 @@ public interface DictMapper extends BaseMapper<Dict> {
* 根据父类编码获取词典列表
*/
List<Dict> selectByParentCode(@Param("code") String code);
}
package cn.stylefeng.guns.modular.system.mapper;
import cn.stylefeng.guns.modular.system.entity.FileInfo;
import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
* <p>
* 文件信息表
Mapper 接口
* </p>
*
* @author stylefeng
* @since 2018-12-07
*/
public interface FileInfoMapper extends BaseMapper<FileInfo> {
}
/**
* Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng)
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.stylefeng.guns.modular.system.dao;
package cn.stylefeng.guns.modular.system.mapper;
import cn.stylefeng.guns.modular.system.model.LoginLog;
import cn.stylefeng.guns.modular.system.entity.LoginLog;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import org.apache.ibatis.annotations.Param;
......@@ -29,7 +14,7 @@ import java.util.Map;
* </p>
*
* @author stylefeng
* @since 2017-07-11
* @since 2018-12-07
*/
public interface LoginLogMapper extends BaseMapper<LoginLog> {
......@@ -38,5 +23,4 @@ public interface LoginLogMapper extends BaseMapper<LoginLog> {
*/
List<Map<String, Object>> getLoginLogs(@Param("page") Page<LoginLog> page, @Param("beginTime") String beginTime,
@Param("endTime") String endTime, @Param("logName") String logName, @Param("orderByField") String orderByField, @Param("isAsc") boolean isAsc);
}
/**
* Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng)
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.stylefeng.guns.modular.system.dao;
package cn.stylefeng.guns.modular.system.mapper;
import cn.stylefeng.guns.core.common.node.MenuNode;
import cn.stylefeng.guns.core.common.node.ZTreeNode;
import cn.stylefeng.guns.modular.system.model.Menu;
import cn.stylefeng.guns.modular.system.entity.Menu;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
......@@ -30,7 +15,7 @@ import java.util.Map;
* </p>
*
* @author stylefeng
* @since 2017-07-11
* @since 2018-12-07
*/
public interface MenuMapper extends BaseMapper<Menu> {
......@@ -48,7 +33,7 @@ public interface MenuMapper extends BaseMapper<Menu> {
* @return
* @date 2017年2月12日 下午9:14:34
*/
List<Long> getMenuIdsByRoleId(@Param("roleId") Integer roleId);
List<Long> getMenuIdsByRoleId(@Param("roleId") Long roleId);
/**
* 获取菜单列表树
......@@ -82,7 +67,7 @@ public interface MenuMapper extends BaseMapper<Menu> {
* @return
* @date 2017年2月19日 下午7:12:38
*/
List<String> getResUrlsByRoleId(Integer roleId);
List<String> getResUrlsByRoleId(Long roleId);
/**
* 根据角色获取菜单
......@@ -91,5 +76,6 @@ public interface MenuMapper extends BaseMapper<Menu> {
* @return
* @date 2017年2月19日 下午10:35:40
*/
List<MenuNode> getMenusByRoleIds(List<Integer> roleIds);
List<MenuNode> getMenusByRoleIds(List<Long> roleIds);
}
/**
* Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng)
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.stylefeng.guns.modular.system.dao;
package cn.stylefeng.guns.modular.system.mapper;
import cn.stylefeng.guns.modular.system.model.Notice;
import cn.stylefeng.guns.modular.system.entity.Notice;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
......@@ -28,7 +13,7 @@ import java.util.Map;
* </p>
*
* @author stylefeng
* @since 2017-07-11
* @since 2018-12-07
*/
public interface NoticeMapper extends BaseMapper<Notice> {
......
/**
* Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng)
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.stylefeng.guns.modular.system.dao;
package cn.stylefeng.guns.modular.system.mapper;
import cn.stylefeng.guns.modular.system.model.OperationLog;
import cn.stylefeng.guns.modular.system.entity.OperationLog;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import org.apache.ibatis.annotations.Param;
......@@ -29,7 +14,7 @@ import java.util.Map;
* </p>
*
* @author stylefeng
* @since 2017-07-11
* @since 2018-12-07
*/
public interface OperationLogMapper extends BaseMapper<OperationLog> {
......@@ -38,4 +23,5 @@ public interface OperationLogMapper extends BaseMapper<OperationLog> {
*/
List<Map<String, Object>> getOperationLogs(@Param("page") Page<OperationLog> page, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("logName") String logName, @Param("logType") String logType, @Param("orderByField") String orderByField, @Param("isAsc") boolean isAsc);
}
package cn.stylefeng.guns.modular.system.mapper;
import cn.stylefeng.guns.modular.system.entity.Relation;
import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
* <p>
* 角色和菜单关联表 Mapper 接口
* </p>
*
* @author stylefeng
* @since 2018-12-07
*/
public interface RelationMapper extends BaseMapper<Relation> {
}
/**
* Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng)
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.stylefeng.guns.modular.system.dao;
package cn.stylefeng.guns.modular.system.mapper;
import cn.stylefeng.guns.core.common.node.ZTreeNode;
import cn.stylefeng.guns.modular.system.model.Role;
import cn.stylefeng.guns.modular.system.entity.Role;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
......@@ -29,7 +14,7 @@ import java.util.Map;
* </p>
*
* @author stylefeng
* @since 2017-07-11
* @since 2018-12-07
*/
public interface RoleMapper extends BaseMapper<Role> {
......@@ -48,7 +33,7 @@ public interface RoleMapper extends BaseMapper<Role> {
* @return
* @date 2017年2月13日 下午7:57:51
*/
int deleteRolesById(@Param("roleId") Integer roleId);
int deleteRolesById(@Param("roleId") Long roleId);
/**
* 获取角色列表树
......@@ -65,4 +50,5 @@ public interface RoleMapper extends BaseMapper<Role> {
* @date 2017年2月18日 上午10:32:04
*/
List<ZTreeNode> roleTreeListByRoleId(String[] roleId);
}
/**
* Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng)
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.stylefeng.guns.modular.system.dao;
package cn.stylefeng.guns.modular.system.mapper;
import cn.stylefeng.guns.modular.system.model.User;
import cn.stylefeng.guns.modular.system.entity.User;
import cn.stylefeng.roses.core.datascope.DataScope;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
......@@ -29,32 +14,33 @@ import java.util.Map;
* </p>
*
* @author stylefeng
* @since 2017-07-11
* @since 2018-12-07
*/
public interface UserMapper extends BaseMapper<User> {
/**
* 修改用户状态
*/
int setStatus(@Param("userId") Integer userId, @Param("status") int status);
int setStatus(@Param("userId") Long userId, @Param("status") String status);
/**
* 修改密码
*/
int changePwd(@Param("userId") Integer userId, @Param("pwd") String pwd);
int changePwd(@Param("userId") Long userId, @Param("pwd") String pwd);
/**
* 根据条件查询用户列表
*/
List<Map<String, Object>> selectUsers(@Param("dataScope") DataScope dataScope, @Param("name") String name, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("deptid") Integer deptid);
List<Map<String, Object>> selectUsers(@Param("dataScope") DataScope dataScope, @Param("name") String name, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("deptid") Long deptId);
/**
* 设置用户的角色
*/
int setRoles(@Param("userId") Integer userId, @Param("roleIds") String roleIds);
int setRoles(@Param("userId") Long userId, @Param("roleIds") String roleIds);
/**
* 通过账号获取用户
*/
User getByAccount(@Param("account") String account);
}
<?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="cn.stylefeng.guns.modular.system.mapper.CodeDbinfoMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.entity.CodeDbinfo">
<id column="DB_ID" property="dbId" />
<result column="NAME" property="name" />
<result column="DB_DRIVER" property="dbDriver" />
<result column="DB_URL" property="dbUrl" />
<result column="DB_USER_NAME" property="dbUserName" />
<result column="DB_PASSWORD" property="dbPassword" />
<result column="DB_TYPE" property="dbType" />
<result column="CREATE_TIME" property="createTime" />
<result column="UPDATE_TIME" property="updateTime" />
<result column="CREATE_USER" property="createUser" />
<result column="UPDATE_USER" property="updateUser" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
DB_ID AS dbId, NAME AS name, DB_DRIVER AS dbDriver, DB_URL AS dbUrl, DB_USER_NAME AS dbUserName, DB_PASSWORD AS dbPassword, DB_TYPE AS dbType, CREATE_TIME AS createTime, UPDATE_TIME AS updateTime, CREATE_USER AS createUser, UPDATE_USER AS updateUser
</sql>
</mapper>
<?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="cn.stylefeng.guns.modular.system.mapper.DeptMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.entity.Dept">
<id column="DEPT_ID" property="deptId"/>
<result column="PID" property="pid"/>
<result column="PIDS" property="pids"/>
<result column="SIMPLE_NAME" property="simpleName"/>
<result column="FULL_NAME" property="fullName"/>
<result column="DESCRIPTION" property="description"/>
<result column="VERSION" property="version"/>
<result column="SORT" property="sort"/>
<result column="CREATE_TIME" property="createTime"/>
<result column="UPDATE_TIME" property="updateTime"/>
<result column="CREATE_USER" property="createUser"/>
<result column="UPDATE_USER" property="updateUser"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
DEPT_ID AS deptId, PID AS pid, PIDS AS pids, SIMPLE_NAME AS simpleName, FULL_NAME AS fullName, DESCRIPTION AS description, VERSION AS version, SORT AS sort, CREATE_TIME AS createTime, UPDATE_TIME AS updateTime, CREATE_USER AS createUser, UPDATE_USER AS updateUser
</sql>
<select id="tree" resultType="cn.stylefeng.guns.core.common.node.ZTreeNode">
select DEPT_ID AS id, PID as pId, SIMPLE_NAME as name,
(
CASE
WHEN (PID = 0 OR PID IS NULL) THEN
'true'
ELSE
'false'
END
) as isOpen from sys_dept
</select>
<select id="list" resultType="map">
select
<include refid="Base_Column_List"/>
from sys_dept
<if test="condition != null and condition != ''">
where SIMPLE_NAME like CONCAT('%',#{condition},'%') or FULL_NAME like CONCAT('%',#{condition},'%')
</if>
order by SORT ASC
</select>
</mapper>
<?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="cn.stylefeng.guns.modular.system.mapper.DictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.entity.Dict">
<id column="DICT_ID" property="dictId"/>
<result column="PID" property="pid"/>
<result column="NAME" property="name"/>
<result column="CODE" property="code"/>
<result column="DESCRIPTION" property="description"/>
<result column="SORT" property="sort"/>
<result column="CREATE_TIME" property="createTime"/>
<result column="UPDATE_TIME" property="updateTime"/>
<result column="CREATE_USER" property="createUser"/>
<result column="UPDATE_USER" property="updateUser"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
DICT_ID AS dictId, PID AS pid, NAME AS name, CODE AS code, DESCRIPTION AS description, SORT AS sort, CREATE_TIME AS createTime, UPDATE_TIME AS updateTime, CREATE_USER AS createUser, UPDATE_USER AS updateUser
</sql>
<select id="selectByCode" resultType="cn.stylefeng.guns.modular.system.entity.Dict">
select
<include refid="Base_Column_List"/>
from sys_dict
where CODE = #{code}
</select>
<select id="selectByParentCode" resultType="cn.stylefeng.guns.modular.system.entity.Dict">
select
<include refid="Base_Column_List"/>
from sys_dict
where PID in(select DICT_ID from sys_dict where CODE = #{code}) order by SORT asc
</select>
<select id="list" resultType="map">
select
<include refid="Base_Column_List"/>
from sys_dict
where PID = 0
<if test="condition != null and condition != ''">
AND NAME like CONCAT('%',#{condition},'%')
</if>
order by DICT_ID ASC
</select>
</mapper>
<?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="cn.stylefeng.guns.modular.system.mapper.FileInfoMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.entity.FileInfo">
<id column="FILE_ID" property="fileId" />
<result column="FILE_DATA" property="fileData" />
<result column="CREATE_TIME" property="createTime" />
<result column="UPDATE_TIME" property="updateTime" />
<result column="CREATE_USER" property="createUser" />
<result column="UPDATE_USER" property="updateUser" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
FILE_ID AS fileId, FILE_DATA AS fileData, CREATE_TIME AS createTime, UPDATE_TIME AS updateTime, CREATE_USER AS createUser, UPDATE_USER AS updateUser
</sql>
</mapper>
<?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="cn.stylefeng.guns.modular.system.dao.LoginLogMapper">
<mapper namespace="cn.stylefeng.guns.modular.system.mapper.LoginLogMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.model.LoginLog">
<id column="id" property="id" />
<result column="logname" property="logname" />
<result column="userid" property="userid" />
<result column="createtime" property="createtime" />
<result column="succeed" property="succeed" />
<result column="message" property="message" />
<result column="ip" property="ip" />
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.entity.LoginLog">
<id column="LOGIN_LOG_ID" property="loginLogId"/>
<result column="LOG_NAME" property="logName"/>
<result column="USER_ID" property="userId"/>
<result column="CREATE_TIME" property="createTime"/>
<result column="SUCCEED" property="succeed"/>
<result column="MESSAGE" property="message"/>
<result column="IP_ADDRESS" property="ipAddress"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
LOGIN_LOG_ID AS loginLogId, LOG_NAME AS logName, USER_ID AS userId, CREATE_TIME AS createTime, SUCCEED AS succeed, MESSAGE AS message, IP_ADDRESS AS ipAddress
</sql>
<select id="getLoginLogs" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
select * from sys_login_log where 1 = 1
select
<include refid="Base_Column_List"/>
from sys_login_log where 1 = 1
<if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''">
and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
and (CREATE_TIME between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
</if>
<if test="logName != null and logName !=''">
and logname like CONCAT('%',#{logName},'%')
and LOG_NAME like CONCAT('%',#{logName},'%')
</if>
<choose>
<when test="orderByField != null and orderByField !=''">
......@@ -33,7 +40,7 @@
</choose>
</when>
<otherwise>
order by createtime DESC
order by CREATE_TIME DESC
</otherwise>
</choose>
</select>
......
<?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="cn.stylefeng.guns.modular.system.dao.MenuMapper">
<mapper namespace="cn.stylefeng.guns.modular.system.mapper.MenuMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.model.Menu">
<id column="id" property="id" />
<result column="code" property="code" />
<result column="pcode" property="pcode" />
<result column="pcodes" property="pcodes" />
<result column="name" property="name" />
<result column="icon" property="icon" />
<result column="url" property="url" />
<result column="num" property="num" />
<result column="levels" property="levels" />
<result column="ismenu" property="ismenu" />
<result column="tips" property="tips" />
<result column="status" property="status" />
<result column="isopen" property="isopen" />
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.entity.Menu">
<id column="MENU_ID" property="menuId"/>
<result column="CODE" property="code"/>
<result column="PCODE" property="pcode"/>
<result column="PCODES" property="pcodes"/>
<result column="NAME" property="name"/>
<result column="ICON" property="icon"/>
<result column="URL" property="url"/>
<result column="SORT" property="sort"/>
<result column="LEVELS" property="levels"/>
<result column="MENU_FLAG" property="menuFlag"/>
<result column="DESCRIPTION" property="description"/>
<result column="STATUS" property="status"/>
<result column="NEW_PAGE_FLAG" property="newPageFlag"/>
<result column="OPEN_FLAG" property="openFlag"/>
<result column="CREATE_TIME" property="createTime"/>
<result column="UPDATE_TIME" property="updateTime"/>
<result column="CREATE_USER" property="createUser"/>
<result column="UPDATE_USER" property="updateUser"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, code, pcode, name, icon, url, num, levels,pcodes,
tips, status,isopen,ismenu
MENU_ID AS menuId, CODE AS code, PCODE AS pcode, PCODES AS pcodes, NAME AS name, ICON AS icon, URL AS url, SORT AS sort, LEVELS AS levels, MENU_FLAG AS menuFlag, DESCRIPTION AS description, STATUS AS status, NEW_PAGE_FLAG AS newPageFlag, OPEN_FLAG AS openFlag, CREATE_TIME AS createTime, UPDATE_TIME AS updateTime, CREATE_USER AS createUser, UPDATE_USER AS updateUser
</sql>
<select id="selectMenus" resultType="map">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from sys_menu
where status = 1
where STATUS = 'ENABLE'
<if test="condition != null and condition != ''">
and (name like CONCAT('%',#{condition},'%') or code like CONCAT('%',#{condition},'%'))
and (NAME like CONCAT('%',#{condition},'%') or CODE like CONCAT('%',#{condition},'%'))
</if>
<if test="level != null and level != ''">
and levels = #{level}
and LEVELS = #{level}
</if>
</select>
<select id="getMenuIdsByRoleId" resultType="long">
select menuid from
sys_relation where roleid = #{roleId}
select MENU_ID from
sys_relation where ROLE_ID = #{roleId}
</select>
<select id="menuTreeList" resultType="cn.stylefeng.guns.core.common.node.ZTreeNode">
SELECT
m1.id AS id,
m1.MENU_ID AS id,
(
CASE
WHEN (m2.id = 0 OR m2.id IS NULL) THEN
WHEN (m2.MENU_ID = 0 OR m2.MENU_ID IS NULL) THEN
0
ELSE
m2.id
m2.MENU_ID
END
) AS pId,
m1. NAME
m1.NAME
AS NAME,
(
CASE
WHEN (m2.id = 0 OR m2.id IS NULL) THEN
WHEN (m2.MENU_ID = 0 OR m2.MENU_ID IS NULL) THEN
'true'
ELSE
'false'
......@@ -65,26 +70,26 @@
) as isOpen
FROM
sys_menu m1
LEFT join sys_menu m2 ON m1.pcode = m2. CODE
LEFT join sys_menu m2 ON m1.PCODE = m2.CODE
ORDER BY
m1.id ASC
m1.MENU_ID ASC
</select>
<select id="menuTreeListByMenuIds" resultType="cn.stylefeng.guns.core.common.node.ZTreeNode">
SELECT
m1.id AS id,
m1.MENU_ID AS id,
(
CASE
WHEN (m2.id = 0 OR m2.id IS NULL) THEN
WHEN (m2.MENU_ID = 0 OR m2.MENU_ID IS NULL) THEN
0
ELSE
m2.id
m2.MENU_ID
END
) AS pId,
m1. NAME AS NAME,
m1.NAME AS name,
(
CASE
WHEN (m2.id = 0 OR m2.id IS
WHEN (m2.MENU_ID = 0 OR m2.MENU_ID IS
NULL) THEN
'true'
ELSE
......@@ -93,85 +98,85 @@
) as isOpen,
(
CASE
WHEN (m3.ID = 0 OR m3.ID
WHEN (m3.MENU_ID = 0 OR m3.MENU_ID
IS NULL) THEN
'false'
ELSE
'true'
END
) "checked"
) as `checked`
FROM
sys_menu m1
LEFT JOIN
sys_menu m2
ON m1.pcode = m2. CODE
ON m1.PCODE = m2.CODE
left join (
SELECT
ID
MENU_ID
FROM
sys_menu
WHERE
ID IN
MENU_ID IN
<foreach collection="list" index="index" item="i" open="("
separator="," close=")">
#{i}
</foreach>
) m3 on m1.id = m3.id
) m3 on m1.MENU_ID = m3.MENU_ID
ORDER BY
m1.id ASC
m1.MENU_ID ASC
</select>
<delete id="deleteRelationByMenu">
delete from sys_relation where menuid = #{menuId}
delete from sys_relation where MENU_ID = #{menuId}
</delete>
<select id="getResUrlsByRoleId" resultType="string">
select url from
select URL from
sys_relation rel
inner join sys_menu m on rel.menuid = m.id
where rel.roleid = #{roleId}
inner join sys_menu m on rel.MENU_ID = m.MENU_ID
where rel.ROLE_ID = #{roleId}
</select>
<select id="getMenusByRoleIds" resultType="cn.stylefeng.guns.core.common.node.MenuNode">
SELECT
m1.id AS id,
m1.icon AS icon,
m1.MENU_ID AS id,
m1.ICON AS icon,
(
CASE
WHEN (m2.id = 0 OR m2.id IS NULL) THEN
WHEN (m2.MENU_ID = 0 OR m2.MENU_ID IS NULL) THEN
0
ELSE
m2.id
m2.MENU_ID
END
) AS parentId,
m1.NAME as name,
m1.url as url,
m1.levels as levels,
m1.ismenu as ismenu,
m1.num as num
m1.URL as url,
m1.LEVELS as levels,
m1.MENU_FLAG as ismenu,
m1.SORT as num
FROM
sys_menu m1
LEFT join sys_menu m2 ON m1.pcode = m2. CODE
LEFT join sys_menu m2 ON m1.PCODE = m2.CODE
INNER JOIN (
SELECT
ID
MENU_ID
FROM
sys_menu
WHERE
ID IN (
MENU_ID IN (
SELECT
menuid
MENU_ID
FROM
sys_relation rela
WHERE
rela.roleid IN
rela.ROLE_ID IN
<foreach collection="list" index="index" item="i" open="(" separator="," close=")">
#{i}
</foreach>
)
) m3 ON m1.id = m3.id
where m1.ismenu = 1
order by levels,num asc
) m3 ON m1.MENU_ID = m3.MENU_ID
where m1.MENU_FLAG = 'Y'
order by LEVELS,m1.SORT asc
</select>
</mapper>
<?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="cn.stylefeng.guns.modular.system.mapper.NoticeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.entity.Notice">
<id column="NOTICE_ID" property="noticeId" />
<result column="TITLE" property="title" />
<result column="CONTENT" property="content" />
<result column="CREATE_TIME" property="createTime" />
<result column="CREATE_USER" property="createUser" />
<result column="UPDATE_TIME" property="updateTime" />
<result column="UPDATE_USER" property="updateUser" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
NOTICE_ID AS noticeId, TITLE AS title, CONTENT AS content, CREATE_TIME AS createTime, CREATE_USER AS createUser, UPDATE_TIME AS updateTime, UPDATE_USER AS updateUser
</sql>
<select id="list" resultType="map">
select
<include refid="Base_Column_List"></include>
from sys_notice
<if test="condition != null and condition != ''">
where TITLE like CONCAT('%',#{condition},'%') or CONTENT like CONCAT('%',#{condition},'%')
</if>
order by CREATE_TIME DESC
</select>
</mapper>
<?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="cn.stylefeng.guns.modular.system.dao.OperationLogMapper">
<mapper namespace="cn.stylefeng.guns.modular.system.mapper.OperationLogMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.model.OperationLog">
<id column="id" property="id" />
<result column="logtype" property="logtype" />
<result column="logname" property="logname" />
<result column="userid" property="userid" />
<result column="classname" property="classname" />
<result column="method" property="method" />
<result column="createtime" property="createtime" />
<result column="succeed" property="succeed" />
<result column="message" property="message" />
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.entity.OperationLog">
<id column="OPERATION_LOG_ID" property="operationLogId"/>
<result column="LOG_TYPE" property="logType"/>
<result column="LOG_NAME" property="logName"/>
<result column="USER_ID" property="userId"/>
<result column="CLASS_NAME" property="className"/>
<result column="METHOD" property="method"/>
<result column="CREATE_TIME" property="createTime"/>
<result column="SUCCEED" property="succeed"/>
<result column="MESSAGE" property="message"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
OPERATION_LOG_ID AS operationLogId, LOG_TYPE AS logType, LOG_NAME AS logName, USER_ID AS userId, CLASS_NAME AS className, METHOD AS method, CREATE_TIME AS createTime, SUCCEED AS succeed, MESSAGE AS message
</sql>
<select id="getOperationLogs" resultType="map">
select * from sys_operation_log where 1 = 1
select
<include refid="Base_Column_List"/>
from sys_operation_log where 1 = 1
<if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''">
and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
and (CREATE_TIME between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
</if>
<if test="logName != null and logName !=''">
and logname like CONCAT('%',#{logName},'%')
and LOG_NAME like CONCAT('%',#{logName},'%')
</if>
<if test="logType != null and logType !=''">
and logtype like CONCAT('%',#{logType},'%')
and LOG_TYPE like CONCAT('%',#{logType},'%')
</if>
<choose>
<when test="orderByField != null and orderByField !=''">
......@@ -38,7 +45,7 @@
</choose>
</when>
<otherwise>
order by createtime DESC
order by CREATE_TIME DESC
</otherwise>
</choose>
</select>
......
<?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="cn.stylefeng.guns.modular.system.dao.ExpenseMapper">
<mapper namespace="cn.stylefeng.guns.modular.system.mapper.RelationMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.model.Expense">
<id column="id" property="id" />
<result column="money" property="money" />
<result column="desc" property="desc" />
<result column="createtime" property="createtime" />
<result column="state" property="state" />
<result column="userid" property="userid" />
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.entity.Relation">
<id column="RELATION_ID" property="relationId" />
<result column="MENU_ID" property="menuId" />
<result column="ROLE_ID" property="roleId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, money, desc, createtime, state, userid
RELATION_ID AS relationId, MENU_ID AS menuId, ROLE_ID AS roleId
</sql>
</mapper>
<?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="cn.stylefeng.guns.modular.system.dao.RoleMapper">
<mapper namespace="cn.stylefeng.guns.modular.system.mapper.RoleMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.model.Role">
<id column="id" property="id" />
<result column="num" property="num" />
<result column="pid" property="pid" />
<result column="name" property="name" />
<result column="deptid" property="deptid" />
<result column="tips" property="tips" />
<result column="version" property="version" />
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.entity.Role">
<id column="ROLE_ID" property="roleId"/>
<result column="PID" property="pid"/>
<result column="NAME" property="name"/>
<result column="DESCRIPTION" property="description"/>
<result column="SORT" property="sort"/>
<result column="VERSION" property="version"/>
<result column="CREATE_TIME" property="createTime"/>
<result column="UPDATE_TIME" property="updateTime"/>
<result column="CREATE_USER" property="createUser"/>
<result column="UPDATE_USER" property="updateUser"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, num, pid, name, deptid, tips, version
ROLE_ID AS roleId, PID AS pid, NAME AS name, DESCRIPTION AS description, SORT AS sort, VERSION AS version, CREATE_TIME AS createTime, UPDATE_TIME AS updateTime, CREATE_USER AS createUser, UPDATE_USER AS updateUser
</sql>
<select id="selectRoles" resultType="map">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from sys_role
<if test="condition != null">
where name like CONCAT('%',#{condition},'%')
where NAME like CONCAT('%',#{condition},'%')
</if>
</select>
<delete id="deleteRolesById">
delete from sys_relation where roleid = #{roleId}
delete from sys_relation where ROLE_ID = #{roleId}
</delete>
<select id="roleTreeList" resultType="cn.stylefeng.guns.core.common.node.ZTreeNode">
select id "id",pId
"pId",name as "name",(case when (pId=0 or pId is null) then 'true'
else 'false' end) "open" from sys_role
select ROLE_ID AS id, PID as pId,
NAME as name, (case when (PID = 0 or PID is null) then 'true'
else 'false' end) as `open` from sys_role
</select>
<select id="roleTreeListByRoleId" resultType="cn.stylefeng.guns.core.common.node.ZTreeNode">
SELECT
r.id "id",
pId "pId",
NAME AS "name",
r.ROLE_ID as id,
PID as pId,
NAME AS `name`,
(
CASE
WHEN (pId = 0 OR pId IS NULL) THEN
WHEN (PID = 0 OR PID IS NULL) THEN
'true'
ELSE
'false'
END
) "open",
) as `open`,
(
CASE
WHEN (r1.ID = 0 OR r1.ID IS NULL) THEN
WHEN (r1.ROLE_ID = 0 OR r1.ROLE_ID IS NULL) THEN
'false'
ELSE
'true'
END
) "checked"
) as checked
FROM
sys_role r
LEFT JOIN (
SELECT
ID
ROLE_ID
FROM
sys_role
WHERE
ID IN
ROLE_ID IN
<foreach collection="array" index="index" item="i" open="(" separator="," close=")">
#{i}
</foreach>
) r1 ON r.ID = r1.ID
ORDER BY
pId,
num ASC
) r1 ON r.ROLE_ID = r1.ROLE_ID
ORDER BY PID,SORT ASC
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment