InfoAddressMapper.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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.ruoyi.system.mapper.InfoAddressMapper">
  6. <resultMap type="InfoAddress" id="InfoAddressResult">
  7. <result property="id" column="id" />
  8. <result property="userId" column="user_id" />
  9. <result property="name" column="name" />
  10. <result property="phone" column="phone" />
  11. <result property="address" column="address" />
  12. <result property="addressDetail" column="address_detail" />
  13. <result property="longitude" column="longitude" />
  14. <result property="latitude" column="latitude" />
  15. <result property="country" column="country" />
  16. <result property="province" column="province" />
  17. <result property="city" column="city" />
  18. <result property="area" column="area" />
  19. <result property="annexes" column="annexes" />
  20. <result property="isTop" column="is_top" />
  21. <result property="topTime" column="top_time" />
  22. </resultMap>
  23. <sql id="selectInfoAddressVo">
  24. select id, user_id, name, phone, address, address_detail, longitude, latitude, country, province, city, area, annexes, is_top, top_time from info_address
  25. </sql>
  26. <select id="selectInfoAddressList" parameterType="InfoAddress" resultMap="InfoAddressResult">
  27. <include refid="selectInfoAddressVo"/>
  28. <where>
  29. <if test="userId != null "> and user_id = #{userId}</if>
  30. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  31. <if test="phone != null and phone != ''"> and phone = #{phone}</if>
  32. <if test="country != null and country != ''"> and country = #{country}</if>
  33. <if test="province != null and province != ''"> and province = #{province}</if>
  34. <if test="city != null and city != ''"> and city = #{city}</if>
  35. <if test="area != null and area != ''"> and area = #{area}</if>
  36. </where>
  37. order by id desc
  38. </select>
  39. <select id="selectInfoAddressById" parameterType="Long" resultMap="InfoAddressResult">
  40. <include refid="selectInfoAddressVo"/>
  41. where id = #{id}
  42. </select>
  43. <insert id="insertInfoAddress" parameterType="InfoAddress" useGeneratedKeys="true" keyProperty="id">
  44. insert into info_address
  45. <trim prefix="(" suffix=")" suffixOverrides=",">
  46. <if test="userId != null">user_id,</if>
  47. <if test="name != null and name != ''">name,</if>
  48. <if test="phone != null and phone != ''">phone,</if>
  49. <if test="address != null and address != ''">address,</if>
  50. <if test="addressDetail != null and addressDetail != ''">address_detail,</if>
  51. <if test="longitude != null">longitude,</if>
  52. <if test="latitude != null">latitude,</if>
  53. <if test="country != null">country,</if>
  54. <if test="province != null">province,</if>
  55. <if test="city != null">city,</if>
  56. <if test="area != null">area,</if>
  57. <if test="annexes != null">annexes,</if>
  58. <if test="isTop != null">is_top,</if>
  59. <if test="topTime != null">top_time,</if>
  60. </trim>
  61. <trim prefix="values (" suffix=")" suffixOverrides=",">
  62. <if test="userId != null">#{userId},</if>
  63. <if test="name != null and name != ''">#{name},</if>
  64. <if test="phone != null and phone != ''">#{phone},</if>
  65. <if test="address != null and address != ''">#{address},</if>
  66. <if test="addressDetail != null and addressDetail != ''">#{addressDetail},</if>
  67. <if test="longitude != null">#{longitude},</if>
  68. <if test="latitude != null">#{latitude},</if>
  69. <if test="country != null">#{country},</if>
  70. <if test="province != null">#{province},</if>
  71. <if test="city != null">#{city},</if>
  72. <if test="area != null">#{area},</if>
  73. <if test="annexes != null">#{annexes},</if>
  74. <if test="isTop != null">#{isTop},</if>
  75. <if test="topTime != null">#{topTime},</if>
  76. </trim>
  77. </insert>
  78. <update id="updateInfoAddress" parameterType="InfoAddress">
  79. update info_address
  80. <trim prefix="SET" suffixOverrides=",">
  81. <if test="userId != null">user_id = #{userId},</if>
  82. <if test="name != null and name != ''">name = #{name},</if>
  83. <if test="phone != null and phone != ''">phone = #{phone},</if>
  84. <if test="address != null and address != ''">address = #{address},</if>
  85. <if test="addressDetail != null and addressDetail != ''">address_detail = #{addressDetail},</if>
  86. <if test="longitude != null">longitude = #{longitude},</if>
  87. <if test="latitude != null">latitude = #{latitude},</if>
  88. <if test="country != null">country = #{country},</if>
  89. <if test="province != null">province = #{province},</if>
  90. <if test="city != null">city = #{city},</if>
  91. <if test="area != null">area = #{area},</if>
  92. <if test="annexes != null">annexes = #{annexes},</if>
  93. <if test="isTop != null">is_top = #{isTop},</if>
  94. <if test="topTime != null">top_time = #{topTime},</if>
  95. </trim>
  96. where id = #{id}
  97. </update>
  98. <delete id="deleteInfoAddressById" parameterType="Long">
  99. delete from info_address where id = #{id}
  100. </delete>
  101. <delete id="deleteInfoAddressByIds" parameterType="String">
  102. delete from info_address where id in
  103. <foreach item="id" collection="array" open="(" separator="," close=")">
  104. #{id}
  105. </foreach>
  106. </delete>
  107. </mapper>