中间表数据添加

This commit is contained in:
lg
2025-10-25 19:18:09 +08:00
parent e73c808bc3
commit 77e9f4d9a2
9 changed files with 144 additions and 14 deletions

View File

@ -0,0 +1,31 @@
package org.dromara.common.core.domain.vo;
import lombok.Data;
import java.io.Serial;
@Data
public class XzdCustomerSuppliervo {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
private Long id;
/**
* 类型1、供应商2、客户
*/
private String type;
/**
* 供应商-客户id
*/
private Long cSId;
}

View File

@ -0,0 +1,14 @@
package org.dromara.common.core.service;
import org.dromara.common.core.domain.vo.XzdCustomerSuppliervo;
public interface XzdCustomerSupplierService {
/**
* 查询供应商-客户中间
*
* @param id 主键
* @return 供应商-客户中间
*/
XzdCustomerSuppliervo queryByIdone(Long id);
}

View File

@ -3,4 +3,6 @@ package org.dromara.common.core.service;
public interface XzdCustomerinformationService {
String selectNmaeByIds(String id);
String selectNmaeById(Long id);
}

View File

@ -3,4 +3,7 @@ package org.dromara.common.core.service;
public interface XzdSupplierInfoService {
String selectNmaeByIds(String ids);
String selectNmaeById(Long id);
}

View File

@ -86,7 +86,7 @@ public class XzdSubcontractVo implements Serializable {
* 项目名称
*/
@ExcelProperty(value = "项目名称")
@Translation(type = TransConstant.PROJECT_ID_TO_NAME, mapper = "project")
@Translation(type = TransConstant.XZD_PROJECT_ID_TO_NAME, mapper = "project")
private String projectName;
/**

View File

@ -84,7 +84,12 @@ public class XzdCorrespondentListImp implements IXzdCorrespondentList {
private final XzdCustomerinformationMapper xzdCustomerinformationMapper;
private final IXzdCustomertypeService iXzdCustomertypeService; ;
private final IXzdCustomertypeService iXzdCustomertypeService;
private final IXzdCustomerSupplierService iXzdCustomerSupplierService;
private final IXzdCustomerSupplierYybService iXzdCustomerSupplierYybService;
@ -116,6 +121,12 @@ public class XzdCorrespondentListImp implements IXzdCorrespondentList {
long id = dto.getXzdCustomerinformation().getId();
XzdCustomerSupplier xzdCustomerSupplier = new XzdCustomerSupplier();
xzdCustomerSupplier.setCSId(id);
xzdCustomerSupplier.setType("1");
iXzdCustomerSupplierService.save(xzdCustomerSupplier);
// 客户类型添加
List<XzdCustomertypeInfoBo> xzdCustomertypeInfo = dto.getXzdCustomertypeInfo();
@ -559,6 +570,12 @@ public class XzdCorrespondentListImp implements IXzdCorrespondentList {
}
public void delCorrespondentVoid(Long dto){
// 删除中间表
XzdCustomerSupplierYyb xzdCustomerSupplierYyb = iXzdCustomerSupplierYybService.getBaseMapper().selectOne(new LambdaQueryWrapper<XzdCustomerSupplierYyb>().eq(XzdCustomerSupplierYyb::getCSId, dto));
if (xzdCustomerSupplierYyb == null) {
iXzdCustomerSupplierService.getBaseMapper().delete(new LambdaQueryWrapper<XzdCustomerSupplier>().eq(XzdCustomerSupplier::getCSId, dto));
}
// 客户信息
xzdCustomerinformationService.removeById(dto);
@ -576,11 +593,6 @@ public class XzdCorrespondentListImp implements IXzdCorrespondentList {
xzdAddressInfoService.removeByMap(temp);
// 联系人信息
// 联系人信息
List<XzdContact> xzdContact = xzdContactService.getBaseMapper().selectByMap(temp);
if (xzdContact != null && xzdContact.size() > 0) {

View File

@ -1,6 +1,8 @@
package org.dromara.xzd.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.dromara.common.core.domain.vo.XzdCustomerSuppliervo;
import org.dromara.common.core.service.XzdCustomerSupplierService;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -28,7 +30,7 @@ import java.util.Collection;
*/
@RequiredArgsConstructor
@Service
public class XzdCustomerSupplierServiceImpl extends ServiceImpl<XzdCustomerSupplierMapper, XzdCustomerSupplier> implements IXzdCustomerSupplierService {
public class XzdCustomerSupplierServiceImpl extends ServiceImpl<XzdCustomerSupplierMapper, XzdCustomerSupplier> implements IXzdCustomerSupplierService , XzdCustomerSupplierService {
private final XzdCustomerSupplierMapper baseMapper;
@ -129,4 +131,10 @@ public class XzdCustomerSupplierServiceImpl extends ServiceImpl<XzdCustomerSuppl
}
return baseMapper.deleteByIds(ids) > 0;
}
@Override
public XzdCustomerSuppliervo queryByIdone(Long id) {
XzdCustomerSupplierVo xzdCustomerSupplierVo = baseMapper.selectVoById(id);
return MapstructUtils.convert(xzdCustomerSupplierVo, XzdCustomerSuppliervo.class);
}
}

View File

