<?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="com.nantian.cloud.jljc.mapper.CcIndirectMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.nantian.cloud.jljc.entity.CcIndirect">
        <id column="id" property="id"/>
        <result column="epc" property="enterpriseCode"/>
        <result column="year" property="year"/>
        <result column="eltric" property="eltric"/>
        <result column="hot" property="hot"/>
        <result column="elitric_co2" property="elitricCo2"/>
        <result column="hot_co2" property="hotCo2"/>
        <result column="direct_total" property="directTotal"/>
        <result column="indirect_total" property="indirectTotal"/>
        <result column="userid" property="userid"/>
        <result column="update_time" property="updateTime"/>
        <result column="del_flag" property="delFlag"/>
        <result column="dept_id" property="deptId"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,epc AS enterpriseCode,year,eltric,hot,elitric_co2,hot_co2,direct_total,indirect_total, userid, update_time, del_flag, dept_id
    </sql>

    <select id="getAll" resultType="com.nantian.cloud.jljc.vo.CcIndirectVo">
        select
        t.id,t.epc AS
        enterpriseCode,e.cmp_name,t.year,t.eltric,t.hot,t.elitric_co2,t.hot_co2,t.direct_total,t.indirect_total,
        t.userid, t.update_time, t.del_flag, t.dept_id
        from t_cc_indirect t,enterprise_info e
        where
        t.epc=e.enterprise_code
        and t.del_flag = "1"
        <if test="cmpName != null and cmpName != ''">
            and e.cmp_name like concat("%",#{cmpName},"%")
        </if>
        <if test="cyear != null and cyear != 0">
            and t.year=#{cyear}
        </if>
    </select>

</mapper>
