权限模块更新

master
星期八 5 years ago
parent 03108d2499
commit cad975fa31
  1. 20
      src/main/java/com/lq/cms/service/impl/SysPermissionServiceImpl.java
  2. 86
      src/main/java/com/lq/cms/vo/SysPermissionVo.java
  3. 2
      src/main/java/com/lq/code/util/sql/MysqlBuilder.java

@ -1,5 +1,6 @@
package com.lq.cms.service.impl;
import com.lq.cms.emun.StatusTypeEnum;
import com.lq.cms.service.SysPermissionService;
import com.lq.cms.vo.SysPermissionVo;
import com.lq.code.dao.BaseDao;
@ -7,6 +8,7 @@ import com.lq.code.service.impl.BaseServiceImpl;
import com.lq.code.util.BeanUtil;
import com.lq.dao.SysPermissionDao;
import com.lq.dao.SysResourceDao;
import com.lq.dao.SysUserDao;
import com.lq.entity.SysPermission;
import com.lq.entity.SysResource;
import com.lq.entity.SysUser;
@ -30,6 +32,8 @@ public class SysPermissionServiceImpl extends BaseServiceImpl<SysPermission> imp
private SysPermissionDao sysPermissionDao;
@Autowired
private SysResourceDao sysResourceDao;
@Autowired
private SysUserDao sysUserDao;
@Override
public List<SysPermissionVo> findListPage(SysPermissionVo vo) {
@ -37,8 +41,23 @@ public class SysPermissionServiceImpl extends BaseServiceImpl<SysPermission> imp
sysPermissionVos.forEach(sysPermissionVo1->{
if (sysPermissionVo1.getSysResourceId()!=null) {
SysResource sysResource = sysResourceDao.findOne(sysPermissionVo1.getSysResourceId());
if (sysResource!=null) {
sysPermissionVo1.setSysResourceName(sysResource.getMenuName());
}
}
if (sysPermissionVo1.getCreateUserId()!=null) {
SysUser createUser = sysUserDao.findOne(sysPermissionVo1.getCreateUserId());
if (createUser!=null) {
sysPermissionVo1.setCreateUserName(createUser.getLoginName());
}
}
if (sysPermissionVo1.getUpdateUserId()!=null) {
SysUser updateUser = sysUserDao.findOne(sysPermissionVo1.getUpdateUserId());
if (updateUser!=null) {
sysPermissionVo1.setUpdateUserName(updateUser.getLoginName());
}
}
});
return sysPermissionVos;
}
@ -58,6 +77,7 @@ public class SysPermissionServiceImpl extends BaseServiceImpl<SysPermission> imp
sysPermission.setCreateUserId(sysUser.getId());
sysPermission.setUpdateTime(new Date());
sysPermission.setUpdateUserId(sysUser.getId());
sysPermission.setStatus(StatusTypeEnum.STATUS_ACTIVITY_YES.getValue());
sysPermissionDao.save(sysPermission);
return sysPermission;
}

@ -1,5 +1,10 @@
package com.lq.cms.vo;
import com.lq.code.util.DateUtil;
import com.lq.code.util.StringUtil;
import java.util.Date;
/**
* @Author: qi
* @Description:
@ -27,6 +32,30 @@ public class SysPermissionVo extends AdminBaseVo {
* 权限键值
*/
private String permissionKey;
/**
* 创建时间字符串
*/
private String createTimeStr;
/**
* 创建用户ID
*/
private Long createUserId;
/**
* 创建用户名称
*/
private String createUserName;
/**
* 更新时间字符串
*/
private String updateTimeStr;
/**
* 更新用户ID
*/
private Long updateUserId;
/**
* 更新用户名称
*/
private String updateUserName;
public Long getSysResourceId() {
return sysResourceId;
@ -67,4 +96,61 @@ public class SysPermissionVo extends AdminBaseVo {
public void setPermissionKey(String permissionKey) {
this.permissionKey = permissionKey;
}
public String getCreateTimeStr() {
if (StringUtil.isNotNull(createTimeStr)){
return createTimeStr;
}else{
return DateUtil.getDateToStr(getCreateTime());
}
}
public void setCreateTimeStr(String createTimeStr) {
this.createTimeStr = createTimeStr;
}
public Long getCreateUserId() {
return createUserId;
}
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
public String getCreateUserName() {
return createUserName;
}
public void setCreateUserName(String createUserName) {
this.createUserName = createUserName;
}
public String getUpdateTimeStr() {
if (StringUtil.isNotNull(updateTimeStr)){
return updateTimeStr;
}else{
return DateUtil.getDateToStr(getUpdateTime());
}
}
public void setUpdateTimeStr(String updateTimeStr) {
this.updateTimeStr = updateTimeStr;
}
public Long getUpdateUserId() {
return updateUserId;
}
public void setUpdateUserId(Long updateUserId) {
this.updateUserId = updateUserId;
}
public String getUpdateUserName() {
return updateUserName;
}
public void setUpdateUserName(String updateUserName) {
this.updateUserName = updateUserName;
}
}

@ -25,7 +25,7 @@ public class MysqlBuilder extends AbstractDbBuiler {
dataTypeMap.put("class java.lang.String","varchar");
dataTypeMap.put("class java.util.Date","datetime");
dataTypeMap.put("class java.lang.Integer","int");
dataTypeMap.put("class java.lang.Long","int");
dataTypeMap.put("class java.lang.Long","bigint");
}

Loading…
Cancel
Save