Commit 10804573 by zhanghj

V1.2.0--选择收货账号,增加用户类型过滤

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@21985 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 49a71d54
...@@ -1142,13 +1142,13 @@ public class UserController extends BaseController { ...@@ -1142,13 +1142,13 @@ public class UserController extends BaseController {
*/ */
@RequestMapping(value = "/getAllIndentUserList", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/getAllIndentUserList", method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody @ResponseBody
public ResultObject getAllIndentUserList(Integer pageIndex, Integer pageSize, String queryContent) { public ResultObject getAllIndentUserList(Integer pageIndex, Integer pageSize, Integer userType, String queryContent) {
Map<String, Object> result = new HashMap<String, Object>(16); Map<String, Object> result = new HashMap<String, Object>(16);
Page page = null; Page page = null;
if (pageIndex != null && pageSize != null) { if (pageIndex != null && pageSize != null) {
page = new Page(pageIndex, pageSize); page = new Page(pageIndex, pageSize);
} }
List<SysManager> list = sysUserService.getAllIndentUserList(queryContent, page); List<SysManager> list = sysUserService.getAllIndentUserList(userType, queryContent, page);
if (page != null) { if (page != null) {
com.github.pagehelper.Page<SysManager> pages = (com.github.pagehelper.Page<SysManager>) list; com.github.pagehelper.Page<SysManager> pages = (com.github.pagehelper.Page<SysManager>) list;
page.setTotalCount((int) pages.getTotal()); page.setTotalCount((int) pages.getTotal());
......
...@@ -158,7 +158,7 @@ public interface SysUserMapper { ...@@ -158,7 +158,7 @@ public interface SysUserMapper {
* List<SysManager> * List<SysManager>
* *
*/ */
List<SysManager> getAllIndentUserList(@Param("queryContent") String queryContent); List<SysManager> getAllIndentUserList(@Param("userType")Integer userType, @Param("queryContent") String queryContent);
Integer getMechanicSP(@Param("userId")Integer userId); Integer getMechanicSP(@Param("userId")Integer userId);
} }
\ No newline at end of file \ No newline at end of file
...@@ -322,7 +322,7 @@ public interface SysUserService { ...@@ -322,7 +322,7 @@ public interface SysUserService {
*/ */
List<SysUser> getMechanicBelongService(Integer userId); List<SysUser> getMechanicBelongService(Integer userId);
List<SysManager> getAllIndentUserList(String queryContent, Page page); List<SysManager> getAllIndentUserList(Integer userType, String queryContent, Page page);
/** /**
* *
......
...@@ -900,12 +900,12 @@ public class SysUserServiceImpl implements SysUserService { ...@@ -900,12 +900,12 @@ public class SysUserServiceImpl implements SysUserService {
} }
@Override @Override
public List<SysManager> getAllIndentUserList(String queryContent, Page page) { public List<SysManager> getAllIndentUserList(Integer userType, String queryContent, Page page) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
if (page != null) { if (page != null) {
PageHelper.startPage(page.getPageIndex(), page.getPageSize(), true); PageHelper.startPage(page.getPageIndex(), page.getPageSize(), true);
} }
return sysUserMapper.getAllIndentUserList(queryContent); return sysUserMapper.getAllIndentUserList(userType, queryContent);
} }
@Override @Override
......
...@@ -1342,21 +1342,43 @@ ...@@ -1342,21 +1342,43 @@
SELECT SELECT
* FROM * FROM
( (
SELECT <choose>
su.id, su.username, so.`name` as orgName, su.phone_number, su.user_type <when test="userType != null and userType == 1">
FROM sys_user su SELECT
LEFT JOIN sys_organization so ON su.org_id = so.id su.id, su.username, so.`name` as orgName, su.phone_number, su.user_type
WHERE su.user_type = 1 FROM sys_user su
and su.user_status = 'sys_user_status_normal' LEFT JOIN sys_organization so ON su.org_id = so.id
UNION WHERE su.user_type = 1
SELECT and su.user_status = 'sys_user_status_normal'
su.id, su.username, so.`name` as orgName, su.phone_number, su.user_type </when>
from sys_user su <when test="userType != null and userType == 3">
LEFT JOIN sys_organization so ON su.org_id = so.id SELECT
LEFT JOIN sys_mechanic sm ON su.id = sm.user_id su.id, su.username, so.`name` as orgName, su.phone_number, su.user_type
WHERE su.user_type = 3 from sys_user su
and su.user_status = 'sys_user_status_normal' LEFT JOIN sys_organization so ON su.org_id = so.id
AND sm.send_type = 2 LEFT JOIN sys_mechanic sm ON su.id = sm.user_id
WHERE su.user_type = 3
and su.user_status = 'sys_user_status_normal'
AND sm.send_type = 2
</when>
<otherwise>
SELECT
su.id, su.username, so.`name` as orgName, su.phone_number, su.user_type
FROM sys_user su
LEFT JOIN sys_organization so ON su.org_id = so.id
WHERE su.user_type = 1
and su.user_status = 'sys_user_status_normal'
UNION
SELECT
su.id, su.username, so.`name` as orgName, su.phone_number, su.user_type
from sys_user su
LEFT JOIN sys_organization so ON su.org_id = so.id
LEFT JOIN sys_mechanic sm ON su.id = sm.user_id
WHERE su.user_type = 3
and su.user_status = 'sys_user_status_normal'
AND sm.send_type = 2
</otherwise>
</choose>
)t )t
<where> <where>
<if test="queryContent != null and queryContent != ''"> <if test="queryContent != null and queryContent != ''">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!