ustcyc
2025-01-07 5fd51c437819f1c9d027a936db4ba2ee7cd2e053
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package com.zhitan.costmanagement.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import java.util.UUID;
 
import com.zhitan.common.utils.DateUtils;
import com.zhitan.common.utils.StringUtils;
import com.zhitan.costmanagement.domain.CostElectricityInput;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhitan.costmanagement.mapper.CostPriceRelevancyMapper;
import com.zhitan.costmanagement.domain.CostPriceRelevancy;
import com.zhitan.costmanagement.service.ICostPriceRelevancyService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 
/**
 * 单价关联Service业务层处理
 *
 * @author ZhiTan
 * @date 2024-11-09
 */
@Service
public class CostPriceRelevancyServiceImpl extends ServiceImpl<CostPriceRelevancyMapper, CostPriceRelevancy> implements ICostPriceRelevancyService {
    @Autowired
    private CostPriceRelevancyMapper costPriceRelevancyMapper;
 
    /**
     * 查询单价关联
     *
     * @param id 单价关联主键
     * @return 单价关联
     */
    @Override
    public CostPriceRelevancy selectCostPriceRelevancyById(String id) {
        return costPriceRelevancyMapper.selectCostPriceRelevancyById(id);
    }
 
    /**
     * 查询单价关联列表
     *
     * @param costPriceRelevancy 单价关联
     * @return 单价关联
     */
    @Override
    public Page<CostPriceRelevancy> selectCostPriceRelevancyList(CostPriceRelevancy costPriceRelevancy,Long pageNum, Long pageSize) {
        LambdaQueryWrapper<CostPriceRelevancy> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(StringUtils.isNotEmpty(costPriceRelevancy.getNodeId()),CostPriceRelevancy::getNodeId,costPriceRelevancy.getNodeId());
      if(costPriceRelevancy.getEnergyType()!=null){
          queryWrapper.eq(StringUtils.isNotEmpty(costPriceRelevancy.getEnergyType().toString()),CostPriceRelevancy::getEnergyType,costPriceRelevancy.getEnergyType());
 
      }
         queryWrapper.orderByDesc(CostPriceRelevancy::getCreateTime);
        Page<CostPriceRelevancy> page = costPriceRelevancyMapper.selectPage(new Page<>(pageNum,pageSize),queryWrapper);
        return page;
    }
 
    /**
     * 新增单价关联
     *
     * @param costPriceRelevancy 单价关联
     * @return 结果
     */
    @Override
    public int insertCostPriceRelevancy(CostPriceRelevancy costPriceRelevancy) {
        costPriceRelevancy.setCreateTime(DateUtils.getNowDate());
        costPriceRelevancy.setId(UUID.randomUUID().toString());
        return costPriceRelevancyMapper.insertCostPriceRelevancy(costPriceRelevancy);
    }
 
    /**
     * 修改单价关联
     *
     * @param costPriceRelevancy 单价关联
     * @return 结果
     */
    @Override
    public int updateCostPriceRelevancy(CostPriceRelevancy costPriceRelevancy) {
        costPriceRelevancy.setUpdateTime(DateUtils.getNowDate());
        return costPriceRelevancyMapper.updateCostPriceRelevancy(costPriceRelevancy);
    }
 
    /**
     * 批量删除单价关联
     *
     * @param ids 需要删除的单价关联主键
     * @return 结果
     */
    @Override
    public int deleteCostPriceRelevancyByIds(String[] ids) {
        return costPriceRelevancyMapper.deleteCostPriceRelevancyByIds(ids);
    }
 
    /**
     * 删除单价关联信息
     *
     * @param id 单价关联主键
     * @return 结果
     */
    @Override
    public int deleteCostPriceRelevancyById(String id) {
        return costPriceRelevancyMapper.deleteCostPriceRelevancyById(id);
    }
}