Files
nuttyreading-java/src/main/resources/mapper/book/BookMedicalRecordsDao.xml
2023-11-27 10:36:22 +08:00

25 lines
1.2 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.peanut.modules.book.dao.BookMedicalRecordsDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.peanut.modules.book.entity.BookMedicalRecordsEntity" id="bookMedicalRecordsMap">
<result property="medicalRecordsId" column="medical_records_id"/>
<result property="bookId" column="book_id"/>
<result property="title" column="title"/>
<result property="content" column="content"/>
<result property="sort" column="sort"/>
<result property="createTime" column="create_time"/>
<result property="delFlag" column="del_flag"/>
</resultMap>
<select id="getBooks" parameterType="int" resultType="com.peanut.modules.book.entity.BookEntity">
select b.* from book_medical_records bmr
left join book b on bmr.book_id = b.id
where bmr.book_id not in (select book_id from user_ebook_buy where user_id = #{userId})
and b.del_flag = 0 and b.state = 1
GROUP BY bmr.book_id
</select>
</mapper>