BomMapper.xml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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.usoftchina.saas.document.mapper.BomMapper" >
  4. <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Bom" >
  5. <id column="bo_id" property="id" jdbcType="INTEGER" />
  6. <result column="bo_motherid" property="bo_motherid" jdbcType="INTEGER" />
  7. <result column="bo_mothercode" property="bo_mothercode" jdbcType="VARCHAR" />
  8. <result column="bo_mothername" property="bo_mothername" jdbcType="VARCHAR" />
  9. <result column="bo_version" property="bo_version" jdbcType="VARCHAR" />
  10. <result column="bo_status" property="bo_status" jdbcType="VARCHAR" />
  11. <result column="bo_statuscode" property="bo_statuscode" jdbcType="VARCHAR" />
  12. <result column="bo_recorderid" property="bo_recorderid" jdbcType="INTEGER" />
  13. <result column="bo_recorder" property="bo_recorder" jdbcType="VARCHAR" />
  14. <result column="bo_recorddate" property="bo_recorddate" jdbcType="TIMESTAMP" />
  15. <result column="companyId" property="companyId" jdbcType="INTEGER" />
  16. <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
  17. <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
  18. <result column="bo_text1" property="bo_text1" jdbcType="VARCHAR" />
  19. <result column="bo_text2" property="bo_text2" jdbcType="VARCHAR" />
  20. <result column="bo_text3" property="bo_text3" jdbcType="VARCHAR" />
  21. <result column="bo_text4" property="bo_text4" jdbcType="VARCHAR" />
  22. <result column="bo_text5" property="bo_text5" jdbcType="VARCHAR" />
  23. </resultMap>
  24. <sql id="Base_Column_List" >
  25. bo_id, bo_motherid, bo_mothercode, bo_mothername, bo_version, bo_status, bo_statuscode,
  26. bo_recorderid, bo_recorder, bo_recorddate, companyId, updaterId, updateTime, bo_text1,
  27. bo_text2, bo_text3, bo_text4, bo_text5
  28. </sql>
  29. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
  30. select
  31. <include refid="Base_Column_List" />
  32. from bom
  33. where bo_id = #{id}
  34. </select>
  35. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
  36. delete from bom
  37. where bo_id = #{id}
  38. </delete>
  39. <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Bom" >
  40. insert into bom (bo_motherid, bo_mothercode,
  41. bo_mothername, bo_version, bo_status,
  42. bo_statuscode, bo_recorderid, bo_recorder,
  43. bo_recorddate, companyId, updaterId,
  44. updateTime, bo_text1, bo_text2,
  45. bo_text3, bo_text4, bo_text5
  46. )
  47. values (#{bo_motherid,jdbcType=INTEGER}, #{bo_mothercode,jdbcType=VARCHAR},
  48. #{bo_mothername,jdbcType=VARCHAR}, #{bo_version,jdbcType=VARCHAR}, #{bo_status,jdbcType=VARCHAR},
  49. #{bo_statuscode,jdbcType=VARCHAR}, #{bo_recorderid,jdbcType=INTEGER}, #{bo_recorder,jdbcType=VARCHAR},
  50. #{bo_recorddate,jdbcType=TIMESTAMP}, #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER},
  51. #{updateTime,jdbcType=TIMESTAMP}, #{bo_text1,jdbcType=VARCHAR}, #{bo_text2,jdbcType=VARCHAR},
  52. #{bo_text3,jdbcType=VARCHAR}, #{bo_text4,jdbcType=VARCHAR}, #{bo_text5,jdbcType=VARCHAR}
  53. )
  54. </insert>
  55. <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Bom" >
  56. insert into bom
  57. <trim prefix="(" suffix=")" suffixOverrides="," >
  58. <if test="bo_motherid != null" >
  59. bo_motherid,
  60. </if>
  61. <if test="bo_mothercode != null" >
  62. bo_mothercode,
  63. </if>
  64. <if test="bo_mothername != null" >
  65. bo_mothername,
  66. </if>
  67. <if test="bo_version != null" >
  68. bo_version,
  69. </if>
  70. <if test="bo_status != null" >
  71. bo_status,
  72. </if>
  73. <if test="bo_statuscode != null" >
  74. bo_statuscode,
  75. </if>
  76. <if test="bo_recorderid != null" >
  77. bo_recorderid,
  78. </if>
  79. <if test="bo_recorder != null" >
  80. bo_recorder,
  81. </if>
  82. <if test="bo_recorddate != null" >
  83. bo_recorddate,
  84. </if>
  85. <if test="companyId != null" >
  86. companyId,
  87. </if>
  88. <if test="updaterId != null" >
  89. updaterId,
  90. </if>
  91. <if test="updateTime != null" >
  92. updateTime,
  93. </if>
  94. <if test="bo_text1 != null" >
  95. bo_text1,
  96. </if>
  97. <if test="bo_text2 != null" >
  98. bo_text2,
  99. </if>
  100. <if test="bo_text3 != null" >
  101. bo_text3,
  102. </if>
  103. <if test="bo_text4 != null" >
  104. bo_text4,
  105. </if>
  106. <if test="bo_text5 != null" >
  107. bo_text5,
  108. </if>
  109. </trim>
  110. <trim prefix="values (" suffix=")" suffixOverrides="," >
  111. <if test="bo_motherid != null" >
  112. #{bo_motherid,jdbcType=INTEGER},
  113. </if>
  114. <if test="bo_mothercode != null" >
  115. #{bo_mothercode,jdbcType=VARCHAR},
  116. </if>
  117. <if test="bo_mothername != null" >
  118. #{bo_mothername,jdbcType=VARCHAR},
  119. </if>
  120. <if test="bo_version != null" >
  121. #{bo_version,jdbcType=VARCHAR},
  122. </if>
  123. <if test="bo_status != null" >
  124. #{bo_status,jdbcType=VARCHAR},
  125. </if>
  126. <if test="bo_statuscode != null" >
  127. #{bo_statuscode,jdbcType=VARCHAR},
  128. </if>
  129. <if test="bo_recorderid != null" >
  130. #{bo_recorderid,jdbcType=INTEGER},
  131. </if>
  132. <if test="bo_recorder != null" >
  133. #{bo_recorder,jdbcType=VARCHAR},
  134. </if>
  135. <if test="bo_recorddate != null" >
  136. #{bo_recorddate,jdbcType=TIMESTAMP},
  137. </if>
  138. <if test="companyId != null" >
  139. #{companyId,jdbcType=INTEGER},
  140. </if>
  141. <if test="updaterId != null" >
  142. #{updaterId,jdbcType=INTEGER},
  143. </if>
  144. <if test="updateTime != null" >
  145. #{updateTime,jdbcType=TIMESTAMP},
  146. </if>
  147. <if test="bo_text1 != null" >
  148. #{bo_text1,jdbcType=VARCHAR},
  149. </if>
  150. <if test="bo_text2 != null" >
  151. #{bo_text2,jdbcType=VARCHAR},
  152. </if>
  153. <if test="bo_text3 != null" >
  154. #{bo_text3,jdbcType=VARCHAR},
  155. </if>
  156. <if test="bo_text4 != null" >
  157. #{bo_text4,jdbcType=VARCHAR},
  158. </if>
  159. <if test="bo_text5 != null" >
  160. #{bo_text5,jdbcType=VARCHAR},
  161. </if>
  162. </trim>
  163. </insert>
  164. <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Bom" >
  165. update bom
  166. <set >
  167. <if test="bo_motherid != null" >
  168. bo_motherid = #{bo_motherid,jdbcType=INTEGER},
  169. </if>
  170. <if test="bo_mothercode != null" >
  171. bo_mothercode = #{bo_mothercode,jdbcType=VARCHAR},
  172. </if>
  173. <if test="bo_mothername != null" >
  174. bo_mothername = #{bo_mothername,jdbcType=VARCHAR},
  175. </if>
  176. <if test="bo_version != null" >
  177. bo_version = #{bo_version,jdbcType=VARCHAR},
  178. </if>
  179. <if test="bo_status != null" >
  180. bo_status = #{bo_status,jdbcType=VARCHAR},
  181. </if>
  182. <if test="bo_statuscode != null" >
  183. bo_statuscode = #{bo_statuscode,jdbcType=VARCHAR},
  184. </if>
  185. <if test="bo_recorderid != null" >
  186. bo_recorderid = #{bo_recorderid,jdbcType=INTEGER},
  187. </if>
  188. <if test="bo_recorder != null" >
  189. bo_recorder = #{bo_recorder,jdbcType=VARCHAR},
  190. </if>
  191. <if test="bo_recorddate != null" >
  192. bo_recorddate = #{bo_recorddate,jdbcType=TIMESTAMP},
  193. </if>
  194. <if test="companyId != null" >
  195. companyId = #{companyId,jdbcType=INTEGER},
  196. </if>
  197. <if test="updaterId != null" >
  198. updaterId = #{updaterId,jdbcType=INTEGER},
  199. </if>
  200. <if test="updateTime != null" >
  201. updateTime = #{updateTime,jdbcType=TIMESTAMP},
  202. </if>
  203. <if test="bo_text1 != null" >
  204. bo_text1 = #{bo_text1,jdbcType=VARCHAR},
  205. </if>
  206. <if test="bo_text2 != null" >
  207. bo_text2 = #{bo_text2,jdbcType=VARCHAR},
  208. </if>
  209. <if test="bo_text3 != null" >
  210. bo_text3 = #{bo_text3,jdbcType=VARCHAR},
  211. </if>
  212. <if test="bo_text4 != null" >
  213. bo_text4 = #{bo_text4,jdbcType=VARCHAR},
  214. </if>
  215. <if test="bo_text5 != null" >
  216. bo_text5 = #{bo_text5,jdbcType=VARCHAR},
  217. </if>
  218. </set>
  219. where bo_id = #{id}
  220. </update>
  221. <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Bom" >
  222. update bom
  223. set bo_motherid = #{bo_motherid,jdbcType=INTEGER},
  224. bo_mothercode = #{bo_mothercode,jdbcType=VARCHAR},
  225. bo_mothername = #{bo_mothername,jdbcType=VARCHAR},
  226. bo_version = #{bo_version,jdbcType=VARCHAR},
  227. bo_status = #{bo_status,jdbcType=VARCHAR},
  228. bo_statuscode = #{bo_statuscode,jdbcType=VARCHAR},
  229. bo_recorderid = #{bo_recorderid,jdbcType=INTEGER},
  230. bo_recorder = #{bo_recorder,jdbcType=VARCHAR},
  231. bo_recorddate = #{bo_recorddate,jdbcType=TIMESTAMP},
  232. companyId = #{companyId,jdbcType=INTEGER},
  233. updaterId = #{updaterId,jdbcType=INTEGER},
  234. updateTime = #{updateTime,jdbcType=TIMESTAMP},
  235. bo_text1 = #{bo_text1,jdbcType=VARCHAR},
  236. bo_text2 = #{bo_text2,jdbcType=VARCHAR},
  237. bo_text3 = #{bo_text3,jdbcType=VARCHAR},
  238. bo_text4 = #{bo_text4,jdbcType=VARCHAR},
  239. bo_text5 = #{bo_text5,jdbcType=VARCHAR}
  240. where bo_id = #{id}
  241. </update>
  242. <select id="validateCodeWhenInsert" resultType="int">
  243. select count(*) from BOM where BO_MOTHERCODE = #{code} and companyId =#{companyId}
  244. </select>
  245. <select id="validateCodeWhenUpdate" resultType="int" >
  246. select count(*) from BOM where BO_MOTHERCODE = #{code} and BO_ID != #{id} and companyId =#{companyId}
  247. </select>
  248. <select id="validCodeAndVersion" resultType="int">
  249. SELECT COUNT(*) FROM BOM WHERE BO_MOTHERCODE = #{code} and BO_VERSION=#{version} and COMPANYID=#{companyId}
  250. </select>
  251. </mapper>