Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 

119 rader
4.3 KiB

  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.iformall.mapper.WxMallFloorMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxMallFloor">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
  8. <result column="mall_id" jdbcType="BIGINT" property="mallId"/>
  9. <result column="building_id" jdbcType="BIGINT" property="buildingId"/>
  10. <result column="floor_name" jdbcType="VARCHAR" property="floorName"/>
  11. <result column="background_img" jdbcType="VARCHAR" property="backgroundImg"/>
  12. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  13. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  14. <result column="total_area" jdbcType="DECIMAL" property="totalArea"/>
  15. <result column="operating_area" jdbcType="DECIMAL" property="operatingArea"/>
  16. <result column="floor_map" jdbcType="VARCHAR" property="floorMap"/>
  17. </resultMap>
  18. <sql id="allColumns">
  19. `id`,`tenant_id`,`parent_tenant_id`,`mall_id`,`building_id`,`floor_name`,`background_img`,`create_date`,`update_date`,`total_area`,`operating_area`,`floor_map`
  20. </sql>
  21. <sql id="dynamicWhereConditions">
  22. where 1 = 1
  23. <if test=" null != id ">
  24. and `id` = #{id}
  25. </if>
  26. <if test=" null != tenantId and '' != tenantId">
  27. and `tenant_id` = #{tenantId}
  28. </if>
  29. <if test=" null != parentTenantId and '' != parentTenantId">
  30. and `parent_tenant_id` = #{parentTenantId}
  31. </if>
  32. <if test=" null != mallId ">
  33. and `mall_id` = #{mallId}
  34. </if>
  35. <if test=" null != buildingId ">
  36. and `building_id` = #{buildingId}
  37. </if>
  38. <if test=" null != floorName ">
  39. and `floor_name` like concat('%', #{floorName},'%')
  40. </if>
  41. <if test=" null != backgroundImg ">
  42. and `background_img` like concat('%', #{backgroundImg},'%')
  43. </if>
  44. <if test=" null != createDate ">
  45. and `create_date` = #{createDate}
  46. </if>
  47. <if test=" null != updateDate ">
  48. and `update_date` = #{updateDate}
  49. </if>
  50. <if test=" null != floorForRule and '' != floorForRule ">
  51. and `id` in (${floorForRule})
  52. </if>
  53. <if test=" null != ids ">
  54. and id in
  55. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  56. #{idItem}
  57. </foreach>
  58. </if>
  59. <if test=" null != sortColumns">order by ${sortColumns}</if>
  60. </sql>
  61. <select id="findList" parameterType="com.iformall.domain.po.WxMallFloor" resultMap="BaseResultMap">
  62. select
  63. <include refid="allColumns"/>
  64. from wx_mall_floor
  65. <include refid="dynamicWhereConditions"/>
  66. </select>
  67. <delete id="deleteByBuildingId">
  68. delete from wx_mall_floor where building_id = #{buildingId}
  69. </delete>
  70. <delete id="deleteByTenantId">
  71. delete from wx_mall_floor where `tenant_id` = #{tenantId}
  72. </delete>
  73. <select id="findIdAndName" resultMap="BaseResultMap">
  74. select
  75. `id`,`floor_name`
  76. from wx_mall_floor
  77. where `tenant_id` = #{tenantId}
  78. </select>
  79. <select id="getBuildindIds" parameterType="com.iformall.domain.po.WxMallFloor" resultType="Long">
  80. select distinct building_id
  81. from wx_mall_floor
  82. <include refid="dynamicWhereConditions"/>
  83. </select>
  84. <select id="getAllPublicAreaSum" parameterType="com.iformall.domain.po.WxMallFloor" resultType="string">
  85. select sum((CAST(operating_area AS DECIMAL(20,4))) area
  86. from wx_mall_floor
  87. <include refid="dynamicWhereConditions"/>
  88. </select>
  89. <select id="getBuildingPublicAreaSum" parameterType="com.iformall.domain.po.WxMallFloor" resultType="hashmap">
  90. select building_id, sum((CAST(operating_area AS DECIMAL(20,4))) area
  91. from wx_mall_floor
  92. <include refid="dynamicWhereConditions"/>
  93. group by building_id
  94. </select>
  95. </mapper>