【添加】添加按照组织机构搜索的功能
This commit is contained in:
+12
-3
@@ -97,12 +97,21 @@ public class SysUserController {
|
||||
@RequiresPermissions("sys:user:list")
|
||||
@PermissionData(pageComponent = "system/UserList")
|
||||
@RequestMapping(value = "/page", method = RequestMethod.GET)
|
||||
public Result<IPage<SysUser>> queryPageList(SysUser user,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
public Result<IPage<SysUser>> queryPageList(SysUser user,
|
||||
@RequestParam(name="departId", required = false) String departId,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
Result<IPage<SysUser>> result = new Result<IPage<SysUser>>();
|
||||
|
||||
QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, req.getParameterMap());
|
||||
|
||||
Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
|
||||
IPage<SysUser> pageList = sysUserService.page(page, queryWrapper);
|
||||
List<String> subDepIds = null;
|
||||
if (StrUtil.isNotEmpty(departId)){
|
||||
subDepIds = sysDepartService.getSubDepIdsByDepId(departId);
|
||||
}
|
||||
|
||||
IPage<SysUser> pageList = sysUserService.queryPage(page, subDepIds, queryWrapper);
|
||||
|
||||
//批量查询用户的所属部门
|
||||
//step.1 先拿到全部的 useids
|
||||
|
||||
+8
-1
@@ -21,12 +21,19 @@ import java.util.List;
|
||||
* @since 2018-12-20
|
||||
*/
|
||||
public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
|
||||
/**
|
||||
* 分页查询用户,可支持组织机构检索
|
||||
* @return
|
||||
*/
|
||||
IPage<SysUser> queryPage(Page page, @Param("departIds") List<String> subDepIds , @Param(Constants.WRAPPER) Wrapper wrapper);
|
||||
|
||||
/**
|
||||
* 通过用户账号查询用户信息
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
public SysUser getUserByName(@Param("username") String username);
|
||||
SysUser getUserByName(@Param("username") String username);
|
||||
|
||||
/**
|
||||
* 根据部门Id查询用户信息
|
||||
|
||||
+20
@@ -2,6 +2,26 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.system.mapper.SysUserMapper">
|
||||
|
||||
<!-- 分页查询用户信息 -->
|
||||
<select id="queryPage" resultType="com.jero.modules.system.entity.SysUser">
|
||||
select * from sys_user where del_flag = 0
|
||||
<if test="departIds!=null and departIds.size()>0">
|
||||
and id in (select user_id from sys_user_depart where dep_id in
|
||||
<foreach collection="departIds" index="index" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<choose>
|
||||
<when test="ew.sqlSegment.indexOf(' ORDER') == 0">
|
||||
${ew.sqlSegment}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND ${ew.sqlSegment}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<!-- 根据用户名查询 -->
|
||||
<select id="getUserByName" resultType="com.jero.modules.system.entity.SysUser">
|
||||
select * from sys_user where username = #{username} and del_flag = 0
|
||||
|
||||
+8
@@ -28,6 +28,14 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
*/
|
||||
public interface ISysUserService extends IService<SysUser> {
|
||||
|
||||
/**
|
||||
* 分页查询用户,可支持组织机构检索
|
||||
* @param page
|
||||
* @param queryWrapper
|
||||
* @return
|
||||
*/
|
||||
IPage<SysUser> queryPage(Page<SysUser> page, List<String> subDepIds, QueryWrapper<SysUser> queryWrapper);
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*
|
||||
|
||||
+9
@@ -1,8 +1,12 @@
|
||||
package com.jero.modules.system.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
|
||||
import com.baomidou.mybatisplus.core.conditions.segments.NormalSegmentList;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -59,6 +63,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
@Resource
|
||||
private BaseCommonService baseCommonService;
|
||||
|
||||
@Override
|
||||
public IPage<SysUser> queryPage(Page<SysUser> page, List<String> subDepIds, QueryWrapper<SysUser> queryWrapper){
|
||||
return this.userMapper.queryPage(page, subDepIds, queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = {CacheConstant.SYS_USERS_CACHE}, allEntries = true)
|
||||
public Result<?> resetPassword(String username, String oldpassword, String newpassword, String confirmpassword) {
|
||||
|
||||
@@ -45,6 +45,22 @@
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :md="6" :sm="8">
|
||||
<a-form-item label="组织机构">
|
||||
<a-tree-select
|
||||
tree-node-filter-prop="title"
|
||||
v-model="queryParam.departId"
|
||||
:maxTagCount="1"
|
||||
show-search
|
||||
:getPopupContainer="triggerNode=> triggerNode.parentNode"
|
||||
class="box-input"
|
||||
style="width: 100%"
|
||||
:tree-data="categoryTreeList"
|
||||
placeholder="请选择组织机构"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</template>
|
||||
|
||||
<a-col :md="6" :sm="8">
|
||||
@@ -175,7 +191,7 @@
|
||||
<script>
|
||||
import UserModal from './modules/UserModal'
|
||||
import PasswordModal from './modules/PasswordModal'
|
||||
import {putAction,getFileAccessHttpUrl} from '@/api/manage';
|
||||
import {getAction,getFileAccessHttpUrl} from '@/api/manage';
|
||||
import {frozenBatch} from '@/api/api'
|
||||
import {JeroListMixin} from '@/mixins/JeroListMixin'
|
||||
import JInput from '@/components/jero/JInput'
|
||||
@@ -197,6 +213,7 @@
|
||||
description: '这是用户管理页面',
|
||||
queryParam: {},
|
||||
recycleBinVisible: false,
|
||||
categoryTreeList:[], // 组织机构查询的组织机构树数据
|
||||
columns: [
|
||||
{
|
||||
title: '序号',
|
||||
@@ -285,6 +302,7 @@
|
||||
deleteBatch: "/sys/user/deleteBatch",
|
||||
exportXlsUrl: "/sys/user/exportXls",
|
||||
importExcelUrl: "sys/user/importExcel",
|
||||
getSysCategoryTree: '/sys/sysDepart/queryTreeList', // 获取组织机构树
|
||||
},
|
||||
}
|
||||
},
|
||||
@@ -293,6 +311,9 @@
|
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getSysCategoryTree()
|
||||
},
|
||||
methods: {
|
||||
getAvatarView: function (avatar) {
|
||||
return getFileAccessHttpUrl(avatar)
|
||||
@@ -364,8 +385,17 @@
|
||||
this.$refs.passwordmodal.show(username);
|
||||
},
|
||||
passwordModalOk() {
|
||||
//TODO 密码修改完成 不需要刷新页面,可以把datasource中的数据更新一下
|
||||
}
|
||||
console.log("密码修改完成")
|
||||
},
|
||||
getSysCategoryTree() {
|
||||
getAction(this.url.getSysCategoryTree, {}).then((res) => {
|
||||
if (res.success) {
|
||||
this.categoryTreeList = res.result
|
||||
} else {
|
||||
this.categoryTreeList = []
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user