首页 > 其他分享 >mapper文件 和bean

mapper文件 和bean

时间:2024-07-29 09:00:39浏览次数:14  
标签:mapper end 文件 private topic bean time roomId id

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hspedu.springboot.mybatis.mapper.MonsterMapper">

<insert id="insertReservation" parameterType="Reservation">
INSERT INTO reservations (room_id, user_id, start_time, end_time, topic)
VALUES (#{roomId}, #{userId}, #{startTime}, #{endTime}, #{topic})
<selectKey keyProperty="reservationId" resultType="int" order="AFTER">
SELECT LAST_INSERT_ID()
</selectKey>
</insert>

<delete id="deleteReservation" parameterType="int">
DELETE FROM reservations WHERE reservation_id = #{reservationId}
</delete>

<select id="selectReservation" resultType="Reservation" parameterType="int">
SELECT reservation_id as reservationId, room_id as roomId, user_id as userId, start_time as startTime, end_time as endTime, topic
FROM reservations
WHERE reservation_id = #{reservationId}
</select>

<select id="selectAllReservations" resultType="Reservation">
SELECT reservation_id as reservationId, room_id as roomId, user_id as userId, start_time as startTime, end_time as endTime, topic
FROM reservations
</select>

<update id="updateReservation" parameterType="Reservation">
UPDATE reservations
SET room_id = #{roomId},
user_id = #{userId},
start_time = #{startTime},
end_time = #{endTime},
topic = #{topic}
WHERE reservation_id = #{reservationId}
</update>

<select id="selectReservationsByTimeRange" resultType="Reservation">
SELECT reservation_id, room_id, user_id, start_time, end_time, topic
FROM reservations
WHERE start_time &lt;= #{endTime} AND end_time &gt;= #{startTime}
</select>

<select id="selectReservationByRoomID" resultType="Reservation" parameterType="int">
SELECT reservation_id as reservationId, room_id as roomId, user_id as userId, start_time as startTime, end_time as endTime, topic
FROM reservations
WHERE room_id = #{roomId}
</select>

</mapper>










private Integer reservationId;
private Integer roomId;
private Integer userId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime;
private String topic;

private String start;
private String end;
private int roomId;
private String title;



标签:mapper,end,文件,private,topic,bean,time,roomId,id
From: https://www.cnblogs.com/lz2z/p/18329282

相关文章

  • 后端配置文件
    server:port:9090spring:datasource:driver-class-name:com.mysql.cj.jdbc.Driverurl:jdbc:mysql://localhost:3306/meetin_scheduling?useSSL=true&useUnicode=true&characterEncoding=UTF-8username:rootpassword:1234mvc:#......
  • 同时运行多个Python文件
    如何同时运行python的多个文件我有三个文件pop.pypop1.pypop2.py我想同时运行这个文件这些文件正在被一一运行python代码运行所有文件可以使用以下几种方法同时运行多个Python文件:1.使用多线程/多进程:多线程(threading):如果的Pytho......
  • 《最新出炉》系列入门篇-Python+Playwright自动化测试-56- 多文件上传 - 下篇
    1.简介前边的两篇文章中,宏哥分别对input控件上传文件和非input控件上传文件进行了从理论到实践地讲解和介绍,但是后来又有人提出疑问,前边讲解和介绍的都是上传一个文件,如果上传多个文件,Playwright是如何实现的呢?宏哥看了一下官方的API也有上传多个文件的API,那么今天就来讲解和介绍......
  • 如何跳转到一个巨大的文本文件中的特定行?
    下面的代码是否有任何替代方案:startFromLine=141978#orwhateverlineIneedtojumptourlsfile=open(filename,"rb",0)linesCounter=1forlineinurlsfile:iflinesCounter>startFromLine:DoSomethingWithThisLine(line)linesCo......
  • 尝试跨同一主文件夹下的子文件夹导入文件时出错
    我是新来的,希望得到一些帮助。最近,我一直在使用Jupyter笔记本进行一些学习,在这种情况下,测试我从不同文件夹中制作的函数。最初,结构如下如下:/MainFolder/Library(containinngfunction)Notebook在这个结构中我可以做fromLibrary."file"import......
  • 在Python中解压文件
    我通读了zipfile文档,但不明白如何解压缩文件,只了解如何压缩文件。如何将zip文件的所有内容解压缩到同一目录中?importzipfilewithzipfile.ZipFile('your_zip_file.zip','r')aszip_ref:zip_ref.extractall('target_directory')将......
  • 文件操作管理
    目录文件管理fopen​编辑perrorfputcfgetcfeoffgetsfputsfprintffscanffwritefreadfseek ftellstructstatremoverename更新缓存区文件管理当启动一个程序时,系统会打开3个设备文件(stdin(标准输入文件(键盘)))、(stdout(标准输出文件(终端(屏幕))))、stderr(标准错误文......
  • 文件上传漏洞--之upload-labs靶场详解11-15关
    第11关第一步:查看源码这是一个白名单,里面限制了只可以提供它所规定文件jpg,png,gif。 这段PHP代码主要实现了文件上传的功能,并进行了一些条件判断和处理: 首先,定义了两个变量 $is_upload 并初始化为 false ,$msg 初始化为 null 。 然后,检查是否通过 PO......
  • Aria2 任意文件写入漏洞
    目录Aria2介绍漏洞描述漏洞复现Aria2介绍Aria2是一个在命令行下运行,多协议,多来源下载工具(HTTP/HTTPS,FTP,BitTorrent,Metalink),内建XML-RPC用户界面。Aria提供RPC服务器,通过–enable-rpc参数启动。Aria2的RPC服务器可以方便的添加、删除下载项目我们可以使用RPC接......
  • 文件上传漏洞,看这一篇文章就够了
    文件上传漏洞文件上传漏洞介绍就是指用户上传了一个可执行的脚本文件,并通过脚本文件获得了执行服务器端命令的能力,出问题的地方在于怎么处理、解释文件,那么攻击方就要思考如何绕过检测和过滤文件上传漏洞的危害上传文件是web脚本语言,服务器的web容器解释并执行了用户上......