BankinformationMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  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.BankinformationMapper" >
  4. <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Bankinformation" >
  5. <id column="bk_id" property="id" jdbcType="INTEGER" />
  6. <result column="bk_bankcode" property="bk_bankcode" jdbcType="VARCHAR" />
  7. <result column="bk_bankname" property="bk_bankname" jdbcType="VARCHAR" />
  8. <result column="bk_date" property="bk_date" jdbcType="TIMESTAMP" />
  9. <result column="bk_type" property="bk_type" jdbcType="VARCHAR" />
  10. <result column="bk_beginamount" property="bk_beginamount" jdbcType="DOUBLE" />
  11. <result column="bk_thisamount" property="bk_thisamount" jdbcType="DOUBLE" />
  12. <result column="bk_status" property="bk_status" jdbcType="VARCHAR" />
  13. <result column="bk_statuscode" property="bk_statuscode" jdbcType="VARCHAR" />
  14. <result column="bk_ym" property="bk_ym" jdbcType="INTEGER" />
  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="bk_text1" property="bk_text1" jdbcType="VARCHAR" />
  19. <result column="bk_text2" property="bk_text2" jdbcType="VARCHAR" />
  20. <result column="bk_text3" property="bk_text3" jdbcType="VARCHAR" />
  21. <result column="bk_text4" property="bk_text4" jdbcType="VARCHAR" />
  22. <result column="bk_text5" property="bk_text5" jdbcType="VARCHAR" />
  23. <result column="bk_remark" property="bk_remark" jdbcType="VARCHAR" />
  24. <result column="bk_spending" property="bk_spending" jdbcType="DOUBLE" />
  25. <result column="bk_income" property="bk_income" jdbcType="DOUBLE" />
  26. <result column="bk_currency" property="bk_currency" jdbcType="VARCHAR" />
  27. <result column="cr_rate" property="cr_rate" jdbcType="DOUBLE" />
  28. </resultMap>
  29. <resultMap id="ResultMapWithBLOBs" type="com.usoftchina.saas.document.entities.Bankinformation" extends="BaseResultMap" >
  30. <result column="bk_remark" property="bk_remark" jdbcType="LONGVARCHAR" />
  31. </resultMap>
  32. <sql id="Base_Column_List" >
  33. bk_id, bk_bankcode, bk_bankname, bk_date, bk_type, bk_beginamount, bk_thisamount,
  34. bk_status, bk_statuscode, bk_ym, bankinformation.companyid companyid,
  35. bankinformation.updaterId updaterId, bankinformation.updateTime updateTime, bk_text1, bk_text2, bk_text3, bk_text4, bk_text5, bk_remark,bk_currency,cr_rate
  36. </sql>
  37. <sql id="Blob_Column_List" >
  38. bk_remark
  39. </sql>
  40. <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" >
  41. select
  42. <include refid="Base_Column_List" />
  43. ,
  44. <include refid="Blob_Column_List" />
  45. from bankinformation
  46. where bk_id = #{id,jdbcType=INTEGER}
  47. </select>
  48. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  49. delete from bankinformation
  50. where bk_id = #{id,jdbcType=INTEGER}
  51. </delete>
  52. <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Bankinformation" >
  53. insert into bankinformation (bk_id, bk_bankcode, bk_bankname,
  54. bk_date, bk_type, bk_beginamount,
  55. bk_thisamount, bk_status, bk_statuscode,
  56. bk_ym, companyid, updaterId,
  57. updateTime, bk_text1, bk_text2,
  58. bk_text3, bk_text4, bk_text5,
  59. bk_remark,
  60. creatorId,createTime,creatorName)
  61. values (#{bk_bankcode,jdbcType=VARCHAR}, #{bk_bankname,jdbcType=VARCHAR},
  62. #{bk_date,jdbcType=TIMESTAMP}, #{bk_type,jdbcType=VARCHAR}, #{bk_beginamount,jdbcType=DOUBLE},
  63. #{bk_thisamount,jdbcType=DOUBLE}, #{bk_status,jdbcType=VARCHAR}, #{bk_statuscode,jdbcType=VARCHAR},
  64. #{bk_ym,jdbcType=INTEGER}, #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER},
  65. #{updateTime,jdbcType=TIMESTAMP}, #{bk_text1,jdbcType=VARCHAR}, #{bk_text2,jdbcType=VARCHAR},
  66. #{bk_text3,jdbcType=VARCHAR}, #{bk_text4,jdbcType=VARCHAR}, #{bk_text5,jdbcType=VARCHAR},
  67. #{bk_remark,jdbcType=LONGVARCHAR},
  68. #{creatorId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{creatorName,jdbcType=VARCHAR})
  69. </insert>
  70. <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Bankinformation" >
  71. insert into bankinformation
  72. <trim prefix="(" suffix=")" suffixOverrides="," >
  73. <if test="bk_bankcode != null" >
  74. bk_bankcode,
  75. </if>
  76. <if test="bk_bankname != null" >
  77. bk_bankname,
  78. </if>
  79. <if test="bk_date != null" >
  80. bk_date,
  81. </if>
  82. <if test="bk_type != null" >
  83. bk_type,
  84. </if>
  85. <if test="bk_beginamount != null" >
  86. bk_beginamount,
  87. </if>
  88. <if test="bk_thisamount != null" >
  89. bk_thisamount,
  90. </if>
  91. <if test="bk_status != null" >
  92. bk_status,
  93. </if>
  94. <if test="bk_statuscode != null" >
  95. bk_statuscode,
  96. </if>
  97. <if test="bk_ym != null" >
  98. bk_ym,
  99. </if>
  100. <if test="companyId != null" >
  101. companyid,
  102. </if>
  103. <if test="updaterId != null" >
  104. updaterId,
  105. </if>
  106. <if test="updateTime != null" >
  107. updateTime,
  108. </if>
  109. <if test="bk_text1 != null" >
  110. bk_text1,
  111. </if>
  112. <if test="bk_text2 != null" >
  113. bk_text2,
  114. </if>
  115. <if test="bk_text3 != null" >
  116. bk_text3,
  117. </if>
  118. <if test="bk_text4 != null" >
  119. bk_text4,
  120. </if>
  121. <if test="bk_text5 != null" >
  122. bk_text5,
  123. </if>
  124. <if test="bk_remark != null" >
  125. bk_remark,
  126. </if>
  127. <if test="bk_spending != null" >
  128. bk_spending,
  129. </if>
  130. <if test="bk_income != null" >
  131. bk_income,
  132. </if>
  133. <if test="creatorId != null" >
  134. creatorId,
  135. </if>
  136. <if test="createTime != null" >
  137. createTime,
  138. </if>
  139. <if test="creatorName != null" >
  140. creatorName,
  141. </if>
  142. <if test="bk_currency != null" >
  143. bk_currency,
  144. </if>
  145. </trim>
  146. <trim prefix="values (" suffix=")" suffixOverrides="," >
  147. <if test="bk_bankcode != null" >
  148. #{bk_bankcode,jdbcType=VARCHAR},
  149. </if>
  150. <if test="bk_bankname != null" >
  151. #{bk_bankname,jdbcType=VARCHAR},
  152. </if>
  153. <if test="bk_date != null" >
  154. #{bk_date,jdbcType=TIMESTAMP},
  155. </if>
  156. <if test="bk_type != null" >
  157. #{bk_type,jdbcType=VARCHAR},
  158. </if>
  159. <if test="bk_beginamount != null" >
  160. #{bk_beginamount,jdbcType=DOUBLE},
  161. </if>
  162. <if test="bk_thisamount != null" >
  163. #{bk_thisamount,jdbcType=DOUBLE},
  164. </if>
  165. <if test="bk_status != null" >
  166. #{bk_status,jdbcType=VARCHAR},
  167. </if>
  168. <if test="bk_statuscode != null" >
  169. #{bk_statuscode,jdbcType=VARCHAR},
  170. </if>
  171. <if test="bk_ym != null" >
  172. #{bk_ym,jdbcType=INTEGER},
  173. </if>
  174. <if test="companyId != null" >
  175. #{companyId,jdbcType=INTEGER},
  176. </if>
  177. <if test="updaterId != null" >
  178. #{updaterId,jdbcType=INTEGER},
  179. </if>
  180. <if test="updateTime != null" >
  181. #{updateTime,jdbcType=TIMESTAMP},
  182. </if>
  183. <if test="bk_text1 != null" >
  184. #{bk_text1,jdbcType=VARCHAR},
  185. </if>
  186. <if test="bk_text2 != null" >
  187. #{bk_text2,jdbcType=VARCHAR},
  188. </if>
  189. <if test="bk_text3 != null" >
  190. #{bk_text3,jdbcType=VARCHAR},
  191. </if>
  192. <if test="bk_text4 != null" >
  193. #{bk_text4,jdbcType=VARCHAR},
  194. </if>
  195. <if test="bk_text5 != null" >
  196. #{bk_text5,jdbcType=VARCHAR},
  197. </if>
  198. <if test="bk_remark != null" >
  199. #{bk_remark,jdbcType=LONGVARCHAR},
  200. </if>
  201. <if test="bk_spending != null" >
  202. #{bk_spending,jdbcType=DOUBLE},
  203. </if>
  204. <if test="bk_income != null" >
  205. #{bk_income,jdbcType=DOUBLE},
  206. </if>
  207. <if test="creatorId != null" >
  208. #{creatorId,jdbcType=INTEGER},
  209. </if>
  210. <if test="createTime != null" >
  211. #{createTime,jdbcType=TIMESTAMP},
  212. </if>
  213. <if test="creatorName != null" >
  214. #{creatorName,jdbcType=VARCHAR},
  215. </if>
  216. <if test="bk_currency != null" >
  217. #{bk_currency,jdbcType=VARCHAR},
  218. </if>
  219. </trim>
  220. <selectKey resultType="Long" keyProperty="id" order="AFTER">
  221. SELECT LAST_INSERT_ID()
  222. </selectKey>
  223. </insert>
  224. <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Bankinformation" >
  225. update bankinformation
  226. <set >
  227. <if test="bk_bankcode != null" >
  228. bk_bankcode = #{bk_bankcode,jdbcType=VARCHAR},
  229. </if>
  230. <if test="bk_bankname != null" >
  231. bk_bankname = #{bk_bankname,jdbcType=VARCHAR},
  232. </if>
  233. <if test="bk_date != null" >
  234. bk_date = #{bk_date,jdbcType=TIMESTAMP},
  235. </if>
  236. <if test="bk_type != null" >
  237. bk_type = #{bk_type,jdbcType=VARCHAR},
  238. </if>
  239. <if test="bk_beginamount != null" >
  240. bk_beginamount = #{bk_beginamount,jdbcType=DOUBLE},
  241. </if>
  242. <if test="bk_thisamount != null" >
  243. bk_thisamount = #{bk_thisamount,jdbcType=DOUBLE},
  244. </if>
  245. <if test="bk_status != null" >
  246. bk_status = #{bk_status,jdbcType=VARCHAR},
  247. </if>
  248. <if test="bk_statuscode != null" >
  249. bk_statuscode = #{bk_statuscode,jdbcType=VARCHAR},
  250. </if>
  251. <if test="bk_ym != null" >
  252. bk_ym = #{bk_ym,jdbcType=INTEGER},
  253. </if>
  254. <if test="companyId != null" >
  255. companyid = #{companyId,jdbcType=INTEGER},
  256. </if>
  257. <if test="updaterId != null" >
  258. updaterId = #{updaterId,jdbcType=INTEGER},
  259. </if>
  260. <if test="updateTime != null" >
  261. updateTime = #{updateTime,jdbcType=TIMESTAMP},
  262. </if>
  263. <if test="bk_text1 != null" >
  264. bk_text1 = #{bk_text1,jdbcType=VARCHAR},
  265. </if>
  266. <if test="bk_text2 != null" >
  267. bk_text2 = #{bk_text2,jdbcType=VARCHAR},
  268. </if>
  269. <if test="bk_text3 != null" >
  270. bk_text3 = #{bk_text3,jdbcType=VARCHAR},
  271. </if>
  272. <if test="bk_text4 != null" >
  273. bk_text4 = #{bk_text4,jdbcType=VARCHAR},
  274. </if>
  275. <if test="bk_text5 != null" >
  276. bk_text5 = #{bk_text5,jdbcType=VARCHAR},
  277. </if>
  278. <if test="bk_remark != null" >
  279. bk_remark = #{bk_remark,jdbcType=LONGVARCHAR},
  280. </if>
  281. <if test="bk_income != null" >
  282. bk_income = #{bk_income,jdbcType=DOUBLE},
  283. </if>
  284. <if test="bk_spending != null" >
  285. bk_spending = #{bk_spending,jdbcType=DOUBLE},
  286. </if>
  287. <if test="bk_currency != null" >
  288. bk_currency = #{bk_currency,jdbcType=VARCHAR},
  289. </if>
  290. </set>
  291. where bk_id = #{id,jdbcType=INTEGER}
  292. </update>
  293. <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.usoftchina.saas.document.entities.Bankinformation" >
  294. update bankinformation
  295. set bk_bankcode = #{bkBankcode,jdbcType=VARCHAR},
  296. bk_bankname = #{bkBankname,jdbcType=VARCHAR},
  297. bk_date = #{bkDate,jdbcType=TIMESTAMP},
  298. bk_type = #{bkType,jdbcType=VARCHAR},
  299. bk_beginamount = #{bkBeginamount,jdbcType=DOUBLE},
  300. bk_thisamount = #{bkThisamount,jdbcType=DOUBLE},
  301. bk_status = #{bkStatus,jdbcType=VARCHAR},
  302. bk_statuscode = #{bkStatuscode,jdbcType=VARCHAR},
  303. bk_ym = #{bkYm,jdbcType=INTEGER},
  304. companyid = #{companyId,jdbcType=INTEGER},
  305. updaterId = #{updaterId,jdbcType=INTEGER},
  306. updateTime = #{updateTime,jdbcType=TIMESTAMP},
  307. bk_text1 = #{bkText1,jdbcType=VARCHAR},
  308. bk_text2 = #{bkText2,jdbcType=VARCHAR},
  309. bk_text3 = #{bkText3,jdbcType=VARCHAR},
  310. bk_text4 = #{bkText4,jdbcType=VARCHAR},
  311. bk_text5 = #{bkText5,jdbcType=VARCHAR},
  312. bk_remark = #{bkRemark,jdbcType=LONGVARCHAR}
  313. where bk_id = #{bkId,jdbcType=INTEGER}
  314. </update>
  315. <select id="selectAll" resultMap="BaseResultMap">
  316. SELECT * FROM bankinformation
  317. </select>
  318. <select id="selectBankinformationBycondition" resultMap="BaseResultMap">
  319. select
  320. <include refid="Base_Column_List" />
  321. from bankinformation
  322. left join currencys on currencys.companyId = Bankinformation.companyid and cr_name = bk_currency
  323. <where>
  324. <if test="con != null">
  325. ${con}
  326. </if>
  327. <if test="companyId != null">
  328. and bankinformation.companyId = #{companyId}
  329. </if>
  330. </where> order by bk_date desc, bk_id desc
  331. </select>
  332. <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
  333. SELECT CONCAT(bk_bankcode,' ',bk_bankname) display,bk_bankname value FROM bankinformation WHERE COMPANYID=#{companyId} order by bk_date desc, bk_id desc
  334. </select>
  335. <select id="selectBankcode" resultType="java.lang.Integer">
  336. select count(0) from bankinformation where
  337. bk_bankcode = #{bk_bankcode,jdbcType=VARCHAR} and bk_id = #{id}
  338. </select>
  339. <select id="selectBankId" resultType="java.lang.Long">
  340. select bk_id from bankinformation where bk_bankcode = #{bk_bankcode,jdbcType=VARCHAR} and companyId = #{companyId}
  341. </select>
  342. <select id="selectamount" parameterType="java.lang.Long" resultType="java.lang.Double">
  343. select bk_beginamount from bankinformation where bk_id = #{bk_id,jdbcType=INTEGER}
  344. </select>
  345. <select id="check" parameterMap="checkParamMap" statementType="CALLABLE">
  346. CALL SP_LIMITBASE(?, ?, ?, ?,?)
  347. </select>
  348. <parameterMap id="checkParamMap" type="java.util.Map">
  349. <parameter property="v_type" jdbcType="VARCHAR" mode="IN" />
  350. <parameter property="v_id" jdbcType="INTEGER" mode="IN" />
  351. <parameter property="v_code" jdbcType="VARCHAR" mode="IN" />
  352. <parameter property="v_companyid" jdbcType="INTEGER" mode="IN" />
  353. <parameter property="v_res" jdbcType="VARCHAR" mode="OUT" />
  354. </parameterMap>
  355. <select id="validateCodeWhenInsert" resultType="int">
  356. select count(*) from bankinformation where bk_bankcode = #{code} and companyId =#{companyId}
  357. </select>
  358. <select id="validateCodeWhenUpdate" resultType="int" >
  359. select count(*) from bankinformation where bk_bankcode = #{code} and bk_id != #{id} and companyId =#{companyId}
  360. </select>
  361. <select id="getBankNameSame" resultType="int">
  362. select count(*) from bankinformation where bk_bankname = #{name} and companyId =#{companyId}
  363. </select>
  364. <select id="getBankNameSameById" resultType="int">
  365. select count(*) from bankinformation where bk_bankname = #{name} and bk_id != #{id} and companyId =#{companyId}
  366. </select>
  367. </mapper>