码迷,mamicode.com
首页 > 数据库 > 详细

第二次数据库作业--action

时间:2016-04-10 16:20:22      阅读:252      评论:0      收藏:0      [点我收藏+]

标签:

package action;

import dao.C2SDao;
import model.C2S;

import java.sql.SQLException;
import java.util.List;

/**
 * Created by yinus
 * Date:2016/4/6
 * Time:18:43
 */

public class C2SAction {
    public void add(C2S c) throws SQLException {
        C2SDao cd = new C2SDao();
        cd.add(c);
    }

    public void delete(int id ,boolean isStudentId) throws SQLException {
        C2SDao cd = new C2SDao();
        cd.delete(id,isStudentId);
    }
    public void delete(int stuId,int couId) throws SQLException {
        C2SDao cd = new C2SDao();
        cd.delete(stuId,couId);
    }

    public void update(C2S c) throws SQLException {
        C2SDao cd = new C2SDao();
        cd.update(c);
    }

    public List<C2S> querys(int id, boolean isStudentId) throws SQLException {
        C2SDao cd = new C2SDao();
        return cd.queryById(id,isStudentId);
    }

    public C2S query(int stuId,int couId) throws SQLException {
        C2SDao cd = new C2SDao();
        return cd.queryByStudentIdAndCourseId(stuId,couId);
    }
}
package action;

import dao.CourseDao;
import model.Course;

import java.sql.SQLException;
import java.util.List;

/**
 * Created by yinus
 * Date:2016/4/6
 * Time:18:43
 */

public class CourseAction {

        public void add(Course course) throws SQLException {
            CourseDao courseDao = new CourseDao();
            courseDao.addCourse(course);
        }

        public void update(Course course) throws SQLException {
            CourseDao courseDao = new CourseDao();
            courseDao.updateCourse(course);
        }

        public void delete(int id) throws SQLException {
            CourseDao courseDao = new CourseDao();
            courseDao.delCourse(id);
        }

        public List<Course> queryByName(String name) throws SQLException {
            CourseDao courseDao = new CourseDao();
            return courseDao.queryCourses(name);
        }

        public Course queryById(int id) throws SQLException {
            CourseDao courseDao = new CourseDao();
            return courseDao.querySingleCourse(id);
        }
}
package action;

import dao.StudentDao;
import model.Student;

import java.sql.SQLException;
import java.util.List;

/**
 * Created by yinus
 * Date:2016/4/6
 * Time:18:43
 */

public class StudentAction {

        public void add(Student student) throws SQLException {
            StudentDao studentDao = new StudentDao();
            studentDao.addStudent(student);
        }

        public void update(Student student) throws SQLException {
            StudentDao studentDao = new StudentDao();
            studentDao.updateStudent(student);
        }

        public void delete(int id) throws SQLException {
            StudentDao studentDao = new StudentDao();
            studentDao.delStudent(id);
        }

        public List<Student> queryByName(String name) throws SQLException {
            StudentDao studentDao = new StudentDao();
            return studentDao.queryStudents(name);
        }

        public Student queryById(int id) throws SQLException {
            StudentDao studentDao = new StudentDao();
            return studentDao.querySingleStudent(id);
        }
}

 

第二次数据库作业--action

标签:

原文地址:http://www.cnblogs.com/ycy1025/p/5374278.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!