UserAddressServiceDaoImplMapper.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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="userAddressServiceDaoImpl">
  6. <!-- 保存用户联系地址信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveUserAddressInfo" parameterType="Map">
  8. insert into u_user_address(
  9. area_code,is_default,address,tel,user_id,address_id,username
  10. ) values (
  11. #{areaCode},#{isDefault},#{address},#{tel},#{userId},#{addressId},#{username}
  12. )
  13. </insert>
  14. <!-- 查询用户联系地址信息 add by wuxw 2018-07-03 -->
  15. <select id="getUserAddressInfo" parameterType="Map" resultType="Map">
  16. select t.area_code,t.area_code areaCode,t.is_default,t.is_default
  17. isDefault,t.address,t.tel,t.status_cd,t.status_cd statusCd,t.user_id,t.user_id userId,t.address_id,t.address_id
  18. addressId,t.username
  19. from u_user_address t
  20. where 1 =1
  21. <if test="areaCode !=null and areaCode != ''">
  22. and t.area_code= #{areaCode}
  23. </if>
  24. <if test="isDefault !=null and isDefault != ''">
  25. and t.is_default= #{isDefault}
  26. </if>
  27. <if test="address !=null and address != ''">
  28. and t.address= #{address}
  29. </if>
  30. <if test="tel !=null and tel != ''">
  31. and t.tel= #{tel}
  32. </if>
  33. <if test="statusCd !=null and statusCd != ''">
  34. and t.status_cd= #{statusCd}
  35. </if>
  36. <if test="userId !=null and userId != ''">
  37. and t.user_id= #{userId}
  38. </if>
  39. <if test="addressId !=null and addressId != ''">
  40. and t.address_id= #{addressId}
  41. </if>
  42. <if test="username !=null and username != ''">
  43. and t.username= #{username}
  44. </if>
  45. order by t.create_time desc
  46. <if test="page != -1 and page != null ">
  47. limit #{page}, #{row}
  48. </if>
  49. </select>
  50. <!-- 修改用户联系地址信息 add by wuxw 2018-07-03 -->
  51. <update id="updateUserAddressInfo" parameterType="Map">
  52. update u_user_address t set t.status_cd = #{statusCd}
  53. <if test="newBId != null and newBId != ''">
  54. ,t.b_id = #{newBId}
  55. </if>
  56. <if test="areaCode !=null and areaCode != ''">
  57. , t.area_code= #{areaCode}
  58. </if>
  59. <if test="isDefault !=null and isDefault != ''">
  60. , t.is_default= #{isDefault}
  61. </if>
  62. <if test="address !=null and address != ''">
  63. , t.address= #{address}
  64. </if>
  65. <if test="tel !=null and tel != ''">
  66. , t.tel= #{tel}
  67. </if>
  68. <if test="username !=null and username != ''">
  69. , t.username= #{username}
  70. </if>
  71. where 1=1
  72. <if test="addressId !=null and addressId != ''">
  73. and t.address_id= #{addressId}
  74. </if>
  75. <if test="userId !=null and userId != ''">
  76. and t.user_id= #{userId}
  77. </if>
  78. </update>
  79. <!-- 查询用户联系地址数量 add by wuxw 2018-07-03 -->
  80. <select id="queryUserAddresssCount" parameterType="Map" resultType="Map">
  81. select count(1) count
  82. from u_user_address t
  83. where 1 =1
  84. <if test="areaCode !=null and areaCode != ''">
  85. and t.area_code= #{areaCode}
  86. </if>
  87. <if test="isDefault !=null and isDefault != ''">
  88. and t.is_default= #{isDefault}
  89. </if>
  90. <if test="address !=null and address != ''">
  91. and t.address= #{address}
  92. </if>
  93. <if test="tel !=null and tel != ''">
  94. and t.tel= #{tel}
  95. </if>
  96. <if test="statusCd !=null and statusCd != ''">
  97. and t.status_cd= #{statusCd}
  98. </if>
  99. <if test="userId !=null and userId != ''">
  100. and t.user_id= #{userId}
  101. </if>
  102. <if test="username !=null and username != ''">
  103. and t.username= #{username}
  104. </if>
  105. <if test="addressId !=null and addressId != ''">
  106. and t.address_id= #{addressId}
  107. </if>
  108. </select>
  109. </mapper>