package com.st.dao;
import com.st.entity.Log;
import com.st.util.DBUtil;
import java.sql.Date;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
/**
* Created by tao on 2017/4/4 0004.
*/
public class LogDao {
/**
* 添加一个日志,
* @param log 日志
* @return 添加成功:true 添加失败:false
*/
public boolean add(Log log){
DBUtil db = new DBUtil();
String sql = "insert into log values(?,?,?,?,?,?,?,?)";
Object[] params = {log.getId(),
log.getUid(),
log.getWorkdate(),
log.getDesribe(),
log.getWorktime(),
log.getDifficulty(),
log.getRemark(),
log.getStatus()
};
int rownum = db.doUpdate(sql,params);//rownum表示影响行数
return rownum == 1;
}
/**
* 添加一个日志,
* @param log 日志
* @return 添加成功:true 添加失败:false
*/
public boolean addWithoutId(Log log){
DBUtil db = new DBUtil();
String sql = "insert into log(uid,workdate,`describe`,worktime,difficulty,remark,`status`) values(?,?,?,?,?,?,?)";
Object[] params = {
log.getUid(),
log.getWorkdate(),
log.getDesribe(),
log.getWorktime(),
log.getDifficulty(),
log.getRemark(),
log.getStatus()
};
int rownum = db.doUpdate(sql,params);//rownum表示影响行数
return rownum == 1;
}
/**
* 添加一个日志,
* @param id 日志ID
* @return 删除成功:true 删除失败:false
*/
public boolean delete(int id){
DBUtil db = new DBUtil();
String sql = "delete from Log where id = ?";
Object[] params = {id};
int rownum = db.doUpdate(sql,params);//rownum表示影响行数
return rownum == 1;
}
/**
*
* @param log 日志
* @return 更新成功:true,更新失败:false
*/
public boolean update(Log log){
DBUtil db = new DBUtil();
String sql = "update Log set uid=?,workdate=?,describe=?,worktime=?,difficulty=?,remark=?,status=? where id =?";
Object[] params = {
log.getUid(),
log.getWorkdate(),
log.getDesribe(),
log.getWorktime(),
log.getDifficulty(),
log.getRemark(),
log.getStatus(),
log.getId()
};
int rownum = db.doUpdate(sql,params);//rownum表示影响行数
return rownum == 1;
}
/**
*
* @param id 日志ID
* @return 查找成功:ID为id的日志,查找失败:null
*/
public Log get(int id){
DBUtil db = new DBUtil();
String sql = "select uid,workdate,`describe`,worktime,difficulty,remark,status from log where id = ?";
Object[] params = {id};
try {
ResultSet rs = db.doQuery(sql, params);
if (rs.next()) {
int uid = rs.getInt(1);
Date workdate = rs.getDate(2);
String describe = rs.getString(3);
int worktime = rs.getInt(4);
String diffculty = rs.getString(5);
String remark = rs.getString(6);
String status = rs.getString(7);
Log log = new Log(id,uid,workdate,describe,worktime,diffculty,remark,status);
return log;
}else{
return null;
}
}catch (Exception e){
e.printStackTrace();
}
return null;
}
/**
*
* @param uid 用户ID
* @return 查找成功:用户ID为uid的所有日志,查找失败:null
*/
public List<Log> getByUid(int uid){
List<Log> list = new ArrayList<Log>();
DBUtil db = new DBUtil();
String sql = "select id,workdate,`describe`,worktime,difficulty,remark,status from log where uid = ? order by workdate desc";
Object[] params = {uid};
try {
ResultSet rs = db.doQuery(sql, params);
while (rs.next()) {
int id = rs.getInt(1);
Date workdate = rs.getDate(2);
String describe = rs.getString(3);
int worktime = rs.getInt(4);
String diffculty = rs.getString(5);
String remark = rs.getString(6);
String status = rs.getString(7);
Log log = new Log(id,uid,workdate,describe,worktime,diffculty,remark,status);
list.add(log);
}
return list;
}catch (Exception e){
e.printStackTrace();
}
return null;
}
/**
*
* @return 所有日志
*/
public List<Log> findAll(){
DBUtil db = new DBUtil();
String sql = "select * from log order by uid";
List<Log> list = new ArrayList<Log>();
try {
ResultSet rs = db.doQuery(sql);
while (rs.next()) {
int id = rs.getInt(1);
int uid = rs.getInt(2);
Date workdate = rs.getDate(3);
String describe = rs.getString(4);
int worktime = rs.getInt(5);
String diffculty = rs.getString(6);
String remark = rs.getString(7);
String status = rs.getString(8);
Log log = new Log(id,uid,workdate,describe,worktime,diffculty,remark,status);
list.add(log);
}
return list;
}catch (Exception e){
e.printStackTrace();
}
return null;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
基于JSP+Servlet+JDBC+MySQL+Bootstrap的考勤管理系统.zip
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共49个文件
java:19个
css:5个
xml:4个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
需积分: 5 0 下载量 7 浏览量
2023-07-30
23:37:17
上传
评论
收藏 182KB ZIP 举报
温馨提示
基于java、jsp、servlet、mysql、springboot等技术构建的系统,适合毕设项目、课设作业。资源中的源码都是经过本地编译过可运行的,下载后按照文档配置好环境就可以运行。资源项目的难度比较适中,内容都是经过助教老师审定过的,应该能够满足学习、使用需求,如果有需要的话可以放心下载使用。
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 49 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/30e8714965eb478aa5e7293a6a29ce4d_weixin_44317448.jpg!1)
独处东汉
- 粉丝: 439
- 资源: 822
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)