<?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.sqx.modules.trainingCenter.dao.TrainingCenterDao">

    <select id="adminTrainingCenter" resultType="com.sqx.modules.trainingCenter.entity.TrainingCenter">
        select * from training_center where delete_flag = 0
        <if test="title!=null and title!=''">
            and title like '%'+#{title}+'%'
        </if>
        <if test="type!=null">
            and `type`=#{type}
        </if>
        order by create_time desc
    </select>

    <update id="updateAdminTrainingCenter">
        update training_center
        set title       = #{title},
            message     = #{message},
            delete_flag = #{deleteFlag},
            update_time = #{format},
            `type`=#{type}
        where training_id = #{trainingId}
    </update>

    <insert id="addAdminTrainingCenter">
        insert into training_center (title, message, create_time, delete_flag, `type`)
        values (#{title}, #{message}, #{format}, 0, #{type})
    </insert>


</mapper>