MapDataDao.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  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.example.nngkxxdp.dao.MapDataDao">
  4. <!--修改一条数据-->
  5. <update id="updataByid">
  6. UPDATE s_map
  7. <trim prefix="set" suffixOverrides=",">
  8. <if test="maData.dictType !=null">
  9. dict_type=#{maData.dictType},
  10. </if>
  11. <if test="maData.address !=null">
  12. address=#{maData.address},
  13. </if>
  14. <if test="maData.content !=null">
  15. content=#{maData.content},
  16. </if>
  17. <if test="maData.dep !=null">
  18. dep=#{maData.dep},
  19. </if>
  20. <if test="maData.img !=null">
  21. img=#{maData.img},
  22. </if>
  23. <if test="maData.gzh !=null">
  24. gzh=#{maData.gzh},
  25. </if>
  26. <if test="maData.sptype !=null">
  27. sptype=#{maData.sptype},
  28. </if>
  29. <if test="maData.tel !=null">
  30. tel=#{maData.tel},
  31. </if>
  32. <if test="maData.time !=null">
  33. time=#{maData.time},
  34. </if>
  35. </trim>
  36. where id=#{maData.id}
  37. </update>
  38. <!--删除一条数据-->
  39. <delete id="delBymMapId">
  40. delete
  41. from s_map
  42. where id = #{id}
  43. </delete>
  44. <!--根据地址 类型 查需要更新或删除id-->
  45. <select id="sleMapId" resultType="java.lang.Integer">
  46. SELECT id FROM s_map
  47. <where>
  48. <if test="dicType !=null and dicType !=''">
  49. and dict_type=#{dicType}
  50. </if>
  51. <if test="address !=null and address !=''">
  52. and address=#{address}
  53. </if>
  54. <if test="sptype !=null and sptype !=''">
  55. and sptype=#{sptype}
  56. </if>
  57. </where>
  58. </select>
  59. <!--分页模糊查询-->
  60. <select id="selByMapData" resultType="java.util.Map">
  61. SELECT dict_type,
  62. address,
  63. dep,
  64. img,
  65. gzh,
  66. specialtype,
  67. tel,
  68. time,
  69. create_time,
  70. update_time
  71. FROM s_map
  72. <where>
  73. <if test="dictType !=null and dictType !=''" >
  74. and dict_type like CONCAT('%', #{dictType}, '%')
  75. </if>
  76. <if test="address !=null and address !=''" >
  77. and address like CONCAT('%', #{address}, '%')
  78. </if>
  79. <if test="dep !=null and dep !=''">
  80. and dep like CONCAT('%', #{dep}, '%')
  81. </if>
  82. </where>
  83. ORDER BY update_time DESC
  84. LIMIT #{page},#{count}
  85. </select>
  86. <sql id="all_base_data">
  87. id
  88. , dict_type, address, content, dep, img, gzh, sptype, tel,
  89. time, url, type, tag, tag2, tag3, specialtype, create_time,
  90. update_time
  91. </sql>
  92. <!-- 批量保存地图数据 -->
  93. <insert id="insertBatch" parameterType="java.util.List">
  94. INSERT INTO s_map (
  95. <include refid="all_base_data"/>
  96. )
  97. VALUES
  98. <foreach collection="mapDataList" item="map" separator=",">
  99. (NULL,
  100. #{map.dictType}, #{map.address}, #{map.content}, #{map.dep},
  101. #{map.img}, #{map.gzh}, #{map.sptype}, #{map.tel}, #{map.time}, #{map.url},
  102. #{map.type}, #{map.tag}, #{map.tag2}, #{map.tag3},
  103. #{map.specialtype}, NOW(), NOW())
  104. </foreach>
  105. </insert>
  106. <!-- 清空表数据信息 -->
  107. <update id="clearMapData">
  108. TRUNCATE TABLE s_map
  109. </update>
  110. <!-- 删除对应ID的地图纠错信息-->
  111. <delete id="deleteErrorLog">
  112. delete
  113. from s_map_errorlog
  114. where id = #{id}
  115. </delete>
  116. <!-- 根据数据字典类型获取地图数据 -->
  117. <select id="getMapDataByDictType"
  118. resultType="com.example.nngkxxdp.entity.MapData">
  119. SELECT
  120. <include refid="all_base_data"/>
  121. FROM s_map
  122. WHERE dict_type = #{dictType}
  123. </select>
  124. <!-- 根据地图数据所有的字典类型 -->
  125. <select id="getDictType" resultType="java.lang.String">
  126. SELECT dict_type
  127. FROM s_map
  128. </select>
  129. <!-- 根据地图数据所有的字典类型 -->
  130. <insert id="saveErrorLog" parameterType="map">
  131. INSERT INTO s_map_errorlog
  132. (s_map_id, address_name, original_address,
  133. original_longitude, original_latitude, original_phone, original_office_hours,
  134. new_phone, new_office_hours, new_address,
  135. new_longitude, new_latitude, error_state, create_time)
  136. VALUE
  137. (#{sMapId},#{addressName},#{originalAddress},
  138. #{originalLongitude},#{originalLatitude},#{originalPhone},#{originalOfficeHours},#{newPhone},#{newOfficeHours},
  139. #{newAddress},#{newLongitude},#{newLatitude},#{errorState},#{createTime})
  140. </insert>
  141. <select id="getHandMatterCount" resultType="java.lang.Integer">
  142. select count(*)
  143. from t_handling_matters
  144. <where>
  145. type=#{type}
  146. <if test="itemName != null">
  147. AND item_name LIKE CONCAT('%', #{itemName}, '%')
  148. </if>
  149. <if test="matterDept != null">
  150. AND matter_dept LIKE CONCAT('%', #{matterDept}, '%')
  151. </if>
  152. </where>
  153. </select>
  154. <select id="getHandMatterPage" resultType="java.util.Map">
  155. SELECT id,
  156. type,
  157. item_name,
  158. matter_dept,
  159. matter_url
  160. FROM t_handling_matters
  161. <where>
  162. type=#{type}
  163. <if test="itemName != null">
  164. AND item_name LIKE CONCAT('%', #{itemName}, '%')
  165. </if>
  166. <if test="matterDept != null">
  167. AND matter_dept LIKE CONCAT('%', #{matterDept}, '%')
  168. </if>
  169. </where>
  170. order by id DESC
  171. limit #{startRows},#{rows}
  172. </select>
  173. <select id="getMapErrorCount" resultType="java.lang.Integer">
  174. select count(*)
  175. from s_map_errorlog
  176. </select>
  177. <select id="getMapErrorPage" resultType="java.util.Map">
  178. SELECT sme.id,
  179. sme.original_address,
  180. sme.original_longitude,
  181. sme.original_latitude,
  182. sme.original_office_hours,
  183. sme.original_phone,
  184. sme.new_address,
  185. sme.new_longitude,
  186. sme.new_latitude,
  187. sme.new_office_hours,
  188. sme.new_phone,
  189. sme.create_time,
  190. sme.update_time,
  191. sm.dep name,
  192. sm.dict_type,
  193. sm.content
  194. FROM s_map_errorlog sme
  195. left join s_map sm on sm.id = sme.s_map_id
  196. order by sme.create_time DESC
  197. limit #{startRows}, #{rows}
  198. </select>
  199. <select id="queryMap" resultType="java.util.Map">
  200. select address,
  201. ifnull(longitude, '') longitude,
  202. ifnull(latitude, '') latitude,
  203. dep name,
  204. IF(dict_type = 'xxs', type, dict_type) dictType
  205. from s_map
  206. <where>
  207. <if test="null != name and '' != name">
  208. and dep LIKE CONCAT('%', #{name}, '%')
  209. </if>
  210. <if test="null != type and '' != type">
  211. and dict_type = #{type}
  212. </if>
  213. <if test="null != dictType and '' != dictType">
  214. and type = #{dictType}
  215. </if>
  216. </where>
  217. order by create_time desc
  218. </select>
  219. <update id="longitudeLatitude">
  220. UPDATE s_map
  221. SET longitude = #{longitude},
  222. latitude = #{latitude}
  223. WHERE id = #{id};
  224. </update>
  225. <update id="updateErrorLog">
  226. UPDATE s_map_errorlog
  227. SET new_address = #{newAddress},
  228. new_longitude = #{newLongitude},
  229. new_latitude = #{newLatitude},
  230. error_state = #{errorState},
  231. update_time = #{updateTime}
  232. WHERE id = #{id};
  233. </update>
  234. <select id="queryMapPage" resultType="com.example.nngkxxdp.entity.MapDo">
  235. SELECT
  236. id,
  237. dict_type,
  238. address,
  239. content,
  240. dep,
  241. img,
  242. gzh,
  243. sptype,
  244. tel,
  245. time,
  246. url,
  247. type,
  248. tag,
  249. tag2,
  250. tag3,
  251. specialtype,
  252. create_time,
  253. update_time,
  254. longitude,
  255. latitude
  256. FROM
  257. s_map
  258. <where>
  259. <if test="mapVo.nameOfOrganization!=null and mapVo.nameOfOrganization != ''">
  260. dep LIKE CONCAT('%',#{mapVo.nameOfOrganization},'%')
  261. </if>
  262. <if test="mapVo.serviceType!=null and mapVo.serviceType != ''">
  263. and sptype LIKE CONCAT('%',#{mapVo.serviceType},'%')
  264. </if>
  265. <if test="mapVo.dictType!=null and mapVo.dictType != ''">
  266. and dict_type = #{mapVo.dictType}
  267. </if>
  268. </where>
  269. order by create_time desc
  270. limit #{page},#{size}
  271. </select>
  272. <select id="pageCount" resultType="long">
  273. select count(*) from s_map
  274. <where>
  275. <if test="mapVo.nameOfOrganization!=null and mapVo.nameOfOrganization != ''">
  276. and dep LIKE CONCAT('%',#{mapVo.nameOfOrganization},'%')
  277. </if>
  278. <if test="mapVo.serviceType!=null and mapVo.serviceType != ''">
  279. and sptype LIKE CONCAT('%',#{mapVo.serviceType},'%')
  280. </if>
  281. <if test="mapVo.dictType!=null and mapVo.dictType != ''">
  282. and dict_type = #{mapVo.dictType}
  283. </if>
  284. </where>
  285. </select>
  286. <select id="getMapDataType" resultType="com.example.nngkxxdp.entity.MapData">
  287. SELECT
  288. <include refid="all_base_data"/>
  289. FROM s_map
  290. <where>
  291. <if test="dictType!=null and dictType!=''">
  292. and dict_type in
  293. <foreach collection="dictType" item="item" index="index" open="(" close=")" separator=",">
  294. #{item}
  295. </foreach>
  296. </if>
  297. <if test="type!=null and type!=''">
  298. and type = #{type}
  299. </if>
  300. <if test="title!=null and title!=''">
  301. and dep like CONCAT('%',#{title},'%')
  302. </if>
  303. </where>
  304. </select>
  305. </mapper>