| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- package com.ydtech.modules.protocol.service.impl;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
- import com.ydtech.exception.SystemException;
- import com.ydtech.modules.protocol.dao.PtlAgreementDeptMapper;
- import com.ydtech.modules.protocol.entity.po.PtlAgreementDept;
- import com.ydtech.modules.protocol.service.PtlAgreementDeptService;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import java.util.List;
- /**
- * @author wenks
- * @description 针对表【ptl_agreement_dept(协议授权部门表)】的数据库操作Service实现
- * @createDate 2023-07-03 09:31:16
- */
- @Service
- public class PtlAgreementDeptServiceImpl extends ServiceImpl<PtlAgreementDeptMapper, PtlAgreementDept>
- implements PtlAgreementDeptService {
- @Override
- @Transactional
- public void saveBatchDept(String agreementId, List<String> dept) {
- List<PtlAgreementDept> ptlAgreementDeptList = PtlAgreementDept.toPtlAgreementDeptList(agreementId, dept);
- saveBatch(ptlAgreementDeptList);
- }
- @Override
- public List<PtlAgreementDept> getByAgreementId(String agreementId) {
- return list(byAgreementId(agreementId));
- }
- @Override
- public void deleteByAgreementId(String agreementId) {
- remove(byAgreementId(agreementId));
- }
- @Override
- public void agreementIsAuthorized(String deptId, String agreementId) {
- List<PtlAgreementDept> list = list(byAgreementId(agreementId).eq(PtlAgreementDept::getDeptId, deptId));
- if (list.isEmpty()) {
- throw new SystemException("请联系团队长授权");
- }
- }
- private LambdaQueryWrapper<PtlAgreementDept> byAgreementId(String agreementId) {
- LambdaQueryWrapper<PtlAgreementDept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
- lambdaQueryWrapper.eq(PtlAgreementDept::getAgreementId, agreementId);
- return lambdaQueryWrapper;
- }
- }
|