zhwl/zhwl-business/zhwl-base/target/classes/mapper/base/ZdyHolidayVacationsMapper.xml
2025-07-01 17:54:58 +08:00

188 lines
6.7 KiB
XML

<?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.zhwl.base.mapper.ZdyHolidayVacationsMapper">
<resultMap type="ZdyHolidayVacations" id="ZdyHolidayVacationsResult">
<result property="id" column="id"/>
<result property="holidayName" column="holiday_name"/>
<result property="holidayType" column="holiday_type"/>
<result property="startTime" column="start_time"/>
<result property="endTime" column="end_time"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="remark" column="remark"/>
<result property="holidayDict" column="holiday_dict"/>
</resultMap>
<sql id="selectZdyHolidayVacationsVo">
select id,
holiday_name,
holiday_type,
start_time,
end_time,
create_time,
create_by,
update_time,
update_by,
remark,
holiday_dict
from zdy_holiday_vacations
</sql>
<select id="selectZdyHolidayVacationsList" parameterType="ZdyHolidayVacations"
resultMap="ZdyHolidayVacationsResult">
<include refid="selectZdyHolidayVacationsVo"/>
<where>
<if test="holidayName != null and holidayName != ''">
and holiday_name like concat('%', #{holidayName}, '%')
</if>
<if test="holidayType != null and holidayType != ''">
and holiday_type = #{holidayType}
</if>
<if test="startTime != null ">
and start_time = #{startTime}
</if>
<if test="endTime != null ">
and end_time = #{endTime}
</if>
<if test="rangeStartDateTime != null ">
and start_time &gt;= #{rangeStartDateTime}
</if>
<if test="rangeEndDateTime != null ">
and start_time &lt;= #{rangeEndDateTime}
</if>
<if test="holidayDict != null ">
and holiday_dict = #{holidayDict}
</if>
<if test="nowDate != null ">
and #{nowDate} &lt;= end_time
</if>
</where>
order by start_time asc
</select>
<select id="selectZdyHolidayVacationsById" parameterType="Long"
resultMap="ZdyHolidayVacationsResult">
<include refid="selectZdyHolidayVacationsVo"/>
where id = #{id}
</select>
<insert id="insertZdyHolidayVacations" parameterType="ZdyHolidayVacations" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_holiday_vacations
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="holidayName != null and holidayName != ''">holiday_name,
</if>
<if test="holidayType != null">holiday_type,
</if>
<if test="startTime != null">start_time,
</if>
<if test="endTime != null">end_time,
</if>
<if test="createTime != null">create_time,
</if>
<if test="createBy != null">create_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="remark != null">remark,
</if>
<if test="holidayDict != null">holiday_dict,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="holidayName != null and holidayName != ''">#{holidayName},
</if>
<if test="holidayType != null">#{holidayType},
</if>
<if test="startTime != null">#{startTime},
</if>
<if test="endTime != null">#{endTime},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="remark != null">#{remark},
</if>
<if test="holidayDict != null">#{holidayDict},
</if>
</trim>
</insert>
<update id="updateZdyHolidayVacations" parameterType="ZdyHolidayVacations">
update zdy_holiday_vacations
<trim prefix="SET" suffixOverrides=",">
<if test="holidayName != null and holidayName != ''">holiday_name =
#{holidayName},
</if>
<if test="holidayType != null">holiday_type =
#{holidayType},
</if>
<if test="startTime != null">start_time =
#{startTime},
</if>
<if test="endTime != null">end_time =
#{endTime},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="remark != null">remark =
#{remark},
</if>
<if test="holidayDict != null">holiday_dict =
#{holidayDict},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyHolidayVacationsById" parameterType="Long">
delete
from zdy_holiday_vacations
where id = #{id}
</delete>
<delete id="deleteZdyHolidayVacationsByIds" parameterType="String">
delete from zdy_holiday_vacations where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteZdyHolidayVacationsByHolidayType">
delete
from zdy_holiday_vacations
where holiday_type in (1,2)
</delete>
<select id="selectByQueryDate" resultMap="ZdyHolidayVacationsResult">
<include refid="selectZdyHolidayVacationsVo"/>
<![CDATA[
where start_time <= DATE_FORMAT(#{queryDate}, '%Y-%m-%d')
and end_time >= DATE_FORMAT(#{queryDate}, '%Y-%m-%d')
]]>
and holiday_type in (1,2)
limit 1
</select>
</mapper>