<?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.srs.stureg.mapper.SrsStuSizeMapper">

    <resultMap type="SrsStuSizeVo" id="SrsStuSizeResultVo">
        <result property="id"    column="id"    />
        <result property="ksh"    column="ksh"    />
        <result property="height"    column="height"    />
        <result property="weight"    column="weight"    />
        <result property="shoes"    column="shoes"    />
        <result property="status"    column="status"    />
        <result property="classId" column="class_id"/>
        <result property="className" column="class_name"/>
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="delFlag"    column="del_flag"    />
    </resultMap>
    <resultMap type="SrsStuSize" id="SrsStuSizeResult">
        <result property="id"    column="id"    />
        <result property="ksh"    column="ksh"    />
        <result property="height"    column="height"    />
        <result property="weight"    column="weight"    />
        <result property="shoes"    column="shoes"    />
        <result property="status"    column="status"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="delFlag"    column="del_flag"    />
    </resultMap>

    <sql id="selectSrsStuSizeVo">
        select id, ksh, height, weight, shoes, status, create_by, create_time, update_by, update_time, del_flag from srs_stu_size
    </sql>

    <select id="selectSrsStuSizeList" parameterType="SrsStuSize" resultMap="SrsStuSizeResult">
        select a.id, a.ksh, height, weight, shoes, a.status, a.create_by, a.create_time, a.update_by, a.update_time, a.del_flag,sc.class_name,sc.class_id from srs_stu_size as a
        left join srs_stu_reg ssr on a.ksh = ssr.KSH
        left join srs_class sc on ssr.BJDM = sc.class_code
        <where>
            <if test="ksh != null  and ksh != ''"> and a.ksh = #{ksh}</if>
            <if test="height != null "> and height = #{height}</if>
            <if test="weight != null "> and weight = #{weight}</if>
            <if test="shoes != null "> and shoes = #{shoes}</if>
            <if test="className != null  and className != ''">and sc.class_name = #{className}</if>
            <if test="classId != null  and classId != ''">and sc.class_id = #{classId}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
        </where>
    </select>
    <select id="selectSrsStuSizeListVo" parameterType="SrsStuSizeVo" resultMap="SrsStuSizeResultVo">
        select a.id, a.ksh, height, weight, shoes, a.status, a.create_by, a.create_time, a.update_by, a.update_time, a.del_flag,sc.class_name,sc.class_id from srs_stu_size as a
        left join srs_stu_reg ssr on a.ksh = ssr.KSH
        left join srs_class sc on ssr.BJDM = sc.class_code
        <where>
            <if test="ksh != null  and ksh != ''"> and a.ksh = #{ksh}</if>
            <if test="height != null "> and height = #{height}</if>
            <if test="weight != null "> and weight = #{weight}</if>
            <if test="shoes != null "> and shoes = #{shoes}</if>
            <if test="className != null  and className != ''">and sc.class_name = #{className}</if>
            <if test="classId != null  and classId != ''">and sc.class_id = #{classId}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
        </where>
    </select>

    <select id="selectSrsStuSizeById" parameterType="Long" resultMap="SrsStuSizeResult">
        <include refid="selectSrsStuSizeVo"/>
        where id = #{id}
    </select>

    <insert id="insertSrsStuSize" parameterType="SrsStuSize">
        insert into srs_stu_size
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="ksh != null">ksh,</if>
            <if test="height != null">height,</if>
            <if test="weight != null">weight,</if>
            <if test="shoes != null">shoes,</if>
            <if test="status != null">status,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="delFlag != null">del_flag,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="ksh != null">#{ksh},</if>
            <if test="height != null">#{height},</if>
            <if test="weight != null">#{weight},</if>
            <if test="shoes != null">#{shoes},</if>
            <if test="status != null">#{status},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="delFlag != null">#{delFlag},</if>
         </trim>
    </insert>

    <update id="updateSrsStuSize" parameterType="SrsStuSize">
        update srs_stu_size
        <trim prefix="SET" suffixOverrides=",">
            <if test="ksh != null">ksh = #{ksh},</if>
            <if test="height != null">height = #{height},</if>
            <if test="weight != null">weight = #{weight},</if>
            <if test="shoes != null">shoes = #{shoes},</if>
            <if test="status != null">status = #{status},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSrsStuSizeById" parameterType="Long">
        delete from srs_stu_size where id = #{id}
    </delete>

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