|
|
@@ -1,19 +1,3 @@
|
|
|
-/*
|
|
|
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
|
|
- *
|
|
|
- * Redistribution and use in source and binary forms, with or without
|
|
|
- * modification, are permitted provided that the following conditions are met:
|
|
|
- *
|
|
|
- * Redistributions of source code must retain the above copyright notice,
|
|
|
- * this list of conditions and the following disclaimer.
|
|
|
- * Redistributions in binary form must reproduce the above copyright
|
|
|
- * notice, this list of conditions and the following disclaimer in the
|
|
|
- * documentation and/or other materials provided with the distribution.
|
|
|
- * Neither the name of the dreamlu.net developer nor the names of its
|
|
|
- * contributors may be used to endorse or promote products derived from
|
|
|
- * this software without specific prior written permission.
|
|
|
- * Author: Chill 庄骞 (smallchill@163.com)
|
|
|
- */
|
|
|
package com.gubersail.admin.corp.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
@@ -26,6 +10,7 @@ import com.gubersail.dealer.admin.api.corps.entity.PjCorpsAttn;
|
|
|
import com.gubersail.dealer.admin.api.corps.vo.CorpsAttnVO;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springblade.common.constant.LandConstant;
|
|
|
+import org.springblade.common.enums.NumberEnum;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
@@ -36,7 +21,9 @@ import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* 配件批发客户明细联系人 服务实现类
|
|
|
@@ -163,4 +150,34 @@ public class CorpsAttnServiceImpl extends ServiceImpl<CorpsAttnMapper, PjCorpsAt
|
|
|
this.updateBatchById(corpsAttnList);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public R delCorpsAttn(PjCorpsAttn corpsAttn) {
|
|
|
+ if (Objects.isNull(corpsAttn.getId())) {
|
|
|
+ return R.fail("请选择要删除的数据");
|
|
|
+ }
|
|
|
+ PjCorpsAttn attn = baseMapper.selectById(corpsAttn.getId());
|
|
|
+ if (Objects.isNull(attn)) {
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
+ Date nowDate = new Date();
|
|
|
+ Long userId = AuthUtil.getUserId();
|
|
|
+ if (!Objects.isNull(attn.getUserId())) {
|
|
|
+ User delUser = new User();
|
|
|
+ delUser.setId(attn.getUserId());
|
|
|
+ delUser.setIsDeleted(NumberEnum.ONE.number);
|
|
|
+ delUser.setUpdateTime(nowDate);
|
|
|
+ delUser.setUpdateUser(userId);
|
|
|
+ int success = userClient.delUserById(delUser);
|
|
|
+ if (success <= 0) {
|
|
|
+ return R.fail("删除用户失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ corpsAttn.setUpdateTime(nowDate);
|
|
|
+ corpsAttn.setUpdateUser(userId);
|
|
|
+ corpsAttn.setIsDeleted(NumberEnum.ONE.number);
|
|
|
+ int updateCount = baseMapper.updateById(corpsAttn);
|
|
|
+ return R.status(updateCount > 0);
|
|
|
+ }
|
|
|
+
|
|
|
}
|