Search in sources :

Example 66 with QueryWrapper

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;
}
Also used : QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) CaptchaDO(io.kenxue.cicd.infrastructure.repositoryimpl.sys.database.dataobject.CaptchaDO)

Example 67 with QueryWrapper

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);
}
Also used : QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) DateTime(org.joda.time.DateTime) Date(java.util.Date) CaptchaDO(io.kenxue.cicd.infrastructure.repositoryimpl.sys.database.dataobject.CaptchaDO)

Example 68 with QueryWrapper

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;
}
Also used : QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) Book(com.github.lybgeek.dynamic.model.Book)

Example 69 with QueryWrapper

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;
}
Also used : QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) Book(com.github.lybgeek.orm.mybatisplus.model.Book)

Example 70 with QueryWrapper

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;
}
Also used : TApplyRecord(com.yt.seckill.entity.TApplyRecord) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)

Aggregations

QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)723 Transactional (org.springframework.transaction.annotation.Transactional)98 IPage (com.baomidou.mybatisplus.core.metadata.IPage)82 UserRolesVo (top.hcode.hoj.pojo.vo.UserRolesVo)74 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)72 Page (com.baomidou.mybatisplus.extension.plugins.pagination.Page)65 ArrayList (java.util.ArrayList)61 Session (org.apache.shiro.session.Session)61 StatusFailException (top.hcode.hoj.common.exception.StatusFailException)60 StatusForbiddenException (top.hcode.hoj.common.exception.StatusForbiddenException)55 Problem (top.hcode.hoj.pojo.entity.problem.Problem)50 UpdateWrapper (com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper)45 Date (java.util.Date)44 HttpServletRequest (javax.servlet.http.HttpServletRequest)35 HashMap (java.util.HashMap)34 RequiresAuthentication (org.apache.shiro.authz.annotation.RequiresAuthentication)34 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)34 ApiOperation (io.swagger.annotations.ApiOperation)32 HttpSession (javax.servlet.http.HttpSession)31 Judge (top.hcode.hoj.pojo.entity.judge.Judge)30