@ -3,7 +3,10 @@ package org.dromara.xzd.service.impl;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.dromara.common.core.domain.vo.XzdCustomerSuppliervo;
import org.dromara.common.core.service.XzdCustomerSupplierService;
import org.dromara.common.core.service.XzdCustomerinformationService;
import org.dromara.common.core.service.XzdSupplierInfoService;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.SpringUtils;
import org.dromara.common.core.utils.StringUtils;
@ -14,6 +17,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.system.domain.vo.SysDeptVo;
import org.dromara.xzd.domain.vo.XzdSupplierInfoVo;
import org.springframework.stereotype.Service;
import org.dromara.xzd.domain.bo.XzdCustomerinformationBo;
import org.dromara.xzd.domain.vo.XzdCustomerinformationVo;
@ -38,6 +42,10 @@ public class XzdCustomerinformationServiceImpl extends ServiceImpl<XzdCustomerin
private final XzdCustomerinformationMapper baseMapper;
private final XzdCustomerSupplierService xzdCustomerSupplierService;
private final XzdSupplierInfoService xzdSupplierInfoService;
/**
* 查询客户信息
*
@ -181,11 +189,33 @@ public class XzdCustomerinformationServiceImpl extends ServiceImpl<XzdCustomerin
public String selectNmaeByIds(String ids) {
List<String> list = new ArrayList<>();
for (Long id : StringUtils.splitTo(ids, Convert::toLong)) {
XzdCustomerinformationVo vo = SpringUtils.getAopProxy(this).getBaseMapper().selectVoById(id);
if (ObjectUtil.isNotNull(vo)) {
list.add(vo.getUnitName());
XzdCustomerSuppliervo xzdCustomerSuppliervo = xzdCustomerSupplierService.queryByIdone(id);
if (xzdCustomerSuppliervo == null){
return null;
}
if (xzdCustomerSuppliervo.getType().equals("1")){
XzdCustomerinformationVo vo = SpringUtils.getAopProxy(this).getBaseMapper().selectVoById(id);
if (ObjectUtil.isNotNull(vo)) {
list.add(vo.getUnitName());
}
}else {
String s = xzdSupplierInfoService.selectNmaeById(id);
if (StringUtils.isNotBlank(s)){
list.add(s);
}
}
}
return String.join(StringUtils.SEPARATOR, list);
}
@Override
public String selectNmaeById(Long id) {
XzdCustomerinformationVo xzdCustomerinformationVo = this.queryById(id);
if (xzdCustomerinformationVo == null){
return null;
}
return xzdCustomerinformationVo.getUnitName();
}
}

View File

@ -7,6 +7,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.domain.vo.XzdCustomerSuppliervo;
import org.dromara.common.core.service.XzdCustomerSupplierService;
import org.dromara.common.core.service.XzdCustomerinformationService;
import org.dromara.common.core.service.XzdSupplierInfoService;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.SpringUtils;
@ -20,6 +23,7 @@ import org.dromara.system.service.impl.SysOssServiceImpl;
import org.dromara.system.service.impl.SysUserServiceImpl;
import org.dromara.xzd.domain.*;
import org.dromara.xzd.domain.bo.XzdSupplierInfoBo;
import org.dromara.xzd.domain.vo.XzdCustomerinformationVo;
import org.dromara.xzd.domain.vo.XzdCustomertypeVo;
import org.dromara.xzd.domain.vo.XzdSupplierInfoVo;
import org.dromara.xzd.mapper.XzdSupplierInfoMapper;
@ -72,11 +76,16 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
@Autowired
private XzdSupplierOpenBankServiceImpl xzdSupplierOpenBankService;
private final XzdCustomerSupplierService xzdCustomerSupplierService;
@Autowired
private SysUserServiceImpl sysUserService;
@Autowired
private SysOssServiceImpl sysOssService;
private final XzdCustomerinformationService xzdCustomerinformationService;
/**
* 查询供应商信息
*
@ -893,11 +902,32 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
public String selectNmaeByIds(String ids) {
List<String> list = new ArrayList<>();
for (Long id : StringUtils.splitTo(ids, Convert::toLong)) {
XzdSupplierInfoVo vo = SpringUtils.getAopProxy(this).getBaseMapper().selectVoById(id);
if (ObjectUtil.isNotNull(vo)) {
list.add(vo.getUnitName());
XzdCustomerSuppliervo xzdCustomerSuppliervo = xzdCustomerSupplierService.queryByIdone(id);
if (xzdCustomerSuppliervo == null){
return null;
}
if (xzdCustomerSuppliervo.getType().equals("1")){
String s = xzdCustomerinformationService.selectNmaeById(id);
if (StringUtils.isNotBlank(s)){
list.add(s);
}
}else {
String s = this.selectNmaeById(id);
if (StringUtils.isNotBlank(s)){
list.add(s);
}
}
}
return String.join(StringUtils.SEPARATOR, list);
}
@Override
public String selectNmaeById(Long id) {
XzdSupplierInfoVo xzdSupplierInfoVo = this.baseMapper.selectVoById(Convert.toLong(id));
if (xzdSupplierInfoVo == null){
return null;
}
return xzdSupplierInfoVo.getUnitName();
}
}