forked from zhanghuanhao/LibrarySystem
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2023516
commit 9f7f969
Showing
4 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?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.library.dao.AdminDao"> | ||
<select id="getMatchCount" resultType="int" parameterType="com.library.bean.Admin"> | ||
select count(*) from admin | ||
where admin_id = #{admin_id} | ||
and password = #{password} | ||
</select> | ||
<update id="resetPassword" parameterType="com.library.bean.Admin"> | ||
update admin set password = #{password} | ||
where admin_id = #{admin_id} | ||
</update> | ||
<select id="getPassword" resultType="String" parameterType="long"> | ||
select password from admin where admin_id = #{admin_id} | ||
</select> | ||
<select id="getUsername" resultType="String" parameterType="long"> | ||
select username from admin where admin_id = #{admin_id} | ||
</select> | ||
</mapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?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.library.dao.BookDao"> | ||
<insert id="addBook" parameterType="com.library.bean.Book"> | ||
insert into book_info values | ||
(null, #{name}, #{author}, #{publish}, #{ISBN}, | ||
#{introduction}, #{language}, #{price}, #{pub_date}, | ||
#{class_id}, #{number}) | ||
</insert> | ||
<update id="editBook" parameterType="com.library.bean.Book"> | ||
update book_info set name=#{name}, author=#{author}, | ||
publish=#{publish}, ISBN=#{ISBN}, introduction=#{introduction}, | ||
language=#{language}, price=#{price}, pub_date=#{pub_date}, | ||
class_id=#{class_id}, number=#{number} where book_id=#{book_id} | ||
</update> | ||
<select id="getAllBooks" resultType="com.library.bean.Book"> | ||
select * from book_info | ||
</select> | ||
<select id="queryBook" resultType="com.library.bean.Book" parameterType="String"> | ||
select * from book_info where name like #{search} | ||
or author like #{search} or introduction like #{search} | ||
</select> | ||
<select id="matchBook" resultType="int" parameterType="String"> | ||
select count(*) from book_info where name like #{search} | ||
or author like #{search} or introduction like #{search} | ||
</select> | ||
<select id="getBook" resultType="com.library.bean.Book" parameterType="long"> | ||
select * from book_info where book_id = #{book_id} | ||
</select> | ||
<delete id="deleteBook" parameterType="long"> | ||
delete from book_info where book_id = #{book_id} | ||
</delete> | ||
</mapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?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.library.dao.LendDao"> | ||
|
||
private final static String RETURN_BOOK_ONE_SQL = "UPDATE lend_list SET back_date = ? WHERE book_id = ? AND | ||
reader_id = ? AND back_date is NULL"; | ||
private final static String RETURN_BOOK_TWO_SQL = "UPDATE book_info SET number = number + 1 WHERE book_id = ? "; | ||
private final static String LEND_BOOK_ONE_SQL = "INSERT INTO lend_list VALUES (NULL , ? , ? , ? , NULL)"; | ||
private final static String LEND_BOOK_TWO_SQL = "UPDATE book_info SET number = number - 1 WHERE book_id = ? "; | ||
private final static String LEND_LIST_SQL = "SELECT * FROM lend_list"; | ||
private final static String MY_LEND_LIST_SQL = "SELECT * FROM lend_list WHERE reader_id = ? "; | ||
private final static String DELETE_LEND_SQL = "DELETE FROM lend_list WHERE ser_num = ?"; | ||
|
||
<update id="returnBookOne" parameterType="com.library.bean.Book"> | ||
update lend_list set back_date = ? where book_id = ? AND reader_id = ? AND back_date is NULL"; | ||
</update> | ||
|
||
|
||
<update id="editBook" parameterType="com.library.bean.Book"> | ||
update book_info set name=#{name}, author=#{author}, | ||
publish=#{publish}, ISBN=#{ISBN}, introduction=#{introduction}, | ||
language=#{language}, price=#{price}, pub_date=#{pub_date}, | ||
class_id=#{class_id}, number=#{number} where book_id=#{book_id} | ||
</update> | ||
<select id="getAllBooks" resultType="com.library.bean.Book"> | ||
select * from book_info | ||
</select> | ||
<select id="queryBook" resultType="com.library.bean.Book" parameterType="String"> | ||
select * from book_info where name like #{search} | ||
or author like #{search} or introduction like #{search} | ||
</select> | ||
<select id="matchBook" resultType="int" parameterType="String"> | ||
select count(*) from book_info where name like #{search} | ||
or author like #{search} or introduction like #{search} | ||
</select> | ||
<select id="getBook" resultType="com.library.bean.Book" parameterType="long"> | ||
select * from book_info where book_id = #{book_id} | ||
</select> | ||
<delete id="deleteBook" parameterType="long"> | ||
delete from book_info where book_id = #{book_id} | ||
</delete> | ||
</mapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#mysql jdbc | ||
jdbc.driver=com.mysql.jdbc.Driver | ||
jdbc.url=jdbc:mysql://localhost:3306/library?useUnicode=true&characterEncoding=UTF-8 | ||
jdbc.username=root | ||
jdbc.password=123456 |