DemandOrderMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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
  193. uid = #{0}
  194. and demand_id = #{1}
  195. and deleted_sign = 0
  196. </select>
  197. <select id="findDemandOrderListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandOrderListBo">
  198. select
  199. do.id, do.serial_number as serialNumber, do.demand_id as demandId,
  200. do.create_time as createTime, do.enclosure_url as enclosureUrl, do.status,
  201. do.intention_money as intentionMoney, do.contract_money as contractMoney, do.commission,
  202. do.service_money as serviceMoney, d.name, d.serial_number as demandSerialNumber,
  203. d.deleted_sign as deletedSign, d.audit_status as auditStatus
  204. from demand_order do
  205. left join demand d on d.id = do.demand_id
  206. where do.deleted_sign = 0
  207. and d.deleted_sign = 0
  208. and do.uid = #{uid,jdbcType=VARCHAR}
  209. <if test="status != null">
  210. and do.status = #{status,jdbcType=INTEGER}
  211. </if>
  212. order by do.serial_number desc
  213. <if test="page_sql!=null">
  214. ${page_sql}
  215. </if>
  216. </select>
  217. <select id="findDemandOrderCount" parameterType="String" resultType="java.lang.Integer">
  218. select
  219. count(1)
  220. from demand_order do
  221. left join demand d on d.id = do.demand_id
  222. where do.deleted_sign = 0
  223. and d.deleted_sign
  224. and do.uid = #{uid,jdbcType=VARCHAR}
  225. <if test="status != null">
  226. and do.status = #{status,jdbcType=INTEGER}
  227. </if>
  228. </select>
  229. <select id="selectDemandOrderByDemandId" parameterType="java.lang.String" resultMap="BaseResultMap">
  230. select
  231. <include refid="Base_Column_List" />
  232. from demand_order
  233. where demand_id = #{demandId,jdbcType=VARCHAR}
  234. </select>
  235. <select id="findUserDemandOrderListByPage" parameterType="String" resultType="com.goafanti.demand.bo.UserDemandOrderListBo">
  236. select
  237. do.id, do.serial_number as serialNumber, do.demand_id as demandId,
  238. do.create_time as createTime, do.enclosure_url as enclosureUrl, do.status,
  239. do.intention_money as intentionMoney, do.contract_money as contractMoney, do.commission,
  240. do.service_money as serviceMoney, d.name, d.serial_number as demandSerialNumber,
  241. d.deleted_sign as deletedSign, d.audit_status as auditStatus,
  242. do.uid, ui.nickname as username
  243. from demand_order do
  244. left join demand d on d.id = do.demand_id
  245. left join user ui on ui.id = do.uid
  246. where do.deleted_sign = 0
  247. and d.deleted_sign = 0
  248. and d.data_category = 0
  249. <if test="techBrokerId != null">
  250. and d.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
  251. </if>
  252. <if test="status != null">
  253. and do.status = #{status,jdbcType=INTEGER}
  254. </if>
  255. <if test="uid != null">
  256. and d.uid = #{uid,jdbcType=VARCHAR}
  257. </if>
  258. <if test="username != null">
  259. and ui.nickname = #{username,jdbcType=VARCHAR}
  260. </if>
  261. order by do.serial_number desc
  262. <if test="page_sql!=null">
  263. ${page_sql}
  264. </if>
  265. </select>
  266. <select id="findUserDemandOrderCount" parameterType="String" resultType="java.lang.Integer">
  267. select
  268. count(1)
  269. from demand_order do
  270. left join demand d on d.id = do.demand_id
  271. left join user ui on ui.id = do.uid
  272. where do.deleted_sign = 0
  273. and d.deleted_sign = 0
  274. and d.data_category = 0
  275. <if test="techBrokerId != null">
  276. and d.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
  277. </if>
  278. <if test="status != null">
  279. and do.status = #{status,jdbcType=INTEGER}
  280. </if>
  281. <if test="uid != null">
  282. and d.uid = #{uid,jdbcType=VARCHAR}
  283. </if>
  284. <if test="username != null">
  285. and ui.nickname = #{username,jdbcType=VARCHAR}
  286. </if>
  287. </select>
  288. <select id="findOrgDemandOrderListByPage" parameterType="String" resultType="com.goafanti.demand.bo.OrgDemandOrderListBo">
  289. select
  290. do.id, do.serial_number as serialNumber, do.demand_id as demandId,
  291. do.create_time as createTime, do.enclosure_url as enclosureUrl, do.status,
  292. do.intention_money as intentionMoney, do.contract_money as contractMoney, do.commission,
  293. do.service_money as serviceMoney, d.name, d.serial_number as demandSerialNumber,
  294. d.deleted_sign as deletedSign, d.audit_status as auditStatus,
  295. do.uid, oi.nickname as unitName
  296. from demand_order do
  297. left join demand d on d.id = do.demand_id
  298. left join user oi on u.id = do.uid
  299. where do.deleted_sign = 0
  300. and d.deleted_sign = 0
  301. and d.data_category = 1
  302. <if test="techBrokerId != null">
  303. and d.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
  304. </if>
  305. <if test="status != null">
  306. and do.status = #{status,jdbcType=INTEGER}
  307. </if>
  308. <if test="uid != null">
  309. and d.uid = #{uid,jdbcType=VARCHAR}
  310. </if>
  311. <if test="unitName != null">
  312. and oi.nickname = #{unitName,jdbcType=VARCHAR}
  313. </if>
  314. order by do.serial_number desc
  315. <if test="page_sql!=null">
  316. ${page_sql}
  317. </if>
  318. </select>
  319. <select id="findOrgDemandOrderCount" parameterType="String" resultType="java.lang.Integer">
  320. select
  321. count(1)
  322. from demand_order do
  323. left join demand d on d.id = do.demand_id
  324. left join user oi on oi.id = do.uid
  325. where do.deleted_sign = 0
  326. and d.deleted_sign = 0
  327. and d.data_category = 1
  328. <if test="techBrokerId != null">
  329. and d.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
  330. </if>
  331. <if test="status != null">
  332. and do.status = #{status,jdbcType=INTEGER}
  333. </if>
  334. <if test="uid != null">
  335. and d.uid = #{uid,jdbcType=VARCHAR}
  336. </if>
  337. <if test="unitName != null">
  338. and oi.nickname = #{unitName,jdbcType=VARCHAR}
  339. </if>
  340. </select>
  341. </mapper>