VendorMapper.xml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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.xingxi.web.controller.master.product.mapper.VendorMapper">
  6. <resultMap type="Vendor" id="VendorResult">
  7. <result property="vendorId" column="vendorId" />
  8. <result property="vendorName" column="vendorName" />
  9. <result property="contact" column="contact" />
  10. <result property="mobile" column="mobile" />
  11. <result property="mail" column="mail" />
  12. <result property="address" column="address" />
  13. <result property="refundContact" column="refundContact" />
  14. <result property="refundMobile" column="refundMobile" />
  15. <result property="refundAddress" column="refundAddress" />
  16. <result property="delFlag" column="delFlag" />
  17. <result property="createUser" column="createUser" />
  18. <result property="createTime" column="createTime" />
  19. <result property="updateUser" column="updateUser" />
  20. <result property="updateTime" column="updateTime" />
  21. </resultMap>
  22. <sql id="selectVendor">
  23. select vendorId, vendorName, contact, mobile, mail, address, refundContact, refundMobile, refundAddress, delFlag, createUser, createTime, updateUser, updateTime from m_vendor
  24. </sql>
  25. <sql id="selectVendorExt">
  26. select
  27. ${tableAlias}.vendorId,
  28. ${tableAlias}.vendorName,
  29. ${tableAlias}.contact,
  30. ${tableAlias}.mobile,
  31. ${tableAlias}.mail,
  32. ${tableAlias}.address,
  33. ${tableAlias}.refundContact,
  34. ${tableAlias}.refundMobile,
  35. ${tableAlias}.refundAddress,
  36. ${tableAlias}.delFlag,
  37. ${tableAlias}.createUser,
  38. ${tableAlias}.createTime,
  39. ${tableAlias}.updateUser,
  40. ${tableAlias}.updateTime
  41. from m_vendor ${tableAlias}
  42. </sql>
  43. <select id="selectVendorList" parameterType="Vendor" resultMap="VendorResult">
  44. <include refid="selectVendor"/>
  45. <where>
  46. <if test="vendorName != null and vendorName != ''"> and vendorName like concat('%', #{vendorName}, '%')</if>
  47. <if test="contact != null and contact != ''"> and contact = #{contact}</if>
  48. <if test="mobile != null and mobile != ''"> and mobile = #{mobile}</if>
  49. <if test="mail != null and mail != ''"> and mail = #{mail}</if>
  50. <if test="address != null and address != ''"> and address = #{address}</if>
  51. <if test="refundContact != null and refundContact != ''"> and refundContact = #{refundContact}</if>
  52. <if test="refundMobile != null and refundMobile != ''"> and refundMobile = #{refundMobile}</if>
  53. <if test="refundAddress != null and refundAddress != ''"> and refundAddress = #{refundAddress}</if>
  54. <if test="delFlag != null and delFlag != ''"> and delFlag = #{delFlag}</if>
  55. <if test="createUser != null and createUser != ''"> and createUser = #{createUser}</if>
  56. <if test="createTime != null "> and createTime = #{createTime}</if>
  57. <if test="updateUser != null and updateUser != ''"> and updateUser = #{updateUser}</if>
  58. <if test="updateTime != null "> and updateTime = #{updateTime}</if>
  59. </where>
  60. </select>
  61. <select id="selectVendorByVendorId" parameterType="Long" resultMap="VendorResult">
  62. <include refid="selectVendor"/>
  63. where vendorId = #{vendorId}
  64. </select>
  65. <insert id="insertVendor" parameterType="Vendor" useGeneratedKeys="true" keyProperty="vendorId">
  66. insert into m_vendor
  67. <trim prefix="(" suffix=")" suffixOverrides=",">
  68. <if test="vendorName != null">vendorName,</if>
  69. <if test="contact != null">contact,</if>
  70. <if test="mobile != null">mobile,</if>
  71. <if test="mail != null">mail,</if>
  72. <if test="address != null">address,</if>
  73. <if test="refundContact != null">refundContact,</if>
  74. <if test="refundMobile != null">refundMobile,</if>
  75. <if test="refundAddress != null">refundAddress,</if>
  76. <if test="delFlag != null">delFlag,</if>
  77. <if test="createUser != null">createUser,</if>
  78. <if test="createTime != null">createTime,</if>
  79. <if test="updateUser != null">updateUser,</if>
  80. <if test="updateTime != null">updateTime,</if>
  81. </trim>
  82. <trim prefix="values (" suffix=")" suffixOverrides=",">
  83. <if test="vendorName != null">#{vendorName},</if>
  84. <if test="contact != null">#{contact},</if>
  85. <if test="mobile != null">#{mobile},</if>
  86. <if test="mail != null">#{mail},</if>
  87. <if test="address != null">#{address},</if>
  88. <if test="refundContact != null">#{refundContact},</if>
  89. <if test="refundMobile != null">#{refundMobile},</if>
  90. <if test="refundAddress != null">#{refundAddress},</if>
  91. <if test="delFlag != null">#{delFlag},</if>
  92. <if test="createUser != null">#{createUser},</if>
  93. <if test="createTime != null">#{createTime},</if>
  94. <if test="updateUser != null">#{updateUser},</if>
  95. <if test="updateTime != null">#{updateTime},</if>
  96. </trim>
  97. </insert>
  98. <insert id="batchInsertVendor">
  99. insert into m_vendor( vendorName, contact, mobile, mail, address, refundContact, refundMobile, refundAddress, delFlag, createUser, createTime, updateUser, updateTime) values
  100. <foreach item="item" index="index" collection="list" separator=",">
  101. ( #{item.vendorName}, #{item.contact}, #{item.mobile}, #{item.mail}, #{item.address}, #{item.refundContact}, #{item.refundMobile}, #{item.refundAddress}, #{item.delFlag}, #{item.createUser}, #{item.createTime}, #{item.updateUser}, #{item.updateTime})
  102. </foreach>
  103. </insert>
  104. <update id="updateVendor" parameterType="Vendor">
  105. update m_vendor
  106. <trim prefix="SET" suffixOverrides=",">
  107. <if test="vendorName != null">vendorName = #{vendorName},</if>
  108. <if test="contact != null">contact = #{contact},</if>
  109. <if test="mobile != null">mobile = #{mobile},</if>
  110. <if test="mail != null">mail = #{mail},</if>
  111. <if test="address != null">address = #{address},</if>
  112. <if test="refundContact != null">refundContact = #{refundContact},</if>
  113. <if test="refundMobile != null">refundMobile = #{refundMobile},</if>
  114. <if test="refundAddress != null">refundAddress = #{refundAddress},</if>
  115. <if test="delFlag != null">delFlag = #{delFlag},</if>
  116. <if test="createUser != null">createUser = #{createUser},</if>
  117. <if test="createTime != null">createTime = #{createTime},</if>
  118. <if test="updateUser != null">updateUser = #{updateUser},</if>
  119. <if test="updateTime != null">updateTime = #{updateTime},</if>
  120. </trim>
  121. where vendorId = #{vendorId}
  122. </update>
  123. <delete id="deleteVendorByVendorId" parameterType="Long">
  124. delete from m_vendor where vendorId = #{vendorId}
  125. </delete>
  126. <delete id="deleteVendorByVendorIds" parameterType="String">
  127. delete from m_vendor where vendorId in
  128. <foreach item="vendorId" collection="array" open="(" separator="," close=")">
  129. #{vendorId}
  130. </foreach>
  131. </delete>
  132. <update id="logicDeleteVendorByVendorId" parameterType="Long">
  133. update m_vendor
  134. set delFlag = '2'
  135. where vendorId = #{vendorId}
  136. </update>
  137. <update id="logicDeleteVendorByVendorIds" parameterType="String">
  138. update m_vendor
  139. set delFlag = '2'
  140. where vendorId in
  141. <foreach item="vendorId" collection="array" open="(" separator="," close=")">
  142. #{vendorId}
  143. </foreach>
  144. </update>
  145. <update id="logicDeleteVendorByCondition" parameterType="Vendor">
  146. update m_vendor
  147. set delFlag = '2'
  148. <where>
  149. <if test="vendorName != null and vendorName != ''"> and vendorName like concat('%', #{vendorName}, '%')</if>
  150. <if test="contact != null and contact != ''"> and contact = #{contact}</if>
  151. <if test="mobile != null and mobile != ''"> and mobile = #{mobile}</if>
  152. <if test="mail != null and mail != ''"> and mail = #{mail}</if>
  153. <if test="address != null and address != ''"> and address = #{address}</if>
  154. <if test="refundContact != null and refundContact != ''"> and refundContact = #{refundContact}</if>
  155. <if test="refundMobile != null and refundMobile != ''"> and refundMobile = #{refundMobile}</if>
  156. <if test="refundAddress != null and refundAddress != ''"> and refundAddress = #{refundAddress}</if>
  157. <if test="delFlag != null and delFlag != ''"> and delFlag = #{delFlag}</if>
  158. <if test="createUser != null and createUser != ''"> and createUser = #{createUser}</if>
  159. <if test="createTime != null "> and createTime = #{createTime}</if>
  160. <if test="updateUser != null and updateUser != ''"> and updateUser = #{updateUser}</if>
  161. <if test="updateTime != null "> and updateTime = #{updateTime}</if>
  162. </where>
  163. </update>
  164. </mapper>