<?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.zcxk.charge.core.dao.ParmSettingMapper">

    <!--  实体栏位  -->
    <sql id="parmSettingColumns">
         a.id as "id" ,
         a.tenant_id as "tenantId" ,
         a.company_org_id as "companyOrgId" ,
         a.parm_type as "parmType" ,
         a.parm_value as "parmValue" ,
         a.enable_state as "enableState" ,
         a.status as "status" ,
         a.date_create as "dateCreate" ,
         a.create_by as "createBy" ,
         a.date_update as "dateUpdate" ,
         a.update_by as "updateBy" 
     </sql>


    <!--  根据主键获取实体   -->
    <select id="findParmSettingById" resultType="com.zcxk.charge.core.entity.ParmSettingEntity">
        SELECT
        <include refid="parmSettingColumns"/>
        FROM sms_parm_setting a

        WHERE a.id = #{id} and a.status=1
    </select>

    <!--  根据获取实体List   -->
    <select id="findList" resultType="com.zcxk.charge.core.entity.ParmSettingEntity">
        SELECT
        <include refid="parmSettingColumns"/>
        FROM sms_parm_setting a
        <where>
            <if test="tenantId != null  and tenantId != ''">and a.tenant_id = #{tenantId}</if>
            <if test="companyOrgId != null ">and a.company_org_id = #{companyOrgId}</if>
            <if test="parmType != null ">and a.parm_type = #{parmType}</if>
            <if test="parmValue != null  and parmValue != ''">and a.parm_value = #{parmValue}</if>
            <if test="enableState != null ">and a.enable_state = #{enableState}</if>
            and a.status=1
        </where>
    </select>
    <!--  根据获取实体 page   -->
    <select id="findPage" resultType="com.zcxk.charge.core.entity.ParmSettingEntity">
        SELECT
        <include refid="parmSettingColumns"/>
        FROM sms_parm_setting a
        <where>
            <if test="parmSetting.tenantId != null  and parmSetting.tenantId != ''">and a.tenant_id =
                #{parmSetting.tenantId}
            </if>
            <if test="parmSetting.companyOrgId != null ">and a.company_org_id = #{parmSetting.companyOrgId}</if>
            <if test="parmSetting.parmType != null ">and a.parm_type = #{parmSetting.parmType}</if>
            <if test="parmSetting.parmValue != null  and parmSetting.parmValue != ''">and a.parm_value =
                #{parmSetting.parmValue}
            </if>
            <if test="parmSetting.enableState != null ">and a.enable_state = #{parmSetting.enableState}</if>
            and a.status=1
        </where>
    </select>
</mapper>