Commit ce82bcd4 authored by 耿迪迪's avatar 耿迪迪

考试接口 gengdidi

parent e2d335e7
......@@ -137,4 +137,14 @@ public class TTrainCourseController extends BaseController
tTrainCourse.setIsDel(1);
return toAjax(tTrainCourseService.updateTTrainCourse(tTrainCourse));
}
/**
* 考试发布
* @param tTrainCourse
* @return
*/
@PostMapping(value = "testPublish")
public AjaxResult testPublish(@RequestBody TTrainCourse tTrainCourse){
return toAjax(tTrainCourseService.testPublish(tTrainCourse));
}
}
package com.zehong.system.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
......@@ -67,13 +69,23 @@ public class TTrainCourse extends BaseEntity
@Excel(name = "0未删除 1已删除")
private Integer isDel;
public String getPlanName() {
return planName;
}
/** 数据类型:0 培训,1 考试 */
@Excel(name = "数据类型:0 培训,1 考试")
private String dataKind;
public void setPlanName(String planName) {
this.planName = planName;
}
/** 考试开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "考试开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date testStartTime;
/** 考试结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "考试结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date testEndTime;
/** 考试人员 */
@Excel(name = "考试人员")
private String testPersons;
public void setCourseId(Long courseId)
{
......@@ -183,6 +195,42 @@ public class TTrainCourse extends BaseEntity
{
return isDel;
}
public void setDataKind(String dataKind)
{
this.dataKind = dataKind;
}
public String getDataKind()
{
return dataKind;
}
public void setTestStartTime(Date testStartTime)
{
this.testStartTime = testStartTime;
}
public Date getTestStartTime()
{
return testStartTime;
}
public void setTestEndTime(Date testEndTime)
{
this.testEndTime = testEndTime;
}
public Date getTestEndTime()
{
return testEndTime;
}
public void setTestPersons(String testPersons)
{
this.testPersons = testPersons;
}
public String getTestPersons()
{
return testPersons;
}
@Override
public String toString() {
......@@ -200,6 +248,10 @@ public class TTrainCourse extends BaseEntity
.append("createTime", getCreateTime())
.append("createUser", getCreateUser())
.append("isDel", getIsDel())
.append("dataKind", getDataKind())
.append("testStartTime", getTestStartTime())
.append("testEndTime", getTestEndTime())
.append("testPersons", getTestPersons())
.toString();
}
}
......@@ -79,5 +79,12 @@ public interface ITTrainCourseService
* 考试
*/
public Map<String,Object> examination(Long userCourseId,String[] answers);
/**
* 考试发布
* @param tTrainCourse 考试实体
* @return int
*/
int testPublish( TTrainCourse tTrainCourse);
}
package com.zehong.system.service.impl;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.domain.TTrainCourseTopic;
import com.zehong.system.domain.TTrainPlan;
import com.zehong.system.domain.TTrainUserCourse;
import com.zehong.system.domain.vo.UserCourseVo;
import com.zehong.system.mapper.TTrainCourseMapper;
import com.zehong.system.mapper.TTrainCourseTopicMapper;
import com.zehong.system.mapper.TTrainPlanMapper;
import com.zehong.system.mapper.TTrainUserCourseMapper;
import com.zehong.system.service.ITTrainCourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TTrainCourseMapper;
import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.service.ITTrainCourseService;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
* 培训课程Service业务层处理
*
......@@ -173,4 +169,24 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
map.put("topicNum",list.size());
return map;
}
/**
* 考试发布
* @param tTrainCourse 考试实体
* @return int
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int testPublish( TTrainCourse tTrainCourse){
//查询考试人员信息
TTrainCourse course = tTrainCourseMapper.selectTTrainCourseById(tTrainCourse.getCourseId());
if(course==null){
return 0;
}
//新增考试人员
tTrainCourseMapper.insertUserCourse(tTrainCourse.getCourseId(),Arrays.asList(course.getTestPersons()));
tTrainCourse.setStatus(1);
tTrainCourse.setReleaseTime(new Date());
return tTrainCourseMapper.updateTTrainCourse(tTrainCourse);
}
}
......@@ -19,10 +19,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="createUser" column="create_user" />
<result property="isDel" column="is_del" />
<result property="dataKind" column="data_kind" />
<result property="testStartTime" column="test_start_time" />
<result property="testEndTime" column="test_end_time" />
<result property="testPersons" column="test_persons" />
</resultMap>
<sql id="selectTTrainCourseVo">
select course_id, course_name, course_type, course_conent, status,release_time, enclosure, video, qualified_num, topic_num, create_time, create_user, is_del from t_train_course
select course_id, course_name, course_type, course_conent, status, release_time, enclosure, video, qualified_num, topic_num, create_time, create_user, is_del, data_kind, test_start_time, test_end_time, test_persons from t_train_course
</sql>
<select id="selectTTrainCourseList" parameterType="TTrainCourse" resultMap="TTrainCourseResult">
......@@ -40,6 +44,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="topicNum != null "> and c.topic_num = #{topicNum}</if>
<if test="createUser != null and createUser != ''"> and c.create_user = #{createUser}</if>
<if test="isDel != null "> and c.is_del = #{isDel}</if>
<if test="dataKind != null and dataKind != ''"> and data_kind = #{dataKind}</if>
<if test="testStartTime != null "> and test_start_time = #{testStartTime}</if>
<if test="testEndTime != null "> and test_end_time = #{testEndTime}</if>
<if test="testPersons != null and testPersons != ''"> and test_persons = #{testPersons}</if>
</where>
</select>
......@@ -63,6 +71,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="createUser != null">create_user,</if>
<if test="isDel != null">is_del,</if>
<if test="dataKind != null">data_kind,</if>
<if test="testStartTime != null">test_start_time,</if>
<if test="testEndTime != null">test_end_time,</if>
<if test="testPersons != null">test_persons,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="courseName != null">#{courseName},</if>
......@@ -77,6 +89,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="createUser != null">#{createUser},</if>
<if test="isDel != null">#{isDel},</if>
<if test="dataKind != null">#{dataKind},</if>
<if test="testStartTime != null">#{testStartTime},</if>
<if test="testEndTime != null">#{testEndTime},</if>
<if test="testPersons != null">#{testPersons},</if>
</trim>
</insert>
......@@ -95,6 +111,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createUser != null">create_user = #{createUser},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="dataKind != null">data_kind = #{dataKind},</if>
<if test="testStartTime != null">test_start_time = #{testStartTime},</if>
<if test="testEndTime != null">test_end_time = #{testEndTime},</if>
<if test="testPersons != null">test_persons = #{testPersons},</if>
</trim>
where course_id = #{courseId}
</update>
......
......@@ -67,6 +67,15 @@ export function deleteLesson(query) {
})
}
//考试发布
export function testPublish(data) {
return request({
url: '/system/course/testPublish',
method: 'put',
data:data
})
}
......
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