大項目之網上書城(八)——數據庫大改添加圖書

目錄

  • 大項目之網上書城(八)——數據庫大改&添加圖書
    • 主要改動
    • 1.數據庫新增表
      • 代碼
    • 2.數據庫新增觸發器
    • 3.其他對BookService和BookDao的修改
      • 代碼
    • 4.addBook.jsp
      • 代碼
      • 效果圖
    • 5.AddNewBookServlet
      • 代碼

大項目之網上書城(八)——數據庫大改&添加圖書

主要改動

今天也是各種各種各種出錯的一天啊,經歷了各種方法的重寫,各種觸發器的重寫。

那么book表一分為n,多個子表更新數據的時候會聯動book表更新數據。然后順勢寫了個增加圖書的方法。內容不多,錯誤不少、

1.數據庫新增表

代碼

以clothing為例,為各個類都新增了一個表。

DROP TABLE IF EXISTS `clothing`;
CREATE TABLE `clothing` (`book_name` varchar(40) NOT NULL,`price` double NOT NULL,`describtion` varchar(200) DEFAULT NULL,`clazz` varchar(40) NOT NULL,`second_id` int(11) NOT NULL AUTO_INCREMENT,`book_img` blob,`click_num` int(11) NOT NULL,`buy_num` int(9) NOT NULL,`re_du` int(12) DEFAULT NULL,`count` int(6) NOT NULL,`is_new` int(1) NOT NULL,`insert_date` date NOT NULL,`book_id` int(11) DEFAULT NULL,PRIMARY KEY (`second_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

2.數據庫新增觸發器

還是以clothing表為例,兩個方法,一個是當子表插入數據時,book表插入一條同樣的數據,2是子表更新時,book也做出相應更新。

DROP TRIGGER IF EXISTS `c_insert`;
DELIMITER ;;
CREATE TRIGGER `c_insert` AFTER INSERT ON `clothing` FOR EACH ROW begininsert into book(book_name,price,describtion,clazz,second_id,click_num,buy_num,count,is_new,insert_date) values(NEW.book_name,NEW.price,NEW.describtion,NEW.clazz,NEW.second_id,0,0,NEW.count,1,NEW.insert_date);
end
;;
DELIMITER ;
DROP TRIGGER IF EXISTS `c_update`;
DELIMITER ;;
CREATE TRIGGER `c_update` AFTER UPDATE ON `clothing` FOR EACH ROW beginupdate book set book.re_du = NEW.click_num + NEW.buy_num * 100,book.click_num = NEW.click_num,book.buy_num = NEW.buy_num where clazz = new.clazz and second_id = new.second_id;
end
;;
DELIMITER ;

3.其他對BookService和BookDao的修改

代碼

因為改得代碼太多,太亂了,不好發,于是重新都發一下實現類好了。

daoimpl

package cn.edu.bdu.mc.daos.impls;import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import java.util.List;import javax.sql.DataSource;import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;import cn.edu.bdu.mc.beans.Book;
import cn.edu.bdu.mc.daos.BookDao;
import cn.edu.bdu.mc.utils.JDBCUtil;public class BookDaoImpl implements BookDao {private DataSource dataSource = JDBCUtil.getDataSource();private QueryRunner queryRunner = new QueryRunner(dataSource);      @Overridepublic Book findNewBookByPaiMing(int shu) throws SQLException {// TODO Auto-generated method stubString sql = "select * from (select * from book where is_new = 1 order by re_du desc)as book1 limit "+(shu-1)+",1";return queryRunner.query(sql, new BeanHandler<Book>(Book.class));}@Overridepublic List<Book> findBookReMen(int page) throws SQLException {String sql = "select * from (select * from book order by re_du desc)as book1 limit "+(page-1)*2+",2";return queryRunner.query(sql, new BeanListHandler<Book>(Book.class));}@Overridepublic void insert(Book book) throws SQLException {// TODO Auto-generated method stubString sql = "insert into "+book.getClazz()+"(book_name,price,describtion,clazz,click_num,buy_num,count,is_new,insert_date) values(?,?,?,?,0,0,?,1,?)";queryRunner.update(sql,book.getBook_name(),book.getPrice(),book.getDescribtion(),book.getClazz(),book.getCount(),new Date());}@Overridepublic Book findBookById(int book_id) throws SQLException{String sql = "select * from book where book_id = ?";return queryRunner.query(sql, new BeanHandler<Book>(Book.class),book_id);}@Overridepublic List<Book>findAllBook() throws SQLException {String sql = "select * from book";return queryRunner.query(sql, new BeanListHandler<Book>(Book.class));}@Overridepublic void deleteById(int book_id) throws SQLException {String sql = "delete from book where book_id = ?";queryRunner.update(sql,book_id);}@Overridepublic void update(Book book) throws SQLException {String sql = "update book set book_name = ?, price = ?, describtion = ?, clazz = ?, second_id = ?, click_num = ?, buy_num = ?, count = ?, is_new = ? where book_id = ?";queryRunner.update(sql,book.getBook_name(),book.getPrice(),book.getDescribtion(),book.getClazz(),book.getSecond_id(),book.getClick_num(),book.getBuy_num(),book.getCount(),book.getIs_new(),book.getBook_id());}@Overridepublic void addImgByName(String book_name, String path) throws SQLException, IOException {// TODO Auto-generated method stubConnection conn = null;PreparedStatement ps = null;FileInputStream in = null;in = new FileInputStream(new File(path));conn = JDBCUtil.getConn();String sql = "update book set book_img = ? where book_name = ?";ps = conn.prepareStatement(sql);ps.setBinaryStream(1, in, in.available());ps.setString(2, book_name);int count = ps.executeUpdate();if (count > 0) {System.out.println("插入成功!");} else {System.out.println("插入失敗!");}JDBCUtil.release(conn, ps);}@Overridepublic InputStream getImgById(int book_id) throws SQLException {// TODO Auto-generated method stubConnection conn = null;PreparedStatement ps = null;ResultSet rs = null;InputStream in = null;try {conn = JDBCUtil.getConn();String sql = "select book_img from book where book_id = ?";ps = conn.prepareStatement(sql);ps.setInt(1, book_id);rs = ps.executeQuery();while (rs.next()) {in = rs.getBinaryStream("book_img");}} catch (Exception e) {e.printStackTrace();}JDBCUtil.release(conn, ps, rs);return in;}@Overridepublic Book findBookByClazzAndEr_id(String clazz, int er_id) throws SQLException {// TODO Auto-generated method stubString sql = "select * from "+clazz+" where second_id = ?";Book book = queryRunner.query(sql, new BeanHandler<Book>(Book.class),er_id);if(book.getBook_id()==0) {sql = "select * from book where clazz = ? and second_id = ?";book.setBook_id(queryRunner.query(sql,new BeanHandler<Book>(Book.class),clazz,er_id).getBook_id());sql = "update "+clazz+" set book_id = ?";queryRunner.update(sql,book.getBook_id());}return book;}@Overridepublic void updateClazz(Book book) throws SQLException {// TODO Auto-generated method stubString sql = "update "+book.getClazz()+" set book_name = ?, price = ?, describtion = ?, clazz = ?, book_id = ?, click_num = ?, buy_num = ?, count = ?, is_new = ? where second_id = ?";queryRunner.update(sql,book.getBook_name(),book.getPrice(),book.getDescribtion(),book.getClazz(),book.getBook_id(),book.getClick_num(),book.getBuy_num(),book.getCount(),book.getIs_new(),book.getSecond_id());}}

serviceimpl

package cn.edu.bdu.mc.services.impls;import java.io.IOException;
import java.io.InputStream;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;import javax.sql.DataSource;import cn.edu.bdu.mc.beans.Book;
import cn.edu.bdu.mc.daos.BookDao;
import cn.edu.bdu.mc.daos.impls.BookDaoImpl;
import cn.edu.bdu.mc.services.BookService;
import cn.edu.bdu.mc.utils.JDBCUtil;public class BookServiceImpl implements BookService {private DataSource dataSource = JDBCUtil.getDataSource();private BookDao dao = new BookDaoImpl(); @Overridepublic Book findNewBookByPaiMing(int shu) throws SQLException {// TODO Auto-generated method stubreturn dao.findNewBookByPaiMing(shu);}@Overridepublic void click(int book_id) throws SQLException {// TODO Auto-generated method stubBook book = dao.findBookById(book_id);book.setClick_num(book.getClick_num()+1);dao.update(book);dao.updateClazz(book);}@Overridepublic void buy(int book_id) throws SQLException {// TODO Auto-generated method stubBook book = dao.findBookById(book_id);book.setBuy_num(book.getBuy_num()+1);dao.update(book);}@Overridepublic List<Book> findBookReMen(int page) throws SQLException {return dao.findBookReMen(page); }@Overridepublic void addImgByName(String book_name, String path) throws SQLException, IOException {// TODO Auto-generated method stubdao.addImgByName(book_name, path);}@Overridepublic InputStream getImgById(int book_id) throws SQLException {// TODO Auto-generated method stubreturn dao.getImgById(book_id);}@Overridepublic Book findBookByClazzAndEr_id(String clazz, int er_id) throws SQLException {// TODO Auto-generated method stubreturn dao.findBookByClazzAndEr_id(clazz, er_id);}@Overridepublic List<Book> findBookByClazz(String clazz) throws SQLException {List<Book> list = dao.findAllBook();List<Book> newList = new ArrayList<>();//lambda表達式,emmmm,的確可讀性不太好的樣子。list.forEach(book->{if(book.getClazz().equals(clazz)){newList.add(book);}});/*相當于for (Book book : newList) {if(book.getClazz().equals(clazz)){newList.add(book);}}*/return newList;}@Overridepublic void insert(String book_name, double price, String describtion, String clazz, int count)throws SQLException {// TODO Auto-generated method stubBook book = new Book(book_name,price,describtion,clazz,count);dao.insert(book);}}

4.addBook.jsp

代碼

<%@ page language="java" contentType="text/html; charset=utf-8"pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<title>添加圖書</title>
</head>
<body style="background-color:#bbb;width:1400px;margin:0 auto">
<!-- 調用頭部頁面 -->
<div style="width:100%;height:100px;float:left">
<jsp:include page="/admin/head.jsp"></jsp:include>
</div>
<!-- 通用內容體大小 -->
<div style="width:70%;height:600px;float:left;margin-left:15%;"><!-- 好看的圖 --><div style="width:55%;height:100%;float:left;margin-top:10%;"><img alt="拿書男孩" src="${pageContext.request.contextPath }/client/img/admin.jpg" style="width:90%;"></div><!-- 登錄界面 --><div style="width:45%;height:80%;float:left;margin-top:7%"><form action="${pageContext.request.contextPath }/AddNewBook" method="post"enctype="multipart/form-data" class="form-horizontal" role="form"><div class="form-group"><label for="lastname" class="col-sm-3 control-label input-lg">書名</label><div class="col-sm-9"><input type="text" name="book_name" class="form-control input-lg"placeholder="請輸入書名" style="float:left"/></div></div><div class="form-group"><label for="lastname" class="col-sm-3 control-label input-lg">價格</label><div class="col-sm-9"><input type="text" name="price" class="form-control input-lg"placeholder="請輸入價格" style="float:left"/></div></div><div class="form-group"><label for="lastname" class="col-sm-3 control-label input-lg">描述</label><div class="col-sm-9"><textarea class="form-control input-lg" name="describtion" rows="2"placeholder="請輸入描述" style="float:left"></textarea></div></div><div class="form-group"><label for="lastname" class="col-sm-3 control-label input-lg">類別</label><div class="col-sm-9"><select name="clazz" class="form-control input-lg" style="float:left"><option value="clothing">服裝</option><option value="food">食品</option><option value="net_literature">網絡文學</option><option value="nursery">育嬰童</option><option value="pai">好書拍賣</option><option value="residence">家居</option><option value="sport">運動戶外</option></select></div></div><div class="form-group"><label for="lastname" class="col-sm-3 control-label input-lg">數量</label><div class="col-sm-9"><input type="text" name="count" class="form-control input-lg"placeholder="請輸入數量" style="float:left"/></div></div><div class="form-group"><label for="exampleInputFile" class="col-sm-3 control-label input-lg" style="float:left;">圖片</label><div class="col-sm-9"><input type="file" name="img" class="form-control input-lg" style="float:left"></div></div><div class="form-group"><label for="firstname" class="col-sm-1 control-label input-lg"></label><div class="col-sm-5"><input type="submit" name="submit" value="提交"class="form-control input-lg btn btn-primary"style="width:100%;float:left"/></div><div class="col-sm-5"><input type="reset" name="reset" value="重置" id="re"class="form-control input-lg btn btn-warning"style="width:100%;float:left"/></div></div></form></div></div>
<!-- 調用底部頁面 -->
<div style="width:100%;height:60px;float:left">
<jsp:include page="/admin/foot.jsp"></jsp:include>
</div>
</body>
</html>

效果圖

1513080-20190621235418489-1788307391.png

5.AddNewBookServlet

代碼

package cn.edu.bdu.mc.servlets;import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.util.List;
import java.util.UUID;import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;import cn.edu.bdu.mc.services.BookService;
import cn.edu.bdu.mc.services.impls.BookServiceImpl;/*** Servlet implementation class AddNewBookServlet*/
@WebServlet("/AddNewBook")
public class AddNewBookServlet extends HttpServlet {private static final long serialVersionUID = 1L;/*** @see HttpServlet#HttpServlet()*/public AddNewBookServlet() {super();// TODO Auto-generated constructor stub}/*** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)*/protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {BookService bookService = new BookServiceImpl();
//      String book_name = request.getParameter("book_name");
//      String price = request.getParameter("price");
//      String describtion = request.getParameter("describtion");
//      String clazz = request.getParameter("clazz");
//      String count = request.getParameter("count");
//      //測試成功
//      response.getWriter().write(book_name+"<br>"+price+"<br>"+describtion+"<br>"+clazz+"<br>"+count);//把enctype="multipart/form-data"之后好像不能用普通方法獲取了。。DiskFileItemFactory factory = new DiskFileItemFactory();File file = new File("d:\\Target");if(!file.exists()) {file.mkdirs();}factory.setRepository(file);ServletFileUpload fileUpload = new ServletFileUpload(factory);fileUpload.setHeaderEncoding("utf-8");try {List<FileItem> fileItems = fileUpload.parseRequest(request);String value = null;String book_name = fileItems.get(0).getString("utf-8");Double price = Double.parseDouble(fileItems.get(1).getString("utf-8"));String describtion = fileItems.get(2).getString("utf-8");String clazz = fileItems.get(3).getString("utf-8");int count = Integer.parseInt(fileItems.get(4).getString("utf-8"));for (FileItem fileItem : fileItems) {if(!fileItem.isFormField()) {String filename = fileItem.getName();filename = filename.substring(filename.lastIndexOf("\\")+1);filename = UUID.randomUUID().toString()+"_"+value+"_"+filename;String webPath = "/upload/";String filepath = getServletContext().getRealPath(webPath+filename);File file2 = new File(filepath);File file3 = new File("d:\\upload\\"+filename);file3.getParentFile().mkdirs();file3.createNewFile();file2.getParentFile().mkdirs();file2.createNewFile();InputStream inputStream = fileItem.getInputStream();OutputStream outputStream = new FileOutputStream(file2);OutputStream outputStream2 = new FileOutputStream(file3);byte[] buffer = new byte[2048];int len;while((len = inputStream.read(buffer)) > 0) {outputStream.write(buffer, 0, len);outputStream2.write(buffer, 0, len);}inputStream.close();outputStream.close();outputStream2.close();fileItem.delete();try {bookService.insert(book_name, price, describtion, clazz, count);String path = "d:/upload/"+filename;bookService.addImgByName(book_name, path);String htmlCode="<!DOCTYPE html>\n" + "<html>"+ "<head>"+ "<link rel=\"stylesheet\" href=\""+request.getContextPath()+"/bootstrap-3.3.7-dist/css/bootstrap.min.css\">"+ "</head>"+ "<body>"+ "<div style=\"position:absolute;left:44%;top:46%;height:100px;width:240px;background-color:rgba(145, 162, 196, 0.9);border:1px;text-align:center;\"id=\"quit1\">\r\n" + "   <h3>添加成功!</h3><a class=\"btn btn-info\" href=\""+request.getContextPath()+"/admin/addBook.jsp\">繼續添加</a>&nbsp;&nbsp;&nbsp;&nbsp;"+"<a class=\"btn btn-info\" href=\""+request.getContextPath()+"/client/index.jsp\">去主頁</a>\n" + "</div>"+ "</body>"+ "</html>";response.getWriter().write(htmlCode);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}} catch (FileUploadException e) {// TODO Auto-generated catch blocke.printStackTrace();}}/*** @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)*/protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {// TODO Auto-generated method stubdoGet(request, response);}}

轉載于:https://www.cnblogs.com/zhangA/p/11067356.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/386595.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/386595.shtml
英文地址,請注明出處:http://en.pswp.cn/news/386595.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

hping3工具DOS攻擊實驗

需要兩臺機器&#xff0c;一臺扮演攻擊源&#xff0c;另一做目標源。 攻擊源地址:10.0.40.4 被攻擊機器地址:10.0.40.246 2 被攻擊的機器上安裝tcpdump&#xff0c;tcpdump主要是用來抓包的&#xff0c;看看網絡數據包是否到達。 $ yum install tcpdump -y 3 首先開啟tcp…

騰訊T2親自講解!搞懂開源框架設計思想真的這么重要嗎?系列篇

Java相關 無論什么級別的Android從業者&#xff0c;Java作為Android開發基礎語言。不管是工作還是面試中&#xff0c;Java都是必考題。如果不懂Java的話&#xff0c;薪酬會非常吃虧&#xff08;美團尤為重視Java基礎&#xff09; 詳細介紹了Java泛型、注解、并發編程、數據傳…

解決Docker容器內訪問宿主機MySQL數據庫服務器的問題

懶得描述太多,總歸是解決了問題,方法簡要記錄如下,雖然簡要,但是完整,一來紀念處理該問題耗費的大半天時間,二來本著共享精神幫助其他遇到該問題的哥們兒,當然這個方法并不一定能解決你們的問題,但是多少能提供些解決思路. 第一,先檢查防火墻,通常應該沒什么問題 (問題解決之后…

阿里P7親自教你!我的頭條面試經歷分享,完整PDF

前言 轉眼間&#xff0c;2020 年已過去一大半了&#xff0c;2020 年很難&#xff0c;各企業裁員的消息蠻多的&#xff0c;降職&#xff0c;不發年終獎等等。2020 年確實是艱難的一年。然而生活總是要繼續&#xff0c;時間不給你喪的機會&#xff01;如果我們能堅持下來&#x…

Java多線程 ——線程基礎和鎖鎖鎖

Java多線程(一) 一、線程的定義二、Synchronize線程同步三、偏向鎖、自旋鎖、重量級鎖四、volatile關鍵字 4.1.普通變量運算的物理意義4.2.有無解決的方案4.3.volatile的幾個特性&#xff08;參考https://www.cnblogs.com/kubidemanong/p/9505944.html&#xff09;五、Compare …

阿里P7級別面試經驗總結,進階學習資料!

一、前言 本人面試已經很久之前了&#xff0c;分享一下我做美團面試官的經歷吧。 美團上海面試&#xff0c;2-1及以下美團是不社招的&#xff0c;校招和2-2~2-3社招一般是三面&#xff0c;格外優秀3-1及以上會加簽面試。初面技術基礎&#xff0c;二面業務感知和技術項目&#…

C 預處理指令

0. Overview C的預處理指令格式為#name&#xff0c;均以#開頭&#xff0c;#和指令名之間不可有空白字符&#xff0c;#前可以有空字符&#xff0c;但為增強可讀性&#xff0c;一般應從第一列開始 #name不能由宏展開得來&#xff0c;name也不能由宏展開得來&#xff0c;如 // Wro…

Windows NAT端口映射

Windows本身命令行支持配置端口映射&#xff0c;條件是已經安裝了IPV6&#xff0c;啟不啟用都無所謂&#xff0c;我在win7和server2008上是可以的。xp&#xff0c;2003裝了ipv6協議也是可以的。 CMD下操作 增加端口映射&#xff0c;將10.10.10.10的8080映射到10.10.10.11的80…

阿里P8大牛親自教你!史上最全的Android面試題集錦,這原因我服了

一、架構師專題 想要掌握復雜的技術&#xff0c;必須要理解其原理和架構。本模塊結合實際一線互聯網大型項目理解架構思維&#xff0c;抽絲剝繭&#xff0c;層層深入&#xff0c;幫助大家成為Android架構師&#xff0c;在思想上對架構認識有一次升華&#xff0c;并知其所以然&a…

面向對象程序設計——UML分析和本學期總結

? 隨著第四單元UML第二次作業的結束&#xff0c;本學期的OO學習也宣告結束了&#xff08;但還得寫博客&#xff09;&#xff0c;下面就對本單元和本次作業做一個總結。 第四單元兩次作業的架構設計 ? 本單元是對UML的結構進行解析&#xff0c;第一次作業是對UML類圖的解析&am…

docker linux k8s kubeadm

一. 安裝docker 1.添加yum國內依賴 yum -y install yum-utils yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo2.安裝docker yum -y install docker-ce docker-ce-cli containerd.io3.啟動docker systemctl start docker4…

小程序FMP優化實錄,大廠面試題匯總

前言 金九銀十面試季&#xff0c;相信大家肯定急需一套Android面試寶典&#xff0c;今天小編就給大家準備了我珍藏已久的Android高階面試寶典&#xff0c;一份超級詳細的Android面試必備知識點&#xff0c;供大家學習 &#xff01; 想必每一個安卓程序員都有追求大廠的決心&a…

文件CRC和MD5校驗

文件CRC和MD5校驗 CRC和MD5用于文件和數據的傳輸校驗&#xff0c;以確認是否接收成功。 unit CRCMD5;interface { 獲取文件CRC校驗碼 } function GetFileCRC(const iFileName: string): String; { 獲取字符串CRC校驗碼 } function GetStringCRC(const Str: string): Cardinal; …

Oracle字符分隔函數(split)

為了讓 PL/SQL 函數返回數據的多個行&#xff0c;必須通過返回一個 REF CURSOR 或一個數據集合來完成。REF CURSOR 的這種情況局限于可以從查詢中選擇的數據&#xff0c;而整個集合在可以返回前&#xff0c;必須進行具體化。Oracle 9i 通過引入的管道化表函數糾正了后一種情況。…

已成功拿下字節、騰訊、脈脈offer,吐血整理

為什么想跳槽&#xff1f; 簡單說一下當時的狀況&#xff0c;我在這家公司做了兩年多&#xff0c;這兩年多完成了一個大項目&#xff0c;作為開發的核心主力&#xff0c;開發壓力很大&#xff0c;特別是項目上線前的幾個月是非常辛苦&#xff0c;幾乎每晚都要加班到12點以后&a…

復雜HTML解析

#再端一碗BeautifulSoup #獲取《戰爭與和平》中的人物名字from urllib.request import urlopen from bs4 import BeautifulSouphtml urlopen("http://www.pythonscraping.com/pages/warandpeace.html") bsObj BeautifulSoup(html,html.parser)#namelist bsObj.fin…

java main方法里調用mapper

在main方法中調用mybatis的mapper&#xff0c;一次性執行導入數據功能package com.runxsoft.test;import com.runxsoft.iutils.common.utils.UserUtils; import com.runxsoft.superwe.base.SqlVo; import com.runxsoft.superwe.base.mapper.ProtogenesisMapper; import com.run…

已成功拿下字節、騰訊、脈脈offer,滿滿干貨指導

開頭 籠統來說&#xff0c;中年程序員容易被淘汰的原因其實不外乎三點。 1、輸出能力已到頂點。這個人奮斗十來年了&#xff0c;依舊碌碌無為&#xff0c;很明顯這人的天花板就這樣了&#xff0c;說白了&#xff0c;天賦就這樣。 2、適應能力越來越差。年紀大&#xff0c;有家…

ServletRequest HttpServletRequest 請求方法 獲取請求參數 請求轉發 請求包含 請求轉發與重定向區別 獲取請求頭字段...

原文地址:ServletRequest HttpServletRequest 請求方法 獲取請求參數 請求轉發 請求包含 請求轉發與重定向區別 獲取請求頭字段ServletRequest 基本概念 JavaWeb中的 "Request"對象 實際為 HttpServletRequest 或者 ServletRequest, 兩者都為接口服務器接收請求…

c#掃描圖片去黑邊(掃描儀去黑邊)

/// <summary> /// 自動去除圖像掃描黑邊 /// </summary> /// <param name"fileName"></param> public static void AutoCutBlackEdge(string fileName) { //打開圖像 Bit…