simulation-backend/target/classes/mapper/tbl/ScenarioHistoryMapper.xml
2025-09-13 15:57:13 +08:00

55 lines
1.8 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.hivekion.scenario.mapper.ScenarioHistoryMapper">
<select id="list" resultType="com.hivekion.scenario.entity.ScenarioHistory" parameterType="com.hivekion.scenario.entity.ScenarioHistory" >
SELECT
@rownum := @rownum + 1 AS seq,
t.*
FROM (
SELECT * FROM tbl_scenario_history
<where>
<if test="name != null and name !='' ">
name LIKE CONCAT('%',#{name},'%')
</if>
</where>
order by id asc ) t, ( SELECT @rownum := #{start} ) r limit
#{start},#{pageSize}
</select>
<select id="count" resultType="java.lang.Long" parameterType="com.hivekion.scenario.entity.ScenarioHistory" >
select count(id) from tbl_scenario_history
<where>
<if test="name != null and name !=''">
name LIKE CONCAT('%',#{name},'%')
</if>
</where>
</select>
<select id="list" resultType="com.hivekion.scenario.entity.ScenarioHistory" parameterType="com.hivekion.scenario.entity.ScenarioHistory" databaseId="dm">
t.seq,
t.*
FROM (
SELECT
ROW_NUMBER() OVER (ORDER BY id ASC) AS seq,
a.*
FROM tbl_scenario_history a
<where>
<if test="name != null and name !='' ">
(name LIKE '%'||#{name}||'%')
</if>
</where>
) t
WHERE t.seq > #{start} AND t.seq &lt;= (#{start} + #{pageSize})
</select>
<select id="count" resultType="java.lang.Long" parameterType="com.hivekion.scenario.entity.ScenarioHistory" databaseId="dm">
select count(id) from tbl_scenario_history
<where>
<if test="name != null and name !=''">
(name LIKE '%'||#{name}||'%')
</if>
</where>
</select>
</mapper>