package com.dy.pipIrrSell.client; import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper; import com.dy.pipIrrGlobal.daoSe.SeClientMapper; import com.dy.pipIrrGlobal.pojoSe.SeClient; import com.dy.pipIrrGlobal.voSe.VoClient; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.common.utils.PojoUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; /** * @author ZhuBaoMin * @date 2023/12/21 19:17 * @LastEditTime 2023/12/21 19:17 * @Description */ @Slf4j @Service public class ClientSv { @Autowired private SeClientMapper seClientMapper; @Autowired private BaDistrictMapper baDistrictMapper; /** * 根据指定条件获取农户数据 * @param vo * @return */ public QueryResultVo> getClients(QueryVo vo){ Map params = (Map) PojoUtils.generalize(vo) ; Long itemTotal = seClientMapper.getRecordCount(params); QueryResultVo> rsVo = new QueryResultVo<>() ; rsVo.pageSize = vo.pageSize ; //rsVo.pageCurr = vo.pageCurr ; Integer pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); params.put("pageCurr", pageCurr); rsVo.pageCurr = pageCurr; rsVo.calculateAndSet(itemTotal, params); rsVo.obj = seClientMapper.getClients(params); return rsVo ; } /** * 根据主键获取农户对象 * @param id 农户主键 * @return 农户对象 */ public VoClient getOneClient(Long id) { SeClient seClient = seClientMapper.selectByPrimaryKey(id); VoClient voClient = SeClientToVoClient.INSTANCT.po2vo(seClient); return voClient; } /** * 增开农户 * @param po * @return */ public Integer addClient(SeClient po) { return seClientMapper.insert(po); } /** * 根据6位区划串模糊查询农户编号 * @param district6 * @return */ public String getClientNumOfMax(String district6) { return seClientMapper.getClientNumOfMax(district6); } /** * 根据村编号获取5级区划信息 * @param villageId 村编号(主键) * @return 5级行政区划信息 */ public Map getDistrictsByVillageId(Long villageId) { return baDistrictMapper.getDistrictsByVillageId(villageId); } /** * 根据农户ID逻辑删除农户 */ public Integer deleteClientById(Long id) { return seClientMapper.deleteClientById(id); } /** * 修改农户对象 * @param po 农户对象 * @return 修改记录条数 */ public Integer updateByPrimaryKey(SeClient po) { return seClientMapper.updateByPrimaryKey(po); } /** * 根据主键获取村ID * @param id * @return */ public Long getVillageIdById(Long id) { return seClientMapper.getVillageIdById(id); } /** * 获取虚拟卡号最大值 * @return */ public Long getMa1xVirtualId() { return seClientMapper.getMa1xVirtualId(); } /** * 获取用水方式列表 * @return */ public List> getWaterTypes() { return seClientMapper.getWaterTypes(); } }