This commit is contained in:
PQZ 2024-09-11 18:34:22 +08:00
parent 0c53f3161c
commit 7ba03242d0
17 changed files with 543 additions and 0 deletions

View File

@ -0,0 +1,91 @@
package cn.iocoder.yudao.module.supplier.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.supplier.entity.BaseSupplier;
import cn.iocoder.yudao.module.supplier.service.BaseSupplierService;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierPageReqVO;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierRespVO;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierSaveReqVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 供应商")
@RestController
@RequestMapping("/supplier/baseSupplier")
@Validated
public class BaseSupplierController {
@Resource
private BaseSupplierService baseSupplierService;
/**
* 新增供应商
*
* @param saveReqVO BaseSupplierSaveReqVO实体
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.String>
* @author PQZ
* @date 11:00 2024/9/11
**/
@PostMapping("/create")
@Operation(summary = "创建供应商")
@PreAuthorize("@ss.hasPermission('supplier:base-supplier:create')")
public CommonResult<Boolean> createBaseSupplier(@Valid @RequestBody BaseSupplierSaveReqVO saveReqVO) {
baseSupplierService.saveBaseSupplier(saveReqVO);
return success(true);
}
/**
* 更新供应商
*
* @param saveReqVO BaseSupplierSaveReqVO实体
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
* @author PQZ
* @date 11:14 2024/9/11
**/
@PutMapping("/update")
@Operation(summary = "更新供应商")
@PreAuthorize("@ss.hasPermission('supplier:base-supplier:update')")
public CommonResult<Boolean> updateBaseSupplier(@Valid @RequestBody BaseSupplierSaveReqVO saveReqVO) {
baseSupplierService.saveBaseSupplier(saveReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除供应商")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('supplier:base-supplier:delete')")
public CommonResult<Boolean> deleteBaseSupplier(@RequestParam("id") String id) {
baseSupplierService.deleteBaseSupplier(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得供应商")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('supplier:base-supplier:query')")
public CommonResult<BaseSupplierRespVO> getBaseSupplier(@RequestParam("id") String id) {
BaseSupplier baseSupplier = baseSupplierService.getBaseSupplier(id);
return success(BeanUtils.toBean(baseSupplier, BaseSupplierRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得供应商分页")
@PreAuthorize("@ss.hasPermission('supplier:base-supplier:query')")
public CommonResult<PageResult<BaseSupplierRespVO>> getBaseSupplierPage(@Valid BaseSupplierPageReqVO pageReqVO) {
PageResult<BaseSupplier> pageResult = baseSupplierService.getBaseSupplierPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, BaseSupplierRespVO.class));
}
}

View File

@ -0,0 +1,73 @@
package cn.iocoder.yudao.module.supplier.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/**
* 供应商 DO
*
* @author pqz
*/
@TableName("dl_base_supplier")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BaseSupplier extends TenantBaseDO {
/**
* 主键标识
*/
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 供应商名称
*/
private String name;
/**
* 联系人
*/
private String linkName;
/**
* 联系电话
*/
private String linkPhone;
/**
* 联系方式
*/
private String phone;
/**
* 传真
*/
private String fax;
/**
* 结算方式
*/
private String billing;
/**
* 排序
*/
private Long sort;
/**
* 地址
*/
private String address;
/**
* 状态
*/
private String status;
/**
* 备注
*/
private String remark;
/**
* 关联子公司
*/
private String corpId;
}

View File

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.supplier.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 供应商关联账户 DO
*
* @author pqz
*/
@TableName("dl_base_supplier_account")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BaseSupplierAccount extends TenantBaseDO {
/**
* 主键标识
*/
@TableId(type = IdType.INPUT)
private String id;
/**
* 供应商id
*/
private String supplierId;
/**
* 开户行
*/
private String bankName;
/**
* 开户名
*/
private String countName;
/**
* 银行卡号
*/
private String countNo;
}

View File

@ -0,0 +1,15 @@
package cn.iocoder.yudao.module.supplier.mapper;
import cn.iocoder.yudao.module.supplier.entity.BaseSupplierAccount;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 供应商关联账户 Mapper
*
* @author pqz
*/
@Mapper
public interface BaseSupplierAccountMapper extends BaseMapper<BaseSupplierAccount> {
}

View File

@ -0,0 +1,15 @@
package cn.iocoder.yudao.module.supplier.mapper;
import cn.iocoder.yudao.module.supplier.entity.BaseSupplier;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 供应商 Mapper
*
* @author pqz
*/
@Mapper
public interface BaseSupplierMapper extends BaseMapper<BaseSupplier> {
}

View File

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.supplier.service;
import cn.iocoder.yudao.module.supplier.entity.BaseSupplierAccount;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 供应商关联账户 Service 接口
*
* @author pqz
*/
public interface BaseSupplierAccountService extends IService<BaseSupplierAccount> {
}

View File

@ -0,0 +1,50 @@
package cn.iocoder.yudao.module.supplier.service;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.supplier.entity.BaseSupplier;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierPageReqVO;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierSaveReqVO;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.validation.Valid;
/**
* 供应商 Service 接口
*
* @author pqz
*/
public interface BaseSupplierService extends IService<BaseSupplier> {
/**
* 保存供应商
* @author PQZ
* @date 11:00 2024/9/11
* @param saveReqVO BaseSupplierSaveReqVO
**/
void saveBaseSupplier(BaseSupplierSaveReqVO saveReqVO);
/**
* 删除供应商
*
* @param id 编号
*/
void deleteBaseSupplier(String id);
/**
* 获得供应商
*
* @param id 编号
* @return 供应商
*/
BaseSupplier getBaseSupplier(String id);
/**
* 获得供应商分页
*
* @param pageReqVO 分页查询
* @return 供应商分页
*/
PageResult<BaseSupplier> getBaseSupplierPage(BaseSupplierPageReqVO pageReqVO);
}

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.supplier.service.impl;
import cn.iocoder.yudao.module.supplier.entity.BaseSupplierAccount;
import cn.iocoder.yudao.module.supplier.mapper.BaseSupplierAccountMapper;
import cn.iocoder.yudao.module.supplier.service.BaseSupplierAccountService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 供应商关联账户 Service 实现类
*
* @author pqz
*/
@Service
@Validated
public class BaseSupplierAccountServiceImpl extends ServiceImpl<BaseSupplierAccountMapper, BaseSupplierAccount> implements BaseSupplierAccountService {
}

View File

@ -0,0 +1,60 @@
package cn.iocoder.yudao.module.supplier.service.impl;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.supplier.entity.BaseSupplier;
import cn.iocoder.yudao.module.supplier.mapper.BaseSupplierMapper;
import cn.iocoder.yudao.module.supplier.service.BaseSupplierService;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierPageReqVO;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierSaveReqVO;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
/**
* 供应商 Service 实现类
*
* @author pqz
*/
@Service
@Validated
public class BaseSupplierServiceImpl extends ServiceImpl<BaseSupplierMapper, BaseSupplier> implements BaseSupplierService {
@Resource
private BaseSupplierMapper baseSupplierMapper;
/**
* 保存供应商
*
* @param saveReqVO BaseSupplierSaveReqVO
* @author PQZ
* @date 11:00 2024/9/11
**/
@Override
public void saveBaseSupplier(BaseSupplierSaveReqVO saveReqVO) {
}
@Override
public void deleteBaseSupplier(String id) {
// 校验存在
baseSupplierMapper.deleteById(id);
}
@Override
public BaseSupplier getBaseSupplier(String id) {
return baseSupplierMapper.selectById(id);
}
@Override
public PageResult<BaseSupplier> getBaseSupplierPage(BaseSupplierPageReqVO pageReqVO) {
return null;
}
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.supplier.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 BaseSupplierAccountPageReqVO extends PageParam {
@Schema(description = "供应商id", example = "9583")
private String supplierId;
@Schema(description = "开户行", example = "王五")
private String bankName;
@Schema(description = "开户名", example = "李四")
private String countName;
@Schema(description = "银行卡号")
private String countNo;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.supplier.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 供应商关联账户 Response VO")
@Data
@ExcelIgnoreUnannotated
public class BaseSupplierAccountRespVO {
@Schema(description = "供应商id", example = "9583")
@ExcelProperty("供应商id")
private String supplierId;
@Schema(description = "开户行", example = "王五")
@ExcelProperty("开户行")
private String bankName;
@Schema(description = "开户名", example = "李四")
@ExcelProperty("开户名")
private String countName;
@Schema(description = "银行卡号")
@ExcelProperty("银行卡号")
private String countNo;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,12 @@
package cn.iocoder.yudao.module.supplier.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 供应商关联账户新增/修改 Request VO")
@Data
public class BaseSupplierAccountSaveReqVO {
}

View File

@ -0,0 +1,23 @@
package cn.iocoder.yudao.module.supplier.vo;
import cn.iocoder.yudao.module.supplier.entity.BaseSupplier;
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 javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
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 BaseSupplierPageReqVO extends BaseSupplier {
}

View File

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.supplier.vo;
import cn.iocoder.yudao.module.supplier.entity.BaseSupplier;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 供应商 Response VO")
@Data
@ExcelIgnoreUnannotated
public class BaseSupplierRespVO extends BaseSupplier {
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.supplier.vo;
import cn.iocoder.yudao.module.supplier.entity.BaseSupplier;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 供应商新增/修改 Request VO")
@Data
public class BaseSupplierSaveReqVO extends BaseSupplier {
}

View File

@ -0,0 +1,12 @@
<?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="cn.iocoder.yudao.module.supplier.mapper.BaseSupplierAccountMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,12 @@
<?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="cn.iocoder.yudao.module.supplier.mapper.BaseSupplierMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>