zoukankan      html  css  js  c++  java
  • QueryWrapper获取另一个表的字段

     QueryWrapper<StFloodcollR> queryWrapper = new QueryWrapper<>();
            queryWrapper.select("*,(SELECT u1.real_name FROM `user` u1 WHERE CREATEDBY = u1.id ) AS createdUser,(SELECT u2.real_name FROM `user` u2 WHERE MODIFYBY = u2.id ) AS modifyUser");
            PageHelper.startPage(pageNo, pageSize);
            if (!StringUtils.isEmpty(lunTime)) {
    
                queryWrapper.ge("LUNTIME", TimeUtil.getStartOfDay(lunTime));
                queryWrapper.le("LUNTIME", TimeUtil.getEndOfDay(lunTime));
            }

    第一步:在StFloodcollR实体类中 加入两个

     第二步:在查询语句中加入

    queryWrapper.select("*,(SELECT u1.real_name FROM `user` u1 WHERE CREATEDBY = u1.id ) AS createdUser,(SELECT u2.real_name FROM `user` u2 WHERE MODIFYBY = u2.id ) AS modifyUser");
  • 相关阅读:
    React之React.cloneElement
    HTB-靶机-Vault
    HTB-靶机-Curling
    HTB-靶机-Zipper
    HTB-靶机-Frolic
    HTB-靶机-Carrier
    HTB-靶机-Oz
    HTB-靶机-Dab
    HTB-靶机-Waldo
    HTB-靶机-Reddish
  • 原文地址:https://www.cnblogs.com/chenlijing/p/14631238.html
Copyright © 2011-2022 走看看