DBHelper.java 、DBCommand.java和属性文件jdbcInfo.properties。
表建立对应的DTO,就是bean了。
表建立数据操作抽象对象DAO,,以及实现类DAOImpl。
service ServiceImpl 业务类
有个demo也好啊 !!
需要stucts吗???
不要ssh框架!!
dto
package zp.bean;
public class Job {
private Integer id;
private String jobname;
private String idate;
private Integer number;
private String location ;
private String decription;
private String requirement ;
private Integer cid ;
public String getJobname() {
return jobname;
}
public void setJobname(String jobname) {
this.jobname = jobname;
}
public String getIdate() {
return idate;
}
public void setIdate(String idate) {
this.idate = idate;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getDecription() {
return decription;
}
public void setDecription(String decription) {
this.decription = decription;
}
public String getRequirement() {
return requirement;
}
public void setRequirement(String requirement) {
this.requirement = requirement;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCid() {
return cid;
}
public void setCid(Integer cid) {
this.cid = cid;
}
}
dao
package zp.dao;
import java.util.List;
import zp.bean.Job;
public abstract class JobDAO extends BaseDAO{
public abstract List<Job> getAllJobs();
public abstract Job getJobByID(Integer id);
public abstract int updateJob(Job job);
public abstract int insertJob(Job job) ;
public abstract int deleteJobByID(Integer id);
}
daoimpl
public class JobDAOImpl extends JobDAO {
private PreparedStatement pstm;
/**
* 根据ID获取JOB详细
*/
public Job getJobByID(Integer id) {
Job job = null ;
try {
pstm = this.getConn()
.prepareStatement("select * from job where id = ? ");
Map<Object,Object> paramsMap = new LinkedHashMap<Object,Object>();
paramsMap.put("id", id.intValue());
List<Map<String,Object>> jobList = DBCommand.execQuery(pstm, paramsMap);