Commit 28cae0eb by duanhq

根据组织查询用户列表 by duanht 2019/3/4

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@18057 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent df3048c9
...@@ -66,8 +66,6 @@ public class UserController extends BaseController { ...@@ -66,8 +66,6 @@ public class UserController extends BaseController {
@Autowired @Autowired
private SysUserService sysUserService; private SysUserService sysUserService;
@Autowired
private DictionaryTypeMapper dictionaryTypeDao;
@Autowired @Autowired
private SysRoleMapper sysRoleMapper; private SysRoleMapper sysRoleMapper;
...@@ -95,10 +93,9 @@ public class UserController extends BaseController { ...@@ -95,10 +93,9 @@ public class UserController extends BaseController {
@ResponseBody @ResponseBody
public ResultObject getAllUserList(Page page, UserQueryVo userQueryVo) { public ResultObject getAllUserList(Page page, UserQueryVo userQueryVo) {
Map<String, Object> result = new HashMap<String, Object>(16); Map<String, Object> result = new HashMap<String, Object>(16);
PageHelper.startPage(page.getPageIndex(), page.getPageSize(), true);
userQueryVo.setUserId(UserUtils.getUserId(request)); userQueryVo.setUserId(UserUtils.getUserId(request));
List<SysUser> list = sysUserService.getAllUserList(userQueryVo); List<SysManager> list = sysUserService.getAllUserList(userQueryVo,page);
com.github.pagehelper.Page<SysUser> pages = (com.github.pagehelper.Page<SysUser>) list; com.github.pagehelper.Page<SysManager> pages = (com.github.pagehelper.Page<SysManager>) list;
page.setTotalCount((int) pages.getTotal()); page.setTotalCount((int) pages.getTotal());
result.put("page", page); result.put("page", page);
result.put("items", list); result.put("items", list);
......
...@@ -44,7 +44,7 @@ public interface SysUserMapper { ...@@ -44,7 +44,7 @@ public interface SysUserMapper {
int updateByPrimaryKey(SysUser record); int updateByPrimaryKey(SysUser record);
List<SysUser> getAllUserList(UserQueryVo userQueryVo); List<SysManager> getAllUserList(UserQueryVo userQueryVo);
List<SysMerchant> getSysMerchantList(UserQueryVo userQueryVo); List<SysMerchant> getSysMerchantList(UserQueryVo userQueryVo);
......
...@@ -3,6 +3,8 @@ package com.glsx.usercenter.service; ...@@ -3,6 +3,8 @@ package com.glsx.usercenter.service;
import java.util.List; import java.util.List;
import com.glsx.common.utils.Page;
import com.glsx.usercenter.dto.ServiceInfo; import com.glsx.usercenter.dto.ServiceInfo;
import com.glsx.usercenter.pojo.user.*; import com.glsx.usercenter.pojo.user.*;
import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationException;
...@@ -27,7 +29,7 @@ public interface SysUserService { ...@@ -27,7 +29,7 @@ public interface SysUserService {
* @Title: getUserList * @Title: getUserList
* @Description: TODO 获取用户列表 * @Description: TODO 获取用户列表
*/ */
List<SysUser> getAllUserList(UserQueryVo userQueryVo); List<SysManager> getAllUserList(UserQueryVo userQueryVo,Page page);
/** /**
* @param userQueryVo * @param userQueryVo
......
...@@ -35,18 +35,18 @@ import org.springframework.stereotype.Service; ...@@ -35,18 +35,18 @@ import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
/** /**
* @ClassName: AreaServiceImpl * @author Zheng Xiajun
* @Description: TODO(这里用一句话描述这个类的作用) * @ClassName: AreaServiceImpl
* @author Zheng Xiajun * @Description: TODO(这里用一句话描述这个类的作用)
* @date 2019年1月23日 * @date 2019年1月23日
* */
*/
@Service @Service
public class AreaServiceImpl implements IAreaService { public class AreaServiceImpl implements IAreaService {
@Autowired @Autowired
private SysAreaMapper sysAreaMapper; private SysAreaMapper sysAreaMapper;
@Override @Override
public List<SysArea> selectByExample(SysAreaExample example) { public List<SysArea> selectByExample(SysAreaExample example) {
...@@ -56,17 +56,23 @@ public class AreaServiceImpl implements IAreaService { ...@@ -56,17 +56,23 @@ public class AreaServiceImpl implements IAreaService {
@Override @Override
public SysArea getAllChargeItems(Integer id) { public SysArea getAllChargeItems(Integer id) {
SysAreaExample example=new SysAreaExample (); SysArea prandPa = new SysArea();
SysAreaExample example = new SysAreaExample();
example.createCriteria().andIdEqualTo(id); example.createCriteria().andIdEqualTo(id);
List<SysArea> child = sysAreaMapper.selectByExample(example); List<SysArea> child = sysAreaMapper.selectByExample(example);
example.clear(); example.clear();
example.createCriteria().andIdEqualTo(child.get(0).getParentId()); example.createCriteria().andIdEqualTo(child.get(0).getParentId());
List<SysArea> parent= sysAreaMapper.selectByExample(example); List<SysArea> parent = sysAreaMapper.selectByExample(example);
if (!parent.isEmpty()) {
example.clear(); example.clear();
example.createCriteria().andIdEqualTo(parent.get(0).getParentId()); example.createCriteria().andIdEqualTo(parent.get(0).getParentId());
SysArea prandPa= sysAreaMapper.selectByExample(example).get(0); prandPa = sysAreaMapper.selectByExample(example).get(0);
if (prandPa != null){
parent.get(0).setChildren(child); parent.get(0).setChildren(child);
prandPa.setChildren(parent); prandPa.setChildren(parent);
}
}
return prandPa; return prandPa;
} }
......
...@@ -3,6 +3,8 @@ package com.glsx.usercenter.service.impl; ...@@ -3,6 +3,8 @@ package com.glsx.usercenter.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.github.pagehelper.PageHelper;
import com.glsx.common.utils.Page;
import com.glsx.usercenter.service.IAreaService; import com.glsx.usercenter.service.IAreaService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationException;
...@@ -82,8 +84,23 @@ public class SysUserServiceImpl implements SysUserService { ...@@ -82,8 +84,23 @@ public class SysUserServiceImpl implements SysUserService {
public Logger logger = LoggerFactory.getLogger(getClass()); public Logger logger = LoggerFactory.getLogger(getClass());
@Override @Override
public List<SysUser> getAllUserList(UserQueryVo userQueryVo) { public List<SysManager> getAllUserList(UserQueryVo userQueryVo,Page page) {
List<SysUser> sysUserList = sysUserMapper.getAllUserList(userQueryVo); //根据传入的组织id获取下面所有组织
if (userQueryVo.getOrgId() != null) {
List<Integer> orgIds = new ArrayList<>();
//将当前组织id和他下面的所有组织id加入到条件中
orgIds.add(userQueryVo.getOrgId());
List<SysOrganization> sysOrganizations = sysOrganizationMapper.findOrgByParentId(userQueryVo.getOrgId());
if (!sysOrganizations.isEmpty()) {
for (SysOrganization sysOrganization : sysOrganizations) {
orgIds.add(sysOrganization.getId());
}
}
userQueryVo.setIds(orgIds);
}
PageHelper.startPage(page.getPageIndex(), page.getPageSize(), true);
List<SysManager> sysUserList = sysUserMapper.getAllUserList(userQueryVo);
//获取用户角色以及数据权限信息 //获取用户角色以及数据权限信息
if (!sysUserList.isEmpty()) { if (!sysUserList.isEmpty()) {
for (SysUser user : sysUserList) { for (SysUser user : sysUserList) {
...@@ -111,6 +128,7 @@ public class SysUserServiceImpl implements SysUserService { ...@@ -111,6 +128,7 @@ public class SysUserServiceImpl implements SysUserService {
//匹配集团 //匹配集团
for (SysMerchant sysMerchant : sysMerchantList) { for (SysMerchant sysMerchant : sysMerchantList) {
//1.根据商户组织id查询出集团 2.设置省市区 //1.根据商户组织id查询出集团 2.设置省市区
if (sysMerchant.getOrgId() != null) {
Integer groupId = getGroupIdByOrgId(sysMerchant.getOrgId()); Integer groupId = getGroupIdByOrgId(sysMerchant.getOrgId());
SysOrganization sysOrganization = sysOrganizationMapper.selectByPrimaryKey(groupId); SysOrganization sysOrganization = sysOrganizationMapper.selectByPrimaryKey(groupId);
sysMerchant.setOrgName(sysOrganization.getName()); sysMerchant.setOrgName(sysOrganization.getName());
...@@ -120,6 +138,7 @@ public class SysUserServiceImpl implements SysUserService { ...@@ -120,6 +138,7 @@ public class SysUserServiceImpl implements SysUserService {
sysMerchant.setSysArea(iAreaService.getAllChargeItems(Integer.valueOf(sysMerchant.getDistrict()))); sysMerchant.setSysArea(iAreaService.getAllChargeItems(Integer.valueOf(sysMerchant.getDistrict())));
} }
} }
}
//根据集团名筛选 //根据集团名筛选
List<SysMerchant> merchantRemove = new ArrayList<SysMerchant>(); List<SysMerchant> merchantRemove = new ArrayList<SysMerchant>();
...@@ -358,7 +377,7 @@ public class SysUserServiceImpl implements SysUserService { ...@@ -358,7 +377,7 @@ public class SysUserServiceImpl implements SysUserService {
private void updateImage(Integer userId, List<String> imageKeyList, List<String> urlList) { private void updateImage(Integer userId, List<String> imageKeyList, List<String> urlList) {
logger.info("开始更新图片"); logger.info("开始更新图片");
for (int i = 0; i < imageKeyList.size(); i++){ for (int i = 0; i < imageKeyList.size(); i++) {
SysUserImage sysUserImage = new SysUserImage(); SysUserImage sysUserImage = new SysUserImage();
sysUserImage.setImageKey(imageKeyList.get(i)); sysUserImage.setImageKey(imageKeyList.get(i));
sysUserImage.setUrl(urlList.get(i)); sysUserImage.setUrl(urlList.get(i));
......
...@@ -593,12 +593,19 @@ ...@@ -593,12 +593,19 @@
</otherwise> </otherwise>
</choose> </choose>
<where>
u.org_id in
<foreach collection="ids" item="item" index="index"
open="(" separator="," close=")">#{item}
</foreach>
</where>
<choose> <choose>
<when test="userStatus != null and userStatus!=''"> <when test="userStatus != null and userStatus!=''">
WHERE u.user_status = #{userStatus,jdbcType=VARCHAR} and u.user_status = #{userStatus,jdbcType=VARCHAR}
</when> </when>
<otherwise> <otherwise>
WHERE u.user_status &lt;&gt; 'sys_user_status_logout' and u.user_status &lt;&gt; 'sys_user_status_logout'
</otherwise> </otherwise>
</choose> </choose>
<if test="id != null and id!=''"> <if test="id != null and id!=''">
...@@ -611,10 +618,6 @@ ...@@ -611,10 +618,6 @@
<if test="phoneNumber != null and phoneNumber!=''"> <if test="phoneNumber != null and phoneNumber!=''">
and u.phone_number like "%"#{phoneNumber,jdbcType=VARCHAR}"%" and u.phone_number like "%"#{phoneNumber,jdbcType=VARCHAR}"%"
</if> </if>
<if test="orgId != null and orgId!=''">
and u.org_id = #{orgId,jdbcType=INTEGER}
</if>
<if test="sTime != null and eTime!=null and sTime !='' and eTime !=''"> <if test="sTime != null and eTime!=null and sTime !='' and eTime !=''">
and u.create_time between #{sTime,jdbcType=TIMESTAMP} and #{eTime,jdbcType=TIMESTAMP} and u.create_time between #{sTime,jdbcType=TIMESTAMP} and #{eTime,jdbcType=TIMESTAMP}
</if> </if>
...@@ -625,6 +628,8 @@ ...@@ -625,6 +628,8 @@
resultType="com.glsx.usercenter.pojo.user.SysMerchant"> resultType="com.glsx.usercenter.pojo.user.SysMerchant">
SELECT SELECT
u.id, u.id,
u.username,
u.password,
u.org_id orgId, u.org_id orgId,
sm.shop_name shopName, sm.shop_name shopName,
user_status userStatus, user_status userStatus,
...@@ -697,7 +702,8 @@ ...@@ -697,7 +702,8 @@
and u.merchant_status = #{userStatus,jdbcType=VARCHAR} and u.merchant_status = #{userStatus,jdbcType=VARCHAR}
</when> </when>
<otherwise> <otherwise>
and sm.merchant_status IN ('sys_user_status_unbound_service','sys_user_status_unbound_mechanic','sys_user_status_bound') and sm.merchant_status IN
('sys_user_status_unbound_service','sys_user_status_unbound_mechanic','sys_user_status_bound')
</otherwise> </otherwise>
</choose> </choose>
</if> </if>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!