Browse Source

查询房屋信息sql 调整

wuxw 7 years ago
parent
commit
b7470070f5

+ 7 - 5
Api/src/main/java/com/java110/api/listener/room/QueryRoomsListener.java

@@ -67,6 +67,8 @@ public class QueryRoomsListener extends AbstractServiceApiDataFlowListener {
             List<RoomDto> roomDtoList = roomInnerServiceSMOImpl.queryRooms(roomDto);
             apiRoomVo.setRooms(BeanConvertUtil.covertBeanList(roomDtoList, ApiRoomDataVo.class));
         }
+        int row = reqJson.getInteger("row");
+        apiRoomVo.setRecords((int) Math.ceil((double) total / (double) row));
 
         ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiRoomVo), HttpStatus.OK);
         dataFlowContext.setResponseEntity(responseEntity);
@@ -81,16 +83,16 @@ public class QueryRoomsListener extends AbstractServiceApiDataFlowListener {
         Assert.jsonObjectHaveKey(reqJson, "communityId", "请求中未包含communityId信息");
         Assert.jsonObjectHaveKey(reqJson, "floorId", "请求中未包含communityId信息");
         Assert.jsonObjectHaveKey(reqJson, "page", "请求报文中未包含page节点");
-        Assert.jsonObjectHaveKey(reqJson, "rows", "请求报文中未包含rows节点");
+        Assert.jsonObjectHaveKey(reqJson, "row", "请求报文中未包含row节点");
 
         Assert.isInteger(reqJson.getString("page"), "page不是数字");
-        Assert.isInteger(reqJson.getString("rows"), "rows不是数字");
+        Assert.isInteger(reqJson.getString("row"), "row不是数字");
         Assert.hasLength(reqJson.getString("communityId"), "小区ID不能为空");
-        int rows = Integer.parseInt(reqJson.getString("rows"));
+        int row = Integer.parseInt(reqJson.getString("row"));
 
 
-        if (rows > MAX_ROW) {
-            throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, "rows 数量不能大于50");
+        if (row > MAX_ROW) {
+            throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, "row 数量不能大于50");
         }
         //校验小区楼ID和小区是否有对应关系
         int total = floorInnerServiceSMOImpl.queryFloorsCount(BeanConvertUtil.covertBean(reqJson, FloorDto.class));

+ 10 - 0
CommunityService/src/main/java/com/java110/community/dao/IRoomServiceDao.java

@@ -72,4 +72,14 @@ public interface IRoomServiceDao {
      */
     int queryRoomsCount(Map info);
 
+
+    /**
+     * 查询小区房屋信息
+     * 根据bId 查询小区房屋信息
+     *
+     * @param info bId 信息
+     * @return 小区房屋信息
+     */
+    List<Map> getRoomInfoByCommunityId(Map info) ;
+
 }

+ 9 - 0
CommunityService/src/main/java/com/java110/community/dao/impl/RoomServiceDaoImpl.java

@@ -130,5 +130,14 @@ public class RoomServiceDaoImpl extends BaseServiceDao implements IRoomServiceDa
         return Integer.parseInt(businessRoomInfos.get(0).get("count").toString());
     }
 
+    @Override
+    public List<Map> getRoomInfoByCommunityId(Map info) {
+        logger.debug("查询小区房屋信息 入参 info : {}", info);
+
+        List<Map> businessRoomInfos = sqlSessionTemplate.selectList("roomServiceDaoImpl.getRoomInfoByCommunityId", info);
+
+        return businessRoomInfos;
+    }
+
 
 }

+ 1 - 1
CommunityService/src/main/java/com/java110/community/smo/impl/RoomInnerServiceSMOImpl.java

@@ -53,7 +53,7 @@ public class RoomInnerServiceSMOImpl extends BaseServiceSMO implements IRoomInne
             roomDto.setRow(page * roomDto.getRow());
         }
 
