sm.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. 商品房
  2. 商品房指标
  3. 商品房、住宅、农房
  4. 项目数、楼幢数、总套数、总面积、
  5. 销售套数、销售面积
  6. 库存套数、库存面积
  7. 月均销售套数、月均销售面积
  8. 套数去化周期、面积去化周期
  9. 户型、面积分析
  10. 商品房
  11. 在建在售
  12. 年度批售
  13. 商品房、住宅
  14. 房屋批售、预售许可、现售备案
  15. 批售套数、批售面积、同比
  16. 年度销售-年度
  17. 商品房、住宅
  18. 销售套数、销售面积、销售金额、销售均价、同比
  19. 年度销售-月度
  20. 商品房、住宅
  21. 批售:套数、面积
  22. 销售:套数、面积、均价同比、环比、金额、库存、去化周期
  23. 销售排行
  24. 年度、月度
  25. 套数、面积
  26. 商品房、住宅
  27. 商品房-在建在售
  28. 商品房、住宅
  29. 项目数、楼幢数、总套数、总面积、
  30. 销售套数、销售面积
  31. 库存套数、库存面积
  32. 月均销售套数、月均销售面积
  33. 套数去化周期、面积去化周期
  34. 在建在售项目-列表 sfwc <=1
  35. 在建在售-详情
  36. 楼栋数、总套数、住宅套数
  37. from ys_xmxx x , fg_building l , fg_house h
  38. where
  39. x.xmbh = l.xmid and l.building_id = h.building_id
  40. and h.zt = 1
  41. and x.sfwc &lt;=1 // 在建在售
  42. and x.xmbh = #{xmbh}// 项目编号
  43. and h.house_name is not null and h.house_zl is not null
  44. and x.xmbh not like 'N%'
  45. and h.house_type not like 'D%'
  46. <if test="fwyt == 1">
  47. and h.yt='住宅'
  48. </if>
  49. 批售套数、批售面积住宅批售套数、批售面积
  50. select h.house_id,
  51. case when s.lb=0 then h.yjzmj else h.jzmj end as fwmj, h.yt, s.lb // . 0预售许可 1现售备案
  52. from ys_yssq s,fg_house h,ys_xmxx x ,fg_building l
  53. where
  54. x.xmbh = l.xmid and l.building_id = h.building_id and s.jhl=h.building_id
  55. and x.sfwc &lt;=1 and x.xmbh = #{xmbh}// 在建在售、项目编号
  56. and s.zt=1 and s.pzrq is not null and s.zsh is not null // 批售条件
  57. and h.house_type not like '%D%' and h.house_name is not null and h.house_zl is not null
  58. and h.house_id not like '%N%'
  59. <if test="fwyt == 1">
  60. and h.yt = '住宅'
  61. </if>
  62. 销售套数、销售面积、销售金额
  63. from ys_htba_sq ht,ys_xmxx x , fg_building l , fg_house h
  64. where
  65. x.xmbh = l.xmid and l.building_id = h.building_id and ht.fwid = h.house_id
  66. and x.sfwc &lt;=1 and x.xmbh = #{xmbh} // 在建在售、项目编号
  67. and ht.zt >= 1
  68. and ht.lb in (1,2) // 商品房
  69. <if test="fwyt == 1">
  70. and ht.fwyt='住宅'
  71. </if>
  72. 在建在售-面积分析
  73. SELECT
  74. fw.house_id as fwid,
  75. CASE WHEN fw.jzmj > 0 THEN fw.jzmj ELSE fw.yjzmj END AS jzmj
  76. FROM fg_house fw,fg_building lz
  77. where
  78. lz.building_id = fw.building_id
  79. and lz.xmid = #{xmbh} // 项目下的房屋
  80. and fw.zt = 1
  81. and fw.house_name is not null and fw.house_zl is not null
  82. and fw.house_id not like '%N%' and yt = '住宅' and house_type not like '%D%'
  83. 在建在售-面积库存分析
  84. select h.house_id as fwid,
  85. CASE WHEN h.jzmj > 0 THEN h.jzmj ELSE h.yjzmj END AS jzmj
  86. from fg_house h
  87. left join fg_building l on l.building_id = h.building_id
  88. left join (
  89. // 已销售的房屋
  90. select h.HOUSE_ID
  91. from ys_htba_sq ht,fg_building l , fg_house h
  92. where
  93. l.building_id = h.building_id and ht.fwid = h.house_id
  94. and l.xmid = #{xmbh} // 项目下房屋
  95. and ht.zt >= 1 and ht.lb in (1,2) // 已销售商品房
  96. and ht.fwyt='住宅'
  97. GROUP BY h.HOUSE_ID
  98. ) t on t.HOUSE_ID = h.HOUSE_ID
  99. where
  100. h.zt = 1
  101. and l.xmid = #{xmbh} // 项目下房屋
  102. and h.house_name is not null and h.house_zl is not null
  103. and h.house_type not like 'D%'
  104. and h.house_id not like '%N%'
  105. and h.yt='住宅'
  106. and t.HOUSE_ID is null // 关联已销售房屋后 、null表示未销售的房屋
  107. 在建在售-面积年度分析
  108. 查询统计数据
  109. 在建在售-户型分析
  110. select hxg.zts,
  111. case when hxg.hx like '一室%' or hxg.hx like '单户%' then 1
  112. when hxg.hx like '二室%' then 2
  113. when hxg.hx like '三室%' then 3
  114. when hxg.hx like '四居%' then 4
  115. else 0 end as hx // 0 其他
  116. from (
  117. select count(h.HOUSE_ID) as zts,h.hx
  118. from fg_house h,fg_building l
  119. where
  120. l.building_id = h.building_id
  121. and l.xmid = #{xmbh}
  122. and h.zt = 1
  123. and h.house_name is not null and h.house_zl is not null
  124. and h.house_type not like 'D%'
  125. and h.house_id not like '%N%'
  126. and h.yt='住宅'
  127. group by h.hx
  128. ) hxg
  129. 在建在售-户型库存分析
  130. select hxg.zts,
  131. case when hxg.hx like '一室%' or hxg.hx like '单户%' then 1
  132. when hxg.hx like '二室%' then 2
  133. when hxg.hx like '三室%' then 3
  134. when hxg.hx like '四居%' then 4
  135. else 0 end as hx
  136. from (
  137. // 项目下的房屋关联已销售的房屋 得到未销售的房屋
  138. select count(h.HOUSE_ID) as zts,h.hx
  139. from fg_house h
  140. left join fg_building l on l.building_id = h.building_id
  141. left join (
  142. // 获取 项目下 已销售的房屋
  143. select h.HOUSE_ID
  144. from ys_htba_sq ht,fg_building l , fg_house h
  145. where
  146. l.building_id = h.building_id and ht.fwid = h.house_id
  147. and l.xmid = #{xmbh}// 获取项目下的房屋
  148. and ht.zt >= 1 and ht.lb in (1,2)
  149. and ht.fwyt='住宅'
  150. GROUP BY h.HOUSE_ID
  151. ) t on t.HOUSE_ID = h.HOUSE_ID
  152. where
  153. h.zt = 1
  154. and l.xmid = #{xmbh} // 获取项目下的房屋
  155. and h.house_name is not null and h.house_zl is not null
  156. and h.house_type not like 'D%'
  157. and h.house_id not like '%N%'
  158. and h.yt='住宅'
  159. and t.HOUSE_ID is null // 未关联销售数据 ——> 得到未销售的房屋
  160. group by h.hx
  161. ) hxg
  162. 在建在售-户型年度分析
  163. 去统计表中查询该户型5年的销量和占比
  164. 商品房-个人
  165. 套数\面积\年龄\区域
  166. 商品房、住宅
  167. from ys_htlsb_msr m, ys_htba_sq b
  168. where m.htbh=b.htbh
  169. and m.state>=0 and m.lx=2
  170. and m.lb in (1,2) // 买受人、买受人共有人
  171. and b.lb in (1,2) // 商品房现售、预售合同
  172. and b.zt>0 //
  173. <if test="fwyt == 1">
  174. and b.fwyt='住宅'
  175. </if>
  176. group by m.mxrzjh
  177. 人均
  178. 存量房
  179. 年度销售
  180. 存量房、住宅
  181. 套数、面积、均价、同比、金额
  182. 月度销售
  183. 存量房、住宅
  184. 套数、面积、均价、同比、环比、金额
  185. 分析
  186. 面积、户型、付款类型
  187. 套数、面积、占比
  188. 小区排行
  189. 年度、月度
  190. 套数、面积
  191. 商品房、住宅
  192. 维修资金
  193. 资金统计
  194. 小区数、楼栋数、房屋套数、承办银行数、总余额
  195. t_zh_fwzh zh ,t_wy_fw fw
  196. fw. fwlx != 'D'
  197. 已缴存房屋套数、面积、总金额
  198. from t_zh_fwzh zh ,t_wy_fw fw
  199. where zh.fwid=fw.id
  200. and zh.cjzt=5 //资金状态 0未初交 2业务办理中 5已交存
  201. and zh.state=1
  202. and fw.state=1 and fw.zt = 1 and fw. fwlx != 'D'
  203. 未交存房屋套数、应交总金额;
  204. from t_zh_fwzh zh ,t_wy_fw fw
  205. where zh.fwid=fw.id
  206. and zh.cjzt &lt; 5 //资金状态 0未初交 2业务办理中 5已交存
  207. and zh.state=1
  208. and fw.state=1 and fw.zt = 1 and fw. fwlx != 'D'
  209. 维修总笔数、预算总金额;
  210. from t_zy_wxxm
  211. where
  212. state = 1 and gcjd >=5 //0暂存 1申报 2维修组织 3维修招标 4维修施工 5竣工验收 9完结 -1撤销
  213. 正在维修项目数、预算总金额;
  214. from t_zy_wxxm
  215. where
  216. state = 1 and gcjd = 4 //0暂存 1申报 2维修组织 3维修招标 4维修施工 5竣工验收 9完结 -1撤销
  217. 拨付总笔数、拨付总金额;
  218. from t_zy_bfyw_mx
  219. where
  220. bfzt = 5 and cxzt = 0
  221. and state = 1
  222. 申请拨付笔数、金额;
  223. from t_zy_bfyw_mx
  224. where
  225. bfzt >= 2 and bfzt &lt;= 4 //拨付状态 0不可拨付 1可申请 2已申请 4可拨付 5已拨付 -1撤销
  226. and cxzt = 0 //撤销状态 0未撤销 1已撤销
  227. and state = 1
  228. 资金归集年度
  229. 1、初始化数据:firstInit
  230. 2、wxzj_jcyw_mx:
  231. ywzt >= 4 //业务状态 1有效 4扣款 5到账
  232. and state = 1
  233. and cxzt = 0 //撤销状态 0未撤销 1撤销
  234. 资金支用年度
  235. 1、初始化数据:firstInit
  236. 2、t_zy_bfyw_mx
  237. bfzt = 5 //拨付状态 0不可拨付 1可申请 2已申请 4可拨付 5已拨付 -1撤销
  238. and cxzt = 0 //撤销状态 0未撤销 1已撤销
  239. and state = 1
  240. 维修支用排行
  241. from t_zy_bfyw_mx mx, t_zy_wxxm xm, t_wy_xq xq
  242. where mx.xmid = xm.id
  243. and xm.xqid = xq.id
  244. and mx.bfzt = 5 //拨付状态 0不可拨付 1可申请 2已申请 4可拨付 5已拨付 -1撤销
  245. and mx.cxzt = 0 //撤销状态 0未撤销 1已撤销
  246. and mx.state = 1
  247. 维修设备分析
  248. from t_zy_wxsb sb,t_zy_wxxm xm
  249. where sb.xmid = xm.id
  250. and sb.state = 1 and xm.state = 1
  251. and xm.gcjd >=4 //0暂存 1申报 2维修组织 3维修招标 4维修施工 5竣工验收 9完结 -1撤销
  252. group by sb.lbid
  253. 预售资金监管
  254. 预售资金归集年度分析
  255. 预售资金拨付年度分析
  256. 存量房资金托管
  257. 本年度托管资金
  258. 托管资金年度分析