-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserMapper.xml
24 lines (21 loc) · 1.15 KB
/
UserMapper.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.HuanyuMake.dao.UserMapper">
<!--这是支持 selectPage(Page<T>) 分页方法查询总数的sql-->
<select id="selectAllSubscriberById" parameterType="int" resultType="user">
SELECT subscriber.*
FROM blogger, subscriber
</select>
<!-- 设置了open-mapper-count-sql = true , 且 count-sql-suffix = '_COUNT' 则会使用该句查询总记录数 -->
<!-- 这是自定义 selectAllSubscriberById sql的总数查询sql的sql语句, 但要注意这些语句的 resultType 必须为 java.lang.Long-->
<select id="selectAllSubscriberById_COUNT" parameterType="int" resultType="Long">
SELECT COUNT(subscriber.id)
FROM blogger, subscriber
</select>
<!-- 自定义mybatis-plus中selectPage的总数查询sql -->
<select id="selectPage_COUNT" resultType="Long">
select TABLE_ROWS AS total from information_schema.TABLES where TABLE_SCHEMA = 'poetryplatform' AND TABLE_NAME = 'users'
</select>
</mapper>