| | |
| | | package com.java110.community.smo.impl; |
| | | |
| | | import com.java110.common.util.BeanConvertUtil; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.community.dao.IFloorServiceDao; |
| | | import com.java110.core.base.smo.BaseServiceSMO; |
| | | import com.java110.core.smo.floor.IFloorInnerServiceSMO; |
| | | import com.java110.core.smo.user.IUserInnerServiceSMO; |
| | | import com.java110.dto.FloorDto; |
| | | import com.java110.dto.PageDto; |
| | | import com.java110.dto.UserDto; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | |
| | | @Override |
| | | public List<FloorDto> queryFloors(@RequestParam("page") int page, @RequestParam("row") int row, @RequestParam("communityId") String communityId) { |
| | | Map<String, Object> floorInfo = new HashMap<String, Object>(); |
| | | floorInfo.put("page", page); |
| | | floorInfo.put("row", row); |
| | | floorInfo.put("page", (page - 1) * row); |
| | | floorInfo.put("row", row * page); |
| | | floorInfo.put("communityId", communityId); |
| | | List<FloorDto> floors = BeanConvertUtil.covertBeanList(floorServiceDaoImpl.queryFloors(floorInfo), FloorDto.class); |
| | | |
| | | |
| | | if (floors == null || floors.size() == 0) { |
| | | return floors; |
| | | } |
| | | |
| | | String[] userIds = getUserIds(floors); |
| | | //根据 userId 查询用户信息 |
| | |
| | | public int queryFloorsCount(String communityId) { |
| | | return floorServiceDaoImpl.queryFloorsCount(communityId); |
| | | } |
| | | |
| | | @Override |
| | | public List<FloorDto> queryFloors(@RequestBody FloorDto floorDto) { |
| | | |
| | | //校验是否传了 分页信息 |
| | | |
| | | int page = floorDto.getPage(); |
| | | |
| | | if (page != PageDto.DEFAULT_PAGE) { |
| | | floorDto.setPage((page - 1) * floorDto.getRow()); |
| | | } |
| | | |
| | | |
| | | List<FloorDto> floors = BeanConvertUtil.covertBeanList( |
| | | floorServiceDaoImpl.queryFloors(BeanConvertUtil.beanCovertMap(floorDto)), FloorDto.class); |
| | | |
| | | |
| | | if (floors == null || floors.size() == 0) { |
| | | return floors; |
| | | } |
| | | |
| | | String[] userIds = getUserIds(floors); |
| | | //根据 userId 查询用户信息 |
| | | List<UserDto> users = userInnerServiceSMOImpl.getUserInfo(userIds); |
| | | |
| | | for (FloorDto floor : floors) { |
| | | refreshFloor(floor, users); |
| | | } |
| | | return floors; |
| | | } |
| | | |
| | | @Override |
| | | public int queryFloorsCount(@RequestBody FloorDto floorDto) { |
| | | return floorServiceDaoImpl.queryFloorsCount(BeanConvertUtil.beanCovertMap(floorDto)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中 |
| | |
| | | userIds.add(floor.getUserId()); |
| | | } |
| | | |
| | | return userIds.toArray(new String[userIds.size()]); |
| | | return userIds.toArray(new String[userIds.size()]); |
| | | } |
| | | |
| | | public IFloorServiceDao getFloorServiceDaoImpl() { |