use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project sduoj-server by SDUOJ.
the class ContestManageService method update.
public void update(ContestManageDTO reqDTO, UserSessionDTO userSessionDTO) {
ContestDO contestDO = contestDao.lambdaQuery().select(ContestDO::getContestId, ContestDO::getUserId, ContestDO::getVersion).eq(ContestDO::getContestId, reqDTO.getContestId()).one();
AssertUtils.notNull(contestDO, ApiExceptionEnum.CONTEST_NOT_FOUND);
// 超级管理员、创建者、权限组用户 才能更新比赛详情
AssertUtils.isTrue(contestCommonService.isContestManager(contestDO, userSessionDTO), ApiExceptionEnum.USER_NOT_MATCHING, "只有超级管理员、创建者才能修改比赛");
ContestDO contestUpdateDO = contestManageConverter.from(reqDTO);
contestUpdateDO.setParticipantNum(contestUpdateDO.getParticipants().length / 8);
contestUpdateDO.setVersion(contestDO.getVersion());
UpdateWrapper<ContestDO> updater = new UpdateWrapper<>();
updater.eq(ContestDOField.ID, contestUpdateDO.getContestId());
if (!contestDao.update(contestUpdateDO, updater)) {
throw new ApiException(ApiExceptionEnum.SERVER_BUSY);
}
}
use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project kms by mahonelau.
the class SysAnnouncementSendController method readAll.
/**
* @功能:一键已读
* @return
*/
@PutMapping(value = "/readAll")
public Result<SysAnnouncementSend> readAll() {
Result<SysAnnouncementSend> result = new Result<SysAnnouncementSend>();
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String userId = sysUser.getId();
LambdaUpdateWrapper<SysAnnouncementSend> updateWrapper = new UpdateWrapper().lambda();
updateWrapper.set(SysAnnouncementSend::getReadFlag, CommonConstant.HAS_READ_FLAG);
updateWrapper.set(SysAnnouncementSend::getReadTime, new Date());
updateWrapper.last("where user_id ='" + userId + "'");
SysAnnouncementSend announcementSend = new SysAnnouncementSend();
sysAnnouncementSendService.update(announcementSend, updateWrapper);
result.setSuccess(true);
result.setMessage("全部已读");
return result;
}
use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project kms by mahonelau.
the class SysAnnouncementSendController method editById.
/**
* @功能:更新用户系统消息阅读状态
* @param json
* @return
*/
@PutMapping(value = "/editByAnntIdAndUserId")
public Result<SysAnnouncementSend> editById(@RequestBody JSONObject json) {
Result<SysAnnouncementSend> result = new Result<SysAnnouncementSend>();
String anntId = json.getString("anntId");
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String userId = sysUser.getId();
LambdaUpdateWrapper<SysAnnouncementSend> updateWrapper = new UpdateWrapper().lambda();
updateWrapper.set(SysAnnouncementSend::getReadFlag, CommonConstant.HAS_READ_FLAG);
updateWrapper.set(SysAnnouncementSend::getReadTime, new Date());
updateWrapper.last("where annt_id ='" + anntId + "' and user_id ='" + userId + "'");
SysAnnouncementSend announcementSend = new SysAnnouncementSend();
sysAnnouncementSendService.update(announcementSend, updateWrapper);
result.setSuccess(true);
return result;
}
use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project jeecg-boot by jeecgboot.
the class SysAnnouncementSendController method editById.
/**
* @功能:更新用户系统消息阅读状态
* @param json
* @return
*/
@PutMapping(value = "/editByAnntIdAndUserId")
public Result<SysAnnouncementSend> editById(@RequestBody JSONObject json) {
Result<SysAnnouncementSend> result = new Result<SysAnnouncementSend>();
String anntId = json.getString("anntId");
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String userId = sysUser.getId();
LambdaUpdateWrapper<SysAnnouncementSend> updateWrapper = new UpdateWrapper().lambda();
updateWrapper.set(SysAnnouncementSend::getReadFlag, CommonConstant.HAS_READ_FLAG);
updateWrapper.set(SysAnnouncementSend::getReadTime, new Date());
updateWrapper.last("where annt_id ='" + anntId + "' and user_id ='" + userId + "'");
SysAnnouncementSend announcementSend = new SysAnnouncementSend();
sysAnnouncementSendService.update(announcementSend, updateWrapper);
result.setSuccess(true);
return result;
}
use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project jeecg-boot by jeecgboot.
the class SysAnnouncementSendController method readAll.
/**
* @功能:一键已读
* @return
*/
@PutMapping(value = "/readAll")
public Result<SysAnnouncementSend> readAll() {
Result<SysAnnouncementSend> result = new Result<SysAnnouncementSend>();
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String userId = sysUser.getId();
LambdaUpdateWrapper<SysAnnouncementSend> updateWrapper = new UpdateWrapper().lambda();
updateWrapper.set(SysAnnouncementSend::getReadFlag, CommonConstant.HAS_READ_FLAG);
updateWrapper.set(SysAnnouncementSend::getReadTime, new Date());
updateWrapper.last("where user_id ='" + userId + "'");
SysAnnouncementSend announcementSend = new SysAnnouncementSend();
sysAnnouncementSendService.update(announcementSend, updateWrapper);
JSONObject socketParams = new JSONObject();
socketParams.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC);
webSocket.sendMessage(socketParams.toJSONString());
result.setSuccess(true);
result.setMessage("全部已读");
return result;
}
Aggregations