diff --git a/pom.xml b/pom.xml
index ac3af71..7b5d9d3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -268,6 +268,19 @@
2.5.0
+
+
+ com.google.zxing
+ core
+ 3.5.3
+
+
+
+ com.google.zxing
+ javase
+ 3.5.3
+
+
diff --git a/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeController.java b/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeController.java
index 5a12d4c..be01a8a 100644
--- a/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeController.java
+++ b/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeController.java
@@ -2,6 +2,8 @@ package com.shzg.project.unique.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
+
+import com.shzg.framework.aspectj.lang.annotation.DataScope;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -37,6 +39,7 @@ public class WornUniqueCodeController extends BaseController
/**
* 查询唯一码管理列表
*/
+ @DataScope(deptAlias = "d")
@PreAuthorize("@ss.hasPermi('unique:code:list')")
@GetMapping("/list")
public TableDataInfo list(WornUniqueCode wornUniqueCode)
@@ -44,6 +47,7 @@ public class WornUniqueCodeController extends BaseController
startPage();
List list = wornUniqueCodeService.selectWornUniqueCodeList(wornUniqueCode);
return getDataTable(list);
+
}
/**
diff --git a/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeEventController.java b/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeEventController.java
new file mode 100644
index 0000000..812c7c2
--- /dev/null
+++ b/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeEventController.java
@@ -0,0 +1,104 @@
+package com.shzg.project.unique.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.shzg.framework.aspectj.lang.annotation.Log;
+import com.shzg.framework.aspectj.lang.enums.BusinessType;
+import com.shzg.project.unique.domain.WornUniqueCodeEvent;
+import com.shzg.project.unique.service.IWornUniqueCodeEventService;
+import com.shzg.framework.web.controller.BaseController;
+import com.shzg.framework.web.domain.AjaxResult;
+import com.shzg.common.utils.poi.ExcelUtil;
+import com.shzg.framework.web.page.TableDataInfo;
+
+/**
+ * 唯一码事件记录Controller
+ *
+ * @author shzg
+ * @date 2026-03-17
+ */
+@RestController
+@RequestMapping("/unique/event")
+public class WornUniqueCodeEventController extends BaseController
+{
+ @Autowired
+ private IWornUniqueCodeEventService wornUniqueCodeEventService;
+
+ /**
+ * 查询唯一码事件记录列表
+ */
+ @PreAuthorize("@ss.hasPermi('unique:event:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(WornUniqueCodeEvent wornUniqueCodeEvent)
+ {
+ startPage();
+ List list = wornUniqueCodeEventService.selectWornUniqueCodeEventList(wornUniqueCodeEvent);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出唯一码事件记录列表
+ */
+ @PreAuthorize("@ss.hasPermi('unique:event:export')")
+ @Log(title = "唯一码事件记录", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, WornUniqueCodeEvent wornUniqueCodeEvent)
+ {
+ List list = wornUniqueCodeEventService.selectWornUniqueCodeEventList(wornUniqueCodeEvent);
+ ExcelUtil util = new ExcelUtil(WornUniqueCodeEvent.class);
+ util.exportExcel(response, list, "唯一码事件记录数据");
+ }
+
+ /**
+ * 获取唯一码事件记录详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('unique:event:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id)
+ {
+ return success(wornUniqueCodeEventService.selectWornUniqueCodeEventById(id));
+ }
+
+ /**
+ * 新增唯一码事件记录
+ */
+ @PreAuthorize("@ss.hasPermi('unique:event:add')")
+ @Log(title = "唯一码事件记录", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody WornUniqueCodeEvent wornUniqueCodeEvent)
+ {
+ return toAjax(wornUniqueCodeEventService.insertWornUniqueCodeEvent(wornUniqueCodeEvent));
+ }
+
+ /**
+ * 修改唯一码事件记录
+ */
+ @PreAuthorize("@ss.hasPermi('unique:event:edit')")
+ @Log(title = "唯一码事件记录", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody WornUniqueCodeEvent wornUniqueCodeEvent)
+ {
+ return toAjax(wornUniqueCodeEventService.updateWornUniqueCodeEvent(wornUniqueCodeEvent));
+ }
+
+ /**
+ * 删除唯一码事件记录
+ */
+ @PreAuthorize("@ss.hasPermi('unique:event:remove')")
+ @Log(title = "唯一码事件记录", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(wornUniqueCodeEventService.deleteWornUniqueCodeEventByIds(ids));
+ }
+}
diff --git a/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeMaterialController.java b/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeMaterialController.java
new file mode 100644
index 0000000..4dda9b4
--- /dev/null
+++ b/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeMaterialController.java
@@ -0,0 +1,104 @@
+package com.shzg.project.unique.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.shzg.framework.aspectj.lang.annotation.Log;
+import com.shzg.framework.aspectj.lang.enums.BusinessType;
+import com.shzg.project.unique.domain.WornUniqueCodeMaterial;
+import com.shzg.project.unique.service.IWornUniqueCodeMaterialService;
+import com.shzg.framework.web.controller.BaseController;
+import com.shzg.framework.web.domain.AjaxResult;
+import com.shzg.common.utils.poi.ExcelUtil;
+import com.shzg.framework.web.page.TableDataInfo;
+
+/**
+ * 唯一码物料信息Controller
+ *
+ * @author shzg
+ * @date 2026-03-17
+ */
+@RestController
+@RequestMapping("/unique/information")
+public class WornUniqueCodeMaterialController extends BaseController
+{
+ @Autowired
+ private IWornUniqueCodeMaterialService wornUniqueCodeMaterialService;
+
+ /**
+ * 查询唯一码物料信息列表
+ */
+ @PreAuthorize("@ss.hasPermi('unique:information:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(WornUniqueCodeMaterial wornUniqueCodeMaterial)
+ {
+ startPage();
+ List list = wornUniqueCodeMaterialService.selectWornUniqueCodeMaterialList(wornUniqueCodeMaterial);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出唯一码物料信息列表
+ */
+ @PreAuthorize("@ss.hasPermi('unique:information:export')")
+ @Log(title = "唯一码物料信息", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, WornUniqueCodeMaterial wornUniqueCodeMaterial)
+ {
+ List list = wornUniqueCodeMaterialService.selectWornUniqueCodeMaterialList(wornUniqueCodeMaterial);
+ ExcelUtil util = new ExcelUtil(WornUniqueCodeMaterial.class);
+ util.exportExcel(response, list, "唯一码物料信息数据");
+ }
+
+ /**
+ * 获取唯一码物料信息详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('unique:information:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id)
+ {
+ return success(wornUniqueCodeMaterialService.selectWornUniqueCodeMaterialById(id));
+ }
+
+ /**
+ * 新增唯一码物料信息
+ */
+ @PreAuthorize("@ss.hasPermi('unique:information:add')")
+ @Log(title = "唯一码物料信息", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody WornUniqueCodeMaterial wornUniqueCodeMaterial)
+ {
+ return toAjax(wornUniqueCodeMaterialService.insertWornUniqueCodeMaterial(wornUniqueCodeMaterial));
+ }
+
+ /**
+ * 修改唯一码物料信息
+ */
+ @PreAuthorize("@ss.hasPermi('unique:information:edit')")
+ @Log(title = "唯一码物料信息", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody WornUniqueCodeMaterial wornUniqueCodeMaterial)
+ {
+ return toAjax(wornUniqueCodeMaterialService.updateWornUniqueCodeMaterial(wornUniqueCodeMaterial));
+ }
+
+ /**
+ * 删除唯一码物料信息
+ */
+ @PreAuthorize("@ss.hasPermi('unique:information:remove')")
+ @Log(title = "唯一码物料信息", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(wornUniqueCodeMaterialService.deleteWornUniqueCodeMaterialByIds(ids));
+ }
+}
diff --git a/src/main/java/com/shzg/project/unique/domain/WornUniqueCode.java b/src/main/java/com/shzg/project/unique/domain/WornUniqueCode.java
index d0240d5..8afe875 100644
--- a/src/main/java/com/shzg/project/unique/domain/WornUniqueCode.java
+++ b/src/main/java/com/shzg/project/unique/domain/WornUniqueCode.java
@@ -5,9 +5,11 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.shzg.framework.aspectj.lang.annotation.Excel;
+import java.util.List;
+
/**
* 唯一码管理对象 worn_unique_code
- *
+ *
* @author shzg
* @date 2026-03-17
*/
@@ -27,7 +29,7 @@ public class WornUniqueCode extends BaseEntity
private String billNo;
/** 项目ID(用于数据隔离,对应sys_dept.id) */
- @Excel(name = "项目ID", readConverterExp = "用=于数据隔离,对应sys_dept.id")
+ @Excel(name = "项目ID", readConverterExp = "用于数据隔离,对应sys_dept.id")
private Long projectId;
/** 当前状态(0已生成 1已打印 2已入库 3已出库 4已配送) */
@@ -46,102 +48,149 @@ public class WornUniqueCode extends BaseEntity
@Excel(name = "是否删除", readConverterExp = "0=正常,1=删除")
private String isDelete;
- public void setId(Long id)
- {
- this.id = id;
- }
+ /** ==================== 扩展字段(不落库) ==================== */
- public Long getId()
+ /** 物料信息(1条) */
+ private WornUniqueCodeMaterial material;
+
+ /** 事件列表(多条) */
+ private List eventList;
+
+ /** 二维码(base64) */
+ private String qrCode;
+
+ /** ==================== getter / setter ==================== */
+
+ public Long getId()
{
return id;
}
- public void setCode(String code)
+ public void setId(Long id)
{
- this.code = code;
+ this.id = id;
}
- public String getCode()
+ public String getCode()
{
return code;
}
- public void setBillNo(String billNo)
+ public void setCode(String code)
{
- this.billNo = billNo;
+ this.code = code;
}
- public String getBillNo()
+ public String getBillNo()
{
return billNo;
}
- public void setProjectId(Long projectId)
+ public void setBillNo(String billNo)
{
- this.projectId = projectId;
+ this.billNo = billNo;
}
- public Long getProjectId()
+ public Long getProjectId()
{
return projectId;
}
- public void setStatus(String status)
+ public void setProjectId(Long projectId)
{
- this.status = status;
+ this.projectId = projectId;
}
- public String getStatus()
+ public String getStatus()
{
return status;
}
- public void setRfidCode(String rfidCode)
+ public void setStatus(String status)
{
- this.rfidCode = rfidCode;
+ this.status = status;
}
- public String getRfidCode()
+ public String getRfidCode()
{
return rfidCode;
}
- public void setPrintCount(Long printCount)
+ public void setRfidCode(String rfidCode)
{
- this.printCount = printCount;
+ this.rfidCode = rfidCode;
}
- public Long getPrintCount()
+ public Long getPrintCount()
{
return printCount;
}
- public void setIsDelete(String isDelete)
+ public void setPrintCount(Long printCount)
{
- this.isDelete = isDelete;
+ this.printCount = printCount;
}
- public String getIsDelete()
+ public String getIsDelete()
{
return isDelete;
}
- @Override
- public String toString() {
- return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
- .append("id", getId())
- .append("code", getCode())
- .append("billNo", getBillNo())
- .append("projectId", getProjectId())
- .append("status", getStatus())
- .append("rfidCode", getRfidCode())
- .append("printCount", getPrintCount())
- .append("createBy", getCreateBy())
- .append("createTime", getCreateTime())
- .append("updateBy", getUpdateBy())
- .append("updateTime", getUpdateTime())
- .append("remark", getRemark())
- .append("isDelete", getIsDelete())
- .toString();
+ public void setIsDelete(String isDelete)
+ {
+ this.isDelete = isDelete;
}
-}
+
+ public WornUniqueCodeMaterial getMaterial()
+ {
+ return material;
+ }
+
+ public void setMaterial(WornUniqueCodeMaterial material)
+ {
+ this.material = material;
+ }
+
+ public List getEventList()
+ {
+ return eventList;
+ }
+
+ public void setEventList(List eventList)
+ {
+ this.eventList = eventList;
+ }
+
+ public String getQrCode()
+ {
+ return qrCode;
+ }
+
+ public void setQrCode(String qrCode)
+ {
+ this.qrCode = qrCode;
+ }
+
+ @Override
+ public String toString()
+ {
+ return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("code", getCode())
+ .append("billNo", getBillNo())
+ .append("projectId", getProjectId())
+ .append("status", getStatus())
+ .append("rfidCode", getRfidCode())
+ .append("printCount", getPrintCount())
+ .append("createBy", getCreateBy())
+ .append("createTime", getCreateTime())
+ .append("updateBy", getUpdateBy())
+ .append("updateTime", getUpdateTime())
+ .append("remark", getRemark())
+ .append("isDelete", getIsDelete())
+ .append("material", getMaterial())
+ .append("eventList", getEventList())
+ .append("qrCode", getQrCode())
+ .toString();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/shzg/project/unique/domain/WornUniqueCodeEvent.java b/src/main/java/com/shzg/project/unique/domain/WornUniqueCodeEvent.java
new file mode 100644
index 0000000..d5e0a52
--- /dev/null
+++ b/src/main/java/com/shzg/project/unique/domain/WornUniqueCodeEvent.java
@@ -0,0 +1,147 @@
+package com.shzg.project.unique.domain;
+
+import com.shzg.framework.web.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.shzg.framework.aspectj.lang.annotation.Excel;
+
+/**
+ * 唯一码事件记录对象 worn_unique_code_event
+ *
+ * @author shzg
+ * @date 2026-03-17
+ */
+public class WornUniqueCodeEvent extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键ID */
+ private Long id;
+
+ /** 唯一码ID */
+ @Excel(name = "唯一码ID")
+ private Long uniqueCodeId;
+
+ /** 事件类型(0生成 1打印 2入库 3出库 4配送) */
+ @Excel(name = "事件类型", readConverterExp = "0=生成,1=打印,2=入库,3=出库,4=配送")
+ private String eventType;
+
+ /** 事件状态 */
+ @Excel(name = "事件状态")
+ private String eventStatus;
+
+ /** 事件描述 */
+ @Excel(name = "事件描述")
+ private String eventDesc;
+
+ /** 操作人ID */
+ @Excel(name = "操作人ID")
+ private Long operatorId;
+
+ /** 操作人名称 */
+ @Excel(name = "操作人名称")
+ private String operatorName;
+
+ /** 是否删除(0正常 1删除) */
+ @Excel(name = "是否删除", readConverterExp = "0=正常,1=删除")
+ private String isDelete;
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setUniqueCodeId(Long uniqueCodeId)
+ {
+ this.uniqueCodeId = uniqueCodeId;
+ }
+
+ public Long getUniqueCodeId()
+ {
+ return uniqueCodeId;
+ }
+
+ public void setEventType(String eventType)
+ {
+ this.eventType = eventType;
+ }
+
+ public String getEventType()
+ {
+ return eventType;
+ }
+
+ public void setEventStatus(String eventStatus)
+ {
+ this.eventStatus = eventStatus;
+ }
+
+ public String getEventStatus()
+ {
+ return eventStatus;
+ }
+
+ public void setEventDesc(String eventDesc)
+ {
+ this.eventDesc = eventDesc;
+ }
+
+ public String getEventDesc()
+ {
+ return eventDesc;
+ }
+
+ public void setOperatorId(Long operatorId)
+ {
+ this.operatorId = operatorId;
+ }
+
+ public Long getOperatorId()
+ {
+ return operatorId;
+ }
+
+ public void setOperatorName(String operatorName)
+ {
+ this.operatorName = operatorName;
+ }
+
+ public String getOperatorName()
+ {
+ return operatorName;
+ }
+
+ public void setIsDelete(String isDelete)
+ {
+ this.isDelete = isDelete;
+ }
+
+ public String getIsDelete()
+ {
+ return isDelete;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("uniqueCodeId", getUniqueCodeId())
+ .append("eventType", getEventType())
+ .append("eventStatus", getEventStatus())
+ .append("eventDesc", getEventDesc())
+ .append("operatorId", getOperatorId())
+ .append("operatorName", getOperatorName())
+ .append("createBy", getCreateBy())
+ .append("createTime", getCreateTime())
+ .append("updateBy", getUpdateBy())
+ .append("updateTime", getUpdateTime())
+ .append("remark", getRemark())
+ .append("isDelete", getIsDelete())
+ .toString();
+ }
+}
diff --git a/src/main/java/com/shzg/project/unique/domain/WornUniqueCodeMaterial.java b/src/main/java/com/shzg/project/unique/domain/WornUniqueCodeMaterial.java
new file mode 100644
index 0000000..9065b6c
--- /dev/null
+++ b/src/main/java/com/shzg/project/unique/domain/WornUniqueCodeMaterial.java
@@ -0,0 +1,119 @@
+package com.shzg.project.unique.domain;
+
+import java.math.BigDecimal;
+
+import com.shzg.framework.web.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.shzg.framework.aspectj.lang.annotation.Excel;
+
+/**
+ * 唯一码物料信息对象 worn_unique_code_material
+ *
+ * @author shzg
+ * @date 2026-03-17
+ */
+public class WornUniqueCodeMaterial extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键ID */
+ private Long id;
+
+ /** 唯一码ID */
+ @Excel(name = "唯一码ID")
+ private Long uniqueCodeId;
+
+ /** 物料ID(对应worn_material.id) */
+ @Excel(name = "物料ID", readConverterExp = "对=应worn_material.id")
+ private Long materialId;
+
+ /** 单位ID(对应worn_material_unit.id) */
+ @Excel(name = "单位ID", readConverterExp = "对=应worn_material_unit.id")
+ private Long unitId;
+
+ /** 数量 */
+ @Excel(name = "数量")
+ private BigDecimal quantity;
+
+ /** 是否删除(0正常 1删除) */
+ @Excel(name = "是否删除", readConverterExp = "0=正常,1=删除")
+ private String isDelete;
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setUniqueCodeId(Long uniqueCodeId)
+ {
+ this.uniqueCodeId = uniqueCodeId;
+ }
+
+ public Long getUniqueCodeId()
+ {
+ return uniqueCodeId;
+ }
+
+ public void setMaterialId(Long materialId)
+ {
+ this.materialId = materialId;
+ }
+
+ public Long getMaterialId()
+ {
+ return materialId;
+ }
+
+ public void setUnitId(Long unitId)
+ {
+ this.unitId = unitId;
+ }
+
+ public Long getUnitId()
+ {
+ return unitId;
+ }
+
+ public void setQuantity(BigDecimal quantity)
+ {
+ this.quantity = quantity;
+ }
+
+ public BigDecimal getQuantity()
+ {
+ return quantity;
+ }
+
+ public void setIsDelete(String isDelete)
+ {
+ this.isDelete = isDelete;
+ }
+
+ public String getIsDelete()
+ {
+ return isDelete;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("uniqueCodeId", getUniqueCodeId())
+ .append("materialId", getMaterialId())
+ .append("unitId", getUnitId())
+ .append("quantity", getQuantity())
+ .append("createBy", getCreateBy())
+ .append("createTime", getCreateTime())
+ .append("updateBy", getUpdateBy())
+ .append("updateTime", getUpdateTime())
+ .append("remark", getRemark())
+ .append("isDelete", getIsDelete())
+ .toString();
+ }
+}
diff --git a/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeEventMapper.java b/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeEventMapper.java
new file mode 100644
index 0000000..c6ce2c6
--- /dev/null
+++ b/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeEventMapper.java
@@ -0,0 +1,68 @@
+package com.shzg.project.unique.mapper;
+
+import java.util.List;
+import com.shzg.project.unique.domain.WornUniqueCodeEvent;
+
+/**
+ * 唯一码事件记录Mapper接口
+ *
+ * @author shzg
+ * @date 2026-03-17
+ */
+public interface WornUniqueCodeEventMapper
+{
+ /**
+ * 查询唯一码事件记录
+ *
+ * @param id 唯一码事件记录主键
+ * @return 唯一码事件记录
+ */
+ public WornUniqueCodeEvent selectWornUniqueCodeEventById(Long id);
+
+ /**
+ * 查询唯一码事件记录列表
+ *
+ * @param wornUniqueCodeEvent 唯一码事件记录
+ * @return 唯一码事件记录集合
+ */
+ public List selectWornUniqueCodeEventList(WornUniqueCodeEvent wornUniqueCodeEvent);
+
+ /**
+ * 新增唯一码事件记录
+ *
+ * @param wornUniqueCodeEvent 唯一码事件记录
+ * @return 结果
+ */
+ public int insertWornUniqueCodeEvent(WornUniqueCodeEvent wornUniqueCodeEvent);
+
+ /**
+ * 修改唯一码事件记录
+ *
+ * @param wornUniqueCodeEvent 唯一码事件记录
+ * @return 结果
+ */
+ public int updateWornUniqueCodeEvent(WornUniqueCodeEvent wornUniqueCodeEvent);
+
+ /**
+ * 删除唯一码事件记录
+ *
+ * @param id 唯一码事件记录主键
+ * @return 结果
+ */
+ public int deleteWornUniqueCodeEventById(Long id);
+
+ /**
+ * 批量删除唯一码事件记录
+ *
+ * @param ids 需要删除的数据主键集合
+ * @return 结果
+ */
+ public int deleteWornUniqueCodeEventByIds(Long[] ids);
+
+ /**
+ * 根据唯一码id查询唯一码事件记录
+ * @param id
+ * @return
+ */
+ List selectByUniqueCodeId(Long id);
+}
diff --git a/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeMapper.java b/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeMapper.java
index 3e845bf..d05a021 100644
--- a/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeMapper.java
+++ b/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeMapper.java
@@ -43,13 +43,6 @@ public interface WornUniqueCodeMapper
*/
public int updateWornUniqueCode(WornUniqueCode wornUniqueCode);
- /**
- * 删除唯一码管理
- *
- * @param id 唯一码管理主键
- * @return 结果
- */
- public int deleteWornUniqueCodeById(Long id);
/**
* 批量删除唯一码管理
diff --git a/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeMaterialMapper.java b/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeMaterialMapper.java
new file mode 100644
index 0000000..96b13eb
--- /dev/null
+++ b/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeMaterialMapper.java
@@ -0,0 +1,68 @@
+package com.shzg.project.unique.mapper;
+
+import java.util.List;
+import com.shzg.project.unique.domain.WornUniqueCodeMaterial;
+
+/**
+ * 唯一码物料信息Mapper接口
+ *
+ * @author shzg
+ * @date 2026-03-17
+ */
+public interface WornUniqueCodeMaterialMapper
+{
+ /**
+ * 查询唯一码物料信息
+ *
+ * @param id 唯一码物料信息主键
+ * @return 唯一码物料信息
+ */
+ public WornUniqueCodeMaterial selectWornUniqueCodeMaterialById(Long id);
+
+ /**
+ * 查询唯一码物料信息列表
+ *
+ * @param wornUniqueCodeMaterial 唯一码物料信息
+ * @return 唯一码物料信息集合
+ */
+ public List selectWornUniqueCodeMaterialList(WornUniqueCodeMaterial wornUniqueCodeMaterial);
+
+ /**
+ * 新增唯一码物料信息
+ *
+ * @param wornUniqueCodeMaterial 唯一码物料信息
+ * @return 结果
+ */
+ public int insertWornUniqueCodeMaterial(WornUniqueCodeMaterial wornUniqueCodeMaterial);
+
+ /**
+ * 修改唯一码物料信息
+ *
+ * @param wornUniqueCodeMaterial 唯一码物料信息
+ * @return 结果
+ */
+ public int updateWornUniqueCodeMaterial(WornUniqueCodeMaterial wornUniqueCodeMaterial);
+
+ /**
+ * 删除唯一码物料信息
+ *
+ * @param id 唯一码物料信息主键
+ * @return 结果
+ */
+ public int deleteWornUniqueCodeMaterialById(Long id);
+
+ /**
+ * 批量删除唯一码物料信息
+ *
+ * @param ids 需要删除的数据主键集合
+ * @return 结果
+ */
+ public int deleteWornUniqueCodeMaterialByIds(Long[] ids);
+
+ /**
+ * 根据唯一码id查询唯一码物料信息
+ * @param id
+ * @return
+ */
+ WornUniqueCodeMaterial selectByUniqueCodeId(Long id);
+}
diff --git a/src/main/java/com/shzg/project/unique/service/IWornUniqueCodeEventService.java b/src/main/java/com/shzg/project/unique/service/IWornUniqueCodeEventService.java
new file mode 100644
index 0000000..16ff834
--- /dev/null
+++ b/src/main/java/com/shzg/project/unique/service/IWornUniqueCodeEventService.java
@@ -0,0 +1,61 @@
+package com.shzg.project.unique.service;
+
+import java.util.List;
+import com.shzg.project.unique.domain.WornUniqueCodeEvent;
+
+/**
+ * 唯一码事件记录Service接口
+ *
+ * @author shzg
+ * @date 2026-03-17
+ */
+public interface IWornUniqueCodeEventService
+{
+ /**
+ * 查询唯一码事件记录
+ *
+ * @param id 唯一码事件记录主键
+ * @return 唯一码事件记录
+ */
+ public WornUniqueCodeEvent selectWornUniqueCodeEventById(Long id);
+
+ /**
+ * 查询唯一码事件记录列表
+ *
+ * @param wornUniqueCodeEvent 唯一码事件记录
+ * @return 唯一码事件记录集合
+ */
+ public List selectWornUniqueCodeEventList(WornUniqueCodeEvent wornUniqueCodeEvent);
+
+ /**
+ * 新增唯一码事件记录
+ *
+ * @param wornUniqueCodeEvent 唯一码事件记录
+ * @return 结果
+ */
+ public int insertWornUniqueCodeEvent(WornUniqueCodeEvent wornUniqueCodeEvent);
+
+ /**
+ * 修改唯一码事件记录
+ *
+ * @param wornUniqueCodeEvent 唯一码事件记录
+ * @return 结果
+ */
+ public int updateWornUniqueCodeEvent(WornUniqueCodeEvent wornUniqueCodeEvent);
+
+ /**
+ * 批量删除唯一码事件记录
+ *
+ * @param ids 需要删除的唯一码事件记录主键集合
+ * @return 结果
+ */
+ public int deleteWornUniqueCodeEventByIds(Long[] ids);
+
+ /**
+ * 删除唯一码事件记录信息
+ *
+ * @param id 唯一码事件记录主键
+ * @return 结果
+ */
+ public int deleteWornUniqueCodeEventById(Long id);
+}
diff --git a/src/main/java/com/shzg/project/unique/service/IWornUniqueCodeMaterialService.java b/src/main/java/com/shzg/project/unique/service/IWornUniqueCodeMaterialService.java
new file mode 100644
index 0000000..50c9194
--- /dev/null
+++ b/src/main/java/com/shzg/project/unique/service/IWornUniqueCodeMaterialService.java
@@ -0,0 +1,61 @@
+package com.shzg.project.unique.service;
+
+import java.util.List;
+import com.shzg.project.unique.domain.WornUniqueCodeMaterial;
+
+/**
+ * 唯一码物料信息Service接口
+ *
+ * @author shzg
+ * @date 2026-03-17
+ */
+public interface IWornUniqueCodeMaterialService
+{
+ /**
+ * 查询唯一码物料信息
+ *
+ * @param id 唯一码物料信息主键
+ * @return 唯一码物料信息
+ */
+ public WornUniqueCodeMaterial selectWornUniqueCodeMaterialById(Long id);
+
+ /**
+ * 查询唯一码物料信息列表
+ *
+ * @param wornUniqueCodeMaterial 唯一码物料信息
+ * @return 唯一码物料信息集合
+ */
+ public List selectWornUniqueCodeMaterialList(WornUniqueCodeMaterial wornUniqueCodeMaterial);
+
+ /**
+ * 新增唯一码物料信息
+ *
+ * @param wornUniqueCodeMaterial 唯一码物料信息
+ * @return 结果
+ */
+ public int insertWornUniqueCodeMaterial(WornUniqueCodeMaterial wornUniqueCodeMaterial);
+
+ /**
+ * 修改唯一码物料信息
+ *
+ * @param wornUniqueCodeMaterial 唯一码物料信息
+ * @return 结果
+ */
+ public int updateWornUniqueCodeMaterial(WornUniqueCodeMaterial wornUniqueCodeMaterial);
+
+ /**
+ * 批量删除唯一码物料信息
+ *
+ * @param ids 需要删除的唯一码物料信息主键集合
+ * @return 结果
+ */
+ public int deleteWornUniqueCodeMaterialByIds(Long[] ids);
+
+ /**
+ * 删除唯一码物料信息信息
+ *
+ * @param id 唯一码物料信息主键
+ * @return 结果
+ */
+ public int deleteWornUniqueCodeMaterialById(Long id);
+}
diff --git a/src/main/java/com/shzg/project/unique/service/IWornUniqueCodeService.java b/src/main/java/com/shzg/project/unique/service/IWornUniqueCodeService.java
index 4eec344..e9c7904 100644
--- a/src/main/java/com/shzg/project/unique/service/IWornUniqueCodeService.java
+++ b/src/main/java/com/shzg/project/unique/service/IWornUniqueCodeService.java
@@ -51,11 +51,4 @@ public interface IWornUniqueCodeService
*/
public int deleteWornUniqueCodeByIds(Long[] ids);
- /**
- * 删除唯一码管理信息
- *
- * @param id 唯一码管理主键
- * @return 结果
- */
- public int deleteWornUniqueCodeById(Long id);
}
diff --git a/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeEventServiceImpl.java b/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeEventServiceImpl.java
new file mode 100644
index 0000000..c3024d8
--- /dev/null
+++ b/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeEventServiceImpl.java
@@ -0,0 +1,96 @@
+package com.shzg.project.unique.service.impl;
+
+import java.util.List;
+import com.shzg.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.shzg.project.unique.mapper.WornUniqueCodeEventMapper;
+import com.shzg.project.unique.domain.WornUniqueCodeEvent;
+import com.shzg.project.unique.service.IWornUniqueCodeEventService;
+
+/**
+ * 唯一码事件记录Service业务层处理
+ *
+ * @author shzg
+ * @date 2026-03-17
+ */
+@Service
+public class WornUniqueCodeEventServiceImpl implements IWornUniqueCodeEventService
+{
+ @Autowired
+ private WornUniqueCodeEventMapper wornUniqueCodeEventMapper;
+
+ /**
+ * 查询唯一码事件记录
+ *
+ * @param id 唯一码事件记录主键
+ * @return 唯一码事件记录
+ */
+ @Override
+ public WornUniqueCodeEvent selectWornUniqueCodeEventById(Long id)
+ {
+ return wornUniqueCodeEventMapper.selectWornUniqueCodeEventById(id);
+ }
+
+ /**
+ * 查询唯一码事件记录列表
+ *
+ * @param wornUniqueCodeEvent 唯一码事件记录
+ * @return 唯一码事件记录
+ */
+ @Override
+ public List selectWornUniqueCodeEventList(WornUniqueCodeEvent wornUniqueCodeEvent)
+ {
+ return wornUniqueCodeEventMapper.selectWornUniqueCodeEventList(wornUniqueCodeEvent);
+ }
+
+ /**
+ * 新增唯一码事件记录
+ *
+ * @param wornUniqueCodeEvent 唯一码事件记录
+ * @return 结果
+ */
+ @Override
+ public int insertWornUniqueCodeEvent(WornUniqueCodeEvent wornUniqueCodeEvent)
+ {
+ wornUniqueCodeEvent.setCreateTime(DateUtils.getNowDate());
+ return wornUniqueCodeEventMapper.insertWornUniqueCodeEvent(wornUniqueCodeEvent);
+ }
+
+ /**
+ * 修改唯一码事件记录
+ *
+ * @param wornUniqueCodeEvent 唯一码事件记录
+ * @return 结果
+ */
+ @Override
+ public int updateWornUniqueCodeEvent(WornUniqueCodeEvent wornUniqueCodeEvent)
+ {
+ wornUniqueCodeEvent.setUpdateTime(DateUtils.getNowDate());
+ return wornUniqueCodeEventMapper.updateWornUniqueCodeEvent(wornUniqueCodeEvent);
+ }
+
+ /**
+ * 批量删除唯一码事件记录
+ *
+ * @param ids 需要删除的唯一码事件记录主键
+ * @return 结果
+ */
+ @Override
+ public int deleteWornUniqueCodeEventByIds(Long[] ids)
+ {
+ return wornUniqueCodeEventMapper.deleteWornUniqueCodeEventByIds(ids);
+ }
+
+ /**
+ * 删除唯一码事件记录信息
+ *
+ * @param id 唯一码事件记录主键
+ * @return 结果
+ */
+ @Override
+ public int deleteWornUniqueCodeEventById(Long id)
+ {
+ return wornUniqueCodeEventMapper.deleteWornUniqueCodeEventById(id);
+ }
+}
diff --git a/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeMaterialServiceImpl.java b/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeMaterialServiceImpl.java
new file mode 100644
index 0000000..7e2c965
--- /dev/null
+++ b/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeMaterialServiceImpl.java
@@ -0,0 +1,96 @@
+package com.shzg.project.unique.service.impl;
+
+import java.util.List;
+import com.shzg.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.shzg.project.unique.mapper.WornUniqueCodeMaterialMapper;
+import com.shzg.project.unique.domain.WornUniqueCodeMaterial;
+import com.shzg.project.unique.service.IWornUniqueCodeMaterialService;
+
+/**
+ * 唯一码物料信息Service业务层处理
+ *
+ * @author shzg
+ * @date 2026-03-17
+ */
+@Service
+public class WornUniqueCodeMaterialServiceImpl implements IWornUniqueCodeMaterialService
+{
+ @Autowired
+ private WornUniqueCodeMaterialMapper wornUniqueCodeMaterialMapper;
+
+ /**
+ * 查询唯一码物料信息
+ *
+ * @param id 唯一码物料信息主键
+ * @return 唯一码物料信息
+ */
+ @Override
+ public WornUniqueCodeMaterial selectWornUniqueCodeMaterialById(Long id)
+ {
+ return wornUniqueCodeMaterialMapper.selectWornUniqueCodeMaterialById(id);
+ }
+
+ /**
+ * 查询唯一码物料信息列表
+ *
+ * @param wornUniqueCodeMaterial 唯一码物料信息
+ * @return 唯一码物料信息
+ */
+ @Override
+ public List selectWornUniqueCodeMaterialList(WornUniqueCodeMaterial wornUniqueCodeMaterial)
+ {
+ return wornUniqueCodeMaterialMapper.selectWornUniqueCodeMaterialList(wornUniqueCodeMaterial);
+ }
+
+ /**
+ * 新增唯一码物料信息
+ *
+ * @param wornUniqueCodeMaterial 唯一码物料信息
+ * @return 结果
+ */
+ @Override
+ public int insertWornUniqueCodeMaterial(WornUniqueCodeMaterial wornUniqueCodeMaterial)
+ {
+ wornUniqueCodeMaterial.setCreateTime(DateUtils.getNowDate());
+ return wornUniqueCodeMaterialMapper.insertWornUniqueCodeMaterial(wornUniqueCodeMaterial);
+ }
+
+ /**
+ * 修改唯一码物料信息
+ *
+ * @param wornUniqueCodeMaterial 唯一码物料信息
+ * @return 结果
+ */
+ @Override
+ public int updateWornUniqueCodeMaterial(WornUniqueCodeMaterial wornUniqueCodeMaterial)
+ {
+ wornUniqueCodeMaterial.setUpdateTime(DateUtils.getNowDate());
+ return wornUniqueCodeMaterialMapper.updateWornUniqueCodeMaterial(wornUniqueCodeMaterial);
+ }
+
+ /**
+ * 批量删除唯一码物料信息
+ *
+ * @param ids 需要删除的唯一码物料信息主键
+ * @return 结果
+ */
+ @Override
+ public int deleteWornUniqueCodeMaterialByIds(Long[] ids)
+ {
+ return wornUniqueCodeMaterialMapper.deleteWornUniqueCodeMaterialByIds(ids);
+ }
+
+ /**
+ * 删除唯一码物料信息信息
+ *
+ * @param id 唯一码物料信息主键
+ * @return 结果
+ */
+ @Override
+ public int deleteWornUniqueCodeMaterialById(Long id)
+ {
+ return wornUniqueCodeMaterialMapper.deleteWornUniqueCodeMaterialById(id);
+ }
+}
diff --git a/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeServiceImpl.java b/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeServiceImpl.java
index 2965794..460e934 100644
--- a/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeServiceImpl.java
+++ b/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeServiceImpl.java
@@ -1,12 +1,22 @@
package com.shzg.project.unique.service.impl;
import java.util.List;
+
+import com.shzg.common.exception.ServiceException;
import com.shzg.common.utils.DateUtils;
+import com.shzg.common.utils.SecurityUtils;
+import com.shzg.framework.aspectj.lang.annotation.DataScope;
+import com.shzg.project.unique.domain.WornUniqueCodeEvent;
+import com.shzg.project.unique.domain.WornUniqueCodeMaterial;
+import com.shzg.project.unique.mapper.WornUniqueCodeEventMapper;
+import com.shzg.project.unique.mapper.WornUniqueCodeMaterialMapper;
+import com.shzg.project.unique.unit.QrCodeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.shzg.project.unique.mapper.WornUniqueCodeMapper;
import com.shzg.project.unique.domain.WornUniqueCode;
import com.shzg.project.unique.service.IWornUniqueCodeService;
+import org.springframework.transaction.annotation.Transactional;
/**
* 唯一码管理Service业务层处理
@@ -20,6 +30,12 @@ public class WornUniqueCodeServiceImpl implements IWornUniqueCodeService
@Autowired
private WornUniqueCodeMapper wornUniqueCodeMapper;
+ @Autowired
+ private WornUniqueCodeMaterialMapper materialMapper;
+
+ @Autowired
+ private WornUniqueCodeEventMapper eventMapper;
+
/**
* 查询唯一码管理
*
@@ -29,7 +45,39 @@ public class WornUniqueCodeServiceImpl implements IWornUniqueCodeService
@Override
public WornUniqueCode selectWornUniqueCodeById(Long id)
{
- return wornUniqueCodeMapper.selectWornUniqueCodeById(id);
+ /* 1️⃣ 主表 */
+ WornUniqueCode code = wornUniqueCodeMapper.selectWornUniqueCodeById(id);
+
+ if (code == null)
+ {
+ throw new ServiceException("唯一码不存在");
+ }
+
+ /* 2️⃣ 数据隔离校验(必须加) */
+ Long deptId = SecurityUtils.getDeptId();
+ if (!SecurityUtils.isAdmin() && !deptId.equals(code.getProjectId()))
+ {
+ throw new ServiceException("无权限查看该数据");
+ }
+
+ /* 3️⃣ 查询物料(1条) */
+ WornUniqueCodeMaterial material =
+ materialMapper.selectByUniqueCodeId(id);
+
+ code.setMaterial(material);
+
+ /* 4️⃣ 查询事件(多条) */
+ List eventList =
+ eventMapper.selectByUniqueCodeId(id);
+
+ code.setEventList(eventList);
+
+ /* 5️⃣ 生成二维码 */
+ String qrBase64 = QrCodeUtils.generateBase64(code.getCode());
+
+ code.setQrCode(qrBase64);
+
+ return code;
}
/**
@@ -38,6 +86,7 @@ public class WornUniqueCodeServiceImpl implements IWornUniqueCodeService
* @param wornUniqueCode 唯一码管理
* @return 唯一码管理
*/
+ @DataScope(deptAlias = "d")
@Override
public List selectWornUniqueCodeList(WornUniqueCode wornUniqueCode)
{
@@ -51,12 +100,49 @@ public class WornUniqueCodeServiceImpl implements IWornUniqueCodeService
* @return 结果
*/
@Override
+ @Transactional(rollbackFor = Exception.class)
public int insertWornUniqueCode(WornUniqueCode wornUniqueCode)
{
- wornUniqueCode.setCreateTime(DateUtils.getNowDate());
- return wornUniqueCodeMapper.insertWornUniqueCode(wornUniqueCode);
- }
+ WornUniqueCodeMaterial material = wornUniqueCode.getMaterial();
+ if (material == null)
+ {
+ throw new RuntimeException("物料信息不能为空");
+ }
+
+ Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
+ wornUniqueCode.setProjectId(deptId);
+
+ /* ================== 1️⃣ 主表 ================== */
+ wornUniqueCode.setCreateTime(DateUtils.getNowDate());
+ wornUniqueCode.setStatus("0");
+
+ wornUniqueCodeMapper.insertWornUniqueCode(wornUniqueCode);
+
+ Long id = wornUniqueCode.getId();
+
+ /* ================== 2️⃣ 生成code ================== */
+ String code = String.valueOf(600000 + id);
+ wornUniqueCode.setCode(code);
+ wornUniqueCodeMapper.updateWornUniqueCode(wornUniqueCode);
+
+ /* ================== 3️⃣ 插入物料 ================== */
+ material.setUniqueCodeId(id);
+ material.setCreateTime(DateUtils.getNowDate());
+ materialMapper.insertWornUniqueCodeMaterial(material);
+
+ /* ================== 4️⃣ 插入事件 ================== */
+ WornUniqueCodeEvent event = new WornUniqueCodeEvent();
+ event.setUniqueCodeId(id);
+ event.setEventType("0");
+ event.setEventStatus("0");
+ event.setEventDesc("唯一码生成");
+ event.setCreateTime(DateUtils.getNowDate());
+
+ eventMapper.insertWornUniqueCodeEvent(event);
+
+ return 1;
+ }
/**
* 修改唯一码管理
*
@@ -82,15 +168,4 @@ public class WornUniqueCodeServiceImpl implements IWornUniqueCodeService
return wornUniqueCodeMapper.deleteWornUniqueCodeByIds(ids);
}
- /**
- * 删除唯一码管理信息
- *
- * @param id 唯一码管理主键
- * @return 结果
- */
- @Override
- public int deleteWornUniqueCodeById(Long id)
- {
- return wornUniqueCodeMapper.deleteWornUniqueCodeById(id);
- }
}
diff --git a/src/main/java/com/shzg/project/unique/unit/QrCodeUtils.java b/src/main/java/com/shzg/project/unique/unit/QrCodeUtils.java
new file mode 100644
index 0000000..562d78f
--- /dev/null
+++ b/src/main/java/com/shzg/project/unique/unit/QrCodeUtils.java
@@ -0,0 +1,38 @@
+package com.shzg.project.unique.unit;
+
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.util.Base64;
+import javax.imageio.ImageIO;
+
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.MultiFormatWriter;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.client.j2se.MatrixToImageWriter;
+
+public class QrCodeUtils
+{
+ public static String generateBase64(String text)
+ {
+ try
+ {
+ int width = 200;
+ int height = 200;
+
+ BitMatrix matrix = new MultiFormatWriter()
+ .encode(text, BarcodeFormat.QR_CODE, width, height);
+
+ BufferedImage image = MatrixToImageWriter.toBufferedImage(matrix);
+
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ ImageIO.write(image, "png", stream);
+
+ return "data:image/png;base64," +
+ Base64.getEncoder().encodeToString(stream.toByteArray());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("二维码生成失败", e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/mybatis/unique/WornUniqueCodeEventMapper.xml b/src/main/resources/mybatis/unique/WornUniqueCodeEventMapper.xml
new file mode 100644
index 0000000..03d2b49
--- /dev/null
+++ b/src/main/resources/mybatis/unique/WornUniqueCodeEventMapper.xml
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select id, unique_code_id, event_type, event_status, event_desc, operator_id, operator_name, create_by, create_time, update_by, update_time, remark, is_delete from worn_unique_code_event
+
+
+
+
+
+
+
+ insert into worn_unique_code_event
+
+ unique_code_id,
+ event_type,
+ event_status,
+ event_desc,
+ operator_id,
+ operator_name,
+ create_by,
+ create_time,
+ update_by,
+ update_time,
+ remark,
+ is_delete,
+
+
+ #{uniqueCodeId},
+ #{eventType},
+ #{eventStatus},
+ #{eventDesc},
+ #{operatorId},
+ #{operatorName},
+ #{createBy},
+ #{createTime},
+ #{updateBy},
+ #{updateTime},
+ #{remark},
+ #{isDelete},
+
+
+
+
+ update worn_unique_code_event
+
+ unique_code_id = #{uniqueCodeId},
+ event_type = #{eventType},
+ event_status = #{eventStatus},
+ event_desc = #{eventDesc},
+ operator_id = #{operatorId},
+ operator_name = #{operatorName},
+ create_by = #{createBy},
+ create_time = #{createTime},
+ update_by = #{updateBy},
+ update_time = #{updateTime},
+ remark = #{remark},
+ is_delete = #{isDelete},
+
+ where id = #{id}
+
+
+
+ delete from worn_unique_code_event where id = #{id}
+
+
+
+ delete from worn_unique_code_event where id in
+
+ #{id}
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mybatis/unique/WornUniqueCodeMapper.xml b/src/main/resources/mybatis/unique/WornUniqueCodeMapper.xml
index 45d2d0d..f00b535 100644
--- a/src/main/resources/mybatis/unique/WornUniqueCodeMapper.xml
+++ b/src/main/resources/mybatis/unique/WornUniqueCodeMapper.xml
@@ -25,15 +25,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
@@ -93,9 +93,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
-
- delete from worn_unique_code where id = #{id}
-
delete from worn_unique_code where id in
diff --git a/src/main/resources/mybatis/unique/WornUniqueCodeMaterialMapper.xml b/src/main/resources/mybatis/unique/WornUniqueCodeMaterialMapper.xml
new file mode 100644
index 0000000..e580d5d
--- /dev/null
+++ b/src/main/resources/mybatis/unique/WornUniqueCodeMaterialMapper.xml
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select id, unique_code_id, material_id, unit_id, quantity, create_by, create_time, update_by, update_time, remark, is_delete from worn_unique_code_material
+
+
+
+
+
+
+ insert into worn_unique_code_material
+
+ unique_code_id,
+ material_id,
+ unit_id,
+ quantity,
+ create_by,
+ create_time,
+ update_by,
+ update_time,
+ remark,
+ is_delete,
+
+
+ #{uniqueCodeId},
+ #{materialId},
+ #{unitId},
+ #{quantity},
+ #{createBy},
+ #{createTime},
+ #{updateBy},
+ #{updateTime},
+ #{remark},
+ #{isDelete},
+
+
+
+
+ update worn_unique_code_material
+
+ unique_code_id = #{uniqueCodeId},
+ material_id = #{materialId},
+ unit_id = #{unitId},
+ quantity = #{quantity},
+ create_by = #{createBy},
+ create_time = #{createTime},
+ update_by = #{updateBy},
+ update_time = #{updateTime},
+ remark = #{remark},
+ is_delete = #{isDelete},
+
+ where id = #{id}
+
+
+
+ delete from worn_unique_code_material where id = #{id}
+
+
+
+ delete from worn_unique_code_material where id in
+
+ #{id}
+
+
+
+
+
\ No newline at end of file