HpPositionAddressMapper.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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.jeeplus.modules.hpposition.mapper.HpPositionAddressMapper">
  4. <sql id="hpPositionAddressColumns">
  5. a.id AS "id",
  6. a.position_id AS "positionId",
  7. a.position_category AS "positionCategory",
  8. a.province_id AS "provinceId",
  9. a.city_id AS "cityId",
  10. a.country_id AS "countryId",
  11. a.adname as "adname",
  12. a.address AS "address",
  13. a.is_this_area_publish AS "isThisAreaPublish"
  14. </sql>
  15. <sql id="hpPositionAddressColumnsAPI">
  16. a.id AS "id",
  17. a.position_id AS "positionId",
  18. a.position_category AS "positionCategory",
  19. a.province_id AS "provinceId",
  20. a.city_id AS "cityId",
  21. a.country_id AS "countryId",
  22. a.adname as "adname",
  23. ifnull(a.address,"") AS "address",
  24. a.is_this_area_publish AS "isThisAreaPublish"
  25. </sql>
  26. <sql id="hpPositionAddressJoins">
  27. </sql>
  28. <sql id="hpPositionAddressJoinsAPI">
  29. </sql>
  30. <select id="get" resultType="HpPositionAddress" >
  31. SELECT
  32. <include refid="hpPositionAddressColumns"/>
  33. FROM hp_position_address a
  34. <include refid="hpPositionAddressJoins"/>
  35. WHERE a.id = #{id}
  36. </select>
  37. <select id="findList" resultType="HpPositionAddress" >
  38. SELECT
  39. <include refid="hpPositionAddressColumns"/>
  40. FROM hp_position_address a
  41. <include refid="hpPositionAddressJoins"/>
  42. <where>
  43. 1=1
  44. ${dataScope}
  45. <if test="positionId != null and positionId != ''">
  46. and a.position_id = #{positionId}
  47. </if>
  48. <if test="positionCategory != null ">
  49. and a.position_category = #{positionCategory}
  50. </if>
  51. </where>
  52. <choose>
  53. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  54. ORDER BY ${page.orderBy}
  55. </when>
  56. <otherwise>
  57. </otherwise>
  58. </choose>
  59. </select>
  60. <select id="findAllList" resultType="HpPositionAddress" >
  61. SELECT
  62. <include refid="hpPositionAddressColumns"/>
  63. FROM hp_position_address a
  64. <include refid="hpPositionAddressJoins"/>
  65. <where>
  66. ${dataScope}
  67. </where>
  68. <choose>
  69. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  70. ORDER BY ${page.orderBy}
  71. </when>
  72. <otherwise>
  73. </otherwise>
  74. </choose>
  75. </select>
  76. <insert id="insert">
  77. INSERT INTO hp_position_address(
  78. position_id,
  79. position_category,
  80. province_id,
  81. city_id,
  82. country_id,
  83. adname,
  84. address,
  85. is_this_area_publish
  86. ) VALUES (
  87. #{positionId},
  88. #{positionCategory},
  89. #{provinceId},
  90. #{cityId},
  91. #{countryId},
  92. #{adname},
  93. #{address},
  94. #{isThisAreaPublish}
  95. )
  96. </insert>
  97. <update id="update">
  98. UPDATE hp_position_address SET
  99. position_id = #{positionId},
  100. position_category = #{positionCategory},
  101. province_id = #{provinceId},
  102. city_id = #{cityId},
  103. country_id = #{countryId},
  104. adname = #{adname},
  105. address = #{address},
  106. is_this_area_publish = #{isThisAreaPublish}
  107. WHERE id = #{id}
  108. </update>
  109. <!--物理删除-->
  110. <update id="delete">
  111. DELETE FROM hp_position_address
  112. WHERE id = #{id}
  113. </update>
  114. <!--逻辑删除-->
  115. <update id="deleteByLogic">
  116. UPDATE hp_position_address SET
  117. del_flag = #{DEL_FLAG_DELETE}
  118. WHERE id = #{id}
  119. </update>
  120. <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
  121. <select id="findUniqueByProperty" resultType="HpPositionAddress" statementType="STATEMENT">
  122. select * FROM hp_position_address where ${propertyName} = '${value}'
  123. </select>
  124. <select id="findAPIList" parameterType="HpPositionAddress" resultType="HpPositionAddress">
  125. SELECT
  126. <include refid="hpPositionAddressColumnsAPI"/>
  127. FROM hp_position_address a
  128. <include refid="hpPositionAddressJoinsAPI"/>
  129. <where>
  130. 1=1
  131. <if test="positionId != null and positionId != ''">
  132. and a.position_id = #{positionId}
  133. </if>
  134. <if test="positionCategory != null ">
  135. and a.position_category = #{positionCategory}
  136. </if>
  137. </where>
  138. </select>
  139. <!--物理删除-->
  140. <update id="deleteBypositionId">
  141. DELETE FROM hp_position_address
  142. WHERE position_id = #{0}
  143. </update>
  144. <!--物理删除-->
  145. <update id="delete1">
  146. DELETE FROM hp_position_address
  147. WHERE position_id = #{0} and position_category=#{1}
  148. </update>
  149. </mapper>