<?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.ynfy.buss.practice.userpractice.mapper.UserPracticeMapper">
    <select id="selectPageList" resultType="com.ynfy.buss.practice.userpractice.entity.UserPractice">
        SELECT
        up.*,
        r.title as repositoryName
        FROM user_practice up
        LEFT JOIN repository r on up.repository_id = r.id
        <where>
            <if test="userPractice.repositoryName != null and userPractice.repositoryName != ''">
                AND r.title like concat('%', #{userPractice.repositoryName}, '%')
            </if>
            <if test="userPractice.practiceName != null and userPractice.practiceName != ''">
                AND up.practice_name like concat('%', #{userPractice.practiceName}, '%')
            </if>
            <if test="userPractice.userId != null and userPractice.userId != ''">
                AND up.user_id = #{userPractice.userId}
            </if>
        </where>
        ORDER BY up.commit_time DESC
    </select>
</mapper>