guoyuji
2024-06-13 054d444182d93e1ffed8ff61e90c2e3a96a34152
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
package com.example.erp.service.pp;
 
import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.erp.entity.pp.TagStyle;
import com.example.erp.mapper.pp.TagStyleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service
@DS("pp")
public class TagStyleService {
    private final TagStyleMapper tagStyleMapper;
 
    public TagStyleService(TagStyleMapper tagStyleMapper) {
        this.tagStyleMapper = tagStyleMapper;
    }
 
    public Boolean saveTag(TagStyle tagStyle) {
        if(tagStyle.getId()==null){
            return tagStyleMapper.insert(tagStyle)>0;
        }else {
            return tagStyleMapper.updateById(tagStyle)>0;
        }
 
    }
 
    public List<TagStyle> getTagList() {
        return tagStyleMapper.selectList(null);
    }
 
    public boolean deleteTag(Integer id) {
        return tagStyleMapper.deleteById(id)>0;
    }
 
    public Boolean updateTag(TagStyle tagStyle) {
        return tagStyleMapper.updateById(tagStyle)>0;
    }
 
    public TagStyle getTagById(Integer id) {
        return tagStyleMapper.selectById(id);
    }
}