guoyujie
2 天以前 c4b9a339caff12e95f61c3d5dc950aafcc8c566c
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
package com.example.erp.service.pp;
 
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.erp.entity.pp.FlowCard;
import com.example.erp.entity.pp.TagStyle;
import com.example.erp.mapper.pp.FlowCardMapper;
import com.example.erp.mapper.pp.TagStyleMapper;
import org.springframework.stereotype.Service;
 
import java.util.List;
import java.util.Map;
 
@Service
@DS("pp")
public class TagStyleService {
    private final TagStyleMapper tagStyleMapper;
 
    final
    FlowCardMapper flowCardMapper;
 
    public TagStyleService(TagStyleMapper tagStyleMapper, FlowCardMapper flowCardMapper) {
        this.tagStyleMapper = tagStyleMapper;
        this.flowCardMapper = flowCardMapper;
    }
 
    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);
    }
 
    public Boolean addTag(TagStyle tagStyle) {
 
        tagStyle.setId(null);
        return tagStyleMapper.insert(tagStyle)>0;
    }
 
    public Boolean updatePrintNumberSv(Map<String, Object> object) {
        List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("printList")), FlowCard.class);
        if (!flowCardList.isEmpty()) {
            for (FlowCard flowCard : flowCardList) {
                // 更新打印状态
                flowCardMapper.updatePrintNumberMp( flowCard.getProcessId(), flowCard.getOrderNumber());
            }
            return true;
        } else {
            return false;
        }
    }
}