diff --git a/src/main/java/com/lq/cms/service/impl/SysPermissionServiceImpl.java b/src/main/java/com/lq/cms/service/impl/SysPermissionServiceImpl.java index cc41811..6310155 100644 --- a/src/main/java/com/lq/cms/service/impl/SysPermissionServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/SysPermissionServiceImpl.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 imp private SysPermissionDao sysPermissionDao; @Autowired private SysResourceDao sysResourceDao; + @Autowired + private SysUserDao sysUserDao; @Override public List findListPage(SysPermissionVo vo) { @@ -37,8 +41,23 @@ public class SysPermissionServiceImpl extends BaseServiceImpl imp sysPermissionVos.forEach(sysPermissionVo1->{ if (sysPermissionVo1.getSysResourceId()!=null) { SysResource sysResource = sysResourceDao.findOne(sysPermissionVo1.getSysResourceId()); - sysPermissionVo1.setSysResourceName(sysResource.getMenuName()); + 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 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; } diff --git a/src/main/java/com/lq/cms/vo/SysPermissionVo.java b/src/main/java/com/lq/cms/vo/SysPermissionVo.java index 34a9238..c97acfc 100644 --- a/src/main/java/com/lq/cms/vo/SysPermissionVo.java +++ b/src/main/java/com/lq/cms/vo/SysPermissionVo.java @@ -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; + } } diff --git a/src/main/java/com/lq/code/util/sql/MysqlBuilder.java b/src/main/java/com/lq/code/util/sql/MysqlBuilder.java index 0adc887..04df923 100755 --- a/src/main/java/com/lq/code/util/sql/MysqlBuilder.java +++ b/src/main/java/com/lq/code/util/sql/MysqlBuilder.java @@ -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"); }