<?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.ruoyi.syzy.mapper.BBusiWishUniversitiesEnrollBrochureMapper">

    <resultMap type="BBusiWishUniversitiesEnrollBrochure" id="BBusiWishUniversitiesEnrollBrochureResult">
        <result property="id"    column="id"    />
        <result property="year"    column="year"    />
        <result property="collegeCode"    column="collegeCode"    />
        <result property="collegeName"    column="collegeName"    />
        <result property="editor"    column="editor"    />
        <result property="summary"    column="summary"    />
        <result property="title"    column="title"    />
        <result property="isArt"    column="isArt"    />
        <result property="type"    column="type"    />
        <result property="metaDescription"    column="metaDescription"    />
        <result property="content"    column="content"    />
        <result property="tags"    column="tags"    />
        <result property="isShow"    column="isShow"    />
        <result property="hits"    column="hits"    />
        <result property="metaKeywords"    column="metaKeywords"    />
        <result property="rank"    column="rank"    />
        <result property="createTime"    column="createTime"    />
        <result property="updateTime"    column="updateTime"    />
        <result property="createTime2"    column="createTime2"    />
        <result property="typeName"    column="typeName"    />
        <result property="url"    column="url"    />
    </resultMap>

    <sql id="selectBBusiWishUniversitiesEnrollBrochureVo">
        select id, `year`, collegeCode, collegeName, editor, summary, title, isArt, `type`, metaDescription, content, tags, isShow, hits, metaKeywords, `rank`, createTime, updateTime, createTime2, typeName, url from b_busi_wish_universities_enroll_brochure
    </sql>

    <select id="selectBBusiWishUniversitiesEnrollBrochureList" parameterType="BBusiWishUniversitiesEnrollBrochure" resultMap="BBusiWishUniversitiesEnrollBrochureResult">
        select id, `year`, collegeCode, collegeName, editor, title, isArt, `type`, tags, isShow, hits, `rank`, createTime, updateTime, createTime2, typeName, url from b_busi_wish_universities_enroll_brochure
        <where>
            <if test="year != null "> and `year` = #{year}</if>
            <if test="collegeCode != null  and collegeCode != ''"> and collegeCode = #{collegeCode}</if>
            <if test="collegeName != null  and collegeName != ''"> and collegeName like concat('%', #{collegeName}, '%')</if>
            <if test="editor != null  and editor != ''"> and editor = #{editor}</if>
            <if test="summary != null  and summary != ''"> and summary = #{summary}</if>
            <if test="title != null  and title != ''"> and title = #{title}</if>
            <if test="isArt != null "> and isArt = #{isArt}</if>
            <if test="type != null "> and `type` = #{type}</if>
            <if test="metaDescription != null  and metaDescription != ''"> and metaDescription = #{metaDescription}</if>
            <if test="content != null  and content != ''"> and content = #{content}</if>
            <if test="tags != null  and tags != ''"> and tags = #{tags}</if>
            <if test="isShow != null "> and isShow = #{isShow}</if>
            <if test="hits != null "> and hits = #{hits}</if>
            <if test="metaKeywords != null  and metaKeywords != ''"> and metaKeywords = #{metaKeywords}</if>
            <if test="url != null  and url != ''"> and url = #{url}</if>
            <if test="rank != null "> and `rank` = #{rank}</if>
            <if test="createTime != null "> and DATE(createTime) &gt;= #{createTime}</if>
            <if test="updateTime != null "> and DATE(createTime) &lt;= #{updateTime}</if>
            <if test="createTime2 != null "> and createTime2 = #{createTime2}</if>
            <if test="typeName != null  and typeName != ''"> and typeName like concat('%', #{typeName}, '%')</if>
        </where>
        order by id desc
    </select>

    <select id="selectBBusiWishUniversitiesEnrollBrochureById" parameterType="Long" resultMap="BBusiWishUniversitiesEnrollBrochureResult">
        <include refid="selectBBusiWishUniversitiesEnrollBrochureVo"/>
        where id = #{id}
    </select>

    <insert id="insertBBusiWishUniversitiesEnrollBrochure" parameterType="BBusiWishUniversitiesEnrollBrochure" useGeneratedKeys="true" keyProperty="id">
        insert into b_busi_wish_universities_enroll_brochure
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="year != null">`year`,</if>
            <if test="collegeCode != null and collegeCode != ''">collegeCode,</if>
            <if test="collegeName != null and collegeName != ''">collegeName,</if>
            <if test="editor != null and editor != ''">editor,</if>
            <if test="summary != null and summary != ''">summary,</if>
            <if test="title != null and title != ''">title,</if>
            <if test="isArt != null">isArt,</if>
            <if test="type != null">`type`,</if>
            <if test="metaDescription != null">metaDescription,</if>
            <if test="content != null and content != ''">content,</if>
            <if test="url != null and url != ''">url,</if>
            <if test="tags != null">tags,</if>
            <if test="isShow != null">isShow,</if>
            <if test="hits != null">hits,</if>
            <if test="metaKeywords != null">metaKeywords,</if>
            <if test="rank != null">`rank`,</if>
            <if test="createTime != null">createTime,</if>
            <if test="updateTime != null">updateTime,</if>
            <if test="createTime2 != null">createTime2,</if>
            <if test="typeName != null">typeName,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="year != null">#{year},</if>
            <if test="collegeCode != null and collegeCode != ''">#{collegeCode},</if>
            <if test="collegeName != null and collegeName != ''">#{collegeName},</if>
            <if test="editor != null and editor != ''">#{editor},</if>
            <if test="summary != null and summary != ''">#{summary},</if>
            <if test="title != null and title != ''">#{title},</if>
            <if test="isArt != null">#{isArt},</if>
            <if test="type != null">#{type},</if>
            <if test="metaDescription != null">#{metaDescription},</if>
            <if test="content != null and content != ''">#{content},</if>
            <if test="url != null and url != ''">#{url},</if>
            <if test="tags != null">#{tags},</if>
            <if test="isShow != null">#{isShow},</if>
            <if test="hits != null">#{hits},</if>
            <if test="metaKeywords != null">#{metaKeywords},</if>
            <if test="rank != null">#{rank},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createTime2 != null">#{createTime2},</if>
            <if test="typeName != null">#{typeName},</if>
         </trim>
    </insert>

    <update id="updateBBusiWishUniversitiesEnrollBrochure" parameterType="BBusiWishUniversitiesEnrollBrochure">
        update b_busi_wish_universities_enroll_brochure
        <trim prefix="SET" suffixOverrides=",">
            <if test="year != null">`year` = #{year},</if>
            <if test="collegeCode != null and collegeCode != ''">collegeCode = #{collegeCode},</if>
            <if test="collegeName != null and collegeName != ''">collegeName = #{collegeName},</if>
            <if test="editor != null and editor != ''">editor = #{editor},</if>
            <if test="summary != null and summary != ''">summary = #{summary},</if>
            <if test="title != null and title != ''">title = #{title},</if>
            <if test="url != null and url != ''">url = #{url},</if>
            <if test="isArt != null">isArt = #{isArt},</if>
            <if test="type != null">`type` = #{type},</if>
            <if test="metaDescription != null">metaDescription = #{metaDescription},</if>
            <if test="content != null and content != ''">content = #{content},</if>
            <if test="tags != null">tags = #{tags},</if>
            <if test="isShow != null">isShow = #{isShow},</if>
            <if test="hits != null">hits = #{hits},</if>
            <if test="metaKeywords != null">metaKeywords = #{metaKeywords},</if>
            <if test="rank != null">`rank` = #{rank},</if>
            <if test="createTime != null">createTime = #{createTime},</if>
            <if test="updateTime != null">updateTime = #{updateTime},</if>
            <if test="createTime2 != null">createTime2 = #{createTime2},</if>
            <if test="typeName != null">typeName = #{typeName},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteBBusiWishUniversitiesEnrollBrochureById" parameterType="Long">
        delete from b_busi_wish_universities_enroll_brochure where id = #{id}
    </delete>

    <delete id="deleteBBusiWishUniversitiesEnrollBrochureByIds" parameterType="String">
        delete from b_busi_wish_universities_enroll_brochure where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
