|
@@ -3,13 +3,21 @@ package org.springblade.business.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springblade.business.entity.PrivateStandard;
|
|
|
+import org.springblade.business.entity.UStandardInfo;
|
|
|
+import org.springblade.business.mapper.StandardInfoJoinMapper;
|
|
|
+import org.springblade.business.mapper.StandardInfoMapper;
|
|
|
+import org.springblade.business.mapper.StandardInfoPrivateJoinMapper;
|
|
|
import org.springblade.business.service.PrivateStandardService;
|
|
|
import org.springblade.business.mapper.PrivateStandardMapper;
|
|
|
+import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
/**
|
|
|
* @author LHB
|
|
|
* @description 针对表【u_wbs_private_standard(规范文件夹及规范文件表)】的数据库操作Service实现
|
|
@@ -18,6 +26,14 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
@Service
|
|
|
public class PrivateStandardServiceImpl extends ServiceImpl<PrivateStandardMapper, PrivateStandard>
|
|
|
implements PrivateStandardService {
|
|
|
+ @Resource
|
|
|
+ private StandardInfoMapper standardInfoMapper;
|
|
|
+ @Resource
|
|
|
+ private StandardInfoJoinMapper standardInfoJoinMapper;
|
|
|
+ @Resource
|
|
|
+ private StandardInfoPrivateJoinMapper standardInfoPrivateJoinMapper;
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean insert(PrivateStandard uWbsPrivateStandard) {
|
|
@@ -33,18 +49,34 @@ public class PrivateStandardServiceImpl extends ServiceImpl<PrivateStandardMappe
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean delete(Long id) {
|
|
|
- //获取当前用户
|
|
|
- BladeUser user = SecureUtil.getUser();
|
|
|
- int update = baseMapper.update(null, Wrappers.<PrivateStandard>lambdaUpdate()
|
|
|
- .set(PrivateStandard::getIsDeleted, 1)
|
|
|
- .set(PrivateStandard::getUpdateUser, user.getUserId())
|
|
|
- .eq(PrivateStandard::getId, id)
|
|
|
- .or()
|
|
|
- .eq(PrivateStandard::getParentId, id)
|
|
|
- );
|
|
|
- //TODO 后续还要删除规范详细信息
|
|
|
-
|
|
|
- return update > 0;
|
|
|
+
|
|
|
+ try {
|
|
|
+ //获取当前用户
|
|
|
+ BladeUser user = SecureUtil.getUser();
|
|
|
+ int update = baseMapper.update(null, Wrappers.<PrivateStandard>lambdaUpdate()
|
|
|
+ .set(PrivateStandard::getIsDeleted, 1)
|
|
|
+ .set(PrivateStandard::getUpdateUser, user.getUserId())
|
|
|
+ .eq(PrivateStandard::getId, id)
|
|
|
+ .or()
|
|
|
+ .eq(PrivateStandard::getParentId, id)
|
|
|
+ );
|
|
|
+ //TODO 后续还要删除规范详细信息
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ int update1 = standardInfoMapper.update(null, Wrappers.<UStandardInfo>lambdaUpdate()
|
|
|
+ .set(UStandardInfo::getIsDeleted, 1)
|
|
|
+ .set(UStandardInfo::getUpdateUser, user.getUserId())
|
|
|
+ .eq(UStandardInfo::getStandardId, id));
|
|
|
+ //TODO 还要删除关联信息
|
|
|
+ standardInfoJoinMapper.updateJoin(user.getUserId(),1,id);
|
|
|
+ //TODo 还要删除与表单的关联信息
|
|
|
+ standardInfoPrivateJoinMapper.updateJoin(user.getUserId(),1,id);
|
|
|
+ return update > 0;
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new ServiceException("删除失败");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|