micro-fast-IIDYB 角色的权限管理接口开发

This commit is contained in:
winLsy
2018-03-21 22:11:28 +08:00
parent c16a2416e7
commit a19b0999a9
3 changed files with 27 additions and 4 deletions
@@ -2,6 +2,7 @@ package com.micro.fast.upms.dao;
import com.micro.fast.common.dao.SsmMapper;
import com.micro.fast.upms.pojo.UpmsPermission;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -34,4 +35,6 @@ public interface UpmsPermissionMapper extends SsmMapper<UpmsPermission,Integer>
List<UpmsPermission> selectByUserIdAndType(@Param("userId") Integer userId, @Param("pType") Integer pType, @Param("type") Integer type);
List<UpmsPermission> selectByRoleIdAndType(@Param("roleId") Integer roleId, @Param("type") Integer type);
}
@@ -199,6 +199,7 @@
</if>
</trim>
</insert>
<!--自定义的sql-->
<select id="selectByCondition" resultType="com.micro.fast.upms.pojo.UpmsPermission">
SELECT <include refid="Base_Column_List"/> FROM upms_permission
@@ -221,11 +222,14 @@
</where>
</select>
<select id="selectByUserIdAndType" resultType="com.micro.fast.upms.pojo.UpmsPermission">
SELECT <include refid="Base_Column_List"/> FROM upms_permission WHERE type = #{pType}
and id in (select permission_id from upms_user_permission where user_id = #{userId} and type =#{type} )
SELECT <include refid="Base_Column_List"/> FROM upms_permission WHERE type = #{pType}
and id in (select permission_id from upms_user_permission where user_id = #{userId} and type =#{type} )
</select>
<delete id="deleteByPrimaryKeys">
<select id="selectByRoleIdAndType" resultType="com.micro.fast.upms.pojo.UpmsPermission">
SELECT <include refid="Base_Column_List"/> FROM upms_permission WHERE type = #{type}
and id in (select permission_id from upms_role_permission where role_id = #{roleId})
</select>
<delete id="deleteByPrimaryKeys">
DELETE FROM upms_permission WHERE id IN
<foreach collection="list" item="item" open="(" separator="," close=")" >
#{item}
@@ -2,10 +2,26 @@ package com.micro.fast.upms.service;
import com.micro.fast.boot.starter.common.response.ServerResponse;
import com.micro.fast.common.service.SsmService;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author lsy
*/
public interface UpmsPermissionService<T,ID> extends SsmService<T,ID>{
@Deprecated
ServerResponse getPermissionsByUserIdandPTypeandType(Integer userId, Integer type, Integer pType);
/**
* 按照类型获取角色所拥有的权限
* @param type 权限类型
* @param roleId 角色id
* @return
*/
ServerResponse getPermissionByRoleAndType(Integer type,Integer roleId);
/**
* 按照类型
*/
}