获取专项题目数量

dev
caolin 2023-08-27 16:38:22 +08:00
parent 55193fab29
commit 2d529ec4b8
9 changed files with 53 additions and 4 deletions

View File

@ -98,5 +98,11 @@ public class TdQuestionController {
return result; return result;
} }
@ApiOperation("查询各专项分类题目数量")
@PostMapping("/querySpecialNum")
public BaseResponse querySpecialNum(@RequestBody QuestionQueryDto queryDto) {
log.info("查询各专项分类题目数量======>queryDto:{}", queryDto);
return BaseResponse.success(tdQuestionService.querySpecialNum(queryDto));
}
} }

View File

@ -103,6 +103,13 @@ public class QuestionQueryDto implements Serializable {
*/ */
@ApiModelProperty("是否v新规") @ApiModelProperty("是否v新规")
private Integer isNew; private Integer isNew;
/**
*
*/
@ApiModelProperty("是否是图片")
private Integer isImage;
/** /**
* *
*/ */

View File

@ -7,6 +7,7 @@ import com.jwl.driver.server.vo.QuestionVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* <p> * <p>
@ -33,4 +34,11 @@ public interface TdQuestionMapper extends BaseMapper<TdQuestion> {
List<QuestionVo> queryQuestionByRandom(@Param("queryDto") QuestionQueryDto queryDto); List<QuestionVo> queryQuestionByRandom(@Param("queryDto") QuestionQueryDto queryDto);
int updateQuestion(@Param("questionVo") QuestionVo questionVo); int updateQuestion(@Param("questionVo") QuestionVo questionVo);
/**
*
* @param queryDto
* @return
*/
Map<String, Integer> querySpecialNum(@Param("queryDto") QuestionQueryDto queryDto);
} }

View File

@ -7,6 +7,7 @@ import com.jwl.driver.server.vo.QuestionVo;
import com.jwl.driver.server.vo.QusetionCategoryVo; import com.jwl.driver.server.vo.QusetionCategoryVo;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* <p> * <p>
@ -60,4 +61,11 @@ public interface ITdQuestionService extends IService<TdQuestion> {
* @return * @return
*/ */
int updateQuestion(QuestionVo questionVo); int updateQuestion(QuestionVo questionVo);
/**
*
* @param queryDto
* @return
*/
Map<String,Integer> querySpecialNum(QuestionQueryDto queryDto);
} }

View File

@ -137,6 +137,11 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
return this.getBaseMapper().updateQuestion(questionVo); return this.getBaseMapper().updateQuestion(questionVo);
} }
@Override
public Map<String, Integer> querySpecialNum(QuestionQueryDto queryDto) {
return this.getBaseMapper().querySpecialNum(queryDto);
}
/** /**
* *
*/ */

View File

@ -12,7 +12,6 @@ spring:
timeout: 5000 timeout: 5000
password: 123456 password: 123456
# 数据库 配置 # 数据库 配置
datasource: datasource:
url: jdbc:mysql://127.0.0.1:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai url: jdbc:mysql://127.0.0.1:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai

View File

@ -9,6 +9,6 @@ spring:
# 数据库 配置 # 数据库 配置
datasource: datasource:
url: jdbc:mysql://127.0.0.1:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai url: jdbc:mysql://114.55.169.15:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai
username: root username: root
password: admin231280 password: Zhou202109

View File

@ -7,7 +7,7 @@ spring:
application: application:
name: '@artifactId@' name: '@artifactId@'
profiles: profiles:
active: test active: prod
#mybatis #mybatis
mybatis-plus: mybatis-plus:
mapper-locations: classpath*:/mapper/**Mapper.xml mapper-locations: classpath*:/mapper/**Mapper.xml

View File

@ -68,6 +68,9 @@
<if test="queryDto.isNew !=null"> <if test="queryDto.isNew !=null">
and tq.IS_NEW = #{queryDto.isNew} and tq.IS_NEW = #{queryDto.isNew}
</if> </if>
<if test="queryDto.isImage !=null">
and tq.IMAGE_URL is not null
</if>
<if test="queryDto.examKey !=null and queryDto.examKey != ''"> <if test="queryDto.examKey !=null and queryDto.examKey != ''">
and find_in_set(#{queryDto.examKey},tq.EXAM_KEYS) and find_in_set(#{queryDto.examKey},tq.EXAM_KEYS)
</if> </if>
@ -172,5 +175,18 @@
where QUESTION_ID = #{questionVo.questionId} where QUESTION_ID = #{questionVo.questionId}
</update> </update>
<select id="querySpecialNum" resultType="java.util.Map">
select count(IF(IS_NEW = '1', IS_NEW, NULL)) as newQuestionNum,
count(IF(IS_ERROR = '1', IS_ERROR, NULL)) as errorQuestionNum,
count(IF(TYPE = '1', TYPE, NULL)) as judgeQuestionNum,
count(IF(TYPE = '2', TYPE, NULL)) as radioQuestionNum,
count(IF(TYPE = '3', TYPE, NULL)) as multipleChoiceQuestionNum,
count(IFNULL(IMAGE_URL, NULL)) as imageQuestionNum
from td_question
where CAR_TYPE_ID = #{queryDto.carTypeId}
and SUBJECT = #{queryDto.subject}
and IS_ACTIVE = '0'
</select>
</mapper> </mapper>