package market.Lms.FixedAssets.impl;


import java.util.ArrayList;
import java.util.List;

import market.Com.vo.CommonPage;
import market.Com.vo.ResultModel;
import market.Lms.FixedAssets.mapper.LmsFixedAssetsChangeOldMapper;
import market.Lms.FixedAssets.service.LmsFixedAssetsChangeOldService;
import market.Lms.FixedAssets.vo.LmsFixedAssetsChangeOld;

import com.hnshituo.basic.service.impl.BaseServiceImpl;
import com.hnshituo.basic.service.support.PageModel;
import com.hnshituo.basic.spring.remoting.annotation.RemoteService;

@RemoteService(path="LmsFixedAssetsChangeOld")
public class LmsFixedAssetsChangeOldServiceImpl extends BaseServiceImpl<LmsFixedAssetsChangeOld,Object> implements LmsFixedAssetsChangeOldService{

	/*******************************WEB***********************************/
	/**Web端根据条件查询（1资产类别  2资产名称  3SN序号 ）
	 * 暂定SN序号模糊查询
	 * @return
	 */
	public ResultModel doQueryWeb(CommonPage<LmsFixedAssetsChangeOld> sum){
		ResultModel rm = new ResultModel();
		LmsFixedAssetsChangeOld changeInfo = sum.getObject();
		int pageIndex = sum.getPageIndex();
		int pageSize = sum.getPageSize();
		String beginTime = sum.getStartTime();
		String endTime = sum.getEndTime();
		List<LmsFixedAssetsChangeOld> changeInfoList = new ArrayList<LmsFixedAssetsChangeOld>();
		PageModel<LmsFixedAssetsChangeOld> pm=new PageModel<LmsFixedAssetsChangeOld>(pageIndex, pageSize);
		int count = 0;
		try{
			changeInfoList = this.getMapper(LmsFixedAssetsChangeOldMapper.class).doQueryList(changeInfo,beginTime,endTime,(pageIndex-1)*pageSize, pageSize);
			count = this.getMapper(LmsFixedAssetsChangeOldMapper.class).countList(changeInfo,beginTime,endTime);
			pm.setRows(changeInfoList);
			pm.setTotal(count);
			rm.setData(pm);
			rm.setState("200");
		}catch(Exception e){
			rm.setState("500");
		}
		return rm;
	}
	
	/*******************************WEB***********************************/
	
	/*******************************APP***********************************/
	/**Web端根据条件查询（1资产类别  2资产名称  3SN序号 ）
	 * 暂定SN序号模糊查询
	 * @return
	 */
	public List<LmsFixedAssetsChangeOld> doQueryApp(CommonPage<LmsFixedAssetsChangeOld> sum){
		LmsFixedAssetsChangeOld changeInfo = sum.getObject();
		int pageIndex = sum.getPageIndex();
		int pageSize = sum.getPageSize();
		String beginTime = sum.getStartTime();
		String endTime = sum.getEndTime();
		List<LmsFixedAssetsChangeOld> changeInfoList = new ArrayList<LmsFixedAssetsChangeOld>();
		try{
			changeInfoList = this.getMapper(LmsFixedAssetsChangeOldMapper.class).doQueryList(changeInfo,beginTime,endTime,pageIndex, pageSize);
		}catch(Exception e){
			return new ArrayList<LmsFixedAssetsChangeOld>();
		}
		return changeInfoList;
	}
	/*******************************APP***********************************/
	
	
	//新增
	public String doAdd(LmsFixedAssetsChangeOld old){
		String id = old.getChange_no();
		this.getMapper(LmsFixedAssetsChangeOldMapper.class).insert(old);
		return id;
	}

	//删除
	public void doDelete(LmsFixedAssetsChangeOld old){
		this.getMapper(LmsFixedAssetsChangeOldMapper.class).delete(old.getChange_no());
	}

	//修改
	public void doUpdate(LmsFixedAssetsChangeOld old){
		this.getMapper(LmsFixedAssetsChangeOldMapper.class).update(old);
	}

	//查询
	public LmsFixedAssetsChangeOld doQuery(String oldNo){
		LmsFixedAssetsChangeOld old = new LmsFixedAssetsChangeOld();
		old = this.getMapper(LmsFixedAssetsChangeOldMapper.class).findById(oldNo);
		return old;
	}
}
