package com.fgkj.services;
|
|
import java.io.File;
|
import java.util.List;
|
|
import com.fgkj.dao.BaseDAO;
|
import com.fgkj.dao.BaseDAOFactory;
|
import com.fgkj.dto.ServiceModel;
|
import com.fgkj.dto.User_Chart;
|
|
public class User_ChartService {
|
private ServiceModel model;
|
private BaseDAO dao;
|
|
public User_ChartService() {
|
super();
|
this.model = new ServiceModel();
|
this.dao = BaseDAOFactory.getBaseDAO(BaseDAO.USER_CHART);
|
}
|
//添加图标
|
public ServiceModel add(Object obj){
|
Boolean bl=dao.add(obj);
|
if(bl){
|
model.setCode(1);
|
model.setMsg("添加成功!");
|
}else{
|
model.setCode(0);
|
model.setMsg("添加失败!");
|
}
|
return model;
|
}
|
//修改图标信息
|
public ServiceModel update(Object obj){
|
Boolean bl=dao.update(obj);
|
if(bl){
|
model.setCode(1);
|
model.setMsg("添加成功!");
|
}else{
|
model.setCode(0);
|
model.setMsg("添加失败!");
|
}
|
return model;
|
}
|
//删除图标
|
public ServiceModel del(Object obj){
|
Boolean bl=dao.del(obj);
|
if(bl){
|
model.setCode(1);
|
model.setMsg("删除成功!");
|
}else{
|
model.setCode(0);
|
model.setMsg("删除失败!");
|
}
|
return model;
|
}
|
//查询所有图标
|
public ServiceModel searchAll(){
|
List list=dao.searchAll();
|
if(list!=null&&list.size()>0){
|
model.setCode(1);
|
model.setMsg("查询成功!");
|
model.setData(list);
|
}else{
|
User_Chart uchart=new User_Chart();
|
uchart.setChart_file("whyc");//默认武汉源畅图表
|
model.setCode(0);
|
model.setData(list);
|
model.setMsg("查询失败!");
|
}
|
return model;
|
}
|
//根据用户id查图表
|
public ServiceModel serchByCondition(Object obj){
|
List list=dao.serchByCondition(obj);
|
if(list!=null&&list.size()>0){
|
model.setCode(1);
|
model.setMsg("查询成功!");
|
model.setData(list);
|
}else{
|
model.setCode(0);
|
model.setMsg("查询失败!");
|
}
|
return model;
|
}
|
|
//根据chartfile和列名查具体的图片
|
public ServiceModel serchByInfo(Object obj){
|
List list=dao.serchByInfo(obj);
|
if(list!=null&&list.size()>0){
|
model.setCode(1);
|
model.setMsg("查询成功!");
|
model.setData(list);
|
}else{
|
model.setCode(0);
|
model.setMsg("查询失败!");
|
}
|
return model;
|
}
|
public static void main(String[] args) {
|
User_ChartService us=new User_ChartService();
|
User_Chart uchart=new User_Chart();
|
uchart.setChart_file("gjdw");
|
uchart.setChart_logo(new File("D://GitWorkSpace/tieta/fuguang/WebRoot/images/tieta/logo.png"));
|
us.update(uchart);
|
}
|
}
|