在哪里交自由编程啊?在这里叫吗?

在哪里交自由编程啊?在这里叫吗?

com.imooc.spring.jdbc.daocom.imooc.spring.jdbc.entity.Hotelorg.springframework.jdbc.core.BeanPropertyRowMapperorg.springframework.jdbc.core.JdbcTemplatejava.util.ListHotelDao {
   JdbcTemplate Hotel (Integer OrderNo){
       String sql=Hotel hotel = .queryForObject(sqlObject[]{OrderNo}BeanPropertyRowMapper<Hotel>(Hotel.))hotel}
   List<Hotel>  (String city){
       String sql=List<Hotel> list = .query(sqlObject[]{city}BeanPropertyRowMapper<Hotel>(Hotel.))list}
   (Hotel hotel){
       String sql=i = .update(sqlObject[]{hotel.getOrderNo()hotel.getCity()hotel.getPrice()hotel.getHotelName()hotel.getArriveDate()hotel.getLeaveDate()})i}
   (Hotel hotel){
       String sql=count = .update(sqlObject[]{hotel.getCity()hotel.getPrice()hotel.getHotelName()hotel.getArriveDate()hotel.getLeaveDate()hotel.getOrderNo()})count}
   (Integer integer){
       String sql=count = .update(sqlObject[]{integer})count}

    JdbcTemplate () {
        }

    (JdbcTemplate jdbcTemplate) {
        .= jdbcTemplate}
}
package com.imooc.spring.jdbc.entity;

import java.util.Date;

public class Hotel {
    private Integer orderNo;
    private String city;
    private Float price;
    private String hotelName;
    private Date arriveDate;
    private Date leaveDate;

    @Override
    public String toString() {
        return "Hotel{" +
                "orderNo=" + orderNo +
                ", city='" + city + '\'' +
                ", price=" + price +
                ", hotelName='" + hotelName + '\'' +
                ", arriveDate=" + arriveDate +
                ", leaveDate=" + leaveDate +
                '}';
    }

    public Integer getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(Integer orderNo) {
        this.orderNo = orderNo;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public Float getPrice() {
        return price;
    }

    public void setPrice(Float price) {
        this.price = price;
    }

    public String getHotelName() {
        return hotelName;
    }

    public void setHotelName(String hotelName) {
        this.hotelName = hotelName;
    }

    public Date getArriveDate() {
        return arriveDate;
    }

    public void setArriveDate(Date arriveDate) {
        this.arriveDate = arriveDate;
    }

    public Date getLeaveDate() {
        return leaveDate;
    }

    public void setLeaveDate(Date leaveDate) {
        this.leaveDate = leaveDate;
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:context="http://www.springframework.org/schema/context"
      xsi:schemaLocation="
       http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">

   <!-- bean definitions here -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
   <property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
   <property name="url" value="jdbc:mysql://localhost:3306/jdbc_imooc?useSSL=false&amp;useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=Asia/Shanghai&amp;allowPublicKeyRetrieval=true">
   </property>
   <property name="username" value="root"></property>
   <property name="password" value="root"></property>
</bean>
   <bean id="JdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
       <property name="dataSource" ref="dataSource"></property>
   </bean>
   <bean id="hotelDao" class="com.imooc.spring.jdbc.dao.HotelDao">
<property name="jdbcTemplate" ref="JdbcTemplate"></property>
   </bean>
</beans>
com.imooc.spring.jdbc.dao.HotelDaocom.imooc.spring.jdbc.entity.Hotelorg.junit.org.junit.runner.org.springframework.test.context.org.springframework.test.context.junit4.SpringJUnit4ClassRunnerjavax.annotation.java.text.ParseExceptionjava.text.SimpleDateFormatjava.util.Datejava.util.List(SpringJUnit4ClassRunner.)
({})
JdbcTemplateTestor {
    HotelDao (){
        Hotel hotel = .findById()System..println(hotel)}
    (){
        List<Hotel> = .findByCity()System..println()}
    (){
        Hotel hotel=Hotel()hotel.setOrderNo()hotel.setCity()hotel.setHotelName()hotel.setArriveDate(Date())hotel.setLeaveDate(Date())hotel.setPrice()count = .insert(hotel)System..println(count)}
    () ParseException {
        String date1=String data2=SimpleDateFormat simpleDateFormat =SimpleDateFormat()Hotel hotel = .findById()hotel.setLeaveDate(simpleDateFormat.parse(date1))hotel.setArriveDate(simpleDateFormat.parse(data2))count = .alter(hotel)System..println(count)}
    (){
        count = .delete()System..println(count)}
}
4.0.0org.exampleexercise1.0-SNAPSHOTorg.springframeworkspring-context5.2.6.RELEASEorg.springframeworkspring-jdbc5.2.6.RELEASEmysqlmysql-connector-java5.1.41junitjunit4.12testorg.springframeworkspring-test5.2.6.RELEASEjunitjunit4.12compile


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕小尤 2021-11-04 10:40:53

同学你好,1、自由编程同学自己在本地进行开发,然后同学根据作业的需求进行查看练习是否有完成。如果同学想要分享或让老师查看作业是否正确,同学可以在自由编程的当前小节提交问答就可以了。

2、同学提交的代码格式存在一点问题,老师无法正确测试代码。建议同学重新反馈代码,在提交代码时,同学需要选择正确的代码语言,这样就可以避免代码格式不正确,便于老师测试代码。如下所示:

https://img1.sycdn.imooc.com//climg/6183474c0958102301540346.jpg

祝学习愉快!

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师