package com.group.bodyBuilding;
import com.group.bodyBuilding.dao.*;
import com.group.bodyBuilding.factory.Factory;
import com.group.bodyBuilding.vo.*;
import org.omg.Messaging.SYNC_WITH_TRANSPORT;
import javax.naming.ldap.StartTlsRequest;
import javax.xml.stream.events.StartDocument;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class test {
public static void main(String args[]) throws SQLException {
//以下是数据持久化操作测试代码
//AuthorityDao
/*AuthorityDao authorityDao = Factory.getAuthorityDao();
int i = 0;
i = authorityDao.queryById("123456");
System.out.print(i);*/
/*AuthorityDao authorityDao = Factory.getAuthorityDao();
boolean flag = authorityDao.del("123456");
System.out.print(flag);*/
/* AuthorityDao authorityDao = Factory.getAuthorityDao();
Authority authority = new Authority();
authority.setId("123456");
authority.setAuthority(1);
boolean flag = authorityDao.add(authority);
System.out.print(flag);*/
//AdminDao
/*AdminDao adminDao = Factory.getAdminDao();
Admin admin = new Admin();
admin = adminDao.queryById("1");
System.out.print(admin.getId()+" ");
System.out.print(admin.getName()+" ");
System.out.print(admin.getPassword()+" ");
System.out.print(admin.getLastLoginTime()+" \n");*/
/*AdminDao adminDao = Factory.getAdminDao();
Admin admin = new Admin();
admin.setId("2");
admin.setName("admin2");
admin.setPassword("root");
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
String startTime = df.format(new Date());
System.out.println(startTime);// new Date()为获取当前系统时间
admin.setLastLoginTime(startTime);
adminDao.add(admin);*/
/* AdminDao adminDao = Factory.getAdminDao();
Admin admin = new Admin();
admin.setId("2");
admin.setName("admin2");
admin.setPassword("root");
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
String startTime = df.format(new Date());
System.out.println(startTime);
admin.setLastLoginTime(startTime);
System.out.println(adminDao.update(admin));*/
/*AdminDao adminDao = Factory.getAdminDao();
System.out.println(adminDao.del("2"));*/
/*AdminDao adminDao = Factory.getAdminDao();
int maleCount = adminDao.maleCount();
int femalCount = adminDao.femaleCount();
System.out.print(maleCount+"\n"+femalCount);*/
/*AdminDao adminDao = Factory.getAdminDao();
int teachCount = adminDao.teachCount();
System.out.print(teachCount);*/
/*AdminDao adminDao = Factory.getAdminDao();
int apparatusCount = adminDao.apparatusCount();
System.out.print(apparatusCount);*/
//ApparatusDao
/*ApparatusDao apparatusDao = Factory.getApparatusDao();
Apparatus apparatus = new Apparatus();
apparatus = apparatusDao.queryById("1");
System.out.print(apparatus.getAppId()+" ");
System.out.print(apparatus.getaName()+" ");
System.out.print(apparatus.getaState()+" ");
System.out.print(apparatus.getbState()+" ");
System.out.print(apparatus.getAccount()+"\n");*/
/*ApparatusDao apparatusDao = Factory.getApparatusDao();
Apparatus apparatus = new Apparatus();
apparatus.setAppId("11");
apparatus.setaName("测试");
apparatus.setaState(0);
apparatus.setbState("0");
apparatus.setAccount(3);
System.out.println(apparatusDao.add(apparatus));*/
/*ApparatusDao apparatusDao = Factory.getApparatusDao();
Apparatus apparatus = new Apparatus();
apparatus.setAppId("11");
apparatus.setaName("测试2");
apparatus.setaState(1);
apparatus.setbState("1");
apparatus.setAccount(2);
System.out.println(apparatusDao.update(apparatus));*/
/*ApparatusDao apparatusDao = Factory.getApparatusDao();
System.out.println(apparatusDao.del("11"));*/
/*ApparatusDao apparatusDao = Factory.getApparatusDao();
System.out.print(apparatusDao.changeBstate("1","10086"));*/
/*ApparatusDao apparatusDao = Factory.getApparatusDao();
List<Apparatus> apparatusList = new ArrayList<>();
apparatusList = apparatusDao.apparatusList();
for(int i=0;i<apparatusList.size();i++){
System.out.println(apparatusList.get(i).getAppId());
}*/
//CourseDao
/*CourseDao courseDao = Factory.getCourseDao();
Course course = new Course();
course = courseDao.queryById("1");
System.out.print(course.getcId()+" ");
System.out.print(course.getcName()+" ");
System.out.print(course.gettId()+" \n");*/
/*CourseDao courseDao = Factory.getCourseDao();
Course course = new Course();
course.setcId("5");
course.setcName("测试");
course.settId("0");
System.out.println(courseDao.add(course));*/
/*CourseDao courseDao = Factory.getCourseDao();
Course course = new Course();
course.setcId("5");
course.setcName("测试1");
course.settId("1");
System.out.println(courseDao.update(course));*/
/*CourseDao courseDao = Factory.getCourseDao();
System.out.println(courseDao.del("5"));*/
/*CourseDao courseDao = Factory.getCourseDao();
List<Course> courseList = new ArrayList<>();
courseList = courseDao.courseList();
for(int i=0;i<courseList.size();i++){
System.out.print(courseList.get(i).getcId()+" ");
System.out.print(courseList.get(i).gettId()+" ");
System.out.print(courseList.get(i).getcName()+" \n");
}*/
//ScourseDao
/*ScourseDao scourseDao = Factory.getScourseDao();
Scourse scourse = new Scourse();
scourse = scourseDao.queryById("1");
System.out.print(scourse.getsCid()+" ");
System.out.print(scourse.getuId()+" ");
System.out.print(scourse.gettId()+" \n");*/
/*ScourseDao scourseDao = Factory.getScourseDao();
Scourse scourse = new Scourse();
scourse.setsCid("5");
scourse.setuId("5");
scourse.settId("5");
System.out.println(scourseDao.add(scourse));*/
/*ScourseDao scourseDao = Factory.getScourseDao();
Scourse scourse = new Scourse();
scourse.setsCid("5");
scourse.setuId("6");
scourse.settId("6");
System.out.println(scourseDao.update(scourse));*/
/*ScourseDao scourseDao = Factory.getScourseDao();
System.out.println(scourseDao.del("5"));*/
//StaffDao
/*StaffDao staffDao = Factory.getStaffDao();
Staff staff = new Staff();
staff = staffDao.queryById("1");
System.out.print(staff.getsId()+" ");
System.out.print(staff.getName()+" ");
System.out.print(staff.getPassword()+" ");
System.out.print(staff.getAge()+" ");
System.out.print(staff.getSex()+" ");
System.out.print(staff.getTel()+" ");
System.out.print(staff.getAddress()+" ");
System.out.print(staff.getSalary()+" \n");*/
/*StaffDao staffDao = Factory.getStaffDao();
Staff staff = new Staff();
staff.setsId("2");
staff.setName("大姐姐");
st