80 lines
2.4 KiB
XML
80 lines
2.4 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.guarantee.mapper.SafeguardDetailMapper">
|
|
<select id="list" resultType="com.hivekion.guarantee.entity.SafeguardDetail" parameterType="com.hivekion.guarantee.entity.SafeguardDetail" >
|
|
SELECT
|
|
@rownum := @rownum + 1 AS seq,
|
|
t.*
|
|
FROM (
|
|
SELECT * FROM tbl_safeguard_detail
|
|
<where>
|
|
<if test="name != null and name !='' ">
|
|
and name LIKE CONCAT('%',#{name},'%')
|
|
</if>
|
|
<if test="type!=null">
|
|
and type=#{type}
|
|
</if>
|
|
<if test="departmentId!=null">
|
|
and department_id=#{departmentId}
|
|
</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.guarantee.entity.SafeguardDetail" >
|
|
select count(id) from tbl_safeguard_detail
|
|
<where>
|
|
<if test="name != null and name !='' ">
|
|
and name LIKE CONCAT('%',#{name},'%')
|
|
</if>
|
|
<if test="type!=null">
|
|
and type=#{type}
|
|
</if>
|
|
<if test="departmentId!=null">
|
|
and department_id=#{departmentId}
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
<select id="list" resultType="com.hivekion.guarantee.entity.SafeguardDetail" parameterType="com.hivekion.guarantee.entity.SafeguardDetail" databaseId="dm">
|
|
t.seq,
|
|
t.*
|
|
FROM (
|
|
SELECT
|
|
ROW_NUMBER() OVER (ORDER BY id ASC) AS seq,
|
|
a.*
|
|
FROM tbl_safeguard_detail a
|
|
<where>
|
|
<if test="name != null and name !='' ">
|
|
and name LIKE CONCAT('%',#{name},'%')
|
|
</if>
|
|
<if test="type!=null">
|
|
and type=#{type}
|
|
</if>
|
|
<if test="departmentId!=null">
|
|
and department_id=#{departmentId}
|
|
</if>
|
|
</where>
|
|
) t
|
|
WHERE t.seq > #{start} AND t.seq <= (#{start} + #{pageSize})
|
|
</select>
|
|
|
|
<select id="count" resultType="java.lang.Long" parameterType="com.hivekion.guarantee.entity.SafeguardDetail" databaseId="dm">
|
|
select count(id) from tbl_safeguard_detail
|
|
<where>
|
|
<if test="name != null and name !='' ">
|
|
and name LIKE CONCAT('%',#{name},'%')
|
|
</if>
|
|
<if test="type!=null">
|
|
and type=#{type}
|
|
</if>
|
|
<if test="departmentId!=null">
|
|
and department_id=#{departmentId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
</mapper>
|