FsUserAddressMapper.xml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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.fs.his.mapper.FsUserAddressMapper">
  6. <resultMap type="FsUserAddress" id="FsUserAddressResult">
  7. <result property="addressId" column="address_id" />
  8. <result property="userId" column="user_id" />
  9. <result property="realName" column="real_name" />
  10. <result property="phone" column="phone" />
  11. <result property="province" column="province" />
  12. <result property="city" column="city" />
  13. <result property="district" column="district" />
  14. <result property="township" column="township" />
  15. <result property="cityIds" column="city_ids" />
  16. <result property="detail" column="detail" />
  17. <result property="postCode" column="post_code" />
  18. <result property="longitude" column="longitude" />
  19. <result property="latitude" column="latitude" />
  20. <result property="isDefault" column="is_default" />
  21. <result property="isDel" column="is_del" />
  22. <result property="createTime" column="create_time" />
  23. <result property="updateTime" column="update_time" />
  24. <result property="isConfirm" column="is_confirm" />
  25. <result property="helpCompanyUserId" column="help_company_user_id" />
  26. </resultMap>
  27. <sql id="selectFsUserAddressVo">
  28. select address_id, user_id, real_name, phone, province, city, district, township, city_ids, detail, post_code, longitude, latitude, is_default, is_del, create_time, update_time, is_confirm, help_company_user_id from fs_user_address
  29. </sql>
  30. <select id="selectFsUserAddressList" parameterType="FsUserAddress" resultMap="FsUserAddressResult">
  31. <include refid="selectFsUserAddressVo"/>
  32. <where>
  33. and is_del = 0
  34. <if test="userId != null "> and user_id = #{userId}</if>
  35. <if test="realName != null and realName != ''"> and real_name like concat('%', #{realName}, '%')</if>
  36. <if test="phone != null and phone != ''"> and phone = #{phone}</if>
  37. <if test="province != null and province != ''"> and province = #{province}</if>
  38. <if test="city != null and city != ''"> and city = #{city}</if>
  39. <if test="district != null and district != ''"> and district = #{district}</if>
  40. <if test="cityIds != null and cityIds != ''"> and city_ids = #{cityIds}</if>
  41. <if test="detail != null and detail != ''"> and detail = #{detail}</if>
  42. <if test="postCode != null and postCode != ''"> and post_code = #{postCode}</if>
  43. <if test="longitude != null and longitude != ''"> and longitude = #{longitude}</if>
  44. <if test="latitude != null and latitude != ''"> and latitude = #{latitude}</if>
  45. <if test="isDefault != null "> and is_default = #{isDefault}</if>
  46. <if test="isConfirm != null "> and is_confirm = #{isConfirm}</if>
  47. <if test="helpCompanyUserId != null "> and help_company_user_id = #{helpCompanyUserId}</if>
  48. </where>
  49. </select>
  50. <select id="selectFsUserAddressByAddressId" parameterType="Long" resultMap="FsUserAddressResult">
  51. <include refid="selectFsUserAddressVo"/>
  52. where address_id = #{addressId}
  53. </select>
  54. <insert id="insertFsUserAddress" parameterType="FsUserAddress" useGeneratedKeys="true" keyProperty="addressId">
  55. insert into fs_user_address
  56. <trim prefix="(" suffix=")" suffixOverrides=",">
  57. <if test="userId != null">user_id,</if>
  58. <if test="realName != null and realName != ''">real_name,</if>
  59. <if test="phone != null and phone != ''">phone,</if>
  60. <if test="province != null and province != ''">province,</if>
  61. <if test="city != null and city != ''">city,</if>
  62. <if test="district != null and district != ''">district,</if>
  63. <if test="township != null and township != ''">township,</if>
  64. <if test="cityIds != null">city_ids,</if>
  65. <if test="detail != null and detail != ''">detail,</if>
  66. <if test="postCode != null and postCode != ''">post_code,</if>
  67. <if test="longitude != null and longitude != ''">longitude,</if>
  68. <if test="latitude != null and latitude != ''">latitude,</if>
  69. <if test="isDefault != null">is_default,</if>
  70. <if test="isDel != null">is_del,</if>
  71. <if test="createTime != null">create_time,</if>
  72. <if test="updateTime != null">update_time,</if>
  73. <if test="isConfirm != null">is_confirm,</if>
  74. <if test="helpCompanyUserId != null">help_company_user_id,</if>
  75. </trim>
  76. <trim prefix="values (" suffix=")" suffixOverrides=",">
  77. <if test="userId != null">#{userId},</if>
  78. <if test="realName != null and realName != ''">#{realName},</if>
  79. <if test="phone != null and phone != ''">#{phone},</if>
  80. <if test="province != null and province != ''">#{province},</if>
  81. <if test="city != null and city != ''">#{city},</if>
  82. <if test="district != null and district != ''">#{district},</if>
  83. <if test="township != null and township != ''">#{township},</if>
  84. <if test="cityIds != null">#{cityIds},</if>
  85. <if test="detail != null and detail != ''">#{detail},</if>
  86. <if test="postCode != null and postCode != ''">#{postCode},</if>
  87. <if test="longitude != null and longitude != ''">#{longitude},</if>
  88. <if test="latitude != null and latitude != ''">#{latitude},</if>
  89. <if test="isDefault != null">#{isDefault},</if>
  90. <if test="isDel != null">#{isDel},</if>
  91. <if test="createTime != null">#{createTime},</if>
  92. <if test="updateTime != null">#{updateTime},</if>
  93. <if test="isConfirm != null">#{isConfirm},</if>
  94. <if test="helpCompanyUserId != null">#{helpCompanyUserId},</if>
  95. </trim>
  96. </insert>
  97. <update id="updateFsUserAddress" parameterType="FsUserAddress">
  98. update fs_user_address
  99. <trim prefix="SET" suffixOverrides=",">
  100. <if test="userId != null">user_id = #{userId},</if>
  101. <if test="realName != null and realName != ''">real_name = #{realName},</if>
  102. <if test="phone != null and phone != ''">phone = #{phone},</if>
  103. <if test="province != null and province != ''">province = #{province},</if>
  104. <if test="city != null and city != ''">city = #{city},</if>
  105. <if test="district != null and district != ''">district = #{district},</if>
  106. <if test="township != null and township != ''">township = #{township},</if>
  107. <if test="cityIds != null">city_ids = #{cityIds},</if>
  108. <if test="detail != null and detail != ''">detail = #{detail},</if>
  109. <if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
  110. <if test="longitude != null and longitude != ''">longitude = #{longitude},</if>
  111. <if test="latitude != null and latitude != ''">latitude = #{latitude},</if>
  112. <if test="isDefault != null">is_default = #{isDefault},</if>
  113. <if test="isDel != null">is_del = #{isDel},</if>
  114. <if test="createTime != null">create_time = #{createTime},</if>
  115. <if test="updateTime != null">update_time = #{updateTime},</if>
  116. <if test="isConfirm != null">is_confirm = #{isConfirm},</if>
  117. <if test="helpCompanyUserId != null">help_company_user_id = #{helpCompanyUserId},</if>
  118. </trim>
  119. where address_id = #{addressId}
  120. </update>
  121. <delete id="deleteFsUserAddressByAddressId" parameterType="Long">
  122. update fs_user_address set is_del=1 where address_id = #{addressId}
  123. </delete>
  124. <delete id="deleteFsUserAddressByAddressIds" parameterType="String">
  125. update fs_user_address set is_del=1 where address_id in
  126. <foreach item="addressId" collection="array" open="(" separator="," close=")">
  127. #{addressId}
  128. </foreach>
  129. </delete>
  130. </mapper>