ASimplifiedHouseInfoMapper.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zksy.property.mapper.ASimplifiedHouseInfoMapper">
  6. <resultMap id="BaseResultMap" type="com.zksy.property.domain.ASimplifiedHouseInfo">
  7. <id property="id" column="id" jdbcType="VARCHAR"/>
  8. <result property="assetType" column="asset_type" jdbcType="VARCHAR"/>
  9. <result property="building" column="building" jdbcType="VARCHAR"/>
  10. <result property="floor" column="floor" jdbcType="VARCHAR"/>
  11. <result property="houseName" column="house_name" jdbcType="VARCHAR"/>
  12. <result property="address" column="address" jdbcType="VARCHAR"/>
  13. <result property="status" column="status" jdbcType="VARCHAR"/>
  14. <result property="rentRange" column="rent_range" jdbcType="DECIMAL"/>
  15. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  16. <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
  17. </resultMap>
  18. <sql id="Base_Column_List">
  19. id,asset_type,building,
  20. floor,house_name,address,
  21. status,rent_range,create_time,
  22. update_time
  23. </sql>
  24. <select id="getListPage" resultType="com.zksy.property.domain.vo.ASimplifiedHouseInfoVo">
  25. SELECT a.*, b.area
  26. FROM a_simplified_house_info a
  27. LEFT JOIN a_house_info_detail b ON a.id = b.simplified_house_id
  28. <where>
  29. <if test="entity.assetType != null and entity.assetType != ''">
  30. AND a.asset_type = #{entity.assetType}
  31. </if>
  32. <if test="entity.building != null and entity.building != ''">
  33. AND a.building = #{entity.building}
  34. </if>
  35. <if test="entity.floor != null and entity.floor != ''">
  36. AND a.floor LIKE CONCAT(#{entity.floor}, '%')
  37. </if>
  38. <if test="entity.rentRangeMin != null">
  39. AND a.rent_range >= COALESCE(#{entity.rentRangeMin}, a.rent_range)
  40. </if>
  41. <if test="entity.rentRangeMax != null">
  42. AND a.rent_range &lt;= COALESCE(#{entity.rentRangeMax}, a.rent_range)
  43. </if>
  44. <if test="entity.areaMin != null">
  45. AND b.area >= COALESCE(#{entity.areaMin}, b.area)
  46. </if>
  47. <if test="entity.areaMax != null">
  48. AND b.area &lt;= COALESCE(#{entity.areaMax}, b.area)
  49. </if>
  50. </where>
  51. <if test="sortClause != null and sortClause != ''">
  52. ORDER BY ${sortClause}
  53. </if>
  54. <!-- 默认排序 -->
  55. <if test="sortClause == null or sortClause == ''">
  56. ORDER BY a.create_time DESC
  57. </if>
  58. <if test="offset != null and limit != null">
  59. LIMIT #{offset}, #{limit}
  60. </if>
  61. </select>
  62. <select id="getListPageTotal" resultType="java.lang.Long">
  63. SELECT count(*)
  64. FROM a_simplified_house_info a
  65. LEFT JOIN a_house_info_detail b ON a.id = b.simplified_house_id
  66. <where>
  67. <if test="entity.assetType != null and entity.assetType != ''">
  68. AND a.asset_type = #{entity.assetType}
  69. </if>
  70. <if test="entity.building != null and entity.building != ''">
  71. AND a.building = #{entity.building}
  72. </if>
  73. <if test="entity.floor != null and entity.floor != ''">
  74. AND a.floor LIKE CONCAT(#{entity.floor}, '%')
  75. </if>
  76. <if test="entity.rentRangeMin != null">
  77. AND a.rent_range >= COALESCE(#{entity.rentRangeMin}, a.rent_range)
  78. </if>
  79. <if test="entity.rentRangeMax != null">
  80. AND a.rent_range &lt;= COALESCE(#{entity.rentRangeMax}, a.rent_range)
  81. </if>
  82. <if test="entity.areaMin != null">
  83. AND b.area >= COALESCE(#{entity.areaMin}, b.area)
  84. </if>
  85. <if test="entity.areaMax != null">
  86. AND b.area &lt;= COALESCE(#{entity.areaMax}, b.area)
  87. </if>
  88. </where>
  89. </select>
  90. </mapper>