<?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="cn.com.ty.lift.business.library.dao.mapper.PlatformCompanyLiftRelevanceMapper" >
	<resultMap id="BaseResultMap" type="cn.com.ty.lift.business.library.dao.entity.PlatformCompanyLiftRelevance" >
		<id column="id" property="id" jdbcType="BIGINT" />
		<result column="lift_id" property="liftId" jdbcType="BIGINT" />
		<result column="mt_company_id" property="mtCompanyId" jdbcType="BIGINT" />
		<result column="lift_company_status" property="liftCompanyStatus" jdbcType="TINYINT" />
	</resultMap>

	<select id="count" resultType="java.lang.Integer">
		SELECT count(1)
		FROM platform_company_lift_relevance pclr
				 LEFT JOIN project_lift_relevance plr ON pclr.lift_id = plr.lift_id
				 LEFT JOIN project p ON plr.project_id = p.id
		WHERE pclr.mt_company_id = #{mtCompanyId}
		  AND p.project_status = #{projectStatus}
		  AND lift_company_status = '1'
	</select>

	<select id="countCapital" resultType="java.lang.Integer">
		SELECT count(1)
		FROM platform_company_lift_relevance pclr
				 LEFT JOIN capital_repair_lift_relevance crlr ON pclr.lift_id = crlr.lift_id
				 LEFT JOIN capital_repair cr ON crlr.project_id = cr.id
		WHERE pclr.mt_company_id = #{mtCompanyId}
		  AND cr.project_status = #{projectStatus}
		  AND lift_company_status = '1'
	</select>
</mapper>