<?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.zcloud.mapper.datasource.check.SysDateMapper">

	<!--表名 -->
	<sql id="tableName">
		V_SYSDATE
	</sql>

	<!--数据字典表名 -->
	<sql id="dicTableName">
		SYS_DICTIONARIES
	</sql>

	<!-- 字段 -->
	<sql id="Field">
		DATE_FORMAT(f.DATE,'%Y-%m-%d %H:%i:%s')  DATE,
		DATE_FORMAT(f.DAY_START,'%Y-%m-%d %H:%i:%s')  DAY_START,
		DATE_FORMAT(f.DAY_END,'%Y-%m-%d %H:%i:%s')  DAY_END,
		DATE_FORMAT(f.WEEK_START,'%Y-%m-%d %H:%i:%s')  WEEK_START,
		DATE_FORMAT(f.WEEK_END,'%Y-%m-%d %H:%i:%s')  WEEK_END,
		DATE_FORMAT(f.XUN_START,'%Y-%m-%d %H:%i:%s')  XUN_START,
		DATE_FORMAT(f.XUN_END,'%Y-%m-%d %H:%i:%s')  XUN_END,
		DATE_FORMAT(f.MONTH_START,'%Y-%m-%d %H:%i:%s')  MONTH_START,
		DATE_FORMAT(f.MONTH_END,'%Y-%m-%d %H:%i:%s')  MONTH_END,
		DATE_FORMAT(f.QUARTER_START,'%Y-%m-%d %H:%i:%s')  QUARTER_START,
		DATE_FORMAT(f.QUARTER_END,'%Y-%m-%d %H:%i:%s')  QUARTER_END,
		DATE_FORMAT(f.HALFYEAR_START,'%Y-%m-%d %H:%i:%s')  HALFYEAR_START,
		DATE_FORMAT(f.HALFYEAR_END,'%Y-%m-%d %H:%i:%s')  HALFYEAR_END,
		DATE_FORMAT(f.YEAR_START,'%Y-%m-%d %H:%i:%s')  YEAR_START,
		DATE_FORMAT(f.YEAR_END,'%Y-%m-%d %H:%i:%s')  YEAR_END
	</sql>

	<!-- 节假日 -->
	<select id="listAllByJjr" parameterType="pd" resultType="pd">
		select
		<include refid="Field"></include>
		from
		<include refid="tableName"></include> f
		${SQL}
	</select>

	<!-- 通过ID获取数据 -->
	<select id="findByDate" parameterType="pd" resultType="pd">
		select
		<include refid="Field"></include>
		from
		<include refid="tableName"></include> f
		where
			f.DATE = DATE_FORMAT(#{DATE},'%Y-%m-%d')
	</select>

</mapper>
