diff --git a/docs/数据库更新记录-方便升级.txt b/docs/数据库更新记录-方便升级.txt
index 2314a779..a8411009 100644
--- a/docs/数据库更新记录-方便升级.txt
+++ b/docs/数据库更新记录-方便升级.txt
@@ -675,4 +675,25 @@ drop table jsh_app;
-- 时间:2019年11月28日
-- 单据编号表-改表名
-- ----------------------------
-ALTER TABLE tbl_sequence RENAME TO jsh_sequence;
\ No newline at end of file
+ALTER TABLE tbl_sequence RENAME TO jsh_sequence;
+
+-- ----------------------------
+-- 增加产品初始库存表
+-- 时间 2019-11-28
+-- by jishenghua
+-- ----------------------------
+CREATE TABLE `jsh_material_stock` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键' ,
+`material_id` bigint(20) NULL DEFAULT NULL COMMENT '产品id' ,
+`depot_id` bigint(20) NULL DEFAULT NULL COMMENT '仓库id' ,
+`number` decimal(24,6) NULL DEFAULT NULL COMMENT '初始库存数量' ,
+`tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户id' ,
+`delete_fag` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标记,0未删除,1删除' ,
+PRIMARY KEY (`id`)
+)
+ENGINE=InnoDB
+DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
+COMMENT='产品初始库存'
+AUTO_INCREMENT=48
+ROW_FORMAT=COMPACT
+;
\ No newline at end of file
diff --git a/erp_web/pages/materials/material.html b/erp_web/pages/materials/material.html
index b7e03c87..43438316 100644
--- a/erp_web/pages/materials/material.html
+++ b/erp_web/pages/materials/material.html
@@ -13,6 +13,7 @@
+
@@ -125,11 +126,11 @@
- | 首选出库单位 |
+ 首选销售单位 |
|
- 首选入库单位 |
+ 首选采购单位 |
|
@@ -237,6 +238,9 @@
+
@@ -251,18 +255,12 @@
closed="true" buttons="#dlg-buttons5" modal="true" collapsible="false" closable="true">
+
@@ -517,14 +516,9 @@
columns: [[
{field: 'id', width: 35, align: "center", checkbox: true},
{
- title: '操作', field: 'op', align: "center", width: 60, formatter: function (value, rec) {
+ title: '操作', field: 'op', align: "center", width: 60, formatter: function (value, rec, index) {
var str = '';
- var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.model + 'AaBb' + rec.color + 'AaBb' + rec.unit + 'AaBb' + rec.retailprice
- + 'AaBb' + rec.lowprice + 'AaBb' + rec.presetpriceone + 'AaBb' + rec.presetpricetwo + 'AaBb' + rec.remark + 'AaBb' + rec.standard
- + 'AaBb' + rec.color + 'AaBb' + rec.packing + 'AaBb' + rec.safetystock + 'AaBb' + rec.categoryid + 'AaBb' + rec.categoryName
- + 'AaBb' + rec.unitid + 'AaBb' + rec.unitName + 'AaBb' + rec.firstoutunit + 'AaBb' + rec.firstinunit
- + 'AaBb' + rec.mfrs + 'AaBb' + rec.otherfield1 + 'AaBb' + rec.otherfield2 + 'AaBb' + rec.otherfield3+ 'AaBb' + rec.enableserialnumber;
- str += '
';
+ str += '
';
str += '
';
return str;
}
@@ -1141,6 +1135,7 @@
oldManyUnit = "";
materialID = 0;
url = '/material/add';
+ initDepotList(materialID); //加载仓库列表页面
}
//检查商品名称是否存在 ++ 重名无法提示问题需要跟进
@@ -1245,6 +1240,17 @@
objInfo.UnitId = $("#manyUnit").val();
objInfo.CategoryId =$("#parentid").val();
objInfo.PriceStrategy = JSON.stringify(priceStrategy); //价格列表
+ //初始库存信息
+ var stockArr = [];
+ $("#initDepot input").each(function () {
+ var id = $(this).attr("data-id");
+ var val = $(this).val();
+ var stockObj = {};
+ stockObj.depotId = id;
+ stockObj.number = val;
+ stockArr.push(stockObj);
+ });
+ objInfo.stock = JSON.stringify(stockArr);
$.ajax({
type: "post",
url: url,
@@ -1291,35 +1297,35 @@
}
//编辑信息
- function editMaterial(materialTotalInfo) {
- var materialInfo = materialTotalInfo.split("AaBb");
+ function editMaterial(index) {
+ var rowsdata = $("#tableData").datagrid("getRows")[index];
bindMProperty(); //根据商品属性绑定
- $("#Name").focus().val(materialInfo[1]);
- $("#Color").focus().val(materialInfo[11]);
- $("#EnableSerialNumber").val(materialInfo[24]=='1'?'1':'0');
+ $("#Name").focus().val(rowsdata.name);
+ $("#Color").focus().val(rowsdata.color);
+ $("#EnableSerialNumber").val(rowsdata.enableserialnumber=='1'?'1':'0');
//商品类别id
- $("#parentid").val(materialInfo[14] == "undefined" ? "" : materialInfo[14]);
+ $("#parentid").val(rowsdata.categoryid);
//商品类别名称
- $("#parentName").val(materialInfo[15] == "undefined" ? "" : materialInfo[15]);
- mId = materialInfo[14];
- mName = materialInfo[15];
- $("#Packing").focus().val(materialInfo[12]);
- $("#SafetyStock").focus().val(materialInfo[13]=="undefined" ? "" : materialInfo[13]);
- $("#Model").val(materialInfo[2]);
- $("#Standard").val(materialInfo[10] == "undefined" ? "" : materialInfo[10]);
- $("#Color").val(materialInfo[3] == "undefined" ? "" : materialInfo[3]);
- $("#Mfrs").val(materialInfo[20] == "undefined" ? "" : materialInfo[20]);
- $("#OtherField1").val(materialInfo[21] == "undefined" ? "" : materialInfo[21]);
- $("#OtherField2").val(materialInfo[22] == "undefined" ? "" : materialInfo[22]);
- $("#OtherField3").val(materialInfo[23] == "undefined" ? "" : materialInfo[23]);
- $("#Unit").val(materialInfo[4] == "undefined" ? "" : materialInfo[4]);
- $("#RetailPrice").val(materialInfo[5] == "undefined" ? "" : materialInfo[5]);
- $("#LowPrice").val(materialInfo[6] == "undefined" ? "" : materialInfo[6]);
- $("#PresetPriceOne").val(materialInfo[7] == "undefined" ? "" : materialInfo[7]);
- $("#PresetPriceTwo").val(materialInfo[8] == "undefined" ? "" : materialInfo[8]);
- $("#Remark").val(materialInfo[9]);
- $("#manyUnit").val(materialInfo[16]);
- if (materialInfo[16] != "undefined") {
+ $("#parentName").val(rowsdata.categoryName);
+ mId = rowsdata.categoryid;
+ mName = rowsdata.categoryName;
+ $("#Packing").focus().val(rowsdata.packing);
+ $("#SafetyStock").focus().val(rowsdata.safetystock);
+ $("#Model").val(rowsdata.model);
+ $("#Standard").val(rowsdata.standard);
+ $("#Color").val(rowsdata.color);
+ $("#Mfrs").val(rowsdata.mfrs);
+ $("#OtherField1").val(rowsdata.otherfield1);
+ $("#OtherField2").val(rowsdata.otherfield2);
+ $("#OtherField3").val(rowsdata.otherfield3);
+ $("#Unit").val(rowsdata.unit);
+ $("#RetailPrice").val(rowsdata.retailprice);
+ $("#LowPrice").val(rowsdata.lowprice);
+ $("#PresetPriceOne").val(rowsdata.presetpriceone);
+ $("#PresetPriceTwo").val(rowsdata.presetpricetwo);
+ $("#Remark").val(rowsdata.remark);
+ $("#manyUnit").val(rowsdata.unitid);
+ if (rowsdata.unitid) {
$("#manyUnitCheck").prop("checked", true);
//当前为选中状态
$("#Unit").hide();
@@ -1336,10 +1342,10 @@
var basic = '';
var other = '';
firstOptions = firstOptions + basic + other;
- $("#FirstOutUnit").empty().append('').append(firstOptions); //首选出库单位
- $("#FirstInUnit").empty().append('').append(firstOptions); //首选入库单位
- $("#FirstOutUnit").val(materialInfo[18]);//首选出库单位
- $("#FirstInUnit").val(materialInfo[19]);//首选入库单位
+ $("#FirstOutUnit").empty().append('').append(firstOptions); //首选销售单位
+ $("#FirstInUnit").empty().append('').append(firstOptions); //首选采购单位
+ $("#FirstOutUnit").val(rowsdata.firstoutunit);//首选销售单位
+ $("#FirstInUnit").val(rowsdata.firstinunit);//首选采购单位
}
}
else {
@@ -1356,7 +1362,7 @@
$.ajax({
url: '/material/findById',
data: {
- id: materialInfo[0]
+ id: rowsdata.id
},
type: "get",
dataType: "json",
@@ -1385,26 +1391,53 @@
}
});
- oldName = materialInfo[1];
- oldModel = materialInfo[2];
- oldColor = materialInfo[11];
- oldStandard = materialInfo[10];
- oldMfrs = materialInfo[20];
- oldOtherField1 = materialInfo[21];
- oldOtherField2 = materialInfo[22];
- oldOtherField3 = materialInfo[23];
- oldUnit = materialInfo[4];
- oldManyUnit = materialInfo[16];
+ oldName = rowsdata.name;
+ oldModel = rowsdata.model;
+ oldColor = rowsdata.color;
+ oldStandard = rowsdata.standard;
+ oldMfrs = rowsdata.mfrs;
+ oldOtherField1 = rowsdata.otherfield1;
+ oldOtherField2 = rowsdata.otherfield2;
+ oldOtherField3 = rowsdata.otherfield3;
+ oldUnit = rowsdata.unit;
+ oldManyUnit = rowsdata.unitid;
$('#materialDlg').dialog('open').dialog('setTitle', '
编辑商品信息');
$(".window-mask").css({width: webW, height: webH});
- materialID = materialInfo[0];
+ materialID = rowsdata.id;
//焦点在名称输入框==定焦在输入文字后面
- $("#Name").val("").focus().val(materialInfo[1]);
+ $("#Name").val("").focus().val(rowsdata.name);
//选中基本资料tab
$("#materialFM #tt .tabs li").first().click();
- url = '/material/update?id=' + materialInfo[0];
+ url = '/material/update?id=' + rowsdata.id;
+ initDepotList(rowsdata.id); //加载仓库列表页面
}
+ function initDepotList(mId) {
+ $.ajax({
+ type: "get",
+ url: "/depot/getAllListWithStock?mId=" + mId,
+ dataType: "json",
+ async: false,
+ success: function (res) {
+ if (res && res.code == 200) {
+ var json = {};
+ json.depotList = res.data;
+ $.ajax({
+ type: "get",
+ url: "../../../pages/template/init_depot_list.html?616",
+ async: false,
+ success: function (tem) {
+ if (tem) {
+ var template = Handlebars.compile(tem);
+ var htmlValue = template(json);
+ $("#initDepot").html(htmlValue);
+ }
+ }
+ });
+ }
+ }
+ });
+ }
//搜索处理
$("#searchBtn").unbind().bind({
@@ -1501,8 +1534,8 @@
var basic = '';
var other = '';
firstOptions = firstOptions + basic + other;
- $("#FirstOutUnit").empty().append('').append(firstOptions); //首选出库单位
- $("#FirstInUnit").empty().append('').append(firstOptions); //首选入库单位
+ $("#FirstOutUnit").empty().append('').append(firstOptions); //首选销售单位
+ $("#FirstInUnit").empty().append('').append(firstOptions); //首选采购单位
$("#basicUnit").text(arr[0]);
$("#otherUnit").text(arr[1]);
}
diff --git a/erp_web/pages/template/init_depot_list.html b/erp_web/pages/template/init_depot_list.html
new file mode 100644
index 00000000..e52be2da
--- /dev/null
+++ b/erp_web/pages/template/init_depot_list.html
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/erp_web/upload/excels/goods_template.xls b/erp_web/upload/excels/goods_template.xls
new file mode 100644
index 00000000..2050712c
Binary files /dev/null and b/erp_web/upload/excels/goods_template.xls differ
diff --git a/src/main/java/com/jsh/erp/controller/DepotController.java b/src/main/java/com/jsh/erp/controller/DepotController.java
index d3d5c361..2bd429ec 100644
--- a/src/main/java/com/jsh/erp/controller/DepotController.java
+++ b/src/main/java/com/jsh/erp/controller/DepotController.java
@@ -12,6 +12,7 @@ import com.jsh.erp.datasource.entities.Depot;
import com.jsh.erp.datasource.entities.DepotEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.depot.DepotService;
+import com.jsh.erp.service.material.MaterialService;
import com.jsh.erp.service.systemConfig.SystemConfigService;
import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.*;
@@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
+import java.math.BigDecimal;
import java.util.*;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
@@ -44,6 +46,9 @@ public class DepotController {
@Resource
private SystemConfigService systemConfigService;
+ @Resource
+ private MaterialService materialService;
+
@GetMapping(value = "/getAllList")
public BaseResponseInfo getAllList(HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
@@ -232,4 +237,33 @@ public class DepotController {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
+
+ @GetMapping(value = "/getAllListWithStock")
+ public BaseResponseInfo getAllList(@RequestParam("mId") Long mId,
+ HttpServletRequest request) {
+ BaseResponseInfo res = new BaseResponseInfo();
+ try {
+ List list = depotService.getAllList();
+ List depotList = new ArrayList();
+ for(Depot depot: list) {
+ DepotEx de = new DepotEx();
+ if(mId!=0) {
+ BigDecimal stock = materialService.getInitStock(mId, depot.getId());
+ de.setStock(stock);
+ } else {
+ de.setStock(BigDecimal.ZERO);
+ }
+ de.setId(depot.getId());
+ de.setName(depot.getName());
+ depotList.add(de);
+ }
+ res.code = 200;
+ res.data = depotList;
+ } catch(Exception e){
+ e.printStackTrace();
+ res.code = 500;
+ res.data = "获取数据失败";
+ }
+ return res;
+ }
}
diff --git a/src/main/java/com/jsh/erp/controller/MaterialController.java b/src/main/java/com/jsh/erp/controller/MaterialController.java
index 366824bb..8640c9a2 100644
--- a/src/main/java/com/jsh/erp/controller/MaterialController.java
+++ b/src/main/java/com/jsh/erp/controller/MaterialController.java
@@ -233,7 +233,7 @@ public class MaterialController {
}
/**
- * excel表格导入
+ * excel表格导入产品(含初始库存)
* @param materialFile
* @param request
* @param response
@@ -257,30 +257,7 @@ public class MaterialController {
info.code = 400;
info.data = data;
}
- //每行中数据顺序 "品名","类型","型号","安全存量","单位","零售价","最低售价","预计采购价","批发价","备注","状态"
- List mList = new ArrayList();
- for (int i = 1; i < src.getRows(); i++) {
- Material m = new Material();
- m.setName(ExcelUtils.getContent(src, i, 0));
- m.setCategoryid(1L); //根目录
- m.setModel(ExcelUtils.getContent(src, i, 2));
- String safetyStock = ExcelUtils.getContent(src, i, 3);
- m.setSafetystock(parseBigDecimalEx(safetyStock));
- m.setUnit(ExcelUtils.getContent(src, i, 4));
- String retailprice = ExcelUtils.getContent(src, i, 5);
- m.setRetailprice(parseBigDecimalEx(retailprice));
- String lowPrice = ExcelUtils.getContent(src, i, 6);
- m.setLowprice(parseBigDecimalEx(lowPrice));
- String presetpriceone = ExcelUtils.getContent(src, i, 7);
- m.setPresetpriceone(parseBigDecimalEx(presetpriceone));
- String presetpricetwo = ExcelUtils.getContent(src, i, 8);
- m.setPresetpricetwo(parseBigDecimalEx(presetpricetwo));
- m.setRemark(ExcelUtils.getContent(src, i, 9));
- String enabled = ExcelUtils.getContent(src, i, 10);
- m.setEnabled(enabled.equals("启用")? true: false);
- mList.add(m);
- }
- info = materialService.importExcel(mList);
+ info = materialService.importExcel(src);
} catch (Exception e) {
e.printStackTrace();
message = "导入失败";
diff --git a/src/main/java/com/jsh/erp/datasource/entities/DepotEx.java b/src/main/java/com/jsh/erp/datasource/entities/DepotEx.java
index cd3b842a..2a66f0e9 100644
--- a/src/main/java/com/jsh/erp/datasource/entities/DepotEx.java
+++ b/src/main/java/com/jsh/erp/datasource/entities/DepotEx.java
@@ -1,5 +1,7 @@
package com.jsh.erp.datasource.entities;
+import java.math.BigDecimal;
+
/**
* Description
*
@@ -10,6 +12,8 @@ public class DepotEx extends Depot{
//负责人名字
private String principalName;
+ private BigDecimal stock;
+
public String getPrincipalName() {
return principalName;
}
@@ -17,4 +21,12 @@ public class DepotEx extends Depot{
public void setPrincipalName(String principalName) {
this.principalName = principalName;
}
+
+ public BigDecimal getStock() {
+ return stock;
+ }
+
+ public void setStock(BigDecimal stock) {
+ this.stock = stock;
+ }
}
diff --git a/src/main/java/com/jsh/erp/datasource/entities/MaterialStock.java b/src/main/java/com/jsh/erp/datasource/entities/MaterialStock.java
new file mode 100644
index 00000000..19067781
--- /dev/null
+++ b/src/main/java/com/jsh/erp/datasource/entities/MaterialStock.java
@@ -0,0 +1,197 @@
+package com.jsh.erp.datasource.entities;
+
+import java.math.BigDecimal;
+
+public class MaterialStock {
+ /**
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column jsh_material_stock.id
+ *
+ * @mbggenerated
+ */
+ private Long id;
+
+ /**
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column jsh_material_stock.material_id
+ *
+ * @mbggenerated
+ */
+ private Long materialId;
+
+ /**
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column jsh_material_stock.depot_id
+ *
+ * @mbggenerated
+ */
+ private Long depotId;
+
+ /**
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column jsh_material_stock.number
+ *
+ * @mbggenerated
+ */
+ private BigDecimal number;
+
+ /**
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column jsh_material_stock.tenant_id
+ *
+ * @mbggenerated
+ */
+ private Long tenantId;
+
+ /**
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column jsh_material_stock.delete_fag
+ *
+ * @mbggenerated
+ */
+ private String deleteFag;
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column jsh_material_stock.id
+ *
+ * @return the value of jsh_material_stock.id
+ *
+ * @mbggenerated
+ */
+ public Long getId() {
+ return id;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column jsh_material_stock.id
+ *
+ * @param id the value for jsh_material_stock.id
+ *
+ * @mbggenerated
+ */
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column jsh_material_stock.material_id
+ *
+ * @return the value of jsh_material_stock.material_id
+ *
+ * @mbggenerated
+ */
+ public Long getMaterialId() {
+ return materialId;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column jsh_material_stock.material_id
+ *
+ * @param materialId the value for jsh_material_stock.material_id
+ *
+ * @mbggenerated
+ */
+ public void setMaterialId(Long materialId) {
+ this.materialId = materialId;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column jsh_material_stock.depot_id
+ *
+ * @return the value of jsh_material_stock.depot_id
+ *
+ * @mbggenerated
+ */
+ public Long getDepotId() {
+ return depotId;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column jsh_material_stock.depot_id
+ *
+ * @param depotId the value for jsh_material_stock.depot_id
+ *
+ * @mbggenerated
+ */
+ public void setDepotId(Long depotId) {
+ this.depotId = depotId;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column jsh_material_stock.number
+ *
+ * @return the value of jsh_material_stock.number
+ *
+ * @mbggenerated
+ */
+ public BigDecimal getNumber() {
+ return number;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column jsh_material_stock.number
+ *
+ * @param number the value for jsh_material_stock.number
+ *
+ * @mbggenerated
+ */
+ public void setNumber(BigDecimal number) {
+ this.number = number;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column jsh_material_stock.tenant_id
+ *
+ * @return the value of jsh_material_stock.tenant_id
+ *
+ * @mbggenerated
+ */
+ public Long getTenantId() {
+ return tenantId;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column jsh_material_stock.tenant_id
+ *
+ * @param tenantId the value for jsh_material_stock.tenant_id
+ *
+ * @mbggenerated
+ */
+ public void setTenantId(Long tenantId) {
+ this.tenantId = tenantId;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column jsh_material_stock.delete_fag
+ *
+ * @return the value of jsh_material_stock.delete_fag
+ *
+ * @mbggenerated
+ */
+ public String getDeleteFag() {
+ return deleteFag;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column jsh_material_stock.delete_fag
+ *
+ * @param deleteFag the value for jsh_material_stock.delete_fag
+ *
+ * @mbggenerated
+ */
+ public void setDeleteFag(String deleteFag) {
+ this.deleteFag = deleteFag == null ? null : deleteFag.trim();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/jsh/erp/datasource/entities/MaterialStockExample.java b/src/main/java/com/jsh/erp/datasource/entities/MaterialStockExample.java
new file mode 100644
index 00000000..fe34f386
--- /dev/null
+++ b/src/main/java/com/jsh/erp/datasource/entities/MaterialStockExample.java
@@ -0,0 +1,673 @@
+package com.jsh.erp.datasource.entities;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+public class MaterialStockExample {
+ /**
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ protected String orderByClause;
+
+ /**
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ protected boolean distinct;
+
+ /**
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ protected List oredCriteria;
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ public MaterialStockExample() {
+ oredCriteria = new ArrayList();
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ public void setOrderByClause(String orderByClause) {
+ this.orderByClause = orderByClause;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ public String getOrderByClause() {
+ return orderByClause;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ public void setDistinct(boolean distinct) {
+ this.distinct = distinct;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ public boolean isDistinct() {
+ return distinct;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ public List getOredCriteria() {
+ return oredCriteria;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ public void or(Criteria criteria) {
+ oredCriteria.add(criteria);
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ public Criteria or() {
+ Criteria criteria = createCriteriaInternal();
+ oredCriteria.add(criteria);
+ return criteria;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ public Criteria createCriteria() {
+ Criteria criteria = createCriteriaInternal();
+ if (oredCriteria.size() == 0) {
+ oredCriteria.add(criteria);
+ }
+ return criteria;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ protected Criteria createCriteriaInternal() {
+ Criteria criteria = new Criteria();
+ return criteria;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ public void clear() {
+ oredCriteria.clear();
+ orderByClause = null;
+ distinct = false;
+ }
+
+ /**
+ * This class was generated by MyBatis Generator.
+ * This class corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ protected abstract static class GeneratedCriteria {
+ protected List criteria;
+
+ protected GeneratedCriteria() {
+ super();
+ criteria = new ArrayList();
+ }
+
+ public boolean isValid() {
+ return criteria.size() > 0;
+ }
+
+ public List getAllCriteria() {
+ return criteria;
+ }
+
+ public List getCriteria() {
+ return criteria;
+ }
+
+ protected void addCriterion(String condition) {
+ if (condition == null) {
+ throw new RuntimeException("Value for condition cannot be null");
+ }
+ criteria.add(new Criterion(condition));
+ }
+
+ protected void addCriterion(String condition, Object value, String property) {
+ if (value == null) {
+ throw new RuntimeException("Value for " + property + " cannot be null");
+ }
+ criteria.add(new Criterion(condition, value));
+ }
+
+ protected void addCriterion(String condition, Object value1, Object value2, String property) {
+ if (value1 == null || value2 == null) {
+ throw new RuntimeException("Between values for " + property + " cannot be null");
+ }
+ criteria.add(new Criterion(condition, value1, value2));
+ }
+
+ public Criteria andIdIsNull() {
+ addCriterion("id is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdIsNotNull() {
+ addCriterion("id is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdEqualTo(Long value) {
+ addCriterion("id =", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdNotEqualTo(Long value) {
+ addCriterion("id <>", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdGreaterThan(Long value) {
+ addCriterion("id >", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdGreaterThanOrEqualTo(Long value) {
+ addCriterion("id >=", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdLessThan(Long value) {
+ addCriterion("id <", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdLessThanOrEqualTo(Long value) {
+ addCriterion("id <=", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdIn(List values) {
+ addCriterion("id in", values, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdNotIn(List values) {
+ addCriterion("id not in", values, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdBetween(Long value1, Long value2) {
+ addCriterion("id between", value1, value2, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdNotBetween(Long value1, Long value2) {
+ addCriterion("id not between", value1, value2, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andMaterialIdIsNull() {
+ addCriterion("material_id is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andMaterialIdIsNotNull() {
+ addCriterion("material_id is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andMaterialIdEqualTo(Long value) {
+ addCriterion("material_id =", value, "materialId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMaterialIdNotEqualTo(Long value) {
+ addCriterion("material_id <>", value, "materialId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMaterialIdGreaterThan(Long value) {
+ addCriterion("material_id >", value, "materialId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMaterialIdGreaterThanOrEqualTo(Long value) {
+ addCriterion("material_id >=", value, "materialId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMaterialIdLessThan(Long value) {
+ addCriterion("material_id <", value, "materialId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMaterialIdLessThanOrEqualTo(Long value) {
+ addCriterion("material_id <=", value, "materialId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMaterialIdIn(List values) {
+ addCriterion("material_id in", values, "materialId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMaterialIdNotIn(List values) {
+ addCriterion("material_id not in", values, "materialId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMaterialIdBetween(Long value1, Long value2) {
+ addCriterion("material_id between", value1, value2, "materialId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMaterialIdNotBetween(Long value1, Long value2) {
+ addCriterion("material_id not between", value1, value2, "materialId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotIdIsNull() {
+ addCriterion("depot_id is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotIdIsNotNull() {
+ addCriterion("depot_id is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotIdEqualTo(Long value) {
+ addCriterion("depot_id =", value, "depotId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotIdNotEqualTo(Long value) {
+ addCriterion("depot_id <>", value, "depotId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotIdGreaterThan(Long value) {
+ addCriterion("depot_id >", value, "depotId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotIdGreaterThanOrEqualTo(Long value) {
+ addCriterion("depot_id >=", value, "depotId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotIdLessThan(Long value) {
+ addCriterion("depot_id <", value, "depotId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotIdLessThanOrEqualTo(Long value) {
+ addCriterion("depot_id <=", value, "depotId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotIdIn(List values) {
+ addCriterion("depot_id in", values, "depotId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotIdNotIn(List values) {
+ addCriterion("depot_id not in", values, "depotId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotIdBetween(Long value1, Long value2) {
+ addCriterion("depot_id between", value1, value2, "depotId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDepotIdNotBetween(Long value1, Long value2) {
+ addCriterion("depot_id not between", value1, value2, "depotId");
+ return (Criteria) this;
+ }
+
+ public Criteria andNumberIsNull() {
+ addCriterion("number is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andNumberIsNotNull() {
+ addCriterion("number is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andNumberEqualTo(BigDecimal value) {
+ addCriterion("number =", value, "number");
+ return (Criteria) this;
+ }
+
+ public Criteria andNumberNotEqualTo(BigDecimal value) {
+ addCriterion("number <>", value, "number");
+ return (Criteria) this;
+ }
+
+ public Criteria andNumberGreaterThan(BigDecimal value) {
+ addCriterion("number >", value, "number");
+ return (Criteria) this;
+ }
+
+ public Criteria andNumberGreaterThanOrEqualTo(BigDecimal value) {
+ addCriterion("number >=", value, "number");
+ return (Criteria) this;
+ }
+
+ public Criteria andNumberLessThan(BigDecimal value) {
+ addCriterion("number <", value, "number");
+ return (Criteria) this;
+ }
+
+ public Criteria andNumberLessThanOrEqualTo(BigDecimal value) {
+ addCriterion("number <=", value, "number");
+ return (Criteria) this;
+ }
+
+ public Criteria andNumberIn(List values) {
+ addCriterion("number in", values, "number");
+ return (Criteria) this;
+ }
+
+ public Criteria andNumberNotIn(List values) {
+ addCriterion("number not in", values, "number");
+ return (Criteria) this;
+ }
+
+ public Criteria andNumberBetween(BigDecimal value1, BigDecimal value2) {
+ addCriterion("number between", value1, value2, "number");
+ return (Criteria) this;
+ }
+
+ public Criteria andNumberNotBetween(BigDecimal value1, BigDecimal value2) {
+ addCriterion("number not between", value1, value2, "number");
+ return (Criteria) this;
+ }
+
+ public Criteria andTenantIdIsNull() {
+ addCriterion("tenant_id is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andTenantIdIsNotNull() {
+ addCriterion("tenant_id is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andTenantIdEqualTo(Long value) {
+ addCriterion("tenant_id =", value, "tenantId");
+ return (Criteria) this;
+ }
+
+ public Criteria andTenantIdNotEqualTo(Long value) {
+ addCriterion("tenant_id <>", value, "tenantId");
+ return (Criteria) this;
+ }
+
+ public Criteria andTenantIdGreaterThan(Long value) {
+ addCriterion("tenant_id >", value, "tenantId");
+ return (Criteria) this;
+ }
+
+ public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
+ addCriterion("tenant_id >=", value, "tenantId");
+ return (Criteria) this;
+ }
+
+ public Criteria andTenantIdLessThan(Long value) {
+ addCriterion("tenant_id <", value, "tenantId");
+ return (Criteria) this;
+ }
+
+ public Criteria andTenantIdLessThanOrEqualTo(Long value) {
+ addCriterion("tenant_id <=", value, "tenantId");
+ return (Criteria) this;
+ }
+
+ public Criteria andTenantIdIn(List values) {
+ addCriterion("tenant_id in", values, "tenantId");
+ return (Criteria) this;
+ }
+
+ public Criteria andTenantIdNotIn(List values) {
+ addCriterion("tenant_id not in", values, "tenantId");
+ return (Criteria) this;
+ }
+
+ public Criteria andTenantIdBetween(Long value1, Long value2) {
+ addCriterion("tenant_id between", value1, value2, "tenantId");
+ return (Criteria) this;
+ }
+
+ public Criteria andTenantIdNotBetween(Long value1, Long value2) {
+ addCriterion("tenant_id not between", value1, value2, "tenantId");
+ return (Criteria) this;
+ }
+
+ public Criteria andDeleteFagIsNull() {
+ addCriterion("delete_fag is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andDeleteFagIsNotNull() {
+ addCriterion("delete_fag is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andDeleteFagEqualTo(String value) {
+ addCriterion("delete_fag =", value, "deleteFag");
+ return (Criteria) this;
+ }
+
+ public Criteria andDeleteFagNotEqualTo(String value) {
+ addCriterion("delete_fag <>", value, "deleteFag");
+ return (Criteria) this;
+ }
+
+ public Criteria andDeleteFagGreaterThan(String value) {
+ addCriterion("delete_fag >", value, "deleteFag");
+ return (Criteria) this;
+ }
+
+ public Criteria andDeleteFagGreaterThanOrEqualTo(String value) {
+ addCriterion("delete_fag >=", value, "deleteFag");
+ return (Criteria) this;
+ }
+
+ public Criteria andDeleteFagLessThan(String value) {
+ addCriterion("delete_fag <", value, "deleteFag");
+ return (Criteria) this;
+ }
+
+ public Criteria andDeleteFagLessThanOrEqualTo(String value) {
+ addCriterion("delete_fag <=", value, "deleteFag");
+ return (Criteria) this;
+ }
+
+ public Criteria andDeleteFagLike(String value) {
+ addCriterion("delete_fag like", value, "deleteFag");
+ return (Criteria) this;
+ }
+
+ public Criteria andDeleteFagNotLike(String value) {
+ addCriterion("delete_fag not like", value, "deleteFag");
+ return (Criteria) this;
+ }
+
+ public Criteria andDeleteFagIn(List values) {
+ addCriterion("delete_fag in", values, "deleteFag");
+ return (Criteria) this;
+ }
+
+ public Criteria andDeleteFagNotIn(List values) {
+ addCriterion("delete_fag not in", values, "deleteFag");
+ return (Criteria) this;
+ }
+
+ public Criteria andDeleteFagBetween(String value1, String value2) {
+ addCriterion("delete_fag between", value1, value2, "deleteFag");
+ return (Criteria) this;
+ }
+
+ public Criteria andDeleteFagNotBetween(String value1, String value2) {
+ addCriterion("delete_fag not between", value1, value2, "deleteFag");
+ return (Criteria) this;
+ }
+ }
+
+ /**
+ * This class was generated by MyBatis Generator.
+ * This class corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated do_not_delete_during_merge
+ */
+ public static class Criteria extends GeneratedCriteria {
+
+ protected Criteria() {
+ super();
+ }
+ }
+
+ /**
+ * This class was generated by MyBatis Generator.
+ * This class corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ public static class Criterion {
+ private String condition;
+
+ private Object value;
+
+ private Object secondValue;
+
+ private boolean noValue;
+
+ private boolean singleValue;
+
+ private boolean betweenValue;
+
+ private boolean listValue;
+
+ private String typeHandler;
+
+ public String getCondition() {
+ return condition;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public Object getSecondValue() {
+ return secondValue;
+ }
+
+ public boolean isNoValue() {
+ return noValue;
+ }
+
+ public boolean isSingleValue() {
+ return singleValue;
+ }
+
+ public boolean isBetweenValue() {
+ return betweenValue;
+ }
+
+ public boolean isListValue() {
+ return listValue;
+ }
+
+ public String getTypeHandler() {
+ return typeHandler;
+ }
+
+ protected Criterion(String condition) {
+ super();
+ this.condition = condition;
+ this.typeHandler = null;
+ this.noValue = true;
+ }
+
+ protected Criterion(String condition, Object value, String typeHandler) {
+ super();
+ this.condition = condition;
+ this.value = value;
+ this.typeHandler = typeHandler;
+ if (value instanceof List>) {
+ this.listValue = true;
+ } else {
+ this.singleValue = true;
+ }
+ }
+
+ protected Criterion(String condition, Object value) {
+ this(condition, value, null);
+ }
+
+ protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+ super();
+ this.condition = condition;
+ this.value = value;
+ this.secondValue = secondValue;
+ this.typeHandler = typeHandler;
+ this.betweenValue = true;
+ }
+
+ protected Criterion(String condition, Object value, Object secondValue) {
+ this(condition, value, secondValue, null);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/jsh/erp/datasource/entities/MaterialWithInitStock.java b/src/main/java/com/jsh/erp/datasource/entities/MaterialWithInitStock.java
new file mode 100644
index 00000000..63efbd6c
--- /dev/null
+++ b/src/main/java/com/jsh/erp/datasource/entities/MaterialWithInitStock.java
@@ -0,0 +1,17 @@
+package com.jsh.erp.datasource.entities;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+public class MaterialWithInitStock extends Material {
+
+ private Map stockMap;
+
+ public Map getStockMap() {
+ return stockMap;
+ }
+
+ public void setStockMap(Map stockMap) {
+ this.stockMap = stockMap;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java b/src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java
index b565fbb4..3d85d8ff 100644
--- a/src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java
+++ b/src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java
@@ -59,4 +59,6 @@ public interface MaterialMapperEx {
List getMaterialListByCategoryIds(@Param("categoryIds") String[] categoryIds);
List getMaterialListByUnitIds(@Param("unitIds") String[] unitIds);
+
+ int insertSelectiveEx(Material record);
}
diff --git a/src/main/java/com/jsh/erp/datasource/mappers/MaterialStockMapper.java b/src/main/java/com/jsh/erp/datasource/mappers/MaterialStockMapper.java
new file mode 100644
index 00000000..796825e0
--- /dev/null
+++ b/src/main/java/com/jsh/erp/datasource/mappers/MaterialStockMapper.java
@@ -0,0 +1,96 @@
+package com.jsh.erp.datasource.mappers;
+
+import com.jsh.erp.datasource.entities.MaterialStock;
+import com.jsh.erp.datasource.entities.MaterialStockExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface MaterialStockMapper {
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ int countByExample(MaterialStockExample example);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ int deleteByExample(MaterialStockExample example);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ int deleteByPrimaryKey(Long id);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ int insert(MaterialStock record);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ int insertSelective(MaterialStock record);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ List selectByExample(MaterialStockExample example);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ MaterialStock selectByPrimaryKey(Long id);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ int updateByExampleSelective(@Param("record") MaterialStock record, @Param("example") MaterialStockExample example);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ int updateByExample(@Param("record") MaterialStock record, @Param("example") MaterialStockExample example);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ int updateByPrimaryKeySelective(MaterialStock record);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table jsh_material_stock
+ *
+ * @mbggenerated
+ */
+ int updateByPrimaryKey(MaterialStock record);
+}
\ No newline at end of file
diff --git a/src/main/java/com/jsh/erp/service/depot/DepotService.java b/src/main/java/com/jsh/erp/service/depot/DepotService.java
index 803fd70d..ccedea10 100644
--- a/src/main/java/com/jsh/erp/service/depot/DepotService.java
+++ b/src/main/java/com/jsh/erp/service/depot/DepotService.java
@@ -292,4 +292,19 @@ public class DepotService {
}
return result;
}
+
+ /**
+ * 根据名称获取id
+ * @param name
+ */
+ public Long getIdByName(String name){
+ Long id = 0L;
+ DepotExample example = new DepotExample();
+ example.createCriteria().andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+ List list = depotMapper.selectByExample(example);
+ if(list!=null && list.size()>0) {
+ id = list.get(0).getId();
+ }
+ return id;
+ }
}
diff --git a/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java b/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
index 474626e6..eafabe76 100644
--- a/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
+++ b/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
@@ -663,10 +663,12 @@ public class DepotItemService {
* @return
*/
public BigDecimal getStockByParam(Long depotId, Long mId, String beginTime, String endTime, Long tenantId){
+ //初始库存
+ BigDecimal initStock = materialService.getInitStockByMid(depotId, mId);
DepotItemVo4Stock stockObj = depotItemMapperEx.getStockByParam(depotId, mId, beginTime, endTime, tenantId);
BigDecimal intNum = stockObj.getInNum();
BigDecimal outNum = stockObj.getOutNum();
- return intNum.subtract(outNum);
+ return initStock.add(intNum).subtract(outNum);
}
/**
diff --git a/src/main/java/com/jsh/erp/service/material/MaterialService.java b/src/main/java/com/jsh/erp/service/material/MaterialService.java
index 5dff0edf..f3775de3 100644
--- a/src/main/java/com/jsh/erp/service/material/MaterialService.java
+++ b/src/main/java/com/jsh/erp/service/material/MaterialService.java
@@ -1,5 +1,7 @@
package com.jsh.erp.service.material;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.jsh.erp.constants.BusinessConstants;
@@ -8,13 +10,19 @@ import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.mappers.DepotItemMapperEx;
import com.jsh.erp.datasource.mappers.MaterialMapper;
import com.jsh.erp.datasource.mappers.MaterialMapperEx;
+import com.jsh.erp.datasource.mappers.MaterialStockMapper;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
+import com.jsh.erp.service.depot.DepotService;
import com.jsh.erp.service.depotItem.DepotItemService;
import com.jsh.erp.service.log.LogService;
+import com.jsh.erp.service.materialCategory.MaterialCategoryService;
+import com.jsh.erp.service.unit.UnitService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.BaseResponseInfo;
+import com.jsh.erp.utils.ExcelUtils;
import com.jsh.erp.utils.StringUtil;
+import jxl.Sheet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@@ -24,6 +32,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
+import java.math.BigDecimal;
import java.util.*;
@Service
@@ -42,6 +51,14 @@ public class MaterialService {
private DepotItemMapperEx depotItemMapperEx;
@Resource
private DepotItemService depotItemService;
+ @Resource
+ private MaterialCategoryService materialCategoryService;
+ @Resource
+ private UnitService unitService;
+ @Resource
+ private MaterialStockMapper materialStockMapper;
+ @Resource
+ private DepotService depotService;
public Material getMaterial(long id)throws Exception {
Material result=null;
@@ -125,6 +142,22 @@ public class MaterialService {
int result =0;
try{
result= materialMapper.insertSelective(material);
+ JSONObject mObj = JSON.parseObject(beanJson);
+ Long mId = material.getId();
+ if(mObj.get("stock")!=null) {
+ String stockStr = mObj.getString("stock");
+ JSONArray stockArr = JSONArray.parseArray(stockStr);
+ for(Object object: stockArr) {
+ JSONObject jsonObj = (JSONObject)object;
+ if(jsonObj.get("depotId")!=null && jsonObj.get("number")!=null) {
+ String number = jsonObj.getString("number");
+ Long depotId = jsonObj.getLong("depotId");
+ if(number!=null && Double.valueOf(number)>0) {
+ insertStockByMaterialAndDepot(depotId, mId, parseBigDecimalEx(number));
+ }
+ }
+ }
+ }
logService.insertLog("商品", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){
JshException.writeFail(logger, e);
@@ -145,6 +178,25 @@ public class MaterialService {
} else {
materialMapperEx.updateUnitIdNullByPrimaryKey(id); //将多单位置空
}
+ JSONObject mObj = JSON.parseObject(beanJson);
+ if(mObj.get("stock")!=null) {
+ String stockStr = mObj.getString("stock");
+ JSONArray stockArr = JSONArray.parseArray(stockStr);
+ for (Object object : stockArr) {
+ JSONObject jsonObj = (JSONObject) object;
+ if (jsonObj.get("depotId") != null && jsonObj.get("number") != null) {
+ String number = jsonObj.getString("number");
+ Long depotId = jsonObj.getLong("depotId");
+ //先清除再插入
+ MaterialStockExample example = new MaterialStockExample();
+ example.createCriteria().andMaterialIdEqualTo(id).andDepotIdEqualTo(depotId);
+ materialStockMapper.deleteByExample(example);
+ if (number != null && Double.valueOf(number) > 0) {
+ insertStockByMaterialAndDepot(depotId, id, parseBigDecimalEx(number));
+ }
+ }
+ }
+ }
logService.insertLog("商品",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){
@@ -296,21 +348,127 @@ public class MaterialService {
}
return resList;
}
+
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
- public BaseResponseInfo importExcel(List mList) throws Exception {
+ public BaseResponseInfo importExcel(Sheet src) throws Exception {
+ List depotList= depotService.getDepot();
+ int depotCount = depotList.size();
+ List mList = new ArrayList();
+ for (int i = 2; i < src.getRows(); i++) {
+ String name = ExcelUtils.getContent(src, i, 0); //名称
+ String model = ExcelUtils.getContent(src, i, 1); //型号
+ String categoryName = ExcelUtils.getContent(src, i, 2); //类型
+ String safetyStock = ExcelUtils.getContent(src, i, 3); //安全存量
+ String color = ExcelUtils.getContent(src, i, 4); //颜色
+ String unit = ExcelUtils.getContent(src, i, 5); //单位
+ //校验名称、型号、单位是否为空
+ if(StringUtil.isNotEmpty(name) && StringUtil.isNotEmpty(model) && StringUtil.isNotEmpty(unit)) {
+ MaterialWithInitStock m = new MaterialWithInitStock();
+ m.setName(name);
+ m.setModel(model);
+ Long categoryId = materialCategoryService.getCategoryIdByName(categoryName);
+ m.setCategoryid(categoryId);
+ m.setSafetystock(parseBigDecimalEx(safetyStock));
+ m.setColor(color);
+ String manyUnit = ExcelUtils.getContent(src, i, 6); //多单位
+ String ratio = ExcelUtils.getContent(src, i, 7); //比例
+ String retailPrice = ExcelUtils.getContent(src, i, 8); //零售价
+ String lowPrice = ExcelUtils.getContent(src, i, 9); //最低售价
+ String presetpriceone = ExcelUtils.getContent(src, i, 10); //预计采购价
+ String presetpricetwo = ExcelUtils.getContent(src, i, 11); //销售价
+ if(StringUtil.isNotEmpty(manyUnit.trim())){ //多单位
+ String manyUnitAll = unit + "," + manyUnit + "(1:" + ratio + ")";
+ Long unitId = unitService.getUnitIdByName(manyUnitAll);
+ m.setUnitid(unitId);
+ m.setFirstoutunit(unit); //首选出库单位
+ m.setFirstinunit(manyUnit); //首选入库单位
+ JSONArray arr = new JSONArray();
+ JSONObject basicObj = new JSONObject();
+ basicObj.put("Unit", unit);
+ basicObj.put("RetailPrice", retailPrice);
+ basicObj.put("LowPrice", lowPrice);
+ basicObj.put("PresetPriceOne", presetpriceone);
+ basicObj.put("PresetPriceTwo", presetpricetwo);
+ JSONObject basicObjEx = new JSONObject();
+ basicObjEx.put("basic", basicObj);
+ JSONObject otherObj = new JSONObject();
+ otherObj.put("Unit", manyUnit);
+ otherObj.put("RetailPrice", parsePrice(retailPrice,ratio));
+ otherObj.put("LowPrice", parsePrice(lowPrice,ratio));
+ otherObj.put("PresetPriceOne", parsePrice(presetpriceone,ratio));
+ otherObj.put("PresetPriceTwo", parsePrice(presetpricetwo,ratio));
+ JSONObject otherObjEx = new JSONObject();
+ otherObjEx.put("other", otherObj);
+ arr.add(basicObjEx);
+ arr.add(otherObjEx);
+ m.setPricestrategy(arr.toJSONString());
+ } else {
+ m.setUnit(unit);
+ m.setRetailprice(parseBigDecimalEx(retailPrice));
+ m.setLowprice(parseBigDecimalEx(lowPrice));
+ m.setPresetpriceone(parseBigDecimalEx(presetpriceone));
+ m.setPresetpricetwo(parseBigDecimalEx(presetpricetwo));
+ }
+ String enabled = ExcelUtils.getContent(src, i, 12); //状态
+ m.setEnabled(enabled.equals("1")? true: false);
+ //缓存各个仓库的库存信息
+ Map stockMap = new HashMap();
+ for(int j=1; j<=depotCount;j++) {
+ int col = 12+j;
+ if(col <= src.getColumns()){
+ String depotName = ExcelUtils.getContent(src, 1, col); //获取仓库名称
+ Long depotId = depotService.getIdByName(depotName);
+ if(depotId!=0L){
+ String stockStr = ExcelUtils.getContent(src, i, col);
+ if(StringUtil.isNotEmpty(stockStr)) {
+ stockMap.put(depotId, parseBigDecimalEx(stockStr));
+ }
+ }
+ }
+ }
+ m.setStockMap(stockMap);
+ mList.add(m);
+ }
+ }
logService.insertLog("商品",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_IMPORT).append(mList.size()).append(BusinessConstants.LOG_DATA_UNIT).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
BaseResponseInfo info = new BaseResponseInfo();
Map data = new HashMap();
try {
- for(Material m: mList) {
- materialMapper.insertSelective(m);
+ Long mId = 0L;
+ for(MaterialWithInitStock m: mList) {
+ //判断该商品是否存在,如果不存在就新增,如果存在就更新
+ List materials = getMaterialListByParam(m.getName(),m.getModel(),m.getColor(),m.getStandard(),
+ m.getMfrs(),m.getUnit(),m.getUnitid());
+ if(materials.size()<=0) {
+ materialMapperEx.insertSelectiveEx(m);
+ mId = m.getId();
+ } else {
+ mId = materials.get(0).getId();
+ String materialJson = JSON.toJSONString(m);
+ Material material = JSONObject.parseObject(materialJson, Material.class);
+ material.setId(mId);
+ materialMapper.updateByPrimaryKeySelective(material);
+ }
+ //给商品初始化库存
+ Map stockMap = m.getStockMap();
+ Long depotId = null;
+ for(Depot depot: depotList){
+ BigDecimal stock = stockMap.get(depot.getId());
+ //先清除再插入
+ MaterialStockExample example = new MaterialStockExample();
+ example.createCriteria().andMaterialIdEqualTo(mId).andDepotIdEqualTo(depot.getId());
+ materialStockMapper.deleteByExample(example);
+ if(stock!=null && stock.compareTo(BigDecimal.ZERO)!=0) {
+ depotId = depot.getId();
+ insertStockByMaterialAndDepot(depotId, mId, stock);
+ }
+ }
}
info.code = 200;
data.put("message", "成功");
} catch (Exception e) {
- JshException.writeFail(logger, e);
e.printStackTrace();
info.code = 500;
data.put("message", e.getMessage());
@@ -319,6 +477,57 @@ public class MaterialService {
return info;
}
+ /**
+ * 根据条件返回产品列表
+ * @param name
+ * @param model
+ * @param color
+ * @param standard
+ * @param mfrs
+ * @param unit
+ * @param unitId
+ * @return
+ */
+ private List getMaterialListByParam(String name, String model, String color,
+ String standard, String mfrs, String unit, Long unitId) {
+ MaterialExample example = new MaterialExample();
+ MaterialExample.Criteria criteria = example.createCriteria();
+ criteria.andNameEqualTo(name).andModelEqualTo(model);
+ if (StringUtil.isNotEmpty(color)) {
+ criteria.andColorEqualTo(color);
+ }
+ if (StringUtil.isNotEmpty(standard)) {
+ criteria.andStandardEqualTo(standard);
+ }
+ if (StringUtil.isNotEmpty(mfrs)) {
+ criteria.andMfrsEqualTo(mfrs);
+ }
+ if (StringUtil.isNotEmpty(unit)) {
+ criteria.andUnitEqualTo(unit);
+ }
+ if (unitId !=null) {
+ criteria.andUnitidEqualTo(unitId);
+ }
+ criteria.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+ List list = materialMapper.selectByExample(example);
+ return list;
+ }
+
+ /**
+ * 写入初始库存
+ * @param depotId
+ * @param mId
+ * @param stock
+ */
+ @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+ public void insertStockByMaterialAndDepot(Long depotId, Long mId, BigDecimal stock){
+ MaterialStock materialStock = new MaterialStock();
+ materialStock.setDepotId(depotId);
+ materialStock.setMaterialId(mId);
+ materialStock.setNumber(stock);
+ materialStockMapper.insertSelective(materialStock); //存入初始库存
+ }
+
public List getMaterialEnableSerialNumberList(Map parameterMap)throws Exception {
List list =null;
try{
@@ -387,4 +596,66 @@ public class MaterialService {
return deleteTotal;
}
+
+ public BigDecimal parseBigDecimalEx(String str) throws Exception{
+ if(!StringUtil.isEmpty(str)) {
+ return new BigDecimal(str);
+ } else {
+ return null;
+ }
+ }
+
+ public BigDecimal parsePrice(String price, String ratio) throws Exception{
+ if(StringUtil.isEmpty(price) || StringUtil.isEmpty(ratio)) {
+ return BigDecimal.ZERO;
+ } else {
+ BigDecimal pr=new BigDecimal(price);
+ BigDecimal r=new BigDecimal(ratio);
+ return pr.multiply(r);
+ }
+ }
+
+ /**
+ * 根据产品和仓库获取初始库存
+ * @param materialId
+ * @param depotId
+ * @return
+ */
+ public BigDecimal getInitStock(Long materialId, Long depotId) {
+ BigDecimal stock = BigDecimal.ZERO;
+ MaterialStockExample example = new MaterialStockExample();
+ example.createCriteria().andMaterialIdEqualTo(materialId).andDepotIdEqualTo(depotId)
+ .andDeleteFagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+ List list = materialStockMapper.selectByExample(example);
+ if(list!=null && list.size()>0) {
+ stock = list.get(0).getNumber();
+ }
+ return stock;
+ }
+
+ /**
+ * 根据产品获取初始库存
+ * @param materialId
+ * @return
+ */
+ public BigDecimal getInitStockByMid(Long depotId, Long materialId) {
+ BigDecimal stock = BigDecimal.ZERO;
+ MaterialStockExample example = new MaterialStockExample();
+ if(depotId!=null) {
+ example.createCriteria().andMaterialIdEqualTo(materialId).andDepotIdEqualTo(depotId)
+ .andDeleteFagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+ } else {
+ example.createCriteria().andMaterialIdEqualTo(materialId)
+ .andDeleteFagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+ }
+ List list = materialStockMapper.selectByExample(example);
+ if(list!=null && list.size()>0) {
+ for(MaterialStock ms: list) {
+ if(ms!=null) {
+ stock = stock.add(ms.getNumber());
+ }
+ }
+ }
+ return stock;
+ }
}
diff --git a/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java b/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java
index 56bb21b9..0b6b96ea 100644
--- a/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java
+++ b/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java
@@ -388,4 +388,19 @@ public class MaterialCategoryService {
deleteTotal= batchDeleteMaterialCategoryByIds(ids);
return deleteTotal;
}
+
+ /**
+ * 根据名称获取类型
+ * @param name
+ */
+ public Long getCategoryIdByName(String name){
+ Long categoryId = 0l;
+ MaterialCategoryExample example = new MaterialCategoryExample();
+ example.createCriteria().andNameEqualTo(name).andStatusNotEqualTo(BusinessConstants.DELETE_TYPE_FORCE);
+ List list = materialCategoryMapper.selectByExample(example);
+ if(list!=null && list.size()>0) {
+ categoryId = list.get(0).getId();
+ }
+ return categoryId;
+ }
}
diff --git a/src/main/java/com/jsh/erp/service/unit/UnitService.java b/src/main/java/com/jsh/erp/service/unit/UnitService.java
index 74ed75b1..5c9c5362 100644
--- a/src/main/java/com/jsh/erp/service/unit/UnitService.java
+++ b/src/main/java/com/jsh/erp/service/unit/UnitService.java
@@ -208,4 +208,19 @@ public class UnitService {
deleteTotal= batchDeleteUnitByIds(ids);
return deleteTotal;
}
+
+ /**
+ * 根据名称获取类型
+ * @param name
+ */
+ public Long getUnitIdByName(String name){
+ Long unitId = 0l;
+ UnitExample example = new UnitExample();
+ example.createCriteria().andUnameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+ List list = unitMapper.selectByExample(example);
+ if(list!=null && list.size()>0) {
+ unitId = list.get(0).getId();
+ }
+ return unitId;
+ }
}
diff --git a/src/main/resources/mapper_xml/MaterialMapperEx.xml b/src/main/resources/mapper_xml/MaterialMapperEx.xml
index 1ff82b5d..5731c1b5 100644
--- a/src/main/resources/mapper_xml/MaterialMapperEx.xml
+++ b/src/main/resources/mapper_xml/MaterialMapperEx.xml
@@ -174,5 +174,168 @@
and ifnull(delete_Flag,'0') !='1'
-
+
+ insert into jsh_material
+
+
+ Id,
+
+
+ CategoryId,
+
+
+ Name,
+
+
+ Mfrs,
+
+
+ Packing,
+
+
+ SafetyStock,
+
+
+ Model,
+
+
+ Standard,
+
+
+ Color,
+
+
+ Unit,
+
+
+ Remark,
+
+
+ RetailPrice,
+
+
+ LowPrice,
+
+
+ PresetPriceOne,
+
+
+ PresetPriceTwo,
+
+
+ UnitId,
+
+
+ FirstOutUnit,
+
+
+ FirstInUnit,
+
+
+ PriceStrategy,
+
+
+ Enabled,
+
+
+ OtherField1,
+
+
+ OtherField2,
+
+
+ OtherField3,
+
+
+ enableSerialNumber,
+
+
+ tenant_id,
+
+
+ delete_Flag,
+
+
+
+
+ #{id,jdbcType=BIGINT},
+
+
+ #{categoryid,jdbcType=BIGINT},
+
+
+ #{name,jdbcType=VARCHAR},
+
+
+ #{mfrs,jdbcType=VARCHAR},
+
+
+ #{packing,jdbcType=DECIMAL},
+
+
+ #{safetystock,jdbcType=DECIMAL},
+
+
+ #{model,jdbcType=VARCHAR},
+
+
+ #{standard,jdbcType=VARCHAR},
+
+
+ #{color,jdbcType=VARCHAR},
+
+
+ #{unit,jdbcType=VARCHAR},
+
+
+ #{remark,jdbcType=VARCHAR},
+
+
+ #{retailprice,jdbcType=DECIMAL},
+
+
+ #{lowprice,jdbcType=DECIMAL},
+
+
+ #{presetpriceone,jdbcType=DECIMAL},
+
+
+ #{presetpricetwo,jdbcType=DECIMAL},
+
+
+ #{unitid,jdbcType=BIGINT},
+
+
+ #{firstoutunit,jdbcType=VARCHAR},
+
+
+ #{firstinunit,jdbcType=VARCHAR},
+
+
+ #{pricestrategy,jdbcType=VARCHAR},
+
+
+ #{enabled,jdbcType=BIT},
+
+
+ #{otherfield1,jdbcType=VARCHAR},
+
+
+ #{otherfield2,jdbcType=VARCHAR},
+
+
+ #{otherfield3,jdbcType=VARCHAR},
+
+
+ #{enableserialnumber,jdbcType=VARCHAR},
+
+
+ #{tenantId,jdbcType=BIGINT},
+
+
+ #{deleteFlag,jdbcType=VARCHAR},
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper_xml/MaterialStockMapper.xml b/src/main/resources/mapper_xml/MaterialStockMapper.xml
new file mode 100644
index 00000000..9adad88c
--- /dev/null
+++ b/src/main/resources/mapper_xml/MaterialStockMapper.xml
@@ -0,0 +1,288 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ and ${criterion.condition}
+
+
+ and ${criterion.condition} #{criterion.value}
+
+
+ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+
+
+ and ${criterion.condition}
+
+ #{listItem}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ and ${criterion.condition}
+
+
+ and ${criterion.condition} #{criterion.value}
+
+
+ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+
+
+ and ${criterion.condition}
+
+ #{listItem}
+
+
+
+
+
+
+
+
+
+
+
+ id, material_id, depot_id, number, tenant_id, delete_fag
+
+
+
+
+
+ delete from jsh_material_stock
+ where id = #{id,jdbcType=BIGINT}
+
+
+
+ delete from jsh_material_stock
+
+
+
+
+
+
+ insert into jsh_material_stock (id, material_id, depot_id,
+ number, tenant_id, delete_fag
+ )
+ values (#{id,jdbcType=BIGINT}, #{materialId,jdbcType=BIGINT}, #{depotId,jdbcType=BIGINT},
+ #{number,jdbcType=DECIMAL}, #{tenantId,jdbcType=BIGINT}, #{deleteFag,jdbcType=VARCHAR}
+ )
+
+
+
+ insert into jsh_material_stock
+
+
+ id,
+
+
+ material_id,
+
+
+ depot_id,
+
+
+ number,
+
+
+ tenant_id,
+
+
+ delete_fag,
+
+
+
+
+ #{id,jdbcType=BIGINT},
+
+
+ #{materialId,jdbcType=BIGINT},
+
+
+ #{depotId,jdbcType=BIGINT},
+
+
+ #{number,jdbcType=DECIMAL},
+
+
+ #{tenantId,jdbcType=BIGINT},
+
+
+ #{deleteFag,jdbcType=VARCHAR},
+
+
+
+
+
+
+ update jsh_material_stock
+
+
+ id = #{record.id,jdbcType=BIGINT},
+
+
+ material_id = #{record.materialId,jdbcType=BIGINT},
+
+
+ depot_id = #{record.depotId,jdbcType=BIGINT},
+
+
+ number = #{record.number,jdbcType=DECIMAL},
+
+
+ tenant_id = #{record.tenantId,jdbcType=BIGINT},
+
+
+ delete_fag = #{record.deleteFag,jdbcType=VARCHAR},
+
+
+
+
+
+
+
+
+ update jsh_material_stock
+ set id = #{record.id,jdbcType=BIGINT},
+ material_id = #{record.materialId,jdbcType=BIGINT},
+ depot_id = #{record.depotId,jdbcType=BIGINT},
+ number = #{record.number,jdbcType=DECIMAL},
+ tenant_id = #{record.tenantId,jdbcType=BIGINT},
+ delete_fag = #{record.deleteFag,jdbcType=VARCHAR}
+
+
+
+
+
+
+ update jsh_material_stock
+
+
+ material_id = #{materialId,jdbcType=BIGINT},
+
+
+ depot_id = #{depotId,jdbcType=BIGINT},
+
+
+ number = #{number,jdbcType=DECIMAL},
+
+
+ tenant_id = #{tenantId,jdbcType=BIGINT},
+
+
+ delete_fag = #{deleteFag,jdbcType=VARCHAR},
+
+
+ where id = #{id,jdbcType=BIGINT}
+
+
+
+ update jsh_material_stock
+ set material_id = #{materialId,jdbcType=BIGINT},
+ depot_id = #{depotId,jdbcType=BIGINT},
+ number = #{number,jdbcType=DECIMAL},
+ tenant_id = #{tenantId,jdbcType=BIGINT},
+ delete_fag = #{deleteFag,jdbcType=VARCHAR}
+ where id = #{id,jdbcType=BIGINT}
+
+
\ No newline at end of file
diff --git a/src/test/resources/generatorConfig.xml b/src/test/resources/generatorConfig.xml
index cc8718a2..868b1080 100644
--- a/src/test/resources/generatorConfig.xml
+++ b/src/test/resources/generatorConfig.xml
@@ -51,6 +51,7 @@
+