use of com.baomidou.mybatisplus.core.conditions.query.QueryWrapper in project cicd-platform by ken-xue.
the class AuthorizeServiceImpl method captchaValidate.
public Boolean captchaValidate(CaptchaValidateDTO captchaValidateDTO) {
CaptchaDO one = captchaMapper.selectOne(new QueryWrapper<CaptchaDO>().eq("uuid", captchaValidateDTO.getUuid()));
if (Objects.isNull(one))
return false;
captchaMapper.delete(new QueryWrapper<CaptchaDO>().eq("uuid", captchaValidateDTO.getUuid()));
if (one.getCode().equalsIgnoreCase(captchaValidateDTO.getCode()) && one.getExpireTime().getTime() >= System.currentTimeMillis())
return true;
return false;
}
use of com.baomidou.mybatisplus.core.conditions.query.QueryWrapper in project cicd-platform by ken-xue.
the class AuthorizeServiceImpl method generateCaptcha.
public BufferedImage generateCaptcha(CaptchaGetDTO captchaGetQry) {
// 生成文字验证码
String code = producer.createText();
CaptchaDO captchaDO = new CaptchaDO();
captchaDO.setUuid(captchaGetQry.getUuid());
captchaDO.setCode(code);
// 5分钟后过期
captchaDO.setExpireTime(new DateTime(new Date()).plusMinutes(Constant.captchaExpireTime).toDate());
// 删除过期的验证码
captchaMapper.delete(new QueryWrapper<CaptchaDO>().lt("expire_time", new Date()));
// 保存验证码
captchaMapper.insert(captchaDO);
return producer.createImage(code);
}
use of com.baomidou.mybatisplus.core.conditions.query.QueryWrapper in project springboot-learning by lyb-geek.
the class BookServiceImpl method getBookByName.
@Override
public BookDTO getBookByName(String bookName) {
Wrapper<Book> wrapper = new QueryWrapper<>();
((QueryWrapper<Book>) wrapper).eq("book_name", bookName);
Book book = bookMapper.selectOne(wrapper);
if (ObjectUtils.isNotEmpty(book)) {
return dozerMapper.map(book, BookDTO.class);
}
return null;
}
use of com.baomidou.mybatisplus.core.conditions.query.QueryWrapper in project springboot-learning by lyb-geek.
the class BookServiceImpl method getBookByName.
@Override
public BookDTO getBookByName(String bookName) {
Wrapper<Book> wrapper = new QueryWrapper<>();
((QueryWrapper<Book>) wrapper).eq("book_name", bookName);
Book book = bookMapper.selectOne(wrapper);
if (ObjectUtils.isNotEmpty(book)) {
return dozerMapper.map(book, BookDTO.class);
}
return null;
}
use of com.baomidou.mybatisplus.core.conditions.query.QueryWrapper in project seckill by yt-King.
the class TApplyRecordServiceImpl method detail.
public TApplyRecord detail(String Id) {
QueryWrapper<TApplyRecord> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("Id", Id);
TApplyRecord tApplyRecord = tApplyRecordMapper.selectOne(queryWrapper);
if (null == tApplyRecord)
throw new RuntimeException("记录不存在");
return tApplyRecord;
}
Aggregations