日期不识别bug修复
This commit is contained in:
parent
a839b0c866
commit
d7fc388c55
|
|
@ -4,20 +4,20 @@ import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
|||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
@Component
|
||||
public class EdMetaObjectHandler implements MetaObjectHandler {
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
this.strictInsertFill(metaObject, "gmtCreate", LocalDateTime.class, LocalDateTime.now());
|
||||
this.strictInsertFill(metaObject, "gmtModified", LocalDateTime.class, LocalDateTime.now());
|
||||
this.strictInsertFill(metaObject, "gmtCreate", Date.class, new Date());
|
||||
this.strictInsertFill(metaObject, "gmtModified", Date.class, new Date());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
this.strictUpdateFill(metaObject, "gmtModified", LocalDateTime.class, LocalDateTime.now());
|
||||
this.strictUpdateFill(metaObject, "gmtModified", Date.class, new Date());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
|||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.RoleDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.RoleService;
|
||||
import com.electromagnetic.industry.software.manage.service.UserService;
|
||||
import com.electromagnetic.industry.software.manage.service.serviceimpl.CommonService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
|
@ -15,10 +17,13 @@ public class RoleController {
|
|||
|
||||
@Resource
|
||||
private RoleService roleService;
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
@ApiOperation(value = "新建角色", notes = "")
|
||||
@RequestMapping(value = "/createRole", method = RequestMethod.POST)
|
||||
public ElectromagneticResult<?> createRole(@RequestBody RoleDTO roleDTO) {
|
||||
commonService.queryAllPrjInfo();
|
||||
return ElectromagneticResultUtil.success(roleService.createRole(roleDTO));
|
||||
}
|
||||
|
||||
|
|
@ -33,4 +38,10 @@ public class RoleController {
|
|||
public ElectromagneticResult<?> deleteRole(@PathVariable("roleId") String roleId) {
|
||||
return ElectromagneticResultUtil.success(roleService.deleteRole(roleId));
|
||||
}
|
||||
|
||||
@ApiOperation(value="查看角色", notes = "")
|
||||
@GetMapping(value="/{roleId}")
|
||||
public ElectromagneticResult<?> getRole(@PathVariable("roleId") String roleId) {
|
||||
return ElectromagneticResultUtil.success(roleService.getRole(roleId));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.electromagnetic.industry.software.manage.pojo.models;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
|
|
|
|||
|
|
@ -22,6 +22,16 @@ public class RoleDTO {
|
|||
*/
|
||||
private String roleDesc;
|
||||
|
||||
/**
|
||||
* 数据权限
|
||||
*/
|
||||
private String dataScope;
|
||||
|
||||
/**
|
||||
* 功能权限
|
||||
*/
|
||||
private String allowedActions;
|
||||
|
||||
/**
|
||||
* 权限数据
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.electromagnetic.industry.software.manage.pojo.req;
|
|||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class RolePermissionDTO {
|
||||
|
|
@ -18,9 +19,14 @@ public class RolePermissionDTO {
|
|||
private String fileName;
|
||||
|
||||
/**
|
||||
* 权限列表
|
||||
* 数据权限
|
||||
*/
|
||||
private List<String> permission;
|
||||
private Map<String,Boolean> dataAuth;
|
||||
|
||||
/**
|
||||
* 权限哈希
|
||||
*/
|
||||
private Map<String,Boolean> permission;
|
||||
|
||||
/**
|
||||
* 子目录
|
||||
|
|
|
|||
|
|
@ -27,5 +27,12 @@ public interface RoleService extends IService<Role> {
|
|||
* @return
|
||||
*/
|
||||
Boolean deleteRole(String roleId);
|
||||
|
||||
/**
|
||||
* 查看角色
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
RoleDTO getRole(String roleId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import com.electromagnetic.industry.software.manage.pojo.req.RolePermissionDTO;
|
|||
import com.electromagnetic.industry.software.manage.service.RolePermissionService;
|
||||
import com.electromagnetic.industry.software.manage.service.RoleService;
|
||||
import com.electromagnetic.industry.software.manage.service.UserRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
|
@ -31,8 +30,6 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
|||
private RolePermissionService rolePermissionService;
|
||||
@Resource
|
||||
private UserRoleService userRoleService;
|
||||
@Autowired
|
||||
private RoleMapper roleMapper;
|
||||
|
||||
private EleLog log = new EleLog(RoleServiceImpl.class);
|
||||
|
||||
|
|
@ -120,6 +117,26 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看角色
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public RoleDTO getRole(String roleId){
|
||||
RoleDTO roleDTO = new RoleDTO();
|
||||
|
||||
QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("role_id", roleId);
|
||||
Role role = this.getOne(queryWrapper);
|
||||
roleDTO.setRoleId(role.getRoleId());
|
||||
roleDTO.setRoleName(role.getRoleName());
|
||||
roleDTO.setRoleDesc(role.getRoleDesc());
|
||||
|
||||
return roleDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验当前角色名称是否唯一
|
||||
*
|
||||
|
|
@ -152,9 +169,12 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
|||
}
|
||||
|
||||
private void flattenNode(RolePermissionDTO node, List<RolePermission> flatList, String roleId) {
|
||||
node.getPermission().forEach(code ->
|
||||
flatList.add(new RolePermission(roleId, node.getFileId(), code))
|
||||
);
|
||||
|
||||
node.getPermission().forEach((code, hasPermission) -> {
|
||||
if (Boolean.TRUE.equals(hasPermission)) { // 检查权限值是否为 true
|
||||
flatList.add(new RolePermission(roleId, node.getFileId(), code));
|
||||
}
|
||||
});
|
||||
// 添加当前节点
|
||||
if (node.getChildren() != null && !node.getChildren().isEmpty()) {
|
||||
for (RolePermissionDTO child : node.getChildren()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue