| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.dto.WorkflowPropertyDTO; |
| | | import com.whyc.dto.WorkflowPropertyDTO2; |
| | |
| | | propertyList.add(temp); |
| | | }); |
| | | |
| | | mapper.insertBatchSomeColumn(propertyList); |
| | | |
| | | } |
| | | |
| | | public void update(WorkflowPropertyDTO propertyDTO) { |
| | | List<WorkflowProperty> propertyList = new LinkedList<>(); |
| | | //数据格式整理 |
| | | List<WorkflowPropertyDTO.Role> roleList = propertyDTO.getRoleList(); |
| | | roleList.stream().forEach(role -> { |
| | | WorkflowProperty temp = new WorkflowProperty(); |
| | | temp.setLinkName(propertyDTO.getLinkName()); |
| | | temp.setLinkType(propertyDTO.getLinkType()); |
| | | temp.setRoleName(role.getName()); |
| | | temp.setRoleType(role.getType()); |
| | | temp.setType(propertyDTO.getType()); |
| | | propertyList.add(temp); |
| | | }); |
| | | |
| | | //先删除type && linkType对应的记录 |
| | | UpdateWrapper<WorkflowProperty> wrapper = Wrappers.update(); |
| | | wrapper.eq("type",propertyDTO.getType()).eq("link_type",propertyDTO.getLinkType()); |
| | | mapper.delete(wrapper); |
| | | //再新增记录 |
| | | mapper.insertBatchSomeColumn(propertyList); |
| | | |
| | | } |
| | |
| | | }); |
| | | return propertyDTOList; |
| | | } |
| | | |
| | | public void delete(Integer type, Integer linkType) { |
| | | UpdateWrapper<WorkflowProperty> wrapper = Wrappers.update(); |
| | | wrapper.eq("type",type).eq("link_type",linkType); |
| | | mapper.delete(wrapper); |
| | | } |
| | | |
| | | public List<WorkflowProperty> getLinkInfo(Integer type) { |
| | | QueryWrapper<WorkflowProperty> wrapper = Wrappers.query(); |
| | | wrapper.select("link_type","link_name").eq("type",type).orderByAsc("link_type"); |
| | | return mapper.selectList(wrapper); |
| | | } |
| | | |
| | | public List<WorkflowProperty> getRoleInfo(Integer type,Integer linkType) { |
| | | QueryWrapper<WorkflowProperty> wrapper = Wrappers.query(); |
| | | wrapper.select("role_type","role_name").eq("type",type).eq("link_type",linkType).orderByAsc("role_type"); |
| | | return mapper.selectList(wrapper); |
| | | } |
| | | } |