WarehouseMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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.WarehouseMapper">
  4. <resultMap id="WarehouseResultMapper" type="com.usoftchina.saas.document.entities.Warehouse">
  5. <id column="wh_id" property="id" jdbcType="INTEGER" />
  6. <result column="wh_code" property="wh_code" jdbcType="VARCHAR" />
  7. <result column="wh_type" property="wh_type" jdbcType="VARCHAR" />
  8. <result column="wh_description" property="wh_description" jdbcType="VARCHAR" />
  9. <result column="wh_statuscode" property="wh_statuscode" jdbcType="VARCHAR" />
  10. <result column="wh_status" property="wh_status" jdbcType="TIMESTAMP" />
  11. <result column="wh_recordid" property="wh_recordid" jdbcType="INTEGER" />
  12. <result column="wh_recorder" property="wh_recorder" jdbcType="INTEGER" />
  13. <result column="wh_date" property="wh_date" jdbcType="INTEGER" />
  14. <result column="companyid" property="companyId" jdbcType="INTEGER" />
  15. <result column="updatemanid" property="updaterId" jdbcType="INTEGER" />
  16. <result column="updatedate" property="updateTime" jdbcType="TIMESTAMP" />
  17. <result column="wh_text1" property="wh_text1" jdbcType="VARCHAR" />
  18. <result column="wh_text2" property="wh_text2" jdbcType="VARCHAR" />
  19. <result column="wh_text3" property="wh_text3" jdbcType="VARCHAR" />
  20. <result column="wh_text4" property="wh_text4" jdbcType="VARCHAR" />
  21. <result column="wh_text5" property="wh_text5" jdbcType="VARCHAR" />
  22. </resultMap>
  23. <select id="post" parameterMap="postParamMap" statementType="CALLABLE">
  24. CALL SP_COMMITPRODINOUT(?, ?, ?, ?, ?)
  25. </select>
  26. <select id="unPost" parameterMap="postParamMap" statementType="CALLABLE">
  27. CALL SP_UNCOMMITPRODINOUT(?, ?, ?, ?, ?)
  28. </select>
  29. <parameterMap id="postParamMap" type="java.util.Map">
  30. <parameter property="inoutNo" jdbcType="VARCHAR" mode="IN" />
  31. <parameter property="class" jdbcType="VARCHAR" mode="IN" />
  32. <parameter property="commitid" jdbcType="INTEGER" mode="IN" />
  33. <parameter property="companyid" jdbcType="INTEGER" mode="IN" />
  34. <parameter property="result" jdbcType="VARCHAR" mode="OUT" />
  35. </parameterMap>
  36. <select id="validPeriod" parameterType="map" resultType="java.lang.Short">
  37. SELECT IFNULL(PD_STATUS,0) PD_STATUS FROM PERIODSDETAIL WHERE COMPANYID=#{companyId} AND PD_DETNO=#{period}
  38. </select>
  39. <sql id="Example_Where_Clause">
  40. <where>
  41. <foreach collection="oredCriteria" item="criteria" separator="or">
  42. <if test="criteria.valid">
  43. <trim prefix="(" prefixOverrides="and" suffix=")">
  44. <foreach collection="criteria.criteria" item="criterion">
  45. <choose>
  46. <when test="criterion.noValue">
  47. and ${criterion.condition}
  48. </when>
  49. <when test="criterion.singleValue">
  50. and ${criterion.condition} #{criterion.value}
  51. </when>
  52. <when test="criterion.betweenValue">
  53. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  54. </when>
  55. <when test="criterion.listValue">
  56. and ${criterion.condition}
  57. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  58. #{listItem}
  59. </foreach>
  60. </when>
  61. </choose>
  62. </foreach>
  63. </trim>
  64. </if>
  65. </foreach>
  66. </where>
  67. </sql>
  68. <sql id="Update_By_Example_Where_Clause">
  69. <where>
  70. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  71. <if test="criteria.valid">
  72. <trim prefix="(" prefixOverrides="and" suffix=")">
  73. <foreach collection="criteria.criteria" item="criterion">
  74. <choose>
  75. <when test="criterion.noValue">
  76. and ${criterion.condition}
  77. </when>
  78. <when test="criterion.singleValue">
  79. and ${criterion.condition} #{criterion.value}
  80. </when>
  81. <when test="criterion.betweenValue">
  82. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  83. </when>
  84. <when test="criterion.listValue">
  85. and ${criterion.condition}
  86. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  87. #{listItem}
  88. </foreach>
  89. </when>
  90. </choose>
  91. </foreach>
  92. </trim>
  93. </if>
  94. </foreach>
  95. </where>
  96. </sql>
  97. <sql id="Base_Column_List">
  98. wh_id, wh_code, wh_type, wh_description, wh_statuscode, wh_status, wh_recorderid,
  99. wh_recorder, wh_date, companyid, updaterId, updatetime, wh_text1, wh_text2, wh_text3,
  100. wh_text4, wh_text5
  101. </sql>
  102. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="WarehouseResultMapper">
  103. select
  104. <include refid="Base_Column_List" />
  105. from warehouse
  106. where wh_id = #{wh_id,jdbcType=INTEGER}
  107. </select>
  108. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  109. delete from warehouse
  110. where wh_id = #{wh_id,jdbcType=INTEGER}
  111. </delete>
  112. <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Warehouse">
  113. insert into warehouse (wh_id, wh_code, wh_type,
  114. wh_description, wh_statuscode, wh_status,
  115. wh_recorderid, wh_recorder, wh_date,
  116. companyid, updaterId, updatetime,
  117. wh_text1, wh_text2, wh_text3,
  118. wh_text4, wh_text5)
  119. values (#{wh_id,jdbcType=INTEGER}, #{wh_code,jdbcType=VARCHAR}, #{wh_type,jdbcType=VARCHAR},
  120. #{wh_description,jdbcType=VARCHAR}, #{wh_statuscode,jdbcType=VARCHAR}, #{wh_status,jdbcType=VARCHAR},
  121. #{wh_recorderid,jdbcType=VARCHAR}, #{wh_recorder,jdbcType=VARCHAR}, #{wh_date,jdbcType=TIMESTAMP},
  122. #{companyid,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER}, #{updatetime,jdbcType=TIMESTAMP},
  123. #{wh_text1,jdbcType=VARCHAR}, #{wh_text2,jdbcType=VARCHAR}, #{wh_text3,jdbcType=VARCHAR},
  124. #{wh_text4,jdbcType=VARCHAR}, #{wh_text5,jdbcType=VARCHAR})
  125. </insert>
  126. <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Warehouse">
  127. insert into warehouse
  128. <trim prefix="(" suffix=")" suffixOverrides=",">
  129. <if test="wh_id != null">
  130. wh_id,
  131. </if>
  132. <if test="wh_code != null">
  133. wh_code,
  134. </if>
  135. <if test="wh_type != null">
  136. wh_type,
  137. </if>
  138. <if test="wh_description != null">
  139. wh_description,
  140. </if>
  141. <if test="wh_statuscode != null">
  142. wh_statuscode,
  143. </if>
  144. <if test="wh_status != null">
  145. wh_status,
  146. </if>
  147. <if test="wh_recorderid != null">
  148. wh_recorderid,
  149. </if>
  150. <if test="wh_recorder != null">
  151. wh_recorder,
  152. </if>
  153. <if test="wh_date != null">
  154. wh_date,
  155. </if>
  156. <if test="companyid != null">
  157. companyid,
  158. </if>
  159. <if test="updaterId != null">
  160. updaterId,
  161. </if>
  162. <if test="updatetime != null">
  163. updatetime,
  164. </if>
  165. <if test="wh_text1 != null">
  166. wh_text1,
  167. </if>
  168. <if test="wh_text2 != null">
  169. wh_text2,
  170. </if>
  171. <if test="wh_text3 != null">
  172. wh_text3,
  173. </if>
  174. <if test="wh_text4 != null">
  175. wh_text4,
  176. </if>
  177. <if test="wh_text5 != null">
  178. wh_text5,
  179. </if>
  180. </trim>
  181. <trim prefix="values (" suffix=")" suffixOverrides=",">
  182. <if test="wh_id != null">
  183. #{wh_id,jdbcType=INTEGER},
  184. </if>
  185. <if test="wh_code != null">
  186. #{wh_code,jdbcType=VARCHAR},
  187. </if>
  188. <if test="wh_type != null">
  189. #{wh_type,jdbcType=VARCHAR},
  190. </if>
  191. <if test="wh_description != null">
  192. #{wh_description,jdbcType=VARCHAR},
  193. </if>
  194. <if test="wh_statuscode != null">
  195. #{wh_statuscode,jdbcType=VARCHAR},
  196. </if>
  197. <if test="wh_status != null">
  198. #{wh_status,jdbcType=VARCHAR},
  199. </if>
  200. <if test="wh_recorderid != null">
  201. #{wh_recorderid,jdbcType=VARCHAR},
  202. </if>
  203. <if test="wh_recorder != null">
  204. #{wh_recorder,jdbcType=VARCHAR},
  205. </if>
  206. <if test="wh_date != null">
  207. #{wh_date,jdbcType=TIMESTAMP},
  208. </if>
  209. <if test="companyid != null">
  210. #{companyid,jdbcType=INTEGER},
  211. </if>
  212. <if test="updaterId != null">
  213. #{updaterId,jdbcType=INTEGER},
  214. </if>
  215. <if test="updatetime != null">
  216. #{updatetime,jdbcType=TIMESTAMP},
  217. </if>
  218. <if test="wh_text1 != null">
  219. #{wh_text1,jdbcType=VARCHAR},
  220. </if>
  221. <if test="wh_text2 != null">
  222. #{wh_text2,jdbcType=VARCHAR},
  223. </if>
  224. <if test="wh_text3 != null">
  225. #{wh_text3,jdbcType=VARCHAR},
  226. </if>
  227. <if test="wh_text4 != null">
  228. #{wh_text4,jdbcType=VARCHAR},
  229. </if>
  230. <if test="wh_text5 != null">
  231. #{wh_text5,jdbcType=VARCHAR},
  232. </if>
  233. </trim>
  234. </insert>
  235. <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Warehouse">
  236. update warehouse
  237. <set>
  238. <if test="wh_code != null">
  239. wh_code = #{wh_code,jdbcType=VARCHAR},
  240. </if>
  241. <if test="wh_type != null">
  242. wh_type = #{wh_type,jdbcType=VARCHAR},
  243. </if>
  244. <if test="wh_description != null">
  245. wh_description = #{wh_description,jdbcType=VARCHAR},
  246. </if>
  247. <if test="wh_statuscode != null">
  248. wh_statuscode = #{wh_statuscode,jdbcType=VARCHAR},
  249. </if>
  250. <if test="wh_status != null">
  251. wh_status = #{wh_status,jdbcType=VARCHAR},
  252. </if>
  253. <if test="wh_recorderid != null">
  254. wh_recorderid = #{wh_recorderid,jdbcType=VARCHAR},
  255. </if>
  256. <if test="wh_recorder != null">
  257. wh_recorder = #{wh_recorder,jdbcType=VARCHAR},
  258. </if>
  259. <if test="wh_date != null">
  260. wh_date = #{wh_date,jdbcType=TIMESTAMP},
  261. </if>
  262. <if test="companyid != null">
  263. companyid = #{companyid,jdbcType=INTEGER},
  264. </if>
  265. <if test="updaterId != null">
  266. updaterId = #{updaterId,jdbcType=INTEGER},
  267. </if>
  268. <if test="updatetime != null">
  269. updatetime = #{updatetime,jdbcType=TIMESTAMP},
  270. </if>
  271. <if test="wh_text1 != null">
  272. wh_text1 = #{wh_text1,jdbcType=VARCHAR},
  273. </if>
  274. <if test="wh_text2 != null">
  275. wh_text2 = #{wh_text2,jdbcType=VARCHAR},
  276. </if>
  277. <if test="wh_text3 != null">
  278. wh_text3 = #{wh_text3,jdbcType=VARCHAR},
  279. </if>
  280. <if test="wh_text4 != null">
  281. wh_text4 = #{wh_text4,jdbcType=VARCHAR},
  282. </if>
  283. <if test="wh_text5 != null">
  284. wh_text5 = #{wh_text5,jdbcType=VARCHAR},
  285. </if>
  286. </set>
  287. where wh_id = #{wh_id,jdbcType=INTEGER}
  288. </update>
  289. <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Warehouse">
  290. update warehouse
  291. set wh_code = #{wh_code,jdbcType=VARCHAR},
  292. wh_type = #{wh_type,jdbcType=VARCHAR},
  293. wh_description = #{wh_description,jdbcType=VARCHAR},
  294. wh_statuscode = #{wh_statuscode,jdbcType=VARCHAR},
  295. wh_status = #{wh_status,jdbcType=VARCHAR},
  296. wh_recorderid = #{wh_recorderid,jdbcType=VARCHAR},
  297. wh_recorder = #{wh_recorder,jdbcType=VARCHAR},
  298. wh_date = #{wh_date,jdbcType=TIMESTAMP},
  299. companyid = #{companyid,jdbcType=INTEGER},
  300. updaterId = #{updaterId,jdbcType=INTEGER},
  301. updatetime = #{updatetime,jdbcType=TIMESTAMP},
  302. wh_text1 = #{wh_text1,jdbcType=VARCHAR},
  303. wh_text2 = #{wh_text2,jdbcType=VARCHAR},
  304. wh_text3 = #{wh_text3,jdbcType=VARCHAR},
  305. wh_text4 = #{wh_text4,jdbcType=VARCHAR},
  306. wh_text5 = #{wh_text5,jdbcType=VARCHAR}
  307. where wh_id = #{wh_id,jdbcType=INTEGER}
  308. </update>
  309. <select id="selectAll" resultType="com.usoftchina.saas.document.entities.Warehouse">
  310. SELECT * FROM WAREHOUSE WHERE COMPANYID = #{companyId}
  311. </select>
  312. <select id="validateCodeWhenInsert" resultType="int">
  313. select count(*) from WAREHOUSE where WH_CODE = #{code} and companyId =#{companyId}
  314. </select>
  315. <select id="validateCodeWhenUpdate" resultType="int" >
  316. select count(*) from WAREHOUSE where WH_CODE = #{code} and WH_ID != #{id} and companyId =#{companyId}
  317. </select>
  318. </mapper>