关闭

db

128人阅读 评论(0) 收藏 举报
分类:
package com.liyang.table;

import com.alibaba.fastjson.JSONObject;
import com.liyang.annotation.Column;
import com.liyang.annotation.Entity;

/*

DROP TABLE IF EXISTS `Tteam`;  
CREATE TABLE `Tteam` (  
 `vc_teamname` varchar(20) NOT NULL,  
 `vc_stuno1` varchar(20) NOT NULL,   
 `vc_stuname1` varchar(20) NOT NULL,  
 `vc_state1` enum("确认","未确认"),   
 `vc_stuno2`  varchar(20) ,  
 `vc_stuname2` varchar(20) ,  
 `vc_state2`  enum("确认","未确认"),   
 `vc_stuno3`  varchar(20) ,  
 `vc_stuname3`  varchar(20) ,  
 `vc_state3`  enum("确认","未确认"),   
 `vc_isgirls`  enum("是","否"),  
 `vc_state`  enum("通过","拒绝"),  
 `vc_date`  date ,
 PRIMARY KEY (`vc_teamname`)  
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;  

*/

@Entity(name = "Tteam")
public class Team {

       @Column(name = "vc_teamname")
       private  String  TeamName  ;

       @Column(name = "vc_stuno1")
       private  String  StuNo1  ; 

       @Column(name = "vc_stuname1")
       private  String  StuName1  ; 

       @Column(name = "vc_state1")
       private  String  State1 ;

       @Column(name = "vc_stuno2")
       private  String  StuNo2 ; 

       @Column(name = "vc_stuname2")
       private  String  StuName2  ;

       @Column(name = "vc_state2")
       private  String  State2 ;

       @Column(name = "vc_stuno3")
       private  String  StuNo3 ; 

       @Column(name = "vc_stuname3")
       private  String  StuName3  ;

       @Column(name = "vc_state3")
       private  String  State3  ;

       @Column(name = "vc_isgirls")
       private  String  Isgirls ;

       @Column(name = "vc_state")
       private  String  State ;

       @Column(name = "vc_date")
       private  String  Date ;

    public String getTeamName() {
        return TeamName;
    }

    public void setTeamName(String teamName) {
        TeamName = teamName;
    }

    public String getStuNo1() {
        return StuNo1;
    }

    public void setStuNo1(String stuNo1) {
        StuNo1 = stuNo1;
    }

    public String getStuName1() {
        return StuName1;
    }

    public void setStuName1(String stuName1) {
        StuName1 = stuName1;
    }

    public String getState1() {
        return State1;
    }

    public void setState1(String state1) {
        State1 = state1;
    }

    public String getStuNo2() {
        return StuNo2;
    }

    public void setStuNo2(String stuNo2) {
        StuNo2 = stuNo2;
    }

    public String getStuName2() {
        return StuName2;
    }

    public void setStuName2(String stuName2) {
        StuName2 = stuName2;
    }

    public String getState2() {
        return State2;
    }

    public void setState2(String state2) {
        State2 = state2;
    }

    public String getStuNo3() {
        return StuNo3;
    }

    public void setStuNo3(String stuNo3) {
        StuNo3 = stuNo3;
    }

    public String getStuName3() {
        return StuName3;
    }

    public void setStuName3(String stuName3) {
        StuName3 = stuName3;
    }

    public String getState3() {
        return State3;
    }

    public void setState3(String state3) {
        State3 = state3;
    }

    public String getIsgirls() {
        return Isgirls;
    }

    public void setIsgirls(String isgirls) {
        Isgirls = isgirls;
    }

    public String getState() {
        return State;
    }

    public void setState(String state) {
        State = state;
    }

    public String getDate() {
        return Date;
    }

    public void setDate(String date) {
        Date = date;
    }


    @Override
    public String toString() {
        // TODO Auto-generated method stub
            return JSONObject.toJSONString(this) ;
    }
}
package com.liyang.table;

import com.alibaba.fastjson.JSONObject;
import com.liyang.annotation.Column;
import com.liyang.annotation.Entity;
/*

DROP TABLE IF EXISTS `Tstudent`;  
CREATE TABLE `Tstudent` (  
  `vc_no` varchar(20) NOT NULL,  
  `vc_name` varchar(20) NOT NULL,  
  `vc_sex` enum("男","女") ,  
   `vc_education` enum("本科","硕士") ,  
  `vc_profession`  varchar(20) NOT NULL,  
  `vc_tel`  varchar(20) NOT NULL,  
  `vc_schoolyear`  varchar(20) NOT NULL,  
  `vc_mail`  varchar(20) NOT NULL,  
  `vc_date`  date ,
  PRIMARY KEY (`vc_no`)  
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;  


 */


@Entity(name = "Tstudent")
public class Student {


    @Column(name = "vc_no")
    private String  No ;

    @Column(name = "vc_name")
    private String  Name ;

    @Column(name = "vc_sex")
    private String  Sex  ;

    @Column(name = "vc_profession")    
    private String  Profession ;

    @Column(name = "vc_tel")
    private String  Tel ;

    @Column(name = "vc_mail")
    private String  Mailbox ;

    @Column(name = "vc_date")
    private String  Date ;

    @Column(name = "vc_education")
    private String  Education  ;

    @Column(name = "vc_schoolyear")
    private String  Schoolyear  ;

    public String getNo() {
        return No;
    }

    public void setNo(String no) {
        No = no;
    }

    public String getName() {
        return Name;
    }

    public void setName(String name) {
        Name = name;
    }

    public String getSex() {
        return Sex;
    }

    public void setSex(String sex) {
        Sex = sex;
    }

    public String getProfession() {
        return Profession;
    }

    public void setProfession(String profession) {
        Profession = profession;
    }

    public String getTel() {
        return Tel;
    }

    public void setTel(String tel) {
        Tel = tel;
    }

    public String getMailbox() {
        return Mailbox;
    }

    public void setMailbox(String mailbox) {
        Mailbox = mailbox;
    }

    public String getDate() {
        return Date;
    }

    public void setDate(String date) {
        Date = date;
    }

    public String getEducation() {
        return Education;
    }

    public void setEducation(String education) {
        Education = education;
    }

    public String getSchoolyear() {
        return Schoolyear;
    }

    public void setSchoolyear(String schoolyear) {
        Schoolyear = schoolyear;
    }

    @Override
    public String toString() {
        // TODO Auto-generated method stub
            return JSONObject.toJSONString(this) ;
    }

}
package com.liyang.table;
import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.liyang.database.DbRunner;



@Service
public class BusinessService {

        @Autowired
        @Qualifier("springJdbcDbRunner")
        private DbRunner dbRunner;


        public void  addStudent(Student stu){
              if(stu != null)
                   dbRunner.insert(stu) ;
        }

        public void  updateStudent(Student stu ){
              if(stu != null)
                   dbRunner.insert(stu) ;
        }

        public List<Student> getStudent(String sno){
              return  dbRunner.find(Student.class ,
                            "select * from Tstudent where vc_no = ? ", sno) ;
        }

        public void  addteam(Team team){
              if(team != null)
                   dbRunner.insert(team) ;
        }

        public List<Team> getTeam(String teamname){
              return  dbRunner.find(Team.class ,
                            "select * from Tteam where vc_teamname = ? ", teamname) ;
        }

        public List<Team> getMyTeam(String sno){
               List<Team> teams =   dbRunner.find(Team.class , "select * from Tteam") ;

               List<Team> myteams = new ArrayList<Team>() ;
               for(Team team : teams){
                     if(team.getStuNo1().equals(sno) 
                        || team.getStuNo2().equals(sno) 
                        || team.getStuNo3().equals(sno) ){
                        myteams.add(team) ; 
                     }
               }

               return myteams ;
        }

}
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:222985次
    • 积分:9758
    • 等级:
    • 排名:第1866名
    • 原创:680篇
    • 转载:0篇
    • 译文:0篇
    • 评论:55条
    文章分类
    最新评论