TaBuildingMapper.xml 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.huiju.estateagents.mapper.TaBuildingMapper">
  4. <select id="buildingList" resultType="com.huiju.estateagents.entity.TaBuilding">
  5. SELECT * FROM ta_building
  6. <where>
  7. status > -1
  8. <if test="Name != null and Name != ''">
  9. and (ta_building.name like concat('%',#{Name,jdbcType=VARCHAR},'%') or ta_building.building_name like concat('%',#{Name,jdbcType=VARCHAR},'%'))
  10. </if>
  11. <if test="Code != null and Code != ''">
  12. and ta_building.code like concat('%',#{Code,jdbcType=VARCHAR},'%')
  13. </if>
  14. <if test="startDate != null">
  15. and TO_DAYS(ta_building.opening_date ) = TO_DAYS(#{startDate})
  16. </if>
  17. <if test="buildingStatus != null and buildingStatus != ''">
  18. and ta_building.building_status = #{buildingStatus}
  19. </if>
  20. <if test="marketStatus != null and marketStatus != ''">
  21. and ta_building.market_status =#{marketStatus}
  22. </if>
  23. <if test="cityId != null and cityId != ''">
  24. and ta_building.city_id =#{cityId}
  25. </if>
  26. <if test="isMain != null and isMain != ''">
  27. and ta_building.is_main = #{isMain}
  28. </if>
  29. </where>
  30. ORDER BY create_date DESC
  31. </select>
  32. <select id="buildingListSelect" resultType="com.huiju.estateagents.entity.TaBuilding">
  33. SELECT * FROM ta_building
  34. <where>
  35. status =1
  36. <if test="Name != null and Name != ''">
  37. and (ta_building.name like concat('%',#{Name,jdbcType=VARCHAR},'%') or ta_building.building_name like concat('%',#{Name,jdbcType=VARCHAR},'%'))
  38. </if>
  39. <if test="Code != null and Code != ''">
  40. and ta_building.code like concat('%',#{Code,jdbcType=VARCHAR},'%')
  41. </if>
  42. <if test="startDate != null">
  43. and TO_DAYS(ta_building.opening_date ) = TO_DAYS(#{startDate})
  44. </if>
  45. <if test="marketStatus != null and marketStatus != ''">
  46. and ta_building.market_status =#{marketStatus}
  47. </if>
  48. <if test="cityId != null and cityId != ''">
  49. and ta_building.city_id =#{cityId}
  50. </if>
  51. <if test="isMain != null and isMain != ''">
  52. and ta_building.is_main = #{isMain}
  53. </if>
  54. </where>
  55. ORDER BY create_date DESC
  56. </select>
  57. <select id="buildingAll" resultType="com.huiju.estateagents.entity.TaBuilding">
  58. SELECT * FROM ta_building
  59. where status > -1
  60. </select>
  61. <select id="selectBuilding" resultType="com.huiju.estateagents.entity.TaBuilding">
  62. SELECT * FROM ta_building
  63. where building_id = #{buildingId}
  64. </select>
  65. <select id="selectBuildingStatistical" resultType="map">
  66. select
  67. IFNULL(sum(pv_num), 0) as pvNum,
  68. <if test="saveOrShare == 'save'">
  69. IFNULL(sum(save_num),0) as saveNum
  70. </if>
  71. <if test="saveOrShare == 'share'">
  72. IFNULL(sum(share_num),0) as shareNum
  73. </if>
  74. from ta_building
  75. </select>
  76. </mapper>