TChangeTaskMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  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.TChangeTaskMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.TChangeTask">
  5. <id column="id" jdbcType="INTEGER" property="id" />
  6. <result column="tid" jdbcType="INTEGER" property="tid" />
  7. <result column="cid" jdbcType="INTEGER" property="cid" />
  8. <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
  9. <result column="main" jdbcType="INTEGER" property="main" />
  10. <result column="commodity_id" jdbcType="VARCHAR" property="commodityId" />
  11. <result column="commodity_name" jdbcType="VARCHAR" property="commodityName" />
  12. <result column="commodity_quantity" jdbcType="INTEGER" property="commodityQuantity" />
  13. <result column="commodity_price" jdbcType="DECIMAL" property="commodityPrice" />
  14. <result column="task_comment" jdbcType="VARCHAR" property="taskComment" />
  15. <result column="type" jdbcType="INTEGER" property="type" />
  16. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  17. <result column="split_status" jdbcType="INTEGER" property="splitStatus" />
  18. <result column="split_super" jdbcType="INTEGER" property="splitSuper" />
  19. <result column="receiver_name" jdbcType="VARCHAR" property="receiverName" />
  20. <result column="official_cost" jdbcType="INTEGER" property="officialCost" />
  21. <result column="cost_reduction" jdbcType="INTEGER" property="costReduction" />
  22. <result column="service_life" jdbcType="VARCHAR" property="serviceLife" />
  23. <result column="service_year" jdbcType="VARCHAR" property="serviceYear" />
  24. <result column="year_sum" jdbcType="INTEGER" property="yearSum" />
  25. <result column="contract_term" jdbcType="VARCHAR" property="contractTerm" />
  26. <result column="declaration_batch" jdbcType="INTEGER" property="declarationBatch" />
  27. <result column="patent_type" jdbcType="INTEGER" property="patentType" />
  28. </resultMap>
  29. <sql id="Base_Column_List">
  30. id, tid, cid, order_no, main, commodity_id, commodity_name, commodity_quantity, commodity_price,
  31. task_comment, `type`, create_time, split_status, split_super, receiver_name, official_cost,
  32. cost_reduction, service_life, service_year, year_sum, contract_term, declaration_batch,
  33. patent_type
  34. </sql>
  35. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  36. select
  37. <include refid="Base_Column_List" />
  38. from t_change_task
  39. where id = #{id,jdbcType=INTEGER}
  40. </select>
  41. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  42. delete from t_change_task
  43. where id = #{id,jdbcType=INTEGER}
  44. </delete>
  45. <insert id="insert" parameterType="com.goafanti.common.model.TChangeTask">
  46. insert into t_change_task (id, tid, cid,
  47. order_no, main, commodity_id,
  48. commodity_name, commodity_quantity, commodity_price,
  49. task_comment, `type`, create_time,
  50. split_status, split_super, receiver_name,
  51. official_cost, cost_reduction, service_life,
  52. service_year, year_sum, contract_term,
  53. declaration_batch, patent_type)
  54. values (#{id,jdbcType=INTEGER}, #{tid,jdbcType=INTEGER}, #{cid,jdbcType=INTEGER},
  55. #{orderNo,jdbcType=VARCHAR}, #{main,jdbcType=INTEGER}, #{commodityId,jdbcType=VARCHAR},
  56. #{commodityName,jdbcType=VARCHAR}, #{commodityQuantity,jdbcType=INTEGER}, #{commodityPrice,jdbcType=DECIMAL},
  57. #{taskComment,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
  58. #{splitStatus,jdbcType=INTEGER}, #{splitSuper,jdbcType=INTEGER}, #{receiverName,jdbcType=VARCHAR},
  59. #{officialCost,jdbcType=INTEGER}, #{costReduction,jdbcType=INTEGER}, #{serviceLife,jdbcType=VARCHAR},
  60. #{serviceYear,jdbcType=VARCHAR}, #{yearSum,jdbcType=INTEGER}, #{contractTerm,jdbcType=VARCHAR},
  61. #{declarationBatch,jdbcType=INTEGER}, #{patentType,jdbcType=INTEGER})
  62. </insert>
  63. <insert id="insertSelective" parameterType="com.goafanti.common.model.TChangeTask">
  64. insert into t_change_task
  65. <trim prefix="(" suffix=")" suffixOverrides=",">
  66. <if test="id != null">
  67. id,
  68. </if>
  69. <if test="tid != null">
  70. tid,
  71. </if>
  72. <if test="cid != null">
  73. cid,
  74. </if>
  75. <if test="orderNo != null">
  76. order_no,
  77. </if>
  78. <if test="main != null">
  79. main,
  80. </if>
  81. <if test="commodityId != null">
  82. commodity_id,
  83. </if>
  84. <if test="commodityName != null">
  85. commodity_name,
  86. </if>
  87. <if test="commodityQuantity != null">
  88. commodity_quantity,
  89. </if>
  90. <if test="commodityPrice != null">
  91. commodity_price,
  92. </if>
  93. <if test="taskComment != null">
  94. task_comment,
  95. </if>
  96. <if test="type != null">
  97. `type`,
  98. </if>
  99. <if test="createTime != null">
  100. create_time,
  101. </if>
  102. <if test="splitStatus != null">
  103. split_status,
  104. </if>
  105. <if test="splitSuper != null">
  106. split_super,
  107. </if>
  108. <if test="receiverName != null">
  109. receiver_name,
  110. </if>
  111. <if test="officialCost != null">
  112. official_cost,
  113. </if>
  114. <if test="costReduction != null">
  115. cost_reduction,
  116. </if>
  117. <if test="serviceLife != null">
  118. service_life,
  119. </if>
  120. <if test="serviceYear != null">
  121. service_year,
  122. </if>
  123. <if test="yearSum != null">
  124. year_sum,
  125. </if>
  126. <if test="contractTerm != null">
  127. contract_term,
  128. </if>
  129. <if test="declarationBatch != null">
  130. declaration_batch,
  131. </if>
  132. <if test="patentType != null">
  133. patent_type,
  134. </if>
  135. </trim>
  136. <trim prefix="values (" suffix=")" suffixOverrides=",">
  137. <if test="id != null">
  138. #{id,jdbcType=INTEGER},
  139. </if>
  140. <if test="tid != null">
  141. #{tid,jdbcType=INTEGER},
  142. </if>
  143. <if test="cid != null">
  144. #{cid,jdbcType=INTEGER},
  145. </if>
  146. <if test="orderNo != null">
  147. #{orderNo,jdbcType=VARCHAR},
  148. </if>
  149. <if test="main != null">
  150. #{main,jdbcType=INTEGER},
  151. </if>
  152. <if test="commodityId != null">
  153. #{commodityId,jdbcType=VARCHAR},
  154. </if>
  155. <if test="commodityName != null">
  156. #{commodityName,jdbcType=VARCHAR},
  157. </if>
  158. <if test="commodityQuantity != null">
  159. #{commodityQuantity,jdbcType=INTEGER},
  160. </if>
  161. <if test="commodityPrice != null">
  162. #{commodityPrice,jdbcType=DECIMAL},
  163. </if>
  164. <if test="taskComment != null">
  165. #{taskComment,jdbcType=VARCHAR},
  166. </if>
  167. <if test="type != null">
  168. #{type,jdbcType=INTEGER},
  169. </if>
  170. <if test="createTime != null">
  171. #{createTime,jdbcType=TIMESTAMP},
  172. </if>
  173. <if test="splitStatus != null">
  174. #{splitStatus,jdbcType=INTEGER},
  175. </if>
  176. <if test="splitSuper != null">
  177. #{splitSuper,jdbcType=INTEGER},
  178. </if>
  179. <if test="receiverName != null">
  180. #{receiverName,jdbcType=VARCHAR},
  181. </if>
  182. <if test="officialCost != null">
  183. #{officialCost,jdbcType=INTEGER},
  184. </if>
  185. <if test="costReduction != null">
  186. #{costReduction,jdbcType=INTEGER},
  187. </if>
  188. <if test="serviceLife != null">
  189. #{serviceLife,jdbcType=VARCHAR},
  190. </if>
  191. <if test="serviceYear != null">
  192. #{serviceYear,jdbcType=VARCHAR},
  193. </if>
  194. <if test="yearSum != null">
  195. #{yearSum,jdbcType=INTEGER},
  196. </if>
  197. <if test="contractTerm != null">
  198. #{contractTerm,jdbcType=VARCHAR},
  199. </if>
  200. <if test="declarationBatch != null">
  201. #{declarationBatch,jdbcType=INTEGER},
  202. </if>
  203. <if test="patentType != null">
  204. #{patentType,jdbcType=INTEGER},
  205. </if>
  206. </trim>
  207. </insert>
  208. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TChangeTask">
  209. update t_change_task
  210. <set>
  211. <if test="tid != null">
  212. tid = #{tid,jdbcType=INTEGER},
  213. </if>
  214. <if test="cid != null">
  215. cid = #{cid,jdbcType=INTEGER},
  216. </if>
  217. <if test="orderNo != null">
  218. order_no = #{orderNo,jdbcType=VARCHAR},
  219. </if>
  220. <if test="main != null">
  221. main = #{main,jdbcType=INTEGER},
  222. </if>
  223. <if test="commodityId != null">
  224. commodity_id = #{commodityId,jdbcType=VARCHAR},
  225. </if>
  226. <if test="commodityName != null">
  227. commodity_name = #{commodityName,jdbcType=VARCHAR},
  228. </if>
  229. <if test="commodityQuantity != null">
  230. commodity_quantity = #{commodityQuantity,jdbcType=INTEGER},
  231. </if>
  232. <if test="commodityPrice != null">
  233. commodity_price = #{commodityPrice,jdbcType=DECIMAL},
  234. </if>
  235. <if test="taskComment != null">
  236. task_comment = #{taskComment,jdbcType=VARCHAR},
  237. </if>
  238. <if test="type != null">
  239. `type` = #{type,jdbcType=INTEGER},
  240. </if>
  241. <if test="createTime != null">
  242. create_time = #{createTime,jdbcType=TIMESTAMP},
  243. </if>
  244. <if test="splitStatus != null">
  245. split_status = #{splitStatus,jdbcType=INTEGER},
  246. </if>
  247. <if test="splitSuper != null">
  248. split_super = #{splitSuper,jdbcType=INTEGER},
  249. </if>
  250. <if test="receiverName != null">
  251. receiver_name = #{receiverName,jdbcType=VARCHAR},
  252. </if>
  253. <if test="officialCost != null">
  254. official_cost = #{officialCost,jdbcType=INTEGER},
  255. </if>
  256. <if test="costReduction != null">
  257. cost_reduction = #{costReduction,jdbcType=INTEGER},
  258. </if>
  259. <if test="serviceLife != null">
  260. service_life = #{serviceLife,jdbcType=VARCHAR},
  261. </if>
  262. <if test="serviceYear != null">
  263. service_year = #{serviceYear,jdbcType=VARCHAR},
  264. </if>
  265. <if test="yearSum != null">
  266. year_sum = #{yearSum,jdbcType=INTEGER},
  267. </if>
  268. <if test="contractTerm != null">
  269. contract_term = #{contractTerm,jdbcType=VARCHAR},
  270. </if>
  271. <if test="declarationBatch != null">
  272. declaration_batch = #{declarationBatch,jdbcType=INTEGER},
  273. </if>
  274. <if test="patentType != null">
  275. patent_type = #{patentType,jdbcType=INTEGER},
  276. </if>
  277. </set>
  278. where id = #{id,jdbcType=INTEGER}
  279. </update>
  280. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TChangeTask">
  281. update t_change_task
  282. set tid = #{tid,jdbcType=INTEGER},
  283. cid = #{cid,jdbcType=INTEGER},
  284. order_no = #{orderNo,jdbcType=VARCHAR},
  285. main = #{main,jdbcType=INTEGER},
  286. commodity_id = #{commodityId,jdbcType=VARCHAR},
  287. commodity_name = #{commodityName,jdbcType=VARCHAR},
  288. commodity_quantity = #{commodityQuantity,jdbcType=INTEGER},
  289. commodity_price = #{commodityPrice,jdbcType=DECIMAL},
  290. task_comment = #{taskComment,jdbcType=VARCHAR},
  291. `type` = #{type,jdbcType=INTEGER},
  292. create_time = #{createTime,jdbcType=TIMESTAMP},
  293. split_status = #{splitStatus,jdbcType=INTEGER},
  294. split_super = #{splitSuper,jdbcType=INTEGER},
  295. receiver_name = #{receiverName,jdbcType=VARCHAR},
  296. official_cost = #{officialCost,jdbcType=INTEGER},
  297. cost_reduction = #{costReduction,jdbcType=INTEGER},
  298. service_life = #{serviceLife,jdbcType=VARCHAR},
  299. service_year = #{serviceYear,jdbcType=VARCHAR},
  300. year_sum = #{yearSum,jdbcType=INTEGER},
  301. contract_term = #{contractTerm,jdbcType=VARCHAR},
  302. declaration_batch = #{declarationBatch,jdbcType=INTEGER},
  303. patent_type = #{patentType,jdbcType=INTEGER}
  304. where id = #{id,jdbcType=INTEGER}
  305. </update>
  306. <insert id="insertSelectiveList" parameterType="java.util.List">
  307. insert into t_change_task ( tid, cid, split_status,
  308. order_no, commodity_id, commodity_name,
  309. commodity_quantity, commodity_price, task_comment,
  310. split_super , receiver_name, create_time,service_life,
  311. service_year, year_sum, contract_term,declaration_batch,patent_type)
  312. values
  313. <foreach collection="list" index="index" item="item" separator=",">
  314. ( #{item.tid,jdbcType=INTEGER}, #{item.cid,jdbcType=INTEGER}, #{item.splitStatus,jdbcType=INTEGER},
  315. #{item.orderNo,jdbcType=VARCHAR}, #{item.commodityId,jdbcType=VARCHAR}, #{item.commodityName,jdbcType=VARCHAR},
  316. #{item.commodityQuantity,jdbcType=INTEGER}, #{item.commodityPrice,jdbcType=DECIMAL}, #{item.taskComment,jdbcType=VARCHAR},
  317. #{item.splitSuper,jdbcType=INTEGER}, #{item.receiverName,jdbcType=VARCHAR}, now(), #{item.serviceLife,jdbcType=VARCHAR},
  318. #{item.serviceYear,jdbcType=VARCHAR}, #{item.yearSum,jdbcType=INTEGER},#{item.contractTerm,jdbcType=VARCHAR},
  319. #{declarationBatch,jdbcType=INTEGER},#{patentType,jdbcType=INTEGER})
  320. </foreach>
  321. </insert>
  322. <select id="selectByCid" resultType="com.goafanti.order.bo.TChangeTaskOut">
  323. select a.id,a.order_no as orderNo,a.main, c.cname,c.sort cSort,a.commodity_name as commodityName,a.official_cost officialCost,
  324. a.official_cost officialCost, a.commodity_quantity as commodityQuantity,i.price,a.commodity_id as commodityId,a.type,a.tid,
  325. a.receiver_name receiverName, a.task_comment as taskComment ,a.commodity_price as commodityPrice,a.split_status splitStatus,
  326. a.split_super splitSuper, a.service_life serviceLife ,a.service_year serviceYear,a.year_sum yearSum,
  327. a.declaration_batch declarationBatch,a.patent_type patentType
  328. from t_change_task a left join business_project i on a.commodity_id=i.id
  329. left join business_category c on i.cid=c.id
  330. where 1=1
  331. <if test="splitStatus !=null and splitStatus !=3">
  332. and a.split_status= #{splitStatus}
  333. </if>
  334. <if test="splitStatus ==3">
  335. and a.split_status !=2
  336. </if>
  337. and a.cid= #{id} order by a.id
  338. </select>
  339. <update id="updateByTid">
  340. update t_change_task set type= #{type}
  341. where 1=1
  342. <if test="tid !=null">
  343. and tid= #{tid}
  344. </if>
  345. <if test="cid !=null">
  346. and cid= #{cid}
  347. </if>
  348. <if test="sid !=null">
  349. and split_super= #{sid}
  350. </if>
  351. </update>
  352. <update id="deleteByTid">
  353. delete from t_change_task where tid= #{tid};
  354. </update>
  355. <select id="selectBySuper" resultType="com.goafanti.order.bo.TChangeTaskOut">
  356. select a.id,a.order_no as orderNo,a.main, c.cname,c.sort cSort,a.commodity_name as commodityName,
  357. a.commodity_quantity as commodityQuantity,i.price,a.commodity_id as commodityId,a.type,a.tid,a.receiver_name receiverName,
  358. a.task_comment as taskComment ,a.commodity_price as commodityPrice,a.split_status splitStatus,a.split_super splitSuper
  359. from t_change_task a left join business_project i on a.commodity_id=i.id
  360. left join business_category c on i.cid=c.id
  361. where a.split_status=2 and a.split_super= #{splitSuper} and a.cid= #{cid} order by a.id
  362. </select>
  363. <select id="selectBytid" resultType="com.goafanti.common.model.TChangeTask">
  364. select tct.id,tct.tid,tct.cid,tct.order_no orderNo
  365. from t_change_task tct left join new_order_change noc on tct.cid =noc.id
  366. where noc.process_state &lt; 4 and noc.status in (0,1,2)
  367. and tct.tid= #{tid}
  368. </select>
  369. </mapper>