答题开发

master
caolin 4 days ago
parent 31e29202cf
commit 7f0f8a7105
  1. 21
      src/main/java/com/wrj/driver/server/controller/WrjQuestionPracticeTotalController.java
  2. 44
      src/main/java/com/wrj/driver/server/entity/WrjQuestionPracticeTotal.java
  3. 20
      src/main/java/com/wrj/driver/server/mapper/WrjQuestionPracticeTotalMapper.java
  4. 16
      src/main/java/com/wrj/driver/server/service/IWrjQuestionPracticeTotalService.java
  5. 20
      src/main/java/com/wrj/driver/server/service/impl/WrjQuestionPracticeTotalServiceImpl.java
  6. 19
      src/main/resources/mapper/WrjQuestionPracticeTotalMapper.xml
  7. BIN
      target/classes/com/wrj/driver/server/dto/QuestionPracticeAddDto.class

@ -0,0 +1,21 @@
package com.wrj.driver.server.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 用户答题统计表 前端控制器
* </p>
*
* @author Automated procedures
* @since 2025-06-30
*/
@RestController
@RequestMapping("/wrjQuestionPracticeTotal")
public class WrjQuestionPracticeTotalController {
}

@ -0,0 +1,44 @@
package com.wrj.driver.server.entity;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 用户答题统计表
* </p>
*
* @author Automated procedures
* @since 2025-06-30
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class WrjQuestionPracticeTotal implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 题目标识
*/
private Long questionId;
/**
* 用户标识
*/
private Long userId;
/**
* 答题次数
*/
private Long answerNumber;
/**
* 答题正确次数
*/
private Long rightNumber;
}

@ -0,0 +1,20 @@
package com.wrj.driver.server.mapper;
import com.wrj.driver.server.entity.WrjQuestionPracticeTotal;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* 用户答题统计表 Mapper 接口
* </p>
*
* @author Automated procedures
* @since 2025-06-30
*/
public interface WrjQuestionPracticeTotalMapper extends BaseMapper<WrjQuestionPracticeTotal> {
WrjQuestionPracticeTotal selectByUserIdAndQuestionId(@Param("userId") Long userId, @Param("questionId") Long questionId);
int updateAnswerNumber(@Param("userId") Long userId, @Param("questionId") Long questionId, @Param("answerNum") int answerNum, @Param("rightNum") int rightNum);
}

@ -0,0 +1,16 @@
package com.wrj.driver.server.service;
import com.wrj.driver.server.entity.WrjQuestionPracticeTotal;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 用户答题统计表 服务类
* </p>
*
* @author Automated procedures
* @since 2025-06-30
*/
public interface IWrjQuestionPracticeTotalService extends IService<WrjQuestionPracticeTotal> {
}

@ -0,0 +1,20 @@
package com.wrj.driver.server.service.impl;
import com.wrj.driver.server.entity.WrjQuestionPracticeTotal;
import com.wrj.driver.server.mapper.WrjQuestionPracticeTotalMapper;
import com.wrj.driver.server.service.IWrjQuestionPracticeTotalService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 用户答题统计表 服务实现类
* </p>
*
* @author Automated procedures
* @since 2025-06-30
*/
@Service
public class WrjQuestionPracticeTotalServiceImpl extends ServiceImpl<WrjQuestionPracticeTotalMapper, WrjQuestionPracticeTotal> implements IWrjQuestionPracticeTotalService {
}

@ -0,0 +1,19 @@
<?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.wrj.driver.server.mapper.WrjQuestionPracticeTotalMapper">
<select id="selectByUserIdAndQuestionId"
resultType="com.wrj.driver.server.entity.WrjQuestionPracticeTotal">
select
*
from wrj_question_practice_total
where question_id = #{questionId} and user_id = #{userId}
</select>
<update id="updateAnswerNumber">
update wrj_question_practice_total
set answer_number = answer_number + #{answerNum},
right_number = right_number + #{rightNum}
where question_id = #{questionId} and user_id = #{userId}
</update>
</mapper>
Loading…
Cancel
Save