/***文档注释***********************************************
 * 作者            ：
 * 创建日期     ：2019-08-23
 * 描述            ：用户表
 * 注意事项     ：
 * 遗留BUG   ：
 * 修改日期     ：
 * 修改人员     ：
 * 修改内容     ：
***********************************************************/
package market.Slm.MarketMap.impl;
import java.util.List;

import market.Com.vo.CommonPage;
import market.Com.vo.ResultModel;
import market.Slm.MarketMap.mapper.SysUserMapper;
import market.Slm.MarketMap.service.SysUserService;
import market.Slm.MarketMap.vo.SlmBaseSaleareaChild;
import market.Slm.MarketMap.vo.SysUser;

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

@RemoteService(path="SysUserService")
public class SysUserServiceImpl extends BaseServiceImpl<SysUser,Object> implements SysUserService {
	public ResultModel doQueryWeb(CommonPage<SysUser> oci){
		ResultModel rm=new ResultModel();
		try{
			SysUser su=oci.getObject()==null?new SysUser():oci.getObject();
			su.setStatus("1");
			rm.setData(this.getMapper(SysUserMapper.class).doQuery(su));
			rm.setState("200");
		}catch(Exception ex){
			rm.setState("500");
			rm.setMsgInfo("查询失败："+ex.getMessage());
			ex.printStackTrace();
		}
		return rm;
	}
	
	/**
	 * SlmBaseSaleareaChild 传sale_area_no
	 * @param oci
	 * @return
	 */
	public ResultModel doQueryAreaPersonWeb(CommonPage<SlmBaseSaleareaChild> oci){
		ResultModel rm=new ResultModel();
		int pageIndex=oci.getPageIndex();
		int pageSize=oci.getPageSize();
		try{
			SlmBaseSaleareaChild su=oci.getObject()==null?new SlmBaseSaleareaChild():oci.getObject();
			List<SysUser> list=this.getMapper(SysUserMapper.class).doQueryAreaPerson(su.getSale_area_no(),(pageIndex-1)*pageSize, pageIndex*pageSize);
			int count=this.getMapper(SysUserMapper.class).doCountAreaPerson(su.getSale_area_no());
			PageModel<SysUser> pm=new PageModel<SysUser>(pageIndex,pageSize);
			pm.setRows(list);
			pm.setTotal(count);
			rm.setData(pm);
			rm.setState("200");
		}catch(Exception ex){
			rm.setState("500");
			rm.setMsgInfo("查询失败："+ex.getMessage());
			ex.printStackTrace();
		}
		
		return rm;
	}
}
