StockCoinMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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.xc.dao.StockCoinMapper" >
  4. <resultMap id="BaseResultMap" type="com.xc.pojo.StockCoin" >
  5. <constructor >
  6. <idArg column="id" jdbcType="INTEGER" javaType="java.lang.Integer" />
  7. <arg column="coin_name" jdbcType="VARCHAR" javaType="java.lang.String" />
  8. <arg column="coin_code" jdbcType="VARCHAR" javaType="java.lang.String" />
  9. <arg column="coin_gid" jdbcType="VARCHAR" javaType="java.lang.String" />
  10. <arg column="dynamic_rate" jdbcType="INTEGER" javaType="java.lang.Integer" />
  11. <arg column="default_rate" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
  12. <arg column="is_use" jdbcType="INTEGER" javaType="java.lang.Integer" />
  13. <arg column="add_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
  14. <arg column="t_desc" jdbcType="VARCHAR" javaType="java.lang.String" />
  15. <arg column="service_charge" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
  16. </constructor>
  17. </resultMap>
  18. <sql id="Base_Column_List" >
  19. id, coin_name, coin_code, coin_gid, dynamic_rate, default_rate, is_use, add_time,
  20. t_desc, service_charge
  21. </sql>
  22. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  23. select
  24. <include refid="Base_Column_List" />
  25. from stock_coin
  26. where id = #{id,jdbcType=INTEGER}
  27. </select>
  28. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  29. delete from stock_coin
  30. where id = #{id,jdbcType=INTEGER}
  31. </delete>
  32. <insert id="insert" parameterType="com.xc.pojo.StockCoin" >
  33. insert into stock_coin (id, coin_name, coin_code,
  34. coin_gid, dynamic_rate, default_rate,
  35. is_use, add_time, t_desc
  36. )
  37. values (#{id,jdbcType=INTEGER}, #{coinName,jdbcType=VARCHAR}, #{coinCode,jdbcType=VARCHAR},
  38. #{coinGid,jdbcType=VARCHAR}, #{dynamicRate,jdbcType=INTEGER}, #{defaultRate,jdbcType=DECIMAL},
  39. #{isUse,jdbcType=INTEGER}, #{addTime,jdbcType=TIMESTAMP}, #{tDesc,jdbcType=VARCHAR}
  40. )
  41. </insert>
  42. <insert id="insertSelective" parameterType="com.xc.pojo.StockCoin" >
  43. insert into stock_coin
  44. <trim prefix="(" suffix=")" suffixOverrides="," >
  45. <if test="id != null" >
  46. id,
  47. </if>
  48. <if test="coinName != null" >
  49. coin_name,
  50. </if>
  51. <if test="coinCode != null" >
  52. coin_code,
  53. </if>
  54. <if test="coinGid != null" >
  55. coin_gid,
  56. </if>
  57. <if test="dynamicRate != null" >
  58. dynamic_rate,
  59. </if>
  60. <if test="defaultRate != null" >
  61. default_rate,
  62. </if>
  63. <if test="isUse != null" >
  64. is_use,
  65. </if>
  66. <if test="addTime != null" >
  67. add_time,
  68. </if>
  69. <if test="tDesc != null" >
  70. t_desc,
  71. </if>
  72. </trim>
  73. <trim prefix="values (" suffix=")" suffixOverrides="," >
  74. <if test="id != null" >
  75. #{id,jdbcType=INTEGER},
  76. </if>
  77. <if test="coinName != null" >
  78. #{coinName,jdbcType=VARCHAR},
  79. </if>
  80. <if test="coinCode != null" >
  81. #{coinCode,jdbcType=VARCHAR},
  82. </if>
  83. <if test="coinGid != null" >
  84. #{coinGid,jdbcType=VARCHAR},
  85. </if>
  86. <if test="dynamicRate != null" >
  87. #{dynamicRate,jdbcType=INTEGER},
  88. </if>
  89. <if test="defaultRate != null" >
  90. #{defaultRate,jdbcType=DECIMAL},
  91. </if>
  92. <if test="isUse != null" >
  93. #{isUse,jdbcType=INTEGER},
  94. </if>
  95. <if test="addTime != null" >
  96. #{addTime,jdbcType=TIMESTAMP},
  97. </if>
  98. <if test="tDesc != null" >
  99. #{tDesc,jdbcType=VARCHAR},
  100. </if>
  101. </trim>
  102. </insert>
  103. <update id="updateByPrimaryKeySelective" parameterType="com.xc.pojo.StockCoin" >
  104. update stock_coin
  105. <set >
  106. <if test="coinName != null" >
  107. coin_name = #{coinName,jdbcType=VARCHAR},
  108. </if>
  109. <if test="coinCode != null" >
  110. coin_code = #{coinCode,jdbcType=VARCHAR},
  111. </if>
  112. <if test="coinGid != null" >
  113. coin_gid = #{coinGid,jdbcType=VARCHAR},
  114. </if>
  115. <if test="dynamicRate != null" >
  116. dynamic_rate = #{dynamicRate,jdbcType=INTEGER},
  117. </if>
  118. <if test="defaultRate != null" >
  119. default_rate = #{defaultRate,jdbcType=DECIMAL},
  120. </if>
  121. <if test="isUse != null" >
  122. is_use = #{isUse,jdbcType=INTEGER},
  123. </if>
  124. <if test="addTime != null" >
  125. add_time = #{addTime,jdbcType=TIMESTAMP},
  126. </if>
  127. <if test="tDesc != null" >
  128. t_desc = #{tDesc,jdbcType=VARCHAR},
  129. </if>
  130. <if test="serviceCharge != null" >
  131. service_charge = #{serviceCharge,jdbcType=VARCHAR},
  132. </if>
  133. </set>
  134. where id = #{id,jdbcType=INTEGER}
  135. </update>
  136. <update id="updateByPrimaryKey" parameterType="com.xc.pojo.StockCoin" >
  137. update stock_coin
  138. set coin_name = #{coinName,jdbcType=VARCHAR},
  139. coin_code = #{coinCode,jdbcType=VARCHAR},
  140. coin_gid = #{coinGid,jdbcType=VARCHAR},
  141. dynamic_rate = #{dynamicRate,jdbcType=INTEGER},
  142. default_rate = #{defaultRate,jdbcType=DECIMAL},
  143. is_use = #{isUse,jdbcType=INTEGER},
  144. add_time = #{addTime,jdbcType=TIMESTAMP},
  145. t_desc = #{tDesc,jdbcType=VARCHAR}
  146. where id = #{id,jdbcType=INTEGER}
  147. </update>
  148. <select id="listByAdmin" parameterType="map" resultMap="BaseResultMap">
  149. SELECT
  150. <include refid="Base_Column_List"/>
  151. FROM stock_coin
  152. <where>
  153. <if test="coinName != null and coinName != '' ">
  154. and coin_name like CONCAT('%','${coinName}','%')
  155. </if>
  156. <if test="coinCode != null and coinCode != '' ">
  157. and coin_code like CONCAT('%','${coinCode}','%')
  158. </if>
  159. </where>
  160. </select>
  161. <select id="selectCoinByName" resultMap="BaseResultMap" parameterType="string">
  162. SELECT
  163. <include refid="Base_Column_List"/>
  164. FROM stock_coin
  165. WHERE coin_name = #{coinName}
  166. </select>
  167. <select id="selectCoinByCode" resultMap="BaseResultMap" parameterType="string">
  168. SELECT
  169. <include refid="Base_Column_List"/>
  170. FROM stock_coin
  171. WHERE coin_code = #{coinCode}
  172. </select>
  173. <select id="selectCoinByGid" resultMap="BaseResultMap" parameterType="string">
  174. SELECT
  175. <include refid="Base_Column_List"/>
  176. FROM stock_coin
  177. WHERE coin_gid = #{coinGid}
  178. </select>
  179. <select id="getSelectCoin" resultMap="BaseResultMap">
  180. SELECT
  181. <include refid="Base_Column_List"/>
  182. FROM stock_coin
  183. WHERE is_use = 1
  184. limit 1
  185. </select>
  186. </mapper>