角色权限

main
tamguo 7 years ago
parent 174825a378
commit 53a2f2f57c

@ -0,0 +1,8 @@
package com.tamguo.modules.sys.dao;
import com.tamguo.config.dao.SuperMapper;
import com.tamguo.modules.sys.model.SysRoleDataScopeEntity;
public interface SysRoleDataScopeMapper extends SuperMapper<SysRoleDataScopeEntity>{
}

@ -0,0 +1,38 @@
package com.tamguo.modules.sys.model;
import com.baomidou.mybatisplus.annotations.TableName;
@TableName(value="sys_role_data_scope")
public class SysRoleDataScopeEntity {
private String roleCode;
private String ctrlType;
private String ctrlData;
private String ctrlPermi;
public String getRoleCode() {
return roleCode;
}
public void setRoleCode(String roleCode) {
this.roleCode = roleCode;
}
public String getCtrlType() {
return ctrlType;
}
public void setCtrlType(String ctrlType) {
this.ctrlType = ctrlType;
}
public String getCtrlData() {
return ctrlData;
}
public void setCtrlData(String ctrlData) {
this.ctrlData = ctrlData;
}
public String getCtrlPermi() {
return ctrlPermi;
}
public void setCtrlPermi(String ctrlPermi) {
this.ctrlPermi = ctrlPermi;
}
}

@ -0,0 +1,8 @@
package com.tamguo.modules.sys.service;
import com.baomidou.mybatisplus.service.IService;
import com.tamguo.modules.sys.model.SysRoleDataScopeEntity;
public interface ISysRoleDataScopeService extends IService<SysRoleDataScopeEntity>{
}

@ -0,0 +1,14 @@
package com.tamguo.modules.sys.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.tamguo.modules.sys.dao.SysRoleDataScopeMapper;
import com.tamguo.modules.sys.model.SysRoleDataScopeEntity;
import com.tamguo.modules.sys.service.ISysRoleDataScopeService;
@Service
public class SysRoleDataScopeServiceImpl extends ServiceImpl<SysRoleDataScopeMapper, SysRoleDataScopeEntity> implements ISysRoleDataScopeService{
}

@ -1,7 +1,6 @@
package com.tamguo.modules.sys.web;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -9,9 +8,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.baomidou.mybatisplus.mapper.Condition;
import com.baomidou.mybatisplus.plugins.Page;
import com.tamguo.modules.sys.model.SysRoleEntity;
import com.tamguo.modules.sys.model.condition.SysRoleCondition;
import com.tamguo.modules.sys.service.ISysRoleDataScopeService;
import com.tamguo.modules.sys.service.ISysRoleService;
import com.tamguo.modules.sys.utils.Result;
@ -28,6 +29,8 @@ public class SysRoleController {
@Autowired
private ISysRoleService iSysRoleService;
@Autowired
private ISysRoleDataScopeService iSysRoleDataScopeService;
/** 角色首页*/
@RequestMapping(path="index")
@ -44,9 +47,11 @@ public class SysRoleController {
}
/** 数据权限 */
@SuppressWarnings("unchecked")
@RequestMapping(path="dataScope")
public ModelAndView dataScope(String roleCode , ModelAndView model) {
model.addObject("role", iSysRoleService.selectById(roleCode));
model.addObject("roleDataScopeList" , iSysRoleDataScopeService.selectList(Condition.create().eq("role_code", roleCode)));
model.setViewName(ROLE_DATA_INDEX_PAGE);
return model;
}

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tamguo.modules.sys.dao.SysRoleDataScopeMapper">
</mapper>

@ -258,8 +258,10 @@ for (var i=0; i<dataScopes.length; i++){
});
}
// 默认选择节点
try{dataScopeTrees['Company'].checkNode(dataScopeTrees['Company']
.getNodeByParam("id","SD1"), true, false);}catch(e){}
try{dataScopeTrees['Company'].checkNode(dataScopeTrees['Company']
.getNodeByParam("id","SD2"), true, false);}catch(e){}
try{
dataScopeTrees['Company'].checkNode(dataScopeTrees['Company'].getNodeByParam("id","SD1"), true, false);
}catch(e){}
try{
dataScopeTrees['Company'].checkNode(dataScopeTrees['Company'].getNodeByParam("id","SD2"), true, false);
}catch(e){}
</script>
Loading…
Cancel
Save