Search in sources :

Example 11 with QueryWrapper

use of com.baomidou.mybatisplus.core.conditions.query.QueryWrapper in project java-example by saxingz.

the class WrapperTest method wrapQueryOne.

@Test
void wrapQueryOne() {
    QueryWrapper<TransferDO> wrapper = new QueryWrapper<>();
    wrapper.eq("id", 10);
    TransferDO transferDO = transferMapper.selectOne(wrapper);
    System.out.println(transferDO);
}
Also used : QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) TransferDO(org.saxing.a0041_wemedia.domain.entity.TransferDO) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 12 with QueryWrapper

use of com.baomidou.mybatisplus.core.conditions.query.QueryWrapper in project finacialpotal by f117-sercet.

the class UserAccountServiceImpl method withdraw.

@Transactional(rollbackFor = Exception.class)
@Override
public void withdraw(Map<String, Object> paramMap) {
    String bindCode = (String) paramMap.get("bindCode");
    String fetchAmt = (String) paramMap.get("fetchAmt");
    UserAccount userAccount = userAccountMapper.selectOne(new QueryWrapper<UserAccount>().eq("user_code", bindCode));
    String amount = BigDemicalUtil.subtract(userAccount.getAmount(), fetchAmt);
    userAccount.setAmount(amount);
    userAccountMapper.updateById(userAccount);
}
Also used : QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) UserAccount(com.heepy.model.UserAccount) Transactional(org.springframework.transaction.annotation.Transactional)

Example 13 with QueryWrapper

use of com.baomidou.mybatisplus.core.conditions.query.QueryWrapper in project finacialpotal by f117-sercet.

the class BorrowerAttachServiceImpl method selectBorrowerAttachVoList.

@Override
public List<BorrowerAttachVO> selectBorrowerAttachVoList(Long borrowerId) {
    QueryWrapper<BorrowerAttach> borrowerAttachQueryWrapper = new QueryWrapper<>();
    borrowerAttachQueryWrapper.eq("borrower_id", borrowerId);
    List<BorrowerAttach> borrowerAttachList = baseMapper.selectList(borrowerAttachQueryWrapper);
    List<BorrowerAttachVO> borrowerAttachVOList = new ArrayList<>();
    borrowerAttachList.forEach(borrowerAttach -> {
        BorrowerAttachVO borrowerAttachVO = new BorrowerAttachVO();
        borrowerAttachVO.setImageType(borrowerAttach.getImageType());
        borrowerAttachVO.setImageUrl(borrowerAttach.getImageUrl());
        borrowerAttachVOList.add(borrowerAttachVO);
    });
    return borrowerAttachVOList;
}
Also used : QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) ArrayList(java.util.ArrayList) BorrowerAttachVO(com.atguigu.srb.core.pojo.Vo.BorrowerAttachVO) BorrowerAttach(com.atguigu.srb.core.pojo.entity.BorrowerAttach)

Example 14 with QueryWrapper

use of com.baomidou.mybatisplus.core.conditions.query.QueryWrapper in project CSKY by SHU-Silence.

the class ArticleServiceImpl method getWorkByUId.

@Override
public ResultVO getWorkByUId(IdParam idParam) {
    Integer uid = idParam.getUid();
    QueryWrapper<Articles> wrapper = new QueryWrapper<>();
    wrapper.eq("author_id", uid);
    Page<Articles> page = new Page<>(idParam.getCurrent(), idParam.getSize(), true);
    articlesMapper.selectPage(page, wrapper);
    ArrayList<ArticleVo> articleVos = new ArrayList<>();
    for (Articles articles : page.getRecords()) {
        ArticleVo articleVo = getArticleVo(String.valueOf(articles.getId()));
        articleVos.add(articleVo);
    }
    ArticlePageVo2 articlePageVo2 = new ArticlePageVo2();
    BeanUtils.copyProperties(page, articlePageVo2);
    articlePageVo2.setArticleVoList(articleVos);
    return new ResultVO(ResStatus.OK, "创建文章查询成功", articlePageVo2);
}
Also used : ArticlePageVo2(shu.java.csky.vo.page.ArticlePageVo2) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) ArrayList(java.util.ArrayList) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) IPage(com.baomidou.mybatisplus.core.metadata.IPage)

Example 15 with QueryWrapper

use of com.baomidou.mybatisplus.core.conditions.query.QueryWrapper in project CSKY by SHU-Silence.

the class CommentServiceImpl method revokeLike.

@Override
public ResultVO revokeLike(IdParam idParam) {
    QueryWrapper<CommentLikes> commentLikesQueryWrapper = new QueryWrapper<>();
    commentLikesQueryWrapper.eq("comment_id", idParam.getCid()).eq("user_id", idParam.getUid());
    commentLikesMapper.delete(commentLikesQueryWrapper);
    Comment comment = commentMapper.selectById(idParam.getCid());
    Integer praiseNum = comment.getPraiseNum();
    praiseNum -= 1;
    comment.setPraiseNum(praiseNum);
    commentMapper.updateById(comment);
    Long count = getCommentLikesCount(idParam.getCid());
    return new ResultVO(ResStatus.OK, "评论删除成功", count);
}
Also used : ResultVO(shu.java.csky.vo.ResultVO) Comment(shu.java.csky.entity.Comment) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) CommentLikes(shu.java.csky.entity.CommentLikes)

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