RdDetailsMapper.xml 12 KB

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