package com.dy.pipIrrBase.client; import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoBa.BaClientMapper; import com.dy.pipIrrGlobal.pojoBa.BaClient; import com.dy.pipIrrGlobal.pojoBa.BaClientType; 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 org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @Slf4j @Service public class ClientSv { private BaClientMapper dao; @Autowired private void setDao(BaClientMapper dao){ this.dao = dao; } /** * 得到一个农户类型 * @param id 农户类型ID * @return 农户类型实体 */ public BaClient selectById(Long id){ return this.dao.selectById(id) ; } /** * 得到一个用户 * @param vo 查询条件值对象 * @return 用户实体 */ @SuppressWarnings("unchecked") public QueryResultVo> selectSome(QueryVo vo){ Map params = (Map) PojoUtils.generalize(vo) ; Long itemTotal = this.dao.selectTotal(params) ; QueryResultVo> rsVo = new QueryResultVo<>() ; rsVo.pageSize = vo.pageSize ; rsVo.pageCurr = vo.pageCurr ; rsVo.calculateAndSet(itemTotal, params); rsVo.obj = this.dao.selectSome(params) ; return rsVo ; } /** * 保存实体 * @param po 实体 * @return 影响记录数量 */ @Transactional public int save(BaClient po){ return this.dao.insertSelective(po) ; } /** * 保存修改实体 * @param po 实体 * @return 影响记录数量 */ @Transactional public int update(BaClient po){ return this.dao.updateByPrimaryKeySelective(po) ; } /** * 保存修改实体 * @param id 实体ID * @return 影响记录数量 */ @Transactional public int delete(Long id){ return this.dao.deleteLogicById(id) ; } }