feat(Frozen/Sale [New]): 销售主表 | 明细表
销售主子表管理功能 [skip ci]
This commit is contained in:
parent
e79d57f6ce
commit
5ae4af6c44
@ -0,0 +1,104 @@
|
|||||||
|
package com.zhyc.module.frozen.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.zhyc.common.annotation.Log;
|
||||||
|
import com.zhyc.common.core.controller.BaseController;
|
||||||
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
|
import com.zhyc.common.enums.BusinessType;
|
||||||
|
import com.zhyc.module.frozen.domain.DdSale;
|
||||||
|
import com.zhyc.module.frozen.service.IDdSaleService;
|
||||||
|
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||||
|
import com.zhyc.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售主单Controller
|
||||||
|
*
|
||||||
|
* @author HashMap
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sale/sale")
|
||||||
|
public class DdSaleController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IDdSaleService ddSaleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询销售主单列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('sale:sale:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(DdSale ddSale)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<DdSale> list = ddSaleService.selectDdSaleList(ddSale);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出销售主单列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('sale:sale:export')")
|
||||||
|
@Log(title = "销售主单", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, DdSale ddSale)
|
||||||
|
{
|
||||||
|
List<DdSale> list = ddSaleService.selectDdSaleList(ddSale);
|
||||||
|
ExcelUtil<DdSale> util = new ExcelUtil<DdSale>(DdSale.class);
|
||||||
|
util.exportExcel(response, list, "销售主单数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取销售主单详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('sale:sale:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(ddSaleService.selectDdSaleById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增销售主单
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('sale:sale:add')")
|
||||||
|
@Log(title = "销售主单", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody DdSale ddSale)
|
||||||
|
{
|
||||||
|
return toAjax(ddSaleService.insertDdSale(ddSale));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改销售主单
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('sale:sale:edit')")
|
||||||
|
@Log(title = "销售主单", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody DdSale ddSale)
|
||||||
|
{
|
||||||
|
return toAjax(ddSaleService.updateDdSale(ddSale));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除销售主单
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('sale:sale:remove')")
|
||||||
|
@Log(title = "销售主单", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(ddSaleService.deleteDdSaleByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,194 @@
|
|||||||
|
package com.zhyc.module.frozen.domain;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.zhyc.common.annotation.Excel;
|
||||||
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售主单对象 dd_sl
|
||||||
|
*
|
||||||
|
* @author HashMap
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
public class DdSale extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 销售日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "销售日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date saleDate;
|
||||||
|
|
||||||
|
/** 客户名称 */
|
||||||
|
@Excel(name = "客户名称")
|
||||||
|
private String custName;
|
||||||
|
|
||||||
|
/** 客户电话 */
|
||||||
|
@Excel(name = "客户电话")
|
||||||
|
private String custPhone;
|
||||||
|
|
||||||
|
/** 客户地址 */
|
||||||
|
@Excel(name = "客户地址")
|
||||||
|
private String custAddr;
|
||||||
|
|
||||||
|
/** 销售人员 */
|
||||||
|
@Excel(name = "销售人员")
|
||||||
|
private String salesper;
|
||||||
|
|
||||||
|
/** 检疫证号(可选) */
|
||||||
|
@Excel(name = "检疫证号", readConverterExp = "可=选")
|
||||||
|
private String quaranNo;
|
||||||
|
|
||||||
|
/** 审批编号(可选) */
|
||||||
|
@Excel(name = "审批编号", readConverterExp = "可=选")
|
||||||
|
private String apprNo;
|
||||||
|
|
||||||
|
/** 总价 */
|
||||||
|
@Excel(name = "总价")
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
/** 技术员 */
|
||||||
|
@Excel(name = "技术员")
|
||||||
|
private String tech;
|
||||||
|
|
||||||
|
/** 销售明细信息 */
|
||||||
|
private List<DdSaleItem> ddSaleItemList;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSaleDate(Date saleDate)
|
||||||
|
{
|
||||||
|
this.saleDate = saleDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getSaleDate()
|
||||||
|
{
|
||||||
|
return saleDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustName(String custName)
|
||||||
|
{
|
||||||
|
this.custName = custName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCustName()
|
||||||
|
{
|
||||||
|
return custName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustPhone(String custPhone)
|
||||||
|
{
|
||||||
|
this.custPhone = custPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCustPhone()
|
||||||
|
{
|
||||||
|
return custPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustAddr(String custAddr)
|
||||||
|
{
|
||||||
|
this.custAddr = custAddr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCustAddr()
|
||||||
|
{
|
||||||
|
return custAddr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSalesper(String salesper)
|
||||||
|
{
|
||||||
|
this.salesper = salesper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSalesper()
|
||||||
|
{
|
||||||
|
return salesper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuaranNo(String quaranNo)
|
||||||
|
{
|
||||||
|
this.quaranNo = quaranNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getQuaranNo()
|
||||||
|
{
|
||||||
|
return quaranNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApprNo(String apprNo)
|
||||||
|
{
|
||||||
|
this.apprNo = apprNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApprNo()
|
||||||
|
{
|
||||||
|
return apprNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(BigDecimal price)
|
||||||
|
{
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getPrice()
|
||||||
|
{
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTech(String tech)
|
||||||
|
{
|
||||||
|
this.tech = tech;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTech()
|
||||||
|
{
|
||||||
|
return tech;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DdSaleItem> getDdSaleItemList()
|
||||||
|
{
|
||||||
|
return ddSaleItemList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDdSaleItemList(List<DdSaleItem> ddSaleItemList)
|
||||||
|
{
|
||||||
|
this.ddSaleItemList = ddSaleItemList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("saleDate", getSaleDate())
|
||||||
|
.append("custName", getCustName())
|
||||||
|
.append("custPhone", getCustPhone())
|
||||||
|
.append("custAddr", getCustAddr())
|
||||||
|
.append("salesper", getSalesper())
|
||||||
|
.append("quaranNo", getQuaranNo())
|
||||||
|
.append("apprNo", getApprNo())
|
||||||
|
.append("price", getPrice())
|
||||||
|
.append("tech", getTech())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("ddSaleItemList", getDdSaleItemList())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,151 @@
|
|||||||
|
package com.zhyc.module.frozen.domain;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.zhyc.common.annotation.Excel;
|
||||||
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售明细对象 dd_sl_item
|
||||||
|
*
|
||||||
|
* @author HashMap
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
public class DdSaleItem extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 销售主单ID */
|
||||||
|
@Excel(name = "销售主单ID")
|
||||||
|
private Long saleId;
|
||||||
|
|
||||||
|
/** 明细类型(冻胚embryo冻精semen) */
|
||||||
|
@Excel(name = "明细类型", readConverterExp = "冻=胚embryo冻精semen")
|
||||||
|
private String itemType;
|
||||||
|
|
||||||
|
/** 胚胎编号或冻精号 */
|
||||||
|
@Excel(name = "胚胎编号或冻精号")
|
||||||
|
private String itemCode;
|
||||||
|
|
||||||
|
/** 数量 */
|
||||||
|
@Excel(name = "数量")
|
||||||
|
private Long qty;
|
||||||
|
|
||||||
|
/** 单价(元) */
|
||||||
|
@Excel(name = "单价", readConverterExp = "元=")
|
||||||
|
private BigDecimal unitPrice;
|
||||||
|
|
||||||
|
/** 所在液氮罐ID */
|
||||||
|
@Excel(name = "所在液氮罐ID")
|
||||||
|
private Long tankId;
|
||||||
|
|
||||||
|
/** 所在提桶ID */
|
||||||
|
@Excel(name = "所在提桶ID")
|
||||||
|
private Long bucketId;
|
||||||
|
|
||||||
|
/** 所在冷冻架ID */
|
||||||
|
@Excel(name = "所在冷冻架ID")
|
||||||
|
private Long rackId;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setSaleId(Long saleId)
|
||||||
|
{
|
||||||
|
this.saleId = saleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSaleId()
|
||||||
|
{
|
||||||
|
return saleId;
|
||||||
|
}
|
||||||
|
public void setItemType(String itemType)
|
||||||
|
{
|
||||||
|
this.itemType = itemType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getItemType()
|
||||||
|
{
|
||||||
|
return itemType;
|
||||||
|
}
|
||||||
|
public void setItemCode(String itemCode)
|
||||||
|
{
|
||||||
|
this.itemCode = itemCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getItemCode()
|
||||||
|
{
|
||||||
|
return itemCode;
|
||||||
|
}
|
||||||
|
public void setQty(Long qty)
|
||||||
|
{
|
||||||
|
this.qty = qty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getQty()
|
||||||
|
{
|
||||||
|
return qty;
|
||||||
|
}
|
||||||
|
public void setUnitPrice(BigDecimal unitPrice)
|
||||||
|
{
|
||||||
|
this.unitPrice = unitPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getUnitPrice()
|
||||||
|
{
|
||||||
|
return unitPrice;
|
||||||
|
}
|
||||||
|
public void setTankId(Long tankId)
|
||||||
|
{
|
||||||
|
this.tankId = tankId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTankId()
|
||||||
|
{
|
||||||
|
return tankId;
|
||||||
|
}
|
||||||
|
public void setBucketId(Long bucketId)
|
||||||
|
{
|
||||||
|
this.bucketId = bucketId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getBucketId()
|
||||||
|
{
|
||||||
|
return bucketId;
|
||||||
|
}
|
||||||
|
public void setRackId(Long rackId)
|
||||||
|
{
|
||||||
|
this.rackId = rackId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getRackId()
|
||||||
|
{
|
||||||
|
return rackId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("saleId", getSaleId())
|
||||||
|
.append("itemType", getItemType())
|
||||||
|
.append("itemCode", getItemCode())
|
||||||
|
.append("qty", getQty())
|
||||||
|
.append("unitPrice", getUnitPrice())
|
||||||
|
.append("tankId", getTankId())
|
||||||
|
.append("bucketId", getBucketId())
|
||||||
|
.append("rackId", getRackId())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,87 @@
|
|||||||
|
package com.zhyc.module.frozen.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.zhyc.module.frozen.domain.DdSale;
|
||||||
|
import com.zhyc.module.frozen.domain.DdSaleItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售主单Mapper接口
|
||||||
|
*
|
||||||
|
* @author HashMap
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
public interface DdSaleMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询销售主单
|
||||||
|
*
|
||||||
|
* @param id 销售主单主键
|
||||||
|
* @return 销售主单
|
||||||
|
*/
|
||||||
|
public DdSale selectDdSaleById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询销售主单列表
|
||||||
|
*
|
||||||
|
* @param ddSale 销售主单
|
||||||
|
* @return 销售主单集合
|
||||||
|
*/
|
||||||
|
public List<DdSale> selectDdSaleList(DdSale ddSale);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增销售主单
|
||||||
|
*
|
||||||
|
* @param ddSale 销售主单
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertDdSale(DdSale ddSale);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改销售主单
|
||||||
|
*
|
||||||
|
* @param ddSale 销售主单
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDdSale(DdSale ddSale);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除销售主单
|
||||||
|
*
|
||||||
|
* @param id 销售主单主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDdSaleById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除销售主单
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDdSaleByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除销售明细
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDdSaleItemBySaleIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增销售明细
|
||||||
|
*
|
||||||
|
* @param ddSaleItemList 销售明细列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int batchDdSaleItem(List<DdSaleItem> ddSaleItemList);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过销售主单主键删除销售明细信息
|
||||||
|
*
|
||||||
|
* @param id 销售主单ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDdSaleItemBySaleId(Long id);
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package com.zhyc.module.frozen.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.zhyc.module.frozen.domain.DdSale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售主单Service接口
|
||||||
|
*
|
||||||
|
* @author HashMap
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
public interface IDdSaleService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询销售主单
|
||||||
|
*
|
||||||
|
* @param id 销售主单主键
|
||||||
|
* @return 销售主单
|
||||||
|
*/
|
||||||
|
public DdSale selectDdSaleById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询销售主单列表
|
||||||
|
*
|
||||||
|
* @param ddSale 销售主单
|
||||||
|
* @return 销售主单集合
|
||||||
|
*/
|
||||||
|
public List<DdSale> selectDdSaleList(DdSale ddSale);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增销售主单
|
||||||
|
*
|
||||||
|
* @param ddSale 销售主单
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertDdSale(DdSale ddSale);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改销售主单
|
||||||
|
*
|
||||||
|
* @param ddSale 销售主单
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDdSale(DdSale ddSale);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除销售主单
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的销售主单主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDdSaleByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除销售主单信息
|
||||||
|
*
|
||||||
|
* @param id 销售主单主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDdSaleById(Long id);
|
||||||
|
}
|
||||||
@ -0,0 +1,133 @@
|
|||||||
|
package com.zhyc.module.frozen.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.zhyc.common.utils.DateUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import com.zhyc.common.utils.StringUtils;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import com.zhyc.module.frozen.domain.DdSaleItem;
|
||||||
|
import com.zhyc.module.frozen.mapper.DdSaleMapper;
|
||||||
|
import com.zhyc.module.frozen.domain.DdSale;
|
||||||
|
import com.zhyc.module.frozen.service.IDdSaleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售主单Service业务层处理
|
||||||
|
*
|
||||||
|
* @author HashMap
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DdSaleServiceImpl implements IDdSaleService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private DdSaleMapper ddSaleMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询销售主单
|
||||||
|
*
|
||||||
|
* @param id 销售主单主键
|
||||||
|
* @return 销售主单
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DdSale selectDdSaleById(Long id)
|
||||||
|
{
|
||||||
|
return ddSaleMapper.selectDdSaleById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询销售主单列表
|
||||||
|
*
|
||||||
|
* @param ddSale 销售主单
|
||||||
|
* @return 销售主单
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DdSale> selectDdSaleList(DdSale ddSale)
|
||||||
|
{
|
||||||
|
return ddSaleMapper.selectDdSaleList(ddSale);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增销售主单
|
||||||
|
*
|
||||||
|
* @param ddSale 销售主单
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public int insertDdSale(DdSale ddSale)
|
||||||
|
{
|
||||||
|
ddSale.setCreateTime(DateUtils.getNowDate());
|
||||||
|
int rows = ddSaleMapper.insertDdSale(ddSale);
|
||||||
|
insertDdSaleItem(ddSale);
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改销售主单
|
||||||
|
*
|
||||||
|
* @param ddSale 销售主单
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public int updateDdSale(DdSale ddSale)
|
||||||
|
{
|
||||||
|
ddSaleMapper.deleteDdSaleItemBySaleId(ddSale.getId());
|
||||||
|
insertDdSaleItem(ddSale);
|
||||||
|
return ddSaleMapper.updateDdSale(ddSale);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除销售主单
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的销售主单主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public int deleteDdSaleByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
ddSaleMapper.deleteDdSaleItemBySaleIds(ids);
|
||||||
|
return ddSaleMapper.deleteDdSaleByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除销售主单信息
|
||||||
|
*
|
||||||
|
* @param id 销售主单主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public int deleteDdSaleById(Long id)
|
||||||
|
{
|
||||||
|
ddSaleMapper.deleteDdSaleItemBySaleId(id);
|
||||||
|
return ddSaleMapper.deleteDdSaleById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增销售明细信息
|
||||||
|
*
|
||||||
|
* @param ddSale 销售主单对象
|
||||||
|
*/
|
||||||
|
public void insertDdSaleItem(DdSale ddSale)
|
||||||
|
{
|
||||||
|
List<DdSaleItem> ddSaleItemList = ddSale.getDdSaleItemList();
|
||||||
|
Long id = ddSale.getId();
|
||||||
|
if (StringUtils.isNotNull(ddSaleItemList))
|
||||||
|
{
|
||||||
|
List<DdSaleItem> list = new ArrayList<DdSaleItem>();
|
||||||
|
for (DdSaleItem ddSaleItem : ddSaleItemList)
|
||||||
|
{
|
||||||
|
ddSaleItem.setSaleId(id);
|
||||||
|
list.add(ddSaleItem);
|
||||||
|
}
|
||||||
|
if (list.size() > 0)
|
||||||
|
{
|
||||||
|
ddSaleMapper.batchDdSaleItem(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,150 @@
|
|||||||
|
<?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="com.zhyc.module.frozen.mapper.DdSaleMapper">
|
||||||
|
|
||||||
|
<resultMap type="DdSale" id="DdSaleResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="saleDate" column="sale_date" />
|
||||||
|
<result property="custName" column="cust_name" />
|
||||||
|
<result property="custPhone" column="cust_phone" />
|
||||||
|
<result property="custAddr" column="cust_addr" />
|
||||||
|
<result property="salesper" column="salesper" />
|
||||||
|
<result property="quaranNo" column="quaran_no" />
|
||||||
|
<result property="apprNo" column="appr_no" />
|
||||||
|
<result property="price" column="price" />
|
||||||
|
<result property="tech" column="tech" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="DdSaleDdSaleItemResult" type="DdSale" extends="DdSaleResult">
|
||||||
|
<collection property="ddSaleItemList" ofType="DdSaleItem" column="id" select="selectDdSaleItemList" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap type="DdSaleItem" id="DdSaleItemResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="saleId" column="sale_id" />
|
||||||
|
<result property="itemType" column="item_type" />
|
||||||
|
<result property="itemCode" column="item_code" />
|
||||||
|
<result property="qty" column="qty" />
|
||||||
|
<result property="unitPrice" column="unit_price" />
|
||||||
|
<result property="tankId" column="tank_id" />
|
||||||
|
<result property="bucketId" column="bucket_id" />
|
||||||
|
<result property="rackId" column="rack_id" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectDdSaleVo">
|
||||||
|
select id, sale_date, cust_name, cust_phone, cust_addr, salesper, quaran_no, appr_no, price, tech, remark, create_by, create_time from dd_sl
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectDdSaleList" parameterType="DdSale" resultMap="DdSaleResult">
|
||||||
|
<include refid="selectDdSaleVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="saleDate != null "> and sale_date = #{saleDate}</if>
|
||||||
|
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
|
||||||
|
<if test="custPhone != null and custPhone != ''"> and cust_phone = #{custPhone}</if>
|
||||||
|
<if test="custAddr != null and custAddr != ''"> and cust_addr = #{custAddr}</if>
|
||||||
|
<if test="salesper != null and salesper != ''"> and salesper = #{salesper}</if>
|
||||||
|
<if test="quaranNo != null and quaranNo != ''"> and quaran_no = #{quaranNo}</if>
|
||||||
|
<if test="apprNo != null and apprNo != ''"> and appr_no = #{apprNo}</if>
|
||||||
|
<if test="price != null "> and price = #{price}</if>
|
||||||
|
<if test="tech != null and tech != ''"> and tech = #{tech}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDdSaleById" parameterType="Long" resultMap="DdSaleDdSaleItemResult">
|
||||||
|
select id, sale_date, cust_name, cust_phone, cust_addr, salesper, quaran_no, appr_no, price, tech, remark, create_by, create_time
|
||||||
|
from dd_sl
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDdSaleItemList" resultMap="DdSaleItemResult">
|
||||||
|
select id, sale_id, item_type, item_code, qty, unit_price, tank_id, bucket_id, rack_id, create_time
|
||||||
|
from dd_sl_item
|
||||||
|
where sale_id = #{sale_id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertDdSale" parameterType="DdSale" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into dd_sl
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="saleDate != null">sale_date,</if>
|
||||||
|
<if test="custName != null and custName != ''">cust_name,</if>
|
||||||
|
<if test="custPhone != null">cust_phone,</if>
|
||||||
|
<if test="custAddr != null">cust_addr,</if>
|
||||||
|
<if test="salesper != null">salesper,</if>
|
||||||
|
<if test="quaranNo != null">quaran_no,</if>
|
||||||
|
<if test="apprNo != null">appr_no,</if>
|
||||||
|
<if test="price != null">price,</if>
|
||||||
|
<if test="tech != null and tech != ''">tech,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="saleDate != null">#{saleDate},</if>
|
||||||
|
<if test="custName != null and custName != ''">#{custName},</if>
|
||||||
|
<if test="custPhone != null">#{custPhone},</if>
|
||||||
|
<if test="custAddr != null">#{custAddr},</if>
|
||||||
|
<if test="salesper != null">#{salesper},</if>
|
||||||
|
<if test="quaranNo != null">#{quaranNo},</if>
|
||||||
|
<if test="apprNo != null">#{apprNo},</if>
|
||||||
|
<if test="price != null">#{price},</if>
|
||||||
|
<if test="tech != null and tech != ''">#{tech},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDdSale" parameterType="DdSale">
|
||||||
|
update dd_sl
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="saleDate != null">sale_date = #{saleDate},</if>
|
||||||
|
<if test="custName != null and custName != ''">cust_name = #{custName},</if>
|
||||||
|
<if test="custPhone != null">cust_phone = #{custPhone},</if>
|
||||||
|
<if test="custAddr != null">cust_addr = #{custAddr},</if>
|
||||||
|
<if test="salesper != null">salesper = #{salesper},</if>
|
||||||
|
<if test="quaranNo != null">quaran_no = #{quaranNo},</if>
|
||||||
|
<if test="apprNo != null">appr_no = #{apprNo},</if>
|
||||||
|
<if test="price != null">price = #{price},</if>
|
||||||
|
<if test="tech != null and tech != ''">tech = #{tech},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteDdSaleById" parameterType="Long">
|
||||||
|
delete from dd_sl where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteDdSaleByIds" parameterType="String">
|
||||||
|
delete from dd_sl where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteDdSaleItemBySaleIds" parameterType="String">
|
||||||
|
delete from dd_sl_item where sale_id in
|
||||||
|
<foreach item="saleId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{saleId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteDdSaleItemBySaleId" parameterType="Long">
|
||||||
|
delete from dd_sl_item where sale_id = #{saleId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<insert id="batchDdSaleItem">
|
||||||
|
insert into dd_sl_item( id, sale_id, item_type, item_code, qty, unit_price, tank_id, bucket_id, rack_id, create_time) values
|
||||||
|
<foreach item="item" index="index" collection="list" separator=",">
|
||||||
|
( #{item.id}, #{item.saleId}, #{item.itemType}, #{item.itemCode}, #{item.qty}, #{item.unitPrice}, #{item.tankId}, #{item.bucketId}, #{item.rackId}, #{item.createTime})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user