AchievementOrderMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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.AchievementOrderMapper" >
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.AchievementOrder" >
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="serial_number" property="serialNumber" jdbcType="INTEGER" />
  7. <result column="achievement_id" property="achievementId" jdbcType="VARCHAR" />
  8. <result column="uid" property="uid" jdbcType="VARCHAR" />
  9. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  10. <result column="status" property="status" jdbcType="INTEGER" />
  11. <result column="intention_money" property="intentionMoney" jdbcType="INTEGER" />
  12. <result column="contract_money" property="contractMoney" jdbcType="INTEGER" />
  13. <result column="commission" property="commission" jdbcType="INTEGER" />
  14. <result column="service_money" property="serviceMoney" jdbcType="INTEGER" />
  15. <result column="refund" property="refund" jdbcType="INTEGER" />
  16. <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
  17. </resultMap>
  18. <sql id="Base_Column_List" >
  19. id, serial_number, achievement_id, uid, create_time, status, intention_money, contract_money,
  20. commission, service_money, refund, deleted_sign
  21. </sql>
  22. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  23. select
  24. <include refid="Base_Column_List" />
  25. from achievement_order
  26. where id = #{id,jdbcType=VARCHAR}
  27. </select>
  28. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  29. delete from achievement_order
  30. where id = #{id,jdbcType=VARCHAR}
  31. </delete>
  32. <insert id="insert" parameterType="com.goafanti.common.model.AchievementOrder" >
  33. insert into achievement_order (id, serial_number, achievement_id,
  34. uid, create_time, status,
  35. intention_money, contract_money, commission,
  36. service_money, refund, deleted_sign
  37. )
  38. values (#{id,jdbcType=VARCHAR}, #{serialNumber,jdbcType=INTEGER}, #{achievementId,jdbcType=VARCHAR},
  39. #{uid,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER},
  40. #{intentionMoney,jdbcType=INTEGER}, #{contractMoney,jdbcType=INTEGER}, #{commission,jdbcType=INTEGER},
  41. #{serviceMoney,jdbcType=INTEGER}, #{refund,jdbcType=INTEGER}, #{deletedSign,jdbcType=INTEGER}
  42. )
  43. </insert>
  44. <insert id="insertSelective" parameterType="com.goafanti.common.model.AchievementOrder" >
  45. insert into achievement_order
  46. <trim prefix="(" suffix=")" suffixOverrides="," >
  47. <if test="id != null" >
  48. id,
  49. </if>
  50. <if test="serialNumber != null" >
  51. serial_number,
  52. </if>
  53. <if test="achievementId != null" >
  54. achievement_id,
  55. </if>
  56. <if test="uid != null" >
  57. uid,
  58. </if>
  59. <if test="createTime != null" >
  60. create_time,
  61. </if>
  62. <if test="status != null" >
  63. status,
  64. </if>
  65. <if test="intentionMoney != null" >
  66. intention_money,
  67. </if>
  68. <if test="contractMoney != null" >
  69. contract_money,
  70. </if>
  71. <if test="commission != null" >
  72. commission,
  73. </if>
  74. <if test="serviceMoney != null" >
  75. service_money,
  76. </if>
  77. <if test="refund != null" >
  78. refund,
  79. </if>
  80. <if test="deletedSign != null" >
  81. deleted_sign,
  82. </if>
  83. </trim>
  84. <trim prefix="values (" suffix=")" suffixOverrides="," >
  85. <if test="id != null" >
  86. #{id,jdbcType=VARCHAR},
  87. </if>
  88. <if test="serialNumber != null" >
  89. #{serialNumber,jdbcType=INTEGER},
  90. </if>
  91. <if test="achievementId != null" >
  92. #{achievementId,jdbcType=VARCHAR},
  93. </if>
  94. <if test="uid != null" >
  95. #{uid,jdbcType=VARCHAR},
  96. </if>
  97. <if test="createTime != null" >
  98. #{createTime,jdbcType=TIMESTAMP},
  99. </if>
  100. <if test="status != null" >
  101. #{status,jdbcType=INTEGER},
  102. </if>
  103. <if test="intentionMoney != null" >
  104. #{intentionMoney,jdbcType=INTEGER},
  105. </if>
  106. <if test="contractMoney != null" >
  107. #{contractMoney,jdbcType=INTEGER},
  108. </if>
  109. <if test="commission != null" >
  110. #{commission,jdbcType=INTEGER},
  111. </if>
  112. <if test="serviceMoney != null" >
  113. #{serviceMoney,jdbcType=INTEGER},
  114. </if>
  115. <if test="refund != null" >
  116. #{refund,jdbcType=INTEGER},
  117. </if>
  118. <if test="deletedSign != null" >
  119. #{deletedSign,jdbcType=INTEGER},
  120. </if>
  121. </trim>
  122. </insert>
  123. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AchievementOrder" >
  124. update achievement_order
  125. <set >
  126. <if test="serialNumber != null" >
  127. serial_number = #{serialNumber,jdbcType=INTEGER},
  128. </if>
  129. <if test="achievementId != null" >
  130. achievement_id = #{achievementId,jdbcType=VARCHAR},
  131. </if>
  132. <if test="uid != null" >
  133. uid = #{uid,jdbcType=VARCHAR},
  134. </if>
  135. <if test="createTime != null" >
  136. create_time = #{createTime,jdbcType=TIMESTAMP},
  137. </if>
  138. <if test="status != null" >
  139. status = #{status,jdbcType=INTEGER},
  140. </if>
  141. <if test="intentionMoney != null" >
  142. intention_money = #{intentionMoney,jdbcType=INTEGER},
  143. </if>
  144. <if test="contractMoney != null" >
  145. contract_money = #{contractMoney,jdbcType=INTEGER},
  146. </if>
  147. <if test="commission != null" >
  148. commission = #{commission,jdbcType=INTEGER},
  149. </if>
  150. <if test="serviceMoney != null" >
  151. service_money = #{serviceMoney,jdbcType=INTEGER},
  152. </if>
  153. <if test="refund != null" >
  154. refund = #{refund,jdbcType=INTEGER},
  155. </if>
  156. <if test="deletedSign != null" >
  157. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  158. </if>
  159. </set>
  160. where id = #{id,jdbcType=VARCHAR}
  161. </update>
  162. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.AchievementOrder" >
  163. update achievement_order
  164. set serial_number = #{serialNumber,jdbcType=INTEGER},
  165. achievement_id = #{achievementId,jdbcType=VARCHAR},
  166. uid = #{uid,jdbcType=VARCHAR},
  167. create_time = #{createTime,jdbcType=TIMESTAMP},
  168. status = #{status,jdbcType=INTEGER},
  169. intention_money = #{intentionMoney,jdbcType=INTEGER},
  170. contract_money = #{contractMoney,jdbcType=INTEGER},
  171. commission = #{commission,jdbcType=INTEGER},
  172. service_money = #{serviceMoney,jdbcType=INTEGER},
  173. refund = #{refund,jdbcType=INTEGER},
  174. deleted_sign = #{deletedSign,jdbcType=INTEGER}
  175. where id = #{id,jdbcType=VARCHAR}
  176. </update>
  177. <select id="selectAchievementOrderByUidAndAchievementId" resultMap="BaseResultMap" >
  178. select
  179. <include refid="Base_Column_List" />
  180. from achievement_order
  181. where uid = #{0} and achievement_id = #{1}
  182. </select>
  183. <select id="findAchievementOrderListByPage" parameterType="String" resultType="com.goafanti.achievement.bo.AchievementOrderListBo">
  184. select
  185. ao.id, ao.serial_number as serialNumber, ao.achievement_id as achievementId,
  186. ao.create_time as createTime,ao.status,
  187. ao.intention_money as intentionMoney, ao.contract_money as contractMoney, ao.commission,
  188. ao.service_money as serviceMoney, a.name, a.serial_number as achievementSerialNumber,
  189. a.deleted_sign as deletedSign, a.audit_status as auditStatus
  190. from achievement_order ao
  191. left join achievement a on a.id = ao.achievement_id
  192. where ao.deleted_sign = 0
  193. and a.deleted_sign = 0
  194. and ao.uid = #{uid,jdbcType=VARCHAR}
  195. <if test="status != null">
  196. and ao.status = #{status,jdbcType=INTEGER}
  197. </if>
  198. order by ao.serial_number desc
  199. <if test="page_sql!=null">
  200. ${page_sql}
  201. </if>
  202. </select>
  203. <select id="findAchievementOrderCount" parameterType="String" resultType="java.lang.Integer">
  204. select
  205. count(1)
  206. from achievement_order ao
  207. left join achievement a on a.id = ao.achievement_id
  208. where ao.deleted_sign = 0
  209. and a.deleted_sign
  210. and ao.uid = #{uid,jdbcType=VARCHAR}
  211. <if test="status != null">
  212. and ao.status = #{status,jdbcType=INTEGER}
  213. </if>
  214. </select>
  215. <select id="selectAchievementOrderByAchievementId" parameterType="java.lang.String" resultMap="BaseResultMap">
  216. select
  217. <include refid="Base_Column_List" />
  218. from achievement_order
  219. where achievement_id = #{achievementId,jdbcType=VARCHAR}
  220. </select>
  221. <select id="findUserAchievementOrderListByPage" parameterType="String" resultType="com.goafanti.achievement.bo.UserAchievementOrderListBo">
  222. select
  223. ao.id, ao.serial_number as serialNumber, ao.achievement_id as achievementId,
  224. ao.create_time as createTime,ao.status,
  225. ao.intention_money as intentionMoney, ao.contract_money as contractMoney, ao.commission,
  226. ao.service_money as serviceMoney, a.name, a.serial_number as achievementSerialNumber,
  227. a.deleted_sign as deletedSign, a.audit_status as auditStatus, ui.username,
  228. ao.uid
  229. from achievement_order ao
  230. left join achievement a on a.id = ao.achievement_id
  231. left join user_identity ui on ui.uid = ao.uid
  232. where ao.deleted_sign = 0
  233. and a.deleted_sign = 0
  234. and a.owner_type= 0
  235. and a.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
  236. <if test="status != null">
  237. and ao.status = #{status,jdbcType=INTEGER}
  238. </if>
  239. <if test="uid != null">
  240. and ao.uid = #{uid,jdbcType=VARCHAR}
  241. </if>
  242. <if test="username != null">
  243. and ui.username = #{username,jdbcType=VARCHAR}
  244. </if>
  245. order by ao.serial_number desc
  246. <if test="page_sql!=null">
  247. ${page_sql}
  248. </if>
  249. </select>
  250. <select id="findUserAchievementOrderCount" parameterType="String" resultType="java.lang.Integer">
  251. select
  252. count(1)
  253. from achievement_order ao
  254. left join achievement a on a.id = ao.achievement_id
  255. left join user_identity ui on ui.uid = ao.uid
  256. where ao.deleted_sign = 0
  257. and a.deleted_sign = 0
  258. and a.owner_type= 0
  259. and a.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
  260. <if test="status != null">
  261. and ao.status = #{status,jdbcType=INTEGER}
  262. </if>
  263. <if test="uid != null">
  264. and ao.uid = #{uid,jdbcType=VARCHAR}
  265. </if>
  266. <if test="username != null">
  267. and ui.username = #{username,jdbcType=VARCHAR}
  268. </if>
  269. </select>
  270. <select id="findOrgAchievementOrderListByPage" parameterType="String" resultType="com.goafanti.achievement.bo.OrgAchievementOrderListBo">
  271. select
  272. ao.id, ao.serial_number as serialNumber, ao.achievement_id as achievementId,
  273. ao.create_time as createTime,ao.status,
  274. ao.intention_money as intentionMoney, ao.contract_money as contractMoney, ao.commission,
  275. ao.service_money as serviceMoney, a.name, a.serial_number as achievementSerialNumber,
  276. a.deleted_sign as deletedSign, a.audit_status as auditStatus, ao.uid,
  277. oi.unit_name as unitName
  278. from achievement_order ao
  279. left join achievement a on a.id = ao.achievement_id
  280. left join organization_identity oi on oi.uid = ao.uid
  281. where ao.deleted_sign = 0
  282. and a.deleted_sign = 0
  283. and a.owner_type= 1
  284. and a.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
  285. <if test="status != null">
  286. and ao.status = #{status,jdbcType=INTEGER}
  287. </if>
  288. <if test="uid != null">
  289. and ao.uid = #{uid,jdbcType=VARCHAR}
  290. </if>
  291. <if test="unitName != null">
  292. and oi.unit_name = #{unitName,jdbcType=VARCHAR}
  293. </if>
  294. order by ao.serial_number desc
  295. <if test="page_sql!=null">
  296. ${page_sql}
  297. </if>
  298. </select>
  299. <select id="findOrgAchievementOrderCount" parameterType="String" resultType="java.lang.Integer">
  300. select
  301. count(1)
  302. from achievement_order ao
  303. left join achievement a on a.id = ao.achievement_id
  304. left join organization_identity oi on oi.uid = ao.uid
  305. where ao.deleted_sign = 0
  306. and a.deleted_sign = 0
  307. and a.owner_type= 0
  308. and a.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
  309. <if test="status != null">
  310. and ao.status = #{status,jdbcType=INTEGER}
  311. </if>
  312. <if test="uid != null">
  313. and ao.uid = #{uid,jdbcType=VARCHAR}
  314. </if>
  315. <if test="unitName != null">
  316. and oi.unit_name = #{unitName,jdbcType=VARCHAR}
  317. </if>
  318. </select>
  319. </mapper>