file/file-web/src/main/resources/mybatis/mapper/ShareMapper.xml
2021-04-22 00:17:25 +08:00

36 lines
1.3 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.qiwenshare.file.mapper.ShareMapper">
<select id="selectShareList" resultType="com.qiwenshare.file.vo.share.ShareListVO">
SELECT * FROM share a
LEFT JOIN sharefile b ON b.shareBatchNum = a.shareBatchNum
LEFT JOIN userfile c ON c.userFileId = b.userFileId
LEFT JOIN file d ON d.fileId = c.fileId
WHERE shareFilePath = #{shareFilePath}
<if test="shareBatchNum != null">
AND a.shareBatchNum = #{shareBatchNum}
</if>
AND c.userId = #{userId}
order BY shareTime desc
limit #{beginCount}, #{pageCount}
</select>
<select id="selectShareListTotalCount" resultType="java.lang.Integer">
SELECT count(*) FROM share a
LEFT JOIN sharefile b ON b.shareBatchNum = a.shareBatchNum
LEFT JOIN userfile c ON c.userFileId = b.userFileId
LEFT JOIN file d ON d.fileId = c.fileId
WHERE shareFilePath = #{shareFilePath}
<if test="shareBatchNum != null">
AND a.shareBatchNum = #{shareBatchNum}
</if>
AND c.userId = #{userId}
</select>
</mapper>