PaymentStatisticsDao.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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="cn.ourwill.module.house.dao.dm.PaymentStatisticsDao">
  4. <resultMap type="cn.ourwill.module.house.entity.dm.PaymentStatistics" id="baseMap">
  5. <result column="grain_id" property="grainId"/>
  6. <result column="grain_name" property="grainName"/>
  7. <result column="feeType" property="feeType"/>
  8. <result column="fee" property="fee"/>
  9. <result column="feeDate" property="feeDate"/>
  10. </resultMap>
  11. <sql id="columns">
  12. grain_id ,
  13. grain_name ,
  14. feeType ,
  15. fee ,
  16. feeDate
  17. </sql>
  18. <sql id="joinCols">
  19. </sql>
  20. <select id="get" resultMap="baseMap">
  21. SELECT
  22. <include refid="columns"/>
  23. FROM daily_payment_statistics a
  24. <include refid="joinCols"/>
  25. WHERE a.grain_id = #{id}
  26. </select>
  27. <select id="findList" resultMap="baseMap">
  28. SELECT
  29. <include refid="columns"/>
  30. FROM daily_payment_statistics a
  31. <include refid="joinCols"/>
  32. <where>
  33. <if test="grainId !=null">
  34. and grain_id = #{grainId}
  35. </if>
  36. <if test="grainName !=null">
  37. and grain_name = #{grainName}
  38. </if>
  39. <if test="feeType !=null">
  40. and feeType = #{feeType}
  41. </if>
  42. <if test="fee !=null">
  43. and fee = #{fee}
  44. </if>
  45. <if test="feeDate !=null">
  46. and feeDate = #{feeDate}
  47. </if>
  48. </where>
  49. <choose>
  50. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  51. ORDER BY ${page.orderBy}
  52. </when>
  53. <otherwise>
  54. </otherwise>
  55. </choose>
  56. </select>
  57. <select id="findAllList" resultMap="baseMap">
  58. SELECT
  59. <include refid="columns"/>
  60. FROM daily_payment_statistics a
  61. <include refid="joinCols"/>
  62. <where>
  63. <if test="grainId !=null">
  64. and grain_id = #{grainId}
  65. </if>
  66. <if test="grainName !=null">
  67. and grain_name = #{grainName}
  68. </if>
  69. <if test="feeType !=null">
  70. and feeType = #{feeType}
  71. </if>
  72. <if test="fee !=null">
  73. and fee = #{fee}
  74. </if>
  75. <if test="beginFeeDate !=null">
  76. and feeDate &gt;= #{beginFeeDate}
  77. </if>
  78. <if test="endFeeDate !=null">
  79. and feeDate &lt; #{endFeeDate}
  80. </if>
  81. </where>
  82. <choose>
  83. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  84. ORDER BY ${page.orderBy}
  85. </when>
  86. <otherwise>
  87. </otherwise>
  88. </choose>
  89. </select>
  90. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  91. parameterType="cn.ourwill.module.house.entity.dm.PaymentStatistics">
  92. INSERT INTO daily_payment_statistics
  93. <trim prefix="(" suffix=")" suffixOverrides=",">
  94. <if test=" grainId != null">
  95. grain_id,
  96. </if>
  97. <if test=" grainName != null">
  98. grain_name,
  99. </if>
  100. <if test=" feeType != null">
  101. feeType,
  102. </if>
  103. <if test=" fee != null">
  104. fee,
  105. </if>
  106. <if test=" feeDate != null">
  107. feeDate
  108. </if>
  109. </trim>
  110. <trim prefix="values (" suffix=")" suffixOverrides=",">
  111. <if test=" grainId != null">
  112. #{grainId}, </if>
  113. <if test=" grainName != null">
  114. #{grainName}, </if>
  115. <if test=" feeType != null">
  116. #{feeType}, </if>
  117. <if test=" fee != null">
  118. #{fee}, </if>
  119. <if test=" feeDate != null">
  120. #{feeDate} </if>
  121. </trim>
  122. </insert>
  123. <update id="update" parameterType="cn.ourwill.module.house.entity.dm.PaymentStatistics">
  124. UPDATE daily_payment_statistics <set>
  125. <if test="grainId != null">
  126. grain_id= #{grainId} ,
  127. </if>
  128. <if test="grainName != null">
  129. grain_name= #{grainName} ,
  130. </if>
  131. <if test="feeType != null">
  132. feeType= #{feeType} ,
  133. </if>
  134. <if test="fee != null">
  135. fee= #{fee} ,
  136. </if>
  137. <if test="feeDate != null">
  138. feeDate= #{feeDate}
  139. </if>
  140. </set>
  141. WHERE id = #{id}
  142. </update>
  143. <delete id="deleteById" parameterType="java.lang.Long">
  144. DELETE FROM daily_payment_statistics WHERE id = #{id}
  145. </delete>
  146. <delete id="deleteByIds" parameterType="java.util.List">
  147. DELETE FROM daily_payment_statistics WHERE id IN
  148. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  149. #{item}
  150. </foreach>
  151. </delete>
  152. </mapper>