package com.dy.pipIrrBase.block;
|
|
import com.alibaba.fastjson2.JSON;
|
import com.dy.common.webUtil.QueryResultVo;
|
import com.dy.pipIrrGlobal.daoBa.BaBlockMapper;
|
import com.dy.pipIrrGlobal.pojoBa.BaBlock;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import org.apache.commons.beanutils.BeanUtils ;
|
|
import java.util.HashMap;
|
import java.util.Map;
|
import java.util.List;
|
|
@Slf4j
|
@Service
|
public class BlockSv {
|
|
private BaBlockMapper dao;
|
|
@Autowired
|
private void setDao(BaBlockMapper dao){
|
this.dao = dao;
|
}
|
|
/**
|
* 得到一个片区
|
* @param id 片区ID
|
* @return 片区实体
|
*/
|
public BaBlock selectById(Long id){
|
return this.dao.selectByPrimaryKey(id) ;
|
}
|
|
/**
|
* 得到一个片区
|
* @param vo 查询条件值对象
|
* @return 片区实体
|
*/
|
public QueryResultVo<List<BaBlock>> selectSome(QueryVo vo) throws Exception{
|
Map<String, Object> params = new HashMap<>();
|
BeanUtils.populate(vo, params);
|
Long itemTotal = this.dao.selectTotal(params) ;
|
|
QueryResultVo<List<BaBlock>> rsVo = new QueryResultVo<>() ;
|
rsVo.pageSize = vo.pageSize ;
|
rsVo.pageCurr = vo.pageCurr ;
|
rsVo.calculateAndSet(itemTotal, params);
|
|
List<BaBlock> list = this.dao.selectSome(params) ;
|
|
return (QueryResultVo.<List<BaBlock>>builder().content(list)).build() ;
|
}
|
|
/**
|
* 保存实体
|
* @param po 实体
|
* @return 数量
|
*/
|
public int save(BaBlock po){
|
return this.dao.insert(po) ;
|
}
|
|
/**
|
* 保存修改实体
|
* @param po 实体
|
* @return 数量
|
*/
|
public int update(BaBlock po){
|
return this.dao.updateByPrimaryKeySelective(po) ;
|
}
|
|
/**
|
* 保存修改实体
|
* @param id 实体ID
|
* @return 数量
|
*/
|
public int delete(Long id){
|
return this.dao.deleteLogicById(id) ;
|
}
|
|
}
|