CmSecondHandDetailMapper.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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.caimei.modules.product.dao.CmSecondHandDetailDao">
  4. <sql id="cmSecondHandDetailColumns">
  5. a.id AS "id",
  6. a.productID AS "productID",
  7. a.sold AS "sold",
  8. a.secondHandType AS "secondHandType",
  9. a.instrumentType AS "instrumentType",
  10. a.fixedYears AS "fixedYears",
  11. a.maturityYears AS "maturityYears",
  12. a.companyName AS "companyName",
  13. a.detailTalkFlag AS "detailTalkFlag",
  14. a.originalPrice AS "originalPrice",
  15. a.contactName AS "contactName",
  16. a.contactMobile AS "contactMobile",
  17. a.dockingPeopleName AS "dockingPeopleName",
  18. a.dockingPeopleMobile AS "dockingPeopleMobile",
  19. a.secondProductType AS "secondProductType",
  20. a.provinceCityDistrict AS "provinceCityDistrict",
  21. a.townId as "townId",
  22. a.address AS "address",
  23. a.productQuality AS "productQuality",
  24. a.productDetails AS "productDetails",
  25. a.viewingNum AS "viewingNum",
  26. a.brandName AS "brandName",
  27. a.payAmount AS "payAmount",
  28. a.payFormData AS "payFormData",
  29. a.payType AS "payType",
  30. a.payDate AS "payDate",
  31. a.submitDate AS "submitDate",
  32. a.reviewedDate AS "reviewedDate",
  33. a.onLineDate AS "onLineDate",
  34. a.source AS "source",
  35. a.showContactFlag AS "showContactFlag",
  36. a.publisher AS "publisher",
  37. a.authenticationImage AS "authenticationImage",
  38. a.fileName AS "fileName",
  39. a.ossName AS "ossName",
  40. a.commitmentImage AS "commitmentImage",
  41. p.validFlag AS "validFlag",
  42. p.productCategory AS "productCategory",
  43. p.name AS "name",
  44. p.normalPrice AS "normalPrice",
  45. p.price AS "price",
  46. p.stock AS "stock",
  47. p.brandID AS "brandID",
  48. p.costPrice as "costPrice",
  49. p.costCheckFlag AS "costCheckFlag",
  50. p.costProportional AS "costProportional",
  51. p.visibility AS "visibility",
  52. p.splitCode AS "splitCode"
  53. </sql>
  54. <sql id="cmSecondHandDetailJoins">
  55. left join product p on p.productID = a.productID
  56. </sql>
  57. <select id="get" resultType="CmSecondHandDetail">
  58. SELECT
  59. <include refid="cmSecondHandDetailColumns"/>
  60. FROM cm_second_hand_detail a
  61. <include refid="cmSecondHandDetailJoins"/>
  62. WHERE a.productID = #{id}
  63. </select>
  64. <select id="findList" resultType="CmSecondHandDetail">
  65. SELECT
  66. <include refid="cmSecondHandDetailColumns"/>
  67. FROM cm_second_hand_detail a
  68. <include refid="cmSecondHandDetailJoins"/>
  69. <where>
  70. <if test="productID != null and productID != ''">
  71. AND a.productID = #{productID}
  72. </if>
  73. </where>
  74. <choose>
  75. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  76. ORDER BY ${page.orderBy}
  77. </when>
  78. <otherwise>
  79. </otherwise>
  80. </choose>
  81. </select>
  82. <select id="findAllList" resultType="CmSecondHandDetail">
  83. SELECT
  84. <include refid="cmSecondHandDetailColumns"/>
  85. FROM cm_second_hand_detail a
  86. <include refid="cmSecondHandDetailJoins"/>
  87. <where>
  88. </where>
  89. <choose>
  90. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  91. ORDER BY ${page.orderBy}
  92. </when>
  93. <otherwise>
  94. </otherwise>
  95. </choose>
  96. </select>
  97. <select id="findValue" resultType="com.caimei.modules.product.entity.CmSecondHandDetail">
  98. select
  99. cshd.publishIdentity,
  100. cshd.authenticationBackImage,
  101. cshd.licenseImage,
  102. s.cardNumber
  103. from cm_second_hand_detail cshd
  104. left join product p on cshd.productId = p.productId
  105. left join shop s on s.shopID = p.shopID
  106. where p.productID = #{productID}
  107. </select>
  108. <select id="findFlieTypes" resultType="java.lang.Integer">
  109. select fileType
  110. from cm_second_file_type
  111. where productId = #{productID}
  112. </select>
  113. <select id="findShopId" resultType="java.lang.Integer">
  114. select shopId from shop
  115. where shopType = 3
  116. AND cardNumber = #{cardNumber}
  117. </select>
  118. <insert id="insert" parameterType="CmSecondHandDetail" keyProperty="id" useGeneratedKeys="true">
  119. INSERT INTO cm_second_hand_detail(
  120. publishIdentity,
  121. authenticationBackImage,
  122. licenseImage,
  123. productID,
  124. sold,
  125. secondHandType,
  126. instrumentType,
  127. fixedYears,
  128. maturityYears,
  129. companyName,
  130. detailTalkFlag,
  131. originalPrice,
  132. contactName,
  133. contactMobile,
  134. dockingPeopleName,
  135. dockingPeopleMobile,
  136. secondProductType,
  137. provinceCityDistrict,
  138. townId,
  139. address,
  140. productQuality,
  141. productDetails,
  142. viewingNum,
  143. brandName,
  144. payAmount,
  145. payFormData,
  146. payType,
  147. payDate,
  148. submitDate,
  149. reviewedDate,
  150. onLineDate,
  151. source,
  152. showContactFlag,
  153. publisher,
  154. authenticationImage,
  155. fileName,
  156. ossName,
  157. commitmentImage
  158. ) VALUES (
  159. #{publishIdentity},
  160. #{authenticationBackImage},
  161. #{licenseImage},
  162. #{productID},
  163. #{sold},
  164. #{secondHandType},
  165. #{instrumentType},
  166. #{fixedYears},
  167. #{maturityYears},
  168. #{companyName},
  169. #{detailTalkFlag},
  170. #{originalPrice},
  171. #{contactName},
  172. #{contactMobile},
  173. #{dockingPeopleName},
  174. #{dockingPeopleMobile},
  175. #{secondProductType},
  176. #{provinceCityDistrict},
  177. #{townId},
  178. #{address},
  179. #{productQuality},
  180. #{productDetails},
  181. #{viewingNum},
  182. #{brandName},
  183. #{payAmount},
  184. #{payFormData},
  185. #{payType},
  186. #{payDate},
  187. #{submitDate},
  188. #{reviewedDate},
  189. #{onLineDate},
  190. #{source},
  191. #{showContactFlag},
  192. #{publisher},
  193. #{authenticationImage},
  194. #{fileName},
  195. #{ossName},
  196. #{commitmentImage}
  197. )
  198. </insert>
  199. <insert id="insertFileType">
  200. insert into cm_second_file_type
  201. (secondid, productid, filetype)
  202. values(#{secondId},#{productId},#{fileType})
  203. </insert>
  204. <insert id="insertShop" keyColumn="shopID" keyProperty="shopID" useGeneratedKeys="true">
  205. insert into shop (name,linkMan,contractMobile,cardNumber,addTime,status,shopType)
  206. values (#{name},#{linkMan},#{contractMobile},#{cardNumber},now(),90,3)
  207. </insert>
  208. <update id="update">
  209. UPDATE cm_second_hand_detail SET
  210. productID = #{productID},
  211. sold = #{sold},
  212. secondHandType = #{secondHandType},
  213. instrumentType = #{instrumentType},
  214. fixedYears = #{fixedYears},
  215. maturityYears = #{maturityYears},
  216. companyName = #{companyName},
  217. detailTalkFlag = #{detailTalkFlag},
  218. originalPrice = #{originalPrice},
  219. contactName = #{contactName},
  220. contactMobile = #{contactMobile},
  221. dockingPeopleName = #{dockingPeopleName},
  222. dockingPeopleMobile = #{dockingPeopleMobile},
  223. secondProductType = #{secondProductType},
  224. provinceCityDistrict = #{provinceCityDistrict},
  225. townId = #{townId},
  226. address = #{address},
  227. productQuality = #{productQuality},
  228. productDetails = #{productDetails},
  229. viewingNum = #{viewingNum},
  230. brandName = #{brandName},
  231. payAmount = #{payAmount},
  232. payFormData = #{payFormData},
  233. payType = #{payType},
  234. payDate = #{payDate},
  235. submitDate = #{submitDate},
  236. reviewedDate = #{reviewedDate},
  237. onLineDate = #{onLineDate},
  238. source = #{source},
  239. showContactFlag = #{showContactFlag},
  240. publisher = #{publisher},
  241. authenticationImage = #{authenticationImage},
  242. fileName = #{fileName},
  243. ossName = #{ossName},
  244. commitmentImage = #{commitmentImage}
  245. WHERE productID = #{productID}
  246. </update>
  247. <update id="updateRevieweInfo">
  248. UPDATE cm_second_hand_detail SET
  249. reviewedDate = #{reviewedDate},
  250. onLineDate = #{onLineDate}
  251. WHERE productID = #{productID}
  252. </update>
  253. <update id="updateOnLineDate">
  254. UPDATE cm_second_hand_detail SET
  255. onLineDate = #{date}
  256. WHERE productID = #{productID}
  257. </update>
  258. <update id="updatSecondHnadproductSold">
  259. UPDATE cm_second_hand_detail SET sold = 1 where productID = #{productID}
  260. </update>
  261. <delete id="delete">
  262. DELETE FROM cm_second_hand_detail
  263. WHERE productID = #{productID}
  264. </delete>
  265. <delete id="deleteFileType">
  266. delete from cm_second_file_type
  267. where productId = #{productId}
  268. </delete>
  269. <update id="updatSecondHnadBySold">
  270. UPDATE cm_second_hand_detail SET sold = 0 WHERE productID = #{productID}
  271. </update>
  272. </mapper>