BillDOMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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.cdu.lys.graduation.repository.dao.BillDOMapper" >
  4. <resultMap id="BaseResultMap" type="com.cdu.lys.graduation.repository.entity.BillDO" >
  5. <constructor >
  6. <idArg column="id" jdbcType="INTEGER" javaType="java.lang.Integer" />
  7. <arg column="total_order_amount" jdbcType="DOUBLE" javaType="java.lang.Double" />
  8. <arg column="total_actual_amount" jdbcType="DOUBLE" javaType="java.lang.Double" />
  9. <arg column="total_cost" jdbcType="DOUBLE" javaType="java.lang.Double" />
  10. <arg column="net_income" jdbcType="DOUBLE" javaType="java.lang.Double" />
  11. <arg column="total_number" jdbcType="INTEGER" javaType="java.lang.Integer" />
  12. <arg column="cancel_number" jdbcType="INTEGER" javaType="java.lang.Integer" />
  13. <arg column="bill_date" jdbcType="TIMESTAMP" javaType="java.util.Date" />
  14. </constructor>
  15. </resultMap>
  16. <sql id="Example_Where_Clause" >
  17. <where >
  18. <foreach collection="oredCriteria" item="criteria" separator="or" >
  19. <if test="criteria.valid" >
  20. <trim prefix="(" suffix=")" prefixOverrides="and" >
  21. <foreach collection="criteria.criteria" item="criterion" >
  22. <choose >
  23. <when test="criterion.noValue" >
  24. and ${criterion.condition}
  25. </when>
  26. <when test="criterion.singleValue" >
  27. and ${criterion.condition} #{criterion.value}
  28. </when>
  29. <when test="criterion.betweenValue" >
  30. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  31. </when>
  32. <when test="criterion.listValue" >
  33. and ${criterion.condition}
  34. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  35. #{listItem}
  36. </foreach>
  37. </when>
  38. </choose>
  39. </foreach>
  40. </trim>
  41. </if>
  42. </foreach>
  43. </where>
  44. </sql>
  45. <sql id="Update_By_Example_Where_Clause" >
  46. <where >
  47. <foreach collection="example.oredCriteria" item="criteria" separator="or" >
  48. <if test="criteria.valid" >
  49. <trim prefix="(" suffix=")" prefixOverrides="and" >
  50. <foreach collection="criteria.criteria" item="criterion" >
  51. <choose >
  52. <when test="criterion.noValue" >
  53. and ${criterion.condition}
  54. </when>
  55. <when test="criterion.singleValue" >
  56. and ${criterion.condition} #{criterion.value}
  57. </when>
  58. <when test="criterion.betweenValue" >
  59. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  60. </when>
  61. <when test="criterion.listValue" >
  62. and ${criterion.condition}
  63. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  64. #{listItem}
  65. </foreach>
  66. </when>
  67. </choose>
  68. </foreach>
  69. </trim>
  70. </if>
  71. </foreach>
  72. </where>
  73. </sql>
  74. <sql id="Base_Column_List" >
  75. id, total_order_amount, total_actual_amount, total_cost, net_income, total_number,
  76. cancel_number, bill_date
  77. </sql>
  78. <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.cdu.lys.graduation.repository.entity.BillDOExample" >
  79. select
  80. <if test="distinct" >
  81. distinct
  82. </if>
  83. 'true' as QUERYID,
  84. <include refid="Base_Column_List" />
  85. from tb_bill
  86. <if test="_parameter != null" >
  87. <include refid="Example_Where_Clause" />
  88. </if>
  89. <if test="orderByClause != null" >
  90. order by ${orderByClause}
  91. </if>
  92. </select>
  93. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  94. select
  95. <include refid="Base_Column_List" />
  96. from tb_bill
  97. where id = #{id,jdbcType=INTEGER}
  98. </select>
  99. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  100. delete from tb_bill
  101. where id = #{id,jdbcType=INTEGER}
  102. </delete>
  103. <delete id="deleteByExample" parameterType="com.cdu.lys.graduation.repository.entity.BillDOExample" >
  104. delete from tb_bill
  105. <if test="_parameter != null" >
  106. <include refid="Example_Where_Clause" />
  107. </if>
  108. </delete>
  109. <insert id="insert" parameterType="com.cdu.lys.graduation.repository.entity.BillDO" >
  110. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  111. SELECT LAST_INSERT_ID()
  112. </selectKey>
  113. insert into tb_bill (total_order_amount, total_actual_amount,
  114. total_cost, net_income, total_number,
  115. cancel_number, bill_date)
  116. values (#{totalOrderAmount,jdbcType=DOUBLE}, #{totalActualAmount,jdbcType=DOUBLE},
  117. #{totalCost,jdbcType=DOUBLE}, #{netIncome,jdbcType=DOUBLE}, #{totalNumber,jdbcType=INTEGER},
  118. #{cancelNumber,jdbcType=INTEGER}, #{billDate,jdbcType=TIMESTAMP})
  119. </insert>
  120. <insert id="insertSelective" parameterType="com.cdu.lys.graduation.repository.entity.BillDO" >
  121. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  122. SELECT LAST_INSERT_ID()
  123. </selectKey>
  124. insert into tb_bill
  125. <trim prefix="(" suffix=")" suffixOverrides="," >
  126. <if test="totalOrderAmount != null" >
  127. total_order_amount,
  128. </if>
  129. <if test="totalActualAmount != null" >
  130. total_actual_amount,
  131. </if>
  132. <if test="totalCost != null" >
  133. total_cost,
  134. </if>
  135. <if test="netIncome != null" >
  136. net_income,
  137. </if>
  138. <if test="totalNumber != null" >
  139. total_number,
  140. </if>
  141. <if test="cancelNumber != null" >
  142. cancel_number,
  143. </if>
  144. <if test="billDate != null" >
  145. bill_date,
  146. </if>
  147. </trim>
  148. <trim prefix="values (" suffix=")" suffixOverrides="," >
  149. <if test="totalOrderAmount != null" >
  150. #{totalOrderAmount,jdbcType=DOUBLE},
  151. </if>
  152. <if test="totalActualAmount != null" >
  153. #{totalActualAmount,jdbcType=DOUBLE},
  154. </if>
  155. <if test="totalCost != null" >
  156. #{totalCost,jdbcType=DOUBLE},
  157. </if>
  158. <if test="netIncome != null" >
  159. #{netIncome,jdbcType=DOUBLE},
  160. </if>
  161. <if test="totalNumber != null" >
  162. #{totalNumber,jdbcType=INTEGER},
  163. </if>
  164. <if test="cancelNumber != null" >
  165. #{cancelNumber,jdbcType=INTEGER},
  166. </if>
  167. <if test="billDate != null" >
  168. #{billDate,jdbcType=TIMESTAMP},
  169. </if>
  170. </trim>
  171. </insert>
  172. <select id="countByExample" parameterType="com.cdu.lys.graduation.repository.entity.BillDOExample" resultType="java.lang.Integer" >
  173. select count(*) from tb_bill
  174. <if test="_parameter != null" >
  175. <include refid="Example_Where_Clause" />
  176. </if>
  177. </select>
  178. <update id="updateByExampleSelective" parameterType="map" >
  179. update tb_bill
  180. <set >
  181. <if test="record.id != null" >
  182. id = #{record.id,jdbcType=INTEGER},
  183. </if>
  184. <if test="record.totalOrderAmount != null" >
  185. total_order_amount = #{record.totalOrderAmount,jdbcType=DOUBLE},
  186. </if>
  187. <if test="record.totalActualAmount != null" >
  188. total_actual_amount = #{record.totalActualAmount,jdbcType=DOUBLE},
  189. </if>
  190. <if test="record.totalCost != null" >
  191. total_cost = #{record.totalCost,jdbcType=DOUBLE},
  192. </if>
  193. <if test="record.netIncome != null" >
  194. net_income = #{record.netIncome,jdbcType=DOUBLE},
  195. </if>
  196. <if test="record.totalNumber != null" >
  197. total_number = #{record.totalNumber,jdbcType=INTEGER},
  198. </if>
  199. <if test="record.cancelNumber != null" >
  200. cancel_number = #{record.cancelNumber,jdbcType=INTEGER},
  201. </if>
  202. <if test="record.billDate != null" >
  203. bill_date = #{record.billDate,jdbcType=TIMESTAMP},
  204. </if>
  205. </set>
  206. <if test="_parameter != null" >
  207. <include refid="Update_By_Example_Where_Clause" />
  208. </if>
  209. </update>
  210. <update id="updateByExample" parameterType="map" >
  211. update tb_bill
  212. set id = #{record.id,jdbcType=INTEGER},
  213. total_order_amount = #{record.totalOrderAmount,jdbcType=DOUBLE},
  214. total_actual_amount = #{record.totalActualAmount,jdbcType=DOUBLE},
  215. total_cost = #{record.totalCost,jdbcType=DOUBLE},
  216. net_income = #{record.netIncome,jdbcType=DOUBLE},
  217. total_number = #{record.totalNumber,jdbcType=INTEGER},
  218. cancel_number = #{record.cancelNumber,jdbcType=INTEGER},
  219. bill_date = #{record.billDate,jdbcType=TIMESTAMP}
  220. <if test="_parameter != null" >
  221. <include refid="Update_By_Example_Where_Clause" />
  222. </if>
  223. </update>
  224. <update id="updateByPrimaryKeySelective" parameterType="com.cdu.lys.graduation.repository.entity.BillDO" >
  225. update tb_bill
  226. <set >
  227. <if test="totalOrderAmount != null" >
  228. total_order_amount = #{totalOrderAmount,jdbcType=DOUBLE},
  229. </if>
  230. <if test="totalActualAmount != null" >
  231. total_actual_amount = #{totalActualAmount,jdbcType=DOUBLE},
  232. </if>
  233. <if test="totalCost != null" >
  234. total_cost = #{totalCost,jdbcType=DOUBLE},
  235. </if>
  236. <if test="netIncome != null" >
  237. net_income = #{netIncome,jdbcType=DOUBLE},
  238. </if>
  239. <if test="totalNumber != null" >
  240. total_number = #{totalNumber,jdbcType=INTEGER},
  241. </if>
  242. <if test="cancelNumber != null" >
  243. cancel_number = #{cancelNumber,jdbcType=INTEGER},
  244. </if>
  245. <if test="billDate != null" >
  246. bill_date = #{billDate,jdbcType=TIMESTAMP},
  247. </if>
  248. </set>
  249. where id = #{id,jdbcType=INTEGER}
  250. </update>
  251. <update id="updateByPrimaryKey" parameterType="com.cdu.lys.graduation.repository.entity.BillDO" >
  252. update tb_bill
  253. set total_order_amount = #{totalOrderAmount,jdbcType=DOUBLE},
  254. total_actual_amount = #{totalActualAmount,jdbcType=DOUBLE},
  255. total_cost = #{totalCost,jdbcType=DOUBLE},
  256. net_income = #{netIncome,jdbcType=DOUBLE},
  257. total_number = #{totalNumber,jdbcType=INTEGER},
  258. cancel_number = #{cancelNumber,jdbcType=INTEGER},
  259. bill_date = #{billDate,jdbcType=TIMESTAMP}
  260. where id = #{id,jdbcType=INTEGER}
  261. </update>
  262. </mapper>