TChangeTaskMapper.xml 17 KB

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