customizedToothMapper.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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.iamberry.wechat.service.mapper.CustomizedToothMapper">
  4. <resultMap id="BaseResultMap" type="CustomizedTooth" >
  5. <result column="tooth_id" property="toothId" />
  6. <result column="user_open_id" property="userOpenId" />
  7. <result column="product_id" property="productId" />
  8. <result column="color_id" property="colorId" />
  9. <result column="tooth_color_id" property="toothColorId" />
  10. <result column="tooth_pattern_id" property="toothPatternId" />
  11. <result column="tooth_position_id" property="toothPositionId" />
  12. <result column="tooth_text" property="toothText" />
  13. <result column="tooth_avatar_img" property="toothAvatarImg" />
  14. <result column="tooth_img" property="toothImg" />
  15. <result column="tooth_code_img" property="toothCodeImg" />
  16. <result column="tooth_type" property="toothType" />
  17. <result column="tooth_status" property="toothStatus" />
  18. <result column="tooth_create_time" property="toothCreateTime" />
  19. </resultMap>
  20. <sql id="Base_List" >
  21. t.tooth_id,
  22. t.user_open_id,
  23. t.product_id,
  24. t.color_id,
  25. t.tooth_color_id,
  26. t.tooth_pattern_id,
  27. t.tooth_position_id,
  28. t.tooth_text,
  29. t.tooth_avatar_img,
  30. t.tooth_img,
  31. t.tooth_code_img,
  32. t.tooth_type,
  33. t.tooth_status,
  34. t.tooth_create_time
  35. </sql>
  36. <select id="getCustomizedToothList" resultMap="BaseResultMap" parameterType="CustomizedTooth" >
  37. select
  38. <include refid="Base_List" />
  39. from tb_iamberry_customized_tooth t
  40. <where>
  41. <if test="toothId != null ">
  42. AND t.tooth_id = #{toothId}
  43. </if >
  44. <if test="userOpenId != null and userOpenId != ''">
  45. AND t.user_open_id like CONCAT ('%',#{userOpenId},'%')
  46. </if >
  47. <if test="productId != null ">
  48. AND t.product_id = #{productId}
  49. </if >
  50. <if test="colorId != null ">
  51. AND t.color_id = #{colorId}
  52. </if >
  53. <if test="toothColorId != null ">
  54. AND t.tooth_color_id = #{toothColorId}
  55. </if >
  56. <if test="toothPatternId != null ">
  57. AND t.tooth_pattern_id = #{toothPatternId}
  58. </if >
  59. <if test="toothPositionId != null ">
  60. AND t.tooth_position_id = #{toothPositionId}
  61. </if >
  62. <if test="toothText != null and toothText != ''">
  63. AND t.tooth_text like CONCAT ('%',#{toothText},'%')
  64. </if >
  65. <if test="toothAvatarImg != null and toothAvatarImg != ''">
  66. AND t.tooth_avatar_img like CONCAT ('%',#{toothAvatarImg},'%')
  67. </if >
  68. <if test="toothImg != null and toothImg != ''">
  69. AND t.tooth_img like CONCAT ('%',#{toothImg},'%')
  70. </if >
  71. <if test="toothType != null ">
  72. AND t.tooth_type = #{toothType}
  73. </if >
  74. <if test="toothStatus != null ">
  75. AND t.tooth_status = #{toothStatus}
  76. </if >
  77. </where>
  78. </select>
  79. <select id="getCustomizedToothById" resultMap="BaseResultMap" parameterType="Integer" >
  80. select
  81. <include refid="Base_List" />
  82. from tb_iamberry_customized_tooth t
  83. where t.tooth_id= #{toothId}
  84. </select>
  85. <insert id="save" keyProperty="toothId" useGeneratedKeys="true" parameterType="CustomizedTooth" >
  86. insert into
  87. tb_iamberry_customized_tooth
  88. (
  89. tooth_id,
  90. user_open_id,
  91. product_id,
  92. color_id,
  93. tooth_color_id,
  94. tooth_pattern_id,
  95. tooth_position_id,
  96. tooth_text,
  97. tooth_avatar_img,
  98. tooth_img,
  99. tooth_code_img,
  100. tooth_type,
  101. tooth_status
  102. )
  103. values
  104. (
  105. #{toothId},
  106. #{userOpenId},
  107. #{productId},
  108. #{colorId},
  109. #{toothColorId},
  110. #{toothPatternId},
  111. #{toothPositionId},
  112. #{toothText},
  113. #{toothAvatarImg},
  114. #{toothImg},
  115. #{toothCodeImg},
  116. #{toothType},
  117. #{toothStatus}
  118. )
  119. </insert>
  120. <update id="update" parameterType="CustomizedTooth" >
  121. update
  122. tb_iamberry_customized_tooth
  123. <set >
  124. <if test="toothId != null ">
  125. tooth_id = #{toothId},
  126. </if >
  127. <if test="userOpenId != null and userOpenId != ''">
  128. user_open_id = #{userOpenId},
  129. </if >
  130. <if test="productId != null ">
  131. product_id = #{productId},
  132. </if >
  133. <if test="colorId != null ">
  134. color_id = #{colorId},
  135. </if >
  136. <if test="toothColorId != null ">
  137. tooth_color_id = #{toothColorId},
  138. </if >
  139. <if test="toothPatternId != null ">
  140. tooth_pattern_id = #{toothPatternId},
  141. </if >
  142. <if test="toothPositionId != null ">
  143. tooth_position_id = #{toothPositionId},
  144. </if >
  145. <if test="toothText != null and toothText != ''">
  146. tooth_text = #{toothText},
  147. </if >
  148. <if test="toothAvatarImg != null and toothAvatarImg != ''">
  149. tooth_avatar_img = #{toothAvatarImg},
  150. </if >
  151. <if test="toothImg != null and toothImg != ''">
  152. tooth_img = #{toothImg},
  153. </if >
  154. <if test="toothType != null ">
  155. tooth_type = #{toothType},
  156. </if >
  157. <if test="toothStatus != null ">
  158. tooth_status = #{toothStatus},
  159. </if >
  160. </set >
  161. where tooth_id= #{toothId}
  162. </update>
  163. </mapper>