【修改】 软件环境根据试卷方案自动获取

This commit is contained in:
dlaren
2025-08-07 15:12:44 +08:00
parent 5fe0e99a71
commit 520f2f0e0a
10 changed files with 225 additions and 116 deletions

View File

@@ -4,11 +4,19 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.annotation.security.PermitAll; import jakarta.annotation.security.PermitAll;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import pc.exam.pp.framework.common.pojo.CommonResult; import pc.exam.pp.framework.common.pojo.CommonResult;
import pc.exam.pp.framework.tenant.core.aop.TenantIgnore; import pc.exam.pp.framework.tenant.core.aop.TenantIgnore;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperScheme;
import pc.exam.pp.module.exam.dal.dataobject.app.AppCheckDO; import pc.exam.pp.module.exam.dal.dataobject.app.AppCheckDO;
import pc.exam.pp.module.exam.dal.dataobject.specialty.ExamSpecialty;
import pc.exam.pp.module.exam.service.app.AppCheckService; import pc.exam.pp.module.exam.service.app.AppCheckService;
import pc.exam.pp.module.exam.service.paper.IEducationPaperSchemeService;
import pc.exam.pp.module.exam.service.specialty.ExamSpecialtyService;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import static pc.exam.pp.framework.common.pojo.CommonResult.success; import static pc.exam.pp.framework.common.pojo.CommonResult.success;
@@ -25,6 +33,10 @@ public class AppCheckController {
@Resource @Resource
AppCheckService appCheckService; AppCheckService appCheckService;
@Autowired
IEducationPaperSchemeService educationPaperSchemeService;
@Autowired
ExamSpecialtyService examSpecialtyService;
@GetMapping("/getAppCheckList/{taskId}") @GetMapping("/getAppCheckList/{taskId}")
@PermitAll @PermitAll
@@ -42,11 +54,42 @@ public class AppCheckController {
} }
@GetMapping("/delete/{id}") @GetMapping("/delete/{id}")
@PermitAll
@TenantIgnore @TenantIgnore
@Operation(summary = "查看学生端需要检测的APP列表", description = "查看学生端需要检测的APP列表") @Operation(summary = "查看学生端需要检测的APP列表", description = "查看学生端需要检测的APP列表")
public CommonResult<Boolean> delete(@PathVariable("id") String id){ public CommonResult<Boolean> delete(@PathVariable("id") String id){
// 使用传入的IP进行ping查看是否存在连接并返回信号的强度 // 使用传入的IP进行ping查看是否存在连接并返回信号的强度
return success(appCheckService.deleteAppCheck(id)); return success(appCheckService.deleteAppCheck(id));
} }
// 根据taskId查询下面有多少题型然后查找对应的软件环境在新增
@GetMapping("/getAppCheckListByTaskId/{taskId}")
public CommonResult<Boolean> getAppCheckListByTaskId(@PathVariable("taskId") String taskId){
List<AppCheckDO> appCheckDOList = new ArrayList<>();
// 根据试卷方案ID查询下面试卷的试题的组成部分
List<EducationPaperScheme> list = educationPaperSchemeService.getInfoDataByTaskId(taskId);
for (EducationPaperScheme educationPaperScheme : list) {
String spName = educationPaperScheme.getSpName();
// 根据题型名称查询软件环境
List<ExamSpecialty> examSpecialty = examSpecialtyService.selectExamSpecialtyBySpName(spName);
if (examSpecialty != null && !examSpecialty.isEmpty()) {
ExamSpecialty exams = examSpecialty.get(0);
if (exams.getRoles() != null && !exams.getRoles().isEmpty()) {
AppCheckDO appCheckDO = new AppCheckDO();
appCheckDO.setTaskId(taskId);
appCheckDO.setAppName(exams.getRoles());
// 判断是否在数组中存在
boolean exists = appCheckDOList.contains(appCheckDO);
if (!exists) {
appCheckDOList.add(appCheckDO);
}
}
}
}
// 添加
for (AppCheckDO appCheckDO : appCheckDOList) {
appCheckService.insertAppCheck(appCheckDO);
}
return success(true);
}
} }

View File

