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);
}
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);
}
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;
}
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);
}
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);
}
Aggregations