<?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.nantian.cloud.jljc.mapper.TTrainingMapper">

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="com.nantian.cloud.jljc.entity.TTraining" id="tTrainingMap">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="content" column="content"/>
        <result property="start_time" column="startTime"/>
        <result property="end_time" column="endTime"/>
        <result property="topic" column="topic"/>
        <result property="userid" column="userid"/>
        <result property="update_time" column="updateTime"/>
        <result property="type" column="type"/>
        <result property="delFlag" column="del_flag"/>
        <result property="state" column="state"/>
        <result property="remarks" column="remarks"/>
        <result property="address" column="address"/>
        <result property="placard" column="placard"/>
        <result column="dept_id" property="deptId"/>
        <result column="placardSting" property="placardSting"/>
        <result column="start_sign_up_time" property="startSignUpTime"/>
        <result column="end_sign_up_time" property="endSignUpTime"/>
        <result column="url_link" property="urlLink"/>
        <result column="url_state" property="urlState"/>
        <result column="line_state" property="lineState"/>
        <result column="video_link" property="videoLink"/>
        <result column="training_file" property="trainingFile"/>
        <result column="setup_accommodation" property="setupAccommodation"/>
        <result column="setup_session" property="setupSession"/>
        <result column="setup_dining" property="setupDining"/>
        <result column="setup_clans" property="setupClans"/>
        <result column="setup_sex" property="setupSex"/>
    </resultMap>

<!--    根据关键字进行模糊查询-->
    <select id="getInfoByKeyWord" parameterType="java.lang.String" resultType="java.lang.Object">
        select name ,placard from t_training where name like '%'||#{name}||'%'
    </select>

    <select id="getTrainingIdByName" parameterType="java.lang.String" resultMap="tTrainingMap">
        select id from t_training where name  like  '%'||#{name}||'%'
    </select>
    <select id="getPage" resultType="com.nantian.cloud.jljc.dto.TTrainingDto">
        select t.*
        from  t_training t
        where del_flag = '1'
        <if test="t.type!=null and t.type!='' and t.type != '0'">
            and type = #{t.type}
        </if>
        <if test="t.year!=null and t.year!=''">
            and start_sign_up_time like concat('%',#{t.year},'%')
        </if>
        <if test="t.name!=null and t.name!=''">
            and t.name like concat('%',#{t.name},'%')
        </if>
        order by t.update_time desc
    </select>
</mapper>