【修改】mysql判分分析,mysql出题增加数据库名,试卷换题增加关键字搜索
This commit is contained in:
@@ -31,4 +31,6 @@ public class QuestionVo extends PageParam {
|
|||||||
|
|
||||||
private String quNum;
|
private String quNum;
|
||||||
|
|
||||||
|
private String keywords;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -49,11 +49,11 @@ public class EducationPaperTask extends TenantBaseDO
|
|||||||
|
|
||||||
/** 是否为模板 */
|
/** 是否为模板 */
|
||||||
//@Excel(name = "是否为模板")
|
//@Excel(name = "是否为模板")
|
||||||
private String isTemplate;
|
private Integer isTemplate;
|
||||||
|
|
||||||
/** 是否启用(0:启用,1:停用) */
|
/** 是否启用(0:启用,1:停用) */
|
||||||
//@Excel(name = "是否启用", readConverterExp = "0=:启用,1:停用")
|
//@Excel(name = "是否启用", readConverterExp = "0=:启用,1:停用")
|
||||||
private String status;
|
private Integer status;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String count;
|
private String count;
|
||||||
|
@@ -99,6 +99,8 @@ public class ExamQuestion extends TenantBaseDO {
|
|||||||
/** 专业分类 */
|
/** 专业分类 */
|
||||||
// @Excel(name = "专业分类")
|
// @Excel(name = "专业分类")
|
||||||
private String specialtyName;
|
private String specialtyName;
|
||||||
|
/** 数据库名 */
|
||||||
|
private String tname;
|
||||||
|
|
||||||
/** 试题答案 */
|
/** 试题答案 */
|
||||||
// @Excel(name = "试题答案")
|
// @Excel(name = "试题答案")
|
||||||
|
@@ -42,6 +42,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
|||||||
return selectPage(questionVo, new LambdaQueryWrapperX<ExamQuestion>()
|
return selectPage(questionVo, new LambdaQueryWrapperX<ExamQuestion>()
|
||||||
.likeIfPresent(ExamQuestion::getQuNum, questionVo.getQuNum())
|
.likeIfPresent(ExamQuestion::getQuNum, questionVo.getQuNum())
|
||||||
.likeIfPresent(ExamQuestion::getQuId,questionVo.getQuId())
|
.likeIfPresent(ExamQuestion::getQuId,questionVo.getQuId())
|
||||||
|
.likeIfPresent(ExamQuestion::getKeywords,questionVo.getKeywords())
|
||||||
.likeIfPresent(ExamQuestion::getQuLevel, questionVo.getQuLevel())
|
.likeIfPresent(ExamQuestion::getQuLevel, questionVo.getQuLevel())
|
||||||
.likeIfPresent(ExamQuestion::getCourseName , questionVo.getCourseName())
|
.likeIfPresent(ExamQuestion::getCourseName , questionVo.getCourseName())
|
||||||
.likeIfPresent(ExamQuestion::getPointNames , questionVo.getPointNames())
|
.likeIfPresent(ExamQuestion::getPointNames , questionVo.getPointNames())
|
||||||
|
@@ -52,7 +52,7 @@ public class MonitorTaskServiceImpl implements MonitorTaskService{
|
|||||||
monitorTaskDO.setTaskType(educationPaperTask.getTaskType());
|
monitorTaskDO.setTaskType(educationPaperTask.getTaskType());
|
||||||
monitorTaskDO.setTaskName(educationPaperTask.getTaskName());
|
monitorTaskDO.setTaskName(educationPaperTask.getTaskName());
|
||||||
monitorTaskDO.setTaskNum(educationPaperTask.getTaskNum());
|
monitorTaskDO.setTaskNum(educationPaperTask.getTaskNum());
|
||||||
monitorTaskDO.setStatus(educationPaperTask.getStatus());
|
monitorTaskDO.setStatus(String.valueOf(educationPaperTask.getStatus()));
|
||||||
monitorTaskDO.setTaskSpecialty(educationPaperTask.getTaskSpecialty());
|
monitorTaskDO.setTaskSpecialty(educationPaperTask.getTaskSpecialty());
|
||||||
|
|
||||||
List<EducationPaper> educationPapers = educationPaperMapper.selectPaperListByTaskId(educationPaperTask.getTaskId());
|
List<EducationPaper> educationPapers = educationPaperMapper.selectPaperListByTaskId(educationPaperTask.getTaskId());
|
||||||
|
@@ -323,7 +323,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
|
|||||||
String timeString = now.format(formatter);
|
String timeString = now.format(formatter);
|
||||||
educationPaperTask.setTaskName(educationPaperTask.getTaskName()+timeString);
|
educationPaperTask.setTaskName(educationPaperTask.getTaskName()+timeString);
|
||||||
|
|
||||||
educationPaperTask.setIsTemplate("1");
|
educationPaperTask.setIsTemplate(1);
|
||||||
educationPaperTaskMapper.insertEducationPaperTask(educationPaperTask);
|
educationPaperTaskMapper.insertEducationPaperTask(educationPaperTask);
|
||||||
|
|
||||||
if (options.contains("1")) {
|
if (options.contains("1")) {
|
||||||
|
@@ -26,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="deleted" column="deleted" />
|
<result property="deleted" column="deleted" />
|
||||||
<result property="status" column="status" />
|
<result property="status" column="status" />
|
||||||
<result property="audit" column="audit" />
|
<result property="audit" column="audit" />
|
||||||
|
<result property="tname" column="tname" />
|
||||||
<result property="courseName" column="course_name" />
|
<result property="courseName" column="course_name" />
|
||||||
<result property="specialtyName" column="specialty_name" />
|
<result property="specialtyName" column="specialty_name" />
|
||||||
<result property="tenantId" column="tenant_id" />
|
<result property="tenantId" column="tenant_id" />
|
||||||
@@ -50,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="selectExamQuestionVo">
|
<sql id="selectExamQuestionVo">
|
||||||
select qu_id, qu_bank_id, qu_num,qu_bank_name, chapterId_dict_text,subject_name, qu_level,
|
select qu_id, qu_bank_id, qu_num,qu_bank_name, chapterId_dict_text,subject_name, qu_level,
|
||||||
content, content_text, analysis,answer, point_names, keywords, manual, create_time, creator, update_time, updater, deleted ,status,audit ,course_name, specialty_name from exam_question
|
content, content_text, analysis,answer, point_names, keywords, manual, create_time, creator, update_time, updater, deleted ,status,audit ,course_name, specialty_name , tname from exam_question
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
@@ -153,6 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="subjectName != null">subject_name,</if>
|
<if test="subjectName != null">subject_name,</if>
|
||||||
<if test="quLevel != null">qu_level,</if>
|
<if test="quLevel != null">qu_level,</if>
|
||||||
<if test="answer != null">answer,</if>
|
<if test="answer != null">answer,</if>
|
||||||
|
<if test="tname != null">tname,</if>
|
||||||
<if test="content != null">content,</if>
|
<if test="content != null">content,</if>
|
||||||
<if test="contentText != null">content_text,</if>
|
<if test="contentText != null">content_text,</if>
|
||||||
<if test="analysis != null">analysis,</if>
|
<if test="analysis != null">analysis,</if>
|
||||||
@@ -179,6 +181,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="subjectName != null">#{subjectName},</if>
|
<if test="subjectName != null">#{subjectName},</if>
|
||||||
<if test="quLevel != null">#{quLevel},</if>
|
<if test="quLevel != null">#{quLevel},</if>
|
||||||
<if test="answer != null">#{answer},</if>
|
<if test="answer != null">#{answer},</if>
|
||||||
|
<if test="tname != null">#{tname},</if>
|
||||||
<if test="content != null">#{content},</if>
|
<if test="content != null">#{content},</if>
|
||||||
<if test="contentText != null">#{contentText},</if>
|
<if test="contentText != null">#{contentText},</if>
|
||||||
<if test="analysis != null">#{analysis},</if>
|
<if test="analysis != null">#{analysis},</if>
|
||||||
@@ -200,14 +203,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</insert>
|
</insert>
|
||||||
<insert id="insertOrUpdateList">
|
<insert id="insertOrUpdateList">
|
||||||
|
|
||||||
INSERT INTO exam_question (qu_id, qu_bank_id, qu_num,chapterId_dict_text, subject_name,specialty_name, course_name, qu_level, content, audit, status, content_text, analysis, point_names, keywords, manual)
|
INSERT INTO exam_question (qu_id, qu_bank_id,tname, qu_num,chapterId_dict_text, subject_name,specialty_name, course_name, qu_level, content, audit, status, content_text, analysis, point_names, keywords, manual)
|
||||||
VALUES
|
VALUES
|
||||||
<foreach collection="collection" item="item" separator=",">
|
<foreach collection="collection" item="item" separator=",">
|
||||||
(#{item.quId}, #{item.quBankId},#{item.quNum}, #{item.chapteridDictText}, #{item.subjectName},
|
(#{item.quId}, #{item.quBankId},#{item.tname},#{item.quNum}, #{item.chapteridDictText}, #{item.subjectName},
|
||||||
#{item.specialtyName}, #{item.courseName}, #{item.quLevel}, #{item.content}, #{item.audit}
|
#{item.specialtyName}, #{item.courseName}, #{item.quLevel}, #{item.content}, #{item.audit}
|
||||||
, #{item.status}, #{item.contentText}, #{item.analysis}, #{item.pointNames}, #{item.keywords}, #{item.manual})
|
, #{item.status}, #{item.contentText}, #{item.analysis}, #{item.pointNames}, #{item.keywords}, #{item.manual})
|
||||||
</foreach>
|
</foreach>
|
||||||
ON DUPLICATE KEY UPDATE
|
ON DUPLICATE KEY UPDATE
|
||||||
|
tname== VALUES(tname),
|
||||||
chapterId_dict_text = VALUES(chapterId_dict_text),
|
chapterId_dict_text = VALUES(chapterId_dict_text),
|
||||||
subject_name = VALUES(subject_name),
|
subject_name = VALUES(subject_name),
|
||||||
specialty_name = VALUES(specialty_name),
|
specialty_name = VALUES(specialty_name),
|
||||||
@@ -234,6 +238,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="quLevel != null">qu_level = #{quLevel},</if>
|
<if test="quLevel != null">qu_level = #{quLevel},</if>
|
||||||
<if test="content != null">content = #{content},</if>
|
<if test="content != null">content = #{content},</if>
|
||||||
<if test="answer != null">answer = #{answer},</if>
|
<if test="answer != null">answer = #{answer},</if>
|
||||||
|
<if test="tname != null">tname = #{tname},</if>
|
||||||
<if test="contentText != null">content_text = #{contentText},</if>
|
<if test="contentText != null">content_text = #{contentText},</if>
|
||||||
<if test="analysis != null">analysis = #{analysis},</if>
|
<if test="analysis != null">analysis = #{analysis},</if>
|
||||||
<if test="pointNames != null">point_names = #{pointNames},</if>
|
<if test="pointNames != null">point_names = #{pointNames},</if>
|
||||||
|
@@ -11,6 +11,7 @@ import pc.exam.pp.module.exam.dal.dataobject.ExamQuestionKeyword;
|
|||||||
import pc.exam.pp.module.exam.dal.mysql.question.ExamMysqlKeywordMapper;
|
import pc.exam.pp.module.exam.dal.mysql.question.ExamMysqlKeywordMapper;
|
||||||
import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionAnswerMapper;
|
import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionAnswerMapper;
|
||||||
import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper;
|
import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper;
|
||||||
|
import pc.exam.pp.module.judgement.controller.service.mysql.vo.MysqlVo;
|
||||||
import pc.exam.pp.module.judgement.controller.utils.Mysql.MySQLExporterUtil;
|
import pc.exam.pp.module.judgement.controller.utils.Mysql.MySQLExporterUtil;
|
||||||
import pc.exam.pp.module.judgement.controller.utils.Mysql.SQLComparatorUtil;
|
import pc.exam.pp.module.judgement.controller.utils.Mysql.SQLComparatorUtil;
|
||||||
import pc.exam.pp.module.judgement.controller.utils.Mysql.SqlFileProcessor;
|
import pc.exam.pp.module.judgement.controller.utils.Mysql.SqlFileProcessor;
|
||||||
@@ -287,8 +288,8 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
table1Columns.add(column);
|
table1Columns.add(column);
|
||||||
|
|
||||||
}
|
}
|
||||||
appendToFile(answerLogPath, "标准答案建表键值对:"+table1Columns);
|
// appendToFile(answerLogPath, "标准答案建表键值对:"+table1Columns);
|
||||||
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "标准答案建表键值对:"+table1Columns);
|
// judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "标准答案建表键值对:"+table1Columns);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -306,19 +307,27 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
column.put("EXTRA", rsstu.getString("EXTRA"));
|
column.put("EXTRA", rsstu.getString("EXTRA"));
|
||||||
table2Columns.add(column);
|
table2Columns.add(column);
|
||||||
}
|
}
|
||||||
appendToFile(answerLogPath, "学生答案建表键值对:"+table2Columns);
|
// appendToFile(answerLogPath, "学生答案建表键值对:"+table2Columns);
|
||||||
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "学生答案建表键值对:"+table2Columns);
|
// judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "学生答案建表键值对:"+table2Columns);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String sql3 = resultStu.get(entry.getKey());
|
String sql3 = resultStu.get(entry.getKey());
|
||||||
|
Matcher matcherStu = pattern.matcher(sql3);
|
||||||
|
String tableNameStu ="";
|
||||||
|
if (matcherStu.find()) {
|
||||||
|
tableNameStu= matcherStu.group(1).replace("`", ""); // 获取表名
|
||||||
|
}
|
||||||
|
String yuju= compareTables(table1Columns, table2Columns, examQuestion.getTname(),tableName, tableNameStu,judgementStr);
|
||||||
|
judgementStr=yuju;
|
||||||
|
|
||||||
if (table1Columns.equals(table2Columns)) {
|
if (table1Columns.equals(table2Columns)) {
|
||||||
//
|
//
|
||||||
SourceAndText studentScorePojo = accumulateScoreAndLog(examMysqlKeywordList,total,answerLogPath,sql3,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
SourceAndText studentScorePojo = accumulateScoreAndLog(examMysqlKeywordList,total,answerLogPath,sql3,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
||||||
scoreTotal += studentScorePojo.getScore();
|
scoreTotal += studentScorePojo.getScore();
|
||||||
judgementStr = studentScorePojo.getText();
|
judgementStr = studentScorePojo.getText();
|
||||||
} else {
|
} else {
|
||||||
SourceAndText studentScorePojo= calculateTotalScoreRate(sql2, examMysqlKeywordList,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
SourceAndText studentScorePojo= calculateTotalScoreRate(sql3, examMysqlKeywordList,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
||||||
scoreTotal += studentScorePojo.getScore();
|
scoreTotal += studentScorePojo.getScore();
|
||||||
judgementStr = studentScorePojo.getText();
|
judgementStr = studentScorePojo.getText();
|
||||||
}
|
}
|
||||||
@@ -788,7 +797,8 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
if (equals) {
|
if (equals) {
|
||||||
//todo 得分
|
//todo 得分
|
||||||
SourceAndText studentScorePojo = accumulateScoreAndLog(examMysqlKeywordList, total, answerLogPath, sql2, totalKeyScore, score, answerId, scoreTotal,judgementStr);
|
SourceAndText studentScorePojo = accumulateScoreAndLog(examMysqlKeywordList, total, answerLogPath, sql2, totalKeyScore, score, answerId, scoreTotal,judgementStr);
|
||||||
|
scoreTotal += studentScorePojo.getScore();
|
||||||
|
judgementStr = studentScorePojo.getText();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
SourceAndText studentScorePojo = calculateTotalScoreRate(sql2, examMysqlKeywordList, totalKeyScore, score, answerId, scoreTotal,judgementStr);
|
SourceAndText studentScorePojo = calculateTotalScoreRate(sql2, examMysqlKeywordList, totalKeyScore, score, answerId, scoreTotal,judgementStr);
|
||||||
@@ -824,7 +834,88 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
return sourceAndText;
|
return sourceAndText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String compareTables(Set<Map<String, String>> standardSet, Set<Map<String, String>> studentSet, String dbTable, String tableName,String tableNameStu,String judgementStr) {
|
||||||
|
String yuju="";
|
||||||
|
int index = 1;
|
||||||
|
// 判断表名是否一致
|
||||||
|
String tableNameCheck = tableName.equalsIgnoreCase(tableNameStu) ? "✔" : "x";
|
||||||
|
|
||||||
|
// 输出
|
||||||
|
System.out.printf("%02d.【数据表】【%s】【名称】【%s】【%s】\n", index, dbTable, tableName, tableNameCheck);
|
||||||
|
appendToFile(answerLogPath, "%02d.【数据表】【%s】【名称】【%s】【%s】\n", index, dbTable, tableName, tableNameCheck);
|
||||||
|
judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "%02d.【数据表】【%s】【名称】【%s】【%s】\n", index, dbTable, tableName, tableNameCheck);
|
||||||
|
// 把Set转成Map,方便通过字段名快速取值
|
||||||
|
Map<String, Map<String, String>> standardMap = convertSetToMap(standardSet);
|
||||||
|
Map<String, Map<String, String>> studentMap = convertSetToMap(studentSet);
|
||||||
|
|
||||||
|
for (String columnName : standardMap.keySet()) {
|
||||||
|
Map<String, String> stdCol = standardMap.get(columnName);
|
||||||
|
Map<String, String> stuCol = studentMap.get(columnName);
|
||||||
|
|
||||||
|
String fullName = dbTable + "." + columnName;
|
||||||
|
|
||||||
|
String nameCheck = stuCol != null ? "✔" : "x";
|
||||||
|
judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "%02d.【字段】【%s】【名称】【%s】【%s】\n", index++, fullName, columnName, nameCheck);
|
||||||
|
appendToFile(answerLogPath, "%02d.【字段】【%s】【名称】【%s】【%s】\n", index++, fullName, columnName, nameCheck);
|
||||||
|
|
||||||
|
if (stuCol != null) {
|
||||||
|
MysqlVo mysqlVo1 = compareField(index, fullName, "类型", stdCol.get("COLUMN_TYPE"), stuCol.get("COLUMN_TYPE"),judgementStr);
|
||||||
|
index=mysqlVo1.getIndex();
|
||||||
|
yuju=mysqlVo1.getText();
|
||||||
|
MysqlVo mysqlVo2 = compareField(index, fullName, "允许为空", stdCol.get("IS_NULLABLE"), stuCol.get("IS_NULLABLE"),yuju);
|
||||||
|
index=mysqlVo2.getIndex();
|
||||||
|
yuju=mysqlVo2.getText();
|
||||||
|
MysqlVo mysqlVo3 = compareField(index, fullName, "扩展", stdCol.get("EXTRA"), stuCol.get("EXTRA"),yuju);
|
||||||
|
index=mysqlVo3.getIndex();
|
||||||
|
yuju=mysqlVo3.getText();
|
||||||
|
MysqlVo mysqlVo4 = compareField(index, fullName, "键类型", stdCol.get("COLUMN_KEY"), stuCol.get("COLUMN_KEY"),yuju);
|
||||||
|
yuju=mysqlVo4.getText();
|
||||||
|
} else {
|
||||||
|
// 缺失字段,直接输出所有属性错误
|
||||||
|
MysqlVo mysqlVo1 = printMissing(index, fullName, "类型", stdCol.get("COLUMN_TYPE"),judgementStr);
|
||||||
|
index=mysqlVo1.getIndex();
|
||||||
|
yuju=mysqlVo1.getText();
|
||||||
|
MysqlVo mysqlVo2 = printMissing(index, fullName, "允许为空", stdCol.get("IS_NULLABLE"),yuju);
|
||||||
|
index=mysqlVo2.getIndex();
|
||||||
|
yuju=mysqlVo2.getText();
|
||||||
|
MysqlVo mysqlVo3 = printMissing(index, fullName, "扩展", stdCol.get("EXTRA"),yuju);
|
||||||
|
index=mysqlVo3.getIndex();
|
||||||
|
yuju=mysqlVo3.getText();
|
||||||
|
MysqlVo mysqlVo4 = printMissing(index, fullName, "键类型", stdCol.get("COLUMN_KEY"),yuju);
|
||||||
|
yuju=mysqlVo4.getText();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return yuju;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MysqlVo compareField(int index, String fullName, String property, String stdValue, String stuValue, String judgementStr) {
|
||||||
|
MysqlVo mysqlVo=new MysqlVo();
|
||||||
|
String mark = stdValue.equalsIgnoreCase(stuValue) ? "✔" : "x";
|
||||||
|
System.out.printf("%02d.【字段】【%s】【%s】【%s】【%s】\n", index, fullName, property, stuValue, mark);
|
||||||
|
appendToFile(answerLogPath, "%02d.【字段】【%s】【%s】【%s】【%s】\n", index, fullName, property, stuValue, mark);
|
||||||
|
judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "%02d.【字段】【%s】【%s】【%s】【%s】\n", index, fullName, property, stuValue, mark);
|
||||||
|
mysqlVo.setText(judgementStr);
|
||||||
|
mysqlVo.setIndex(index + 1);
|
||||||
|
return mysqlVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MysqlVo printMissing(int index, String fullName, String property, String stdValue,String judgementStr) {
|
||||||
|
MysqlVo mysqlVo=new MysqlVo();
|
||||||
|
System.out.printf("%02d.【字段】【%s】【%s】【%s】【x】\n", index, fullName, property, stdValue);
|
||||||
|
appendToFile(answerLogPath, "%02d.【字段】【%s】【%s】【%s】【x】\n", index, fullName, property, stdValue);
|
||||||
|
judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "%02d.【字段】【%s】【%s】【%s】【x】\n", index, fullName, property, stdValue);
|
||||||
|
mysqlVo.setText(judgementStr);
|
||||||
|
mysqlVo.setIndex(index + 1);
|
||||||
|
return mysqlVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Map<String, Map<String, String>> convertSetToMap(Set<Map<String, String>> set) {
|
||||||
|
Map<String, Map<String, String>> map = new LinkedHashMap<>();
|
||||||
|
for (Map<String, String> column : set) {
|
||||||
|
map.put(column.get("COLUMN_NAME"), column);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
public static void deleteFolder(File folder) {
|
public static void deleteFolder(File folder) {
|
||||||
if (folder.isDirectory()) {
|
if (folder.isDirectory()) {
|
||||||
File[] files = folder.listFiles();
|
File[] files = folder.listFiles();
|
||||||
@@ -1448,4 +1539,16 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static void appendToFile(String filePath, String format, Object... args) {
|
||||||
|
try (BufferedWriter writer = new BufferedWriter(new FileWriter(filePath, true))) {
|
||||||
|
String timestamp = LocalDateTime.now().format(formatter);
|
||||||
|
String content = String.format(format, args);
|
||||||
|
String logLine = String.format("[%s] %s", timestamp, content);
|
||||||
|
writer.write(logLine);
|
||||||
|
writer.newLine(); // 可选:添加换行符
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -0,0 +1,16 @@
|
|||||||
|
package pc.exam.pp.module.judgement.controller.service.mysql.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MysqlVo {
|
||||||
|
/**
|
||||||
|
* 序列
|
||||||
|
*/
|
||||||
|
private int index;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文本
|
||||||
|
*/
|
||||||
|
private String text;
|
||||||
|
}
|
@@ -20,6 +20,18 @@ public class HtmlAppender {
|
|||||||
|
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
public static String appendHtmlLineMysql(String originalText, String format, Object... args) {
|
||||||
|
StringBuilder result = new StringBuilder(originalText == null ? "" : originalText);
|
||||||
|
|
||||||
|
if (format != null && !format.isEmpty()) {
|
||||||
|
String newLine = String.format(format, args);
|
||||||
|
result.append("<p>")
|
||||||
|
.append(escapeHtml(newLine))
|
||||||
|
.append("</p>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
|
||||||
// 简单HTML转义,防止注入攻击
|
// 简单HTML转义,防止注入攻击
|
||||||
private static String escapeHtml(String text) {
|
private static String escapeHtml(String text) {
|
||||||
|
BIN
word/试卷.docx
BIN
word/试卷.docx
Binary file not shown.
Reference in New Issue
Block a user