<?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.kxs.system.biz.mapper.KxsBcqtTeamMapper">

    <resultMap type="com.kxs.system.api.model.KxsBcqtTeam" id="KxsBcqtTeamMap">
        <result column="id" property="id" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="del_flag" property="delFlag" />
        <result column="version" property="version" />
        <result column="team_name" property="teamName" />
        <result column="start_time" property="startTime" />
        <result column="end_time" property="endTime" />
        <result column="status" property="status" />
        <result column="reach_status" property="reachStatus" />
        <result column="captain_id" property="captainId" />
        <result column="team_number" property="teamNumber" />
        <result column="activity_date" property="activityDate" />

    </resultMap>
    <select id="getBcqtList" resultType="com.kxs.system.api.vo.kxsapp.camp.CampGetBcqtListVO">
        select * from kxs_bcqt_team
        <where>
            and del_flag != 1
            and `status` = 0
            <if test="keyword != null and keyword != ''">
                and (team_name like concat('%', #{keyword}, '%') or username like concat('%', #{keyword}, '%'))
            </if>
            ORDER BY
            CASE
            WHEN team_number = 10 THEN 1
            ELSE 0
            END,
            create_time DESC

        </where>
    </select>

</mapper>
