BankinformationMapper.xml 14 KB

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