package com.java.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import com.java.model.BookType;
import com.java.util.StringUtil;
public class BookTypeDao {
	public int bookTypeAdd(Connection con,BookType bookType) throws Exception{
		String sql="insert into t_bookType values(null,?,?)";
		PreparedStatement pstmt=con.prepareStatement(sql);
		pstmt.setString(1, bookType.getBookTypeName());
		pstmt.setString(2, bookType.getBookTypeDesc());
		return pstmt.executeUpdate();
	}
	
	public ResultSet bookTypeList(Connection con,BookType bookType) throws Exception{	
		StringBuffer sb=new StringBuffer("select * from t_bookType");
		if(StringUtil.isNotEmpty(bookType.getBookTypeName())){
			sb.append(" and bookTypeName like '%"+bookType.getBookTypeName()+"%'");
		}
		PreparedStatement pstmt=con.prepareStatement(sb.toString().replaceFirst("and", "where"));
		return pstmt.executeQuery();
	}
	
	public int bookTypeDelete(Connection con,String id)throws Exception{
		String sql="delete from t_bookType where id=?";
		PreparedStatement pstmt=con.prepareStatement(sql);
		pstmt.setString(1, id);
		return pstmt.executeUpdate();
	}
	
	public int bookTypeModify(Connection con,BookType bookType)throws Exception{
		String sql="update t_bookType set bookTypeName=?,bookTypeDesc=? where id=?";
		PreparedStatement pstmt=con.prepareStatement(sql);
		pstmt.setString(1, bookType.getBookTypeName());
		pstmt.setString(2, bookType.getBookTypeDesc());
		pstmt.setInt(3, bookType.getId());
		return pstmt.executeUpdate();
	}
}
 最近下载更多
最近下载更多
                
                hongdongdong     LV14
                2023年8月9日
            
            
        
                婆婆12254     LV2
                2023年6月12日
            
            
        
                user0810     LV4
                2023年1月5日
            
            
        
                liys1234     LV9
                2022年6月23日
            
            
        
                testuser1234567     LV24
                2022年5月31日
            
            
        
                喃喵xxxx     LV6
                2022年5月11日
            
            
        
                wyx065747     LV67
                2022年4月2日
            
            
        
                微信网友_5853711597064192     LV3
                2022年3月1日
            
            
        
                benbosn     LV15
                2022年2月11日
            
            
        
                不愧是谁     LV2
                2021年12月17日
            
            
         最近浏览更多
最近浏览更多
                
                无异偶     LV3
                2024年12月30日
            
            
        
                binzhuyou     LV2
                2024年7月4日
            
            
        
                微信网友_7015663524368384     LV1
                2024年5月30日
            
            
        
                z1445234295    
                2024年3月11日
            
            
                    暂无贡献等级
            
        
                asddwh     LV13
                2023年12月25日
            
            
        
                huangzy     LV12
                2023年12月21日
            
            
        
                微信网友_6786215447367680     LV5
                2023年12月20日
            
            
        
                微信网友_6445756515635200     LV3
                2023年12月18日
            
            
        
                xp95323     LV15
                2023年11月27日
            
            
        
                李朝磊     LV18
                2023年11月18日
            
            
        
 
                 
                 
                 
                