YqGAreaMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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.yiqi.mapper.YqGAreaMapper">
  6. <resultMap type="com.ruoyi.yiqi.entity.YqGArea" id="GAreaResult">
  7. <result property="id" column="id"/>
  8. <result property="name" column="name"/>
  9. <result property="userId" column="user_id"/>
  10. <result property="releaseIs" column="release_is"/>
  11. <result property="releaseBy" column="release_by"/>
  12. <result property="delFlag" column="del_flag"/>
  13. <result property="createBy" column="create_by"/>
  14. <result property="createTime" column="create_time"/>
  15. <result property="updateBy" column="update_by"/>
  16. <result property="updateTime" column="update_time"/>
  17. <result property="district" column="district"/>
  18. <result property="calculateDistrictId" column="calculate_district_id"/>
  19. <result property="calculateDistrictName" column="calculate_district_name"/>
  20. <result property="areaSize" column="area_size"/>
  21. <result property="affiliatedPackage" column="affiliated_package"/>
  22. </resultMap>
  23. <select id="getList" resultType="com.ruoyi.yiqi.entity.YqGArea">
  24. select a.id as id,
  25. a.name as name,
  26. (select b.name from yq_g_user b where b.id = a.user_id) as userName,
  27. a.release_is as releaseIs,
  28. a.calculate_district_id as calculateDistrictId,
  29. a.calculate_district_name as calculateDistrictName,
  30. a.area_size as areaSize,
  31. a.affiliated_package as affiliatedPackage,
  32. a.district as district
  33. from yq_g_area a
  34. <where>
  35. a.del_flag = '0'
  36. <if test="p.name != null and p.name != ''">
  37. and a.name LIKE CONCAT('%',#{p.name},'%')
  38. </if>
  39. <if test="p.userId != null and p.userId != ''">
  40. and a.user_id = #{p.userId}
  41. </if>
  42. <if test="p.district != null and p.district != ''">
  43. and a.district = #{p.district}
  44. </if>
  45. <if test="p.calculateDistrictId != null and p.calculateDistrictId != ''">
  46. and a.calculate_district_id = #{p.calculateDistrictId}
  47. </if>
  48. </where>
  49. </select>
  50. <select id="getArea" resultType="com.ruoyi.yiqi.entity.YqGArea">
  51. select id as id,
  52. name as name
  53. from yq_g_area
  54. where del_flag = '0'
  55. </select>
  56. <select id="getHouse" resultType="java.lang.Integer">
  57. select count(a.id)
  58. from yq_g_house a
  59. left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
  60. left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
  61. left join yq_g_area d on (c.area_id = d.id and d.del_flag = '0')
  62. where
  63. a.del_flag = '0' and d.id = #{id}
  64. </select>
  65. <select id="getExamineArea" resultType="com.ruoyi.yiqi.entity.GCensusVo">
  66. select count( o.house_id) as value,
  67. o.examine_status as name
  68. from yq_g_order o
  69. left join yq_g_house a on (o.house_id = a.id and a.del_flag = '0')
  70. left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
  71. left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
  72. left join yq_g_area d on (c.area_id = d.id and d.del_flag = '0')
  73. where o.order_status = '002'
  74. and o.service_type = '002'
  75. and o.del_flag = '0'
  76. <if test="areaId != null and areaId != ''">
  77. and d.id = #{areaId}
  78. </if>
  79. group by name
  80. </select>
  81. <select id="getExamineServe" resultType="com.ruoyi.yiqi.entity.GCensusVo">
  82. select count( o.id) as value,
  83. o.service_type as name
  84. from yq_g_order o
  85. left join yq_g_house a on (o.house_id = a.id and a.del_flag = '0')
  86. left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
  87. left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
  88. left join yq_g_area d on (c.area_id = d.id and d.del_flag = '0')
  89. where o.del_flag = '0'
  90. and o.service_type = ''
  91. or o.service_type = '001'
  92. or o.service_type = '002'
  93. or o.service_type = '003'
  94. <if test="id != null and id != ''">
  95. and d.id = #{id}
  96. </if>
  97. group by o.service_type
  98. </select>
  99. <select id="getExportList" resultType="com.ruoyi.yiqi.entity.GExportVo">
  100. select a.id as id,
  101. d.name as areaName,
  102. c.name as buildName,
  103. b.name as unitName,
  104. d.calculate_district_name as calculateDistrictName,
  105. d.area_size as areaSize,
  106. d.affiliated_package as affiliatedPackage,
  107. a.name as houseName
  108. from yq_g_area d
  109. left join yq_g_building c on (d.id = c.area_id and c.del_flag = '0')
  110. left join yq_g_unit b on (c.id = b.building_id and b.del_flag = '0')
  111. left join yq_g_house a on (b.id = a.unit_id and a.del_flag = '0')
  112. where d.del_flag = '0'
  113. </select>
  114. <select id="getExport" resultType="com.ruoyi.yiqi.entity.GExportsVo">
  115. SELECT a.name AS areaName,
  116. a.district AS district,
  117. a.calculate_district_id AS calculateDistrictName,
  118. a.area_size AS areaSize,
  119. a.affiliated_package AS affiliatedPackage,
  120. COUNT(b.area_id) AS count
  121. FROM yq_g_area a
  122. LEFT JOIN yq_g_order b ON (b.area_id = a.id AND b.del_flag = '0')
  123. WHERE a.del_flag = '0'
  124. AND a.calculate_district_id = #{calculateDistrictId}
  125. AND a.affiliated_package = #{affiliatedPackage}
  126. GROUP BY b.area_id
  127. </select>
  128. <select id="getDictNameOfAffiliatedPackage" resultType="string">
  129. SELECT
  130. CONCAT(a.dict_label,'-工程任务单(',b.dict_label,')') AS name
  131. FROM `yq_sys_dict_data` a
  132. LEFT JOIN yq_sys_dict_data b ON (b.dict_type = 'affiliated_package' AND b.dict_value = #{affiliatedPackage})
  133. WHERE a.dict_type = 'district' AND a.dict_value = #{calculateDistrictId}
  134. </select>
  135. <select id="getByName" resultType="com.ruoyi.yiqi.entity.YqGArea">
  136. select * from yq_g_area
  137. where name = #{name}
  138. and del_flag = '0'
  139. </select>
  140. <select id="getConform" resultType="com.ruoyi.yiqi.entity.GCensusVo">
  141. select count( o.house_id) as value,
  142. o.service_type as name
  143. from yq_g_order o
  144. left join yq_g_house a on (o.house_id = a.id and a.del_flag = '0')
  145. left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
  146. left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
  147. left join yq_g_area d on (c.area_id = d.id and d.del_flag = '0')
  148. where o.del_flag = '0'
  149. and o.service_type = '002' or o.service_type = '003' or o.service_type = ''
  150. <if test="areaId != null and areaId != ''">
  151. and d.id = #{areaId}
  152. </if>
  153. group by name
  154. </select>
  155. <select id="getInConform" resultType="java.lang.Integer">
  156. select count( o.house_id)
  157. from yq_g_order o
  158. left join yq_g_house a on (o.house_id = a.id and a.del_flag = '0')
  159. left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
  160. left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
  161. left join yq_g_area d on (c.area_id = d.id and d.del_flag = '0')
  162. where o.service_type = '003'
  163. and o.del_flag = '0'
  164. <if test="areaId != null and areaId != ''">
  165. and d.id = #{areaId}
  166. </if>
  167. </select>
  168. <select id="getHouseCount" resultType="java.lang.Integer">
  169. select count( a.id)
  170. from yq_g_house a
  171. left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
  172. left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
  173. left join yq_g_area d on (c.area_id = d.id and d.del_flag = '0')
  174. where a.del_flag = '0'
  175. <if test="areaId != null and areaId != ''">
  176. and d.id = #{areaId}
  177. </if>
  178. </select>
  179. <select id="getForName" resultType="com.ruoyi.yiqi.entity.YqGArea">
  180. select * from yq_g_area
  181. where name = #{name}
  182. and del_flag = '0'
  183. <if test="id != null and id!= ''">
  184. and id != #{id}
  185. </if>
  186. limit 1
  187. </select>
  188. <select id="getPhoto" resultType="java.lang.String">
  189. select a.pic_url
  190. from yq_g_order_photo a
  191. left join yq_g_order b on (a.order_id = b.id and b.service_type = '002' and b.examine_status = '001')
  192. left join yq_g_house c on b.house_id = c.id
  193. left join yq_g_unit d on c.unit_id = d.id
  194. left join yq_g_building e on d.building_id=e.id
  195. left join yq_g_area f on e.area_id = f.id
  196. where f.id = #{id}
  197. </select>
  198. <select id="getAllHouse" resultType="com.ruoyi.yiqi.entity.GAreaExportVo">
  199. select b.id as id,
  200. CONCAT(e.name,'-',d.name,'-',c.name,'-',b.name) as houseName
  201. FROM
  202. yq_g_house b
  203. LEFT JOIN yq_g_unit c ON b.unit_id = c.id
  204. LEFT JOIN yq_g_building d ON c.building_id = d.id
  205. LEFT JOIN yq_g_area e ON d.area_id = e.id
  206. WHERE
  207. b.del_flag = '0'
  208. AND c.del_flag = '0'
  209. AND d.del_flag = '0'
  210. AND e.del_flag = '0'
  211. AND e.id = #{areaId}
  212. </select>
  213. <select id="getOrderHouse" resultType="com.ruoyi.yiqi.entity.GAreaExportVo">
  214. select a.house_id as id,
  215. CONCAT(e.name,'-',d.name,'-',c.name,'-',b.name) as houseName
  216. from yq_g_order a
  217. left join yq_g_house b on (a.house_id = b.id and b.del_flag = '0')
  218. left join yq_g_unit c on (b.unit_id = c.id and c.del_flag = '0')
  219. left join yq_g_building d on (c.building_id = d.id and d.del_flag = '0')
  220. left join yq_g_area e on (d.area_id = e.id and e.del_flag = '0')
  221. where
  222. a.del_flag = '0'
  223. and a.service_type = '002'
  224. and a.examine_status = '001'
  225. and e.id = #{areaId}
  226. </select>
  227. <select id="checkDataList" resultType="java.lang.Long">
  228. select IFNULL(count(d.id) ,0) AS OrderAverage
  229. from yq_g_area d
  230. where
  231. d.del_flag = '0'
  232. and d.name = #{p.name}
  233. </select>
  234. </mapper>