供应商管理-代码生成
This commit is contained in:
@ -0,0 +1,133 @@
|
||||
package com.xjrsoft.module.supplier.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.page.ConventPage;
|
||||
import com.xjrsoft.common.page.PageOutput;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.utils.VoToColumnUtil;
|
||||
import com.xjrsoft.module.supplier.dto.AddLngSupplierDto;
|
||||
import com.xjrsoft.module.supplier.dto.UpdateLngSupplierDto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.module.supplier.dto.LngSupplierPageDto;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplier;
|
||||
import com.xjrsoft.module.supplier.service.ISupplierService;
|
||||
import com.xjrsoft.module.supplier.vo.LngSupplierPageVo;
|
||||
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.supplier.vo.LngSupplierVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: 供应商
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-15
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/supplier" + "/supplier")
|
||||
@Api(value = "/supplier" + "/supplier",tags = "供应商代码")
|
||||
@AllArgsConstructor
|
||||
public class SupplierController {
|
||||
|
||||
|
||||
private final ISupplierService supplierService;
|
||||
private final DatalogService dataService;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@ApiOperation(value="LngSupplier列表(分页)")
|
||||
@SaCheckPermission("supplier:list")
|
||||
public R page(@Valid LngSupplierPageDto dto){
|
||||
|
||||
LambdaQueryWrapper<LngSupplier> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getSuName()),LngSupplier::getSuName,dto.getSuName())
|
||||
.like(StrUtil.isNotBlank(dto.getSuSname()),LngSupplier::getSuSname,dto.getSuSname())
|
||||
.like(StrUtil.isNotBlank(dto.getNatureCode()),LngSupplier::getNatureCode,dto.getNatureCode())
|
||||
.like(StrUtil.isNotBlank(dto.getTypeCode()),LngSupplier::getTypeCode,dto.getTypeCode())
|
||||
.like(StrUtil.isNotBlank(dto.getClassCode()),LngSupplier::getClassCode,dto.getClassCode())
|
||||
.like(StrUtil.isNotBlank(dto.getDI()),LngSupplier::getDI,dto.getDI())
|
||||
.like(StrUtil.isNotBlank(dto.getValid()),LngSupplier::getValid,dto.getValid())
|
||||
.like(StrUtil.isNotBlank(dto.getApproCode()),LngSupplier::getApproCode,dto.getApproCode())
|
||||
.orderByDesc(LngSupplier::getId)
|
||||
.select(LngSupplier.class,x -> VoToColumnUtil.fieldsToColumns(LngSupplierPageVo.class).contains(x.getProperty()));
|
||||
IPage<LngSupplier> page = supplierService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<LngSupplierPageVo> pageOutput = ConventPage.getPageOutput(page, LngSupplierPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@ApiOperation(value="根据id查询LngSupplier信息")
|
||||
@SaCheckPermission("supplier:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
LngSupplier lngSupplier = supplierService.getByIdDeep(id);
|
||||
if (lngSupplier == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(lngSupplier, LngSupplierVo.class));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/datalog")
|
||||
@ApiOperation(value="根据id查询LngSupplier数据详细日志")
|
||||
@SaCheckPermission("supplier:datalog")
|
||||
public R datalog(@RequestParam Long id){
|
||||
List<DataChangeLogVo> logs = dataService.findLogsByEntityId(UpdateLngSupplierDto.class,id);
|
||||
return R.ok(logs);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增LngSupplier")
|
||||
@SaCheckPermission("supplier:add")
|
||||
public R add(@Valid @RequestBody UpdateLngSupplierDto dto){
|
||||
UpdateLngSupplierDto res = dataService.insert(dto);
|
||||
return R.ok(res.getId());
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改LngSupplier")
|
||||
@SaCheckPermission("supplier:edit")
|
||||
public R update(@Valid @RequestBody UpdateLngSupplierDto dto){
|
||||
return R.ok(dataService.updateById(dto));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation(value = "删除")
|
||||
@SaCheckPermission("supplier:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(dataService.deleteByIds(UpdateLngSupplierDto.class, ids));
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/enable")
|
||||
@ApiOperation(value = "启用LngSupplier")
|
||||
@SaCheckPermission("supplier:enable")
|
||||
public R enable(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(dataService.enable(UpdateLngSupplierDto.class,ids));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/disable")
|
||||
@ApiOperation(value = "禁用LngSupplier")
|
||||
@SaCheckPermission("supplier:disable")
|
||||
public R disable(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(dataService.disable(UpdateLngSupplierDto.class,ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,237 @@
|
||||
package com.xjrsoft.module.supplier.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import com.github.yulichang.annotation.EntityMapping;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 供应商
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-15
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("lng_supplier")
|
||||
@ApiModel(value = "供应商对象", description = "供应商")
|
||||
public class LngSupplier implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 集团编码
|
||||
*/
|
||||
@ApiModelProperty("集团编码")
|
||||
private String suMcode;
|
||||
|
||||
/**
|
||||
* 供应商编码(不能重复,以S开头)
|
||||
*/
|
||||
@ApiModelProperty("供应商编码(不能重复,以S开头)")
|
||||
private String suCode;
|
||||
|
||||
/**
|
||||
* 供应商名称(不能与名称、简称重复)
|
||||
*/
|
||||
@ApiModelProperty("供应商名称(不能与名称、简称重复)")
|
||||
private String suName;
|
||||
|
||||
/**
|
||||
* 简称(不能与名称、简称重复)
|
||||
*/
|
||||
@ApiModelProperty("简称(不能与名称、简称重复)")
|
||||
private String suSname;
|
||||
|
||||
/**
|
||||
* 国际/国内(I-国际,D-国内)
|
||||
*/
|
||||
@ApiModelProperty("国际/国内(I-国际,D-国内)")
|
||||
private String dI;
|
||||
|
||||
/**
|
||||
* 企业性质(国有企业/非国有企业)
|
||||
*/
|
||||
@ApiModelProperty("企业性质(国有企业/非国有企业)")
|
||||
private String natureCode;
|
||||
|
||||
/**
|
||||
* 母公司名称
|
||||
*/
|
||||
@ApiModelProperty("母公司名称")
|
||||
private String parentName;
|
||||
|
||||
/**
|
||||
* 统一社会信用代码(非空时不可重复)
|
||||
*/
|
||||
@ApiModelProperty("统一社会信用代码(非空时不可重复)")
|
||||
private String creditNo;
|
||||
|
||||
/**
|
||||
* 纳税人识别号(非空时不可重复)
|
||||
*/
|
||||
@ApiModelProperty("纳税人识别号(非空时不可重复)")
|
||||
private String tiNo;
|
||||
|
||||
/**
|
||||
* 法定代表人
|
||||
*/
|
||||
@ApiModelProperty("法定代表人")
|
||||
private String representative;
|
||||
|
||||
/**
|
||||
* 注册资本(万元)
|
||||
*/
|
||||
@ApiModelProperty("注册资本(万元)")
|
||||
private String amtReg;
|
||||
|
||||
/**
|
||||
* 注册地址
|
||||
*/
|
||||
@ApiModelProperty("注册地址")
|
||||
private String addrReg;
|
||||
|
||||
/**
|
||||
* 通讯地址
|
||||
*/
|
||||
@ApiModelProperty("通讯地址")
|
||||
private String addrMail;
|
||||
|
||||
/**
|
||||
* 成立日期
|
||||
*/
|
||||
@ApiModelProperty("成立日期")
|
||||
private LocalDateTime dateEstab;
|
||||
|
||||
/**
|
||||
* 准入时间
|
||||
*/
|
||||
@ApiModelProperty("准入时间")
|
||||
private LocalDateTime dateEntry;
|
||||
|
||||
/**
|
||||
* 供应商分类(一类/二类)
|
||||
*/
|
||||
@ApiModelProperty("供应商分类(一类/二类)")
|
||||
private String classCode;
|
||||
|
||||
/**
|
||||
* 供应商类别(资源方/贸易商/托运商/接收站/多领域)
|
||||
*/
|
||||
@ApiModelProperty("供应商类别(资源方/贸易商/托运商/接收站/多领域)")
|
||||
private String typeCode;
|
||||
|
||||
/**
|
||||
* 组织架构编码
|
||||
*/
|
||||
@ApiModelProperty("组织架构编码")
|
||||
private String orgCode;
|
||||
|
||||
/**
|
||||
* 有效标志(Y-有效,N-无效)
|
||||
*/
|
||||
@ApiModelProperty("有效标志(Y-有效,N-无效)")
|
||||
private String valid;
|
||||
|
||||
/**
|
||||
* 状态(未提交/审批中/已审批/已驳回)
|
||||
*/
|
||||
@ApiModelProperty("状态(未提交/审批中/已审批/已驳回)")
|
||||
private String approCode;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty("备注")
|
||||
private String note;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@ApiModelProperty("创建人id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createDate;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
@ApiModelProperty("修改人id")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private Long modifyUserId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@ApiModelProperty("修改时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime modifyDate;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ApiModelProperty("部门id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 数据权限id
|
||||
*/
|
||||
@ApiModelProperty("数据权限id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long ruleUserId;
|
||||
|
||||
|
||||
/**
|
||||
* lngSupplierBank
|
||||
*/
|
||||
@ApiModelProperty("lngSupplierBank子表")
|
||||
@TableField(exist = false)
|
||||
@EntityMapping(thisField = "suCode", joinField = "suCode")
|
||||
private List<LngSupplierBank> lngSupplierBankList;
|
||||
/**
|
||||
* lngSupplierContact
|
||||
*/
|
||||
@ApiModelProperty("lngSupplierContact子表")
|
||||
@TableField(exist = false)
|
||||
@EntityMapping(thisField = "suCode", joinField = "suCode")
|
||||
private List<LngSupplierContact> lngSupplierContactList;
|
||||
/**
|
||||
* lngSupplierDoc
|
||||
*/
|
||||
@ApiModelProperty("lngSupplierDoc子表")
|
||||
@TableField(exist = false)
|
||||
@EntityMapping(thisField = "suCode", joinField = "suCode")
|
||||
private List<LngSupplierDoc> lngSupplierDocList;
|
||||
|
||||
}
|
||||
@ -0,0 +1,126 @@
|
||||
package com.xjrsoft.module.supplier.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import com.github.yulichang.annotation.EntityMapping;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 供应商
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-15
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("lng_supplier_bank")
|
||||
@ApiModel(value = "供应商对象", description = "供应商")
|
||||
public class LngSupplierBank implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 供应商编码
|
||||
*/
|
||||
@ApiModelProperty("供应商编码")
|
||||
private String suCode;
|
||||
|
||||
/**
|
||||
* 银行
|
||||
*/
|
||||
@ApiModelProperty("银行")
|
||||
private String bankCode;
|
||||
|
||||
/**
|
||||
* 账号名称
|
||||
*/
|
||||
@ApiModelProperty("账号名称")
|
||||
private String accountName;
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
@ApiModelProperty("账号")
|
||||
private String account;
|
||||
|
||||
/**
|
||||
* 默认账号(Y-是,N-否;只能有一个Y的有效记录)
|
||||
*/
|
||||
@ApiModelProperty("默认账号(Y-是,N-否;只能有一个Y的有效记录)")
|
||||
private String defaultSign;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty("备注")
|
||||
private String note;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@ApiModelProperty("创建人id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createDate;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
@ApiModelProperty("修改人id")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private Long modifyUserId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@ApiModelProperty("修改时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime modifyDate;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ApiModelProperty("部门id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 数据权限id
|
||||
*/
|
||||
@ApiModelProperty("数据权限id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long ruleUserId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,138 @@
|
||||
package com.xjrsoft.module.supplier.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import com.github.yulichang.annotation.EntityMapping;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 供应商
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-15
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("lng_supplier_contact")
|
||||
@ApiModel(value = "供应商对象", description = "供应商")
|
||||
public class LngSupplierContact implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 供应商编码
|
||||
*/
|
||||
@ApiModelProperty("供应商编码")
|
||||
private String suCode;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@ApiModelProperty("姓名")
|
||||
private String contactName;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@ApiModelProperty("联系电话")
|
||||
private String tel;
|
||||
|
||||
/**
|
||||
* 通讯地址
|
||||
*/
|
||||
@ApiModelProperty("通讯地址")
|
||||
private String addrMail;
|
||||
|
||||
/**
|
||||
* 电子邮箱
|
||||
*/
|
||||
@ApiModelProperty("电子邮箱")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 职位
|
||||
*/
|
||||
@ApiModelProperty("职位")
|
||||
private String position;
|
||||
|
||||
/**
|
||||
* 有效标志(Y-有效,N-无效)
|
||||
*/
|
||||
@ApiModelProperty("有效标志(Y-有效,N-无效)")
|
||||
private String valid;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty("备注")
|
||||
private String note;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@ApiModelProperty("创建人id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createDate;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
@ApiModelProperty("修改人id")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private Long modifyUserId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@ApiModelProperty("修改时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime modifyDate;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ApiModelProperty("部门id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 数据权限id
|
||||
*/
|
||||
@ApiModelProperty("数据权限id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long ruleUserId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,138 @@
|
||||
package com.xjrsoft.module.supplier.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import com.github.yulichang.annotation.EntityMapping;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 供应商
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-15
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("lng_supplier_doc")
|
||||
@ApiModel(value = "供应商对象", description = "供应商")
|
||||
public class LngSupplierDoc implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 供应商编码
|
||||
*/
|
||||
@ApiModelProperty("供应商编码")
|
||||
private String suCode;
|
||||
|
||||
/**
|
||||
* 资质证书类型
|
||||
*/
|
||||
@ApiModelProperty("资质证书类型")
|
||||
private String docTypeCode;
|
||||
|
||||
/**
|
||||
* 资质证书编号
|
||||
*/
|
||||
@ApiModelProperty("资质证书编号")
|
||||
private String docNo;
|
||||
|
||||
/**
|
||||
* 有效期开始
|
||||
*/
|
||||
@ApiModelProperty("有效期开始")
|
||||
private LocalDateTime dateFrom;
|
||||
|
||||
/**
|
||||
* 有效期结束
|
||||
*/
|
||||
@ApiModelProperty("有效期结束")
|
||||
private LocalDateTime dateTo;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
@ApiModelProperty("显示顺序")
|
||||
private Short sort;
|
||||
|
||||
/**
|
||||
* 有效标志(Y-有效,N-无效)
|
||||
*/
|
||||
@ApiModelProperty("有效标志(Y-有效,N-无效)")
|
||||
private String valid;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty("备注")
|
||||
private String note;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@ApiModelProperty("创建人id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createDate;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
@ApiModelProperty("修改人id")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private Long modifyUserId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@ApiModelProperty("修改时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime modifyDate;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ApiModelProperty("部门id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 数据权限id
|
||||
*/
|
||||
@ApiModelProperty("数据权限id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long ruleUserId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.module.supplier.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplierBank;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-15
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngSupplierBankMapper extends MPJBaseMapper<LngSupplierBank> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.module.supplier.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplierContact;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-15
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngSupplierContactMapper extends MPJBaseMapper<LngSupplierContact> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.module.supplier.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplierDoc;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-15
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngSupplierDocMapper extends MPJBaseMapper<LngSupplierDoc> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.module.supplier.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplier;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-15
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngSupplierMapper extends MPJBaseMapper<LngSupplier> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.xjrsoft.module.supplier.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.github.yulichang.extension.mapping.base.MPJDeepService;
|
||||
import com.github.yulichang.extension.mapping.base.MPJRelationService;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplier;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-15
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface ISupplierService extends MPJBaseService<LngSupplier>, MPJDeepService<LngSupplier>, MPJRelationService<LngSupplier> {
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param lngSupplier
|
||||
* @return
|
||||
*/
|
||||
Boolean add(LngSupplier lngSupplier);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param lngSupplier
|
||||
* @return
|
||||
*/
|
||||
Boolean update(LngSupplier lngSupplier);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
Boolean delete(List<Long> ids);
|
||||
}
|
||||
@ -0,0 +1,162 @@
|
||||
package com.xjrsoft.module.supplier.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplierBank;
|
||||
import com.xjrsoft.module.supplier.mapper.LngSupplierBankMapper;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplierContact;
|
||||
import com.xjrsoft.module.supplier.mapper.LngSupplierContactMapper;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplierDoc;
|
||||
import com.xjrsoft.module.supplier.mapper.LngSupplierDocMapper;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplier;
|
||||
import com.xjrsoft.module.supplier.mapper.LngSupplierMapper;
|
||||
import com.xjrsoft.module.supplier.service.ISupplierService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-15
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SupplierServiceImpl extends MPJBaseServiceImpl<LngSupplierMapper, LngSupplier> implements ISupplierService {
|
||||
private final LngSupplierMapper supplierLngSupplierMapper;
|
||||
|
||||
private final LngSupplierBankMapper supplierLngSupplierBankMapper;
|
||||
private final LngSupplierContactMapper supplierLngSupplierContactMapper;
|
||||
private final LngSupplierDocMapper supplierLngSupplierDocMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean add(LngSupplier lngSupplier) {
|
||||
supplierLngSupplierMapper.insert(lngSupplier);
|
||||
for (LngSupplierBank lngSupplierBank : lngSupplier.getLngSupplierBankList()) {
|
||||
lngSupplierBank.setSuCode(lngSupplier.getSuCode());
|
||||
supplierLngSupplierBankMapper.insert(lngSupplierBank);
|
||||
}
|
||||
for (LngSupplierContact lngSupplierContact : lngSupplier.getLngSupplierContactList()) {
|
||||
lngSupplierContact.setSuCode(lngSupplier.getSuCode());
|
||||
supplierLngSupplierContactMapper.insert(lngSupplierContact);
|
||||
}
|
||||
for (LngSupplierDoc lngSupplierDoc : lngSupplier.getLngSupplierDocList()) {
|
||||
lngSupplierDoc.setSuCode(lngSupplier.getSuCode());
|
||||
supplierLngSupplierDocMapper.insert(lngSupplierDoc);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean update(LngSupplier lngSupplier) {
|
||||
supplierLngSupplierMapper.updateById(lngSupplier);
|
||||
//********************************* LngSupplierBank 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngSupplierBank> lngSupplierBankList = supplierLngSupplierBankMapper.selectList(Wrappers.lambdaQuery(LngSupplierBank.class).eq(LngSupplierBank::getSuCode, lngSupplier.getSuCode()).select(LngSupplierBank::getId));
|
||||
List<Long> lngSupplierBankIds = lngSupplierBankList.stream().map(LngSupplierBank::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngSupplierBankOldIds = lngSupplier.getLngSupplierBankList().stream().map(LngSupplierBank::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngSupplierBankRemoveIds = lngSupplierBankIds.stream().filter(item -> !lngSupplierBankOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (LngSupplierBank lngSupplierBank : lngSupplier.getLngSupplierBankList()) {
|
||||
//如果不等于空则修改
|
||||
if (lngSupplierBank.getId() != null) {
|
||||
supplierLngSupplierBankMapper.updateById(lngSupplierBank);
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngSupplierBank.setSuCode(lngSupplier.getSuCode());
|
||||
supplierLngSupplierBankMapper.insert(lngSupplierBank);
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngSupplierBankRemoveIds.size() > 0){
|
||||
supplierLngSupplierBankMapper.deleteBatchIds(lngSupplierBankRemoveIds);
|
||||
}
|
||||
}
|
||||
//********************************* LngSupplierBank 增删改 结束 *******************************************/
|
||||
|
||||
//********************************* LngSupplierContact 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngSupplierContact> lngSupplierContactList = supplierLngSupplierContactMapper.selectList(Wrappers.lambdaQuery(LngSupplierContact.class).eq(LngSupplierContact::getSuCode, lngSupplier.getSuCode()).select(LngSupplierContact::getId));
|
||||
List<Long> lngSupplierContactIds = lngSupplierContactList.stream().map(LngSupplierContact::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngSupplierContactOldIds = lngSupplier.getLngSupplierContactList().stream().map(LngSupplierContact::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngSupplierContactRemoveIds = lngSupplierContactIds.stream().filter(item -> !lngSupplierContactOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (LngSupplierContact lngSupplierContact : lngSupplier.getLngSupplierContactList()) {
|
||||
//如果不等于空则修改
|
||||
if (lngSupplierContact.getId() != null) {
|
||||
supplierLngSupplierContactMapper.updateById(lngSupplierContact);
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngSupplierContact.setSuCode(lngSupplier.getSuCode());
|
||||
supplierLngSupplierContactMapper.insert(lngSupplierContact);
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngSupplierContactRemoveIds.size() > 0){
|
||||
supplierLngSupplierContactMapper.deleteBatchIds(lngSupplierContactRemoveIds);
|
||||
}
|
||||
}
|
||||
//********************************* LngSupplierContact 增删改 结束 *******************************************/
|
||||
|
||||
//********************************* LngSupplierDoc 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngSupplierDoc> lngSupplierDocList = supplierLngSupplierDocMapper.selectList(Wrappers.lambdaQuery(LngSupplierDoc.class).eq(LngSupplierDoc::getSuCode, lngSupplier.getSuCode()).select(LngSupplierDoc::getId));
|
||||
List<Long> lngSupplierDocIds = lngSupplierDocList.stream().map(LngSupplierDoc::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngSupplierDocOldIds = lngSupplier.getLngSupplierDocList().stream().map(LngSupplierDoc::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngSupplierDocRemoveIds = lngSupplierDocIds.stream().filter(item -> !lngSupplierDocOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (LngSupplierDoc lngSupplierDoc : lngSupplier.getLngSupplierDocList()) {
|
||||
//如果不等于空则修改
|
||||
if (lngSupplierDoc.getId() != null) {
|
||||
supplierLngSupplierDocMapper.updateById(lngSupplierDoc);
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngSupplierDoc.setSuCode(lngSupplier.getSuCode());
|
||||
supplierLngSupplierDocMapper.insert(lngSupplierDoc);
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngSupplierDocRemoveIds.size() > 0){
|
||||
supplierLngSupplierDocMapper.deleteBatchIds(lngSupplierDocRemoveIds);
|
||||
}
|
||||
}
|
||||
//********************************* LngSupplierDoc 增删改 结束 *******************************************/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean delete(List<Long> ids) {
|
||||
supplierLngSupplierMapper.deleteBatchIds(ids);
|
||||
supplierLngSupplierBankMapper.delete(Wrappers.lambdaQuery(LngSupplierBank.class).in(LngSupplierBank::getSuCode, ids));
|
||||
supplierLngSupplierContactMapper.delete(Wrappers.lambdaQuery(LngSupplierContact.class).in(LngSupplierContact::getSuCode, ids));
|
||||
supplierLngSupplierDocMapper.delete(Wrappers.lambdaQuery(LngSupplierDoc.class).in(LngSupplierDoc::getSuCode, ids));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user