<?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="cn.bunny.services.mapper.SchedulersGroupMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.bunny.dao.entity.quartz.SchedulersGroup">
        <id column="id" property="id"/>
        <id column="create_time" property="createTime"/>
        <id column="update_time" property="updateTime"/>
        <id column="create_user" property="createUser"/>
        <id column="update_user" property="updateUser"/>
        <id column="is_deleted" property="isDeleted"/>
        <id column="group_name" property="groupName"/>
        <id column="description" property="description"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, create_time, update_time, create_user, update_user, is_deleted, group_name, description
    </sql>

    <!-- 分页查询任务调度分组内容 -->
    <select id="selectListByPage" resultType="cn.bunny.dao.entity.quartz.SchedulersGroup">
        select
        <include refid="Base_Column_List"/>
        from qrtz_schedulers_group
        <where>
            <if test="dto.groupName != null and dto.groupName != ''">
                and group_name like CONCAT('%',#{dto.groupName},'%')
            </if>
            <if test="dto.description != null and dto.description != ''">
                and description like CONCAT('%',#{dto.description},'%')
            </if>
        </where>
        order by update_time desc
    </select>

    <!-- 物理删除任务调度分组 -->
    <delete id="deleteBatchIdsWithPhysics">
        delete
        from qrtz_schedulers_group
        where id in
        <foreach collection="ids" item="id" open="(" close=")" separator=",">
            #{id}
        </foreach>
    </delete>

</mapper>
