| | |
| | | package com.fgkj.services; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.fgkj.mapper.BaseDAO; |
| | | import com.fgkj.mapper.BaseDAOFactory; |
| | | import com.fgkj.mapper.impl.User_infImpl; |
| | | import com.fgkj.dto.ServiceModel; |
| | | import com.fgkj.dto.User_battmaint_check; |
| | | import com.fgkj.dto.User_battmaint_check_process; |
| | | import com.fgkj.dto.User_inf; |
| | | import com.fgkj.mapper.impl.User_battmaint_check_processMapper; |
| | | import com.fgkj.mapper.impl.User_infMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | @Service |
| | | public class User_battmaint_check_processService { |
| | | |
| | | private ServiceModel model; |
| | | |
| | | |
| | | private Impl mapper;; |
| | | @Resource |
| | | private User_battmaint_check_processMapper mapper; |
| | | @Resource |
| | | private User_infMapper userInfMapper; |
| | | |
| | | public User_battmaint_check_processService() { |
| | | model=new ServiceModel(); |
| | | dao=BaseDAOFactory.getBaseDAO(BaseDAO.USER_BATTMAINT_CHECK_PROCESS); |
| | | public ServiceModel add(Object obj) { |
| | | ServiceModel model = new ServiceModel(); |
| | | Boolean bl=mapper.add(obj); |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("添加成功!"); |
| | | } |
| | | else{ |
| | | model.setMsg("添加失败!"); |
| | | } |
| | | return model; |
| | | |
| | | } |
| | | |
| | | public ServiceModel add(Object obj) { |
| | | Boolean bl=dao.add(obj); |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("添加成功!"); |
| | | } |
| | | else{ |
| | | model.setMsg("添加失败!"); |
| | | } |
| | | return model; |
| | | |
| | | public ServiceModel update(Object obj) { |
| | | ServiceModel model = new ServiceModel(); |
| | | Boolean bl=mapper.update(obj); |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("修改成功!"); |
| | | } |
| | | public ServiceModel update(Object obj) { |
| | | Boolean bl=dao.update(obj); |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("修改成功!"); |
| | | } |
| | | else{ |
| | | model.setMsg("修改失败!"); |
| | | } |
| | | return model; |
| | | else{ |
| | | model.setMsg("修改失败!"); |
| | | } |
| | | public ServiceModel delete(Object obj) { |
| | | Boolean bl=dao.del(obj); |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("删除成功!"); |
| | | } |
| | | else{ |
| | | model.setMsg("删除失败!"); |
| | | } |
| | | return model; |
| | | return model; |
| | | } |
| | | public ServiceModel delete(Object obj) { |
| | | ServiceModel model = new ServiceModel(); |
| | | Boolean bl=mapper.del(obj); |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("删除成功!"); |
| | | } |
| | | else{ |
| | | model.setMsg("删除失败!"); |
| | | } |
| | | return model; |
| | | } |
| | | //4.10根据User_battmaint_check的num查询User_battmaint_check_process对应的数据 |
| | | public ServiceModel serchByCondition(Object obj){ |
| | | List<User_battmaint_check_process> list=dao.serchByCondition(obj); |
| | | public ServiceModel serchByCondition(User_battmaint_check obj){ |
| | | ServiceModel model = new ServiceModel(); |
| | | List<User_battmaint_check_process> list=mapper.serchByCondition(obj); |
| | | int usr_id=0;//编辑人 |
| | | String usr_name=""; |
| | | for (int i = 0; i <list.size(); i++) { |
| | | User_inf uinf=new User_inf(); |
| | | usr_id=list.get(i).getUsr_id(); |
| | | uinf.setUId(usr_id); |
| | | usr_name=((User_inf)(new User_infImpl()).serchUname(uinf).get(0)).getUName(); |
| | | uinf.setuId(usr_id); |
| | | List<User_inf> user_infs = userInfMapper.serchUname(uinf); |
| | | if (user_infs!=null&&user_infs.size()>0) { |
| | | usr_name = user_infs.get(0).getuName(); |
| | | } |
| | | list.get(i).setUsr_name(usr_name); |
| | | } |
| | | //System.out.println(list); |
| | | if(list!=null && list.size()>0){ |
| | | model.setCode(1); |
| | | model.setData(list); |
| | | } |
| | | } |
| | | //System.out.println(model); |
| | | return model; |
| | | } |
| | | public ServiceModel searchAll() { |
| | | List<User_battmaint_check_process> list = dao.searchAll(); |
| | | ServiceModel model = new ServiceModel(); |
| | | List<User_battmaint_check_process> list = mapper.searchAll(); |
| | | //System.out.println(list.size()); |
| | | |
| | | if (list != null && list.size() > 0) { |
| | |
| | | } |
| | | return model; |
| | | } |
| | | public static void main(String[] args) { |
| | | User_battmaint_check_processService us=new User_battmaint_check_processService(); |
| | | User_battmaint_check mcheck=new User_battmaint_check(); |
| | | mcheck.setNum(4); |
| | | us.serchByCondition(mcheck); |
| | | } |
| | | |
| | | } |