@@ -29,7 +29,7 @@ import static pc.exam.pp.framework.common.pojo.CommonResult.success;
*/ */
@RestController @RestController
@RequestMapping("/exam/specialty") @RequestMapping("/exam/specialty")
public class ExamSpecialtyController{ public class ExamSpecialtyController {
@Autowired @Autowired
private ExamSpecialtyService examSpecialtyService; private ExamSpecialtyService examSpecialtyService;
@Autowired @Autowired
@@ -49,6 +49,7 @@ public class ExamSpecialtyController{
List<SpecialtyQueryVo> list = examSpecialtyService.selectExamSpecialtyPart(); List<SpecialtyQueryVo> list = examSpecialtyService.selectExamSpecialtyPart();
return success(BeanUtils.toBean(list, SpecialtyQueryVo.class)); return success(BeanUtils.toBean(list, SpecialtyQueryVo.class));
} }
/** /**
* 获取全部数据详细信息 * 获取全部数据详细信息
*/ */
@@ -156,6 +157,7 @@ public class ExamSpecialtyController{
} }
return success(examSpecialtyService.deleteExamSpecialtyBySpIds(spIds)); return success(examSpecialtyService.deleteExamSpecialtyBySpIds(spIds));
} }
@PostMapping("/setRole") @PostMapping("/setRole")
public CommonResult setRole(@RequestBody SpecialRolesVo specialRolesVo) { public CommonResult setRole(@RequestBody SpecialRolesVo specialRolesVo) {
System.out.println(specialRolesVo); System.out.println(specialRolesVo);
@@ -164,10 +166,11 @@ public class ExamSpecialtyController{
examSpecialtyService.updateExamSpecialty(examSpecialty); examSpecialtyService.updateExamSpecialty(examSpecialty);
return success("设置成功"); return success("设置成功");
} }
@GetMapping(value = "/getRole/{id}") @GetMapping(value = "/getRole/{id}")
public CommonResult getRole(@PathVariable("id") String id) { public CommonResult getRole(@PathVariable("id") String id) {
String roles= examSpecialtyService.getRoleById(id); String roles = examSpecialtyService.getRoleById(id);
if(roles!=null){ if (roles != null) {
return success(Integer.parseInt(roles)); return success(Integer.parseInt(roles));
} }
return success(""); return success("");

View File

@@ -14,8 +14,7 @@ import java.util.List;
* @date 2025-04-15 * @date 2025-04-15
*/ */
@Mapper @Mapper
public interface EducationPaperSchemeMapper public interface EducationPaperSchemeMapper {
{
/** /**
* 查询试卷方案 * 查询试卷方案
* *
@@ -66,6 +65,7 @@ public interface EducationPaperSchemeMapper
/** /**
* 根据试卷任务id查询 试卷方案集合 * 根据试卷任务id查询 试卷方案集合
*
* @param taskid * @param taskid
* @return * @return
*/ */
@@ -73,6 +73,7 @@ public interface EducationPaperSchemeMapper
/** /**
* 批量插入 试卷方案 * 批量插入 试卷方案
*
* @param educationPaperSchemeList * @param educationPaperSchemeList
*/ */
void insertEducationPaperSchemeList(List<EducationPaperScheme> educationPaperSchemeList); void insertEducationPaperSchemeList(List<EducationPaperScheme> educationPaperSchemeList);

View File

@@ -30,7 +30,9 @@ public interface ExamSpecialtyMapper extends BaseMapperX<ExamSpecialty>
* @param spId 数据主键 * @param spId 数据主键
* @return 数据信息 * @return 数据信息
*/ */
public ExamSpecialty selectExamSpecialtyBySpId(Long spId); ExamSpecialty selectExamSpecialtyBySpId(Long spId);
List<ExamSpecialty> selectExamSpecialtyBySpName(String spName);
/** /**
* 查询数据parentId * 查询数据parentId
* *

View File

@@ -17,8 +17,7 @@ import java.util.stream.Collectors;
* @date 2025-04-15 * @date 2025-04-15
*/ */
@Service @Service
public class EducationPaperSchemeServiceImpl implements IEducationPaperSchemeService public class EducationPaperSchemeServiceImpl implements IEducationPaperSchemeService {
{
@Autowired @Autowired
private EducationPaperSchemeMapper educationPaperSchemeMapper; private EducationPaperSchemeMapper educationPaperSchemeMapper;
@@ -29,8 +28,7 @@ public class EducationPaperSchemeServiceImpl implements IEducationPaperSchemeSer
* @return 试卷方案 * @return 试卷方案
*/ */
@Override @Override
public EducationPaperScheme selectEducationPaperSchemeBySchemeId(String schemeId) public EducationPaperScheme selectEducationPaperSchemeBySchemeId(String schemeId) {
{
return educationPaperSchemeMapper.selectEducationPaperSchemeBySchemeId(schemeId); return educationPaperSchemeMapper.selectEducationPaperSchemeBySchemeId(schemeId);
} }
@@ -41,8 +39,7 @@ public class EducationPaperSchemeServiceImpl implements IEducationPaperSchemeSer
* @return 试卷方案 * @return 试卷方案
*/ */
@Override @Override
public List<EducationPaperScheme> selectEducationPaperSchemeList(EducationPaperScheme educationPaperScheme) public List<EducationPaperScheme> selectEducationPaperSchemeList(EducationPaperScheme educationPaperScheme) {
{
return educationPaperSchemeMapper.selectEducationPaperSchemeList(educationPaperScheme); return educationPaperSchemeMapper.selectEducationPaperSchemeList(educationPaperScheme);
} }
@@ -56,7 +53,6 @@ public class EducationPaperSchemeServiceImpl implements IEducationPaperSchemeSer
public int insertEducationPaperScheme(EducationPaperScheme educationPaperScheme) { public int insertEducationPaperScheme(EducationPaperScheme educationPaperScheme) {
String uuid = IdUtils.simpleUUID(); String uuid = IdUtils.simpleUUID();
educationPaperScheme.setSchemeId(uuid); educationPaperScheme.setSchemeId(uuid);
@@ -85,8 +81,7 @@ public class EducationPaperSchemeServiceImpl implements IEducationPaperSchemeSer
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateEducationPaperScheme(EducationPaperScheme educationPaperScheme) public int updateEducationPaperScheme(EducationPaperScheme educationPaperScheme) {
{
// // 将 List<String> 转换为逗号分隔的字符串 // // 将 List<String> 转换为逗号分隔的字符串
// List<String> keyword = educationPaperScheme.getKeyword(); // List<String> keyword = educationPaperScheme.getKeyword();
@@ -110,8 +105,7 @@ public class EducationPaperSchemeServiceImpl implements IEducationPaperSchemeSer
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteEducationPaperSchemeBySchemeIds(String[] schemeIds) public int deleteEducationPaperSchemeBySchemeIds(String[] schemeIds) {
{
return educationPaperSchemeMapper.deleteEducationPaperSchemeBySchemeIds(schemeIds); return educationPaperSchemeMapper.deleteEducationPaperSchemeBySchemeIds(schemeIds);
} }
@@ -122,8 +116,7 @@ public class EducationPaperSchemeServiceImpl implements IEducationPaperSchemeSer
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteEducationPaperSchemeBySchemeId(String schemeId) public int deleteEducationPaperSchemeBySchemeId(String schemeId) {
{
return educationPaperSchemeMapper.deleteEducationPaperSchemeBySchemeId(schemeId); return educationPaperSchemeMapper.deleteEducationPaperSchemeBySchemeId(schemeId);
} }
@@ -131,5 +124,10 @@ public class EducationPaperSchemeServiceImpl implements IEducationPaperSchemeSer
public int selectEducationPaperSchemeCountsByTaskId(String taskId) { public int selectEducationPaperSchemeCountsByTaskId(String taskId) {
return educationPaperSchemeMapper.selectEducationPaperSchemeCountsByTaskId(taskId); return educationPaperSchemeMapper.selectEducationPaperSchemeCountsByTaskId(taskId);
} }
@Override
public List<EducationPaperScheme> getInfoDataByTaskId(String taskId) {
return educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskId);
}
} }

View File

@@ -63,5 +63,7 @@ public interface IEducationPaperSchemeService
int selectEducationPaperSchemeCountsByTaskId(String taskId); int selectEducationPaperSchemeCountsByTaskId(String taskId);
List<EducationPaperScheme> getInfoDataByTaskId(String taskId);
} }

View File

@@ -22,6 +22,14 @@ public interface ExamSpecialtyService
*/ */
public ExamSpecialty selectExamSpecialtyBySpId(Long spId); public ExamSpecialty selectExamSpecialtyBySpId(Long spId);
/**
* 查询信息(名称)
*
* @param spName 名称
* @return 所有信息
*/
List<ExamSpecialty> selectExamSpecialtyBySpName(String spName);
/** /**
* 查询全部信息列表 * 查询全部信息列表
* *

View File

@@ -30,10 +30,15 @@ public class ExamSpecialtyServiceImpl implements ExamSpecialtyService {
* @return 数据信息 * @return 数据信息
*/ */
@Override @Override
public ExamSpecialty selectExamSpecialtyBySpId(Long spId) public ExamSpecialty selectExamSpecialtyBySpId(Long spId) {
{
return examSpecialtyMapper.selectExamSpecialtyBySpId(spId); return examSpecialtyMapper.selectExamSpecialtyBySpId(spId);
} }
@Override
public List<ExamSpecialty> selectExamSpecialtyBySpName(String spName) {
return examSpecialtyMapper.selectExamSpecialtyBySpName(spName);
}
/** /**
* 查询数据信息列表 * 查询数据信息列表
* *
@@ -41,8 +46,7 @@ public class ExamSpecialtyServiceImpl implements ExamSpecialtyService {
* @return 数据信息 * @return 数据信息
*/ */
@Override @Override
public List<SpecialtyQueryVo> selectExamSpecialtyList(SpecialtListReqVo reqVo) public List<SpecialtyQueryVo> selectExamSpecialtyList(SpecialtListReqVo reqVo) {
{
return examSpecialtyMapper.selectExamSpecialtyListVo(reqVo); return examSpecialtyMapper.selectExamSpecialtyListVo(reqVo);
} }
@@ -58,7 +62,7 @@ public class ExamSpecialtyServiceImpl implements ExamSpecialtyService {
* @return 数据信息 * @return 数据信息
*/ */
@Override @Override
public List<ExamSpecialty> selectSpIds(Long[] spIds){ public List<ExamSpecialty> selectSpIds(Long[] spIds) {
return examSpecialtyMapper.selectSpIds(spIds); return examSpecialtyMapper.selectSpIds(spIds);
} }
@@ -69,8 +73,7 @@ public class ExamSpecialtyServiceImpl implements ExamSpecialtyService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertExamSpecialty(ExamSpecialty examSpecialty) public int insertExamSpecialty(ExamSpecialty examSpecialty) {
{
// 插入部门 // 插入部门
ExamSpecialty specialty = BeanUtils.toBean(examSpecialty, ExamSpecialty.class); ExamSpecialty specialty = BeanUtils.toBean(examSpecialty, ExamSpecialty.class);
return examSpecialtyMapper.insert(specialty); return examSpecialtyMapper.insert(specialty);
@@ -83,12 +86,11 @@ public class ExamSpecialtyServiceImpl implements ExamSpecialtyService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateExamSpecialty(ExamSpecialty examSpecialty) public int updateExamSpecialty(ExamSpecialty examSpecialty) {
{
// 对专业修改需判断是否已经互联 // 对专业修改需判断是否已经互联
// 已互联的情况需要对知识点表也进行修改 // 已互联的情况需要对知识点表也进行修改
ExamSpecialty Specialty = examSpecialtyMapper.selectExamSpecialtyBySpId(examSpecialty.getSpId()); ExamSpecialty Specialty = examSpecialtyMapper.selectExamSpecialtyBySpId(examSpecialty.getSpId());
if (Objects.equals(Specialty.getUnite(), "1")){ if (Objects.equals(Specialty.getUnite(), "1")) {
// 实例化需要修改的专业 // 实例化需要修改的专业
ExamKnowledgePoints knowledgePoint = new ExamKnowledgePoints(); ExamKnowledgePoints knowledgePoint = new ExamKnowledgePoints();
knowledgePoint.setSpId(examSpecialty.getSpId()); knowledgePoint.setSpId(examSpecialty.getSpId());
@@ -105,10 +107,10 @@ public class ExamSpecialtyServiceImpl implements ExamSpecialtyService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteExamSpecialtyBySpIds(Long[] spIds) public int deleteExamSpecialtyBySpIds(Long[] spIds) {
{
return examSpecialtyMapper.deleteExamSpecialtyBySpIds(spIds); return examSpecialtyMapper.deleteExamSpecialtyBySpIds(spIds);
} }
/** /**
* 删除数据信息 * 删除数据信息
* *
@@ -116,8 +118,7 @@ public class ExamSpecialtyServiceImpl implements ExamSpecialtyService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteExamSpecialtyBySpId(Long spId) public int deleteExamSpecialtyBySpId(Long spId) {
{
return examSpecialtyMapper.deleteExamSpecialtyBySpId(spId); return examSpecialtyMapper.deleteExamSpecialtyBySpId(spId);
} }

View File

@@ -5,36 +5,48 @@
<mapper namespace="pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperSchemeMapper"> <mapper namespace="pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperSchemeMapper">
<resultMap type="EducationPaperScheme" id="EducationPaperSchemeResult"> <resultMap type="EducationPaperScheme" id="EducationPaperSchemeResult">
<result property="schemeId" column="scheme_id" /> <result property="schemeId" column="scheme_id"/>
<result property="taskId" column="task_id" /> <result property="taskId" column="task_id"/>
<result property="quTitle" column="qu_title" /> <result property="quTitle" column="qu_title"/>
<result property="spName" column="sp_name" /> <result property="spName" column="sp_name"/>
<result property="quLevel" column="qu_level" /> <result property="quLevel" column="qu_level"/>
<result property="keywords" column="keywords" /> <result property="keywords" column="keywords"/>
<result property="pointNames" column="point_names" /> <result property="pointNames" column="point_names"/>
<result property="quNumbers" column="qu_numbers" /> <result property="quNumbers" column="qu_numbers"/>
<result property="quScores" column="qu_scores" /> <result property="quScores" column="qu_scores"/>
<result property="subtotalScore" column="subtotal_score" /> <result property="subtotalScore" column="subtotal_score"/>
<result property="sort" column="sort" /> <result property="sort" column="sort"/>
</resultMap> </resultMap>
<sql id="selectEducationPaperSchemeVo"> <sql id="selectEducationPaperSchemeVo">
select scheme_id, task_id,qu_title,sp_name, qu_level, keywords, point_names, qu_numbers, qu_scores, subtotal_score,sort from education_paper_scheme select scheme_id,
task_id,
qu_title,
sp_name,
qu_level,
keywords,
point_names,
qu_numbers,
qu_scores,
subtotal_score,
sort
from education_paper_scheme
</sql> </sql>
<select id="selectEducationPaperSchemeList" parameterType="EducationPaperScheme" resultMap="EducationPaperSchemeResult"> <select id="selectEducationPaperSchemeList" parameterType="EducationPaperScheme"
resultMap="EducationPaperSchemeResult">
<include refid="selectEducationPaperSchemeVo"/> <include refid="selectEducationPaperSchemeVo"/>
<where> <where>
<if test="taskId != null and taskId != ''"> and task_id = #{taskId}</if> <if test="taskId != null and taskId != ''">and task_id = #{taskId}</if>
<if test="spName != null and spName != ''"> and sp_name like concat('%', #{spName}, '%')</if> <if test="spName != null and spName != ''">and sp_name like concat('%', #{spName}, '%')</if>
<if test="quLevel != null and quLevel != ''"> and qu_level = #{quLevel}</if> <if test="quLevel != null and quLevel != ''">and qu_level = #{quLevel}</if>
<if test="keywords != null and keywords != ''"> and keywords = #{keywords}</if> <if test="keywords != null and keywords != ''">and keywords = #{keywords}</if>
<if test="pointNames != null and pointNames != ''"> and point_names = #{pointNames}</if> <if test="pointNames != null and pointNames != ''">and point_names = #{pointNames}</if>
<if test="quNumbers != null and quNumbers != ''"> and qu_numbers = #{quNumbers}</if> <if test="quNumbers != null and quNumbers != ''">and qu_numbers = #{quNumbers}</if>
<if test="quScores != null and quScores != ''"> and qu_scores = #{quScores}</if> <if test="quScores != null and quScores != ''">and qu_scores = #{quScores}</if>
<if test="subtotalScore != null and subtotalScore != ''"> and subtotal_score = #{subtotalScore}</if> <if test="subtotalScore != null and subtotalScore != ''">and subtotal_score = #{subtotalScore}</if>
</where> </where>
order by sort asc order by sort asc
</select> </select>
<select id="selectEducationPaperSchemeBySchemeId" parameterType="String" resultMap="EducationPaperSchemeResult"> <select id="selectEducationPaperSchemeBySchemeId" parameterType="String" resultMap="EducationPaperSchemeResult">
@@ -42,10 +54,16 @@
where scheme_id = #{schemeId} where scheme_id = #{schemeId}
</select> </select>
<select id="selectEducationPaperTaskByTaskId" resultMap="EducationPaperSchemeResult"> <select id="selectEducationPaperTaskByTaskId" resultMap="EducationPaperSchemeResult">
select * from education_paper_scheme where task_id =#{taskid} order by sort asc select *
from education_paper_scheme
where task_id = #{taskid}
order by sort asc
</select> </select>
<select id="selectEducationPaperSchemeCountsByTaskId" resultType="java.lang.Integer"> <select id="selectEducationPaperSchemeCountsByTaskId" resultType="java.lang.Integer">
select count(*) from education_paper_scheme where task_id =#{taskId} select count(*)
from education_paper_scheme
where task_id = #{taskId}
</select> </select>
<insert id="insertEducationPaperScheme" parameterType="EducationPaperScheme"> <insert id="insertEducationPaperScheme" parameterType="EducationPaperScheme">
@@ -78,10 +96,12 @@
</trim> </trim>
</insert> </insert>
<insert id="insertEducationPaperSchemeList"> <insert id="insertEducationPaperSchemeList">
INSERT INTO education_paper_scheme (scheme_id, task_id, qu_title,sp_name, qu_level, keywords, point_names, qu_numbers, qu_scores, subtotal_score,sort) VALUES INSERT INTO education_paper_scheme (scheme_id, task_id, qu_title,sp_name, qu_level, keywords, point_names,
qu_numbers, qu_scores, subtotal_score,sort) VALUES
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
( (
#{item.schemeId}, #{item.taskId}, #{item.quTitle},#{item.spName}, #{item.quLevel}, #{item.keywords}, #{item.pointNames}, #{item.quNumbers}, #{item.quScores}, #{item.subtotalScore}, #{item.sort} #{item.schemeId}, #{item.taskId}, #{item.quTitle},#{item.spName}, #{item.quLevel}, #{item.keywords},
#{item.pointNames}, #{item.quNumbers}, #{item.quScores}, #{item.subtotalScore}, #{item.sort}
) )
</foreach> </foreach>
</insert> </insert>
@@ -95,7 +115,9 @@
</update> </update>
<delete id="deleteEducationPaperSchemeBySchemeId" parameterType="String"> <delete id="deleteEducationPaperSchemeBySchemeId" parameterType="String">
delete from education_paper_scheme where scheme_id = #{schemeId} delete
from education_paper_scheme
where scheme_id = #{schemeId}
</delete> </delete>
<delete id="deleteEducationPaperSchemeBySchemeIds" parameterType="String"> <delete id="deleteEducationPaperSchemeBySchemeIds" parameterType="String">

View File

@@ -1,49 +1,69 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pc.exam.pp.module.exam.dal.mysql.specialty.ExamSpecialtyMapper"> <mapper namespace="pc.exam.pp.module.exam.dal.mysql.specialty.ExamSpecialtyMapper">
<resultMap type="ExamSpecialty" id="ExamSpecialtyResult"> <resultMap type="ExamSpecialty" id="ExamSpecialtyResult">
<result property="spId" column="sp_id" /> <result property="spId" column="sp_id"/>
<result property="parentId" column="parent_id" /> <result property="parentId" column="parent_id"/>
<result property="ancestors" column="ancestors" /> <result property="ancestors" column="ancestors"/>
<result property="spName" column="sp_name" /> <result property="spName" column="sp_name"/>
<result property="orderNum" column="order_num" /> <result property="orderNum" column="order_num"/>
<result property="status" column="status" /> <result property="status" column="status"/>
<result property="unite" column="unite" /> <result property="unite" column="unite"/>
<result property="treeNum" column="tree_num" /> <result property="treeNum" column="tree_num"/>
<result property="roles" column="roles" /> <result property="roles" column="roles"/>
</resultMap> </resultMap>
<resultMap type="ExamKnowledgePoints" id="KnowledgePointsResult"> <resultMap type="ExamKnowledgePoints" id="KnowledgePointsResult">
<result property="spId" column="sp_id" /> <result property="spId" column="sp_id"/>
<result property="parentId" column="parent_id" /> <result property="parentId" column="parent_id"/>
<result property="ancestors" column="ancestors" /> <result property="ancestors" column="ancestors"/>
<result property="spName" column="sp_name" /> <result property="spName" column="sp_name"/>
<result property="orderNum" column="order_num" /> <result property="orderNum" column="order_num"/>
<result property="status" column="status" /> <result property="status" column="status"/>
<result property="treeNum" column="tree_num" /> <result property="treeNum" column="tree_num"/>
</resultMap> </resultMap>
<sql id="selectExamSpecialtyVo"> <sql id="selectExamSpecialtyVo">
select sp_id, parent_id, ancestors, sp_name, order_num, status, creator, create_time, updater, update_time, unite, tree_num, roles,tenant_id from exam_specialty select sp_id,
parent_id,
ancestors,
sp_name,
order_num,
status,
creator,
create_time,
updater,
update_time,
unite,
tree_num,
roles,
tenant_id
from exam_specialty
</sql> </sql>
<select id="selectExamSpecialtyListVo" resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo"> <select id="selectExamSpecialtyListVo"
resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo">
select sp_id as id, sp_name as name, parent_id, status, create_time,roles from exam_specialty select sp_id as id, sp_name as name, parent_id, status, create_time,roles from exam_specialty
<where> <where>
<if test="name != null and name != ''"> and sp_name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''">and sp_name like concat('%', #{name}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if> <if test="status != null and status != ''">and status = #{status}</if>
and deleted = 0 and deleted = 0
</where> </where>
</select> </select>
<select id="selectExamSpecialtyAll" resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo"> <select id="selectExamSpecialtyAll"
select sp_id as id, sp_name as name, parent_id, status, create_time from exam_specialty where deleted = 0 and status = 0 resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo">
select sp_id as id, sp_name as name, parent_id, status, create_time
from exam_specialty
where deleted = 0
and status = 0
</select> </select>
<select id="selectExamSpecialtyByids" resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo"> <select id="selectExamSpecialtyByids"
SELECT sp_id AS id, sp_name AS name, ancestors, parent_id, status, create_time from exam_specialty resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo">
SELECT sp_id AS id, sp_name AS name, ancestors, parent_id, status, create_time from exam_specialty
WHERE sp_id IN WHERE sp_id IN
<foreach collection="ids" item="id" open="(" separator="," close=")"> <foreach collection="ids" item="id" open="(" separator="," close=")">
#{id} #{id}
@@ -51,30 +71,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND deleted = 0 and status = 0 AND deleted = 0 and status = 0
</select> </select>
<select id="selectExamSpecialtyPart" resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo"> <select id="selectExamSpecialtyPart"
resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo">
select sp_id as id, sp_name as name, parent_id, status, create_time select sp_id as id, sp_name as name, parent_id, status, create_time
FROM exam_specialty FROM exam_specialty
WHERE WHERE (
( LENGTH(ancestors) - LENGTH(REPLACE(ancestors, ',', ''))
LENGTH(ancestors) - LENGTH(REPLACE(ancestors, ',', '')) ) + 1 &lt;= 2
) + 1 &lt;= 2 and status = 0 and deleted = 0 and status = 0
and deleted = 0
</select> </select>
<select id="selectExamSpecialtyList" resultType="ExamSpecialty"> <select id="selectExamSpecialtyList" resultType="ExamSpecialty">
<include refid="selectExamSpecialtyVo"/> <include refid="selectExamSpecialtyVo"/>
<where> <where>
<if test="name != null and name != ''"> and sp_name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''">and sp_name like concat('%', #{name}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if> <if test="status != null and status != ''">and status = #{status}</if>
and deleted = 0 and deleted = 0
</where> </where>
</select> </select>
<select id="selectSpIds" parameterType="ExamSpecialty" resultMap="ExamSpecialtyResult"> <select id="selectSpIds" parameterType="ExamSpecialty" resultMap="ExamSpecialtyResult">
<include refid="selectExamSpecialtyVo"/> <include refid="selectExamSpecialtyVo"/>
<!-- <where>--> <!-- <where>-->
<!-- <if test="spId != null "> and sp_id = #{spId}</if>--> <!-- <if test="spId != null "> and sp_id = #{spId}</if>-->
<!-- </where>--> <!-- </where>-->
where sp_id in where sp_id in
<foreach item="spId" collection="array" open="(" separator="," close=")"> <foreach item="spId" collection="array" open="(" separator="," close=")">
#{spId} #{spId}
@@ -101,17 +123,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where sp_id = #{spId} where sp_id = #{spId}
</select> </select>
<select id="selectExamSpecialtyByParentId" resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo"> <select id="selectExamSpecialtyBySpName" parameterType="String" resultType="pc.exam.pp.module.exam.dal.dataobject.specialty.ExamSpecialty">
SELECT sp_id AS id, sp_name AS name, ancestors, parent_id, status, create_time from exam_specialty SELECT *
from exam_specialty
where sp_name = #{spName}
</select>
<select id="selectExamSpecialtyByParentId"
resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo">
SELECT sp_id AS id, sp_name AS name, ancestors, parent_id, status, create_time
from exam_specialty
where parent_id = #{parentId} where parent_id = #{parentId}
</select> </select>
<select id="getRoleById" resultType="java.lang.String"> <select id="getRoleById" resultType="java.lang.String">
select roles select roles
from exam_specialty where sp_id =#{id}; from exam_specialty
where sp_id = #{id};
</select> </select>
<select id="selectBySpecCourseSub" resultMap="ExamSpecialtyResult"> <select id="selectBySpecCourseSub" resultMap="ExamSpecialtyResult">
SELECT SELECT q3.*
q3.*
FROM exam_specialty q1 FROM exam_specialty q1
JOIN exam_specialty q2 ON q2.parent_id = q1.sp_id JOIN exam_specialty q2 ON q2.parent_id = q1.sp_id
JOIN exam_specialty q3 ON q3.parent_id = q2.sp_id JOIN exam_specialty q3 ON q3.parent_id = q2.sp_id
@@ -120,12 +150,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND q3.sp_name = #{subjectName} AND q3.sp_name = #{subjectName}
AND q1.deleted = '0' AND q1.deleted = '0'
AND q2.deleted = '0' AND q2.deleted = '0'
AND q3.deleted = '0' AND q3.deleted = '0' LIMIT 1;
LIMIT 1;
</select> </select>
<select id="selectByPointsSub" resultMap="KnowledgePointsResult"> <select id="selectByPointsSub" resultMap="KnowledgePointsResult">
SELECT SELECT q3.*
q3.*
FROM exam_knowledge_points q1 FROM exam_knowledge_points q1
JOIN exam_knowledge_points q2 ON q2.parent_id = q1.sp_id JOIN exam_knowledge_points q2 ON q2.parent_id = q1.sp_id
JOIN exam_knowledge_points q3 ON q3.parent_id = q2.sp_id JOIN exam_knowledge_points q3 ON q3.parent_id = q2.sp_id
@@ -134,19 +162,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND q3.sp_name = #{pointNames} AND q3.sp_name = #{pointNames}
AND q1.deleted = '0' AND q1.deleted = '0'
AND q2.deleted = '0' AND q2.deleted = '0'
AND q3.deleted = '0' AND q3.deleted = '0' LIMIT 1;
LIMIT 1;
</select> </select>
<select id="selectAllSpecialtyRelations" <select id="selectAllSpecialtyRelations"
resultType="pc.exam.pp.module.exam.service.monitor.vo.SpecialtyRelation"> resultType="pc.exam.pp.module.exam.service.monitor.vo.SpecialtyRelation">
SELECT sp_id AS spId, parent_id AS parentId SELECT sp_id AS spId, parent_id AS parentId
FROM exam_specialty FROM exam_specialty
</select> </select>
<select id="selectAllIdToParent" resultType="pc.exam.pp.module.exam.service.monitor.vo.IdParentPair"> <select id="selectAllIdToParent" resultType="pc.exam.pp.module.exam.service.monitor.vo.IdParentPair">
SELECT sp_id AS spId, parent_id AS parentId SELECT sp_id AS spId, parent_id AS parentId
FROM exam_specialty FROM exam_specialty
WHERE deleted = '0' and status ='0' and tenant_id =#{loginTenantId} WHERE deleted = '0'
and status = '0'
and tenant_id = #{loginTenantId}
</select> </select>
@@ -155,7 +184,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
deleted = 1 deleted = 1
</trim> </trim>
where sp_id = #{spId} where sp_id = #{spId}
</update> </update>
<update id="deleteExamSpecialtyBySpIds" parameterType="String"> <update id="deleteExamSpecialtyBySpIds" parameterType="String">
@@ -163,7 +192,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
deleted = 1 deleted = 1
</trim> </trim>
where sp_id in where sp_id in
<foreach item="spId" collection="array" open="(" separator="," close=")"> <foreach item="spId" collection="array" open="(" separator="," close=")">
#{spId} #{spId}
</foreach> </foreach>