gasWellWatch/src/main/resources/mapper/SwitchStatusExportDao.xml

26 lines
982 B
XML
Raw Normal View History

2024-12-17 14:32:18 +08:00
<?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.isu.gaswellwatch.dao.SwitchStatusExportDao">
<delete id="deleteData">
delete from switch_status_export
<where>
create_time &lt;= DATE_SUB(NOW(), INTERVAL 7 DAY)
</where>
</delete>
<select id="getSwitchStatusExport" resultType="com.isu.gaswellwatch.vo.SwitchStatusExport">
2024-12-27 15:24:41 +08:00
select s.* from switch_status_export s join block_department b on s.block_id = b.block_id
2024-12-17 14:32:18 +08:00
<where>
2024-12-27 15:24:41 +08:00
b.department_id = #{departmentId}
2024-12-17 14:32:18 +08:00
<if test="startTime != null and startTime != ''">
2024-12-27 15:24:41 +08:00
and s.create_time &gt;= #{startTime}
2024-12-17 14:32:18 +08:00
</if>
<if test="endTime != null and endTime != ''">
2024-12-27 15:24:41 +08:00
and s.create_time &lt;= #{endTime}
2024-12-17 14:32:18 +08:00
</if>
2024-12-27 15:24:41 +08:00
</where> order by s.create_time desc
2024-12-17 14:32:18 +08:00
</select>
</mapper>