ZbGcMapper.xml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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.ruoyi.system.mapper.ZbGcMapper">
  6. <resultMap type="ZbGc" id="ZbGcResult">
  7. <result property="id" column="id" />
  8. <result property="title" column="title" />
  9. <result property="addr" column="addr" />
  10. <result property="rule" column="rule" />
  11. <result property="time" column="time" />
  12. <result property="other" column="other" />
  13. <result property="type" column="type" />
  14. <result property="url" column="url" />
  15. <result property="searchKey" column="search_key" />
  16. <result property="depType" column="dep_type" />
  17. <result property="dep" column="dep" />
  18. <result property="price" column="price" />
  19. <result property="word" column="word" />
  20. <result property="regex" column="regex" />
  21. </resultMap>
  22. <sql id="selectZbGcVo">
  23. select id, title, addr, rule, time, other, type, url, search_key, dep_type, dep, price, word, regex from zb_gc
  24. </sql>
  25. <select id="selectZbGcList" parameterType="ZbGc" resultMap="ZbGcResult">
  26. <include refid="selectZbGcVo"/>
  27. <where>
  28. <if test="title != null and title != ''"> and title = #{title}</if>
  29. <if test="addr != null and addr != ''"> and addr = #{addr}</if>
  30. <if test="rule != null and rule != ''"> and rule = #{rule}</if>
  31. <if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and time between #{params.beginTime} and #{params.endTime}</if>
  32. <if test="other != null and other != ''"> and other = #{other}</if>
  33. <if test="type != null and type != ''"> and type = #{type}</if>
  34. <if test="url != null and url != ''"> and url = #{url}</if>
  35. <if test="searchKey != null and searchKey != ''"> and search_key = #{searchKey}</if>
  36. <if test="depType != null "> and dep_type = #{depType}</if>
  37. <if test="dep != null and dep != ''"> and dep = #{dep}</if>
  38. <if test="price != null "> and price = #{price}</if>
  39. <if test="word != null and word != ''"> and word like concat('%', #{word}, '%')</if>
  40. <if test="regex != null "> and regex = #{regex}</if>
  41. </where>
  42. </select>
  43. <select id="selectAllCount" resultType="Integer" >
  44. SELECT count(id) as 'count' FROM zb_gc
  45. </select>
  46. <select id="selectAllIsNull" resultType="Integer">
  47. SELECT count(id) as 'count' FROM zb_gc WHERE regex=-1
  48. </select>
  49. <select id="selectAllNotDoneByType" resultType="Map">
  50. SELECT type,count(id) as 'count' FROM zb_gc WHERE regex is not null and regex =-1 GROUP BY type
  51. </select>
  52. <select id="selectAllDoneByType" resultType="Map">
  53. SELECT type,count(id) as 'count' FROM zb_gc WHERE regex is not null GROUP BY type
  54. </select>
  55. <select id="selectAllSumPrice" resultType="BigDecimal">
  56. SELECT sum(price) as 'sum' FROM zb_gc WHERE regex =1 and type='中标结果公示'
  57. </select>
  58. <select id="selectAllCountJGByMon" resultType="Map">
  59. select DATE_FORMAT(time,'%Y-%m') as 'mon',count(id) as 'count' from zb_gc WHERE regex =1 and type='中标结果公示' and time>'2021-06' group by DATE_FORMAT(time,'%Y-%m')
  60. </select>
  61. <select id="selectAllCountGGByMon" resultType="Map">
  62. select DATE_FORMAT(time,'%Y-%m') as 'mon',count(id) as 'count' from zb_gc WHERE regex =1 and type='招标公告' and time>'2021-06' group by DATE_FORMAT(time,'%Y-%m')
  63. </select>
  64. <select id="selectAllSumPriceByMon" resultType="map">
  65. select DATE_FORMAT(time,'%Y-%m') as 'mon',COALESCE(sum(price),0) as 'price' from zb_gc WHERE regex =1 and type='中标结果公示' group by DATE_FORMAT(time,'%Y-%m')
  66. </select>
  67. <select id="selectAllJGCountByDep" resultType="Map">
  68. SELECT dep_type,count(id) as 'count' FROM zb_gc WHERE regex=1 and type='中标结果公示' GROUP BY dep_type
  69. </select>
  70. <select id="selectAllZBCountByDep" resultType="map">
  71. SELECT dep_type,count(id) as 'count' FROM zb_gc WHERE regex=1 and type='招标公告' GROUP BY dep_type
  72. </select>
  73. <select id="selectAddrBySearchKey" resultType="String">
  74. SELECT search_key FROM zb_gc GROUP BY search_key
  75. </select>
  76. <select id="selectSumPriceByAddr" resultType="map">
  77. select COALESCE(sum(price),0) as 'value',REPLACE(search_key,' 工程','') as 'name' from zb_gc WHERE regex =1 and search_key=#{key}
  78. </select>
  79. <select id="selectAllZBCountByDepDateOne" resultType="map">
  80. select DATE_FORMAT(time,'%Y-%m') as 'mon',count(id) as 'count' from zb_gc WHERE regex =1 and type='招标公告' and time>'2021-06' and dep_type=1 group by DATE_FORMAT(time,'%Y-%m')
  81. </select>
  82. <select id="selectAllZBCountByDepDateTwo" resultType="map">
  83. select DATE_FORMAT(time,'%Y-%m') as 'mon',count(id) as 'count' from zb_gc WHERE regex =1 and type='招标公告' and time>'2021-06' and dep_type=2 group by DATE_FORMAT(time,'%Y-%m')
  84. </select>
  85. <select id="selectZbGcById" parameterType="Long" resultMap="ZbGcResult">
  86. <include refid="selectZbGcVo"/>
  87. where id = #{id}
  88. </select>
  89. <insert id="insertZbGc" parameterType="ZbGc" useGeneratedKeys="true" keyProperty="id">
  90. insert into zb_gc
  91. <trim prefix="(" suffix=")" suffixOverrides=",">
  92. <if test="title != null">title,</if>
  93. <if test="addr != null">addr,</if>
  94. <if test="rule != null">rule,</if>
  95. <if test="time != null">time,</if>
  96. <if test="other != null">other,</if>
  97. <if test="type != null">type,</if>
  98. <if test="url != null">url,</if>
  99. <if test="searchKey != null">search_key,</if>
  100. <if test="depType != null">dep_type,</if>
  101. <if test="dep != null">dep,</if>
  102. <if test="price != null">price,</if>
  103. <if test="word != null">word,</if>
  104. <if test="regex != null">regex,</if>
  105. </trim>
  106. <trim prefix="values (" suffix=")" suffixOverrides=",">
  107. <if test="title != null">#{title},</if>
  108. <if test="addr != null">#{addr},</if>
  109. <if test="rule != null">#{rule},</if>
  110. <if test="time != null">#{time},</if>
  111. <if test="other != null">#{other},</if>
  112. <if test="type != null">#{type},</if>
  113. <if test="url != null">#{url},</if>
  114. <if test="searchKey != null">#{searchKey},</if>
  115. <if test="depType != null">#{depType},</if>
  116. <if test="dep != null">#{dep},</if>
  117. <if test="price != null">#{price},</if>
  118. <if test="word != null">#{word},</if>
  119. <if test="regex != null">#{regex},</if>
  120. </trim>
  121. </insert>
  122. <update id="updateZbGc" parameterType="ZbGc">
  123. update zb_gc
  124. <trim prefix="SET" suffixOverrides=",">
  125. <if test="title != null">title = #{title},</if>
  126. <if test="addr != null">addr = #{addr},</if>
  127. <if test="rule != null">rule = #{rule},</if>
  128. <if test="time != null">time = #{time},</if>
  129. <if test="other != null">other = #{other},</if>
  130. <if test="type != null">type = #{type},</if>
  131. <if test="url != null">url = #{url},</if>
  132. <if test="searchKey != null">search_key = #{searchKey},</if>
  133. <if test="depType != null">dep_type = #{depType},</if>
  134. <if test="dep != null">dep = #{dep},</if>
  135. <if test="price != null">price = #{price},</if>
  136. <if test="word != null">word = #{word},</if>
  137. <if test="regex != null">regex = #{regex},</if>
  138. </trim>
  139. where id = #{id}
  140. </update>
  141. <delete id="deleteZbGcById" parameterType="Long">
  142. delete from zb_gc where id = #{id}
  143. </delete>
  144. <delete id="deleteZbGcByIds" parameterType="String">
  145. delete from zb_gc where id in
  146. <foreach item="id" collection="array" open="(" separator="," close=")">
  147. #{id}
  148. </foreach>
  149. </delete>
  150. </mapper>