<?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.CcDirectMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.nantian.cloud.jljc.entity.CcDirect">
        <id column="id" property="id" />
        <result column="epc" property="enterpriseCode" />
        <result column="year" property="year" />
        <result column="energy_id" property="energyId" />
        <result column="energy_value" property="energyValue" />
        <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,energy_id,energy_value, userid, update_time, del_flag, dept_id
    </sql>

    <select id="getAllByEpcYear" resultType="com.nantian.cloud.jljc.vo.CcDirectVo">
        select
        t.id,t.epc AS
        enterpriseCode,t.year,t.energy_id,ei.energy_name,t.energy_value,
        t.userid, t.update_time, t.del_flag, t.dept_id
        from t_cc_direct t,energy_info ei
        where
        t.energy_id=ei.id
        and t.epc=#{epc}
        and t.year=#{cyear}
    </select>

</mapper>
