Browse Source

角色资源配置修改

anderx 7 years ago
parent
commit
1a46d2f638

+ 2 - 0
src/main/java/com/goafanti/common/dao/RoleResourcesMapper.java

@@ -103,4 +103,6 @@ public interface RoleResourcesMapper {
 	int updateDimissionTransfer( @Param("type")Integer type,  @Param("aid")String aid,  @Param("transferId")String transferId);
 
 	int updateLockRelease(@Param("type")String type,  @Param("aid")String aid,@Param("transferId")String transferId);
+
+	List<RoleResources> selectByRid(@Param("rid")String rid);
 }

+ 11 - 0
src/main/java/com/goafanti/common/mapper/RoleResourcesMapper.xml

@@ -331,4 +331,15 @@ where a.id= #{aid,jdbcType=VARCHAR}
 	 and type=#{type,jdbcType=VARCHAR}
 	 and status=0
 </update>
+
+<select id="selectByRid" parameterType="java.lang.String" resultType="com.goafanti.common.model.RoleResources">
+    select
+    id,role_id as roleId,resources,create_time as createTime
+    from role_resources
+    where 1=1
+    <if test="rid != null">
+     and role_id= #{rid,jdbcType=VARCHAR}
+    </if>
+    
+  </select>
 </mapper>

+ 17 - 1
src/main/java/com/goafanti/permission/controller/NewRoleApiController.java

@@ -22,7 +22,7 @@ import com.goafanti.permission.bo.RoleBo;
 import com.goafanti.permission.service.NewRoleService;
 
 @RestController
-@RequestMapping("/open/api/admin")
+@RequestMapping("/api/admin")
 public class NewRoleApiController extends BaseApiController{
 	@Resource
 	private NewRoleService newRoleService;
@@ -150,6 +150,22 @@ public class NewRoleApiController extends BaseApiController{
 		return res;
 	}
 	/**
+	 * 角色资源详情
+	 * @param rid 角色ID
+	 * @param resources 资源
+	 * @return
+	 */
+	@RequestMapping(value = "/role/ResourcesDetail", method = RequestMethod.POST)
+	public Result ResourcesDetail(String rid) {
+		Result res = new Result();
+		if (StringUtils.isBlank(rid)) {
+			res.getError().add(buildError("","角色错误"));
+			return res;
+		}
+		res.setData(newRoleService.ResourcesDetail(rid));
+		return res;
+	}
+	/**
 	 * 离职人员转交
 	 * @param aid 离职ID
 	 * @param transferId 转交ID

+ 4 - 0
src/main/java/com/goafanti/permission/service/NewRoleService.java

@@ -5,7 +5,9 @@ package com.goafanti.permission.service;
 import java.util.List;
 import java.util.Set;
 
+import com.goafanti.common.enums.roleResources;
 import com.goafanti.common.model.Role;
+import com.goafanti.common.model.RoleResources;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.permission.bo.RoleBo;
 import com.goafanti.permission.bo.RolePermissionBo;
@@ -36,4 +38,6 @@ public interface NewRoleService {
 	int addResources(String rid, String resources);
 
 	int updatedimission(String aid, String transferId);
+
+	List<RoleResources> ResourcesDetail(String rid);
 }

+ 4 - 0
src/main/java/com/goafanti/permission/service/impl/NewRoleServiceImpl.java

@@ -185,5 +185,9 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 		}
 		return 1;
 	}
+	@Override
+	public List<RoleResources> ResourcesDetail(String rid) {
+		return roleResourcesMapper.selectByRid(rid);
+	}
 	
 }