delete judge.tid
This commit is contained in:
parent
3921ddb2e2
commit
71aa59310b
|
@ -113,7 +113,7 @@ public class JudgeController {
|
||||||
|
|
||||||
boolean isContestSubmission = judgeDto.getCid() != 0;
|
boolean isContestSubmission = judgeDto.getCid() != 0;
|
||||||
|
|
||||||
boolean isTrainingSubmission = judgeDto.getTid() != null;
|
boolean isTrainingSubmission = judgeDto.getTid() != null && judgeDto.getTid() != 0;
|
||||||
|
|
||||||
if (!isContestSubmission) { // 非比赛提交限制8秒提交一次
|
if (!isContestSubmission) { // 非比赛提交限制8秒提交一次
|
||||||
String lockKey = Constants.Account.SUBMIT_NON_CONTEST_LOCK.getCode() + userRolesVo.getUid();
|
String lockKey = Constants.Account.SUBMIT_NON_CONTEST_LOCK.getCode() + userRolesVo.getUid();
|
||||||
|
@ -134,7 +134,6 @@ public class JudgeController {
|
||||||
judge.setShare(false) // 默认设置代码为单独自己可见
|
judge.setShare(false) // 默认设置代码为单独自己可见
|
||||||
.setCode(judgeDto.getCode())
|
.setCode(judgeDto.getCode())
|
||||||
.setCid(judgeDto.getCid())
|
.setCid(judgeDto.getCid())
|
||||||
.setTid(judgeDto.getTid())
|
|
||||||
.setLanguage(judgeDto.getLanguage())
|
.setLanguage(judgeDto.getLanguage())
|
||||||
.setLength(judgeDto.getCode().length())
|
.setLength(judgeDto.getCode().length())
|
||||||
.setUid(userRolesVo.getUid())
|
.setUid(userRolesVo.getUid())
|
||||||
|
@ -392,7 +391,6 @@ public class JudgeController {
|
||||||
@RequestParam(value = "currentPage", required = false) Integer currentPage,
|
@RequestParam(value = "currentPage", required = false) Integer currentPage,
|
||||||
@RequestParam(value = "onlyMine", required = false) Boolean onlyMine,
|
@RequestParam(value = "onlyMine", required = false) Boolean onlyMine,
|
||||||
@RequestParam(value = "problemID", required = false) String searchPid,
|
@RequestParam(value = "problemID", required = false) String searchPid,
|
||||||
@RequestParam(value = "tid", required = false) Long tid,
|
|
||||||
@RequestParam(value = "status", required = false) Integer searchStatus,
|
@RequestParam(value = "status", required = false) Integer searchStatus,
|
||||||
@RequestParam(value = "username", required = false) String searchUsername,
|
@RequestParam(value = "username", required = false) String searchUsername,
|
||||||
@RequestParam(value = "completeProblemID", defaultValue = "false") Boolean completeProblemID,
|
@RequestParam(value = "completeProblemID", defaultValue = "false") Boolean completeProblemID,
|
||||||
|
@ -426,7 +424,6 @@ public class JudgeController {
|
||||||
searchStatus,
|
searchStatus,
|
||||||
searchUsername,
|
searchUsername,
|
||||||
uid,
|
uid,
|
||||||
tid,
|
|
||||||
completeProblemID);
|
completeProblemID);
|
||||||
|
|
||||||
if (commonJudgeList.getTotal() == 0) { // 未查询到一条数据
|
if (commonJudgeList.getTotal() == 0) { // 未查询到一条数据
|
||||||
|
|
|
@ -82,6 +82,7 @@ public class TrainingController {
|
||||||
* @Since 2021/11/20
|
* @Since 2021/11/20
|
||||||
*/
|
*/
|
||||||
@GetMapping("/get-training-detail")
|
@GetMapping("/get-training-detail")
|
||||||
|
@RequiresAuthentication
|
||||||
public CommonResult getTraining(@RequestParam(value = "tid") Long tid, HttpServletRequest request) {
|
public CommonResult getTraining(@RequestParam(value = "tid") Long tid, HttpServletRequest request) {
|
||||||
|
|
||||||
Training training = trainingService.getById(tid);
|
Training training = trainingService.getById(tid);
|
||||||
|
@ -121,6 +122,7 @@ public class TrainingController {
|
||||||
* @Since 2021/11/20
|
* @Since 2021/11/20
|
||||||
*/
|
*/
|
||||||
@GetMapping("/get-training-problem-list")
|
@GetMapping("/get-training-problem-list")
|
||||||
|
@RequiresAuthentication
|
||||||
public CommonResult getTrainingProblemList(@RequestParam(value = "tid") Long tid, HttpServletRequest request) {
|
public CommonResult getTrainingProblemList(@RequestParam(value = "tid") Long tid, HttpServletRequest request) {
|
||||||
|
|
||||||
Training training = trainingService.getById(tid);
|
Training training = trainingService.getById(tid);
|
||||||
|
|
|
@ -30,7 +30,6 @@ public interface JudgeMapper extends BaseMapper<Judge> {
|
||||||
@Param("status") Integer status,
|
@Param("status") Integer status,
|
||||||
@Param("username") String username,
|
@Param("username") String username,
|
||||||
@Param("uid") String uid,
|
@Param("uid") String uid,
|
||||||
@Param("tid") Long tid,
|
|
||||||
@Param("completeProblemID") Boolean completeProblemID);
|
@Param("completeProblemID") Boolean completeProblemID);
|
||||||
|
|
||||||
IPage<JudgeVo> getContestJudgeList(Page<JudgeVo> page,
|
IPage<JudgeVo> getContestJudgeList(Page<JudgeVo> page,
|
||||||
|
|
|
@ -24,9 +24,6 @@
|
||||||
<if test="uid!=null and uid!=''">
|
<if test="uid!=null and uid!=''">
|
||||||
AND j.uid = #{uid}
|
AND j.uid = #{uid}
|
||||||
</if>
|
</if>
|
||||||
<if test="tid!=null">
|
|
||||||
AND j.tid = #{tid}
|
|
||||||
</if>
|
|
||||||
</where>
|
</where>
|
||||||
order by j.submit_time DESC,j.submit_id DESC
|
order by j.submit_time DESC,j.submit_id DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -32,7 +32,6 @@ public interface JudgeService extends IService<Judge> {
|
||||||
Integer status,
|
Integer status,
|
||||||
String username,
|
String username,
|
||||||
String uid,
|
String uid,
|
||||||
Long tid,
|
|
||||||
Boolean completeProblemID);
|
Boolean completeProblemID);
|
||||||
|
|
||||||
IPage<JudgeVo> getContestJudgeList(Integer limit,
|
IPage<JudgeVo> getContestJudgeList(Integer limit,
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class JudgeServiceImpl extends ServiceImpl<JudgeMapper, Judge> implements
|
||||||
|
|
||||||
QueryWrapper<Problem> problemQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<Problem> problemQueryWrapper = new QueryWrapper<>();
|
||||||
problemQueryWrapper.eq("problem_id", judgeDto.getPid());
|
problemQueryWrapper.eq("problem_id", judgeDto.getPid());
|
||||||
Problem problem = problemService.getOne(problemQueryWrapper,false);
|
Problem problem = problemService.getOne(problemQueryWrapper, false);
|
||||||
|
|
||||||
if (problem.getAuth() == 2) {
|
if (problem.getAuth() == 2) {
|
||||||
return CommonResult.errorResponse("错误!当前题目不可提交!", CommonResult.STATUS_FORBIDDEN);
|
return CommonResult.errorResponse("错误!当前题目不可提交!", CommonResult.STATUS_FORBIDDEN);
|
||||||
|
@ -70,12 +70,11 @@ public class JudgeServiceImpl extends ServiceImpl<JudgeMapper, Judge> implements
|
||||||
Integer status,
|
Integer status,
|
||||||
String username,
|
String username,
|
||||||
String uid,
|
String uid,
|
||||||
Long tid,
|
|
||||||
Boolean completeProblemID) {
|
Boolean completeProblemID) {
|
||||||
//新建分页
|
//新建分页
|
||||||
Page<JudgeVo> page = new Page<>(currentPage, limit);
|
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
|
@Override
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class TrainingRecordServiceImpl extends ServiceImpl<TrainingRecordMapper,
|
||||||
|
|
||||||
TrainingRecord trainingRecord = new TrainingRecord();
|
TrainingRecord trainingRecord = new TrainingRecord();
|
||||||
trainingRecord.setPid(problem.getId())
|
trainingRecord.setPid(problem.getId())
|
||||||
.setTid(judge.getTid())
|
.setTid(judgeDto.getTid())
|
||||||
.setTpid(trainingProblem.getId())
|
.setTpid(trainingProblem.getId())
|
||||||
.setSubmitId(judge.getSubmitId())
|
.setSubmitId(judge.getSubmitId())
|
||||||
.setUid(userRolesVo.getUid());
|
.setUid(userRolesVo.getUid());
|
||||||
|
|
|
@ -82,9 +82,6 @@ public class Judge implements Serializable {
|
||||||
@ApiModelProperty(value = "比赛中题目排序id,非比赛提交默认为0")
|
@ApiModelProperty(value = "比赛中题目排序id,非比赛提交默认为0")
|
||||||
private Long cpid;
|
private Long cpid;
|
||||||
|
|
||||||
@ApiModelProperty(value = "训练id,非训练提交默认为null")
|
|
||||||
private Long tid;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "判题机名称")
|
@ApiModelProperty(value = "判题机名称")
|
||||||
private String judger;
|
private String judger;
|
||||||
|
|
||||||
|
|
|
@ -663,7 +663,7 @@ export default {
|
||||||
captchaSrc: '',
|
captchaSrc: '',
|
||||||
contestID: 0,
|
contestID: 0,
|
||||||
problemID: '',
|
problemID: '',
|
||||||
trainingID: 0,
|
trainingID: null,
|
||||||
submitting: false,
|
submitting: false,
|
||||||
code: '',
|
code: '',
|
||||||
language: '',
|
language: '',
|
||||||
|
|
|
@ -16,6 +16,13 @@
|
||||||
<section>
|
<section>
|
||||||
<b class="training-category">{{ $t('m.Training_Category') }}</b>
|
<b class="training-category">{{ $t('m.Training_Category') }}</b>
|
||||||
<div>
|
<div>
|
||||||
|
<el-tag
|
||||||
|
size="medium"
|
||||||
|
class="category-item"
|
||||||
|
:style="getCategoryBlockColor(null)"
|
||||||
|
@click="filterByCategory(null)"
|
||||||
|
>{{ $t('m.All') }}</el-tag
|
||||||
|
>
|
||||||
<el-tag
|
<el-tag
|
||||||
size="medium"
|
size="medium"
|
||||||
class="category-item"
|
class="category-item"
|
||||||
|
@ -139,6 +146,8 @@
|
||||||
import api from '@/common/api';
|
import api from '@/common/api';
|
||||||
import utils from '@/common/utils';
|
import utils from '@/common/utils';
|
||||||
import { TRAINING_TYPE } from '@/common/constants';
|
import { TRAINING_TYPE } from '@/common/constants';
|
||||||
|
import myMessage from '@/common/message';
|
||||||
|
import { mapGetters } from 'vuex';
|
||||||
const Pagination = () => import('@/components/oj/common/Pagination');
|
const Pagination = () => import('@/components/oj/common/Pagination');
|
||||||
export default {
|
export default {
|
||||||
name: 'TrainingList',
|
name: 'TrainingList',
|
||||||
|
@ -209,10 +218,15 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
toTraining(trainingID) {
|
toTraining(trainingID) {
|
||||||
|
if (!this.isAuthenticated) {
|
||||||
|
myMessage.warning(this.$i18n.t('m.Please_login_first'));
|
||||||
|
this.$store.dispatch('changeModalStatus', { visible: true });
|
||||||
|
} else {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'TrainingDetails',
|
name: 'TrainingDetails',
|
||||||
params: { trainingID: trainingID },
|
params: { trainingID: trainingID },
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
goUserHome(username) {
|
goUserHome(username) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
|
@ -222,6 +236,14 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
getCategoryBlockColor(category) {
|
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) {
|
if (category.id == this.query.categoryId) {
|
||||||
return (
|
return (
|
||||||
'color: #fff;background-color: ' +
|
'color: #fff;background-color: ' +
|
||||||
|
@ -241,6 +263,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['isAuthenticated']),
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
$route(newVal, oldVal) {
|
$route(newVal, oldVal) {
|
||||||
if (newVal !== oldVal) {
|
if (newVal !== oldVal) {
|
||||||
|
|
|
@ -524,3 +524,68 @@ DELIMITER ;
|
||||||
CALL contest_Add_auto_real_rank;
|
CALL contest_Add_auto_real_rank;
|
||||||
|
|
||||||
DROP PROCEDURE 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;
|
||||||
|
|
|
@ -149,6 +149,8 @@ CREATE TABLE `contest` (
|
||||||
`open_account_limit` tinyint(1) DEFAULT '0' COMMENT '是否开启账号限制',
|
`open_account_limit` tinyint(1) DEFAULT '0' COMMENT '是否开启账号限制',
|
||||||
`account_limit_rule` mediumtext COMMENT '账号限制规则',
|
`account_limit_rule` mediumtext COMMENT '账号限制规则',
|
||||||
`rank_show_name` varchar(20) DEFAULT 'username' COMMENT '排行榜显示(username、nickname、realname)',
|
`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_create` datetime DEFAULT CURRENT_TIMESTAMP,
|
||||||
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
PRIMARY KEY (`id`,`uid`),
|
PRIMARY KEY (`id`,`uid`),
|
||||||
|
@ -414,7 +416,6 @@ CREATE TABLE `judge` (
|
||||||
`language` varchar(30) DEFAULT NULL COMMENT '代码语言',
|
`language` varchar(30) DEFAULT NULL COMMENT '代码语言',
|
||||||
`cid` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '比赛id,非比赛题目默认为0',
|
`cid` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '比赛id,非比赛题目默认为0',
|
||||||
`cpid` bigint(20) unsigned 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',
|
`judger` varchar(20) DEFAULT NULL COMMENT '判题机ip',
|
||||||
`ip` varchar(20) DEFAULT NULL COMMENT '提交者所在ip',
|
`ip` varchar(20) DEFAULT NULL COMMENT '提交者所在ip',
|
||||||
`version` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁',
|
`version` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁',
|
||||||
|
@ -428,11 +429,9 @@ CREATE TABLE `judge` (
|
||||||
KEY `pid` (`pid`),
|
KEY `pid` (`pid`),
|
||||||
KEY `uid` (`uid`),
|
KEY `uid` (`uid`),
|
||||||
KEY `username` (`username`),
|
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_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_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_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
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
/*Table structure for table `judge_case` */
|
/*Table structure for table `judge_case` */
|
||||||
|
|
Loading…
Reference in New Issue