| | |
| | | select * from lf.sys_role_menu_auth; |
| | | |
| | | select a.*,c.name from lf.sys_menu_auth a inner join lf.sys_auth c on a.authid = c.id |
| | | where not exists (select b.id from lf.sys_role_menu_auth b where b.menu_auth_id = a.id and b.roleid = 1) and a.menuid = 1; |
| | | where not exists (select b.id from lf.sys_role_menu_auth b where b.menu_auth_id = a.id and b.roleid = 1) and a.menuid = 1 order by c.id; |
| | | |
| | | select a.*,b.menuid,c.name from lf.sys_role_menu_auth a inner join lf.sys_menu_auth b on a.menu_auth_id = b.id |
| | | inner join lf.sys_auth c on b.authid = c.id where a.roleid = 1 and b.menuid = 1; |
| | | inner join lf.sys_auth c on b.authid = c.id where a.roleid = 1 and b.menuid = 1 order by c.id; |
| | | ----------------------------------------------------------------------------------------------------- |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "根据角色ID+菜单ID分页查询并返回记录数") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "roleid", value = "角色ID", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "menuid", value = "菜单ID", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPageForRole") |
| | | public ResponseMsg<List<MenuAuthEntity>> selectByPageForRole(Integer roleid, Integer menuid, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("每页页数或分页数小于1", null); |
| | | } |
| | | |
| | | int count = menuAuthService.selectCountForRole(roleid, menuid); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<MenuAuthEntity> rs = menuAuthService.selectByPageForRole(roleid, menuid, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询所有") |
| | | @GetMapping(value = "/selectAll") |
| | | public ResponseMsg<List<MenuAuthEntity>> selectAll() { |
| | |
| | | |
| | | private int authid; |
| | | |
| | | private String name; |
| | | |
| | | private int createUser; |
| | | |
| | | private Timestamp createTime; |
| | |
| | | this.authid = authid; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public int getCreateUser() { |
| | | return createUser; |
| | | } |
| | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param menuid 菜单ID |
| | | * @param menuid 菜单ID |
| | | * @param limit 记录表 |
| | | * @param offset 偏移量 |
| | | * @return 列表 |
| | |
| | | public List<MenuAuthEntity> selectByPage(Integer menuid, Integer limit, Integer offset); |
| | | |
| | | /** |
| | | * 根据角色ID+菜单ID查询记录数 |
| | | * |
| | | * @param roleid |
| | | * @param menuid |
| | | * @return |
| | | */ |
| | | public Integer selectCountForRole(Integer roleid, Integer menuid); |
| | | |
| | | /** |
| | | * 根据角色ID+菜单ID分页查询 |
| | | * |
| | | * @param roleid |
| | | * @param menuid |
| | | * @param limit |
| | | * @param offset |
| | | * @return |
| | | */ |
| | | public List<MenuAuthEntity> selectByPageForRole(Integer roleid, Integer menuid, Integer limit, Integer offset); |
| | | |
| | | /** |
| | | * 查询所有 |
| | | * |
| | | * @return |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectCountForRole(Integer roleid, Integer menuid) { |
| | | return menuAuthMapper.selectCountForRole(roleid, menuid); |
| | | } |
| | | |
| | | @Override |
| | | public List<MenuAuthEntity> selectByPageForRole(Integer roleid, Integer menuid, Integer limit, Integer offset) { |
| | | return menuAuthMapper.selectByPageForRole(roleid, menuid, limit, offset); |
| | | } |
| | | |
| | | @Override |
| | | public List<MenuAuthEntity> selectAll() { |
| | | return menuAuthMapper.selectAll(); |
| | | } |
| | |
| | | limit #{limit} offset #{offset} |
| | | </select> |
| | | |
| | | <select id="selectCountForRole" resultType="java.lang.Integer" parameterType="java.lang.String"> |
| | | select count(a.id) from lf.sys_menu_auth a inner join lf.sys_auth c on a.authid = c.id |
| | | where not exists (select b.id from lf.sys_role_menu_auth b where b.menu_auth_id = a.id |
| | | <if test="roleid != null"> |
| | | and b.roleid = #{roleid} |
| | | </if> |
| | | ) |
| | | <if test="menuid != null"> |
| | | and a.menuid = #{menuid} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectByPageForRole" resultType="com.lf.server.entity.sys.MenuAuthEntity"> |
| | | select a.*,c.name from lf.sys_menu_auth a inner join lf.sys_auth c on a.authid = c.id |
| | | where not exists (select b.id from lf.sys_role_menu_auth b where b.menu_auth_id = a.id |
| | | <if test="roleid != null"> |
| | | and b.roleid = #{roleid} |
| | | </if> |
| | | ) |
| | | <if test="menuid != null"> |
| | | and a.menuid = #{menuid} |
| | | </if> |
| | | order by c.id |
| | | limit #{limit} offset #{offset} |
| | | </select> |
| | | |
| | | <select id="selectAll" resultType="com.lf.server.entity.sys.MenuAuthEntity"> |
| | | select * from lf.sys_menu_auth order by id; |
| | | </select> |