| | |
| | | select a.*,fn_uname(a.create_user) createUserName,fn_uname(a.update_user) updateUserName from lf.sys_blacklist a order by a.id; |
| | | select * from lf.sys_user a where uname like '%' and a.depid=ANY(fn_rec_array(1,'dep')); |
| | | |
| | | select * from lf.sys_user a left join lf.sys_role_user b on a.id=b.userid |
| | | where exist |
| | | |
| | | |
| | | select * from lf.sys_user a where not exists (select id from lf.sys_role_user b where b.userid = a.id and b.roleid = 1) |
| | | and uname like '%室%' and a.depid = ANY(fn_rec_array(1, 'dep')) |
| | | order by a.id limit 10 offset 0; |
| | | |
| | | |
| | | |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询记录数") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", required = false, example = "sys_dict") |
| | | @ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", required = false, example = "") |
| | | }) |
| | | @GetMapping({"/selectCount"}) |
| | | public ResponseMsg<Integer> selectCount(String tab) { |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "分页查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", example = "sys_dict"), |
| | | @ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "分页查询并返回记录数") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", example = "sys_dict"), |
| | | @ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询记录数") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "uname", value = "用户名", dataType = "String", paramType = "query", required = false, example = "sys_user") |
| | | @ApiImplicitParam(name = "uname", value = "用户名", dataType = "String", paramType = "query", required = false, example = "室") |
| | | }) |
| | | @GetMapping({"/selectCount"}) |
| | | public ResponseMsg<Integer> selectCount(String uname) { |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "分页查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "uname", value = "用戶名", dataType = "String", paramType = "query", example = "sys_user"), |
| | | @ApiImplicitParam(name = "uname", value = "用戶名", dataType = "String", paramType = "query", example = "室"), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "分页查询并返回记录数") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "uname", value = "用户名", dataType = "String", paramType = "query", example = "sys_dict"), |
| | | @ApiImplicitParam(name = "uname", value = "用户名", dataType = "String", paramType = "query", example = "室"), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "根据角色+单位分页查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "uname", value = "用户名", dataType = "String", paramType = "query", example = "室"), |
| | | @ApiImplicitParam(name = "roleid", value = "角色ID", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "depid", 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<UserEntity>> selectByPageForRole(String uname, Integer roleid, Integer depid, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("每页页数或分页数小于1", null); |
| | | } |
| | | int count = userService.selectCountForRole(uname, roleid, depid); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | List<UserEntity> rs = userService.selectByPageForRole(uname, roleid, depid, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "插入一条") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "entity", value = "实体类", dataType = "com.lf.server.entity.data.UserEntity", paramType = "body", example = "") |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 字典管理 |
| | | * 用户管理 |
| | | * @author sws |
| | | * @date 2022-09-27 |
| | | */ |
| | | @Mapper |
| | | @Repository |
| | | public interface UserMapper { |
| | | |
| | | /** |
| | | * 查询记录数 |
| | | * |
| | |
| | | * @return |
| | | */ |
| | | public List<UserEntity> selectUserAll(); |
| | | |
| | | /** |
| | | * 根据角色+单位查询记录数 |
| | | * |
| | | * @param uname |
| | | * @param roleid |
| | | * @param depid |
| | | * @return |
| | | */ |
| | | public Integer selectCountForRole(String uname, Integer roleid, Integer depid); |
| | | |
| | | /** |
| | | * 根据角色+单位分页查询 |
| | | * |
| | | * @param uname |
| | | * @param roleid |
| | | * @param depid |
| | | * @param limit |
| | | * @param offset |
| | | * @return |
| | | */ |
| | | public List<UserEntity> selectByPageForRole(String uname, Integer roleid, Integer depid, Integer limit, Integer offset); |
| | | } |
| | |
| | | public Integer updateUsers(UserEntity userEntity) { |
| | | return userMapper.updateUsers(userEntity); |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectCountForRole(String uname, Integer roleid, Integer depid) { |
| | | uname = "%" + (StringHelper.isNull(uname) ? "" : uname.trim()) + "%"; |
| | | |
| | | return userMapper.selectCountForRole(uname, roleid, depid); |
| | | } |
| | | |
| | | @Override |
| | | public List<UserEntity> selectByPageForRole(String uname, Integer roleid, Integer depid, Integer limit, Integer offset) { |
| | | uname = "%" + (StringHelper.isNull(uname) ? "" : uname.trim()) + "%"; |
| | | |
| | | return userMapper.selectByPageForRole(uname, roleid, depid, limit, offset); |
| | | } |
| | | } |
| | |
| | | </select> |
| | | |
| | | <select id="selectByPage" resultMap="resultMap" resultType="com.lf.server.entity.sys.UserEntity"> |
| | | select a.*, fn_rec_query(a.depid, 'dep') depName from lf.sys_user a |
| | | select a.*,fn_rec_query(a.depid, 'dep') depName from lf.sys_user a |
| | | <where> |
| | | <if test="uname != null"> |
| | | uname like #{uname} |
| | |
| | | <select id="selectCountForRole" resultType="java.lang.Integer" parameterType="java.lang.String"> |
| | | select count(*) from lf.sys_user a |
| | | <where> |
| | | not exists (select id from lf.sys_role_user b where b.userid = a.id and b.roleid = #{roleid}) |
| | | not exists (select id from lf.sys_role_user b where b.userid = a.id |
| | | <if test="roleid != null"> |
| | | and b.roleid = #{roleid} |
| | | </if> |
| | | ) |
| | | <if test="uname != null"> |
| | | and a.uname like #{uname} |
| | | </if> |
| | |
| | | <select id="selectByPageForRole" resultMap="resultMap" resultType="com.lf.server.entity.sys.UserEntity"> |
| | | select a.*,fn_rec_query(a.depid, 'dep') depName from lf.sys_user a |
| | | <where> |
| | | not exists (select id from lf.sys_role_user b where b.userid = a.id and b.roleid = #{roleid}) |
| | | not exists (select id from lf.sys_role_user b where b.userid = a.id |
| | | <if test="roleid != null"> |
| | | and b.roleid = #{roleid} |
| | | </if> |
| | | ) |
| | | <if test="uname != null"> |
| | | and a.uname like #{uname} |
| | | </if> |