<?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.KxsCampUserMapper">

    <resultMap type="com.kxs.system.api.model.KxsCampUser" id="KxsCampUserMap">
        <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="camp_id" property="campId" />
        <result column="user_id" property="userId" />
        <result column="username" property="username" />
        <result column="user_code" property="userCode" />
        <result column="team_open_num" property="teamOpenNum" />
        <result column="team_order_num" property="teamOrderNum" />
        <result column="team_order_pool" property="teamOrderPool" />
        <result column="team_leader_num" property="teamLeaderNum" />
        <result column="team_leader_pool" property="teamLeaderPool" />
        <result column="team_pos_num" property="teamPosNum" />
        <result column="team_gd_num" property="teamGdNum" />
        <result column="team_lkb_num" property="teamLkbNum" />
        <result column="group_id" property="groupId" />

    </resultMap>
    <select id="getByPage" resultType="com.kxs.system.api.vo.kxsapp.camp.CampUserPageVO">
        select * from kxs_camp_user
            <where>
                del_flag = 0
                and camp_id = #{campId}
            </where>
    </select>
    <select id="getSysByPage" resultType="com.kxs.system.api.vo.admin.camp.SysCampUserPageVO">
        select a.*, cg.group_name from kxs_camp_user a
        left join kxs_camp_group cg on cg.group_id = a.group_id
        <where>
            a.del_flag = 0
            and a.camp_id = #{param.campId}
            <if test="param.userCode != null and param.userCode != ''">
                and a.user_code = #{param.userCode}
            </if>
            <if test="param.groupId != null and param.groupId != ''">
                and a.group_id = #{param.groupId}
            </if>
        </where>
    </select>

</mapper>
