AchievementOrderMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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
  182. uid = #{0} and achievement_id = #{1} and deleted_sign = 0
  183. </select>
  184. <select id="findAchievementOrderListByPage" parameterType="String" resultType="com.goafanti.achievement.bo.AchievementOrderListBo">
  185. select
  186. ao.id, ao.serial_number as serialNumber, ao.achievement_id as achievementId,
  187. ao.create_time as createTime,ao.status,
  188. ao.intention_money as intentionMoney, ao.contract_money as contractMoney, ao.commission,
  189. ao.service_money as serviceMoney, a.name, a.serial_number as achievementSerialNumber,
  190. a.deleted_sign as deletedSign, a.audit_status as auditStatus
  191. from achievement_order ao
  192. left join achievement a on a.id = ao.achievement_id
  193. where ao.deleted_sign = 0
  194. and a.deleted_sign = 0
  195. and ao.uid = #{uid,jdbcType=VARCHAR}
  196. <if test="status != null">
  197. and ao.status = #{status,jdbcType=INTEGER}
  198. </if>
  199. order by ao.serial_number desc
  200. <if test="page_sql!=null">
  201. ${page_sql}
  202. </if>
  203. </select>
  204. <select id="findAchievementOrderCount" parameterType="String" resultType="java.lang.Integer">
  205. select
  206. count(1)
  207. from achievement_order ao
  208. left join achievement a on a.id = ao.achievement_id
  209. where ao.deleted_sign = 0
  210. and a.deleted_sign
  211. and ao.uid = #{uid,jdbcType=VARCHAR}
  212. <if test="status != null">
  213. and ao.status = #{status,jdbcType=INTEGER}
  214. </if>
  215. </select>
  216. <select id="selectAchievementOrderByAchievementId" parameterType="java.lang.String" resultMap="BaseResultMap">
  217. select
  218. <include refid="Base_Column_List" />
  219. from achievement_order
  220. where achievement_id = #{achievementId,jdbcType=VARCHAR}
  221. </select>
  222. <select id="findUserAchievementOrderListByPage" parameterType="String" resultType="com.goafanti.achievement.bo.UserAchievementOrderListBo">
  223. select
  224. ao.id, ao.serial_number as serialNumber, ao.achievement_id as achievementId,
  225. ao.create_time as createTime,ao.status,
  226. ao.intention_money as intentionMoney, ao.contract_money as contractMoney, ao.commission,
  227. ao.service_money as serviceMoney, a.name, a.serial_number as achievementSerialNumber,
  228. a.deleted_sign as deletedSign, a.audit_status as auditStatus, ui.username,
  229. ao.uid
  230. from achievement_order ao
  231. left join achievement a on a.id = ao.achievement_id
  232. left join user_identity ui on ui.uid = ao.uid
  233. where ao.deleted_sign = 0
  234. and a.deleted_sign = 0
  235. and a.owner_type= 0
  236. <if test="techBrokerId != null">
  237. and a.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
  238. </if>
  239. <if test="status != null">
  240. and ao.status = #{status,jdbcType=INTEGER}
  241. </if>
  242. <if test="uid != null">
  243. and ao.uid = #{uid,jdbcType=VARCHAR}
  244. </if>
  245. <if test="username != null">
  246. and ui.username = #{username,jdbcType=VARCHAR}
  247. </if>
  248. order by ao.serial_number desc
  249. <if test="page_sql!=null">
  250. ${page_sql}
  251. </if>
  252. </select>
  253. <select id="findUserAchievementOrderCount" parameterType="String" resultType="java.lang.Integer">
  254. select
  255. count(1)
  256. from achievement_order ao
  257. left join achievement a on a.id = ao.achievement_id
  258. left join user_identity ui on ui.uid = ao.uid
  259. where ao.deleted_sign = 0
  260. and a.deleted_sign = 0
  261. and a.owner_type= 0
  262. <if test="techBrokerId != null">
  263. and a.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
  264. </if>
  265. <if test="status != null">
  266. and ao.status = #{status,jdbcType=INTEGER}
  267. </if>
  268. <if test="uid != null">
  269. and ao.uid = #{uid,jdbcType=VARCHAR}
  270. </if>
  271. <if test="username != null">
  272. and ui.username = #{username,jdbcType=VARCHAR}
  273. </if>
  274. </select>
  275. <select id="findOrgAchievementOrderListByPage" parameterType="String" resultType="com.goafanti.achievement.bo.OrgAchievementOrderListBo">
  276. select
  277. ao.id, ao.serial_number as serialNumber, ao.achievement_id as achievementId,
  278. ao.create_time as createTime,ao.status,
  279. ao.intention_money as intentionMoney, ao.contract_money as contractMoney, ao.commission,
  280. ao.service_money as serviceMoney, a.name, a.serial_number as achievementSerialNumber,
  281. a.deleted_sign as deletedSign, a.audit_status as auditStatus, ao.uid,
  282. oi.unit_name as unitName
  283. from achievement_order ao
  284. left join achievement a on a.id = ao.achievement_id
  285. left join organization_identity oi on oi.uid = ao.uid
  286. where ao.deleted_sign = 0
  287. and a.deleted_sign = 0
  288. and a.owner_type= 1
  289. <if test="techBrokerId != null">
  290. and a.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
  291. </if>
  292. <if test="status != null">
  293. and ao.status = #{status,jdbcType=INTEGER}
  294. </if>
  295. <if test="uid != null">
  296. and ao.uid = #{uid,jdbcType=VARCHAR}
  297. </if>
  298. <if test="unitName != null">
  299. and oi.unit_name = #{unitName,jdbcType=VARCHAR}
  300. </if>
  301. order by ao.serial_number desc
  302. <if test="page_sql!=null">
  303. ${page_sql}
  304. </if>
  305. </select>
  306. <select id="findOrgAchievementOrderCount" parameterType="String" resultType="java.lang.Integer">
  307. select
  308. count(1)
  309. from achievement_order ao
  310. left join achievement a on a.id = ao.achievement_id
  311. left join organization_identity oi on oi.uid = ao.uid
  312. where ao.deleted_sign = 0
  313. and a.deleted_sign = 0
  314. and a.owner_type= 1
  315. <if test="techBrokerId != null">
  316. and a.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
  317. </if>
  318. <if test="status != null">
  319. and ao.status = #{status,jdbcType=INTEGER}
  320. </if>
  321. <if test="uid != null">
  322. and ao.uid = #{uid,jdbcType=VARCHAR}
  323. </if>
  324. <if test="unitName != null">
  325. and oi.unit_name = #{unitName,jdbcType=VARCHAR}
  326. </if>
  327. </select>
  328. </mapper>