<?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.tanpu.community.dao.mapper.community.TopicFollowRelMapper"> <!-- 通用查询映射结果 --> <sql id="Base_Column_List"> id, topic_id, user_id, follow_time, unfollow_time, create_time, update_time, delete_tag </sql> <resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.community.TopicFollowRelEntity"> <id column="id" property="id" /> <result column="topic_id" property="topicId" /> <result column="user_id" property="userId" /> <result column="follow_time" property="followTime" /> <result column="unfollow_time" property="unfollowTime" /> <result column="create_time" property="createTime" /> <result column="update_time" property="updateTime" /> <result column="delete_tag" property="deleteTag" /> </resultMap> <!--auto generated by MybatisCodeHelper on 2022-02-17--> <select id="selectTopicIdByUserId" resultType="java.lang.String"> select topic_id from topic_follow_rel where user_id=#{userId} and delete_tag = 0 </select> <!--auto generated by MybatisCodeHelper on 2022-02-17--> <select id="queryOneByTopicIdAndUserId" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from topic_follow_rel where topic_id=#{topicId} and user_id=#{userId} and delete_tag = 0 </select> </mapper>