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 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 object) { List 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; } } }