New file |
| | |
| | | package com.dy.pipIrrBase.divide; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoBa.BaDivideMapper; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaDivide; |
| | | 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; |
| | | |
| | | /** |
| | | * @author wuzeyu |
| | | * @date 2023/12/26 11:12 |
| | | * @LastEditTime 2023/12/26 11:12 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class DivideSv { |
| | | |
| | | private BaDivideMapper dao; |
| | | |
| | | @Autowired |
| | | private void setDao(BaDivideMapper dao) { this.dao = dao; } |
| | | |
| | | /** |
| | | * 得到所有分水口 |
| | | * @return 所有分水口集合 |
| | | */ |
| | | public QueryResultVo<List<BaDivide>> selectAll(){ |
| | | QueryResultVo<List<BaDivide>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.obj = this.dao.selectAll() ; |
| | | return rsVo ; |
| | | } |
| | | /** |
| | | * 得到一个分水口 |
| | | * @param id 分水口ID |
| | | * @return 分水口实体 |
| | | */ |
| | | public BaDivide selectById(Long id){ |
| | | return this.dao.selectByPrimaryKey(id) ; |
| | | } |
| | | /** |
| | | * 得到一些分水口 |
| | | * @param vo 查询条件值对象 |
| | | * @return 分水口实体 |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public QueryResultVo<List<BaDivide>> selectSome(DivideVo vo){ |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ; |
| | | Long itemTotal = this.dao.selectTotal(params) ; |
| | | |
| | | QueryResultVo<List<BaDivide>> 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(BaDivide po){ |
| | | return this.dao.insertSelective(po) ; |
| | | } |
| | | /** |
| | | * 保存修改实体 |
| | | * @param po 实体 |
| | | * @return 数量 |
| | | */ |
| | | @Transactional |
| | | public int update(BaDivide po){ |
| | | return this.dao.updateByPrimaryKeySelective(po) ; |
| | | } |
| | | |
| | | /** |
| | | * 逻辑删除实体 |
| | | * @param id 实体ID |
| | | * @return 数量 |
| | | */ |
| | | @Transactional |
| | | public int delete(Long id){ |
| | | return this.dao.deleteLogicById(id) ; |
| | | } |
| | | } |