RdDetailsMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  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.RdDetailsMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.RdDetails">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="user_name" jdbcType="VARCHAR" property="userName" />
  7. <result column="rd_no" jdbcType="VARCHAR" property="rdNo" />
  8. <result column="ip_no" jdbcType="VARCHAR" property="ipNo" />
  9. <result column="rd_name" jdbcType="VARCHAR" property="rdName" />
  10. <result column="rd_start" jdbcType="TIMESTAMP" property="rdStart" />
  11. <result column="rd_end" jdbcType="TIMESTAMP" property="rdEnd" />
  12. <result column="technical_field" jdbcType="VARCHAR" property="technicalField" />
  13. <result column="technology_source" jdbcType="VARCHAR" property="technologySource" />
  14. <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
  15. <result column="recent_three_amount" jdbcType="DECIMAL" property="recentThreeAmount" />
  16. <result column="rd_objective" jdbcType="VARCHAR" property="rdObjective" />
  17. <result column="core_technology" jdbcType="VARCHAR" property="coreTechnology" />
  18. <result column="achieve_results" jdbcType="VARCHAR" property="achieveResults" />
  19. <result column="consultant_name" jdbcType="VARCHAR" property="consultantName" />
  20. <result column="status" jdbcType="INTEGER" property="status" />
  21. <result column="open_time" jdbcType="TIMESTAMP" property="openTime" />
  22. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  23. <result column="aid" jdbcType="VARCHAR" property="aid" />
  24. <result column="browse_count" jdbcType="INTEGER" property="browseCount" />
  25. <result column="download_count" jdbcType="INTEGER" property="downloadCount" />
  26. </resultMap>
  27. <sql id="Base_Column_List">
  28. id, user_name, rd_no, ip_no, rd_name, rd_start, rd_end, technical_field, technology_source,
  29. total_amount, recent_three_amount, rd_objective, core_technology, achieve_results,
  30. consultant_name, `status`, open_time, create_time, aid, browse_count, download_count
  31. </sql>
  32. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  33. select
  34. <include refid="Base_Column_List" />
  35. from rd_details
  36. where id = #{id,jdbcType=BIGINT}
  37. </select>
  38. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  39. delete from rd_details
  40. where id = #{id,jdbcType=BIGINT}
  41. </delete>
  42. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.RdDetails" useGeneratedKeys="true">
  43. insert into rd_details (user_name, rd_no, ip_no,
  44. rd_name, rd_start, rd_end,
  45. technical_field, technology_source, total_amount,
  46. recent_three_amount, rd_objective, core_technology,
  47. achieve_results, consultant_name, `status`,
  48. open_time, create_time, aid,
  49. browse_count, download_count)
  50. values (#{userName,jdbcType=VARCHAR}, #{rdNo,jdbcType=VARCHAR}, #{ipNo,jdbcType=VARCHAR},
  51. #{rdName,jdbcType=VARCHAR}, #{rdStart,jdbcType=TIMESTAMP}, #{rdEnd,jdbcType=TIMESTAMP},
  52. #{technicalField,jdbcType=VARCHAR}, #{technologySource,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL},
  53. #{recentThreeAmount,jdbcType=DECIMAL}, #{rdObjective,jdbcType=VARCHAR}, #{coreTechnology,jdbcType=VARCHAR},
  54. #{achieveResults,jdbcType=VARCHAR}, #{consultantName,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
  55. #{openTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{aid,jdbcType=VARCHAR},
  56. #{browseCount,jdbcType=INTEGER}, #{downloadCount,jdbcType=INTEGER})
  57. </insert>
  58. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.RdDetails" useGeneratedKeys="true">
  59. insert into rd_details
  60. <trim prefix="(" suffix=")" suffixOverrides=",">
  61. <if test="userName != null">
  62. user_name,
  63. </if>
  64. <if test="rdNo != null">
  65. rd_no,
  66. </if>
  67. <if test="ipNo != null">
  68. ip_no,
  69. </if>
  70. <if test="rdName != null">
  71. rd_name,
  72. </if>
  73. <if test="rdStart != null">
  74. rd_start,
  75. </if>
  76. <if test="rdEnd != null">
  77. rd_end,
  78. </if>
  79. <if test="technicalField != null">
  80. technical_field,
  81. </if>
  82. <if test="technologySource != null">
  83. technology_source,
  84. </if>
  85. <if test="totalAmount != null">
  86. total_amount,
  87. </if>
  88. <if test="recentThreeAmount != null">
  89. recent_three_amount,
  90. </if>
  91. <if test="rdObjective != null">
  92. rd_objective,
  93. </if>
  94. <if test="coreTechnology != null">
  95. core_technology,
  96. </if>
  97. <if test="achieveResults != null">
  98. achieve_results,
  99. </if>
  100. <if test="consultantName != null">
  101. consultant_name,
  102. </if>
  103. <if test="status != null">
  104. `status`,
  105. </if>
  106. <if test="openTime != null">
  107. open_time,
  108. </if>
  109. <if test="createTime != null">
  110. create_time,
  111. </if>
  112. <if test="aid != null">
  113. aid,
  114. </if>
  115. <if test="browseCount != null">
  116. browse_count,
  117. </if>
  118. <if test="downloadCount != null">
  119. download_count,
  120. </if>
  121. </trim>
  122. <trim prefix="values (" suffix=")" suffixOverrides=",">
  123. <if test="userName != null">
  124. #{userName,jdbcType=VARCHAR},
  125. </if>
  126. <if test="rdNo != null">
  127. #{rdNo,jdbcType=VARCHAR},
  128. </if>
  129. <if test="ipNo != null">
  130. #{ipNo,jdbcType=VARCHAR},
  131. </if>
  132. <if test="rdName != null">
  133. #{rdName,jdbcType=VARCHAR},
  134. </if>
  135. <if test="rdStart != null">
  136. #{rdStart,jdbcType=TIMESTAMP},
  137. </if>
  138. <if test="rdEnd != null">
  139. #{rdEnd,jdbcType=TIMESTAMP},
  140. </if>
  141. <if test="technicalField != null">
  142. #{technicalField,jdbcType=VARCHAR},
  143. </if>
  144. <if test="technologySource != null">
  145. #{technologySource,jdbcType=VARCHAR},
  146. </if>
  147. <if test="totalAmount != null">
  148. #{totalAmount,jdbcType=DECIMAL},
  149. </if>
  150. <if test="recentThreeAmount != null">
  151. #{recentThreeAmount,jdbcType=DECIMAL},
  152. </if>
  153. <if test="rdObjective != null">
  154. #{rdObjective,jdbcType=VARCHAR},
  155. </if>
  156. <if test="coreTechnology != null">
  157. #{coreTechnology,jdbcType=VARCHAR},
  158. </if>
  159. <if test="achieveResults != null">
  160. #{achieveResults,jdbcType=VARCHAR},
  161. </if>
  162. <if test="consultantName != null">
  163. #{consultantName,jdbcType=VARCHAR},
  164. </if>
  165. <if test="status != null">
  166. #{status,jdbcType=INTEGER},
  167. </if>
  168. <if test="openTime != null">
  169. #{openTime,jdbcType=TIMESTAMP},
  170. </if>
  171. <if test="createTime != null">
  172. #{createTime,jdbcType=TIMESTAMP},
  173. </if>
  174. <if test="aid != null">
  175. #{aid,jdbcType=VARCHAR},
  176. </if>
  177. <if test="browseCount != null">
  178. #{browseCount,jdbcType=INTEGER},
  179. </if>
  180. <if test="downloadCount != null">
  181. #{downloadCount,jdbcType=INTEGER},
  182. </if>
  183. </trim>
  184. </insert>
  185. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.RdDetails">
  186. update rd_details
  187. <set>
  188. <if test="userName != null">
  189. user_name = #{userName,jdbcType=VARCHAR},
  190. </if>
  191. <if test="rdNo != null">
  192. rd_no = #{rdNo,jdbcType=VARCHAR},
  193. </if>
  194. <if test="ipNo != null">
  195. ip_no = #{ipNo,jdbcType=VARCHAR},
  196. </if>
  197. <if test="rdName != null">
  198. rd_name = #{rdName,jdbcType=VARCHAR},
  199. </if>
  200. <if test="rdStart != null">
  201. rd_start = #{rdStart,jdbcType=TIMESTAMP},
  202. </if>
  203. <if test="rdEnd != null">
  204. rd_end = #{rdEnd,jdbcType=TIMESTAMP},
  205. </if>
  206. <if test="technicalField != null">
  207. technical_field = #{technicalField,jdbcType=VARCHAR},
  208. </if>
  209. <if test="technologySource != null">
  210. technology_source = #{technologySource,jdbcType=VARCHAR},
  211. </if>
  212. <if test="totalAmount != null">
  213. total_amount = #{totalAmount,jdbcType=DECIMAL},
  214. </if>
  215. <if test="recentThreeAmount != null">
  216. recent_three_amount = #{recentThreeAmount,jdbcType=DECIMAL},
  217. </if>
  218. <if test="rdObjective != null">
  219. rd_objective = #{rdObjective,jdbcType=VARCHAR},
  220. </if>
  221. <if test="coreTechnology != null">
  222. core_technology = #{coreTechnology,jdbcType=VARCHAR},
  223. </if>
  224. <if test="achieveResults != null">
  225. achieve_results = #{achieveResults,jdbcType=VARCHAR},
  226. </if>
  227. <if test="consultantName != null">
  228. consultant_name = #{consultantName,jdbcType=VARCHAR},
  229. </if>
  230. <if test="status != null">
  231. `status` = #{status,jdbcType=INTEGER},
  232. </if>
  233. <if test="openTime != null">
  234. open_time = #{openTime,jdbcType=TIMESTAMP},
  235. </if>
  236. <if test="createTime != null">
  237. create_time = #{createTime,jdbcType=TIMESTAMP},
  238. </if>
  239. <if test="aid != null">
  240. aid = #{aid,jdbcType=VARCHAR},
  241. </if>
  242. <if test="browseCount != null">
  243. browse_count = #{browseCount,jdbcType=INTEGER},
  244. </if>
  245. <if test="downloadCount != null">
  246. download_count = #{downloadCount,jdbcType=INTEGER},
  247. </if>
  248. </set>
  249. where id = #{id,jdbcType=BIGINT}
  250. </update>
  251. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.RdDetails">
  252. update rd_details
  253. set user_name = #{userName,jdbcType=VARCHAR},
  254. rd_no = #{rdNo,jdbcType=VARCHAR},
  255. ip_no = #{ipNo,jdbcType=VARCHAR},
  256. rd_name = #{rdName,jdbcType=VARCHAR},
  257. rd_start = #{rdStart,jdbcType=TIMESTAMP},
  258. rd_end = #{rdEnd,jdbcType=TIMESTAMP},
  259. technical_field = #{technicalField,jdbcType=VARCHAR},
  260. technology_source = #{technologySource,jdbcType=VARCHAR},
  261. total_amount = #{totalAmount,jdbcType=DECIMAL},
  262. recent_three_amount = #{recentThreeAmount,jdbcType=DECIMAL},
  263. rd_objective = #{rdObjective,jdbcType=VARCHAR},
  264. core_technology = #{coreTechnology,jdbcType=VARCHAR},
  265. achieve_results = #{achieveResults,jdbcType=VARCHAR},
  266. consultant_name = #{consultantName,jdbcType=VARCHAR},
  267. `status` = #{status,jdbcType=INTEGER},
  268. open_time = #{openTime,jdbcType=TIMESTAMP},
  269. create_time = #{createTime,jdbcType=TIMESTAMP},
  270. aid = #{aid,jdbcType=VARCHAR},
  271. browse_count = #{browseCount,jdbcType=INTEGER},
  272. download_count = #{downloadCount,jdbcType=INTEGER}
  273. where id = #{id,jdbcType=BIGINT}
  274. </update>
  275. <select id="checkRdNo" resultType="java.lang.Integer">
  276. select count(*)
  277. from rd_details
  278. where rd_no =#{rdNo}
  279. <if test="id !=null">
  280. and id !=#{id}
  281. </if>
  282. </select>
  283. <sql id="details_List">
  284. a.id, a.user_name userName, a.rd_no rdNo, a.ip_no ipNo, a.rd_name rdName,a.technical_field technicalField,
  285. a.technology_source technologySource, a.total_amount totalAmount, a.recent_three_amount recentThreeAmount,a.aid,
  286. a.rd_objective rdObjective, a.core_technology coreTechnology, a.achieve_results achieveResults,a.consultant_name consultantName,
  287. a.status,a.browse_count browseCount ,a.download_count downloadCount, date_format(a.rd_start, '%Y-%m-%d') rdStartStr,
  288. date_format(a.rd_end , '%Y-%m-%d') rdEndStr,date_format(a.open_time, '%Y-%m-%d %H:%i:%s')openTimeStr,
  289. date_format(a.create_time, '%Y-%m-%d %H:%i:%s') createTimeStr
  290. </sql>
  291. <select id="details" resultType="com.goafanti.RD.bo.OutRdDetails">
  292. select
  293. <include refid="details_List" />
  294. from rd_details a
  295. where a.id =#{id}
  296. </select>
  297. <select id="RdDetailsList" resultType="com.goafanti.RD.bo.InputExcelRdDetails">
  298. select
  299. <include refid="details_List" />
  300. from rd_details a
  301. where 1=1
  302. <if test="RdStart !=null and RdEnd !=null">
  303. and a.rd_start >= #{RdStart} and a.rd_end <![CDATA[ <= ]]> #{RdEnd}
  304. </if>
  305. <if test="RdName !=null ">
  306. and a.rd_name =#{RdName}
  307. </if>
  308. <if test="page_sql !=null ">
  309. ${page_sql}
  310. </if>
  311. </select>
  312. <select id="RdDetailsCount" resultType="java.lang.Integer">
  313. select
  314. count(*)
  315. from rd_details a
  316. where 1=1
  317. <if test="RdStart !=null and RdEnd !=null">
  318. and a.rd_start >= #{RdStart} and a.rd_end <![CDATA[ <= ]]> #{RdEnd}
  319. </if>
  320. <if test="RdName !=null ">
  321. and a.rd_name =#{RdName}
  322. </if>
  323. </select>
  324. <insert id="insertBatch">
  325. insert into rd_details (user_name, rd_no, ip_no,
  326. rd_name, rd_start, rd_end,
  327. technical_field, technology_source, total_amount,
  328. recent_three_amount, rd_objective, core_technology,
  329. achieve_results, consultant_name, `status`,
  330. open_time, create_time, aid
  331. ) values
  332. <foreach item="item" index="index" collection="list" separator=",">
  333. (#{item.userName,jdbcType=VARCHAR}, #{item.rdNo,jdbcType=VARCHAR}, #{item.ipNo,jdbcType=VARCHAR},
  334. #{item.rdName,jdbcType=VARCHAR}, #{item.rdStart,jdbcType=TIMESTAMP}, #{item.rdEnd,jdbcType=TIMESTAMP},
  335. #{item.technicalField,jdbcType=VARCHAR}, #{item.technologySource,jdbcType=VARCHAR}, #{item.totalAmount,jdbcType=DECIMAL},
  336. #{item.recentThreeAmount,jdbcType=DECIMAL}, #{item.rdObjective,jdbcType=VARCHAR}, #{item.coreTechnology,jdbcType=VARCHAR},
  337. #{item.achieveResults,jdbcType=VARCHAR}, #{item.consultantName,jdbcType=VARCHAR}, #{item.status,jdbcType=INTEGER},
  338. #{item.openTime,jdbcType=TIMESTAMP}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.aid,jdbcType=VARCHAR}
  339. )
  340. </foreach>
  341. </insert>
  342. <update id="updateBrowseOrDownload">
  343. update rd_details
  344. <set>
  345. <if test="type==0">
  346. browse_count = browse_count+1
  347. </if>
  348. <if test="type==1">
  349. download_count = download_count+1
  350. </if>
  351. where id = #{id,jdbcType=BIGINT}
  352. </set>
  353. </update>
  354. </mapper>