Commit 1982805d authored by zhangjianqian's avatar zhangjianqian

Merge remote-tracking branch 'origin/master'

parents 0c4f2337 da29a3f9
package com.zehong.web.controller.contractTrain;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TContractorTrainCourse;
import com.zehong.system.service.ITContractorTrainCourseService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 承包商及访客培训Controller
*
* @author zehong
* @date 2022-12-27
*/
@RestController
@RequestMapping("/contractTrain")
public class TContractorTrainCourseController extends BaseController
{
@Autowired
private ITContractorTrainCourseService tContractorTrainCourseService;
/**
* 查询承包商及访客培训列表
*/
//@PreAuthorize("@ss.hasPermi('system:course:list')")
@GetMapping("/list")
public TableDataInfo list(TContractorTrainCourse tContractorTrainCourse)
{
startPage();
List<TContractorTrainCourse> list = tContractorTrainCourseService.selectTContractorTrainCourseList(tContractorTrainCourse);
return getDataTable(list);
}
/**
* 导出承包商及访客培训列表
*/
//@PreAuthorize("@ss.hasPermi('system:course:export')")
@Log(title = "承包商及访客培训", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TContractorTrainCourse tContractorTrainCourse)
{
List<TContractorTrainCourse> list = tContractorTrainCourseService.selectTContractorTrainCourseList(tContractorTrainCourse);
ExcelUtil<TContractorTrainCourse> util = new ExcelUtil<TContractorTrainCourse>(TContractorTrainCourse.class);
return util.exportExcel(list, "承包商及访客培训数据");
}
/**
* 获取承包商及访客培训详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:course:query')")
@GetMapping(value = "/{contractorCourseId}")
public AjaxResult getInfo(@PathVariable("contractorCourseId") Long contractorCourseId)
{
return AjaxResult.success(tContractorTrainCourseService.selectTContractorTrainCourseById(contractorCourseId));
}
/**
* 新增承包商及访客培训
*/
//@PreAuthorize("@ss.hasPermi('system:course:add')")
@Log(title = "承包商及访客培训", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TContractorTrainCourse tContractorTrainCourse)
{
return toAjax(tContractorTrainCourseService.insertTContractorTrainCourse(tContractorTrainCourse));
}
/**
* 修改承包商及访客培训
*/
//@PreAuthorize("@ss.hasPermi('system:course:edit')")
@Log(title = "承包商及访客培训", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TContractorTrainCourse tContractorTrainCourse)
{
return toAjax(tContractorTrainCourseService.updateTContractorTrainCourse(tContractorTrainCourse));
}
/**
* 删除承包商及访客培训
*/
//@PreAuthorize("@ss.hasPermi('system:course:remove')")
@Log(title = "承包商及访客培训", businessType = BusinessType.DELETE)
@DeleteMapping("/{contractorCourseIds}")
public AjaxResult remove(@PathVariable Long[] contractorCourseIds)
{
return toAjax(tContractorTrainCourseService.deleteTContractorTrainCourseByIds(contractorCourseIds));
}
}
package com.zehong.web.controller.contractTrain;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TContractorTrainCourseTopic;
import com.zehong.system.service.ITContractorTrainCourseTopicService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 承包商及访客培训题库Controller
*
* @author zehong
* @date 2022-12-27
*/
@RestController
@RequestMapping("/contractTrainTopic")
public class TContractorTrainCourseTopicController extends BaseController
{
@Autowired
private ITContractorTrainCourseTopicService tContractorTrainCourseTopicService;
/**
* 查询承包商及访客培训题库列表
*/
//@PreAuthorize("@ss.hasPermi('system:topic:list')")
@GetMapping("/list")
public TableDataInfo list(TContractorTrainCourseTopic tContractorTrainCourseTopic)
{
startPage();
List<TContractorTrainCourseTopic> list = tContractorTrainCourseTopicService.selectTContractorTrainCourseTopicList(tContractorTrainCourseTopic);
return getDataTable(list);
}
/**
* 导出承包商及访客培训题库列表
*/
//@PreAuthorize("@ss.hasPermi('system:topic:export')")
@Log(title = "承包商及访客培训题库", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TContractorTrainCourseTopic tContractorTrainCourseTopic)
{
List<TContractorTrainCourseTopic> list = tContractorTrainCourseTopicService.selectTContractorTrainCourseTopicList(tContractorTrainCourseTopic);
ExcelUtil<TContractorTrainCourseTopic> util = new ExcelUtil<TContractorTrainCourseTopic>(TContractorTrainCourseTopic.class);
return util.exportExcel(list, "承包商及访客培训题库数据");
}
/**
* 获取承包商及访客培训题库详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:topic:query')")
@GetMapping(value = "/{topicId}")
public AjaxResult getInfo(@PathVariable("topicId") Long topicId)
{
return AjaxResult.success(tContractorTrainCourseTopicService.selectTContractorTrainCourseTopicById(topicId));
}
/**
* 新增承包商及访客培训题库
*/
//@PreAuthorize("@ss.hasPermi('system:topic:add')")
@Log(title = "承包商及访客培训题库", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TContractorTrainCourseTopic tContractorTrainCourseTopic)
{
return toAjax(tContractorTrainCourseTopicService.insertTContractorTrainCourseTopic(tContractorTrainCourseTopic));
}
/**
* 修改承包商及访客培训题库
*/
//@PreAuthorize("@ss.hasPermi('system:topic:edit')")
@Log(title = "承包商及访客培训题库", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TContractorTrainCourseTopic tContractorTrainCourseTopic)
{
return toAjax(tContractorTrainCourseTopicService.updateTContractorTrainCourseTopic(tContractorTrainCourseTopic));
}
/**
* 删除承包商及访客培训题库
*/
//@PreAuthorize("@ss.hasPermi('system:topic:remove')")
@Log(title = "承包商及访客培训题库", businessType = BusinessType.DELETE)
@DeleteMapping("/{topicIds}")
public AjaxResult remove(@PathVariable Long[] topicIds)
{
return toAjax(tContractorTrainCourseTopicService.deleteTContractorTrainCourseTopicByIds(topicIds));
}
}
package com.zehong.web.controller.system;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.exception.CustomException;
import com.zehong.common.utils.StringUtils;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.TBankSubject;
import com.zehong.system.service.ITBankSubjectService;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.xml.crypto.Data;
/**
* 题目Controller
......@@ -131,7 +140,7 @@ public class TBankSubjectController extends BaseController
int lastRowNum = sheet.getLastRowNum();
// 通过循环,逐行取出表中每行数据
for(int i=0;i<=lastRowNum;i++){//跳过第一行和第二行
if(i<=2){
if(i<=1){
continue;
}
// 获取行
......@@ -149,26 +158,28 @@ public class TBankSubjectController extends BaseController
/**选项*/
for (int s=1;s<=8;s++){
JSONObject jsonObject=new JSONObject();
jsonObject.put("value",row.getCell(s).toString());
jsonArray.add(jsonObject);
if (!StringUtils.isEmpty(row.getCell(s).toString())) {
jsonObject.put("value", row.getCell(s).toString());
jsonArray.add(jsonObject);
}
}
/**答案*/
if ("A".equals(row.getCell(9).toString())){
excelEntity.setAnswer(0);
}else if ("B".equals(row.getCell(9).toString())){
excelEntity.setAnswer(1);
}else if ("b".equals(row.getCell(9).toString())){
excelEntity.setAnswer(2);
}else if ("C".equals(row.getCell(9).toString())){
excelEntity.setAnswer(3);
excelEntity.setAnswer(2);
}else if ("D".equals(row.getCell(9).toString())){
excelEntity.setAnswer(4);
excelEntity.setAnswer(3);
}else if ("E".equals(row.getCell(9).toString())){
excelEntity.setAnswer(5);
excelEntity.setAnswer(4);
}else if ("F".equals(row.getCell(9).toString())){
excelEntity.setAnswer(6);
excelEntity.setAnswer(5);
}else if ("G".equals(row.getCell(9).toString())){
excelEntity.setAnswer(7);
excelEntity.setAnswer(6);
}else if ("H".equals(row.getCell(9).toString())){
excelEntity.setAnswer(8);
excelEntity.setAnswer(7);
}
excelEntity.setTopicOption(String.valueOf(jsonArray));
excelEntity.setDatetime(new Date());
......@@ -195,8 +206,10 @@ public class TBankSubjectController extends BaseController
{
successMsg.insert(0, "数据已全部导入成功!共 " + successNum + " 条");
}
/**数据添加方法*/
tBankSubjectService.insertBank(list);
if (list.size()!=0){
/**数据添加方法*/
tBankSubjectService.insertBank(list);
}
// String message = tBankSubjectService.importDevice(file, updateSupport);
return AjaxResult.success(successMsg.toString());
}
......
......@@ -2,6 +2,7 @@ package com.zehong.web.controller.train;
import java.util.List;
import com.zehong.system.domain.vo.BatchTopicVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
......@@ -122,4 +123,14 @@ public class TTrainCourseTopicController extends BaseController
{
return toAjax(tTrainCourseTopicService.deleteTTrainCourseTopicById(topicId));
}
/**
* 题库批量导入试题
* @param batchTopicVo 试题实体
* @return AjaxResult
*/
@PostMapping("/bachAddTopic")
public AjaxResult bachAddTopic(@RequestBody BatchTopicVo batchTopicVo){
return toAjax(tTrainCourseTopicService.bachAddTopic(batchTopicVo));
}
}
package com.zehong.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 承包商及访客培训对象 t_contractor_train_course
*
* @author zehong
* @date 2022-12-27
*/
public class TContractorTrainCourse extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 培训id */
private Long contractorCourseId;
/** 培训名称 */
@Excel(name = "培训名称")
private String courseName;
/** 培训内容 */
@Excel(name = "培训内容")
private String courseConent;
/** 培训附件 */
@Excel(name = "培训附件")
private String enclosure;
/** 培训视频 */
@Excel(name = "培训视频")
private String video;
/** 答题合格数 */
@Excel(name = "答题合格数")
private Integer qualifiedNum;
/** 录入题数量 */
@Excel(name = "录入题数量")
private Integer topicNum;
/** 创建人 */
@Excel(name = "创建人")
private String createUser;
/** 是否删除(0正常,1删除) */
@Excel(name = "是否删除(0正常,1删除)")
private String isDel;
public void setContractorCourseId(Long contractorCourseId)
{
this.contractorCourseId = contractorCourseId;
}
public Long getContractorCourseId()
{
return contractorCourseId;
}
public void setCourseName(String courseName)
{
this.courseName = courseName;
}
public String getCourseName()
{
return courseName;
}
public void setCourseConent(String courseConent)
{
this.courseConent = courseConent;
}
public String getCourseConent()
{
return courseConent;
}
public void setEnclosure(String enclosure)
{
this.enclosure = enclosure;
}
public String getEnclosure()
{
return enclosure;
}
public void setVideo(String video)
{
this.video = video;
}
public String getVideo()
{
return video;
}
public void setQualifiedNum(Integer qualifiedNum)
{
this.qualifiedNum = qualifiedNum;
}
public Integer getQualifiedNum()
{
return qualifiedNum;
}
public void setTopicNum(Integer topicNum)
{
this.topicNum = topicNum;
}
public Integer getTopicNum()
{
return topicNum;
}
public void setCreateUser(String createUser)
{
this.createUser = createUser;
}
public String getCreateUser()
{
return createUser;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
{
return isDel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("contractorCourseId", getContractorCourseId())
.append("courseName", getCourseName())
.append("courseConent", getCourseConent())
.append("enclosure", getEnclosure())
.append("video", getVideo())
.append("qualifiedNum", getQualifiedNum())
.append("topicNum", getTopicNum())
.append("createTime", getCreateTime())
.append("createUser", getCreateUser())
.append("isDel", getIsDel())
.append("remark", getRemark())
.toString();
}
}
package com.zehong.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 承包商及访客培训题库对象 t_contractor_train_course_topic
*
* @author zehong
* @date 2022-12-27
*/
public class TContractorTrainCourseTopic extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 题目id */
private Long topicId;
/** 所属培训id */
@Excel(name = "所属培训id")
private Long contractorCourseId;
/** 题目内容 */
@Excel(name = "题目内容")
private String topicTitle;
/** 题目选项(json) */
@Excel(name = "题目选项", readConverterExp = "j=son")
private String topicOption;
/** 答案 */
@Excel(name = "答案")
private Integer answer;
/** 是否删除(0正常,1删除) */
@Excel(name = "是否删除(0正常,1删除)")
private String isDel;
public void setTopicId(Long topicId)
{
this.topicId = topicId;
}
public Long getTopicId()
{
return topicId;
}
public void setContractorCourseId(Long contractorCourseId)
{
this.contractorCourseId = contractorCourseId;
}
public Long getContractorCourseId()
{
return contractorCourseId;
}
public void setTopicTitle(String topicTitle)
{
this.topicTitle = topicTitle;
}
public String getTopicTitle()
{
return topicTitle;
}
public void setTopicOption(String topicOption)
{
this.topicOption = topicOption;
}
public String getTopicOption()
{
return topicOption;
}
public void setAnswer(Integer answer)
{
this.answer = answer;
}
public Integer getAnswer()
{
return answer;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
{
return isDel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("topicId", getTopicId())
.append("contractorCourseId", getContractorCourseId())
.append("topicTitle", getTopicTitle())
.append("topicOption", getTopicOption())
.append("answer", getAnswer())
.append("createTime", getCreateTime())
.append("isDel", getIsDel())
.append("remark", getRemark())
.toString();
}
}
package com.zehong.system.domain.vo;
import java.util.List;
/**
* @author geng
* 批量导入试题
*/
public class BatchTopicVo {
/**
* 所属考试id
*/
private Long courseId;
private List<TopicInfos> topicInfos;
public Long getCourseId() {
return courseId;
}
public void setCourseId(Long courseId) {
this.courseId = courseId;
}
public List<TopicInfos> getTopicInfos() {
return topicInfos;
}
public void setTopicInfos(List<TopicInfos> topicInfos) {
this.topicInfos = topicInfos;
}
/**
* @author geng
* 题库批量导入试题实体
*/
public static class TopicInfos{
/**
* 题库id
*/
private Long bankId;
/**
* 随机抽取题数量
*/
private int quan;
public Long getBankId() {
return bankId;
}
public void setBankId(Long bankId) {
this.bankId = bankId;
}
public int getQuan() {
return quan;
}
public void setQuan(int quan) {
this.quan = quan;
}
}
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TContractorTrainCourse;
/**
* 承包商及访客培训Mapper接口
*
* @author zehong
* @date 2022-12-27
*/
public interface TContractorTrainCourseMapper
{
/**
* 查询承包商及访客培训
*
* @param contractorCourseId 承包商及访客培训ID
* @return 承包商及访客培训
*/
public TContractorTrainCourse selectTContractorTrainCourseById(Long contractorCourseId);
/**
* 查询承包商及访客培训列表
*
* @param tContractorTrainCourse 承包商及访客培训
* @return 承包商及访客培训集合
*/
public List<TContractorTrainCourse> selectTContractorTrainCourseList(TContractorTrainCourse tContractorTrainCourse);
/**
* 新增承包商及访客培训
*
* @param tContractorTrainCourse 承包商及访客培训
* @return 结果
*/
public int insertTContractorTrainCourse(TContractorTrainCourse tContractorTrainCourse);
/**
* 修改承包商及访客培训
*
* @param tContractorTrainCourse 承包商及访客培训
* @return 结果
*/
public int updateTContractorTrainCourse(TContractorTrainCourse tContractorTrainCourse);
/**
* 删除承包商及访客培训
*
* @param contractorCourseId 承包商及访客培训ID
* @return 结果
*/
public int deleteTContractorTrainCourseById(Long contractorCourseId);
/**
* 批量删除承包商及访客培训
*
* @param contractorCourseIds 需要删除的数据ID
* @return 结果
*/
public int deleteTContractorTrainCourseByIds(Long[] contractorCourseIds);
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TContractorTrainCourseTopic;
/**
* 承包商及访客培训题库Mapper接口
*
* @author zehong
* @date 2022-12-27
*/
public interface TContractorTrainCourseTopicMapper
{
/**
* 查询承包商及访客培训题库
*
* @param topicId 承包商及访客培训题库ID
* @return 承包商及访客培训题库
*/
public TContractorTrainCourseTopic selectTContractorTrainCourseTopicById(Long topicId);
/**
* 查询承包商及访客培训题库列表
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 承包商及访客培训题库集合
*/
public List<TContractorTrainCourseTopic> selectTContractorTrainCourseTopicList(TContractorTrainCourseTopic tContractorTrainCourseTopic);
/**
* 新增承包商及访客培训题库
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 结果
*/
public int insertTContractorTrainCourseTopic(TContractorTrainCourseTopic tContractorTrainCourseTopic);
/**
* 修改承包商及访客培训题库
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 结果
*/
public int updateTContractorTrainCourseTopic(TContractorTrainCourseTopic tContractorTrainCourseTopic);
/**
* 删除承包商及访客培训题库
*
* @param topicId 承包商及访客培训题库ID
* @return 结果
*/
public int deleteTContractorTrainCourseTopicById(Long topicId);
/**
* 批量删除承包商及访客培训题库
*
* @param topicIds 需要删除的数据ID
* @return 结果
*/
public int deleteTContractorTrainCourseTopicByIds(Long[] topicIds);
}
......@@ -60,4 +60,11 @@ public interface TTrainCourseTopicMapper
* @return 结果
*/
public int deleteTTrainCourseTopicByIds(Long[] topicIds);
/**
* 批量新增
* @param topics 试题试题
* @return
*/
int batchInsertTTrainCourseTopic(List<TTrainCourseTopic> topics);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TContractorTrainCourse;
/**
* 承包商及访客培训Service接口
*
* @author zehong
* @date 2022-12-27
*/
public interface ITContractorTrainCourseService
{
/**
* 查询承包商及访客培训
*
* @param contractorCourseId 承包商及访客培训ID
* @return 承包商及访客培训
*/
public TContractorTrainCourse selectTContractorTrainCourseById(Long contractorCourseId);
/**
* 查询承包商及访客培训列表
*
* @param tContractorTrainCourse 承包商及访客培训
* @return 承包商及访客培训集合
*/
public List<TContractorTrainCourse> selectTContractorTrainCourseList(TContractorTrainCourse tContractorTrainCourse);
/**
* 新增承包商及访客培训
*
* @param tContractorTrainCourse 承包商及访客培训
* @return 结果
*/
public int insertTContractorTrainCourse(TContractorTrainCourse tContractorTrainCourse);
/**
* 修改承包商及访客培训
*
* @param tContractorTrainCourse 承包商及访客培训
* @return 结果
*/
public int updateTContractorTrainCourse(TContractorTrainCourse tContractorTrainCourse);
/**
* 批量删除承包商及访客培训
*
* @param contractorCourseIds 需要删除的承包商及访客培训ID
* @return 结果
*/
public int deleteTContractorTrainCourseByIds(Long[] contractorCourseIds);
/**
* 删除承包商及访客培训信息
*
* @param contractorCourseId 承包商及访客培训ID
* @return 结果
*/
public int deleteTContractorTrainCourseById(Long contractorCourseId);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TContractorTrainCourseTopic;
/**
* 承包商及访客培训题库Service接口
*
* @author zehong
* @date 2022-12-27
*/
public interface ITContractorTrainCourseTopicService
{
/**
* 查询承包商及访客培训题库
*
* @param topicId 承包商及访客培训题库ID
* @return 承包商及访客培训题库
*/
public TContractorTrainCourseTopic selectTContractorTrainCourseTopicById(Long topicId);
/**
* 查询承包商及访客培训题库列表
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 承包商及访客培训题库集合
*/
public List<TContractorTrainCourseTopic> selectTContractorTrainCourseTopicList(TContractorTrainCourseTopic tContractorTrainCourseTopic);
/**
* 新增承包商及访客培训题库
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 结果
*/
public int insertTContractorTrainCourseTopic(TContractorTrainCourseTopic tContractorTrainCourseTopic);
/**
* 修改承包商及访客培训题库
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 结果
*/
public int updateTContractorTrainCourseTopic(TContractorTrainCourseTopic tContractorTrainCourseTopic);
/**
* 批量删除承包商及访客培训题库
*
* @param topicIds 需要删除的承包商及访客培训题库ID
* @return 结果
*/
public int deleteTContractorTrainCourseTopicByIds(Long[] topicIds);
/**
* 删除承包商及访客培训题库信息
*
* @param topicId 承包商及访客培训题库ID
* @return 结果
*/
public int deleteTContractorTrainCourseTopicById(Long topicId);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TTrainCourseTopic;
import com.zehong.system.domain.vo.BatchTopicVo;
import java.util.List;
/**
* 培训课程题库Service接口
......@@ -59,4 +61,11 @@ public interface ITTrainCourseTopicService
* @return 结果
*/
public int deleteTTrainCourseTopicById(Long topicId);
/**
* 题库批量导入试题
* @param batchTopicVo 试题实体
* @return int
*/
int bachAddTopic(BatchTopicVo batchTopicVo);
}
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TContractorTrainCourseMapper;
import com.zehong.system.domain.TContractorTrainCourse;
import com.zehong.system.service.ITContractorTrainCourseService;
/**
* 承包商及访客培训Service业务层处理
*
* @author zehong
* @date 2022-12-27
*/
@Service
public class TContractorTrainCourseServiceImpl implements ITContractorTrainCourseService
{
@Autowired
private TContractorTrainCourseMapper tContractorTrainCourseMapper;
/**
* 查询承包商及访客培训
*
* @param contractorCourseId 承包商及访客培训ID
* @return 承包商及访客培训
*/
@Override
public TContractorTrainCourse selectTContractorTrainCourseById(Long contractorCourseId)
{
return tContractorTrainCourseMapper.selectTContractorTrainCourseById(contractorCourseId);
}
/**
* 查询承包商及访客培训列表
*
* @param tContractorTrainCourse 承包商及访客培训
* @return 承包商及访客培训
*/
@Override
public List<TContractorTrainCourse> selectTContractorTrainCourseList(TContractorTrainCourse tContractorTrainCourse)
{
return tContractorTrainCourseMapper.selectTContractorTrainCourseList(tContractorTrainCourse);
}
/**
* 新增承包商及访客培训
*
* @param tContractorTrainCourse 承包商及访客培训
* @return 结果
*/
@Override
public int insertTContractorTrainCourse(TContractorTrainCourse tContractorTrainCourse)
{
tContractorTrainCourse.setCreateTime(DateUtils.getNowDate());
return tContractorTrainCourseMapper.insertTContractorTrainCourse(tContractorTrainCourse);
}
/**
* 修改承包商及访客培训
*
* @param tContractorTrainCourse 承包商及访客培训
* @return 结果
*/
@Override
public int updateTContractorTrainCourse(TContractorTrainCourse tContractorTrainCourse)
{
return tContractorTrainCourseMapper.updateTContractorTrainCourse(tContractorTrainCourse);
}
/**
* 批量删除承包商及访客培训
*
* @param contractorCourseIds 需要删除的承包商及访客培训ID
* @return 结果
*/
@Override
public int deleteTContractorTrainCourseByIds(Long[] contractorCourseIds)
{
return tContractorTrainCourseMapper.deleteTContractorTrainCourseByIds(contractorCourseIds);
}
/**
* 删除承包商及访客培训信息
*
* @param contractorCourseId 承包商及访客培训ID
* @return 结果
*/
@Override
public int deleteTContractorTrainCourseById(Long contractorCourseId)
{
return tContractorTrainCourseMapper.deleteTContractorTrainCourseById(contractorCourseId);
}
}
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TContractorTrainCourseTopicMapper;
import com.zehong.system.domain.TContractorTrainCourseTopic;
import com.zehong.system.service.ITContractorTrainCourseTopicService;
/**
* 承包商及访客培训题库Service业务层处理
*
* @author zehong
* @date 2022-12-27
*/
@Service
public class TContractorTrainCourseTopicServiceImpl implements ITContractorTrainCourseTopicService
{
@Autowired
private TContractorTrainCourseTopicMapper tContractorTrainCourseTopicMapper;
/**
* 查询承包商及访客培训题库
*
* @param topicId 承包商及访客培训题库ID
* @return 承包商及访客培训题库
*/
@Override
public TContractorTrainCourseTopic selectTContractorTrainCourseTopicById(Long topicId)
{
return tContractorTrainCourseTopicMapper.selectTContractorTrainCourseTopicById(topicId);
}
/**
* 查询承包商及访客培训题库列表
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 承包商及访客培训题库
*/
@Override
public List<TContractorTrainCourseTopic> selectTContractorTrainCourseTopicList(TContractorTrainCourseTopic tContractorTrainCourseTopic)
{
return tContractorTrainCourseTopicMapper.selectTContractorTrainCourseTopicList(tContractorTrainCourseTopic);
}
/**
* 新增承包商及访客培训题库
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 结果
*/
@Override
public int insertTContractorTrainCourseTopic(TContractorTrainCourseTopic tContractorTrainCourseTopic)
{
tContractorTrainCourseTopic.setCreateTime(DateUtils.getNowDate());
return tContractorTrainCourseTopicMapper.insertTContractorTrainCourseTopic(tContractorTrainCourseTopic);
}
/**
* 修改承包商及访客培训题库
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 结果
*/
@Override
public int updateTContractorTrainCourseTopic(TContractorTrainCourseTopic tContractorTrainCourseTopic)
{
return tContractorTrainCourseTopicMapper.updateTContractorTrainCourseTopic(tContractorTrainCourseTopic);
}
/**
* 批量删除承包商及访客培训题库
*
* @param topicIds 需要删除的承包商及访客培训题库ID
* @return 结果
*/
@Override
public int deleteTContractorTrainCourseTopicByIds(Long[] topicIds)
{
return tContractorTrainCourseTopicMapper.deleteTContractorTrainCourseTopicByIds(topicIds);
}
/**
* 删除承包商及访客培训题库信息
*
* @param topicId 承包商及访客培训题库ID
* @return 结果
*/
@Override
public int deleteTContractorTrainCourseTopicById(Long topicId)
{
return tContractorTrainCourseTopicMapper.deleteTContractorTrainCourseTopicById(topicId);
}
}
package com.zehong.system.service.impl;
import java.util.List;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.TBankSubject;
import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.domain.TTrainCourseTopic;
import com.zehong.system.domain.vo.BatchTopicVo;
import com.zehong.system.mapper.TBankSubjectMapper;
import com.zehong.system.mapper.TTrainCourseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TTrainCourseTopicMapper;
import com.zehong.system.domain.TTrainCourseTopic;
import com.zehong.system.service.ITTrainCourseTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
* 培训课程题库Service业务层处理
*
......@@ -24,6 +35,8 @@ public class TTrainCourseTopicServiceImpl implements ITTrainCourseTopicService
private TTrainCourseTopicMapper tTrainCourseTopicMapper;
@Autowired
private TTrainCourseMapper tTrainCourseMapper;
@Resource
private TBankSubjectMapper tBankSubjectMapper;
/**
* 查询培训课程题库
......@@ -118,4 +131,37 @@ public class TTrainCourseTopicServiceImpl implements ITTrainCourseTopicService
}
return tTrainCourseTopicMapper.deleteTTrainCourseTopicById(topicId);
}
/**
* 题库批量导入试题
* @param batchTopicVo 试题实体
* @return int
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int bachAddTopic(BatchTopicVo batchTopicVo){
if(CollectionUtil.isEmpty(batchTopicVo.getTopicInfos()) || StringUtils.isEmpty(String.valueOf(batchTopicVo.getCourseId()))){
return 0;
}
List<TTrainCourseTopic> topics = new ArrayList<>();
for(BatchTopicVo.TopicInfos topic : batchTopicVo.getTopicInfos()){
//获取题库试题
TBankSubject tBankSubject = new TBankSubject();
tBankSubject.setBankId(topic.getBankId());
List<TBankSubject> bankSubjects = tBankSubjectMapper.selectTBankSubjectList(tBankSubject);
//获取随机试题
Collections.shuffle(bankSubjects);
for(int i = 0;i<topic.getQuan();i++){
TTrainCourseTopic courseTopic = new TTrainCourseTopic();
courseTopic.setCourseId(batchTopicVo.getCourseId());
courseTopic.setTopicTitle(bankSubjects.get(i).getTopicTitle());
courseTopic.setTopicOption(bankSubjects.get(i).getTopicOption());
courseTopic.setAnswer(bankSubjects.get(i).getAnswer());
courseTopic.setCreateTime(new Date());
topics.add(courseTopic);
}
}
//批量新增试题
return tTrainCourseTopicMapper.batchInsertTTrainCourseTopic(topics);
}
}
<?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.zehong.system.mapper.TContractorTrainCourseMapper">
<resultMap type="TContractorTrainCourse" id="TContractorTrainCourseResult">
<result property="contractorCourseId" column="contractor_course_id" />
<result property="courseName" column="course_name" />
<result property="courseConent" column="course_conent" />
<result property="enclosure" column="enclosure" />
<result property="video" column="video" />
<result property="qualifiedNum" column="qualified_num" />
<result property="topicNum" column="topic_num" />
<result property="createTime" column="create_time" />
<result property="createUser" column="create_user" />
<result property="isDel" column="is_del" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectTContractorTrainCourseVo">
select contractor_course_id, course_name, course_conent, enclosure, video, qualified_num, topic_num, create_time, create_user, is_del, remark from t_contractor_train_course
</sql>
<select id="selectTContractorTrainCourseList" parameterType="TContractorTrainCourse" resultMap="TContractorTrainCourseResult">
<include refid="selectTContractorTrainCourseVo"/>
<where>
<if test="courseName != null and courseName != ''"> and course_name like concat('%', #{courseName}, '%')</if>
<if test="courseConent != null and courseConent != ''"> and course_conent = #{courseConent}</if>
<if test="enclosure != null and enclosure != ''"> and enclosure = #{enclosure}</if>
<if test="video != null and video != ''"> and video = #{video}</if>
<if test="qualifiedNum != null "> and qualified_num = #{qualifiedNum}</if>
<if test="topicNum != null "> and topic_num = #{topicNum}</if>
<if test="createUser != null and createUser != ''"> and create_user = #{createUser}</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
</where>
</select>
<select id="selectTContractorTrainCourseById" parameterType="Long" resultMap="TContractorTrainCourseResult">
<include refid="selectTContractorTrainCourseVo"/>
where contractor_course_id = #{contractorCourseId}
</select>
<insert id="insertTContractorTrainCourse" parameterType="TContractorTrainCourse" useGeneratedKeys="true" keyProperty="contractorCourseId">
insert into t_contractor_train_course
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="courseName != null">course_name,</if>
<if test="courseConent != null">course_conent,</if>
<if test="enclosure != null">enclosure,</if>
<if test="video != null">video,</if>
<if test="qualifiedNum != null">qualified_num,</if>
<if test="topicNum != null">topic_num,</if>
<if test="createTime != null">create_time,</if>
<if test="createUser != null">create_user,</if>
<if test="isDel != null">is_del,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="courseName != null">#{courseName},</if>
<if test="courseConent != null">#{courseConent},</if>
<if test="enclosure != null">#{enclosure},</if>
<if test="video != null">#{video},</if>
<if test="qualifiedNum != null">#{qualifiedNum},</if>
<if test="topicNum != null">#{topicNum},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createUser != null">#{createUser},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateTContractorTrainCourse" parameterType="TContractorTrainCourse">
update t_contractor_train_course
<trim prefix="SET" suffixOverrides=",">
<if test="courseName != null">course_name = #{courseName},</if>
<if test="courseConent != null">course_conent = #{courseConent},</if>
<if test="enclosure != null">enclosure = #{enclosure},</if>
<if test="video != null">video = #{video},</if>
<if test="qualifiedNum != null">qualified_num = #{qualifiedNum},</if>
<if test="topicNum != null">topic_num = #{topicNum},</if>
<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="remark != null">remark = #{remark},</if>
</trim>
where contractor_course_id = #{contractorCourseId}
</update>
<delete id="deleteTContractorTrainCourseById" parameterType="Long">
delete from t_contractor_train_course where contractor_course_id = #{contractorCourseId}
</delete>
<delete id="deleteTContractorTrainCourseByIds" parameterType="String">
delete from t_contractor_train_course where contractor_course_id in
<foreach item="contractorCourseId" collection="array" open="(" separator="," close=")">
#{contractorCourseId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?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.zehong.system.mapper.TContractorTrainCourseTopicMapper">
<resultMap type="TContractorTrainCourseTopic" id="TContractorTrainCourseTopicResult">
<result property="topicId" column="topic_id" />
<result property="contractorCourseId" column="contractor_course_id" />
<result property="topicTitle" column="topic_title" />
<result property="topicOption" column="topic_option" />
<result property="answer" column="answer" />
<result property="createTime" column="create_time" />
<result property="isDel" column="is_del" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectTContractorTrainCourseTopicVo">
select topic_id, contractor_course_id, topic_title, topic_option, answer, create_time, is_del, remark from t_contractor_train_course_topic
</sql>
<select id="selectTContractorTrainCourseTopicList" parameterType="TContractorTrainCourseTopic" resultMap="TContractorTrainCourseTopicResult">
<include refid="selectTContractorTrainCourseTopicVo"/>
<where>
<if test="contractorCourseId != null "> and contractor_course_id = #{contractorCourseId}</if>
<if test="topicTitle != null and topicTitle != ''"> and topic_title = #{topicTitle}</if>
<if test="topicOption != null and topicOption != ''"> and topic_option = #{topicOption}</if>
<if test="answer != null "> and answer = #{answer}</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
</where>
</select>
<select id="selectTContractorTrainCourseTopicById" parameterType="Long" resultMap="TContractorTrainCourseTopicResult">
<include refid="selectTContractorTrainCourseTopicVo"/>
where topic_id = #{topicId}
</select>
<insert id="insertTContractorTrainCourseTopic" parameterType="TContractorTrainCourseTopic" useGeneratedKeys="true" keyProperty="topicId">
insert into t_contractor_train_course_topic
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="contractorCourseId != null">contractor_course_id,</if>
<if test="topicTitle != null">topic_title,</if>
<if test="topicOption != null">topic_option,</if>
<if test="answer != null">answer,</if>
<if test="createTime != null">create_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="contractorCourseId != null">#{contractorCourseId},</if>
<if test="topicTitle != null">#{topicTitle},</if>
<if test="topicOption != null">#{topicOption},</if>
<if test="answer != null">#{answer},</if>
<if test="createTime != null">#{createTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateTContractorTrainCourseTopic" parameterType="TContractorTrainCourseTopic">
update t_contractor_train_course_topic
<trim prefix="SET" suffixOverrides=",">
<if test="contractorCourseId != null">contractor_course_id = #{contractorCourseId},</if>
<if test="topicTitle != null">topic_title = #{topicTitle},</if>
<if test="topicOption != null">topic_option = #{topicOption},</if>
<if test="answer != null">answer = #{answer},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where topic_id = #{topicId}
</update>
<delete id="deleteTContractorTrainCourseTopicById" parameterType="Long">
delete from t_contractor_train_course_topic where topic_id = #{topicId}
</delete>
<delete id="deleteTContractorTrainCourseTopicByIds" parameterType="String">
delete from t_contractor_train_course_topic where topic_id in
<foreach item="topicId" collection="array" open="(" separator="," close=")">
#{topicId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -77,4 +77,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{topicId}
</foreach>
</delete>
<insert id="batchInsertTTrainCourseTopic" parameterType="java.util.List">
insert into t_train_course_topic(course_id,topic_title,topic_option,answer,create_time) values
<foreach collection="list" item="topic" index="index" separator="," >
(#{topic.courseId},#{topic.topicTitle},#{topic.topicOption},#{topic.answer},#{topic.createTime})
</foreach>
</insert>
</mapper>
\ No newline at end of file
import request from '@/utils/request'
// 查询承包商及访客培训列表
export function listCourse(query) {
return request({
url: '/contractTrain/list',
method: 'get',
params: query
})
}
// 查询承包商及访客培训详细
export function getCourse(contractorCourseId) {
return request({
url: '/contractTrain/' + contractorCourseId,
method: 'get'
})
}
// 新增承包商及访客培训
export function addCourse(data) {
return request({
url: '/contractTrain',
method: 'post',
data: data
})
}
// 修改承包商及访客培训
export function updateCourse(data) {
return request({
url: '/contractTrain',
method: 'put',
data: data
})
}
// 删除承包商及访客培训
export function delCourse(contractorCourseId) {
return request({
url: '/contractTrain/' + contractorCourseId,
method: 'delete'
})
}
// 导出承包商及访客培训
export function exportCourse(query) {
return request({
url: '/contractTrain/export',
method: 'get',
params: query
})
}
import request from '@/utils/request'
// 查询承包商及访客培训题库列表
export function listTopic(query) {
return request({
url: '/contractTrainTopic/list',
method: 'get',
params: query
})
}
// 查询承包商及访客培训题库详细
export function getTopic(topicId) {
return request({
url: '/contractTrainTopic/' + topicId,
method: 'get'
})
}
// 新增承包商及访客培训题库
export function addTopic(data) {
return request({
url: '/contractTrainTopic',
method: 'post',
data: data
})
}
// 修改承包商及访客培训题库
export function updateTopic(data) {
return request({
url: '/contractTrainTopic',
method: 'put',
data: data
})
}
// 删除承包商及访客培训题库
export function delTopic(topicId) {
return request({
url: '/contractTrainTopic/' + topicId,
method: 'delete'
})
}
// 导出承包商及访客培训题库
export function exportTopic(query) {
return request({
url: '/contractTrainTopic/export',
method: 'get',
params: query
})
}
......@@ -159,3 +159,15 @@ export function testPersonDetailByCourseId(query) {
})
}
/**
* 从题库导入试题
* @param data
*/
export function bachAddTopic(data) {
return request({
url: '/system/course/bachAddTopic',
method: 'post',
data: data
})
}
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-19 17:39:55
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-21 17:36:34
* @LastEditTime: 2022-12-24 16:12:47
* @FilePath: /danger-manage-web/src/views/educationPlanExam/textPaper/components/ChangePapel.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -30,7 +30,7 @@
<el-input
v-model="staffName"
size="mini"
placeholder="请输入内容"
placeholder="请输入姓名"
suffix-icon="el-icon-date"
style="width: 48%"
>
......@@ -108,8 +108,8 @@ export default {
if (Array.isArray(this.selectNameList)) {
json = this.selectNameList.map((item) => {
return {
staffId: item.staffId,
staffName: item.staffName,
peoPleId: item.staffId,
peoPleName: item.staffName,
};
});
} else {
......@@ -122,7 +122,12 @@ export default {
methods: {
changeNameList(jsonSelectNameList) {
if (jsonSelectNameList) {
this.selectNameList = JSON.parse(jsonSelectNameList);
this.selectNameList = JSON.parse(jsonSelectNameList).map((item) => {
return {
staffId: item.peoPleId,
staffName: item.peoPleName,
};
});
} else {
this.selectNameList = [];
}
......@@ -203,8 +208,8 @@ export default {
.middle {
align-items: center;
justify-content: center;
div{
color:#1890FF;
div {
color: #1890ff;
font-weight: 2000;
}
}
......
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-19 15:23:58
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-24 16:51:34
* @FilePath: /danger-manage-web/src/views/educationPlanExam/textPaper/components/Lesson-table.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div>
<el-table
v-loading="loading"
:data="nameList"
height="305"
@select="select"
@select-all="all"
ref="multipleTable"
>
<el-table-column type="selection"></el-table-column>
<el-table-column label="负责人" align="center" prop="staffName">
</el-table-column>
<el-table-column
label="手机号"
align="center"
prop="deptName"
:formatter="formatter"
>
</el-table-column>
<el-table-column
label="所属单位"
align="center"
prop="profession"
:formatter="formatter"
>
</el-table-column>
</el-table>
<!-- <div> -->
<el-pagination
:layout="'prev, pager, next'"
v-show="total > 0"
:total="total"
:current-page="queryParams.pageNum"
:page-sizes="[queryParams.pageSize]"
@current-change="currentChangeClick"
/>
<!-- </div> -->
</div>
</template>
<script>
import { listStaff } from "@/api/safetyManagement/staff";
export default {
name: "",
props: {
selectNameList: {
type: Array,
},
},
created() {
// this.listStaff();
},
data() {
return {
queryParams: {
pageNum: 1,
pageSize: 10,
deptId: null,
staffName: null,
},
total: 0,
nameList: [],
loading: false,
};
},
methods: {
listStaff() {
this.loading = true;
listStaff(this.queryParams).then((res) => {
this.total = res.total;
this.nameList = res.rows;
this.$nextTick((item) => {
this.selectNameList.forEach((item) => {
this.toggleSelection(item.staffId, true);
});
this.loading = false;
});
});
},
// toggleSelection(rows) {
// if (rows) {
// rows.forEach((row) => {
// this.$refs.multipleTable.toggleRowSelection(row);
// });
// } else {
// this.$refs.multipleTable.clearSelection();
// }
// },
select(all, row) {
this.$emit("selectOne", all, row);
},
all(all) {
console.log(all);
// true是全选,false是全清
let allSelect = false;
if (all.length == 0 || (all.length == 1 && [0] == undefined)) {
allSelect = false;
} else if (all.length > 1) {
allSelect = true;
}
this.$emit("selectAll", this.nameList, allSelect);
},
// 切换选项
toggleSelection(staffId, SeclctFlag = false) {
const item = this.nameList.find((item) => {
return item.staffId == staffId;
});
this.$refs.multipleTable.toggleRowSelection(item, SeclctFlag);
},
currentChangeClick(val) {
this.queryParams.pageNum = val;
this.listStaff();
},
formatter(row, column, cellValue, index) {
// console.log(row, column, cellValue, index);
if (!cellValue) return "-";
else return cellValue;
},
},
};
</script>
<style lang="scss" scoped>
</style>
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-19 17:39:55
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-24 16:12:56
* @FilePath: /danger-manage-web/src/views/educationPlanExam/textPaper/components/ChangePapel.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="changePeople-wrapper flex">
<div class="changePeople-left">
<div class="top-search flex">
<el-select
v-model="deptId"
filterable
placeholder="请选择"
size="mini"
style="width: 40%"
clearable
>
<el-option
v-for="item in searchList"
:key="item.deptId"
:label="item.deptName"
:value="item.deptId"
>
</el-option>
</el-select>
<el-input
v-model="staffName"
size="mini"
placeholder="请输入姓名"
suffix-icon="el-icon-date"
style="width: 48%"
>
</el-input>
<div>
<el-button @click="searchTable" size="mini">搜索</el-button>
</div>
</div>
<div class="left-middle-table">
<ChangPapelTable
ref="table"
:selectNameList.sync="selectNameList"
@selectOne="selectOne"
@selectAll="selectAll"
/>
</div>
<!-- <div class="bottom-text">共有3n人</div> -->
</div>
<div class="middle flex">
<div>>>></div>
</div>
<div class="changePeople-right flex">
<div class="people-card flex zzz">
<div
class="item flex"
v-for="item in selectNameList"
:key="item.staffId"
>
<div>{{ item.staffName }}</div>
<div class="close" @click="deleteName(item.staffId)">x</div>
</div>
</div>
<div class="bottom-text">已选择n人</div>
</div>
</div>
</template>
<script>
import ChangPapelTable from "./ChangPapelTable";
import { listDept } from "@/api/system/dept";
export default {
name: "PeopleGuestChange",
components: {
ChangPapelTable,
},
props: {
// 传进组件的已经被选择的人名
jsonSelectNameList: {
type: String,
default: null,
},
},
data() {
return {
selectNameList: [],
searchList: [],
deptId: null,
staffName: null,
};
},
created() {
listDept().then((res) => {
console.log(res);
this.searchList = res.data;
});
},
mounted() {},
watch: {
selectNameList() {
let json;
if (this.selectNameList.length == 0) {
json = null;
}
if (Array.isArray(this.selectNameList)) {
json = this.selectNameList.map((item) => {
return {
peoPleId: item.staffId,
peoPleName: item.staffName,
};
});
} else {
json = this.selectNameList;
}
this.$emit("getPeopleList", JSON.stringify(json));
},
},
methods: {
changeNameList(jsonSelectNameList) {
if (jsonSelectNameList) {
this.selectNameList = JSON.parse(jsonSelectNameList).map((item) => {
return {
staffId: item.peoPleId,
staffName: item.peoPleName,
};
});
} else {
this.selectNameList = [];
}
this.$refs.table.listStaff();
},
searchTable() {
this.$refs.table.queryParams = {
pageNum: 1,
pageSize: 10,
deptId: this.deptId,
staffName: this.staffName,
};
this.$refs.table.listStaff();
},
deleteName(staffId) {
const index = this.selectNameList.findIndex((item) => {
return item.staffId == staffId;
});
if (index >= 0) {
console.log(index);
this.selectNameList.splice(index, 1);
this.$refs.table.toggleSelection(staffId);
}
},
addName(row) {
const index = this.selectNameList.findIndex((item) => {
// console.log(item.id)
return item.staffId == row.staffId;
});
console.log(index);
if (index >= 0) {
this.selectNameList.splice(index, 1);
} else {
this.selectNameList.push(row);
}
},
selectAll(all, allSelect) {
// console.log(all);
console.log(allSelect);
if (allSelect) {
all.forEach((item) => {
const index = this.selectNameList.findIndex((iten) => {
return iten.staffId == item.staffId;
});
if (index < 0) {
this.selectNameList.push(item);
}
});
} else {
all.forEach((item) => {
this.deleteName(item.staffId);
});
}
},
selectOne(all, row) {
this.addName(row);
// console.log(all,row)
},
},
};
</script>
<style lang="scss" scoped>
.changePeople-wrapper {
width: 100%;
height: 400px;
// background-color: red;
margin-top: 10px;
justify-content: space-between;
& > div {
flex-direction: column;
}
.changePeople-left,
.changePeople-right {
width: 415px;
height: 100%;
border: 1px solid #e5e6eb;
}
.middle {
align-items: center;
justify-content: center;
div {
color: #1890ff;
font-weight: 2000;
}
}
.changePeople-left {
padding: 14px 20px 11px 16px;
flex-direction: column;
.top-search {
margin-bottom: 12px;
justify-content: space-between;
}
.left-middle-table {
flex: 1;
// background: red;
}
.bottom-text {
padding-top: 10px;
font-size: 12px;
height: 20px;
line-height: 20px;
text-align: right;
color: #1890ff;
}
}
.changePeople-right {
flex-direction: column;
padding-top: 14px;
height: 100%;
.people-card {
flex-wrap: wrap;
align-content: flex-start;
width: 100%;
flex: 1;
height: 0;
padding-left: 11px;
overflow-y: scroll;
&::-webkit-scrollbar {
display: none; /* Chrome Safari */
}
.item {
width: 70px;
height: 30px;
line-height: 30px;
padding-left: 10px;
padding-right: 5px;
margin-right: 10px;
color: #3d3d3d;
box-sizing: border-box;
margin-bottom: 10px;
box-sizing: border-box;
border: 1px solid #a3d3ff;
border-radius: 3px;
font-size: 12px;
position: relative;
justify-content: space-between;
}
.close {
cursor: pointer;
}
}
.bottom-text {
// padding-top: 10px;
padding-right: 10px;
font-size: 12px;
height: 20px;
line-height: 20px;
text-align: right;
color: #1890ff;
}
}
}
</style>
......@@ -174,6 +174,9 @@ export default {
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/system/subject/import"
},
queryParams: {
bankId:0
},
};
},
// watch: {
......@@ -198,9 +201,9 @@ export default {
// 文件下载处理
handleDownload(row) {
const a = document.createElement('a')
a.setAttribute('download', '考试宝')
a.setAttribute('download', '试题导入模板')
a.setAttribute('target', '_blank')
a.setAttribute('href', 'http://36.138.181.113:8091/dangerManage/profile/upload/2022/kaoshi/kaoshibao.xlsx')
a.setAttribute('href', 'http://36.138.181.113:8091/dangerManage/profile/upload/2022/kaoshi/shitimoban.xlsx')
a.click()
},
......@@ -219,7 +222,7 @@ export default {
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
this.getList();
this.getQuestion({ bankId: this.bankId });
},
/** 下载模板操作 */
importTemplate() {
......@@ -243,9 +246,7 @@ export default {
this.$parent.$parent.componentsNumChange(3);
},
getQuestion(bankId) {
console.log(bankId);
return listSubject(bankId).then((res) => {
console.log("题库res", res);
this.questionList = res.rows.map((item) => {
return {
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:59:44
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-21 17:30:33
* @LastEditTime: 2022-12-24 15:50:39
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/Lession.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -15,12 +15,13 @@
label-width="auto"
:rules="rules"
>
<el-form-item label="题库名称" prop="bankName">
<el-input style="width: 500px" v-model="form.bankName"></el-input>
</el-form-item>
<div class="top flex">
<el-form-item label="题库名称" prop="bankName">
<el-input style="width: 500px" v-model="form.bankName"></el-input>
</el-form-item>
<el-form-item label="开始时间" prop="releaseTime">
<el-date-picker
style="width: 220px; margin-right: 44px"
v-model="form.startTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
......@@ -29,16 +30,22 @@
>
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="releaseTime">
<el-date-picker
v-model="form.endTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="结束时间"
default-time="12:00:00"
>
</el-date-picker>
</el-form-item>
</div>
<el-form-item label="结束时间" prop="releaseTime">
<el-date-picker
v-model="form.endTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="结束时间"
default-time="12:00:00"
>
</el-date-picker>
<el-form-item label="考试范围" prop="releaseTime">
<el-radio-group v-model="form.personelType">
<el-radio :label="1">内部员工</el-radio>
<el-radio :label="2">访客和承包商</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="选择人员" prop="releaseTime">
......@@ -46,7 +53,7 @@
<!-- jsonSelectNameList就是呗选中的人员的json -->
<!-- getPeopleList 是每次选中或者删除人员都会返回 一个所有人员列表的json串,[{staffId:staffId,staffName:staffName},{staffId:staffId,staffName:staffName}] -->
<!-- 要在jsonSelectNameList赋值完毕之后 调用一下 this.$refs.changePaple.changeNameList 135行 -->
<ChangePapel
<PeopleGuestChange
ref="changePaple"
:jsonSelectNameList="jsonSelectNameList"
@getPeopleList="getPeopleList"
......@@ -57,7 +64,10 @@
</template>
<script>
// 内部
import ChangePapel from "@/components/PeopleChange";
// 访客承包商
import PeopleGuestChange from "@/components/PeopleGuestChange";
// import { mapGetters } from "vuex";
// import {
// addLessons,
......@@ -89,6 +99,7 @@ export default {
},
components: {
ChangePapel,
PeopleGuestChange
},
data() {
return {
......@@ -100,9 +111,12 @@ export default {
// enclosure: "",
deptId: null,
abc: 0,
personelType: 1,
},
// 参考人员
jsonSelectNameList: null,
// jsonSelectNameList: null,
jsonSelectNameList: '[{"peoPleId":880,"peoPleName":"孙卓亚"},{"peoPleId":871,"peoPleName":"张玉宾"}]',
// 考试范围
// 归属部门列表
deptOptions: [],
......@@ -134,9 +148,9 @@ export default {
// this.getTreeselect();
},
mounted() {
// this.jsonSelectNameList
// '[{"staffId":880,"staffName":"孙卓亚"},{"staffId":871,"staffName":"张玉宾"},{"staffId":869,"staffName":"李二朝"},{"staffId":870,"staffName":"盖永峰"},{"staffId":868,"staffName":"刘丽艳"},{"staffId":867,"staffName":"霍文俊"},{"staffId":866,"staffName":"刘志坚"},{"staffId":865,"staffName":"郝文权"},{"staffId":864,"staffName":"齐雪军"},{"staffId":852,"staffName":"刘江平"},{"staffId":853,"staffName":"谷建海"},{"staffId":851,"staffName":"丁振国"},{"staffId":850,"staffName":"齐江波"},{"staffId":849,"staffName":"周立新"},{"staffId":848,"staffName":"史志波"},{"staffId":847,"staffName":"王增波"},{"staffId":846,"staffName":"杨彦龙"},{"staffId":845,"staffName":"杨华国"},{"staffId":844,"staffName":"王青华"}]';
// this.jsonSelectNameList
// '[{"staffId":880,"staffName":"孙卓亚"},{"staffId":871,"staffName":"张玉宾"},{"staffId":869,"staffName":"李二朝"},{"staffId":870,"staffName":"盖永峰"},{"staffId":868,"staffName":"刘丽艳"},{"staffId":867,"staffName":"霍文俊"},{"staffId":866,"staffName":"刘志坚"},{"staffId":865,"staffName":"郝文权"},{"staffId":864,"staffName":"齐雪军"},{"staffId":852,"staffName":"刘江平"},{"staffId":853,"staffName":"谷建海"},{"staffId":851,"staffName":"丁振国"},{"staffId":850,"staffName":"齐江波"},{"staffId":849,"staffName":"周立新"},{"staffId":848,"staffName":"史志波"},{"staffId":847,"staffName":"王增波"},{"staffId":846,"staffName":"杨彦龙"},{"staffId":845,"staffName":"杨华国"},{"staffId":844,"staffName":"王青华"}]';
this.$refs.changePaple.changeNameList(this.jsonSelectNameList);
},
methods: {
......@@ -244,14 +258,14 @@ export default {
.form-wrapper {
padding-top: 22px;
width: 100%;
height: 550px;
height: 600px;
// overflow: hidden;
// padding-bottom: 10px;
margin-bottom: 20px;
// border-bottom: 1px solid #bbbbbb;
.top {
width: 100%;
justify-content: space-between;
// justify-content: space-between;
}
}
</style>
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