GjShijiShouchuMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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.siwei.apply.mapper.GjShijiShouchuMapper">
  6. <resultMap id="gjShijiShouchuMap" type="com.siwei.apply.domain.GjShijiShouchu">
  7. <id column="gid" property="gid"/>
  8. <result column="yqsdw" property="yqsdw"/>
  9. <result column="scmj" property="scmj"/>
  10. <result column="scjg" property="scjg"/>
  11. <result column="scwh" property="scwh"/>
  12. <result column="scsj" property="scsj"/>
  13. <result column="mj" property="mj"/>
  14. <result column="scfs" property="scfs"/>
  15. <result column="scnd" property="scnd"/>
  16. <result column="tdzl" property="tdzl"/>
  17. <result column="ytdyt" property="ytdyt"/>
  18. <result column="ytdsyqxz" property="ytdsyqxz"/>
  19. <result column="wzfbck" property="wzfbck"/>
  20. <result column="bz" property="bz"/>
  21. <result column="bsm" property="bsm"/>
  22. <result column="xzq" property="xzq"/>
  23. <result column="dabh" property="dabh"/>
  24. <result column="shape_leng" property="shapeLeng"/>
  25. <result column="shape_area" property="shapeArea"/>
  26. <result column="项目名" property="xmmc"/>
  27. <result column="sccb" property="sccb"/>
  28. <result column="面积_亩" property="mjMu"/>
  29. <result column="geom" property="geom"/>
  30. </resultMap>
  31. <insert id="add" parameterType="com.siwei.apply.domain.GjShijiShouchu">
  32. INSERT INTO vector.gj_shiji_shouchu (yqsdw, scmj, scjg, scwh, scsj, mj, scfs, scnd, tdzl, ytdyt, ytdsyqxz, wzfbck, bz, bsm, xzq, dabh, shape_leng, shape_area, "项目名", sccb, "面积_亩", geom)
  33. VALUES (#{yqsdw}, #{scmj}, #{scjg}, #{scwh}, #{scsj}, #{mj}, #{scfs}, #{scnd}, #{tdzl}, #{ytdyt}, #{ytdsyqxz}, #{wzfbck}, #{bz}, #{bsm}, #{xzq}, #{dabh}, #{shapeLeng}, #{shapeArea}, #{xmmc}, #{sccb}, #{mjMu}, ST_GeomFromEWKT(#{geom}))
  34. </insert>
  35. <select id="get" resultMap="gjShijiShouchuMap">
  36. SELECT gid, yqsdw, scmj, scjg, scwh, scsj, mj, scfs, scnd, tdzl, ytdyt, ytdsyqxz, wzfbck, bz, bsm, xzq, dabh, shape_leng, shape_area, "项目名", sccb, "面积_亩", ST_AsEWKT(geom) as geom
  37. FROM vector.gj_shiji_shouchu
  38. WHERE gid = #{gid}
  39. </select>
  40. <select id="getList" parameterType="com.siwei.apply.domain.vo.GjShijiShouchuFilterVo" resultMap="gjShijiShouchuMap">
  41. SELECT gid, yqsdw, scmj, scjg, scwh, scsj, mj, scfs, scnd, tdzl, ytdyt, ytdsyqxz, wzfbck, bz, bsm, xzq, dabh, shape_leng, shape_area, "项目名", sccb, "面积_亩", ST_AsEWKT(geom) as geom
  42. FROM vector.gj_shiji_shouchu
  43. <where>
  44. <if test="xmmc != null and xmmc != ''">
  45. AND "项目名" LIKE CONCAT('%', #{xmmc}, '%')
  46. </if>
  47. <if test="xzq != null and xzq != ''">
  48. AND xzq = #{xzq}
  49. </if>
  50. <if test="scfs != null and scfs != ''">
  51. AND scfs = #{scfs}
  52. </if>
  53. <if test="startDate != null and startDate != ''">
  54. AND scsj &gt;= #{startDate}
  55. </if>
  56. <if test="endDate != null and endDate != ''">
  57. AND scsj &lt;= #{endDate}
  58. </if>
  59. </where>
  60. ORDER BY gid DESC
  61. LIMIT #{pageSize} OFFSET #{offset}
  62. </select>
  63. <select id="getCount" parameterType="com.siwei.apply.domain.vo.GjShijiShouchuFilterVo" resultType="int">
  64. SELECT COUNT(*)
  65. FROM vector.gj_shiji_shouchu
  66. <where>
  67. <if test="xmmc != null and xmmc != ''">
  68. AND "项目名" LIKE CONCAT('%', #{xmmc}, '%')
  69. </if>
  70. <if test="xzq != null and xzq != ''">
  71. AND xzq = #{xzq}
  72. </if>
  73. <if test="scfs != null and scfs != ''">
  74. AND scfs = #{scfs}
  75. </if>
  76. <if test="startDate != null and startDate != ''">
  77. AND scsj &gt;= #{startDate}
  78. </if>
  79. <if test="endDate != null and endDate != ''">
  80. AND scsj &lt;= #{endDate}
  81. </if>
  82. </where>
  83. </select>
  84. <update id="update" parameterType="com.siwei.apply.domain.GjShijiShouchu">
  85. UPDATE vector.gj_shiji_shouchu
  86. <set>
  87. <if test="yqsdw != null">yqsdw = #{yqsdw},</if>
  88. <if test="scmj != null">scmj = #{scmj},</if>
  89. <if test="scjg != null">scjg = #{scjg},</if>
  90. <if test="scwh != null">scwh = #{scwh},</if>
  91. <if test="scsj != null">scsj = #{scsj},</if>
  92. <if test="mj != null">mj = #{mj},</if>
  93. <if test="scfs != null">scfs = #{scfs},</if>
  94. <if test="scnd != null">scnd = #{scnd},</if>
  95. <if test="tdzl != null">tdzl = #{tdzl},</if>
  96. <if test="ytdyt != null">ytdyt = #{ytdyt},</if>
  97. <if test="ytdsyqxz != null">ytdsyqxz = #{ytdsyqxz},</if>
  98. <if test="wzfbck != null">wzfbck = #{wzfbck},</if>
  99. <if test="bz != null">bz = #{bz},</if>
  100. <if test="bsm != null">bsm = #{bsm},</if>
  101. <if test="xzq != null">xzq = #{xzq},</if>
  102. <if test="dabh != null">dabh = #{dabh},</if>
  103. <if test="shapeLeng != null">shape_leng = #{shapeLeng},</if>
  104. <if test="shapeArea != null">shape_area = #{shapeArea},</if>
  105. <if test="xmmc != null">"项目名" = #{xmmc},</if>
  106. <if test="sccb != null">sccb = #{sccb},</if>
  107. <if test="mjMu != null">"面积_亩" = #{mjMu},</if>
  108. <if test="geom != null">geom = ST_GeomFromEWKT(#{geom}),</if>
  109. </set>
  110. WHERE gid = #{gid}
  111. </update>
  112. <delete id="batchDelete">
  113. DELETE FROM vector.gj_shiji_shouchu
  114. WHERE gid IN
  115. <foreach collection="gids" item="gid" open="(" separator="," close=")">
  116. #{gid}
  117. </foreach>
  118. </delete>
  119. <select id="getStatsByYear" resultType="map">
  120. SELECT
  121. COALESCE(CAST(scnd AS VARCHAR), '其它') AS year,
  122. ROUND(COALESCE(SUM(CAST(scmj AS NUMERIC)), 0), 2) AS in_data_area
  123. FROM vector.gj_shiji_shouchu
  124. GROUP BY scnd
  125. ORDER BY year
  126. </select>
  127. <select id="getByGeomIntersects" resultMap="gjShijiShouchuMap">
  128. SELECT gid, yqsdw, scmj, scjg, scwh, scsj, mj, scfs, scnd, tdzl, ytdyt, ytdsyqxz, wzfbck, bz, bsm, xzq, dabh, shape_leng, shape_area, "项目名", sccb, "面积_亩", ST_AsEWKT(geom) as geom
  129. FROM vector.gj_shiji_shouchu
  130. WHERE public.ST_Intersects(geom, public.ST_GeomFromEWKT(#{ewkt}))
  131. </select>
  132. </mapper>