WdInfoMapper.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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.benyun.core.dao.WdInfoMapper">
  6. <resultMap type="com.benyun.core.entity.bo.WdAddrTypeDistribution" id="WdAddrDisResult">
  7. <result property="addrCode" column="addr_code"/>
  8. <result property="typeCode" column="type_code_by"/>
  9. <result property="count" column="count"/>
  10. </resultMap>
  11. <resultMap type="com.benyun.core.entity.bo.WdAddrTypeDistribution" id="WdTypeDisResult">
  12. <result property="addrCode" column="addr_code"/>
  13. <result property="typeCode" column="wd_type_code"/>
  14. <result property="count" column="count"/>
  15. </resultMap>
  16. <resultMap type="com.benyun.core.entity.bo.WdAddrTypeDistribution" id="WdTotalDisResult">
  17. <result property="typeCode" column="wd_type_code"/>
  18. <result property="count" column="count"/>
  19. </resultMap>
  20. <resultMap type="com.benyun.core.entity.vo.AddStatusVo" id="AddStatusResult">
  21. <result property="typeCode" column="wd_type_code"/>
  22. <result property="count" column="count"/>
  23. <result property="time" column="time"/>
  24. </resultMap>
  25. <select id="searchAddrDisByMulti" resultMap="WdAddrDisResult">
  26. SELECT
  27. addr_code,
  28. type_code_by,
  29. COUNT(*) count
  30. FROM
  31. `ddt_wd_info`
  32. WHERE
  33. type_code_by IS NOT NULL
  34. <if test="addrCodes != null">
  35. <foreach collection="addrCodes" item="addrCode" open="AND addr_code IN (" separator="," close=")">
  36. #{addrCode,jdbcType=VARCHAR}
  37. </foreach>
  38. </if>
  39. <if test="typeCodes != null">
  40. <foreach collection="typeCodes" item="typeCode" open="AND type_code_by IN (" separator="," close=")">
  41. #{typeCode,jdbcType=VARCHAR}
  42. </foreach>
  43. </if>
  44. GROUP BY
  45. addr_code,
  46. type_code_by
  47. ORDER BY count DESC;
  48. </select>
  49. <select id="searchWdTypeDisByMulti" resultMap="WdTypeDisResult">
  50. SELECT
  51. addr_code,
  52. wd_type_code,
  53. COUNT(*) count
  54. FROM
  55. `ddt_wd_info`
  56. <trim prefix="WHERE" prefixOverrides="AND">
  57. <if test="addrCodes != null">
  58. <foreach collection="addrCodes" item="addrCode" open="AND addr_code IN (" separator="," close=")">
  59. #{addrCode,jdbcType=VARCHAR}
  60. </foreach>
  61. </if>
  62. <if test="typeCodes != null">
  63. <foreach collection="typeCodes" item="typeCode" open="AND wd_type_code IN (" separator="," close=")">
  64. #{typeCode,jdbcType=VARCHAR}
  65. </foreach>
  66. </if>
  67. </trim>
  68. GROUP BY
  69. addr_code,
  70. wd_type_code
  71. ORDER BY count DESC
  72. </select>
  73. <select id="searchWdTotal" resultMap="WdTotalDisResult">
  74. SELECT
  75. wd_type_code,
  76. COUNT(*) count
  77. FROM
  78. `ddt_wd_info`
  79. GROUP BY
  80. wd_type_code
  81. ORDER BY count DESC
  82. </select>
  83. <select id="list" parameterType="com.benyun.core.entity.vo.WdInfoVo" resultType="com.benyun.core.entity.WdInfo">
  84. select * from ddt_wd_info
  85. <where>
  86. <if test="wdName != null and wdName != ''">
  87. and wd_name like concat("%",#{wdName},"%")
  88. </if>
  89. <if test="typeCodeBy != null and typeCodeBy != ''">
  90. and type_code_by = #{typeCodeBy}
  91. </if>
  92. <if test="addrCode != null and addrCode != ''">
  93. and addr_code = #{addrCode}
  94. </if>
  95. <if test="showDelete != -1">
  96. and show_delete = #{showDelete}
  97. </if>
  98. </where>
  99. </select>
  100. <select id="searchAddStatusByMulti" resultMap="AddStatusResult">
  101. SELECT
  102. wd_type_code,
  103. COUNT(*) count,
  104. DATE_FORMAT(collect_time, "%Y-%m") time
  105. FROM
  106. `ddt_wd_info`
  107. <trim prefix="where" prefixOverrides="and">
  108. <if test="times != null">
  109. <foreach collection="times" item="time" open="and DATE_FORMAT(collect_time, '%Y-%m') IN (" separator="," close=")">
  110. #{time,jdbcType=VARCHAR}
  111. </foreach>
  112. </if>
  113. <if test="addrCodes != null">
  114. <foreach collection="addrCodes" item="addrCode" open="and addr_code IN (" separator="," close=")">
  115. #{addrCode,jdbcType=VARCHAR}
  116. </foreach>
  117. </if>
  118. <if test="wdTypeCodes != null">
  119. <foreach collection="wdTypeCodes" item="type" open="and wd_type_code IN (" separator="," close=")">
  120. #{type,jdbcType=VARCHAR}
  121. </foreach>
  122. </if>
  123. </trim>
  124. GROUP BY
  125. wd_type_code,
  126. time
  127. </select>
  128. <update id="recoverWd" parameterType="java.lang.String">
  129. update ddt_wd_info set show_delete = 0 where wd_id = #{wdId}
  130. </update>
  131. </mapper>