ソースを参照

feat(property): 添加房屋信息列表页总条数查询功能

- 在 ASimplifiedHouseInfoMapper 接口中添加 getListPageTotal 方法
- 在 ASimplifiedHouseInfoMapper.xml 中实现 getListPageTotal 方法的 SQL 查询- 修改 ASimplifiedHouseInfoServiceImpl 中的分页逻辑,使用新的总条数查询方法
林仔 10 ヶ月 前
コミット
c053ce8edb

+ 1 - 0
src/main/java/com/zksy/property/mapper/ASimplifiedHouseInfoMapper.java

@@ -16,6 +16,7 @@ import java.util.List;
 */
 public interface ASimplifiedHouseInfoMapper extends BaseMapper<ASimplifiedHouseInfo> {
     public List<ASimplifiedHouseInfoVo> getListPage(@Param("entity") ASimplifiedHouseInfoDto entity,Integer offset,Integer limit,String sortClause);
+    Long getListPageTotal(@Param("entity") ASimplifiedHouseInfoDto entity);
 }
 
 

+ 1 - 1
src/main/java/com/zksy/property/service/impl/ASimplifiedHouseInfoServiceImpl.java

@@ -80,7 +80,7 @@ public class ASimplifiedHouseInfoServiceImpl extends ServiceImpl<ASimplifiedHous
 
         // 设置分页数据
         page.setRecords(list);
-        page.setTotal(houseInfoMapper.getListPage(entity,offset,entity.getPageSize(),sortClause).size());
+        page.setTotal(houseInfoMapper.getListPageTotal(entity));
 
         return page;
     }

+ 28 - 0
src/main/resources/mapper/property/ASimplifiedHouseInfoMapper.xml

@@ -62,4 +62,32 @@
         </if>
 
     </select>
+    <select id="getListPageTotal" resultType="java.lang.Long">
+        SELECT count(*)
+        FROM a_simplified_house_info a
+        LEFT JOIN a_house_info_detail b ON a.id = b.simplified_house_id
+        <where>
+            <if test="entity.assetType != null and entity.assetType != ''">
+                AND a.asset_type = #{entity.assetType}
+            </if>
+            <if test="entity.building != null and entity.building != ''">
+                AND a.building = #{entity.building}
+            </if>
+            <if test="entity.floor != null and entity.floor != ''">
+                AND a.floor LIKE CONCAT(#{entity.floor}, '%')
+            </if>
+            <if test="entity.rentRangeMin != null">
+                AND a.rent_range >= COALESCE(#{entity.rentRangeMin}, a.rent_range)
+            </if>
+            <if test="entity.rentRangeMax != null">
+                AND a.rent_range &lt;= COALESCE(#{entity.rentRangeMax}, a.rent_range)
+            </if>
+            <if test="entity.areaMin != null">
+                AND b.area >= COALESCE(#{entity.areaMin}, b.area)
+            </if>
+            <if test="entity.areaMax != null">
+                AND b.area &lt;= COALESCE(#{entity.areaMax}, b.area)
+            </if>
+        </where>
+    </select>
 </mapper>