<?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.younike.system.mapper.ServerTimeMapper">
    
    <resultMap type="ServerTimeVo" id="ServerTimeResultVo">
        <result property="serverId"    column="server_id"    />
        <result property="stopOrder"    column="stop_order"    />
        <result property="allowEdit"    column="allow_edit"    />
        <result property="serverGrap"    column="server_grap"    />
        <result property="loginIp"    column="login_ip"    />
        <result property="loginDate"    column="login_date"    />
        <result property="delFlag"    column="del_flag"    />
        <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="column1"    column="column1"    />
        <result property="column2"    column="column2"    />
        <result property="column3"    column="column3"    />
        <collection property="sectionList" resultMap="com.younike.system.mapper.ServerTimeSectionMapper.ServerTimeSectionResultVo"
                    notNullColumn="section_id"/>
    </resultMap>

    <select id="getServerTimeInfo"  resultMap="ServerTimeResultVo">
        select st.server_id, st.stop_order, st.allow_edit, st.server_grap, st.login_ip, st.login_date, st.del_flag, st.create_by,
               st.create_time, st.update_by, st.update_time, st.column1, st.column2, st.column3,sts.section_id,
               sts.weeks,sts.hours_from,sts.hours_end,sts.is_enable
        from server_time st
        left join server_time_section sts on st.server_id = sts.server_id and sts.del_flag = 0
        where st.server_id = #{serverId}
        and st.del_flag = 0
        order by sts.create_time desc
    </select>
        

</mapper>