package com.dy.pipIrrModel.crops;
|
|
import com.dy.common.webUtil.QueryResultVo;
|
import com.dy.pipIrrGlobal.daoMd.MdCropsMapper;
|
import com.dy.pipIrrGlobal.pojoMd.MdCrops;
|
import com.dy.pipIrrGlobal.voMd.VoCrops;
|
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: liurunyu
|
* @Date: 2025/8/6 11:11
|
* @Description
|
*/
|
|
@Slf4j
|
@Service
|
public class CropsSv {
|
|
private MdCropsMapper mdCropsDao ;
|
|
@Autowired
|
private void setDao(MdCropsMapper dao) { this.mdCropsDao = dao; }
|
|
/**
|
* 得到一个实体
|
* @param id 实体ID
|
* @return 实体
|
*/
|
public VoCrops selectById(Long id){
|
return this.mdCropsDao.selectById(id) ;
|
}
|
|
/**
|
* 查询一些实体
|
* @param qo 查询条件值对象
|
* @return 包含实体集合的结果对象
|
*/
|
@SuppressWarnings("unchecked")
|
public QueryResultVo<List<VoCrops>> selectSome(CropsQo qo){
|
Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ;
|
Long itemTotal = this.mdCropsDao.selectTotal(params) ;
|
|
QueryResultVo<List<VoCrops>> rsVo = new QueryResultVo<>() ;
|
rsVo.pageSize = qo.pageSize ;
|
rsVo.pageCurr = qo.pageCurr ;
|
rsVo.calculateAndSet(itemTotal, params);
|
rsVo.obj = this.mdCropsDao.selectSome(params) ;
|
|
return rsVo ;
|
}
|
/**
|
* 添加实体
|
* @param po 实体
|
* @return 实体ID
|
*/
|
public Integer save(MdCrops po){
|
return mdCropsDao.insert(po);
|
}
|
/**
|
* 修改实体
|
* @param po
|
* @return
|
*/
|
public int update(MdCrops po) {
|
return mdCropsDao.updateByPrimaryKeySelective(po);
|
}
|
|
/**
|
* 根据实体ID逻辑删除实体
|
* @param id 实体
|
* @return
|
*/
|
public Integer delete(Long id) {
|
return mdCropsDao.deleteById(id);
|
}
|
|
|
}
|