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


    <resultMap type="com.zcxk.charge.core.entity.ComdisplayMapEntity" id="ComdisplayMapResult">
        <result property="id" column="id"/>
        <result property="tenantId" column="tenant_id"/>
        <result property="imagePath" column="image_path"/>
        <result property="status" column="status"/>
        <result property="dateCreate" column="date_create"/>
        <result property="createBy" column="create_by"/>
        <result property="dateUpdate" column="date_update"/>
        <result property="updateBy" column="update_by"/>
    </resultMap>

    <!--  实体栏位  -->
    <sql id="comdisplayMapColumns">
         a.id as "id" ,
         a.tenant_id as "tenantId" ,
         a.image_path as "imagePath" ,
         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="findComdisplayMapById" resultType="com.zcxk.charge.core.entity.ComdisplayMapEntity">
        SELECT
        <include refid="comdisplayMapColumns"/>
        FROM sms_comdisplay_map a
        WHERE a.id = #{id}
    </select>

    <!--  根据获取实体List   -->
    <select id="findList" resultType="com.zcxk.charge.core.entity.ComdisplayMapEntity">
        SELECT
        <include refid="comdisplayMapColumns"/>
        FROM sms_comdisplay_map a
        <where>
            a.status=1
            <if test="tenantId != null  and tenantId != ''">and a.tenant_id = #{tenantId}</if>
        </where>
    </select>
</mapper>