DemandOrderMapper.xml 11 KB

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