📄 contentmentservice.java
字号:
package edu.yinhe.mis.services;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import edu.yinhe.mis.dto.ContentmentDTO;
import edu.yinhe.mis.model.ContentmentDAO;
import edu.yinhe.mis.model.DAOFactory;
import edu.yinhe.mis.vo.ContentmentVO;
import edu.yinhe.system.common.AppException;
import edu.yinhe.system.model.IBaseDAO;
import edu.yinhe.system.services.Service;
import edu.yinhe.system.vo.LoginVO;
/**
*
* @author 宋玉萍
*
*/
public class ContentmentService extends Service {
private IBaseDAO tdao=null;
public Object alllist() throws AppException {
// TODO Auto-generated method stub
return null;
}
/**
* @author 宋玉萍
* 向学员满意问卷表插入数据
*/
public Object create(Object arg0) throws AppException {
Boolean flag = false;
ContentmentDTO dto=(ContentmentDTO) arg0;
ContentmentDAO dao= (ContentmentDAO) DAOFactory.getConentmentDAO(conn);
try {
flag=(Boolean) dao.insert(dto);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
closeConnection();
}
return flag;
}
public Object findAll() throws AppException {
// TODO Auto-generated method stub
return null;
}
/**
* @author 宋玉萍
* 查看学员满意问卷表
*/
public Object findAll(Object arg0) throws AppException {
tdao=DAOFactory.getConentmentDAO(conn);
ContentmentDTO dto = (ContentmentDTO)arg0;
List alist = null;
StringBuffer str = new StringBuffer("");
ContentmentVO vo = null;
Object[] obj = new Object[2];
String strList="";
int count1=0;
int count2=0;
int count3=0;
int count4=0;
int arr[]=null;
try {
alist=(ArrayList)tdao.findAll(dto);
if(alist.size() >=1){
for(int i=0;i<alist.size();i++){
vo =(ContentmentVO)alist.get(i);
switch(vo.getJudge1().charAt(0)) {
case 'A':
count1++;
break;
case 'B' :
count2++;
break;
case 'C' :
count3++;
break;
case 'D' :
count4++;
break;
}
switch(vo.getJudge2().charAt(0)) {
case 'A':
count1++;
break;
case 'B' :
count2++;
break;
case 'C' :
count3++;
break;
case 'D' :
count4++;
break;
}
switch(vo.getJudge3().charAt(0)) {
case 'A':
count1++;
break;
case 'B' :
count2++;
break;
case 'C' :
count3++;
break;
case 'D' :
count4++;
break;
}
}
arr=new int[]{count1,count2,count3,count4};
}
obj[0] = arr;
obj[1] = alist;
} catch (SQLException e) {
e.printStackTrace();
}finally{
closeConnection();
tdao =null;
}
return obj;
}
public Object findById(Object arg0) throws AppException {
return null;
}
public Object findByObject(Object arg0) throws AppException {
// TODO Auto-generated method stub
return null;
}
public int getcount() throws AppException {
// TODO Auto-generated method stub
return 0;
}
public int getcount(Object arg0) throws AppException {
// TODO Auto-generated method stub
return 0;
}
public Object list() throws AppException {
// TODO Auto-generated method stub
return null;
}
public Object list(Object obj) throws AppException {
return null;
}
public Object load(Object obj) throws AppException{ //候传LoginDTO类型,是不会有错的, Object类是LoginDTO的父类, //把子类的引用给父类的引用,叫向上转型
return null;
}
/**
* @author 宋玉萍
* 查询符合条件的老师
*/
public Object alllist(Object obj) throws AppException {
LoginVO loginVO=(LoginVO) obj;
tdao=DAOFactory.getConentmentDAO(conn);
List list=null;
try {
list = (List) tdao.findById(loginVO);
} catch (SQLException e) {
try {
conn.rollback();
} catch (SQLException e1) {
throw new AppException(e.getMessage()+"weixian");
}
}finally{
closeConnection();
tdao=null;
}
return list;
}
public Object modify(Object arg0) throws AppException {
// TODO Auto-generated method stub
return null;
}
public Object remove(Object arg0) throws AppException {
// TODO Auto-generated method stub
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -