客户信息

new
fNumb 1 year ago
parent 14e5fa8e9c
commit e6d321aff0

@ -13,4 +13,5 @@ public interface ErrorCodeConstants {
ErrorCode EXPENSE_APPLY_NOT_EXISTS = new ErrorCode(200200, "申请单不存在"); ErrorCode EXPENSE_APPLY_NOT_EXISTS = new ErrorCode(200200, "申请单不存在");
ErrorCode BUDGET_NOT_EXISTS = new ErrorCode(200400, "预算管理不存在"); ErrorCode BUDGET_NOT_EXISTS = new ErrorCode(200400, "预算管理不存在");
ErrorCode FEE_MANAGE_NOT_EXISTS = new ErrorCode(200500, "费用控制不存在"); ErrorCode FEE_MANAGE_NOT_EXISTS = new ErrorCode(200500, "费用控制不存在");
ErrorCode CUSTOMER_COMPANY_NOT_EXISTS = new ErrorCode(200600, "客户公司不存在");
} }

@ -0,0 +1,102 @@
package cn.iocoder.yudao.module.bs.controller.admin.customer;
import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.*;
import cn.iocoder.yudao.module.bs.convert.customer.CustomerCompanyConvert;
import cn.iocoder.yudao.module.bs.dal.dataobject.customer.CustomerCompanyDO;
import cn.iocoder.yudao.module.bs.service.customer.CustomerCompanyService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 客户公司信息")
@RestController
@RequestMapping("/bs/customer-company")
@Validated
public class CustomerCompanyController {
@Resource
private CustomerCompanyService customerCompanyService;
@PostMapping("/create")
@Operation(summary = "创建客户公司信息")
@PreAuthorize("@ss.hasPermission('bs:customer-company:create')")
public CommonResult<Long> createCustomerCompany(@Valid @RequestBody CustomerCompanyCreateReqVO createReqVO) {
return success(customerCompanyService.createCustomerCompany(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新客户公司信息")
@PreAuthorize("@ss.hasPermission('bs:customer-company:update')")
public CommonResult<Boolean> updateCustomerCompany(@Valid @RequestBody CustomerCompanyUpdateReqVO updateReqVO) {
customerCompanyService.updateCustomerCompany(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除客户公司信息")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('bs:customer-company:delete')")
public CommonResult<Boolean> deleteCustomerCompany(@RequestParam("id") Long id) {
customerCompanyService.deleteCustomerCompany(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得客户公司信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('bs:customer-company:query')")
public CommonResult<CustomerCompanyRespVO> getCustomerCompany(@RequestParam("id") Long id) {
CustomerCompanyDO customerCompany = customerCompanyService.getCustomerCompany(id);
return success(CustomerCompanyConvert.INSTANCE.convert(customerCompany));
}
@GetMapping("/list")
@Operation(summary = "获得客户公司信息列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('bs:customer-company:query')")
public CommonResult<List<CustomerCompanyRespVO>> getCustomerCompanyList(@RequestParam("ids") Collection<Long> ids) {
List<CustomerCompanyDO> list = customerCompanyService.getCustomerCompanyList(ids);
return success(CustomerCompanyConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得客户公司信息分页")
@PreAuthorize("@ss.hasPermission('bs:customer-company:query')")
public CommonResult<PageResult<CustomerCompanyRespVO>> getCustomerCompanyPage(@Valid CustomerCompanyPageReqVO pageVO) {
PageResult<CustomerCompanyDO> pageResult = customerCompanyService.getCustomerCompanyPage(pageVO);
return success(CustomerCompanyConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出客户公司信息 Excel")
@PreAuthorize("@ss.hasPermission('bs:customer-company:export')")
@OperateLog(type = EXPORT)
public void exportCustomerCompanyExcel(@Valid CustomerCompanyExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<CustomerCompanyDO> list = customerCompanyService.getCustomerCompanyList(exportReqVO);
// 导出 Excel
List<CustomerCompanyExcelVO> datas = CustomerCompanyConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "客户公司信息.xls", "数据", CustomerCompanyExcelVO.class, datas);
}
}

@ -0,0 +1,76 @@
package cn.iocoder.yudao.module.bs.controller.admin.customer.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class CustomerCompanyBaseVO {
@Schema(description = "公司名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@NotNull(message = "公司名称不能为空")
private String companyName;
@Schema(description = "公司编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "公司编码不能为空")
private String companyNumber;
@Schema(description = "企业性质", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "企业性质不能为空")
private String companyType;
@Schema(description = "法人代表")
private String legalPerson;
@Schema(description = "联系方式", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "联系方式不能为空")
private String phone;
@Schema(description = "统一社会信用代码")
private String creditCode;
@Schema(description = "区域编码")
private String areaCode;
@Schema(description = "企业地址")
private String address;
@Schema(description = "营业期限(起)")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime businessStratDate;
@Schema(description = "营业期限(止)")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime businessEndDate;
@Schema(description = "银行户名", example = "张三")
private String bankName;
@Schema(description = "银行账号")
private String bankNumber;
@Schema(description = "开户行名称")
private String bankOfDeposit;
@Schema(description = "status", example = "2")
private String status;
@Schema(description = "备注", example = "你猜")
private String remark;
@Schema(description = "附件")
private String files;
}

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.bs.controller.admin.customer.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 客户公司信息创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CustomerCompanyCreateReqVO extends CustomerCompanyBaseVO {
}

@ -0,0 +1,75 @@
package cn.iocoder.yudao.module.bs.controller.admin.customer.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty;
/**
* Excel VO
*
* @author
*/
@Data
public class CustomerCompanyExcelVO {
@ExcelProperty("id")
private Long id;
@ExcelProperty("公司名称")
private String companyName;
@ExcelProperty("公司编码")
private String companyNumber;
@ExcelProperty("企业性质")
private String companyType;
@ExcelProperty("法人代表")
private String legalPerson;
@ExcelProperty("联系方式")
private String phone;
@ExcelProperty("统一社会信用代码")
private String creditCode;
@ExcelProperty("区域编码")
private String areaCode;
@ExcelProperty("企业地址")
private String address;
@ExcelProperty("营业期限(起)")
private LocalDateTime businessStratDate;
@ExcelProperty("营业期限(止)")
private LocalDateTime businessEndDate;
@ExcelProperty("银行户名")
private String bankName;
@ExcelProperty("银行账号")
private String bankNumber;
@ExcelProperty("开户行名称")
private String bankOfDeposit;
@ExcelProperty("status")
private String status;
@ExcelProperty("备注")
private String remark;
@ExcelProperty("附件")
private String files;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

@ -0,0 +1,70 @@
package cn.iocoder.yudao.module.bs.controller.admin.customer.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.time.LocalDateTime;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 客户公司信息 Excel 导出 Request VO参数和 CustomerCompanyPageReqVO 是一致的")
@Data
public class CustomerCompanyExportReqVO {
@Schema(description = "公司名称", example = "李四")
private String companyName;
@Schema(description = "公司编码")
private String companyNumber;
@Schema(description = "企业性质", example = "2")
private String companyType;
@Schema(description = "法人代表")
private String legalPerson;
@Schema(description = "联系方式")
private String phone;
@Schema(description = "统一社会信用代码")
private String creditCode;
@Schema(description = "区域编码")
private String areaCode;
@Schema(description = "企业地址")
private String address;
@Schema(description = "营业期限(起)")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] businessStratDate;
@Schema(description = "营业期限(止)")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] businessEndDate;
@Schema(description = "银行户名", example = "张三")
private String bankName;
@Schema(description = "银行账号")
private String bankNumber;
@Schema(description = "开户行名称")
private String bankOfDeposit;
@Schema(description = "status", example = "2")
private String status;
@Schema(description = "备注", example = "你猜")
private String remark;
@Schema(description = "附件")
private String files;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

@ -0,0 +1,72 @@
package cn.iocoder.yudao.module.bs.controller.admin.customer.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 客户公司信息分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CustomerCompanyPageReqVO extends PageParam {
@Schema(description = "公司名称", example = "李四")
private String companyName;
@Schema(description = "公司编码")
private String companyNumber;
@Schema(description = "企业性质", example = "2")
private String companyType;
@Schema(description = "法人代表")
private String legalPerson;
@Schema(description = "联系方式")
private String phone;
@Schema(description = "统一社会信用代码")
private String creditCode;
@Schema(description = "区域编码")
private String areaCode;
@Schema(description = "企业地址")
private String address;
@Schema(description = "营业期限(起)")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] businessStratDate;
@Schema(description = "营业期限(止)")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] businessEndDate;
@Schema(description = "银行户名", example = "张三")
private String bankName;
@Schema(description = "银行账号")
private String bankNumber;
@Schema(description = "开户行名称")
private String bankOfDeposit;
@Schema(description = "status", example = "2")
private String status;
@Schema(description = "备注", example = "你猜")
private String remark;
@Schema(description = "附件")
private String files;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.bs.controller.admin.customer.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 客户公司信息 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CustomerCompanyRespVO extends CustomerCompanyBaseVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24144")
private Long id;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.bs.controller.admin.customer.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 客户公司信息更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CustomerCompanyUpdateReqVO extends CustomerCompanyBaseVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24144")
@NotNull(message = "id不能为空")
private Long id;
}

@ -0,0 +1,37 @@
package cn.iocoder.yudao.module.bs.convert.customer;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyCreateReqVO;
import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyExcelVO;
import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyRespVO;
import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyUpdateReqVO;
import cn.iocoder.yudao.module.bs.dal.dataobject.customer.CustomerCompanyDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* Convert
*
* @author
*/
@Mapper
public interface CustomerCompanyConvert {
CustomerCompanyConvert INSTANCE = Mappers.getMapper(CustomerCompanyConvert.class);
CustomerCompanyDO convert(CustomerCompanyCreateReqVO bean);
CustomerCompanyDO convert(CustomerCompanyUpdateReqVO bean);
CustomerCompanyRespVO convert(CustomerCompanyDO bean);
List<CustomerCompanyRespVO> convertList(List<CustomerCompanyDO> list);
PageResult<CustomerCompanyRespVO> convertPage(PageResult<CustomerCompanyDO> page);
List<CustomerCompanyExcelVO> convertList02(List<CustomerCompanyDO> list);
}

@ -0,0 +1,97 @@
package cn.iocoder.yudao.module.bs.dal.dataobject.customer;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
*
* @author
*/
@TableName("bs_customer_company")
@KeySequence("bs_customer_company_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CustomerCompanyDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
*
*/
private String companyName;
/**
*
*/
private String companyNumber;
/**
*
*/
private String companyType;
/**
*
*/
private String legalPerson;
/**
*
*/
private String phone;
/**
*
*/
private String creditCode;
/**
*
*/
private String areaCode;
/**
*
*/
private String address;
/**
* ()
*/
private LocalDateTime businessStratDate;
/**
* ()
*/
private LocalDateTime businessEndDate;
/**
*
*/
private String bankName;
/**
*
*/
private String bankNumber;
/**
*
*/
private String bankOfDeposit;
/**
* status
*/
private String status;
/**
*
*/
private String remark;
/**
*
*/
private String files;
}

@ -0,0 +1,65 @@
package cn.iocoder.yudao.module.bs.dal.mysql.customer;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyExportReqVO;
import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyPageReqVO;
import cn.iocoder.yudao.module.bs.dal.dataobject.customer.CustomerCompanyDO;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
*
* @author
*/
@Mapper
public interface CustomerCompanyMapper extends BaseMapperX<CustomerCompanyDO> {
default PageResult<CustomerCompanyDO> selectPage(CustomerCompanyPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<CustomerCompanyDO>()
.likeIfPresent(CustomerCompanyDO::getCompanyName, reqVO.getCompanyName())
.eqIfPresent(CustomerCompanyDO::getCompanyNumber, reqVO.getCompanyNumber())
.eqIfPresent(CustomerCompanyDO::getCompanyType, reqVO.getCompanyType())
.eqIfPresent(CustomerCompanyDO::getLegalPerson, reqVO.getLegalPerson())
.eqIfPresent(CustomerCompanyDO::getPhone, reqVO.getPhone())
.eqIfPresent(CustomerCompanyDO::getCreditCode, reqVO.getCreditCode())
.eqIfPresent(CustomerCompanyDO::getAreaCode, reqVO.getAreaCode())
.eqIfPresent(CustomerCompanyDO::getAddress, reqVO.getAddress())
.betweenIfPresent(CustomerCompanyDO::getBusinessStratDate, reqVO.getBusinessStratDate())
.betweenIfPresent(CustomerCompanyDO::getBusinessEndDate, reqVO.getBusinessEndDate())
.likeIfPresent(CustomerCompanyDO::getBankName, reqVO.getBankName())
.eqIfPresent(CustomerCompanyDO::getBankNumber, reqVO.getBankNumber())
.eqIfPresent(CustomerCompanyDO::getBankOfDeposit, reqVO.getBankOfDeposit())
.eqIfPresent(CustomerCompanyDO::getStatus, reqVO.getStatus())
.eqIfPresent(CustomerCompanyDO::getRemark, reqVO.getRemark())
.eqIfPresent(CustomerCompanyDO::getFiles, reqVO.getFiles())
.betweenIfPresent(CustomerCompanyDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(CustomerCompanyDO::getId));
}
default List<CustomerCompanyDO> selectList(CustomerCompanyExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<CustomerCompanyDO>()
.likeIfPresent(CustomerCompanyDO::getCompanyName, reqVO.getCompanyName())
.eqIfPresent(CustomerCompanyDO::getCompanyNumber, reqVO.getCompanyNumber())
.eqIfPresent(CustomerCompanyDO::getCompanyType, reqVO.getCompanyType())
.eqIfPresent(CustomerCompanyDO::getLegalPerson, reqVO.getLegalPerson())
.eqIfPresent(CustomerCompanyDO::getPhone, reqVO.getPhone())
.eqIfPresent(CustomerCompanyDO::getCreditCode, reqVO.getCreditCode())
.eqIfPresent(CustomerCompanyDO::getAreaCode, reqVO.getAreaCode())
.eqIfPresent(CustomerCompanyDO::getAddress, reqVO.getAddress())
.betweenIfPresent(CustomerCompanyDO::getBusinessStratDate, reqVO.getBusinessStratDate())
.betweenIfPresent(CustomerCompanyDO::getBusinessEndDate, reqVO.getBusinessEndDate())
.likeIfPresent(CustomerCompanyDO::getBankName, reqVO.getBankName())
.eqIfPresent(CustomerCompanyDO::getBankNumber, reqVO.getBankNumber())
.eqIfPresent(CustomerCompanyDO::getBankOfDeposit, reqVO.getBankOfDeposit())
.eqIfPresent(CustomerCompanyDO::getStatus, reqVO.getStatus())
.eqIfPresent(CustomerCompanyDO::getRemark, reqVO.getRemark())
.eqIfPresent(CustomerCompanyDO::getFiles, reqVO.getFiles())
.betweenIfPresent(CustomerCompanyDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(CustomerCompanyDO::getId));
}
}

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.bs.service.customer;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyCreateReqVO;
import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyExportReqVO;
import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyPageReqVO;
import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyUpdateReqVO;
import cn.iocoder.yudao.module.bs.dal.dataobject.customer.CustomerCompanyDO;
import java.util.*;
import javax.validation.*;
/**
* Service
*
* @author
*/
public interface CustomerCompanyService {
/**
*
*
* @param createReqVO
* @return
*/
Long createCustomerCompany(@Valid CustomerCompanyCreateReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateCustomerCompany(@Valid CustomerCompanyUpdateReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteCustomerCompany(Long id);
/**
*
*
* @param id
* @return
*/
CustomerCompanyDO getCustomerCompany(Long id);
/**
*
*
* @param ids
* @return
*/
List<CustomerCompanyDO> getCustomerCompanyList(Collection<Long> ids);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<CustomerCompanyDO> getCustomerCompanyPage(CustomerCompanyPageReqVO pageReqVO);
/**
* , Excel
*
* @param exportReqVO
* @return
*/
List<CustomerCompanyDO> getCustomerCompanyList(CustomerCompanyExportReqVO exportReqVO);
}

@ -0,0 +1,85 @@
package cn.iocoder.yudao.module.bs.service.customer;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyCreateReqVO;
import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyExportReqVO;
import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyPageReqVO;
import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyUpdateReqVO;
import cn.iocoder.yudao.module.bs.convert.customer.CustomerCompanyConvert;
import cn.iocoder.yudao.module.bs.dal.dataobject.customer.CustomerCompanyDO;
import cn.iocoder.yudao.module.bs.dal.mysql.customer.CustomerCompanyMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.bs.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author
*/
@Service
@Validated
public class CustomerCompanyServiceImpl implements CustomerCompanyService {
@Resource
private CustomerCompanyMapper customerCompanyMapper;
@Override
public Long createCustomerCompany(CustomerCompanyCreateReqVO createReqVO) {
// 插入
CustomerCompanyDO customerCompany = CustomerCompanyConvert.INSTANCE.convert(createReqVO);
customerCompanyMapper.insert(customerCompany);
// 返回
return customerCompany.getId();
}
@Override
public void updateCustomerCompany(CustomerCompanyUpdateReqVO updateReqVO) {
// 校验存在
validateCustomerCompanyExists(updateReqVO.getId());
// 更新
CustomerCompanyDO updateObj = CustomerCompanyConvert.INSTANCE.convert(updateReqVO);
customerCompanyMapper.updateById(updateObj);
}
@Override
public void deleteCustomerCompany(Long id) {
// 校验存在
validateCustomerCompanyExists(id);
// 删除
customerCompanyMapper.deleteById(id);
}
private void validateCustomerCompanyExists(Long id) {
if (customerCompanyMapper.selectById(id) == null) {
throw exception(CUSTOMER_COMPANY_NOT_EXISTS);
}
}
@Override
public CustomerCompanyDO getCustomerCompany(Long id) {
return customerCompanyMapper.selectById(id);
}
@Override
public List<CustomerCompanyDO> getCustomerCompanyList(Collection<Long> ids) {
return customerCompanyMapper.selectBatchIds(ids);
}
@Override
public PageResult<CustomerCompanyDO> getCustomerCompanyPage(CustomerCompanyPageReqVO pageReqVO) {
return customerCompanyMapper.selectPage(pageReqVO);
}
@Override
public List<CustomerCompanyDO> getCustomerCompanyList(CustomerCompanyExportReqVO exportReqVO) {
return customerCompanyMapper.selectList(exportReqVO);
}
}
Loading…
Cancel
Save