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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.nantian.cloud.jljc.entity.HTableKind">
        <result column="id" property="id" />
        <result column="production" property="production" />
        <result column="product_name" property="productName" />
        <result column="unit" property="unit" />
        <result column="unit2" property="unit2" />
        <result column="code" property="code" />
        <result column="code2" property="code2" />
        <result column="calculationResults" property="calculationResults" />
        <result column="refModulus" property="refModulus" />
        <result column="codes" property="codes" />
        <result column="tce" property="tce" />
        <result column="bd" property="bd" />
        <result column="input_item" property="inputItem" />
        <result column="result_item" property="resultItem" />
        <result column="old_code" property="oldCode" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, production, product_name, unit,unit2, code,code2, calculationResults, refModulus, codes, tce,bd,input_item,result_item,old_code
    </sql>

    <sql id="sql_base">
        id, IFNULL(production,0) as production, product_name, unit,unit2,bd,result_item,input_item, code,code2, IFNULL(calculationResults,0) as calculationResults, refModulus, codes, tce,old_code
    </sql>

    <select id="getTableKindByCodes" resultType="com.nantian.cloud.jljc.entity.HTableKind">
        select <include refid="sql_base"></include>
        from h_table_kind where codes = #{codes} order by id asc
    </select>

</mapper>
