duhuizhe
2024-04-18 f4ac3c37d09873f8271c6b07571d1c8183bb9d11
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
package com.yqzx.common.service.impl;
 
 
import com.yqzx.common.mapper.BaseMapper;
 
import java.util.List;
 
/**
 * @Description: 公共基础Service实现类
 * @Author: liujun
 * @Date: 2019-08-02 11:18
 **/
public abstract class BaseServiceImpl<T,Q,R>  {
 
    private BaseMapper<T,Q,R> baseMapper;
 
    public void setBaseMapper(BaseMapper<T,Q,R> baseMapper) {
        this.baseMapper = baseMapper;
    }
 
 
    public int del(Long id) {
        return baseMapper.deleteByPrimaryKey(id);
    }
 
    public int add(T t) {
        return baseMapper.insert(t);
    }
 
    public int addSelective(T t) {
        return baseMapper.insertSelective(t);
    }
 
    public T get(Long id) {
        return baseMapper.selectByPrimaryKey(id);
    }
 
    public int editSelective(T t) {
        return baseMapper.updateByPrimaryKeySelective(t);
    }
 
    public int edit(T t) {
        return baseMapper.updateByPrimaryKey(t);
    }
 
    public List<R> getList(Q q) {
        return baseMapper.selectList(q);
    }
}