feat(oa/crm): 新增供应商信息管理模块
- 新增供应商信息实体类 CrmSupplierInfo 及相关字段定义 - 新增供应商信息业务对象 CrmSupplierInfoBo 并配置校验规则 - 新增供应商信息视图对象 CrmSupplierInfoVo 支持Excel导出- 新增供应商信息控制器 CrmSupplierInfoController 实现CRUD接口 - 新增供应商信息Mapper接口及XML映射文件 - 新增供应商信息服务实现类 CrmSupplierInfoServiceImpl - 支持附件信息填充与远程文件关联展示 - 提供分页查询、详情查看、新增、修改、删除功能 - 支持供应商信息导出Excel功能 - 添加权限控制注解确保接口安全性- 实现下拉框查询供应商信息列表接口dev
parent
9b4d00a042
commit
7b444396d5
@ -0,0 +1,116 @@
|
||||
package org.dromara.oa.crm.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.oa.crm.domain.vo.CrmSupplierInfoVo;
|
||||
import org.dromara.oa.crm.domain.bo.CrmSupplierInfoBo;
|
||||
import org.dromara.oa.crm.service.ICrmSupplierInfoService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 供应商信息
|
||||
* 前端访问路由地址为:/oa/crm/crmSupplierInfo
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-11-05
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/crm/crmSupplierInfo")
|
||||
public class CrmSupplierInfoController extends BaseController {
|
||||
|
||||
private final ICrmSupplierInfoService crmSupplierInfoService;
|
||||
|
||||
/**
|
||||
* 查询供应商信息列表
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:crmSupplierInfo:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<CrmSupplierInfoVo> list(CrmSupplierInfoBo bo, PageQuery pageQuery) {
|
||||
return crmSupplierInfoService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出供应商信息列表
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:crmSupplierInfo:export")
|
||||
@Log(title = "供应商信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(CrmSupplierInfoBo bo, HttpServletResponse response) {
|
||||
List<CrmSupplierInfoVo> list = crmSupplierInfoService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "供应商信息", CrmSupplierInfoVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取供应商信息详细信息
|
||||
*
|
||||
* @param supplierId 主键
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:crmSupplierInfo:query")
|
||||
@GetMapping("/{supplierId}")
|
||||
public R<CrmSupplierInfoVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("supplierId") Long supplierId) {
|
||||
return R.ok(crmSupplierInfoService.queryById(supplierId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增供应商信息
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:crmSupplierInfo:add")
|
||||
@Log(title = "供应商信息", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody CrmSupplierInfoBo bo) {
|
||||
return toAjax(crmSupplierInfoService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改供应商信息
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:crmSupplierInfo:edit")
|
||||
@Log(title = "供应商信息", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody CrmSupplierInfoBo bo) {
|
||||
return toAjax(crmSupplierInfoService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除供应商信息
|
||||
*
|
||||
* @param supplierIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:crmSupplierInfo:remove")
|
||||
@Log(title = "供应商信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{supplierIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("supplierIds") Long[] supplierIds) {
|
||||
return toAjax(crmSupplierInfoService.deleteWithValidByIds(List.of(supplierIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉框查询供应商信息列表
|
||||
*/
|
||||
@GetMapping("/getCrmSupplierInfoList")
|
||||
public R<List<CrmSupplierInfoVo>> getCrmSupplierInfoList(CrmSupplierInfoBo bo) {
|
||||
List<CrmSupplierInfoVo> list = crmSupplierInfoService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package org.dromara.oa.crm.service;
|
||||
|
||||
import org.dromara.oa.crm.domain.CrmSupplierInfo;
|
||||
import org.dromara.oa.crm.domain.vo.CrmSupplierInfoVo;
|
||||
import org.dromara.oa.crm.domain.bo.CrmSupplierInfoBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 供应商信息Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-11-05
|
||||
*/
|
||||
public interface ICrmSupplierInfoService {
|
||||
|
||||
/**
|
||||
* 查询供应商信息
|
||||
*
|
||||
* @param supplierId 主键
|
||||
* @return 供应商信息
|
||||
*/
|
||||
CrmSupplierInfoVo queryById(Long supplierId);
|
||||
|
||||
/**
|
||||
* 分页查询供应商信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 供应商信息分页列表
|
||||
*/
|
||||
TableDataInfo<CrmSupplierInfoVo> queryPageList(CrmSupplierInfoBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的供应商信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 供应商信息列表
|
||||
*/
|
||||
List<CrmSupplierInfoVo> queryList(CrmSupplierInfoBo bo);
|
||||
|
||||
/**
|
||||
* 新增供应商信息
|
||||
*
|
||||
* @param bo 供应商信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(CrmSupplierInfoBo bo);
|
||||
|
||||
/**
|
||||
* 修改供应商信息
|
||||
*
|
||||
* @param bo 供应商信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(CrmSupplierInfoBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除供应商信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,217 @@
|
||||
package org.dromara.oa.crm.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.oa.crm.domain.bo.CrmSupplierInfoBo;
|
||||
import org.dromara.oa.crm.domain.vo.CrmSupplierInfoVo;
|
||||
import org.dromara.oa.crm.domain.CrmSupplierInfo;
|
||||
import org.dromara.oa.crm.mapper.CrmSupplierInfoMapper;
|
||||
import org.dromara.oa.crm.service.ICrmSupplierInfoService;
|
||||
import org.dromara.resource.api.RemoteFileService;
|
||||
import org.dromara.resource.api.domain.RemoteFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 供应商信息Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-11-05
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class CrmSupplierInfoServiceImpl implements ICrmSupplierInfoService {
|
||||
|
||||
private final CrmSupplierInfoMapper baseMapper;
|
||||
@DubboReference(mock = "true")
|
||||
private RemoteFileService remoteFileService;
|
||||
|
||||
/**
|
||||
* 查询供应商信息
|
||||
*
|
||||
* @param supplierId 主键
|
||||
* @return 供应商信息
|
||||
*/
|
||||
@Override
|
||||
public CrmSupplierInfoVo queryById(Long supplierId){
|
||||
CrmSupplierInfoVo vo = baseMapper.selectVoById(supplierId);
|
||||
fillAttachmentInfo(Collections.singletonList(vo));
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询供应商信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 供应商信息分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<CrmSupplierInfoVo> queryPageList(CrmSupplierInfoBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<CrmSupplierInfo> lqw = buildQueryWrapper(bo);
|
||||
Page<CrmSupplierInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
fillAttachmentInfo(result.getRecords());
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的供应商信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 供应商信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<CrmSupplierInfoVo> queryList(CrmSupplierInfoBo bo) {
|
||||
MPJLambdaWrapper<CrmSupplierInfo> lqw = buildQueryWrapper(bo);
|
||||
List<CrmSupplierInfoVo> list = baseMapper.selectVoList(lqw);
|
||||
fillAttachmentInfo(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<CrmSupplierInfo> buildQueryWrapper(CrmSupplierInfoBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<CrmSupplierInfo> lqw = JoinWrappers.lambda(CrmSupplierInfo.class)
|
||||
.selectAll(CrmSupplierInfo.class)
|
||||
// // 左连接 sys_user 表获取归属人员名称
|
||||
// .selectAs(SysUser::getNickName, CrmSupplierInfo::getOwnerName)
|
||||
// .leftJoin(SysUser.class, SysUser::getUserId, CrmSupplierInfo::getOwnerId)
|
||||
.eq(CrmSupplierInfo::getDelFlag, "0")
|
||||
.like(StringUtils.isNotBlank(bo.getSupplierName()), CrmSupplierInfo::getSupplierName, bo.getSupplierName())
|
||||
.like(StringUtils.isNotBlank(bo.getMnemonicName()), CrmSupplierInfo::getMnemonicName, bo.getMnemonicName())
|
||||
.eq(StringUtils.isNotBlank(bo.getSupplierType()), CrmSupplierInfo::getSupplierType, bo.getSupplierType())
|
||||
.eq(bo.getRegisteredCapital() != null, CrmSupplierInfo::getRegisteredCapital, bo.getRegisteredCapital())
|
||||
.eq(bo.getEstablishmentDate() != null, CrmSupplierInfo::getEstablishmentDate, bo.getEstablishmentDate())
|
||||
.eq(StringUtils.isNotBlank(bo.getBusinessScope()), CrmSupplierInfo::getBusinessScope, bo.getBusinessScope())
|
||||
.eq(StringUtils.isNotBlank(bo.getMainIndustry()), CrmSupplierInfo::getMainIndustry, bo.getMainIndustry())
|
||||
.eq(StringUtils.isNotBlank(bo.getLegalRepresentative()), CrmSupplierInfo::getLegalRepresentative, bo.getLegalRepresentative())
|
||||
.eq(StringUtils.isNotBlank(bo.getBusinessLicenseNumber()), CrmSupplierInfo::getBusinessLicenseNumber, bo.getBusinessLicenseNumber())
|
||||
.eq(StringUtils.isNotBlank(bo.getTaxNumber()), CrmSupplierInfo::getTaxNumber, bo.getTaxNumber())
|
||||
.eq(StringUtils.isNotBlank(bo.getBankAccountOpening()), CrmSupplierInfo::getBankAccountOpening, bo.getBankAccountOpening())
|
||||
.eq(StringUtils.isNotBlank(bo.getBankNumber()), CrmSupplierInfo::getBankNumber, bo.getBankNumber())
|
||||
.eq(StringUtils.isNotBlank(bo.getRegisteredAddress()), CrmSupplierInfo::getRegisteredAddress, bo.getRegisteredAddress())
|
||||
.eq(StringUtils.isNotBlank(bo.getBusinessAddress()), CrmSupplierInfo::getBusinessAddress, bo.getBusinessAddress())
|
||||
.eq(StringUtils.isNotBlank(bo.getContactPerson()), CrmSupplierInfo::getContactPerson, bo.getContactPerson())
|
||||
.eq(StringUtils.isNotBlank(bo.getContactPhone()), CrmSupplierInfo::getContactPhone, bo.getContactPhone())
|
||||
.eq(StringUtils.isNotBlank(bo.getContactMobile()), CrmSupplierInfo::getContactMobile, bo.getContactMobile())
|
||||
.eq(StringUtils.isNotBlank(bo.getContactEmail()), CrmSupplierInfo::getContactEmail, bo.getContactEmail())
|
||||
.eq(StringUtils.isNotBlank(bo.getContactFax()), CrmSupplierInfo::getContactFax, bo.getContactFax())
|
||||
.eq(StringUtils.isNotBlank(bo.getWebsite()), CrmSupplierInfo::getWebsite, bo.getWebsite())
|
||||
.eq(bo.getOwnerId() != null, CrmSupplierInfo::getOwnerId, bo.getOwnerId())
|
||||
.eq(StringUtils.isNotBlank(bo.getDetailedAddress()), CrmSupplierInfo::getDetailedAddress, bo.getDetailedAddress())
|
||||
.eq(StringUtils.isNotBlank(bo.getOssId()), CrmSupplierInfo::getOssId, bo.getOssId())
|
||||
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), CrmSupplierInfo::getActiveFlag, bo.getActiveFlag());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
private void fillAttachmentInfo(List<CrmSupplierInfoVo> voList) {
|
||||
if (voList == null || voList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Set<String> ossIdSet = new LinkedHashSet<>();
|
||||
Map<CrmSupplierInfoVo, List<String>> voOssMapping = new HashMap<>();
|
||||
for (CrmSupplierInfoVo vo : voList) {
|
||||
if (vo == null || StringUtils.isBlank(vo.getOssId())) {
|
||||
continue;
|
||||
}
|
||||
List<String> ids = List.of(StringUtils.split(vo.getOssId(), ","));
|
||||
if (ids.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
voOssMapping.put(vo, ids);
|
||||
ossIdSet.addAll(ids);
|
||||
}
|
||||
if (ossIdSet.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
List<RemoteFile> files = remoteFileService.selectByIds(String.join(",", ossIdSet));
|
||||
Map<Long, RemoteFile> fileMap = files.stream()
|
||||
.filter(item -> item.getOssId() != null)
|
||||
.collect(Collectors.toMap(RemoteFile::getOssId, item -> item, (a, b) -> a));
|
||||
for (Entry<CrmSupplierInfoVo, List<String>> entry : voOssMapping.entrySet()) {
|
||||
List<RemoteFile> voFiles = entry.getValue().stream()
|
||||
.map(id -> {
|
||||
if (!StringUtils.isNumeric(id)) {
|
||||
return null;
|
||||
}
|
||||
Long key = Long.parseLong(id);
|
||||
return fileMap.get(key);
|
||||
})
|
||||
.filter(item -> item != null)
|
||||
.collect(Collectors.toList());
|
||||
entry.getKey().setAttachmentList(voFiles);
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
// 远程文件服务异常时忽略附件
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增供应商信息
|
||||
*
|
||||
* @param bo 供应商信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(CrmSupplierInfoBo bo) {
|
||||
CrmSupplierInfo add = MapstructUtils.convert(bo, CrmSupplierInfo.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setSupplierId(add.getSupplierId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改供应商信息
|
||||
*
|
||||
* @param bo 供应商信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(CrmSupplierInfoBo bo) {
|
||||
CrmSupplierInfo update = MapstructUtils.convert(bo, CrmSupplierInfo.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(CrmSupplierInfo entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除供应商信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,319 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.oa.crm.mapper.CrmSupplierInfoMapper">
|
||||
<resultMap type="org.dromara.oa.crm.domain.vo.CrmSupplierInfoVo" id="CrmSupplierInfoResult">
|
||||
</resultMap>
|
||||
|
||||
<select id="selectCustomCrmSupplierInfoVoList" resultMap="CrmSupplierInfoResult">
|
||||
select t.supplier_id, t.tenant_id, t.supplier_name, t.mnemonic_name, t.supplier_type,
|
||||
t.registered_capital, t.establishment_date, t.business_scope, t.main_industry,
|
||||
t.legal_representative, t.business_license_number, t.tax_number, t.bank_account_opening,
|
||||
t.bank_number, t.registered_address, t.business_address, t.contact_person, t.contact_phone, t.contact_mobile,
|
||||
t.contact_email, t.contact_fax, t.website, t.owner_id, t.detailed_address, t.oss_id, t.remark, t.active_flag, t.del_flag, t.create_dept,
|
||||
u1.nick_name as ownerName,
|
||||
t.create_by, t.create_time, t.update_by, t.update_time
|
||||
from crm_supplier_info t
|
||||
left join sys_user u1 on u1.user_id = t.owner_id
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
<!-- 根据ID查询详情 -->
|
||||
<select id="selectCustomCrmSupplierInfoVoById" resultMap="CrmSupplierInfoResult">
|
||||
select t.supplier_id, t.tenant_id, t.supplier_name, t.mnemonic_name, t.supplier_type, t.registered_capital, t.establishment_date, t.business_scope, t.main_industry, t.legal_representative, t.business_license_number, t.tax_number, t.bank_account_opening, t.bank_number, t.registered_address, t.business_address, t.contact_person, t.contact_phone, t.contact_mobile, t.contact_email, t.contact_fax, t.website, t.owner_id, t.detailed_address, t.oss_id, t.remark, t.active_flag, t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
|
||||
from crm_supplier_info t
|
||||
where t.supplier_id = #{supplierId}
|
||||
</select>
|
||||
|
||||
<!-- 批量查询 - 根据ID列表 -->
|
||||
<select id="selectCustomCrmSupplierInfoVoByIds" resultMap="CrmSupplierInfoResult">
|
||||
select t.supplier_id, t.tenant_id, t.supplier_name, t.mnemonic_name, t.supplier_type, t.registered_capital, t.establishment_date, t.business_scope, t.main_industry, t.legal_representative, t.business_license_number, t.tax_number, t.bank_account_opening, t.bank_number, t.registered_address, t.business_address, t.contact_person, t.contact_phone, t.contact_mobile, t.contact_email, t.contact_fax, t.website, t.owner_id, t.detailed_address, t.oss_id, t.remark, t.active_flag, t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
|
||||
from crm_supplier_info t
|
||||
where t.supplier_id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<!-- 统计查询 -->
|
||||
<select id="countCustomCrmSupplierInfo" resultType="java.lang.Long">
|
||||
select count(1) from crm_supplier_info t
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
<!-- 分页查询(带自定义条件) -->
|
||||
<select id="selectCustomCrmSupplierInfoVoPage" resultMap="CrmSupplierInfoResult">
|
||||
select t.supplier_id, t.tenant_id, t.supplier_name, t.mnemonic_name, t.supplier_type, t.registered_capital, t.establishment_date, t.business_scope, t.main_industry, t.legal_representative, t.business_license_number, t.tax_number, t.bank_account_opening, t.bank_number, t.registered_address, t.business_address, t.contact_person, t.contact_phone, t.contact_mobile, t.contact_email, t.contact_fax, t.website, t.owner_id, t.detailed_address, t.oss_id, t.remark, t.active_flag, t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
|
||||
from crm_supplier_info t
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
<!-- 批量插入 -->
|
||||
<insert id="batchInsertCrmSupplierInfo">
|
||||
insert into crm_supplier_info(
|
||||
tenant_id,
|
||||
|
||||
supplier_name,
|
||||
|
||||
mnemonic_name,
|
||||
|
||||
supplier_type,
|
||||
|
||||
registered_capital,
|
||||
|
||||
establishment_date,
|
||||
|
||||
business_scope,
|
||||
|
||||
main_industry,
|
||||
|
||||
legal_representative,
|
||||
|
||||
business_license_number,
|
||||
|
||||
tax_number,
|
||||
|
||||
bank_account_opening,
|
||||
|
||||
bank_number,
|
||||
|
||||
registered_address,
|
||||
|
||||
business_address,
|
||||
|
||||
contact_person,
|
||||
|
||||
contact_phone,
|
||||
|
||||
contact_mobile,
|
||||
|
||||
contact_email,
|
||||
|
||||
contact_fax,
|
||||
|
||||
website,
|
||||
|
||||
owner_id,
|
||||
|
||||
detailed_address,
|
||||
|
||||
oss_id,
|
||||
|
||||
remark,
|
||||
|
||||
active_flag,
|
||||
|
||||
del_flag,
|
||||
|
||||
create_dept,
|
||||
|
||||
create_by,
|
||||
|
||||
create_time,
|
||||
|
||||
update_by,
|
||||
|
||||
update_time
|
||||
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.tenantId},
|
||||
|
||||
#{item.supplierName},
|
||||
|
||||
#{item.mnemonicName},
|
||||
|
||||
#{item.supplierType},
|
||||
|
||||
#{item.registeredCapital},
|
||||
|
||||
#{item.establishmentDate},
|
||||
|
||||
#{item.businessScope},
|
||||
|
||||
#{item.mainIndustry},
|
||||
|
||||
#{item.legalRepresentative},
|
||||
|
||||
#{item.businessLicenseNumber},
|
||||
|
||||
#{item.taxNumber},
|
||||
|
||||
#{item.bankAccountOpening},
|
||||
|
||||
#{item.bankNumber},
|
||||
|
||||
#{item.registeredAddress},
|
||||
|
||||
#{item.businessAddress},
|
||||
|
||||
#{item.contactPerson},
|
||||
|
||||
#{item.contactPhone},
|
||||
|
||||
#{item.contactMobile},
|
||||
|
||||
#{item.contactEmail},
|
||||
|
||||
#{item.contactFax},
|
||||
|
||||
#{item.website},
|
||||
|
||||
#{item.ownerId},
|
||||
|
||||
#{item.detailedAddress},
|
||||
|
||||
#{item.ossId},
|
||||
|
||||
#{item.remark},
|
||||
|
||||
#{item.activeFlag},
|
||||
|
||||
#{item.delFlag},
|
||||
|
||||
#{item.createDept},
|
||||
|
||||
#{item.createBy},
|
||||
|
||||
#{item.createTime},
|
||||
|
||||
#{item.updateBy},
|
||||
|
||||
#{item.updateTime}
|
||||
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量更新 -->
|
||||
<update id="batchUpdateCrmSupplierInfo">
|
||||
<foreach collection="list" item="item" separator=";">
|
||||
update crm_supplier_info
|
||||
<set>
|
||||
<if test="item.tenantId != null and item.tenantId != ''">
|
||||
tenant_id = #{item.tenantId},
|
||||
</if>
|
||||
<if test="item.supplierName != null and item.supplierName != ''">
|
||||
supplier_name = #{item.supplierName},
|
||||
</if>
|
||||
<if test="item.mnemonicName != null and item.mnemonicName != ''">
|
||||
mnemonic_name = #{item.mnemonicName},
|
||||
</if>
|
||||
<if test="item.supplierType != null and item.supplierType != ''">
|
||||
supplier_type = #{item.supplierType},
|
||||
</if>
|
||||
<if test="item.registeredCapital != null">
|
||||
registered_capital = #{item.registeredCapital},
|
||||
</if>
|
||||
<if test="item.establishmentDate != null">
|
||||
establishment_date = #{item.establishmentDate},
|
||||
</if>
|
||||
<if test="item.businessScope != null and item.businessScope != ''">
|
||||
business_scope = #{item.businessScope},
|
||||
</if>
|
||||
<if test="item.mainIndustry != null and item.mainIndustry != ''">
|
||||
main_industry = #{item.mainIndustry},
|
||||
</if>
|
||||
<if test="item.legalRepresentative != null and item.legalRepresentative != ''">
|
||||
legal_representative = #{item.legalRepresentative},
|
||||
</if>
|
||||
<if test="item.businessLicenseNumber != null and item.businessLicenseNumber != ''">
|
||||
business_license_number = #{item.businessLicenseNumber},
|
||||
</if>
|
||||
<if test="item.taxNumber != null and item.taxNumber != ''">
|
||||
tax_number = #{item.taxNumber},
|
||||
</if>
|
||||
<if test="item.bankAccountOpening != null and item.bankAccountOpening != ''">
|
||||
bank_account_opening = #{item.bankAccountOpening},
|
||||
</if>
|
||||
<if test="item.bankNumber != null and item.bankNumber != ''">
|
||||
bank_number = #{item.bankNumber},
|
||||
</if>
|
||||
<if test="item.registeredAddress != null and item.registeredAddress != ''">
|
||||
registered_address = #{item.registeredAddress},
|
||||
</if>
|
||||
<if test="item.businessAddress != null and item.businessAddress != ''">
|
||||
business_address = #{item.businessAddress},
|
||||
</if>
|
||||
<if test="item.contactPerson != null and item.contactPerson != ''">
|
||||
contact_person = #{item.contactPerson},
|
||||
</if>
|
||||
<if test="item.contactPhone != null and item.contactPhone != ''">
|
||||
contact_phone = #{item.contactPhone},
|
||||
</if>
|
||||
<if test="item.contactMobile != null and item.contactMobile != ''">
|
||||
contact_mobile = #{item.contactMobile},
|
||||
</if>
|
||||
<if test="item.contactEmail != null and item.contactEmail != ''">
|
||||
contact_email = #{item.contactEmail},
|
||||
</if>
|
||||
<if test="item.contactFax != null and item.contactFax != ''">
|
||||
contact_fax = #{item.contactFax},
|
||||
</if>
|
||||
<if test="item.website != null and item.website != ''">
|
||||
website = #{item.website},
|
||||
</if>
|
||||
<if test="item.ownerId != null">
|
||||
owner_id = #{item.ownerId},
|
||||
</if>
|
||||
<if test="item.detailedAddress != null and item.detailedAddress != ''">
|
||||
detailed_address = #{item.detailedAddress},
|
||||
</if>
|
||||
<if test="item.ossId != null and item.ossId != ''">
|
||||
oss_id = #{item.ossId},
|
||||
</if>
|
||||
<if test="item.remark != null and item.remark != ''">
|
||||
remark = #{item.remark},
|
||||
</if>
|
||||
<if test="item.activeFlag != null and item.activeFlag != ''">
|
||||
active_flag = #{item.activeFlag},
|
||||
</if>
|
||||
<if test="item.delFlag != null and item.delFlag != ''">
|
||||
del_flag = #{item.delFlag},
|
||||
</if>
|
||||
<if test="item.createDept != null">
|
||||
create_dept = #{item.createDept},
|
||||
</if>
|
||||
<if test="item.createBy != null">
|
||||
create_by = #{item.createBy},
|
||||
</if>
|
||||
<if test="item.createTime != null">
|
||||
create_time = #{item.createTime},
|
||||
</if>
|
||||
<if test="item.updateBy != null">
|
||||
update_by = #{item.updateBy},
|
||||
</if>
|
||||
<if test="item.updateTime != null">
|
||||
update_time = #{item.updateTime}
|
||||
</if>
|
||||
</set>
|
||||
where supplier_id = #{item.supplierId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 根据自定义条件删除 -->
|
||||
<delete id="deleteCustomCrmSupplierInfo">
|
||||
delete from crm_supplier_info
|
||||
${ew.getCustomSqlSegment}
|
||||
</delete>
|
||||
|
||||
<!-- 根据ID列表批量删除 -->
|
||||
<delete id="deleteCustomCrmSupplierInfoByIds">
|
||||
delete from crm_supplier_info
|
||||
where supplier_id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 检查是否存在 -->
|
||||
<select id="existsCrmSupplierInfo" resultType="java.lang.Boolean">
|
||||
select count(1) > 0 from crm_supplier_info t
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue