<?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.countrygarden.bi.main.dao.financial.ErpToNcMapper">

    <resultMap id="BaseResultMap" type="cn.com.countrygarden.bi.main.model.financial.ErpToNc">
        <id column="id" jdbcType="VARCHAR" property="id" />
        <result column="CorpCostName" jdbcType="VARCHAR" property="costName" />
        <result column="CorpCostId" jdbcType="VARCHAR" property="costId" />
        <result column="first" jdbcType="VARCHAR" property="first" />
        <result column="second" jdbcType="VARCHAR" property="second" />
        <result column="third" jdbcType="VARCHAR" property="third" />
        <result column="code" jdbcType="VARCHAR" property="code" />
    </resultMap>

    <sql id="Base_Column_List">
    id, CorpCostName, CorpCostId, first, second, third, code
  </sql>

    <select id="selectERPCostIdByNCCode" resultMap="BaseResultMap">
    SELECT
	  *
    FROM
	  `erp_to_nc`
    WHERE
	  `code` = #{code}
<if test="name != null">
    AND
      third = #{name}
</if>

  </select>
</mapper>