<?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.ruoyi.system.mapper.ElRepoMapper">

    <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.repo.ElRepo">
            <id property="id" column="id" jdbcType="VARCHAR"/>
            <result property="code" column="code" jdbcType="VARCHAR"/>
            <result property="title" column="title" jdbcType="VARCHAR"/>
            <result property="remark" column="remark" jdbcType="VARCHAR"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
    </resultMap>

    <sql id="Base_Column_List">
        id,code,title,
        remark,create_time,update_time
    </sql>


    <select id="selectRepoList" parameterType="com.ruoyi.system.domain.repo.ElRepo"   resultType="com.ruoyi.system.domain.repo.vo.RepoVO">
        SELECT id, code, title, remark, create_time, update_time,
        (SELECT COUNT(0) FROM el_qu_repo WHERE repo_id=repo.id AND qu_type=1) AS radio_count,
        (SELECT COUNT(0) FROM el_qu_repo WHERE repo_id=repo.id AND qu_type=2) AS multi_count,
        (SELECT COUNT(0) FROM el_qu_repo WHERE repo_id=repo.id AND qu_type=3) AS judge_count
        FROM el_repo repo
        <trim prefix="where" prefixOverrides="and|or">
                <if test="title!=null and title!=''">
                    and repo.title like concat('%',#{title},'%')
                </if>
        </trim>
        order by repo.create_time desc
    </select>




</mapper>
