delete judge.tid

This commit is contained in:
Himit_ZH 2021-12-19 10:55:02 +08:00
parent 3921ddb2e2
commit 71aa59310b
12 changed files with 104 additions and 25 deletions

View File

@ -113,7 +113,7 @@ public class JudgeController {
boolean isContestSubmission = judgeDto.getCid() != 0;
boolean isTrainingSubmission = judgeDto.getTid() != null;
boolean isTrainingSubmission = judgeDto.getTid() != null && judgeDto.getTid() != 0;
if (!isContestSubmission) { // 非比赛提交限制8秒提交一次
String lockKey = Constants.Account.SUBMIT_NON_CONTEST_LOCK.getCode() + userRolesVo.getUid();
@ -134,7 +134,6 @@ public class JudgeController {
judge.setShare(false) // 默认设置代码为单独自己可见
.setCode(judgeDto.getCode())
.setCid(judgeDto.getCid())
.setTid(judgeDto.getTid())
.setLanguage(judgeDto.getLanguage())
.setLength(judgeDto.getCode().length())
.setUid(userRolesVo.getUid())
@ -392,7 +391,6 @@ public class JudgeController {
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "onlyMine", required = false) Boolean onlyMine,
@RequestParam(value = "problemID", required = false) String searchPid,
@RequestParam(value = "tid", required = false) Long tid,
@RequestParam(value = "status", required = false) Integer searchStatus,
@RequestParam(value = "username", required = false) String searchUsername,
@RequestParam(value = "completeProblemID", defaultValue = "false") Boolean completeProblemID,
@ -426,7 +424,6 @@ public class JudgeController {
searchStatus,
searchUsername,
uid,
tid,
completeProblemID);
if (commonJudgeList.getTotal() == 0) { // 未查询到一条数据

View File

@ -82,6 +82,7 @@ public class TrainingController {
* @Since 2021/11/20
*/
@GetMapping("/get-training-detail")
@RequiresAuthentication
public CommonResult getTraining(@RequestParam(value = "tid") Long tid, HttpServletRequest request) {
Training training = trainingService.getById(tid);
@ -121,6 +122,7 @@ public class TrainingController {
* @Since 2021/11/20
*/
@GetMapping("/get-training-problem-list")
@RequiresAuthentication
public CommonResult getTrainingProblemList(@RequestParam(value = "tid") Long tid, HttpServletRequest request) {
Training training = trainingService.getById(tid);

View File

@ -30,7 +30,6 @@ public interface JudgeMapper extends BaseMapper<Judge> {
@Param("status") Integer status,
@Param("username") String username,
@Param("uid") String uid,
@Param("tid") Long tid,
@Param("completeProblemID") Boolean completeProblemID);
IPage<JudgeVo> getContestJudgeList(Page<JudgeVo> page,

View File

@ -24,9 +24,6 @@
<if test="uid!=null and uid!=''">
AND j.uid = #{uid}
</if>
<if test="tid!=null">
AND j.tid = #{tid}
</if>
</where>
order by j.submit_time DESC,j.submit_id DESC
</select>

View File

@ -32,7 +32,6 @@ public interface JudgeService extends IService<Judge> {
Integer status,
String username,
String uid,
Long tid,
Boolean completeProblemID);
IPage<JudgeVo> getContestJudgeList(Integer limit,

View File

@ -50,7 +50,7 @@ public class JudgeServiceImpl extends ServiceImpl<JudgeMapper, Judge> implements
QueryWrapper<Problem> problemQueryWrapper = new QueryWrapper<>();
problemQueryWrapper.eq("problem_id", judgeDto.getPid());
Problem problem = problemService.getOne(problemQueryWrapper,false);
Problem problem = problemService.getOne(problemQueryWrapper, false);
if (problem.getAuth() == 2) {
return CommonResult.errorResponse("错误!当前题目不可提交!", CommonResult.STATUS_FORBIDDEN);
@ -70,12 +70,11 @@ public class JudgeServiceImpl extends ServiceImpl<JudgeMapper, Judge> implements
Integer status,
String username,
String uid,
Long tid,
Boolean completeProblemID) {
//新建分页
Page<JudgeVo> page = new Page<>(currentPage, limit);
return judgeMapper.getCommonJudgeList(page, searchPid, status, username, uid, tid, completeProblemID);
return judgeMapper.getCommonJudgeList(page, searchPid, status, username, uid, completeProblemID);
}
@Override

View File

@ -98,7 +98,7 @@ public class TrainingRecordServiceImpl extends ServiceImpl<TrainingRecordMapper,
TrainingRecord trainingRecord = new TrainingRecord();
trainingRecord.setPid(problem.getId())
.setTid(judge.getTid())
.setTid(judgeDto.getTid())
.setTpid(trainingProblem.getId())
.setSubmitId(judge.getSubmitId())
.setUid(userRolesVo.getUid());

View File

@ -82,9 +82,6 @@ public class Judge implements Serializable {
@ApiModelProperty(value = "比赛中题目排序id非比赛提交默认为0")
private Long cpid;
@ApiModelProperty(value = "训练id非训练提交默认为null")
private Long tid;
@ApiModelProperty(value = "判题机名称")
private String judger;

View File

@ -663,7 +663,7 @@ export default {
captchaSrc: '',
contestID: 0,
problemID: '',
trainingID: 0,
trainingID: null,
submitting: false,
code: '',
language: '',

View File

@ -16,6 +16,13 @@
<section>
<b class="training-category">{{ $t('m.Training_Category') }}</b>
<div>
<el-tag
size="medium"
class="category-item"
:style="getCategoryBlockColor(null)"
@click="filterByCategory(null)"
>{{ $t('m.All') }}</el-tag
>
<el-tag
size="medium"
class="category-item"
@ -139,6 +146,8 @@
import api from '@/common/api';
import utils from '@/common/utils';
import { TRAINING_TYPE } from '@/common/constants';
import myMessage from '@/common/message';
import { mapGetters } from 'vuex';
const Pagination = () => import('@/components/oj/common/Pagination');
export default {
name: 'TrainingList',
@ -209,10 +218,15 @@ export default {
},
toTraining(trainingID) {
this.$router.push({
name: 'TrainingDetails',
params: { trainingID: trainingID },
});
if (!this.isAuthenticated) {
myMessage.warning(this.$i18n.t('m.Please_login_first'));
this.$store.dispatch('changeModalStatus', { visible: true });
} else {
this.$router.push({
name: 'TrainingDetails',
params: { trainingID: trainingID },
});
}
},
goUserHome(username) {
this.$router.push({
@ -222,6 +236,14 @@ export default {
},
getCategoryBlockColor(category) {
if (category == null) {
if (!this.query.categoryId) {
return 'color: #fff;background-color: #409EFF;background-color: #409EFF';
} else {
return 'background-color: #fff;color: #409EFF;border-color: #409EFF';
}
}
if (category.id == this.query.categoryId) {
return (
'color: #fff;background-color: ' +
@ -241,6 +263,9 @@ export default {
}
},
},
computed: {
...mapGetters(['isAuthenticated']),
},
watch: {
$route(newVal, oldVal) {
if (newVal !== oldVal) {

View File

@ -524,3 +524,68 @@ DELIMITER ;
CALL contest_Add_auto_real_rank;
DROP PROCEDURE contest_Add_auto_real_rank;
/*
* 2021.12.07 contest增加打星账号列表
*/
DROP PROCEDURE
IF EXISTS contest_Add_star_account_And_open_rank;
DELIMITER $$
CREATE PROCEDURE contest_Add_star_account_And_open_rank ()
BEGIN
IF NOT EXISTS (
SELECT
1
FROM
information_schema.`COLUMNS`
WHERE
table_name = 'contest'
AND column_name = 'star_account'
) THEN
ALTER TABLE `hoj`.`contest` ADD COLUMN `star_account` mediumtext COMMENT '打星用户列表';
ALTER TABLE `hoj`.`contest` ADD COLUMN `open_rank` BOOLEAN DEFAULT 0 NULL COMMENT '是否开放比赛榜单';
END
IF ; END$$
DELIMITER ;
CALL contest_Add_star_account_And_open_rank ;
DROP PROCEDURE contest_Add_star_account_And_open_rank;
/*
* 2021.12.19 judge表删除tid
*/
DROP PROCEDURE
IF EXISTS judge_Delete_tid;
DELIMITER $$
CREATE PROCEDURE judge_Delete_tid ()
BEGIN
IF EXISTS (
SELECT
1
FROM
information_schema.`COLUMNS`
WHERE
table_name = 'judge'
AND column_name = 'tid'
) THEN
ALTER TABLE `hoj`.`judge` DROP foreign key `judge_ibfk_4`;
ALTER TABLE `hoj`.`judge` DROP COLUMN `tid`;
END
IF ; END$$
DELIMITER ;
CALL judge_Delete_tid ;
DROP PROCEDURE judge_Delete_tid;

View File

@ -149,6 +149,8 @@ CREATE TABLE `contest` (
`open_account_limit` tinyint(1) DEFAULT '0' COMMENT '是否开启账号限制',
`account_limit_rule` mediumtext COMMENT '账号限制规则',
`rank_show_name` varchar(20) DEFAULT 'username' COMMENT '排行榜显示username、nickname、realname',
`open_rank` tinyint(1) DEFAULT '0' COMMENT '是否开放比赛榜单',
`star_account` mediumtext COMMENT '打星用户列表',
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP,
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`,`uid`),
@ -414,7 +416,6 @@ CREATE TABLE `judge` (
`language` varchar(30) DEFAULT NULL COMMENT '代码语言',
`cid` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '比赛id非比赛题目默认为0',
`cpid` bigint(20) unsigned DEFAULT '0' COMMENT '比赛中题目排序id非比赛题目默认为0',
`tid` bigint unsigned DEFAULT NULL,
`judger` varchar(20) DEFAULT NULL COMMENT '判题机ip',
`ip` varchar(20) DEFAULT NULL COMMENT '提交者所在ip',
`version` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁',
@ -428,11 +429,9 @@ CREATE TABLE `judge` (
KEY `pid` (`pid`),
KEY `uid` (`uid`),
KEY `username` (`username`),
KEY `tid` (`tid`),
CONSTRAINT `judge_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `problem` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `judge_ibfk_2` FOREIGN KEY (`uid`) REFERENCES `user_info` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `judge_ibfk_3` FOREIGN KEY (`username`) REFERENCES `user_info` (`username`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `judge_ibfk_4` FOREIGN KEY (`tid`) REFERENCES `training` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
CONSTRAINT `judge_ibfk_3` FOREIGN KEY (`username`) REFERENCES `user_info` (`username`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
/*Table structure for table `judge_case` */