AmbInvestMapper.xml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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.goafanti.common.dao.AmbInvestMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.AmbInvest">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="initiate_amb_id" jdbcType="BIGINT" property="initiateAmbId" />
  7. <result column="accept_amb_id" jdbcType="BIGINT" property="acceptAmbId" />
  8. <result column="amount" jdbcType="DECIMAL" property="amount" />
  9. <result column="status" jdbcType="INTEGER" property="status" />
  10. <result column="operator" jdbcType="VARCHAR" property="operator" />
  11. <result column="comment" jdbcType="VARCHAR" property="comment" />
  12. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  13. <result column="count_amount" jdbcType="DECIMAL" property="countAmount" />
  14. </resultMap>
  15. <sql id="Base_Column_List">
  16. id, initiate_amb_id, accept_amb_id, amount, `status`, `operator`, `comment`, create_time,
  17. count_amount
  18. </sql>
  19. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  20. select
  21. <include refid="Base_Column_List" />
  22. from amb_invest
  23. where id = #{id,jdbcType=BIGINT}
  24. </select>
  25. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  26. delete from amb_invest
  27. where id = #{id,jdbcType=BIGINT}
  28. </delete>
  29. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbInvest" useGeneratedKeys="true">
  30. insert into amb_invest (initiate_amb_id, accept_amb_id, amount,
  31. `status`, `operator`, `comment`,
  32. create_time, count_amount)
  33. values (#{initiateAmbId,jdbcType=BIGINT}, #{acceptAmbId,jdbcType=BIGINT}, #{amount,jdbcType=DECIMAL},
  34. #{status,jdbcType=INTEGER}, #{operator,jdbcType=VARCHAR}, #{comment,jdbcType=VARCHAR},
  35. #{createTime,jdbcType=TIMESTAMP}, #{countAmount,jdbcType=DECIMAL})
  36. </insert>
  37. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbInvest" useGeneratedKeys="true">
  38. insert into amb_invest
  39. <trim prefix="(" suffix=")" suffixOverrides=",">
  40. <if test="initiateAmbId != null">
  41. initiate_amb_id,
  42. </if>
  43. <if test="acceptAmbId != null">
  44. accept_amb_id,
  45. </if>
  46. <if test="amount != null">
  47. amount,
  48. </if>
  49. <if test="status != null">
  50. `status`,
  51. </if>
  52. <if test="operator != null">
  53. `operator`,
  54. </if>
  55. <if test="comment != null">
  56. `comment`,
  57. </if>
  58. <if test="createTime != null">
  59. create_time,
  60. </if>
  61. <if test="countAmount != null">
  62. count_amount,
  63. </if>
  64. </trim>
  65. <trim prefix="values (" suffix=")" suffixOverrides=",">
  66. <if test="initiateAmbId != null">
  67. #{initiateAmbId,jdbcType=BIGINT},
  68. </if>
  69. <if test="acceptAmbId != null">
  70. #{acceptAmbId,jdbcType=BIGINT},
  71. </if>
  72. <if test="amount != null">
  73. #{amount,jdbcType=DECIMAL},
  74. </if>
  75. <if test="status != null">
  76. #{status,jdbcType=INTEGER},
  77. </if>
  78. <if test="operator != null">
  79. #{operator,jdbcType=VARCHAR},
  80. </if>
  81. <if test="comment != null">
  82. #{comment,jdbcType=VARCHAR},
  83. </if>
  84. <if test="createTime != null">
  85. #{createTime,jdbcType=TIMESTAMP},
  86. </if>
  87. <if test="countAmount != null">
  88. #{countAmount,jdbcType=DECIMAL},
  89. </if>
  90. </trim>
  91. </insert>
  92. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AmbInvest">
  93. update amb_invest
  94. <set>
  95. <if test="initiateAmbId != null">
  96. initiate_amb_id = #{initiateAmbId,jdbcType=BIGINT},
  97. </if>
  98. <if test="acceptAmbId != null">
  99. accept_amb_id = #{acceptAmbId,jdbcType=BIGINT},
  100. </if>
  101. <if test="amount != null">
  102. amount = #{amount,jdbcType=DECIMAL},
  103. </if>
  104. <if test="status != null">
  105. `status` = #{status,jdbcType=INTEGER},
  106. </if>
  107. <if test="operator != null">
  108. `operator` = #{operator,jdbcType=VARCHAR},
  109. </if>
  110. <if test="comment != null">
  111. `comment` = #{comment,jdbcType=VARCHAR},
  112. </if>
  113. <if test="createTime != null">
  114. create_time = #{createTime,jdbcType=TIMESTAMP},
  115. </if>
  116. <if test="countAmount != null">
  117. count_amount = #{countAmount,jdbcType=DECIMAL},
  118. </if>
  119. </set>
  120. where id = #{id,jdbcType=BIGINT}
  121. </update>
  122. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.AmbInvest">
  123. update amb_invest
  124. set initiate_amb_id = #{initiateAmbId,jdbcType=BIGINT},
  125. accept_amb_id = #{acceptAmbId,jdbcType=BIGINT},
  126. amount = #{amount,jdbcType=DECIMAL},
  127. `status` = #{status,jdbcType=INTEGER},
  128. `operator` = #{operator,jdbcType=VARCHAR},
  129. `comment` = #{comment,jdbcType=VARCHAR},
  130. create_time = #{createTime,jdbcType=TIMESTAMP},
  131. count_amount = #{countAmount,jdbcType=DECIMAL}
  132. where id = #{id,jdbcType=BIGINT}
  133. </update>
  134. <select id="selectInvestList" resultType="com.goafanti.ambSystem.bo.OutInvestList">
  135. select a.id,b.name initiateName,c.name acceptName,a.amount ,a.status ,d.name operator,a.comment ,
  136. date_format(a.create_time,'%Y-%m-%d %H:%i:%S') createTimes
  137. from amb_invest a left join amb_system b on a.initiate_amb_id =b.id
  138. left join amb_system c on a.accept_amb_id =c.id
  139. left join admin d on a.operator =d.id
  140. where 1=1
  141. <if test="roleType==1">
  142. and a.status in (1,2,3)
  143. </if>
  144. order by a.create_time desc
  145. <if test="page_sql !=null">
  146. ${page_sql}
  147. </if>
  148. </select>
  149. <select id="selectInvestCount" resultType="integer">
  150. select count(*)
  151. from amb_invest a
  152. where 1=1
  153. <if test="roleType==1">
  154. and a.status in (1,2,3)
  155. </if>
  156. </select>
  157. <select id="selectCountAmountById" resultType="java.lang.Integer">
  158. select sum(amount)amount
  159. from amb_invest
  160. where status=2 and accept_amb_id = #{id}
  161. </select>
  162. <select id="selectAmbInvestDtailsList" resultType="com.goafanti.ambSystem.bo.OutInvestList">
  163. select a.id,a.initiate_amb_id initiateAmbId ,a.accept_amb_id acceptAmbId,a.amount ,a.status ,
  164. a.comment , date_format(a.create_time,'%Y-%m-%d %H:%i:%S') createTimes,
  165. b.name initiateName,c.name acceptName,d.name operator
  166. from amb_invest a left join amb_system b on a.initiate_amb_id =b.id
  167. left join amb_system c on a.accept_amb_id =c.id left join admin d on a.operator =d.id
  168. where a.status =2
  169. <if test="type==0">
  170. and a.initiate_amb_id= #{id}
  171. </if>
  172. <if test="type==1">
  173. and a.accept_amb_id = #{id}
  174. </if>
  175. order by a.create_time desc
  176. </select>
  177. </mapper>