<?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.chinacreator.video.mapper.QueryOderRelationDao">


    <select id="findByUserAndSpid" resultType="Map">
    SELECT ID, CPID,SPID,USERID, TO_CHAR(ORDERTIME, 'yyyymmddhh24miss') ORDERTIME,
			TO_CHAR(endtime, 'yyyymmddhh24miss') endtime, TO_CHAR(CANCELTIME, 'yyyymmddhh24miss') CANCELTIME,
			(case when endtime is null then '0' when endtime >= sysdate then '1' else '2' end) STATUS,
			ORDERCHANNEL,ORDERCHANNEL2,CANCELCHANNEL,CANCELCHANNEL2
	FROM TD_ORDER_RELATIONS WHERE USERID=#{userid} and CPID=#{cpid} AND SPID=#{spid} 
    </select>

    <select id="getSysTime" resultType="string" >
	select to_char(sysdate,'yyyymmddhh24miss') from dual
    </select>


</mapper>