diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/BusExamInfo.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/BusExamInfo.java index 4630757c..a954c834 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/BusExamInfo.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/BusExamInfo.java @@ -21,13 +21,19 @@ public class BusExamInfo extends BaseEntity private Long id; /** 部门主键 */ - @Excel(name = "部门主键") - private Long deptId; + private Long comId; + + /** 单位名称 */ + @Excel(name = "单位名称") + private String comName; /** 项目主键 */ - @Excel(name = "项目主键") private Long projectId; + /** 项目名称 */ + @Excel(name = "项目名称") + private String projectName; + /** 试卷名称 */ @Excel(name = "试卷名称") private String examTitle; @@ -84,16 +90,32 @@ public class BusExamInfo extends BaseEntity { return id; } - public void setDeptId(Long deptId) - { - this.deptId = deptId; + + public Long getComId() { + return comId; } - public Long getDeptId() - { - return deptId; + public void setComId(Long comId) { + this.comId = comId; } - public void setProjectId(Long projectId) + + public String getComName() { + return comName; + } + + public void setComName(String comName) { + this.comName = comName; + } + + public String getProjectName() { + return projectName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + public void setProjectId(Long projectId) { this.projectId = projectId; } @@ -216,7 +238,7 @@ public class BusExamInfo extends BaseEntity public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("id", getId()) - .append("deptId", getDeptId()) + .append("comId", getComId()) .append("projectId", getProjectId()) .append("examTitle", getExamTitle()) .append("examType", getExamType()) diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/BusExamQuestion.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/BusExamQuestion.java index 7b013953..2d8577a9 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/BusExamQuestion.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/BusExamQuestion.java @@ -21,13 +21,19 @@ public class BusExamQuestion extends BaseEntity private Long id; /** 单位主键 */ - @Excel(name = "单位主键") - private Long deptId; + private Long comId; + + /** 单位名称 */ + @Excel(name = "单位名称") + private String comName; /** 项目主键 */ - @Excel(name = "项目主键") private Long projectId; + /** 项目名称 */ + @Excel(name = "项目名称") + private String projectName; + /** 工种类型 */ @Excel(name = "工种类型") private String craftType; @@ -68,16 +74,32 @@ public class BusExamQuestion extends BaseEntity { return id; } - public void setDeptId(Long deptId) - { - this.deptId = deptId; + + public Long getComId() { + return comId; } - public Long getDeptId() - { - return deptId; + public void setComId(Long comId) { + this.comId = comId; } - public void setProjectId(Long projectId) + + public String getComName() { + return comName; + } + + public void setComName(String comName) { + this.comName = comName; + } + + public String getProjectName() { + return projectName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + public void setProjectId(Long projectId) { this.projectId = projectId; } @@ -164,7 +186,7 @@ public class BusExamQuestion extends BaseEntity public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("id", getId()) - .append("deptId", getDeptId()) + .append("comId", getComId()) .append("projectId", getProjectId()) .append("craftType", getCraftType()) .append("craftPost", getCraftPost()) diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/BusExamQuestionResult.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/BusExamQuestionResult.java index d7383805..1cdc379c 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/BusExamQuestionResult.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/BusExamQuestionResult.java @@ -22,17 +22,17 @@ public class BusExamQuestionResult extends BaseEntity @Excel(name = "问题主键") private Long questionId; - /** 选项 */ - @Excel(name = "选项") + /** 答案选项 */ + @Excel(name = "答案选项") private String opt; - /** 问题选项 */ - @Excel(name = "问题选项") + /** 答案描述 */ + @Excel(name = "答案描述") private String result; - /** 是否删除 */ - @Excel(name = "是否删除") - private Long isDel; + /** 是否正确 */ + @Excel(name = "是否正确") + private Long isOk; public void setId(Long id) { @@ -70,14 +70,13 @@ public class BusExamQuestionResult extends BaseEntity { return result; } - public void setIsDel(Long isDel) - { - this.isDel = isDel; + + public Long getIsOk() { + return isOk; } - public Long getIsDel() - { - return isDel; + public void setIsOk(Long isOk) { + this.isOk = isOk; } @Override @@ -87,7 +86,7 @@ public class BusExamQuestionResult extends BaseEntity .append("questionId", getQuestionId()) .append("opt", getOpt()) .append("result", getResult()) - .append("isDel", getIsDel()) + .append("isOk", getIsOk()) .append("createBy", getCreateBy()) .append("createTime", getCreateTime()) .append("updateBy", getUpdateBy()) diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusExamInfoMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusExamInfoMapper.xml index dfd8d9ed..44ecab0f 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusExamInfoMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusExamInfoMapper.xml @@ -6,8 +6,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + + @@ -38,32 +40,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, dept_id, project_id, exam_title, exam_type, craft_type, craft_post, single_num, multiple_num, estimate_num, full_mark, pass_mark, use_number, is_del, create_by, create_time, update_by, update_time, remark from bus_exam_info + select bei.id, bei.com_id, sd.dept_name as com_name, bei.project_id, pi.project_name, bei.exam_title, bei.exam_type, bei.craft_type, bei.craft_post, bei.single_num, bei.multiple_num, bei.estimate_num, bei.full_mark, bei.pass_mark, bei.use_number, bei.is_del, bei.create_by, bei.create_time, bei.update_by, bei.update_time, bei.remark from bus_exam_info bei + left join pro_project_info pi on pi.id = bei.project_id + left join sys_dept sd on sd.dept_id = pi.com_id @@ -71,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into bus_exam_info - dept_id, + com_id, project_id, exam_title, exam_type, @@ -91,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" remark, - #{deptId}, + #{comId}, #{projectId}, #{examTitle}, #{examType}, @@ -115,7 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update bus_exam_info - dept_id = #{deptId}, + com_id = #{comId}, project_id = #{projectId}, exam_title = #{examTitle}, exam_type = #{examType}, diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusExamQuestionMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusExamQuestionMapper.xml index 64fa76f8..7548c3ce 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusExamQuestionMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusExamQuestionMapper.xml @@ -6,8 +6,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + + @@ -31,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -40,28 +42,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, dept_id, project_id, craft_type, craft_post, question_diff, question_type, question_desc, question_answer, is_del, create_by, create_time, update_by, update_time, remark from bus_exam_question + select beq.id, beq.com_id, sd.dept_name as com_name, beq.project_id, pi.project_name, beq.craft_type, beq.craft_post, beq.question_diff, beq.question_type, beq.question_desc, beq.question_answer, beq.is_del, beq.create_by, beq.create_time, beq.update_by, beq.update_time, beq.remark from bus_exam_question beq + left join pro_project_info pi on pi.id = beq.project_id + left join sys_dept sd on sd.dept_id = pi.com_id @@ -69,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into bus_exam_question - dept_id, + com_id, project_id, craft_type, craft_post, @@ -85,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" remark, - #{deptId}, + #{comId}, #{projectId}, #{craftType}, #{craftPost}, @@ -105,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update bus_exam_question - dept_id = #{deptId}, + com_id = #{comId}, project_id = #{projectId}, craft_type = #{craftType}, craft_post = #{craftPost}, @@ -123,12 +132,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} - - delete from bus_exam_question where id = #{id} - + + update bus_exam_question set is_del=2 where id = #{id} + - delete from bus_exam_question where id in + update bus_exam_question set is_del=2 where id in #{id} @@ -146,9 +155,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - insert into bus_exam_question_result( id, question_id, opt, result, is_del, create_by, create_time, update_by, update_time, remark) values + insert into bus_exam_question_result( id, question_id, opt, result, is_ok, create_by, create_time, update_by, update_time) values - ( #{item.id}, #{item.questionId}, #{item.opt}, #{item.result}, #{item.isDel}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark}) + ( #{item.id}, #{item.questionId}, #{item.opt}, #{item.result}, #{item.isOk}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}) + \ No newline at end of file diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusExamQuestionResultMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusExamQuestionResultMapper.xml index 83c419ad..d5efef0b 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusExamQuestionResultMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusExamQuestionResultMapper.xml @@ -9,7 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, question_id, opt, result, is_del, create_by, create_time, update_by, update_time, remark from bus_exam_question_result + select id, question_id, opt, result, is_ok, create_by, create_time, update_by, update_time, remark from bus_exam_question_result @@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" question_id, opt, result, - is_del, + is_ok, create_by, create_time, update_by, @@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{questionId}, #{opt}, #{result}, - #{isDel}, + #{isOk}, #{createBy}, #{createTime}, #{updateBy}, @@ -68,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" question_id = #{questionId}, opt = #{opt}, result = #{result}, - is_del = #{isDel}, + is_ok = #{isOk}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy}, diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/BusExamInfoQuesController.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/BusExamInfoQuesController.java deleted file mode 100644 index fea9ae4a..00000000 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/BusExamInfoQuesController.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.yanzhu.manage.controller; - -import com.yanzhu.common.core.utils.poi.ExcelUtil; -import com.yanzhu.common.core.web.controller.BaseController; -import com.yanzhu.common.core.web.domain.AjaxResult; -import com.yanzhu.common.core.web.page.TableDataInfo; -import com.yanzhu.common.log.annotation.Log; -import com.yanzhu.common.log.enums.BusinessType; -import com.yanzhu.common.security.annotation.RequiresPermissions; -import com.yanzhu.manage.domain.BusExamInfoQues; -import com.yanzhu.manage.service.IBusExamInfoQuesService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * 试卷问题Controller - * - * @author JiangYuQi - * @date 2024-08-25 - */ -@RestController -@RequestMapping("/busExamInfoQues") -public class BusExamInfoQuesController extends BaseController -{ - @Autowired - private IBusExamInfoQuesService busExamInfoQuesService; - - /** - * 查询试卷问题列表 - */ - @RequiresPermissions("manage:busExamInfoQues:list") - @GetMapping("/list") - public TableDataInfo list(BusExamInfoQues busExamInfoQues) - { - startPage(); - List list = busExamInfoQuesService.selectBusExamInfoQuesList(busExamInfoQues); - return getDataTable(list); - } - - /** - * 导出试卷问题列表 - */ - @RequiresPermissions("manage:busExamInfoQues:export") - @Log(title = "试卷问题", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public void export(HttpServletResponse response, BusExamInfoQues busExamInfoQues) - { - List list = busExamInfoQuesService.selectBusExamInfoQuesList(busExamInfoQues); - ExcelUtil util = new ExcelUtil(BusExamInfoQues.class); - util.exportExcel(response, list, "试卷问题数据"); - } - - /** - * 获取试卷问题详细信息 - */ - @RequiresPermissions("manage:busExamInfoQues:query") - @GetMapping(value = "/{examId}") - public AjaxResult getInfo(@PathVariable("examId") Long examId) - { - return success(busExamInfoQuesService.selectBusExamInfoQuesByExamId(examId)); - } - - /** - * 新增试卷问题 - */ - @RequiresPermissions("manage:busExamInfoQues:add") - @Log(title = "试卷问题", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody BusExamInfoQues busExamInfoQues) - { - return toAjax(busExamInfoQuesService.insertBusExamInfoQues(busExamInfoQues)); - } - - /** - * 修改试卷问题 - */ - @RequiresPermissions("manage:busExamInfoQues:edit") - @Log(title = "试卷问题", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody BusExamInfoQues busExamInfoQues) - { - return toAjax(busExamInfoQuesService.updateBusExamInfoQues(busExamInfoQues)); - } - - /** - * 删除试卷问题 - */ - @RequiresPermissions("manage:busExamInfoQues:remove") - @Log(title = "试卷问题", businessType = BusinessType.DELETE) - @DeleteMapping("/{examIds}") - public AjaxResult remove(@PathVariable Long[] examIds) - { - return toAjax(busExamInfoQuesService.deleteBusExamInfoQuesByExamIds(examIds)); - } -} diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/BusExamQuestionResultController.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/BusExamQuestionResultController.java deleted file mode 100644 index 196aa358..00000000 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/BusExamQuestionResultController.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.yanzhu.manage.controller; - -import com.yanzhu.common.core.utils.poi.ExcelUtil; -import com.yanzhu.common.core.web.controller.BaseController; -import com.yanzhu.common.core.web.domain.AjaxResult; -import com.yanzhu.common.core.web.page.TableDataInfo; -import com.yanzhu.common.log.annotation.Log; -import com.yanzhu.common.log.enums.BusinessType; -import com.yanzhu.common.security.annotation.RequiresPermissions; -import com.yanzhu.manage.domain.BusExamQuestionResult; -import com.yanzhu.manage.service.IBusExamQuestionResultService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * 题库问题Controller - * - * @author JiangYuQi - * @date 2024-08-25 - */ -@RestController -@RequestMapping("/busExamQuestionResult") -public class BusExamQuestionResultController extends BaseController -{ - @Autowired - private IBusExamQuestionResultService busExamQuestionResultService; - - /** - * 查询题库问题列表 - */ - @RequiresPermissions("manage:busExamQuestionResult:list") - @GetMapping("/list") - public TableDataInfo list(BusExamQuestionResult busExamQuestionResult) - { - startPage(); - List list = busExamQuestionResultService.selectBusExamQuestionResultList(busExamQuestionResult); - return getDataTable(list); - } - - /** - * 导出题库问题列表 - */ - @RequiresPermissions("manage:busExamQuestionResult:export") - @Log(title = "题库问题", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public void export(HttpServletResponse response, BusExamQuestionResult busExamQuestionResult) - { - List list = busExamQuestionResultService.selectBusExamQuestionResultList(busExamQuestionResult); - ExcelUtil util = new ExcelUtil(BusExamQuestionResult.class); - util.exportExcel(response, list, "题库问题数据"); - } - - /** - * 获取题库问题详细信息 - */ - @RequiresPermissions("manage:busExamQuestionResult:query") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return success(busExamQuestionResultService.selectBusExamQuestionResultById(id)); - } - - /** - * 新增题库问题 - */ - @RequiresPermissions("manage:busExamQuestionResult:add") - @Log(title = "题库问题", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody BusExamQuestionResult busExamQuestionResult) - { - return toAjax(busExamQuestionResultService.insertBusExamQuestionResult(busExamQuestionResult)); - } - - /** - * 修改题库问题 - */ - @RequiresPermissions("manage:busExamQuestionResult:edit") - @Log(title = "题库问题", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody BusExamQuestionResult busExamQuestionResult) - { - return toAjax(busExamQuestionResultService.updateBusExamQuestionResult(busExamQuestionResult)); - } - - /** - * 删除题库问题 - */ - @RequiresPermissions("manage:busExamQuestionResult:remove") - @Log(title = "题库问题", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(busExamQuestionResultService.deleteBusExamQuestionResultByIds(ids)); - } -} diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/BusExamQuestionServiceImpl.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/BusExamQuestionServiceImpl.java index fca513b2..93babffe 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/BusExamQuestionServiceImpl.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/BusExamQuestionServiceImpl.java @@ -1,8 +1,13 @@ package com.yanzhu.manage.service.impl; import java.util.List; + +import com.yanzhu.common.core.constant.CacheConstants; import com.yanzhu.common.core.utils.DateUtils; import com.yanzhu.common.core.utils.StringUtils; +import com.yanzhu.common.redis.service.RedisService; +import com.yanzhu.common.security.utils.SecurityUtils; +import com.yanzhu.manage.domain.ProProjectInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; @@ -21,6 +26,9 @@ import com.yanzhu.manage.service.IBusExamQuestionService; @Service public class BusExamQuestionServiceImpl implements IBusExamQuestionService { + @Autowired + private RedisService redisService; + @Autowired private BusExamQuestionMapper busExamQuestionMapper; @@ -45,6 +53,8 @@ public class BusExamQuestionServiceImpl implements IBusExamQuestionService @Override public List selectBusExamQuestionList(BusExamQuestion busExamQuestion) { + busExamQuestion.setActiveComId(SecurityUtils.getLoginUser().getProjectDeptId()); + busExamQuestion.setActiveProjectId(SecurityUtils.getLoginUser().getProjectId()); return busExamQuestionMapper.selectBusExamQuestionList(busExamQuestion); } @@ -58,7 +68,11 @@ public class BusExamQuestionServiceImpl implements IBusExamQuestionService @Override public int insertBusExamQuestion(BusExamQuestion busExamQuestion) { + ProProjectInfo info = redisService.getCacheObject(CacheConstants.PRO_PROJECT+busExamQuestion.getProjectId()); + busExamQuestion.setComId(info.getComId()); + busExamQuestion.setCreateBy(SecurityUtils.getUsername()); busExamQuestion.setCreateTime(DateUtils.getNowDate()); + busExamQuestion.setUpdateTime(DateUtils.getNowDate()); int rows = busExamQuestionMapper.insertBusExamQuestion(busExamQuestion); insertBusExamQuestionResult(busExamQuestion); return rows; diff --git a/yanzhu-ui-vue3/src/views/manage/busExamInfo/index.vue b/yanzhu-ui-vue3/src/views/manage/busExamInfo/index.vue index 35d281d3..477b9817 100644 --- a/yanzhu-ui-vue3/src/views/manage/busExamInfo/index.vue +++ b/yanzhu-ui-vue3/src/views/manage/busExamInfo/index.vue @@ -1,18 +1,10 @@