VendorMapper.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  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.VendorMapper">
  4. <resultMap id="VendorResultMapper" type="com.usoftchina.saas.document.entities.Vendor">
  5. <id column="ve_id" property="id" jdbcType="INTEGER" />
  6. <result column="ve_code" property="ve_code" jdbcType="VARCHAR" />
  7. <result column="ve_shortname" property="ve_shortname" jdbcType="VARCHAR"/>
  8. <result column="ve_uu" property="ve_uu" jdbcType="VARCHAR" />
  9. <result column="ve_name" property="ve_name" jdbcType="VARCHAR" />
  10. <result column="ve_type" property="ve_type" jdbcType="VARCHAR" />
  11. <result column="ve_begindate" property="ve_begindate" jdbcType="TIMESTAMP" />
  12. <result column="ve_beginapamount" property="ve_beginapamount" jdbcType="DOUBLE" />
  13. <result column="ve_beginprepayamount" property="ve_beginprepayamount" jdbcType="DOUBLE" />
  14. <result column="ve_promisedays" property="ve_promisedays" jdbcType="INTEGER" />
  15. <result column="ve_taxrate" property="ve_taxrate" jdbcType="DOUBLE" />
  16. <result column="ve_nsrzh" property="ve_nsrzh" jdbcType="VARCHAR" />
  17. <result column="ve_bankaccount" property="ve_bankaccount" jdbcType="VARCHAR" />
  18. <result column="ve_bankcode" property="ve_bankcode" jdbcType="VARCHAR" />
  19. <result column="ve_status" property="ve_status" jdbcType="VARCHAR" />
  20. <result column="ve_statuscode" property="ve_statuscode" jdbcType="VARCHAR" />
  21. <result column="companyId" property="companyId" jdbcType="INTEGER" />
  22. <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
  23. <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
  24. <result column="ve_text1" property="ve_text1" jdbcType="VARCHAR" />
  25. <result column="ve_text2" property="ve_text2" jdbcType="VARCHAR" />
  26. <result column="ve_text3" property="ve_text3" jdbcType="VARCHAR" />
  27. <result column="ve_text4" property="ve_text4" jdbcType="VARCHAR" />
  28. <result column="ve_text5" property="ve_text5" jdbcType="VARCHAR" />
  29. <result column="ve_payamount" property="ve_payamount" jdbcType="DOUBLE" />
  30. <result column="ve_leftamount" property="ve_leftamount" jdbcType="DOUBLE" />
  31. <result column="ve_beginym" property="ve_beginym" jdbcType="INTEGER" />
  32. <result column="ve_preamount" property="ve_preamount" jdbcType="DOUBLE" />
  33. <result column="ve_remark" property="ve_remark" jdbcType="VARCHAR" />
  34. </resultMap>
  35. <resultMap id="VendorDTOResultMapper" type="com.usoftchina.saas.document.dto.VendorDTO">
  36. <id column="ve_id" property="id" jdbcType="INTEGER" />
  37. <result column="ve_code" property="ve_code" jdbcType="VARCHAR" />
  38. <result column="ve_shortname" property="ve_shortname" jdbcType="VARCHAR"/>
  39. <result column="ve_name" property="ve_name" jdbcType="VARCHAR" />
  40. <result column="ve_type" property="ve_type" jdbcType="VARCHAR" />
  41. <result column="ve_status" property="ve_status" jdbcType="VARCHAR" />
  42. <result column="ve_remark" property="ve_remark" jdbcType="VARCHAR" />
  43. </resultMap>
  44. <select id="getVendorsByCondition" resultMap="VendorDTOResultMapper">
  45. SELECT * FROM VENDOR
  46. <where>
  47. <if test="condition!=null">
  48. ${condition}
  49. </if>
  50. <if test="companyId!=null">
  51. AND companyId = #{companyId}
  52. </if>
  53. </where>
  54. ORDER BY VE_ID DESC
  55. </select>
  56. <resultMap id="VendorListResultMapper" type="com.usoftchina.saas.document.entities.VendorList">
  57. <id column="ve_id" property="id" jdbcType="INTEGER" />
  58. <result column="ve_code" property="ve_code" jdbcType="VARCHAR" />
  59. <result column="ve_uu" property="ve_uu" jdbcType="VARCHAR" />
  60. <result column="ve_shortname" property="ve_shortname" jdbcType="VARCHAR"/>
  61. <result column="ve_name" property="ve_name" jdbcType="VARCHAR" />
  62. <result column="ve_type" property="ve_type" jdbcType="VARCHAR" />
  63. <result column="ve_begindate" property="ve_begindate" jdbcType="TIMESTAMP" />
  64. <result column="ve_beginapamount" property="ve_beginapamount" jdbcType="DOUBLE" />
  65. <result column="ve_beginprepayamount" property="ve_beginprepayamount" jdbcType="DOUBLE" />
  66. <result column="ve_promisedays" property="ve_promisedays" jdbcType="INTEGER" />
  67. <result column="ve_taxrate" property="ve_taxrate" jdbcType="DOUBLE" />
  68. <result column="ve_nsrzh" property="ve_nsrzh" jdbcType="VARCHAR" />
  69. <result column="ve_bankaccount" property="ve_bankaccount" jdbcType="VARCHAR" />
  70. <result column="ve_bankcode" property="ve_bankcode" jdbcType="VARCHAR" />
  71. <result column="ve_status" property="ve_status" jdbcType="VARCHAR" />
  72. <result column="ve_statuscode" property="ve_statuscode" jdbcType="VARCHAR" />
  73. <result column="ve_leftamount" property="ve_leftamount" jdbcType="INTEGER" />
  74. <result column="ve_text1" property="ve_text1" jdbcType="VARCHAR" />
  75. <result column="ve_text2" property="ve_text2" jdbcType="VARCHAR" />
  76. <result column="ve_text3" property="ve_text3" jdbcType="VARCHAR" />
  77. <result column="ve_text4" property="ve_text4" jdbcType="VARCHAR" />
  78. <result column="ve_text5" property="ve_text5" jdbcType="VARCHAR" />
  79. <result column="ve_remark" property="ve_remark" jdbcType="VARCHAR" />
  80. <result column="ve_buyerid" property="ve_buyerid" jdbcType="INTEGER" />
  81. <result column="ve_buyercode" property="ve_buyercode" jdbcType="VARCHAR" />
  82. <result column="ve_buyername" property="ve_buyername" jdbcType="VARCHAR" />
  83. <result column="vc_veid" property="vc_veid" jdbcType="INTEGER" />
  84. <result column="vc_detno" property="vc_detno" jdbcType="INTEGER" />
  85. <result column="vc_name" property="vc_name" jdbcType="VARCHAR" />
  86. <result column="vc_tel" property="vc_tel" jdbcType="VARCHAR" />
  87. <result column="vc_qq" property="vc_qq" jdbcType="VARCHAR" />
  88. <result column="vc_email" property="vc_email" jdbcType="VARCHAR" />
  89. <result column="vc_text1" property="vc_text1" jdbcType="VARCHAR" />
  90. <result column="vc_text2" property="vc_text2" jdbcType="VARCHAR" />
  91. <result column="vc_text3" property="vc_text3" jdbcType="VARCHAR" />
  92. <result column="vc_text4" property="vc_text4" jdbcType="VARCHAR" />
  93. <result column="vc_text5" property="vc_text5" jdbcType="VARCHAR" />
  94. <result column="vc_default" property="vc_default" jdbcType="VARCHAR" />
  95. </resultMap>
  96. <select id="getListDataByCondition" resultMap="VendorListResultMapper">
  97. SELECT * FROM VENDOR LEFT JOIN VENDORCONTACT ON VE_ID = VC_VEID and vc_default = 1
  98. <where>
  99. <if test="condition!=null">
  100. ${condition}
  101. </if>
  102. AND VENDOR.COMPANYID = #{companyId}
  103. </where>
  104. order by VE_ID DESC
  105. </select>
  106. <sql id="Base_Column_List" >
  107. ve_id, ve_code, ve_shortname,ve_name, ve_uu, ve_type, ve_begindate, ve_beginapamount, ve_beginprepayamount,
  108. ve_promisedays, ve_taxrate, ve_nsrzh, ve_bankaccount, ve_bankcode, ve_status, ve_statuscode,
  109. companyId, updaterId, updateTime, ve_text1,
  110. ve_text2, ve_text3, ve_text4, ve_text5, ve_payamount, ve_leftamount, ve_beginym, ve_preamount,ve_remark,
  111. ve_buyerid,ve_buyercode,ve_buyername
  112. </sql>
  113. <select id="selectByPrimaryKey" resultMap="VendorResultMapper" parameterType="java.lang.Long" >
  114. select
  115. <include refid="Base_Column_List" />
  116. from vendor
  117. where ve_id = #{id}
  118. </select>
  119. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
  120. delete from vendor
  121. where ve_id = #{id}
  122. </delete>
  123. <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Vendor" >
  124. <selectKey resultType="java.lang.Long" keyProperty="id">
  125. SELECT LAST_INSERT_ID() AS ID
  126. </selectKey>
  127. insert into vendor
  128. <trim prefix="(" suffix=")" suffixOverrides="," >
  129. <if test="ve_code != null" >
  130. ve_code,
  131. </if>
  132. <if test="ve_shortname !=null">
  133. ve_shortname,
  134. </if>
  135. <if test="ve_name != null" >
  136. ve_name,
  137. </if>
  138. <if test="ve_uu != null" >
  139. ve_uu,
  140. </if>
  141. <if test="ve_type != null" >
  142. ve_type,
  143. </if>
  144. <if test="ve_begindate != null" >
  145. ve_begindate,
  146. </if>
  147. <if test="ve_beginapamount != null" >
  148. ve_beginapamount,
  149. </if>
  150. <if test="ve_beginprepayamount != null" >
  151. ve_beginprepayamount,
  152. </if>
  153. <if test="ve_promisedays != null" >
  154. ve_promisedays,
  155. </if>
  156. <if test="ve_taxrate != null" >
  157. ve_taxrate,
  158. </if>
  159. <if test="ve_nsrzh != null" >
  160. ve_nsrzh,
  161. </if>
  162. <if test="ve_bankaccount != null" >
  163. ve_bankaccount,
  164. </if>
  165. <if test="ve_bankcode != null" >
  166. ve_bankcode,
  167. </if>
  168. <if test="ve_status != null" >
  169. ve_status,
  170. </if>
  171. <if test="ve_statuscode != null" >
  172. ve_statuscode,
  173. </if>
  174. <if test="companyId != null" >
  175. companyId,
  176. </if>
  177. <if test="updaterId != null" >
  178. updaterId,
  179. </if>
  180. <if test="updateTime != null" >
  181. updateTime,
  182. </if>
  183. <if test="ve_text1 != null" >
  184. ve_text1,
  185. </if>
  186. <if test="ve_text2 != null" >
  187. ve_text2,
  188. </if>
  189. <if test="ve_text3 != null" >
  190. ve_text3,
  191. </if>
  192. <if test="ve_text4 != null" >
  193. ve_text4,
  194. </if>
  195. <if test="ve_text5 != null" >
  196. ve_text5,
  197. </if>
  198. <if test="ve_payamount != null" >
  199. ve_payamount,
  200. </if>
  201. <if test="ve_leftamount != null" >
  202. ve_leftamount,
  203. </if>
  204. <if test="ve_beginym != null" >
  205. ve_beginym,
  206. </if>
  207. <if test="ve_preamount !=null" >
  208. ve_preamount,
  209. </if>
  210. <if test="creatorId != null" >
  211. creatorId,
  212. </if>
  213. <if test="createTime != null" >
  214. createTime,
  215. </if>
  216. <if test="creatorName != null" >
  217. creatorName,
  218. </if>
  219. <if test="ve_remark!=null">
  220. ve_remark,
  221. </if>
  222. <if test="ve_buyerid!=null">
  223. ve_buyerid,
  224. </if>
  225. <if test="ve_buyercode!=null">
  226. ve_buyercode,
  227. </if>
  228. <if test="ve_buyername!=null">
  229. ve_buyername
  230. </if>
  231. </trim>
  232. <trim prefix="values (" suffix=")" suffixOverrides="," >
  233. <if test="ve_code != null" >
  234. #{ve_code,jdbcType=VARCHAR},
  235. </if>
  236. <if test="ve_shortname !=null">
  237. #{ve_shortname,jdbcType=VARCHAR},
  238. </if>
  239. <if test="ve_name != null" >
  240. #{ve_name,jdbcType=VARCHAR},
  241. </if>
  242. <if test="ve_uu != null" >
  243. #{ve_uu,jdbcType=VARCHAR},
  244. </if>
  245. <if test="ve_type != null" >
  246. #{ve_type,jdbcType=VARCHAR},
  247. </if>
  248. <if test="ve_begindate != null" >
  249. #{ve_begindate,jdbcType=TIMESTAMP},
  250. </if>
  251. <if test="ve_beginapamount != null" >
  252. #{ve_beginapamount,jdbcType=DOUBLE},
  253. </if>
  254. <if test="ve_beginprepayamount != null" >
  255. #{ve_beginprepayamount,jdbcType=DOUBLE},
  256. </if>
  257. <if test="ve_promisedays != null" >
  258. #{ve_promisedays,jdbcType=DECIMAL},
  259. </if>
  260. <if test="ve_taxrate != null" >
  261. #{ve_taxrate,jdbcType=DOUBLE},
  262. </if>
  263. <if test="ve_nsrzh != null" >
  264. #{ve_nsrzh,jdbcType=VARCHAR},
  265. </if>
  266. <if test="ve_bankaccount != null" >
  267. #{ve_bankaccount,jdbcType=VARCHAR},
  268. </if>
  269. <if test="ve_bankcode != null" >
  270. #{ve_bankcode,jdbcType=VARCHAR},
  271. </if>
  272. <if test="ve_status != null" >
  273. #{ve_status,jdbcType=VARCHAR},
  274. </if>
  275. <if test="ve_statuscode != null" >
  276. #{ve_statuscode,jdbcType=VARCHAR},
  277. </if>
  278. <if test="companyId != null" >
  279. #{companyId,jdbcType=DECIMAL},
  280. </if>
  281. <if test="updaterId != null" >
  282. #{updaterId,jdbcType=DECIMAL},
  283. </if>
  284. <if test="updateTime != null" >
  285. #{updateTime,jdbcType=TIMESTAMP},
  286. </if>
  287. <if test="ve_text1 != null" >
  288. #{ve_text1,jdbcType=VARCHAR},
  289. </if>
  290. <if test="ve_text2 != null" >
  291. #{ve_text2,jdbcType=VARCHAR},
  292. </if>
  293. <if test="ve_text3 != null" >
  294. #{ve_text3,jdbcType=VARCHAR},
  295. </if>
  296. <if test="ve_text4 != null" >
  297. #{ve_text4,jdbcType=VARCHAR},
  298. </if>
  299. <if test="ve_text5 != null" >
  300. #{ve_text5,jdbcType=VARCHAR},
  301. </if>
  302. <if test="ve_payamount != null" >
  303. #{ve_payamount,jdbcType=DOUBLE},
  304. </if>
  305. <if test="ve_leftamount != null" >
  306. #{ve_leftamount,jdbcType=DOUBLE},
  307. </if>
  308. <if test="ve_beginym != null" >
  309. #{ve_beginym,jdbcType=INTEGER},
  310. </if>
  311. <if test="ve_preamount !=null" >
  312. #{ve_preamount,jdbcType=DOUBLE},
  313. </if>
  314. <if test="creatorId != null" >
  315. #{creatorId,jdbcType=INTEGER},
  316. </if>
  317. <if test="createTime != null" >
  318. #{createTime,jdbcType=TIMESTAMP},
  319. </if>
  320. <if test="creatorName != null" >
  321. #{creatorName,jdbcType=VARCHAR},
  322. </if>
  323. <if test="ve_remark != null">
  324. #{ve_remark,jdbcType=VARCHAR},
  325. </if>
  326. <if test="ve_buyerid != null">
  327. #{ve_buyerid,jdbcType=INTEGER},
  328. </if>
  329. <if test="ve_buyercode != null">
  330. #{ve_buyercode,jdbcType=VARCHAR},
  331. </if>
  332. <if test="ve_buyername != null">
  333. #{ve_buyername,jdbcType=VARCHAR}
  334. </if>
  335. </trim>
  336. </insert>
  337. <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Vendor" >
  338. update vendor
  339. <set >
  340. <if test="ve_code != null" >
  341. ve_code = #{ve_code,jdbcType=VARCHAR},
  342. </if>
  343. <if test="ve_shortname !=null">
  344. ve_shortname = #{ve_shortname,jdbcType=VARCHAR},
  345. </if>
  346. <if test="ve_name != null" >
  347. ve_name = #{ve_name,jdbcType=VARCHAR},
  348. </if>
  349. <if test="ve_uu != null" >
  350. ve_uu = #{ve_uu,jdbcType=VARCHAR},
  351. </if>
  352. <if test="ve_type != null" >
  353. ve_type = #{ve_type,jdbcType=VARCHAR},
  354. </if>
  355. <if test="ve_begindate != null" >
  356. ve_begindate = #{ve_begindate,jdbcType=TIMESTAMP},
  357. </if>
  358. <if test="ve_beginapamount != null" >
  359. ve_beginapamount = #{ve_beginapamount,jdbcType=DOUBLE},
  360. </if>
  361. <if test="ve_beginprepayamount != null" >
  362. ve_beginprepayamount = #{ve_beginprepayamount,jdbcType=DOUBLE},
  363. </if>
  364. <if test="ve_promisedays != null" >
  365. ve_promisedays = #{ve_promisedays,jdbcType=DECIMAL},
  366. </if>
  367. <if test="ve_taxrate != null" >
  368. ve_taxrate = #{ve_taxrate,jdbcType=DOUBLE},
  369. </if>
  370. <if test="ve_nsrzh != null" >
  371. ve_nsrzh = #{ve_nsrzh,jdbcType=VARCHAR},
  372. </if>
  373. <if test="ve_bankaccount != null" >
  374. ve_bankaccount = #{ve_bankaccount,jdbcType=VARCHAR},
  375. </if>
  376. <if test="ve_bankcode != null" >
  377. ve_bankcode = #{ve_bankcode,jdbcType=VARCHAR},
  378. </if>
  379. <if test="ve_status != null" >
  380. ve_status = #{ve_status,jdbcType=VARCHAR},
  381. </if>
  382. <if test="ve_statuscode != null" >
  383. ve_statuscode = #{ve_statuscode,jdbcType=VARCHAR},
  384. </if>
  385. <if test="companyId != null" >
  386. companyId = #{companyId,jdbcType=DECIMAL},
  387. </if>
  388. <if test="updaterId != null" >
  389. updaterId = #{updaterId,jdbcType=DECIMAL},
  390. </if>
  391. <if test="updateTime != null" >
  392. updateTime = #{updateTime,jdbcType=TIMESTAMP},
  393. </if>
  394. <if test="ve_text1 != null" >
  395. ve_text1 = #{ve_text1,jdbcType=VARCHAR},
  396. </if>
  397. <if test="ve_text2 != null" >
  398. ve_text2 = #{ve_text2,jdbcType=VARCHAR},
  399. </if>
  400. <if test="ve_text3 != null" >
  401. ve_text3 = #{ve_text3,jdbcType=VARCHAR},
  402. </if>
  403. <if test="ve_text4 != null" >
  404. ve_text4 = #{ve_text4,jdbcType=VARCHAR},
  405. </if>
  406. <if test="ve_text5 != null" >
  407. ve_text5 = #{ve_text5,jdbcType=VARCHAR},
  408. </if>
  409. <if test="ve_payamount != null" >
  410. ve_payamount = #{ve_payamount,jdbcType=DOUBLE},
  411. </if>
  412. <if test="ve_leftamount != null" >
  413. ve_leftamount = #{ve_leftamount,jdbcType=DOUBLE},
  414. </if>
  415. <if test="ve_beginym != null" >
  416. ve_beginym = #{ve_beginym,jdbcType=INTEGER},
  417. </if>
  418. <if test="ve_preamount !=null" >
  419. #{ve_preamount,jdbcType=DOUBLE},
  420. </if>
  421. <if test="ve_remark != null" >
  422. ve_remark = #{ve_remark,jdbcType=VARCHAR},
  423. </if>
  424. <if test="ve_buyerid != null" >
  425. ve_buyerid = #{ve_buyerid,jdbcType=INTEGER},
  426. </if>
  427. <if test="ve_buyercode != null" >
  428. ve_buyercode = #{ve_buyercode,jdbcType=VARCHAR},
  429. </if>
  430. <if test="ve_buyername != null" >
  431. ve_buyername = #{ve_buyername,jdbcType=VARCHAR}
  432. </if>
  433. </set>
  434. where ve_id = #{id}
  435. </update>
  436. <select id="validateCodeWhenInsert" resultType="int">
  437. select count(*) from VENDOR where VE_CODE = #{code} and companyId =#{companyId}
  438. </select>
  439. <select id="validateCodeWhenUpdate" resultType="int" >
  440. select count(*) from VENDOR where VE_CODE = #{code} and VE_ID != #{id} and companyId =#{companyId}
  441. </select>
  442. <select id="getCodeById" resultType="string">
  443. SELECT VE_CODE FROM VENDOR WHERE VE_ID = #{id} and COMPANYID = #{companyId}
  444. </select>
  445. <select id="getCountByCode" resultType="int">
  446. SELECT COUNT(*) FROM VENDOR WHERE COMPANYID = #{companyId} AND VE_CODE=#{code}
  447. </select>
  448. <select id="getCountByName" resultType="int">
  449. SELECT COUNT(*) FROM VENDOR WHERE COMPANYID = #{companyId} AND VE_NAME=#{name}
  450. </select>
  451. <select id="validFinish" parameterType="long" resultType="int">
  452. select count(1) from periodsdetail where pd_status=99 and pd_detno=(select DATE_FORMAT(ve_begindate,'%Y%m') from vendor where ve_id =#{id})
  453. and companyId =#{companyId};
  454. </select>
  455. <select id="check" parameterMap="checkParamMap" statementType="CALLABLE">
  456. CALL SP_LIMITBASE(?, ?, ?, ?,?)
  457. </select>
  458. <parameterMap id="checkParamMap" type="java.util.Map">
  459. <parameter property="v_type" jdbcType="VARCHAR" mode="IN" />
  460. <parameter property="v_id" jdbcType="INTEGER" mode="IN" />
  461. <parameter property="v_code" jdbcType="VARCHAR" mode="IN" />
  462. <parameter property="v_companyid" jdbcType="INTEGER" mode="IN" />
  463. <parameter property="v_res" jdbcType="VARCHAR" mode="OUT" />
  464. </parameterMap>
  465. <select id="selectIdByCode" resultType="long">
  466. select ve_id from VENDOR where ve_code=#{code} and companyId=#{companyId}
  467. </select>
  468. </mapper>