本次项目是基于上次的校园兼职的基础改进的,将之前的IO流转换成了Mysql,同时新增了一些需求。
相较于之前项目,提供了又一个新的角色,发布兼职人员。他的角色就相当于公司的招聘人员,可以根据公司需求,去这个平台上发布自己公司对应需要的兼职信息。
发布兼职人员基本功能:
- 可以对兼职信息进行发布
- 可以对自己发布的兼职信息进行查看(状态:未通过,已通过,未审批),还可以查看审核过关的信息是否有兼职人员已经接取。
- 可以对自己发布的兼职信息进行撤销
为了保证兼职人员的安全性,所有发布兼职人员发布的信息都需要管理员审批通过后才能展示给兼职人员,如果信息虚假可由管理员直接拒绝。
管理员添加的功能
- 可以对兼职信息进行审批
- 可以有审批通过的信息才能展示给兼职人员查看
- 可以发布兼职人员进行增,删,改,查
本次版本采用了三层架构的模式,新增了一个controller类,与根据该类的一些实现
ControllerDaoimpl类的实现:
public class ControllerDaoimpl implements ControllerDao {
private JdbcTemplate runner = new JdbcTemplate(JDBCUtils.getDataSource());
@Override
public Controller query(String ID) {
Controller controller = null;
try {
String sql = "select * from controller where ID=?";
controller = runner.queryForObject(sql, new BeanPropertyRowMapper<>(Controller.class), ID);
}catch (Exception e){
return controller;
}
return controller;
}
@Override
public Controller query2(String ID, String password) {
Controller controller = null;
try {
String sql = "select * from controller where ID=? and password=?";
controller = runner.queryForObject(sql, new BeanPropertyRowMapper<>(Controller.class), ID,password);
}catch (Exception e){
return controller;
}
return controller;
}
@Override
public int insert(String ID, String name, String password, String sex, String phone) {
int update = 0;
try {
String sql = "insert into controller values(?,?,?,?,?)";
update = runner.update(sql,ID,name,password,sex,phone);
}catch (Exception e){
e.printStackTrace();
}
return update;
}
@Override
public int delete(String ID) {
int update =0;
try {
String sql = "delete from controller where ID=?";
update = runner.update(sql, ID);
}catch (Exception e){
return update;
}
return update;
}
@Override
public int update(String ID, String name, String password, String sex, String phone) {
int update =0;
try {
String sql = "update controller set name=?,password=?,sex=?,phone =? where ID=?";
update = runner.update(sql, name, password, sex, phone, ID);
}catch (Exception e){
return update;
}
return update;
}
@Override
public List<Controller> query1() {
List<Controller> list =null;
try {
String sql ="select * from controller";
list = runner.query(sql, new BeanPropertyRowMapper<>(Controller.class));
}catch (Exception e){
return list;
}
return list;
}
@Override
public List<Job> queryinformation(String ID) {
List<Job> list =null;
try {
String sql = "select * from job where ID=?";
list = runner.query(sql, new BeanPropertyRowMapper<>(Job.class), ID);
}catch (Exception e){
return list;
}
return list;
}
@Override
public Job queryinformation1(String ID, String JID) {
Job job =null;
try{
String sql ="select * from job where ID=? and JID=?";
job = runner.queryForObject(sql, new BeanPropertyRowMapper<>(Job.class), JID, ID);
}catch (Exception e){
return job;
}
return job;
}
@Override
public int deleteinformation(String JID) {
int delete =0;
try {
String sql ="delete from job where JID =?";
delete = runner.update(sql, JID);
}catch (Exception e){
return delete;
}
return delete;
}
@Override
public int update(String JID) {
int update =0;
try {
String sql ="update job set state=? where JID=?";
update = runner.update(sql, 1, JID);
}catch (Exception e){
return update;
}
return update;
}
@Override
public int update2(String JID) {
int update =0;
try {
String sql ="update job set state=? where JID=?";
update = runner.update(sql, 2, JID);
}catch (Exception e){
return update;
}
return update;
}
@Override
public List<Job> query5(String ID) {
List<Job> list =null;
try {
String sql = "select * from job where ID=?";
list = runner.query(sql, new BeanPropertyRowMapper<>(Job.class), ID);
}catch (Exception e){
return list;
}
return list;
}
}
通过本次项目,更加深入的了解三层架构的模式,也更加娴熟了与MYsql交互的操作。