-        List<RoomDto> rooms = BeanConvertUtil.covertBeanList(roomServiceDaoImpl.getRoomInfo(BeanConvertUtil.beanCovertMap(roomDto)), RoomDto.class);
+        List<RoomDto> rooms = BeanConvertUtil.covertBeanList(roomServiceDaoImpl.getRoomInfoByCommunityId(BeanConvertUtil.beanCovertMap(roomDto)), RoomDto.class);
 
         if (rooms == null || rooms.size() == 0) {
             return rooms;

+ 3 - 3
WebService/src/main/java/com/java110/web/smo/impl/RoomServiceSMOImpl.java

@@ -99,13 +99,13 @@ public class RoomServiceSMOImpl extends BaseComponentSMO implements IRoomService
         Assert.jsonObjectHaveKey(pd.getReqData(), "communityId", "请求报文中未包含communityId节点");
         Assert.jsonObjectHaveKey(pd.getReqData(), "floorId", "请求报文中未包含floorId节点");
         Assert.jsonObjectHaveKey(pd.getReqData(), "page", "请求报文中未包含page节点");
-        Assert.jsonObjectHaveKey(pd.getReqData(), "rows", "请求报文中未包含rows节点");
+        Assert.jsonObjectHaveKey(pd.getReqData(), "row", "请求报文中未包含rows节点");
 
         JSONObject paramIn = JSONObject.parseObject(pd.getReqData());
         Assert.isInteger(paramIn.getString("page"), "page不是数字");
-        Assert.isInteger(paramIn.getString("rows"), "rows不是数字");
+        Assert.isInteger(paramIn.getString("row"), "row不是数字");
         Assert.hasLength(paramIn.getString("communityId"), "小区ID不能为空");
-        int rows = Integer.parseInt(paramIn.getString("rows"));
+        int rows = Integer.parseInt(paramIn.getString("row"));
 
 
         if (rows > MAX_ROW) {

+ 5 - 5
WebService/src/main/resources/components/room/room.js

@@ -3,7 +3,7 @@
 **/
 (function(vc){
     var DEFAULT_PAGE = 1;
-    var DEFAULT_ROWS = 10;
+    var DEFAULT_ROW = 10;
     vc.extends({
         data:{
             roomInfo:{
@@ -22,18 +22,18 @@
             });
             vc.on('room','loadData',function(_param){
                 vc.component.roomInfo.floorId = _param.floorId;
-                vc.component.listRoom(DEFAULT_PAGE,DEFAULT_ROWS);
+                vc.component.listRoom(DEFAULT_PAGE,DEFAULT_ROW);
             });
             vc.on('pagination','page_event',function(_currentPage){
-                vc.component.listRoom(_currentPage,DEFAULT_ROWS);
+                vc.component.listRoom(_currentPage,DEFAULT_ROW);
             });
         },
         methods:{
-            listRoom:function(_page,_rows){
+            listRoom:function(_page,_row){
                 var param = {
                     params:{
                         page:_page,
-                        rows:_rows,
+                        row:_row,
                         communityId:vc.getCurrentCommunity().communityId,
                         floorId:vc.component.roomInfo.floorId
                     }

+ 59 - 0
java110-config/src/main/resources/mapper/room/RoomServiceDaoImplMapper.xml

@@ -243,4 +243,63 @@ where 1 =1
 
      </select>
 
+    <!-- 查询小区房屋信息 add by wuxw 2018-07-03 -->
+    <select id="getRoomInfoByCommunityId" parameterType="Map" resultType="Map">
+        SELECT  t.unit_price,t.unit_price unitPrice,t.section,t.status_cd,t.status_cd statusCd,t.remark,t.user_id,t.user_id userId,t.room_id,t.room_id roomId,t.layer,t.built_up_area,t.built_up_area builtUpArea,t.room_num,t.room_num roomNum,t.unit_id,t.unit_id unitId,t.b_id,t.b_id bId,t.apartment
+        FROM building_room t,s_community c,s_community_member cm,building_unit u,f_floor f
+        WHERE 1 =1
+            AND t.`unit_id` = u.`unit_id`
+            AND u.`floor_id` = f.`floor_id`
+            AND f.`floor_id` = cm.`member_id`
+            AND cm.`community_id` = c.`community_id`
+            AND cm.`member_type_cd` = '390001200004'
+            AND c.`status_cd` = '0'
+            AND cm.`status_cd` = '0'
+            AND u.`status_cd` = '0'
+            AND f.`status_cd` = '0'
+            AND c.`community_id` = #{communityId}
+        <if test="floorId !=null and floorId != ''">
+            and f.`floor_id`= #{floorId}
+        </if>
+        <if test="unitPrice !=null and unitPrice != ''">
+            and t.unit_price= #{unitPrice}
+        </if>
+        <if test="section !=null and section != ''">
+            and t.section= #{section}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="userId !=null and userId != ''">
+            and t.user_id= #{userId}
+        </if>
+        <if test="roomId !=null and roomId != ''">
+            and t.room_id= #{roomId}
+        </if>
+        <if test="layer !=null and layer != ''">
+            and t.layer= #{layer}
+        </if>
+        <if test="builtUpArea !=null and builtUpArea != ''">
+            and t.built_up_area= #{builtUpArea}
+        </if>
+        <if test="roomNum !=null and roomNum != ''">
+            and t.room_num= #{roomNum}
+        </if>
+        <if test="unitId !=null and unitId != ''">
+            and t.unit_id= #{unitId}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="apartment !=null and apartment != ''">
+            and t.apartment= #{apartment}
+        </if>
+        <if test="page != -1 and page != null and page != ''">
+            limit page,row
+        </if>
+
+    </select>
 </mapper>