qirong
2023-11-29 13f796dc50449ae2ec525ef02aaf4b49a91a564b
src/main/resources/mapper/ExamTemplatesUserCountMapper.xml
@@ -19,17 +19,23 @@
    </insert>
    <select id="list" resultType="com.mindskip.xzs.domain.vo.ExamTemplatesUserCountVO" parameterType="com.mindskip.xzs.viewmodel.admin.exam.ExamPaperPageRequestVM">
        SELECT exam_templates_id as id, count(*) as count, user_id as userId FROM `t_exam_templates_user_count`
        SELECT u.exam_templates_id as id, count(*) as count, u.user_id as userId FROM `t_exam_templates_user_count` u
        left join t_exam_templates e on u.exam_templates_id = e.id
        <where>
            <if test="templatesId != null">
                and exam_templates_id = #{templatesId}
            </if>
            <if test="userId != null">
                and user_id = #{userId}
            </if>
                <if test="templatesId != null">
                    and u.exam_templates_id = #{templatesId}
                </if>
                <if test="userId != null">
                    and u.user_id = #{userId}
                </if>
                <if test="status != null">
                    and e.status = 0
                </if>
                <if test="status == null">
                    and e.status is null
                </if>
        </where>
        GROUP BY exam_templates_id, user_id
        GROUP BY u.exam_templates_id, u.user_id
    </select>
    <select id="getByTemplatesIds" resultMap="BaseResultMap">
@@ -55,6 +61,11 @@
        where user_id = #{userId}  and exam_templates_id = #{id}
    </select>
    <select id="getCountByUserIdAndTemplatesId" resultType="java.lang.Integer" parameterType="com.mindskip.xzs.domain.vo.ExamTemplatesUserCountVO">
        select count(*) from t_exam_templates_user_count
        where user_id = #{userId}  and exam_templates_id = #{id}
    </select>
    <select id="getByTemplates" resultMap="BaseResultMap">
        select * from t_exam_templates_user_count
        where exam_templates_id = #{id}