SubledgerMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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.SubledgerMapper" >
  4. <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Subledger" >
  5. <id column="sl_id" property="id" jdbcType="INTEGER" />
  6. <result column="sl_code" property="sl_code" jdbcType="VARCHAR" />
  7. <result column="sl_kind" property="sl_kind" jdbcType="VARCHAR" />
  8. <result column="sl_custid" property="sl_custid" jdbcType="INTEGER" />
  9. <result column="sl_vendid" property="sl_vendid" jdbcType="INTEGER" />
  10. <result column="sl_date" property="sl_date" jdbcType="TIMESTAMP" />
  11. <result column="sl_amount" property="sl_amount" jdbcType="DOUBLE" />
  12. <result column="sl_preamount" property="sl_preamount" jdbcType="DOUBLE" />
  13. <result column="sl_yamount" property="sl_yamount" jdbcType="DOUBLE" />
  14. <result column="sl_namount" property="sl_namount" jdbcType="DOUBLE" />
  15. <result column="sl_remark" property="sl_remark" jdbcType="VARCHAR" />
  16. <result column="companyId" property="companyId" jdbcType="INTEGER" />
  17. <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
  18. <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
  19. <result column="sl_orderamount" property="sl_orderamount" jdbcType="DOUBLE" />
  20. <result column="sl_discount" property="sl_discount" jdbcType="DOUBLE" />
  21. <result column="sl_ym" property="sl_ym" jdbcType="INTEGER" />
  22. </resultMap>
  23. <sql id="Base_Column_List" >
  24. sl_id, sl_code, sl_kind, sl_custid, sl_vendid, sl_date, sl_amount, sl_preamount,
  25. sl_yamount, sl_namount, sl_remark, companyId, updaterId, updateTime, sl_orderamount,
  26. sl_discount, sl_ym
  27. </sql>
  28. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  29. select
  30. <include refid="Base_Column_List" />
  31. from subledger
  32. where sl_id = #{sl_id,jdbcType=INTEGER}
  33. </select>
  34. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  35. delete from subledger
  36. where sl_code = #{code,jdbcType=VARCHAR} and sl_kind = #{kind, jdbcType=VARCHAR}
  37. </delete>
  38. <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Subledger" >
  39. insert into subledger (sl_id, sl_code, sl_kind,
  40. sl_custid, sl_vendid, sl_date,
  41. sl_amount, sl_preamount, sl_yamount,
  42. sl_namount, sl_remark, companyId,
  43. updaterId, updateTime, sl_orderamount,
  44. sl_discount, sl_ym,
  45. creatorId,createTime,creatorName)
  46. values (#{sl_id,jdbcType=INTEGER}, #{sl_code,jdbcType=VARCHAR}, #{sl_kind,jdbcType=VARCHAR},
  47. #{sl_custid,jdbcType=INTEGER}, #{sl_vendid,jdbcType=INTEGER}, #{sl_date,jdbcType=TIMESTAMP},
  48. #{sl_amount,jdbcType=DOUBLE}, #{sl_preamount,jdbcType=DOUBLE}, #{sl_yamount,jdbcType=DOUBLE},
  49. #{sl_namount,jdbcType=DOUBLE}, #{sl_remark,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER},
  50. #{updaterId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{sl_orderamount,jdbcType=DOUBLE},
  51. #{sl_discount,jdbcType=DOUBLE}, #{sl_ym,jdbcType=INTEGER},
  52. #{creatorId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{creatorName,jdbcType=VARCHAR})
  53. </insert>
  54. <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Subledger" >
  55. insert into subledger
  56. <trim prefix="(" suffix=")" suffixOverrides="," >
  57. <if test="sl_code != null" >
  58. sl_code,
  59. </if>
  60. <if test="sl_kind != null" >
  61. sl_kind,
  62. </if>
  63. <if test="sl_custid != null" >
  64. sl_custid,
  65. </if>
  66. <if test="sl_vendid != null" >
  67. sl_vendid,
  68. </if>
  69. <if test="sl_date != null" >
  70. sl_date,
  71. </if>
  72. <if test="sl_amount != null" >
  73. sl_amount,
  74. </if>
  75. <if test="sl_preamount != null" >
  76. sl_preamount,
  77. </if>
  78. <if test="sl_yamount != null" >
  79. sl_yamount,
  80. </if>
  81. <if test="sl_namount != null" >
  82. sl_namount,
  83. </if>
  84. <if test="sl_remark != null" >
  85. sl_remark,
  86. </if>
  87. <if test="companyId != null" >
  88. companyId,
  89. </if>
  90. <if test="updaterId != null" >
  91. updaterId,
  92. </if>
  93. <if test="updateTime != null" >
  94. updateTime,
  95. </if>
  96. <if test="sl_orderamount != null" >
  97. sl_orderamount,
  98. </if>
  99. <if test="sl_discount != null" >
  100. sl_discount,
  101. </if>
  102. <if test="sl_ym != null" >
  103. sl_ym,
  104. </if>
  105. <if test="creatorId != null" >
  106. creatorId,
  107. </if>
  108. <if test="createTime != null" >
  109. createTime,
  110. </if>
  111. <if test="creatorName != null" >
  112. creatorName,
  113. </if>
  114. </trim>
  115. <trim prefix="values (" suffix=")" suffixOverrides="," >
  116. <if test="sl_code != null" >
  117. #{sl_code,jdbcType=VARCHAR},
  118. </if>
  119. <if test="sl_kind != null" >
  120. #{sl_kind,jdbcType=VARCHAR},
  121. </if>
  122. <if test="sl_custid != null" >
  123. #{sl_custid,jdbcType=INTEGER},
  124. </if>
  125. <if test="sl_vendid != null" >
  126. #{sl_vendid,jdbcType=INTEGER},
  127. </if>
  128. <if test="sl_date != null" >
  129. #{sl_date,jdbcType=TIMESTAMP},
  130. </if>
  131. <if test="sl_amount != null" >
  132. #{sl_amount,jdbcType=DOUBLE},
  133. </if>
  134. <if test="sl_preamount != null" >
  135. #{sl_preamount,jdbcType=DOUBLE},
  136. </if>
  137. <if test="sl_yamount != null" >
  138. #{sl_yamount,jdbcType=DOUBLE},
  139. </if>
  140. <if test="sl_namount != null" >
  141. #{sl_namount,jdbcType=DOUBLE},
  142. </if>
  143. <if test="sl_remark != null" >
  144. #{sl_remark,jdbcType=VARCHAR},
  145. </if>
  146. <if test="companyId != null" >
  147. #{companyId,jdbcType=INTEGER},
  148. </if>
  149. <if test="updaterId != null" >
  150. #{updaterId,jdbcType=INTEGER},
  151. </if>
  152. <if test="updateTime != null" >
  153. #{updateTime,jdbcType=TIMESTAMP},
  154. </if>
  155. <if test="sl_orderamount != null" >
  156. #{sl_orderamount,jdbcType=DOUBLE},
  157. </if>
  158. <if test="sl_discount != null" >
  159. #{sl_discount,jdbcType=DOUBLE},
  160. </if>
  161. <if test="sl_ym != null" >
  162. #{sl_ym,jdbcType=INTEGER},
  163. </if>
  164. <if test="creatorId != null" >
  165. #{creatorId,jdbcType=INTEGER},
  166. </if>
  167. <if test="createTime != null" >
  168. #{createTime,jdbcType=TIMESTAMP},
  169. </if>
  170. <if test="creatorName != null" >
  171. #{creatorName,jdbcType=VARCHAR},
  172. </if>
  173. </trim>
  174. </insert>
  175. <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Subledger" >
  176. update subledger
  177. <set >
  178. <if test="sl_code != null" >
  179. sl_code = #{sl_code,jdbcType=VARCHAR},
  180. </if>
  181. <if test="sl_kind != null" >
  182. sl_kind = #{sl_kind,jdbcType=VARCHAR},
  183. </if>
  184. <if test="sl_custid != null" >
  185. sl_custid = #{sl_custid,jdbcType=INTEGER},
  186. </if>
  187. <if test="sl_vendid != null" >
  188. sl_vendid = #{sl_vendid,jdbcType=INTEGER},
  189. </if>
  190. <if test="sl_date != null" >
  191. sl_date = #{sl_date,jdbcType=TIMESTAMP},
  192. </if>
  193. <if test="sl_amount != null" >
  194. sl_amount = #{sl_amount,jdbcType=DOUBLE},
  195. </if>
  196. <if test="sl_preamount != null" >
  197. sl_preamount = #{sl_preamount,jdbcType=DOUBLE},
  198. </if>
  199. <if test="sl_yamount != null" >
  200. sl_yamount = #{sl_yamount,jdbcType=DOUBLE},
  201. </if>
  202. <if test="sl_namount != null" >
  203. sl_namount = #{sl_namount,jdbcType=DOUBLE},
  204. </if>
  205. <if test="sl_remark != null" >
  206. sl_remark = #{sl_remark,jdbcType=VARCHAR},
  207. </if>
  208. <if test="companyId != null" >
  209. companyId = #{companyId,jdbcType=INTEGER},
  210. </if>
  211. <if test="updaterId != null" >
  212. updaterId = #{updaterId,jdbcType=INTEGER},
  213. </if>
  214. <if test="updateTime != null" >
  215. updateTime = #{updateTime,jdbcType=TIMESTAMP},
  216. </if>
  217. <if test="sl_orderamount != null" >
  218. sl_orderamount = #{sl_orderamount,jdbcType=DOUBLE},
  219. </if>
  220. <if test="sl_discount != null" >
  221. sl_discount = #{sl_discount,jdbcType=DOUBLE},
  222. </if>
  223. <if test="sl_ym != null" >
  224. sl_ym = #{sl_ym,jdbcType=INTEGER},
  225. </if>
  226. </set>
  227. where sl_id = #{id,jdbcType=INTEGER}
  228. </update>
  229. <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Subledger" >
  230. update subledger
  231. set sl_code = #{sl_code,jdbcType=VARCHAR},
  232. sl_kind = #{sl_kind,jdbcType=VARCHAR},
  233. sl_custid = #{sl_custid,jdbcType=INTEGER},
  234. sl_vendid = #{sl_vendid,jdbcType=INTEGER},
  235. sl_date = #{sl_date,jdbcType=TIMESTAMP},
  236. sl_amount = #{sl_amount,jdbcType=DOUBLE},
  237. sl_preamount = #{sl_preamount,jdbcType=DOUBLE},
  238. sl_yamount = #{sl_yamount,jdbcType=DOUBLE},
  239. sl_namount = #{sl_namount,jdbcType=DOUBLE},
  240. sl_remark = #{sl_remark,jdbcType=VARCHAR},
  241. companyId = #{companyId,jdbcType=INTEGER},
  242. updaterId = #{updaterId,jdbcType=INTEGER},
  243. updateTime = #{updateTime,jdbcType=TIMESTAMP},
  244. sl_orderamount = #{sl_orderamount,jdbcType=DOUBLE},
  245. sl_discount = #{sl_discount,jdbcType=DOUBLE},
  246. sl_ym = #{sl_ym,jdbcType=INTEGER}
  247. where sl_id = #{sl_id,jdbcType=INTEGER}
  248. </update>
  249. <select id="selectSubledgerBycondition" resultMap="BaseResultMap">
  250. select
  251. <include refid="Base_Column_List" />
  252. from subledger
  253. <where>
  254. <if test="con != null">
  255. ${con}
  256. </if>
  257. <if test="companyId != null">
  258. and subledger.companyId = #{companyId}
  259. </if>
  260. </where> order by sl_date desc
  261. </select>
  262. <select id="selectCode" parameterType="java.lang.String" resultMap="BaseResultMap">
  263. select sl_code
  264. from subledger
  265. where sl_code = #{sl_code,jdbcType=VARCHAR}
  266. </select>
  267. <select id="selectByKindCodeCustid" resultType="java.lang.Long">
  268. select
  269. ifnull(sl_id,0)
  270. from subledger
  271. where sl_code = #{sl_code,jdbcType=VARCHAR} and sl_kind = #{sl_kind,jdbcType=VARCHAR} and
  272. sl_custid = #{sl_custid,jdbcType=INTEGER} and companyId = #{companyid,jdbcType=INTEGER}
  273. and sl_ym=#{sl_ym,jdbcType=VARCHAR}
  274. </select>
  275. <select id="selectByKindCodeVendid" resultType="java.lang.Long">
  276. select
  277. ifnull(sl_id,0)
  278. from subledger
  279. where sl_code = #{sl_code,jdbcType=VARCHAR} and sl_kind = #{sl_kind,jdbcType=VARCHAR} and
  280. sl_vendid = #{sl_vendid,jdbcType=INTEGER} and companyId = #{companyid,jdbcType=INTEGER}
  281. and sl_ym=#{sl_ym,jdbcType=VARCHAR}
  282. </select>
  283. <delete id="deleteCustomer">
  284. delete from subledger
  285. where sl_code = #{sl_code,jdbcType=VARCHAR} and sl_kind = #{sl_kind, jdbcType=VARCHAR} and
  286. sl_custid = #{sl_custid,jdbcType=INTEGER}
  287. </delete>
  288. <delete id="deleteVendor">
  289. delete from subledger
  290. where sl_code = #{sl_code,jdbcType=VARCHAR} and sl_kind = #{sl_kind, jdbcType=VARCHAR} and
  291. sl_vendid = #{sl_vendid,jdbcType=INTEGER}
  292. </delete>
  293. <select id="selectUnPeriod" resultType="string">
  294. select PD_DETNO from periodsdetail where companyid=#{companyId} and pd_status=99 order by PD_DETNO desc LIMIT 1;
  295. </select>
  296. </mapper>