TechProjectMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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.TechProjectMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.TechProject">
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="uid" property="uid" jdbcType="VARCHAR" />
  7. <result column="serial_number" property="serialNumber"
  8. jdbcType="INTEGER" />
  9. <result column="contacts" property="contacts" jdbcType="INTEGER" />
  10. <result column="department" property="department" jdbcType="VARCHAR" />
  11. <result column="dispatch_info" property="dispatchInfo"
  12. jdbcType="VARCHAR" />
  13. <result column="project_name" property="projectName" jdbcType="VARCHAR" />
  14. <result column="project_catagory" property="projectCatagory"
  15. jdbcType="VARCHAR" />
  16. <result column="tech_field" property="techField" jdbcType="VARCHAR" />
  17. <result column="project_des" property="projectDes" jdbcType="VARCHAR" />
  18. <result column="project_mode" property="projectMode" jdbcType="INTEGER" />
  19. <result column="project_approval" property="projectApproval"
  20. jdbcType="DECIMAL" />
  21. <result column="subsidy" property="subsidy" jdbcType="INTEGER" />
  22. <result column="consultant" property="consultant" jdbcType="VARCHAR" />
  23. <result column="approval_url" property="approvalUrl" jdbcType="VARCHAR" />
  24. <result column="state" property="state" jdbcType="INTEGER" />
  25. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  26. <result column="accept_date" property="acceptDate" jdbcType="TIMESTAMP" />
  27. <result column="approved_date" property="approvedDate"
  28. jdbcType="TIMESTAMP" />
  29. <result column="record_time" property="recordTime" jdbcType="TIMESTAMP" />
  30. <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
  31. </resultMap>
  32. <sql id="Base_Column_List">
  33. id, uid, serial_number, contacts, department, dispatch_info,
  34. project_name, project_catagory,
  35. tech_field, project_des, project_mode, project_approval, subsidy, consultant,
  36. approval_url,
  37. state, create_time, accept_date, approved_date, record_time, deleted_sign
  38. </sql>
  39. <select id="selectByPrimaryKey" resultMap="BaseResultMap"
  40. parameterType="java.lang.String">
  41. select
  42. <include refid="Base_Column_List" />
  43. from tech_project
  44. where id = #{id,jdbcType=VARCHAR}
  45. </select>
  46. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  47. delete from tech_project
  48. where id = #{id,jdbcType=VARCHAR}
  49. </delete>
  50. <insert id="insert" parameterType="com.goafanti.common.model.TechProject">
  51. insert into tech_project (id, uid, serial_number,
  52. contacts, department, dispatch_info,
  53. project_name, project_catagory, tech_field,
  54. project_des, project_mode, project_approval,
  55. subsidy, consultant, approval_url,
  56. state, create_time, accept_date,
  57. approved_date, record_time, deleted_sign
  58. )
  59. values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR},
  60. #{serialNumber,jdbcType=INTEGER},
  61. #{contacts,jdbcType=INTEGER}, #{department,jdbcType=VARCHAR}, #{dispatchInfo,jdbcType=VARCHAR},
  62. #{projectName,jdbcType=VARCHAR}, #{projectCatagory,jdbcType=VARCHAR},
  63. #{techField,jdbcType=VARCHAR},
  64. #{projectDes,jdbcType=VARCHAR}, #{projectMode,jdbcType=INTEGER}, #{projectApproval,jdbcType=DECIMAL},
  65. #{subsidy,jdbcType=INTEGER}, #{consultant,jdbcType=VARCHAR},
  66. #{approvalUrl,jdbcType=VARCHAR},
  67. #{state,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{acceptDate,jdbcType=TIMESTAMP},
  68. #{approvedDate,jdbcType=TIMESTAMP}, #{recordTime,jdbcType=TIMESTAMP},
  69. #{deletedSign,jdbcType=INTEGER}
  70. )
  71. </insert>
  72. <insert id="insertSelective" parameterType="com.goafanti.common.model.TechProject">
  73. insert into tech_project
  74. <trim prefix="(" suffix=")" suffixOverrides=",">
  75. <if test="id != null">
  76. id,
  77. </if>
  78. <if test="uid != null">
  79. uid,
  80. </if>
  81. <if test="serialNumber != null">
  82. serial_number,
  83. </if>
  84. <if test="contacts != null">
  85. contacts,
  86. </if>
  87. <if test="department != null">
  88. department,
  89. </if>
  90. <if test="dispatchInfo != null">
  91. dispatch_info,
  92. </if>
  93. <if test="projectName != null">
  94. project_name,
  95. </if>
  96. <if test="projectCatagory != null">
  97. project_catagory,
  98. </if>
  99. <if test="techField != null">
  100. tech_field,
  101. </if>
  102. <if test="projectDes != null">
  103. project_des,
  104. </if>
  105. <if test="projectMode != null">
  106. project_mode,
  107. </if>
  108. <if test="projectApproval != null">
  109. project_approval,
  110. </if>
  111. <if test="subsidy != null">
  112. subsidy,
  113. </if>
  114. <if test="consultant != null">
  115. consultant,
  116. </if>
  117. <if test="approvalUrl != null">
  118. approval_url,
  119. </if>
  120. <if test="state != null">
  121. state,
  122. </if>
  123. <if test="createTime != null">
  124. create_time,
  125. </if>
  126. <if test="acceptDate != null">
  127. accept_date,
  128. </if>
  129. <if test="approvedDate != null">
  130. approved_date,
  131. </if>
  132. <if test="recordTime != null">
  133. record_time,
  134. </if>
  135. <if test="deletedSign != null">
  136. deleted_sign,
  137. </if>
  138. </trim>
  139. <trim prefix="values (" suffix=")" suffixOverrides=",">
  140. <if test="id != null">
  141. #{id,jdbcType=VARCHAR},
  142. </if>
  143. <if test="uid != null">
  144. #{uid,jdbcType=VARCHAR},
  145. </if>
  146. <if test="serialNumber != null">
  147. #{serialNumber,jdbcType=INTEGER},
  148. </if>
  149. <if test="contacts != null">
  150. #{contacts,jdbcType=INTEGER},
  151. </if>
  152. <if test="department != null">
  153. #{department,jdbcType=VARCHAR},
  154. </if>
  155. <if test="dispatchInfo != null">
  156. #{dispatchInfo,jdbcType=VARCHAR},
  157. </if>
  158. <if test="projectName != null">
  159. #{projectName,jdbcType=VARCHAR},
  160. </if>
  161. <if test="projectCatagory != null">
  162. #{projectCatagory,jdbcType=VARCHAR},
  163. </if>
  164. <if test="techField != null">
  165. #{techField,jdbcType=VARCHAR},
  166. </if>
  167. <if test="projectDes != null">
  168. #{projectDes,jdbcType=VARCHAR},
  169. </if>
  170. <if test="projectMode != null">
  171. #{projectMode,jdbcType=INTEGER},
  172. </if>
  173. <if test="projectApproval != null">
  174. #{projectApproval,jdbcType=DECIMAL},
  175. </if>
  176. <if test="subsidy != null">
  177. #{subsidy,jdbcType=INTEGER},
  178. </if>
  179. <if test="consultant != null">
  180. #{consultant,jdbcType=VARCHAR},
  181. </if>
  182. <if test="approvalUrl != null">
  183. #{approvalUrl,jdbcType=VARCHAR},
  184. </if>
  185. <if test="state != null">
  186. #{state,jdbcType=INTEGER},
  187. </if>
  188. <if test="createTime != null">
  189. #{createTime,jdbcType=TIMESTAMP},
  190. </if>
  191. <if test="acceptDate != null">
  192. #{acceptDate,jdbcType=TIMESTAMP},
  193. </if>
  194. <if test="approvedDate != null">
  195. #{approvedDate,jdbcType=TIMESTAMP},
  196. </if>
  197. <if test="recordTime != null">
  198. #{recordTime,jdbcType=TIMESTAMP},
  199. </if>
  200. <if test="deletedSign != null">
  201. #{deletedSign,jdbcType=INTEGER},
  202. </if>
  203. </trim>
  204. </insert>
  205. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TechProject">
  206. update tech_project
  207. <set>
  208. <if test="uid != null">
  209. uid = #{uid,jdbcType=VARCHAR},
  210. </if>
  211. <if test="serialNumber != null">
  212. serial_number = #{serialNumber,jdbcType=INTEGER},
  213. </if>
  214. <if test="contacts != null">
  215. contacts = #{contacts,jdbcType=INTEGER},
  216. </if>
  217. <if test="department != null">
  218. department = #{department,jdbcType=VARCHAR},
  219. </if>
  220. <if test="dispatchInfo != null">
  221. dispatch_info = #{dispatchInfo,jdbcType=VARCHAR},
  222. </if>
  223. <if test="projectName != null">
  224. project_name = #{projectName,jdbcType=VARCHAR},
  225. </if>
  226. <if test="projectCatagory != null">
  227. project_catagory = #{projectCatagory,jdbcType=VARCHAR},
  228. </if>
  229. <if test="techField != null">
  230. tech_field = #{techField,jdbcType=VARCHAR},
  231. </if>
  232. <if test="projectDes != null">
  233. project_des = #{projectDes,jdbcType=VARCHAR},
  234. </if>
  235. <if test="projectMode != null">
  236. project_mode = #{projectMode,jdbcType=INTEGER},
  237. </if>
  238. <if test="projectApproval != null">
  239. project_approval = #{projectApproval,jdbcType=DECIMAL},
  240. </if>
  241. <if test="subsidy != null">
  242. subsidy = #{subsidy,jdbcType=INTEGER},
  243. </if>
  244. <if test="consultant != null">
  245. consultant = #{consultant,jdbcType=VARCHAR},
  246. </if>
  247. <if test="approvalUrl != null">
  248. approval_url = #{approvalUrl,jdbcType=VARCHAR},
  249. </if>
  250. <if test="state != null">
  251. state = #{state,jdbcType=INTEGER},
  252. </if>
  253. <if test="createTime != null">
  254. create_time = #{createTime,jdbcType=TIMESTAMP},
  255. </if>
  256. <if test="acceptDate != null">
  257. accept_date = #{acceptDate,jdbcType=TIMESTAMP},
  258. </if>
  259. <if test="approvedDate != null">
  260. approved_date = #{approvedDate,jdbcType=TIMESTAMP},
  261. </if>
  262. <if test="recordTime != null">
  263. record_time = #{recordTime,jdbcType=TIMESTAMP},
  264. </if>
  265. <if test="deletedSign != null">
  266. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  267. </if>
  268. </set>
  269. where id = #{id,jdbcType=VARCHAR}
  270. </update>
  271. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TechProject">
  272. update tech_project
  273. set uid = #{uid,jdbcType=VARCHAR},
  274. serial_number = #{serialNumber,jdbcType=INTEGER},
  275. contacts = #{contacts,jdbcType=INTEGER},
  276. department = #{department,jdbcType=VARCHAR},
  277. dispatch_info = #{dispatchInfo,jdbcType=VARCHAR},
  278. project_name = #{projectName,jdbcType=VARCHAR},
  279. project_catagory = #{projectCatagory,jdbcType=VARCHAR},
  280. tech_field = #{techField,jdbcType=VARCHAR},
  281. project_des = #{projectDes,jdbcType=VARCHAR},
  282. project_mode = #{projectMode,jdbcType=INTEGER},
  283. project_approval = #{projectApproval,jdbcType=DECIMAL},
  284. subsidy = #{subsidy,jdbcType=INTEGER},
  285. consultant = #{consultant,jdbcType=VARCHAR},
  286. approval_url = #{approvalUrl,jdbcType=VARCHAR},
  287. state = #{state,jdbcType=INTEGER},
  288. create_time = #{createTime,jdbcType=TIMESTAMP},
  289. accept_date = #{acceptDate,jdbcType=TIMESTAMP},
  290. approved_date = #{approvedDate,jdbcType=TIMESTAMP},
  291. record_time = #{recordTime,jdbcType=TIMESTAMP},
  292. deleted_sign = #{deletedSign,jdbcType=INTEGER}
  293. where id = #{id,jdbcType=VARCHAR}
  294. </update>
  295. <select id="findTechProjectClientListByPage" parameterType="java.lang.String"
  296. resultType="com.goafanti.techproject.bo.TechProjectClientListBo">
  297. select p.id, p.uid, i.location_province as province,
  298. i.unit_name as unitName,
  299. CONCAT(i.first_contacts,' ', i.first_mobile) as firstContacts,
  300. CONCAT(i.second_contacts,' ', i.second_mobile) as secondContacts,
  301. CONCAT(i.third_contacts,' ', i.third_mobile) as thirdContacts,
  302. p.serial_number as serialNumber, p.create_time as createTime, p.approved_date as approvedDate,
  303. p.accept_date as acceptDate, a.name as consultant, p.contacts,
  304. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField, p.state
  305. FROM tech_project p
  306. LEFT JOIN organization_identity i on i.uid = p.uid
  307. LEFT JOIN admin a on p.consultant = a.id
  308. where p.deleted_sign = 0
  309. <if test ="uid != null">
  310. and p.uid = #{uid,jdbcType=VARCHAR}
  311. </if>
  312. order by p.serial_number desc
  313. <if test="page_sql!=null">
  314. ${page_sql}
  315. </if>
  316. </select>
  317. <select id="findTechProjectClientCount" resultType="java.lang.Integer" parameterType="String">
  318. select count(1)
  319. FROM tech_project p
  320. LEFT JOIN organization_identity i on i.uid = p.uid
  321. LEFT JOIN admin a on p.consultant = a.id
  322. where p.deleted_sign = 0
  323. <if test ="uid != null">
  324. and p.uid = #{uid,jdbcType=VARCHAR}
  325. </if>
  326. </select>
  327. <select id ="findTechProjectManageListByPage" parameterType="java.lang.String"
  328. resultType="com.goafanti.techproject.bo.TechProjectManageListBo">
  329. select x.* from (select p.id, p.uid, i.location_province as province,
  330. i.unit_name as unitName,
  331. CONCAT(i.first_contacts,' ', i.first_mobile) as firstContacts,
  332. CONCAT(i.second_contacts,' ', i.second_mobile) as secondContacts,
  333. CONCAT(i.third_contacts,' ', i.third_mobile) as thirdContacts,
  334. p.serial_number as serialNumber, p.create_time as createTime, p.approved_date as approvedDate,
  335. p.accept_date as acceptDate, a.name as consultant, p.contacts,
  336. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField, p.state,
  337. w.id as wid, w.website, w.account_number as accountNumber, w.department, w.password, p.deleted_sign as pd, w.deleted_sign as wd
  338. FROM tech_project p
  339. LEFT JOIN organization_identity i on i.uid = p.uid
  340. LEFT JOIN admin a on p.consultant = a.id
  341. LEFT JOIN tech_website w on p.department = w.id where p.deleted_sign = 0 ) x where x.wd = 0 or x.wd is null
  342. <if test="province != null">
  343. and x.province = #{province,jdbcType=VARCHAR}
  344. </if>
  345. <if test="unitName != null" >
  346. and x.unitName like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')
  347. </if>
  348. order by x.serialNumber desc
  349. <if test="page_sql!=null">
  350. ${page_sql}
  351. </if>
  352. </select>
  353. <select id="findTechProjectManageCount" resultType="java.lang.Integer" parameterType="String">
  354. select count(1) from ( select x.* from (select p.id, p.uid, i.location_province as province,
  355. i.unit_name as unitName,
  356. CONCAT(i.first_contacts,' ', i.first_mobile) as firstContacts,
  357. CONCAT(i.second_contacts,' ', i.second_mobile) as secondContacts,
  358. CONCAT(i.third_contacts,' ', i.third_mobile) as thirdContacts,
  359. p.serial_number as serialNumber, p.create_time as createTime, p.approved_date as approvedDate,
  360. p.accept_date as acceptDate, a.name as consultant, p.contacts,
  361. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField, p.state,
  362. w.id as wid, w.website, w.account_number as accountNumber, w.department, w.password, p.deleted_sign as pd, w.deleted_sign as wd
  363. FROM tech_project p
  364. LEFT JOIN organization_identity i on i.uid = p.uid
  365. LEFT JOIN admin a on p.consultant = a.id
  366. LEFT JOIN tech_website w on p.department = w.id where p.deleted_sign = 0 ) x where x.wd = 0 or x.wd is null
  367. <if test="province != null">
  368. and x.province = #{province,jdbcType=VARCHAR}
  369. </if>
  370. <if test="unitName != null" >
  371. and x.unitName like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')
  372. </if>
  373. ) y
  374. </select>
  375. <select id="selectProjectDetail" resultType="com.goafanti.techproject.bo.TechProjectDetailBo" parameterType="java.lang.String">
  376. select
  377. p.id, p.uid, i.location_province as province, i.location_city as city, i.location_area as area,
  378. i.unit_name as unitName, i.org_code as orgCode,
  379. p.serial_number as serialNumber,
  380. a.name as consultant, p.contacts, p.project_des as projectDes, p.subsidy, p.dispatch_info as dispatchInfo,
  381. p.project_mode as projectMode, p.project_approval as projectApproval, p.approval_url as approvalUrl , p.department,
  382. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField, p.state
  383. FROM tech_project p
  384. LEFT JOIN organization_identity i on i.uid = p.uid
  385. LEFT JOIN admin a on p.consultant = a.id
  386. where p.deleted_sign = 0 and p.id = #{uid,jdbcType=VARCHAR}
  387. </select>
  388. <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
  389. update tech_project set deleted_sign = 1
  390. where id in
  391. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  392. #{item}
  393. </foreach>
  394. </update>
  395. </mapper>