会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132578个问题
Python 全系列/第一阶段:Python入门/面向对象 23986楼
WEB前端全系列/第十一阶段:Nodejs编程模块--/Nodejs基础 23988楼
Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 23989楼
Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 23990楼
Python 全系列/第二阶段:Python 深入与提高/模块 23991楼
JAVA 全系列/第一阶段:JAVA 快速入门/变量、数据类型、运算符 23992楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 23994楼
JAVA 全系列/(隐藏)第二十三阶段:数字货币交易所项目/服务中台_定时任务 23997楼
JAVA 全系列/(隐藏)第二十三阶段:数字货币交易所项目/服务中台_定时任务 23998楼

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./icon/iconfont.css">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        #box{
            width:600px;
            height:1200px;
            margin:auto;
            background:rgb(14, 112, 128);
        }
        #box > h2{
            padding:50px;
            padding-bottom:15px;
            text-align:center;
            color:white;
        }
        #box > h2:nth-child(2){
            padding-top:0px;
            color:yellow;
        }
        #box > h3{
            height:40px;
            text-align:center;
            line-height:40px;
            color:white;
            border:1px solid red;
        }
        #box > h3 > i{
            font-size:30px;
            color:white;
        }
        #box > .content{
            width:100%;
            height:280px;
            margin-top:20px;
        }
        #box > .content .content_center{
            width:75%;
            height:100%;
            margin:auto;
        }
        #box > .content .content_center .content_center_left{
            float:left;
            width:60%;
            height:100%;
        }
        #box > .content .content_center .content_center_left .content_center_left_top{
            width:100%;
            height:60px;
            text-align:center;
            color:white;
            line-height:60px;
            font-size:20px;
        }
        #box > .content .content_center .content_center_left .content_center_left_bottom{
            width:220px;
            height:220px;
            margin:auto;
            background:pink;
        }
        #box > .content .content_center .content_center_right{
            float:left;
            width:40%;
            height:100%;
        }
        #box > .content .content_center .content_center_right .content_center_right_center{
            float:right;
            width:80%;
            height:100%;
            padding-top:8px;
        }
        #box > .content .content_center .content_center_right .content_center_right_center .content_center_right_center_top{
            width:100%;
            height:120px;
        }   
        #box > .content .content_center .content_center_right .content_center_right_center .fz{
            width:100%;
            height:40%;
            font-size:20px;
            color:white;
            line-height:48px;
            text-align:center;
            cursor: pointer;
        }
        #box > .content .content_center .content_center_right .content_center_right_center .lj{
            width:100%;
            height:46%;
            text-align:center;
            line-height:55px;
            border-radius:30px;
        }
        #box > .content .content_center .content_center_right .content_center_right_center .fzje{
            background:yellow;
        }
        #box > .content .content_center .content_center_right .content_center_right_center .fzlj{
            background:white;
            margin-top:0px;
        }
        #box > .content .content_center .content_center_right .content_center_right_center .content_center_right_center_bottom{
            width:100%;
            height:120px;
            margin-top:50px;
        }
        #box > .ziduan{
            width:100%;
            margin-top:40px;
            color:white;
        }
        #box > .ziduan > p{
            margin-left:20px;
            line-height:40px;
        }
    </style>
</head>
<body>

    <div id="box">
        <h2>请使用USDT-TRC20支付转账</h2>
        <h2>转账数量需严格要求, 数量错误将不会到账</h2>
        <h3> <i class="iconfont icon-naozhong"></i> 有效时间 : <span class="shi">10</span>:<span class="fen">00</span>:<span class="miao">00</span></h3>
        <div class="content">
            <div class="content_center">
                <div class="content_center_left">
                    <div class="content_center_left_top">
                        马上扫码去转账
                    </div>
                    <div class="content_center_left_bottom"></div>
                </div>
                <div class="content_center_right">
                    <div class="content_center_right_center">
                        <div class="content_center_right_center_top">
                            <div class="fz">复制金额</div>
                            <div class="lj fzje">15.38 USDT</div>
                        </div>
                        <div class="content_center_right_center_bottom">
                            <div class="fz">复制链接</div>
                            <div class="lj fzlj">链接</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="ziduan">
            <p>温馨提醒</p>
            <p>1. 请勿向上述地址充值任何非USDT-TRC20资产, 否则资产将不可找回</p>
            <p>2. 您充值至上述地址后, 需整个网络节点的确认, 多次网络确认后到账</p>
            <p>3. 务必确保最终到账金额为15.38USDT, 不包含额外手续费, 其他不符金额都不自动到账</p>
            <p>4. 该地址只能使用一次, 重复使用会造成资产丢失</p>
        </div>
    </div>
    
</body>
</html>


WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5基础元素 23999楼

users可以查出来


users.getOrder()报空指针异常


<!--    一对多的映射关系-->
    <resultMap id="UsersAndOrdersMapper" type="com.bjsxt.pojo.Users">
        <id property="userid" column="userid"/>
        <result property="username" column="username"/>
        <result property="usersex" column="usersex"/>
        <collection property="orders" ofType="com.bjsxt.pojo.Orders">
            <id property="orderid" column="orderid"/>
            <result property="orderprice" column="orderprice"/>
        </collection>
    </resultMap>
<!--    根据用户id查询用户以及该用户的所有订单-->
    <select id="selectUsersAndOrders" resultMap="UsersAndOrdersMapper">
        select * from users u ,orders o where u.userid = o.user_id and u.userid = #{userid};
    </select>
public interface UsersMapper {
    List<Users> selectUsersAll();
    Users selectUsersAndRoles(int userid);
    Users selectUsersAndOrders(int userid);
}
public interface UsersServices {
    List<Users> findUsersAll();
    Users findUsersAndRoles(int userid);
    Users findUsersAndOrders(int userid);


}

UsersServiceImpl

@Override
public Users findUsersAndOrders(int userid) {
    Users users = null;
    try{
        SqlSession sqlSession = MybatisUtils.getSqlSession();
        UsersMapper mapper = sqlSession.getMapper(UsersMapper.class);
        users = mapper.selectUsersAndOrders(userid);
    }catch (Exception e){
        e.printStackTrace();
    }finally {
        MybatisUtils.closeSqlSession();
    }
    return users;
}

Test

public class FindUsersAndOrdersTest {
    public static void main(String[] args) {
        UsersServices usersServices = new UsersServicesImpl();
        Users users = usersServices.findUsersAndRoles(1);
        System.out.println(users);
        List<Orders> orders = users.getOrders();
        orders.forEach(System.out::println);
    }
}

image.png


运行结果

image.png

JAVA 全系列/第六阶段:项目管理与SSM框架/Mybatis 24000楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637