zhubaomin
2024-11-14 9a34c6b7a1a1bd98408849dc5dda44709727adb6
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.dy.pipIrrBase.rtuUpgrade.program;
 
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoRm.UgRtuProgramMapper;
import com.dy.pipIrrGlobal.pojoUg.UgRtuProgram;
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: liurunyu
 * @Date: 2024/11/5 8:33
 * @Description
 */
@Slf4j
@Service
public class UgRtuProgramSv {
 
    @Autowired
    private UgRtuProgramMapper dao ;
 
    /**
     * 得到一个一些升级程序
     * @param id 一些升级程序ID
     * @return 一些升级程序实体
     */
    public UgRtuProgram selectById(Long id){
        return this.dao.selectByPrimaryKey(id) ;
    }
 
    /**
     * 得到一些升级程序
     * @return 一些升级程序
     */
    public QueryResultVo<List<UgRtuProgram>> selectSome(QueryVo queryVo){
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ;
        Long itemTotal = this.dao.selectTotal(params) ;
 
        QueryResultVo<List<UgRtuProgram>> rsVo = new QueryResultVo<>() ;
        rsVo.pageSize = queryVo.pageSize ;
        rsVo.pageCurr = queryVo.pageCurr ;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = this.dao.selectSome(params) ;
 
        return rsVo ;
    }
 
    /**
     * 得到所有升级程序记录ID和文件名称
     * @return 一些升级程序
     */
    public QueryResultVo<List<UgRtuProgram>> selectAll(){
        QueryResultVo<List<UgRtuProgram>> rsVo = new QueryResultVo<>() ;
        rsVo.obj = this.dao.selectAll() ;
        return rsVo ;
    }
    /**
     * 查询数据库,是否存在给定升级文件名称
     * @param programFileName 文件名称
     * @return bool
     */
    public boolean existFileName(String programFileName){
        Long count = this.dao.selectByFileName(programFileName) ;
        if(count != null && count > 0){
            return true ;
        }else{
            return false ;
        }
    }
 
    /**
     * 新增保存分水口实体
     * @param po 实体
     * @return 数量
     */
    @Transactional
    public int save(UgRtuProgram po){
        return this.dao.insertSelective(po) ;
    }
    /**
     * 保存修改实体
     * @param po 实体
     * @return 数量
     */
    @Transactional
    public int update(UgRtuProgram po){
        return this.dao.updateByPrimaryKeySelective(po) ;
    }
 
    /**
     * 逻辑删除实体
     * @param id 实体ID
     * @return 数量
     */
    @Transactional
    public int delete(Long id){
        return this.dao.deleteLogicById(id) ;
    }
 
}