CenterdataTKeyProjectsMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.sooka.sponest.data.generalbusiness.mapper.CenterdataTKeyProjectsMapper">
  6. <resultMap type="CenterdataTKeyProjects" id="CenterdataTKeyProjectsResult">
  7. <result property="id" column="id"/>
  8. <result property="projectName" column="project_name"/>
  9. <result property="projectTarget" column="project_target"/>
  10. <result property="projectType" column="project_type"/>
  11. <result property="projectLevel" column="project_level"/>
  12. <result property="constructionUnit" column="construction_unit"/>
  13. <result property="principal" column="principal"/>
  14. <result property="phone" column="phone"/>
  15. <result property="constructionSite" column="construction_site"/>
  16. <result property="constructionArea" column="construction_area"/>
  17. <result property="longitude" column="longitude"/>
  18. <result property="latitude" column="latitude"/>
  19. <result property="createTime" column="create_time"/>
  20. <result property="photoId" column="photo_id"/>
  21. <result property="cameraSystem" column="camera_system"/>
  22. <result property="deptId" column="dept_id"/>
  23. <result property="deptName" column="dept_name"/>
  24. <result property="orderNum" column="order_num"/>
  25. <result property="introduction" column="introduction"/>
  26. <result property="createBy" column="create_by"/>
  27. <result property="createName" column="create_name"/>
  28. <result property="createTime" column="create_time"/>
  29. <result property="updateBy" column="update_by"/>
  30. <result property="updateName" column="update_name"/>
  31. <result property="updateTime" column="update_time"/>
  32. <result property="territoriality" column="territoriality"/>
  33. <result property="park" column="park"/>
  34. <result property="parkLongitude" column="park_longitude"/>
  35. <result property="parkLatitude" column="park_latitude"/>
  36. <result property="environment" column="environment"/>
  37. <result property="legalUnit" column="legal_unit"/>
  38. <result property="startTime" column="start_time"/>
  39. <result property="endTime" column="end_time"/>
  40. <result property="nature" column="nature"/>
  41. <result property="totalInvest" column="total_invest"/>
  42. <result property="yearInvest" column="year_invest"/>
  43. <result property="industryType" column="industry_type"/>
  44. <result property="secretary" column="secretary"/>
  45. <result property="secretaryDuties" column="secretary_duties"/>
  46. <result property="secretaryPhone" column="secretary_phone"/>
  47. <result property="parkLabel" column="parkLabel"/>
  48. <result property="projectId" column="project_id"/>
  49. </resultMap>
  50. <sql id="selectCenterdataTKeyProjectsVo">
  51. select id, project_name, project_target, project_type, project_level, construction_unit, principal, phone, construction_site, construction_area, longitude, latitude, camera_system, dept_id, dept_name, order_num, introduction,
  52. photo_id, create_time, create_by, create_name, update_time, update_by, update_name, territoriality, park, park_longitude, park_latitude, environment, legal_unit, start_time, end_time, nature, total_invest, year_invest, industry_type,
  53. secretary, secretary_duties, secretary_phone,project_id from centerdata_t_key_projects
  54. </sql>
  55. <select id="selectCenterdataTKeyProjectsList" parameterType="CenterdataTKeyProjects"
  56. resultMap="CenterdataTKeyProjectsResult">
  57. select a.* ,
  58. dd.dept_name as parkLabel
  59. from centerdata_t_key_projects a
  60. left join ${database_system}.sys_dept d ON d.dept_id = a.dept_id
  61. LEFT JOIN ${database_system}.sys_dept dd on dd.dept_id = a.park
  62. <where>
  63. <if test="projectName != null and projectName != ''">and project_name like concat('%', #{projectName},
  64. '%')
  65. </if>
  66. <if test="projectTarget != null and projectTarget != ''">and project_target = #{projectTarget}</if>
  67. <if test="projectType != null and projectType != ''">and project_type = #{projectType}</if>
  68. <if test="projectLevel != null and projectLevel != ''">and project_level = #{projectLevel}</if>
  69. <if test="constructionUnit != null and constructionUnit != ''">and construction_unit like concat('%', #{constructionUnit},'%')</if>
  70. <if test="principal != null and principal != ''">and principal = #{principal}</if>
  71. <if test="phone != null and phone != ''">and phone = #{phone}</if>
  72. <if test="constructionSite != null and constructionSite != ''">and construction_site =
  73. #{constructionSite}
  74. </if>
  75. <if test="constructionArea != null and constructionArea != ''">and construction_area =
  76. #{constructionArea}
  77. </if>
  78. <if test="longitude != null and longitude != ''">and longitude = #{longitude}</if>
  79. <if test="latitude != null and latitude != ''">and latitude = #{latitude}</if>
  80. <if test="cameraSystem != null and cameraSystem != ''">and camera_system = #{cameraSystem}</if>
  81. <if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
  82. <if test="introduction != null and introduction != ''">and introduction = #{introduction}</if>
  83. <if test="territoriality != null and territoriality != ''">and territoriality = #{territoriality}</if>
  84. <if test="park != null and park != ''">and park = #{park}</if>
  85. ${params.dataScope}
  86. </where>
  87. order by a.order_num,a.create_time desc
  88. </select>
  89. <select id="selectCenterdataTKeyProjectsById" parameterType="String" resultMap="CenterdataTKeyProjectsResult">
  90. <include refid="selectCenterdataTKeyProjectsVo"/>
  91. where id = #{id}
  92. </select>
  93. <insert id="insertCenterdataTKeyProjects" parameterType="CenterdataTKeyProjects">
  94. insert into centerdata_t_key_projects
  95. <trim prefix="(" suffix=")" suffixOverrides=",">
  96. <if test="id != null">id,</if>
  97. <if test="projectName != null">project_name,</if>
  98. <if test="projectTarget != null">project_target,</if>
  99. <if test="projectType != null">project_type,</if>
  100. <if test="projectLevel != null">project_level,</if>
  101. <if test="constructionUnit != null">construction_unit,</if>
  102. <if test="principal != null">principal,</if>
  103. <if test="phone != null">phone,</if>
  104. <if test="constructionSite != null">construction_site,</if>
  105. <if test="constructionArea != null">construction_area,</if>
  106. <if test="longitude != null">longitude,</if>
  107. <if test="latitude != null">latitude,</if>
  108. <if test="cameraSystem != null">camera_system,</if>
  109. <if test="deptId != null and deptId != ''">dept_id,</if>
  110. <if test="deptName != null and deptName != ''">dept_name,</if>
  111. <if test="orderNum != null">order_num,</if>
  112. <if test="introduction != null">introduction,</if>
  113. <if test="photoId != null">photo_id,</if>
  114. <if test="createBy != null">create_by,</if>
  115. <if test="createTime != null">create_time,</if>
  116. <if test="createName != null">create_name,</if>
  117. <if test="updateName != null">update_name,</if>
  118. <if test="updateBy != null">update_by,</if>
  119. <if test="updateTime != null">update_time,</if>
  120. <if test="territoriality != null">territoriality,</if>
  121. <if test="park != null">park,</if>
  122. <if test="parkLongitude != null">park_longitude,</if>
  123. <if test="parkLatitude != null">park_latitude,</if>
  124. <if test="environment != null">environment,</if>
  125. <if test="legalUnit != null">legal_unit,</if>
  126. <if test="startTime != null">start_time,</if>
  127. <if test="endTime != null">end_time,</if>
  128. <if test="nature != null">nature,</if>
  129. <if test="totalInvest != null">total_invest,</if>
  130. <if test="yearInvest != null">year_invest,</if>
  131. <if test="industryType != null">industry_type,</if>
  132. <if test="secretary != null">secretary,</if>
  133. <if test="secretaryDuties != null">secretary_duties,</if>
  134. <if test="secretaryPhone != null">secretary_phone,</if>
  135. <if test="message != null">message,</if>
  136. <if test="projectId != null">project_id,</if>
  137. </trim>
  138. <trim prefix="values (" suffix=")" suffixOverrides=",">
  139. <if test="id != null">#{id},</if>
  140. <if test="projectName != null">#{projectName},</if>
  141. <if test="projectTarget != null">#{projectTarget},</if>
  142. <if test="projectType != null">#{projectType},</if>
  143. <if test="projectLevel != null">#{projectLevel},</if>
  144. <if test="constructionUnit != null">#{constructionUnit},</if>
  145. <if test="principal != null">#{principal},</if>
  146. <if test="phone != null">#{phone},</if>
  147. <if test="constructionSite != null">#{constructionSite},</if>
  148. <if test="constructionArea != null">#{constructionArea},</if>
  149. <if test="longitude != null">#{longitude},</if>
  150. <if test="latitude != null">#{latitude},</if>
  151. <if test="cameraSystem != null">#{cameraSystem},</if>
  152. <if test="deptId != null and deptId != ''">#{deptId},</if>
  153. <if test="deptName != null and deptName != ''">#{deptName},</if>
  154. <if test="orderNum != null">#{orderNum},</if>
  155. <if test="introduction != null">#{introduction},</if>
  156. <if test="photoId != null">#{photoId},</if>
  157. <if test="createBy != null">#{createBy},</if>
  158. <if test="createTime != null">#{createTime},</if>
  159. <if test="createName != null">#{createName},</if>
  160. <if test="updateName != null">#{updateName},</if>
  161. <if test="updateBy != null">#{updateBy},</if>
  162. <if test="updateTime != null">#{updateTime},</if>
  163. <if test="territoriality != null">#{territoriality},</if>
  164. <if test="park != null">#{park},</if>
  165. <if test="parkLongitude != null">#{parkLongitude},</if>
  166. <if test="parkLatitude != null">#{parkLatitude},</if>
  167. <if test="environment != null">#{environment},</if>
  168. <if test="legalUnit != null">#{legalUnit},</if>
  169. <if test="startTime != null">#{startTime},</if>
  170. <if test="endTime != null">#{endTime},</if>
  171. <if test="nature != null">#{nature},</if>
  172. <if test="totalInvest != null">#{totalInvest},</if>
  173. <if test="yearInvest != null">#{yearInvest},</if>
  174. <if test="industryType != null">#{industryType},</if>
  175. <if test="secretary != null">#{secretary},</if>
  176. <if test="secretaryDuties != null">#{secretaryDuties},</if>
  177. <if test="secretaryPhone != null">#{secretaryPhone},</if>
  178. <if test="message != null">#{message},</if>
  179. <if test="projectId != null">#{projectId},</if>
  180. </trim>
  181. </insert>
  182. <update id="updateCenterdataTKeyProjects" parameterType="CenterdataTKeyProjects">
  183. update centerdata_t_key_projects
  184. <trim prefix="SET" suffixOverrides=",">
  185. <if test="projectName != null">project_name = #{projectName},</if>
  186. <if test="projectTarget != null">project_target = #{projectTarget},</if>
  187. <if test="projectType != null">project_type = #{projectType},</if>
  188. <if test="projectLevel != null">project_level = #{projectLevel},</if>
  189. <if test="constructionUnit != null">construction_unit = #{constructionUnit},</if>
  190. <if test="principal != null">principal = #{principal},</if>
  191. <if test="phone != null">phone = #{phone},</if>
  192. <if test="constructionSite != null">construction_site = #{constructionSite},</if>
  193. <if test="constructionArea != null">construction_area = #{constructionArea},</if>
  194. <if test="longitude != null">longitude = #{longitude},</if>
  195. <if test="latitude != null">latitude = #{latitude},</if>
  196. <if test="cameraSystem != null">camera_system = #{cameraSystem},</if>
  197. <if test="deptId != null and deptId != ''">dept_id = #{deptId},</if>
  198. <if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
  199. <if test="photoId != null">photo_id = #{photoId},</if>
  200. <if test="orderNum != null">order_num = #{orderNum},</if>
  201. <if test="introduction != null">introduction = #{introduction},</if>
  202. <if test="createBy != null">create_by = #{createBy},</if>
  203. <if test="createName != null">create_name = #{createName},</if>
  204. <if test="createTime != null">create_time = #{createTime},</if>
  205. <if test="updateBy != null">update_by = #{updateBy},</if>
  206. <if test="updateName != null">update_name = #{updateName},</if>
  207. <if test="updateTime != null">update_time = #{updateTime},</if>
  208. <if test="territoriality != null">territoriality = #{territoriality},</if>
  209. <if test="park != null">park = #{park},</if>
  210. <if test="parkLongitude != null">park_longitude = #{parkLongitude},</if>
  211. <if test="parkLatitude != null">park_latitude = #{parkLatitude},</if>
  212. <if test="environment != null">environment = #{environment},</if>
  213. <if test="legalUnit != null">legal_unit = #{legalUnit},</if>
  214. <if test="startTime != null">start_time = #{startTime},</if>
  215. <if test="endTime != null">end_time = #{endTime},</if>
  216. <if test="nature != null">nature = #{nature},</if>
  217. <if test="totalInvest != null">total_invest = #{totalInvest},</if>
  218. <if test="yearInvest != null">year_invest = #{yearInvest},</if>
  219. <if test="industryType != null">industry_type = #{industryType},</if>
  220. <if test="secretary != null">secretary = #{secretary},</if>
  221. <if test="secretaryDuties != null">secretary_duties = #{secretaryDuties},</if>
  222. <if test="secretaryPhone != null">secretary_phone = #{secretaryPhone},</if>
  223. <if test="message != null">message = #{message},</if>
  224. </trim>
  225. where id = #{id}
  226. </update>
  227. <delete id="deleteCenterdataTKeyProjectsByIds" parameterType="String">
  228. delete from centerdata_t_key_projects where id in
  229. <foreach item="id" collection="array" open="(" separator="," close=")">
  230. #{id}
  231. </foreach>
  232. </delete>
  233. <select id="getSelectScheduleById" parameterType="String" resultType="java.lang.String">
  234. SELECT
  235. GROUP_CONCAT( a.schedule_pictures ) schedulePictures
  236. FROM
  237. centerdata_t_key_projects_schedule a
  238. WHERE
  239. a.key_projects_id = #{id}
  240. GROUP BY
  241. a.schedule_time
  242. ORDER BY
  243. a.schedule_time DESC
  244. LIMIT 1
  245. </select>
  246. </mapper>