<?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.gxwebsoft.cms.mapper.CmsDesignRecordMapper">

    <!-- 关联查询sql -->
    <sql id="selectSql">
        SELECT a.*
        FROM cms_design_record a
        <where>
            <if test="param.id != null">
                AND a.id = #{param.id}
            </if>
            <if test="param.navigationId != null">
                AND a.navigation_id = #{param.navigationId}
            </if>
            <if test="param.title != null">
                AND a.title LIKE CONCAT('%', #{param.title}, '%')
            </if>
            <if test="param.dictCode != null">
                AND a.dict_code LIKE CONCAT('%', #{param.dictCode}, '%')
            </if>
            <if test="param.styles != null">
                AND a.styles LIKE CONCAT('%', #{param.styles}, '%')
            </if>
            <if test="param.shadow != null">
                AND a.shadow LIKE CONCAT('%', #{param.shadow}, '%')
            </if>
            <if test="param.keywords != null">
                AND a.keywords LIKE CONCAT('%', #{param.keywords}, '%')
            </if>
            <if test="param.description != null">
                AND a.description LIKE CONCAT('%', #{param.description}, '%')
            </if>
            <if test="param.path != null">
                AND a.path LIKE CONCAT('%', #{param.path}, '%')
            </if>
            <if test="param.photo != null">
                AND a.photo LIKE CONCAT('%', #{param.photo}, '%')
            </if>
            <if test="param.userId != null">
                AND a.user_id = #{param.userId}
            </if>
            <if test="param.sortNumber != null">
                AND a.sort_number = #{param.sortNumber}
            </if>
            <if test="param.comments != null">
                AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
            </if>
            <if test="param.status != null">
                AND a.status = #{param.status}
            </if>
            <if test="param.createTimeStart != null">
                AND a.create_time &gt;= #{param.createTimeStart}
            </if>
            <if test="param.createTimeEnd != null">
                AND a.create_time &lt;= #{param.createTimeEnd}
            </if>
        </where>
    </sql>

    <!-- 分页查询 -->
    <select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.CmsDesignRecord">
        <include refid="selectSql"></include>
    </select>

    <!-- 查询全部 -->
    <select id="selectListRel" resultType="com.gxwebsoft.cms.entity.CmsDesignRecord">
        <include refid="selectSql"></include>
    </select>

</mapper>
