Commit 52522226 authored by mlchun's avatar mlchun

1.添加查询本机构全部服务人员接口

parent f757e30d
...@@ -4,6 +4,8 @@ import io.hmit.common.dao.BaseDao; ...@@ -4,6 +4,8 @@ import io.hmit.common.dao.BaseDao;
import io.hmit.entity.UserEntity; import io.hmit.entity.UserEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 用户 * 用户
* *
...@@ -15,4 +17,7 @@ public interface UserDao extends BaseDao<UserEntity> { ...@@ -15,4 +17,7 @@ public interface UserDao extends BaseDao<UserEntity> {
UserEntity getUserByMobile(String mobile); UserEntity getUserByMobile(String mobile);
UserEntity getUserByUserId(Long userId); UserEntity getUserByUserId(Long userId);
List<Long> getAllOrganizationStaff(Long userId);
} }
...@@ -15,6 +15,7 @@ import io.hmit.entity.UserEntity; ...@@ -15,6 +15,7 @@ import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO; import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.dto.ReservationDTO; import io.hmit.modules.serviceOrder.dto.ReservationDTO;
import io.hmit.modules.serviceOrder.service.PensionOrderService; import io.hmit.modules.serviceOrder.service.PensionOrderService;
import io.hmit.service.UserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
...@@ -39,6 +40,9 @@ public class PensionOrderController { ...@@ -39,6 +40,9 @@ public class PensionOrderController {
@Autowired @Autowired
private PensionOrderService pensionOrderService; private PensionOrderService pensionOrderService;
@Autowired
private UserService userService;
@Login @Login
@GetMapping("page") @GetMapping("page")
@ApiOperation("全部订单(志愿者)") @ApiOperation("全部订单(志愿者)")
...@@ -298,4 +302,22 @@ public class PensionOrderController { ...@@ -298,4 +302,22 @@ public class PensionOrderController {
return new Result(); return new Result();
} }
/**
* 机构全部人员
*/
@Login
@GetMapping("organizationStaff")
@ApiOperation(value = "机构全部人员(机构)")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
public Result<PageData<UserEntity>> organizationStaff(@ApiIgnore @LoginUser UserEntity user,
@ApiIgnore @RequestParam Map<String, Object> params){
PageData<UserEntity> page = userService.getOrganizationAllUsers(params, user.getId());
return new Result<PageData<UserEntity>>().ok(page);
}
} }
package io.hmit.service; package io.hmit.service;
import io.hmit.common.page.PageData;
import io.hmit.common.service.BaseService; import io.hmit.common.service.BaseService;
import io.hmit.dto.LoginDTO; import io.hmit.dto.LoginDTO;
import io.hmit.entity.UserEntity; import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import java.util.Map; import java.util.Map;
...@@ -24,4 +26,7 @@ public interface UserService extends BaseService<UserEntity> { ...@@ -24,4 +26,7 @@ public interface UserService extends BaseService<UserEntity> {
* @return 返回登录信息 * @return 返回登录信息
*/ */
Map<String, Object> login(LoginDTO dto); Map<String, Object> login(LoginDTO dto);
PageData<UserEntity> getOrganizationAllUsers(Map<String, Object> params, Long userId);
} }
package io.hmit.service.impl; package io.hmit.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.hmit.common.constant.Constant;
import io.hmit.common.exception.ErrorCode; import io.hmit.common.exception.ErrorCode;
import io.hmit.common.exception.HmitException; import io.hmit.common.exception.HmitException;
import io.hmit.common.page.PageData;
import io.hmit.common.service.impl.BaseServiceImpl; import io.hmit.common.service.impl.BaseServiceImpl;
import io.hmit.common.validator.AssertUtils; import io.hmit.common.validator.AssertUtils;
import io.hmit.dao.UserDao; import io.hmit.dao.UserDao;
...@@ -14,7 +17,9 @@ import org.apache.commons.codec.digest.DigestUtils; ...@@ -14,7 +17,9 @@ import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@Service @Service
...@@ -23,6 +28,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem ...@@ -23,6 +28,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
@Autowired
private UserDao userDao;
@Override @Override
public UserEntity getByMobile(String mobile) { public UserEntity getByMobile(String mobile) {
return baseDao.getUserByMobile(mobile); return baseDao.getUserByMobile(mobile);
...@@ -54,4 +62,17 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem ...@@ -54,4 +62,17 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
return map; return map;
} }
@Override
public PageData<UserEntity> getOrganizationAllUsers(Map<String, Object> params, Long userId) {
IPage<UserEntity> page = getPage(params, Constant.CREATE_DATE, false);
List<Long> serviceIds = userDao.getAllOrganizationStaff(userId);
List<UserEntity> list = new ArrayList<>();
for (Long id : serviceIds) {
UserEntity userEntity = userDao.selectById(id);
list.add(userEntity);
}
page.setTotal(list.size());
return getPageData(list, page.getTotal(), UserEntity.class);
}
} }
\ No newline at end of file
...@@ -10,4 +10,10 @@ ...@@ -10,4 +10,10 @@
<select id="getUserByUserId" resultType="io.hmit.entity.UserEntity"> <select id="getUserByUserId" resultType="io.hmit.entity.UserEntity">
select * from tb_user where id = #{value} select * from tb_user where id = #{value}
</select> </select>
<select id="getAllOrganizationStaff" resultType="Long">
SELECT user_id FROM pension_organization_user
WHERE organization_id = (SELECT organization_id FROM pension_organization_user
WHERE user_id = #{userId});
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment