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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
package com.vci.web.dao.impl;
 
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.PageHelper;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.web.dao.OsCodeGenSchemaDaoI;
import com.vci.model.OsCodeGenSchemaDO;
import com.vci.web.service.OsLinkTypeServiceI;
import com.vci.web.service.WebBoServiceI;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
 
import java.util.List;
import java.util.Map;
 
import static com.vci.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST;
 
 
/**
 * 代码生成器的内容
 * @author weidy
 * @date 2021/8/23
 */
@Repository
public class OsCodeGenSchemaDaoImpl implements OsCodeGenSchemaDaoI {
 
    /**
     * 业务类型操作的服务
     */
    @Autowired
    private WebBoServiceI boService;
 
    /**
     * 生命周期的服务
     */
    @Autowired
    private OsLinkTypeServiceI lifeCycleService;
    /**
     * 使用主键删除
     *
     * @param oid 主键
     * @return 受影响的个数
     */
    @Override
    public int deleteByPrimaryKey(String oid) {
        VciBaseUtil.alertNotNull(oid,"主键");
        OsCodeGenSchemaDO osCodeGenSchemaDO = selectByPrimaryKey(oid);
        boService.delete(osCodeGenSchemaDO);
        return 1;
    }
 
    /**
     * 插入数据
     *
     * @param record 数据的对象
     * @return 受影响的个数
     */
    @Override
    public int insert(OsCodeGenSchemaDO record) {
        VciBaseUtil.alertNotNull(record,"要添加的数据");
        boService.addSave(record);
        return 1;
    }
 
    /**
     * 使用主键查询
     *
     * @param oid 主键
     * @return 数据对象
     */
    @Override
    public OsCodeGenSchemaDO selectByPrimaryKey(String oid) {
        VciBaseUtil.alertNotNull(oid,"主键");
        OsCodeGenSchemaDO schemaDO = boService.selectByOid(oid, OsCodeGenSchemaDO.class);
        if(schemaDO == null || StringUtils.isBlank(schemaDO.getOid())){
            throw new VciBaseException(DATA_OID_NOT_EXIST);
        }
        return schemaDO;
    }
 
    /**
     * 查询全部
     *
     * @return 数据对象
     */
    @Override
    public List<OsCodeGenSchemaDO> selectAll() {
        return boService.queryObject(OsCodeGenSchemaDO.class,null);
    }
 
    /**
     * 使用主键更新
     *
     * @param record 数据对象
     * @return 受影响的行数
     */
    @Override
    public int updateByPrimaryKey(OsCodeGenSchemaDO record) {
        VciBaseUtil.alertNotNull(record,"要修改的对象",record.getOid(),"主键");
        boService.editSave(record);
        return 1;
    }
 
    /**
     * 根据查询条件查询数据
     *
     * @param conditionMap 查询条件
     * @param pageHelper   分页对象
     * @return 数据对象列表
     */
    @Override
    public List<OsCodeGenSchemaDO> selectByWrapper(Map< String, String> conditionMap, PageHelper pageHelper) {
        return boService.queryObject(OsCodeGenSchemaDO.class,conditionMap,pageHelper);
    }
 
    /**
     * 根据查询条件来查询总数
     *
     * @param conditionMap 查询条件
     * @return 总数
     */
    @Override
    public Integer countByWrapper(Map<String, String> conditionMap) {
        return boService.queryCount(OsCodeGenSchemaDO.class,conditionMap);
    }
 
}