<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="io.renren.modules.app.dao.HomePageDao">
	<select id="selectSsywbl" resultType="io.renren.modules.app.entity.HomePage_SsywblEntity">
		SELECT
		djbh,(CASE djlx
		WHEN
		'01'
		THEN '单位预交'
		WHEN '02' THEN '分配'
		WHEN '03' THEN '个人预交'
		WHEN '04' THEN
		'公共收益'
		WHEN '05' THEN '个人续补缴'
		WHEN '82' THEN '冲账'
		when
		'10' THEN '年度结息'
		when '21' then '首次拨付分摊'
		when '22' then '余额拨付分摊'
		when '13' then
		'业主退款'
		when '23'
		then '业主销户' else '' end) djlx,
		(case shzt
		when '0' then '未审核'
		when '1'
		then '审核通过'
		when '2' then '驳回' end) shzt,
		je,
		djrq
		FROM ywpz ORDER
		BY
		substring(djbh, 3) DESC LIMIT 0,10
	</select>


	<select id="selectsfjz" resultType="integer">
		select sfjz from sqwxzq where
		djbh=#{djbh}
	</select>

	<select id="selectsfjs" resultType="integer">
		select sfjs from sqwxzq where
		jsdbh=#{jsdbh}
	</select>

	<!-- 当月单位缴纳 -->
	<select id="selectDydwjk" resultType="String">
		select IFNULL(sum(je),0)
		from ywpz
		where (SUBSTR(djbh FROM 1 FOR 2)='01' or SUBSTR(djbh FROM 5
		FOR 2)='01') and kjqj=date_format(NOW(), '%Y-%m')
	</select>

	<!-- 当月个人缴纳 -->
	<select id="selectDygrjk" resultType="String">
		select IFNULL(sum(je),0)
		from ywpz
		where (SUBSTR(djbh FROM 1 FOR 2)='03' or SUBSTR(djbh FROM 5
		FOR 2)='03') and kjqj=date_format(NOW(), '%Y-%m')
	</select>

	<!-- 当月个人支出 -->
	<select id="selectDygrzc" resultType="String">
		select IFNULL(sum(je),0)
		from ywpz
		where djlx in('21','22') and kjqj=date_format(NOW(),'%Y-%m')
	</select>

	<!-- 当年单位缴纳 -->
	<select id="selectDndwjk" resultType="String">
		select sum(je) from ywpz
		where (SUBSTR(djbh FROM 1 FOR 2)='01' or SUBSTR(djbh FROM 5 FOR
		2)='01') and SUBSTR(kjqj FROM 1 FOR 4)=date_format(NOW(), '%Y')
	</select>

	<!-- 当年个人缴纳 -->
	<select id="selectDngrjk" resultType="String">
		select sum(je) from ywpz
		where (SUBSTR(djbh FROM 1 FOR 2)='03' or SUBSTR(djbh FROM 5 FOR
		2)='03') and SUBSTR(kjqj FROM 1 FOR 4)=date_format(NOW(), '%Y')
	</select>

	<!-- 当年个人支出 -->
	<select id="selectDngrzc" resultType="String">
		select IFNULL(sum(je),0)
		from ywpz
		where djlx in('21','22') and SUBSTR(kjqj FROM 1 FOR
		4)=date_format(NOW(),'%Y')
	</select>

	<select id="selectdhbm01" resultType="java.lang.String">
		select dhbm from yjmx where
		(SUBSTR(djbh FROM 1 FOR 2)='01' or SUBSTR(djbh FROM 5 FOR 2)='01')
	</select>

	<select id="selectdhbm03" resultType="java.lang.String">
		select dhbm from ywpzmx
		where (SUBSTR(djbh FROM 1 FOR 2)='03' or SUBSTR(djbh FROM 5 FOR
		2)='03')
	</select>

	<select id="selectxmbm" parameterType="java.lang.String"
		resultType="java.lang.String">
		select xmbm from zhxx where dhbm=#{id}
	</select>

	<select id="selectyjnje" resultType="io.renren.modules.app.entity.YwpzEntity">
		select sum(je) yjnje from
		ywpz
		where (SUBSTR(djbh FROM 1 FOR 2)='01' or SUBSTR(djbh FROM 5 FOR
		2)='01') or (SUBSTR(djbh FROM 1 FOR 2)='03' or SUBSTR(djbh FROM 5 FOR
		2)='03') or (SUBSTR(djbh FROM 1 FOR 2)='05' or SUBSTR(djbh FROM 5 FOR
		2)='05')
	</select>

	<select id="selectyzcje" resultType="io.renren.modules.app.entity.YwpzEntity">
		select sum(je) yzcje from
		ywpz where (SUBSTR(djbh FROM 1 FOR 2)='22' or SUBSTR(djbh FROM 5 FOR
		2)='22') or (SUBSTR(djbh FROM 1 FOR 2)='21' or SUBSTR(djbh FROM 5 FOR
		2)='21')
	</select>

	<select id="selectdwsjje" resultType="io.renren.modules.app.entity.YwpzEntity">
		select sum(je) sydwsjje
		from ywpz where (SUBSTR(djbh FROM 1 FOR 2)='01' or SUBSTR(djbh FROM 5
		FOR 2)='01')
	</select>

	<select id="selelctzhxx" resultType="io.renren.modules.app.entity.ZhxxEntity">
		select * from zhxx where 1=1
	</select>

	<select id="selectgrsjje" resultType="io.renren.modules.app.entity.YwpzEntity">
		select sum(je) sygrsjje
		from ywpz
		where (SUBSTR(djbh FROM 1 FOR 2)='03' or SUBSTR(djbh FROM 5
		FOR
		2)='03') or (SUBSTR(djbh FROM 1 FOR 2)='05' or SUBSTR(djbh FROM 5
		FOR
		2)='05')
	</select>

	<select id="selectfwxx" resultType="io.renren.modules.app.entity.FwxxEntity">
		select * from fwxx where 1=1
	</select>

	<select id="selectjcje" parameterType="java.lang.String"
		resultType="io.renren.modules.app.entity.JczqqsEntity">
		select IFNULL(sum(je),0) jiaocun from ywpz where
		CONCAT(SUBSTR(djrq FROM 1 FOR 4),SUBSTR(djrq FROM 6 FOR 2))=#{id} and
		djlx in('01','03','04','05')
	</select>

	<select id="selectzqje" parameterType="java.lang.String"
		resultType="io.renren.modules.app.entity.JczqqsEntity">
		select IFNULL(sum(je),0) zhiqu from ywpz where
		CONCAT(SUBSTR(djrq FROM 1 FOR 4),SUBSTR(djrq FROM 6 FOR 2))=#{id} and
		djlx in('21','22','23')
	</select>

</mapper>