package com.fgkj.services;
|
|
import java.util.List;
|
|
import com.fgkj.dao.BaseDAO;
|
import com.fgkj.dao.BaseDAOFactory;
|
import com.fgkj.dto.ServiceModel;
|
|
public class BattInf_RebuildService {
|
private ServiceModel model;
|
private BaseDAO dao;
|
public BattInf_RebuildService() {
|
super();
|
this.model =new ServiceModel();
|
this.dao = BaseDAOFactory.getBaseDAO(BaseDAO.BATTINF_REBUILD);
|
}
|
//添加
|
public ServiceModel add(Object obj) {
|
List list=dao.serchByCondition(obj);
|
if(list!=null&&list.size()>0){
|
boolean b=dao.update(obj);
|
}
|
boolean bl=dao.add(obj);
|
if(bl){
|
model.setCode(1);
|
model.setMsg("添加成功!");
|
}else{
|
model.setCode(0);
|
model.setMsg("添加失败!");
|
}
|
return model;
|
}
|
//将同电池组同单体的记录变为历史(rebuild_clear_type=0)
|
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;
|
}
|
}
|