Commit 17412d51 by 梅存智

Merge branch 'dev' into 'master'

考试优化

See merge request !1
parents 62968b19 041c96a1
...@@ -32,7 +32,7 @@ public class MyExamParameterVO { ...@@ -32,7 +32,7 @@ public class MyExamParameterVO {
"1:进行中(考试时间范围内,未参加,或有考试次数,或未审阅)" + "1:进行中(考试时间范围内,未参加,或有考试次数,或未审阅)" +
"2:已完成(考试时间内,不能再考,考试时间外已考过的所有考试) 默认是0"+ "2:已完成(考试时间内,不能再考,考试时间外已考过的所有考试) 默认是0"+
"3: 已逾期(考试时间外没有考过的所有考试)") "3: 已逾期(考试时间外没有考过的所有考试)")
private Integer state = 1; private Integer state = null;
@ApiModelProperty(value = "分页参数一页显示多少条 默认10条") @ApiModelProperty(value = "分页参数一页显示多少条 默认10条")
private Integer pageSize = 10; private Integer pageSize = 10;
......
...@@ -47,7 +47,7 @@ public class MyExamVO { ...@@ -47,7 +47,7 @@ public class MyExamVO {
//后端内部使用 //后端内部使用
private Integer maxState; private Integer maxState;
@ApiModelProperty(value = "操作: 0开始考试 1继续考试(无查看记录) 2继续考试(查看记录) 3重新考试(查看记录) 4(只有查看记录)") @ApiModelProperty(value = "操作: 0开始考试 1继续考试(无查看记录) 2继续考试(查看记录) 3重新考试(查看记录) 4(只有查看记录) 5待补考 6已完成 7已结束")
private Integer handle; private Integer handle;
@ApiModelProperty(value = "考试说明") @ApiModelProperty(value = "考试说明")
...@@ -61,4 +61,7 @@ public class MyExamVO { ...@@ -61,4 +61,7 @@ public class MyExamVO {
@ApiModelProperty(value = "培训项目名称") @ApiModelProperty(value = "培训项目名称")
private String trainingProjectName; private String trainingProjectName;
@ApiModelProperty(value = "考试logo图片")
private String logoImg;
} }
...@@ -16,10 +16,10 @@ import springfox.documentation.spring.web.plugins.Docket; ...@@ -16,10 +16,10 @@ import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration @Configuration
@EnableSwagger2 //@EnableSwagger2
public class SwaggerConfig extends WebMvcConfigurerAdapter { public class SwaggerConfig extends WebMvcConfigurerAdapter {
@Value("${swagger.enabled}") //@Value("${swagger.enabled}")
private boolean swaggerEnabled; private boolean swaggerEnabled;
@Bean @Bean
public Docket createRestApi() { public Docket createRestApi() {
......
...@@ -153,7 +153,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, com.yizhi.applicati ...@@ -153,7 +153,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, com.yizhi.applicati
Long siteId = myExamParameterVO.getSiteId(); Long siteId = myExamParameterVO.getSiteId();
Long accountId = myExamParameterVO.getAccountId(); Long accountId = myExamParameterVO.getAccountId();
List<MyExamVO> list = examMapper.selectMyExamInfo(strat, end, examIds, myExamParameterVO.getState(), accountId, siteId); List<MyExamVO> list = examMapper.selectMyExamInfo(strat, end, examIds, myExamParameterVO.getState(), accountId, siteId);
if (myExamParameterVO.getState() == 1) { if (myExamParameterVO.getState() != null && myExamParameterVO.getState() == 1) {
for (MyExamVO myExamVO : list) { for (MyExamVO myExamVO : list) {
List<ExamOnlineReadOverVo> examOnlineReadOverVos = trExamOnlineReadOverMapper.selectStateList(myExamVO.getId(), myExamParameterVO.getAccountId()); List<ExamOnlineReadOverVo> examOnlineReadOverVos = trExamOnlineReadOverMapper.selectStateList(myExamVO.getId(), myExamParameterVO.getAccountId());
if (examOnlineReadOverVos.size() > 0) { if (examOnlineReadOverVos.size() > 0) {
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<result column="qualifiedScore" property="qualifiedScore"></result> <result column="qualifiedScore" property="qualifiedScore"></result>
<result column="description" property="description"></result> <result column="description" property="description"></result>
<result column="isQualified" property="isQualified"></result> <result column="isQualified" property="isQualified"></result>
<result column="image" property="logoImg"></result>
</resultMap> </resultMap>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
...@@ -56,7 +57,7 @@ ...@@ -56,7 +57,7 @@
<select id="selectMyExamInfo" resultMap="myExamResult"> <select id="selectMyExamInfo" resultMap="myExamResult">
<if test="state == 0"> <if test="state == 0">
select a.name as name ,a.start_time as startTime,a.end_time as endTime,a.id as id, select a.name as name ,a.start_time as startTime,a.end_time as endTime,a.id as id,
a.training_project_id as trainingProjectId,a.description as description a.training_project_id as trainingProjectId,a.description as description,a.image
from exam a where 1=1 and a.site_id = #{siteId} from exam a where 1=1 and a.site_id = #{siteId}
<if test="ids!=null"> <if test="ids!=null">
AND a.id IN AND a.id IN
...@@ -150,6 +151,28 @@ ...@@ -150,6 +151,28 @@
#{accountId} ) and a.site_id = #{siteId})h #{accountId} ) and a.site_id = #{siteId})h
order by h.startTime desc limit #{start},#{end} order by h.startTime desc limit #{start},#{end}
</if> </if>
<if test="state == null">
select a.name as name ,a.start_time as startTime,a.end_time as endTime,a.id as id,
a.training_project_id as trainingProjectId,a.description as description,
(SELECT MAX(score) FROM tr_exam_answer b WHERE a.id=b.exam_id AND b.state=2) AS score,
CASE WHEN NOW() > a.end_time THEN 7 ELSE
(SELECT CASE WHEN IFNULL(MAX(score),-1)=-1 THEN 0 ELSE CASE WHEN MAX(score)>=a.qualified_score THEN 6 ELSE 5 END END AS score FROM tr_exam_answer b WHERE a.id=b.exam_id AND b.state=2)
END AS handle,a.image AS logoImg
from exam a where 1=1 and a.site_id = #{siteId}
<if test="ids!=null">
AND a.id IN
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="ids==null or ids.size()==0">
AND a.visible_range=1
</if>
AND a.state = 2
ORDER BY a.start_time desc,a.end_time desc
limit #{start},#{end}
</if>
</select> </select>
<select id="selectTotalInfo" resultType="java.lang.Integer"> <select id="selectTotalInfo" resultType="java.lang.Integer">
...@@ -243,6 +266,22 @@ ...@@ -243,6 +266,22 @@
)c) )c)
from dual from dual
</if> </if>
<if test="state == null">
select COUNT(*) from(
select a.id
from exam a where 1=1 and a.site_id = #{siteId}
<if test="ids!=null">
AND a.id IN
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="ids==null or ids.size()==0">
AND a.visible_range=1
</if>
and a.state = 2)x
</if>
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment