<?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.cyksj.mapper.EquipmentActivityReduceMapper">

    <select id="checkRepeatTimeDuration" resultType="java.lang.Integer">
        select count(*) from equipment_activity_reduce where
        <if test="id != null">
            id != #{id} and
        </if>
        deleted is true and ((st >= #{st} and st &lt; #{et} or et
        >= #{st} and et &lt; #{et}) or (#{st} >= st and #{st} &lt; et or
        #{et} >= st and #{et} &lt; et))
        limit 1
    </select>
</mapper>