<?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.dbcapp.mapper.record.TEnterpriseQuotaMapper">
    <resultMap id="BaseResultMap" type="com.nantian.cloud.dbcapp.entity.TEnterpriseQuota">
        <id column="id" property="id" />
        <result column="enterprise_code" property="enterpriseCode" />
        <result column="quota_name" property="quotaName" />
        <result column="quota_code" property="quotaCode" />
        <result column="product_code" property="productCode" />
    </resultMap>
    <select id="getQuotaList" resultType="java.util.Map">
        SELECT * from t_enterprise_quota
        <trim prefix="where" prefixOverrides="and">
            <if test="enterpriseCode!=null and enterpriseCode != ''" >
                and enterprise_code = #{enterpriseCode}
            </if>
        </trim>
    </select>
    <select id="getQuota" resultType="java.lang.String">
        SELECT quota_code from t_enterprise_quota
        <trim prefix="where" prefixOverrides="and">
            <if test="enterpriseCode!=null and enterpriseCode != ''" >
                and enterprise_code = #{enterpriseCode}
            </if>
            <if test="quotaName!=null and quotaName != ''" >
                and quota_name = #{quotaName}
            </if>
        </trim>
    </select>

    <select id="getTotal" resultType="java.lang.Integer">
        SELECT IFNULL(count(*),0)
        FROM t_enterprise_quota
        <trim prefix="where" prefixOverrides="and">
            <if test="enterpriseCode!=null and enterpriseCode != ''">
                and enterpriseCode = #{enterpriseCode}
            </if>
        </trim>
    </select>
</mapper>