基于SSH+MySQL+Bootstrap的高校毕业设计管理系统

登陆

首页

学院管理

专业管理

班级管理

注册用户

注册用户

发布校级通知

开题报告

中期检查

论文管理

消息发送

审批

课题查看

已提交的课题

技术描述

开发工具: Idea/Eclipse
数据库: mysql
Jar包仓库: Jar包
前段框架:jquery/Jsp
后端框架: Spring+Structs2+Hibernate

package org.pigeon.gradpro.action;

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

import org.pigeon.gradpro.dao.CollegeDAO;
import org.pigeon.gradpro.dao.DeptDAO;
import org.pigeon.gradpro.vo.College;

public class DeptAction {

    private String message;
    
    private String collegeid;
    private String deptid;
    private String dname;
    
    private List<College> colleges = null;
    
    public String toDeptPage(){
        CollegeDAO collegeDao = new CollegeDAO();
        try {
            colleges = collegeDao.getAllColleges();
        } catch (SQLException e) {
            e.printStackTrace();
            message = "系统错误";
            return "notexist";
        }
        
        return "todeptpage";
    }
    
    public String addDept(){
        DeptDAO deptDao = new DeptDAO();
        if("0".equals(collegeid)){
            message = "所属学院编号不能为空";
            return "notexist";
        }
        if(deptDao.isExist(deptid)){
            message = "此专业编号已存在";
            return "notexist";
        }
        try {
            deptDao.insertDept(deptid, dname, collegeid);
        } catch (SQLException e) {
            e.printStackTrace();
            message = "系统错误";
            return "notexist";
        }
        
        message = "添加专业成功!";
        return "success";
    }
    
    public String deleteDept(){
        DeptDAO deptDao = new DeptDAO();
        try {
            deptDao.deleteDeptByID(deptid);
        } catch (SQLException e) {
            e.printStackTrace();
            message = "系统错误";
            return "notexist";
        }
        
        message = "删除专业成功!";
        return "success";
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public List<College> getColleges() {
        return colleges;
    }

    public void setColleges(List<College> colleges) {
        this.colleges = colleges;
    }

    public String getCollegeid() {
        return collegeid;
    }

    public void setCollegeid(String collegeid) {
        this.collegeid = collegeid;
    }

    public String getDeptid() {
        return deptid;
    }

    public void setDeptid(String deptid) {
        this.deptid = deptid;
    }

    public String getDname() {
        return dname;
    }

    public void setDname(String dname) {
        this.dname = dname;
    }
    
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

2016855150

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值