首页>代码>jsp+servlet+原生jdbc实现的停车场管理系统分享>/park/src/main/java/cn/parking/DAO/Fixed.java
package cn.parking.DAO;

import cn.parking.DBUtil.SQLUtil;

import java.util.List;

public class Fixed {

		//获取固定车主出入记录表信息列表
		public List<Object> getEntity()
		{
			String sqlCmd="select *from fixed";
			return SQLUtil.executeQuery(sqlCmd, null);//执行查询操作executeQuery
		}
            
         //获取分页后固定车主出入记录表信息列表
		public List<Object> getEntity(int page)
		{
			int size=(page-1)*15;
			String sqlCmd="select *from v_fixed limit "+size+",15";
			return SQLUtil.executeQuery(sqlCmd, null);//执行查询操作executeQuery
		}
		
		 //获取未出场车辆
		public List<Object> getNoOut(int page)
		{
			int size=(page-1)*15;
			String sqlCmd="select *from v_fixed where out_date='1111-11-11' limit "+size+",15";
			return SQLUtil.executeQuery(sqlCmd, null);//执行查询操作executeQuery
		}
                
        //根据查询条件sqlWhere获取分页后固定车主出入记录表信息列表
		public List<Object> getEntityByWhere(String sqlWhere,int page)
		{
			int size=(page-1)*15;
			String sqlCmd="select *from v_fixed where "+sqlWhere+" limit "+ size+",15";
			return SQLUtil.executeQuery(sqlCmd, null);//执行查询操作executeQuery
        }
        
        //删除固定车主出入记录表信息
        public int deleteEntity(String fixed_id)
        {
            String sqlCmd="delete from fixed where fixed_id='"+fixed_id+"'";
            return SQLUtil.executeNonQuery(sqlCmd, null);//执行非查询操作executeNonQuery
        }
        
        //根据固定车主出入记录表编号获取固定车主出入记录表信息
        public List<Object> getEntityById(String fixed_id)
        {
            String sqlCmd="select *From v_fixed where fixed_id='"+fixed_id+"'";
            return SQLUtil.executeQuery(sqlCmd, null);//执行查询操作executeQuery
        }
        
        //更新固定车主出入记录表信息
        public int updateEntity(String fixed_id,String card_id,String entry_date,String entry_time,String out_date,String out_time)
        {
            String sqlCmd="Update fixed set card_id='" + card_id + "',entry_date='" + entry_date + "',entry_time='" + entry_time + "',out_date='" + out_date + "',out_time='" + out_time + "' where fixed_id='"+fixed_id+"'";
            return SQLUtil.executeNonQuery(sqlCmd, null);
        }
        
        public int setOut(String fixed_id,String out_date,String out_time )
        {
        	String sqlCmd="update fixed set out_date='"+out_date+"',out_time='"+out_time+"' where fixed_id='"+fixed_id+"'";
        	 return SQLUtil.executeNonQuery(sqlCmd, null);
        }
        
        //插入固定车主出入记录表信息
        public int insertEntity(String fixed_id,String card_id,String entry_date,String entry_time,String out_date,String out_time)
        {
            String sqlCmd="Insert into fixed values('" + fixed_id + "','" + card_id + "','" + entry_date + "','" + entry_time + "','" + out_date + "','"+out_time+"')";
            return SQLUtil.executeNonQuery(sqlCmd, null);
        }
        
        //检查插入主键是否重复
        public boolean checkExist(String fixed_id)
        {
            String sqlCmd="select count(*) from v_fixed where fixed_id='"+fixed_id+"'";
            if(1==Integer.parseInt(SQLUtil.excuteScalar(sqlCmd, null).toString()) )
            {
                return true;
            }
            return false;
        }

		//获取分页总数
		public Object getPageCount()
		{
			String sqlCmd="SELECT CEIL( COUNT(*)/15.0) FROM v_fixed ";
			return SQLUtil.excuteScalar(sqlCmd, null);
		}

		//根据查询条件获取分页总数
		public Object getPageCountByWhere(String sqlWhere)
		{
			String sqlCmd="SELECT CEIL( COUNT(*)/15.0) FROM v_fixed where "+sqlWhere;
			return SQLUtil.excuteScalar(sqlCmd, null);
		}
            
        }
最近下载更多
wanglinddad  LV54 4月8日
zolscy  LV12 3月24日
huangzy  LV12 2023年12月13日
另类清晨  LV8 2023年9月22日
komice1992  LV3 2023年7月1日
hongdongdong  LV12 2023年6月17日
lvdong2023  LV10 2023年5月17日
1613619109  LV6 2023年5月2日
全栈小白  LV34 2023年4月25日
Mr_VVcat  LV8 2023年4月22日
最近浏览更多
80730176  LV7 4月20日
wanglinddad  LV54 4月2日
YiMoWanXia 3月25日
暂无贡献等级
zolscy  LV12 3月24日
kaye7549317 3月18日
暂无贡献等级
1134116035 2月24日
暂无贡献等级
2602275348  LV12 1月10日
admin_z  LV22 1月10日
yangyangyangyangzzzz  LV1 1月3日
iiiiiiixiiiiii  LV1 2023年12月28日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友