给商品增加图片上传功能

This commit is contained in:
季圣华
2021-07-02 00:51:54 +08:00
parent 3d32e3ae88
commit 9af01678a7
7 changed files with 123 additions and 23 deletions

View File

@@ -10,7 +10,7 @@ Target Server Type : MYSQL
Target Server Version : 50704
File Encoding : 65001
Date: 2021-06-30 01:09:37
Date: 2021-07-02 00:26:31
*/
SET FOREIGN_KEY_CHECKS=0;
@@ -411,6 +411,7 @@ CREATE TABLE `jsh_material` (
`color` varchar(50) DEFAULT NULL COMMENT '颜色',
`unit` varchar(50) DEFAULT NULL COMMENT '单位-单个',
`remark` varchar(100) DEFAULT NULL COMMENT '备注',
`img_name` varchar(500) DEFAULT NULL COMMENT '图片名称',
`unit_id` bigint(20) DEFAULT NULL COMMENT '计量单位Id',
`enabled` bit(1) DEFAULT NULL COMMENT '启用 0-禁用 1-启用',
`other_field1` varchar(50) DEFAULT NULL COMMENT '自定义1',
@@ -427,14 +428,14 @@ CREATE TABLE `jsh_material` (
-- ----------------------------
-- Records of jsh_material
-- ----------------------------
INSERT INTO `jsh_material` VALUES ('568', '17', '商品1', '制1', '100.000000', 'sp1', '', '', '', '', null, '', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('569', '17', '商品2', '', '200.000000', 'sp2', '', '', '', '', null, '', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('570', '17', '商品3', '', '300.000000', 'sp3', '', '', '', '', null, '', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('577', null, '商品8', '', null, 'sp8', '', '', '', '', '15', '', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('579', '21', '商品17', '', null, 'sp17', '', '', '', '', '15', '', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('586', '17', '序列号商品测试', '', null, 'xlh123', '', '', '', '', null, '', '', '', '', '1', '63', '0');
INSERT INTO `jsh_material` VALUES ('587', '17', '商品test1', '南通中远', null, '', 'test1', '', '', '', null, '', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('588', '21', '商品200', 'fafda', '112.000000', 'weqwe', '300ml', '红色', '', 'aaaabbbbb', null, '', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('568', '17', '商品1', '制1', '100.000000', 'sp1', '', '', '', '', null, null, '', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('569', '17', '商品2', '', '200.000000', 'sp2', '', '', '', '', null, null, '', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('570', '17', '商品3', '', '300.000000', 'sp3', '', '', '', '', null, null, '', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('577', null, '商品8', '', null, 'sp8', '', '', '', '', null, '15', '', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('579', '21', '商品17', '', null, 'sp17', '', '', '', '', null, '15', '', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('586', '17', '序列号商品测试', '', null, 'xlh123', '', '', '', '', null, null, '', '', '', '', '1', '63', '0');
INSERT INTO `jsh_material` VALUES ('587', '17', '商品test1', '南通中远', null, '', 'test1', '', '', '', null, null, '', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('588', '21', '商品200', 'fafda', '112.000000', 'weqwe', '300ml', '红色', '', 'aaaabbbbb', null, null, '', '', '', '', '0', '63', '0');
-- ----------------------------
-- Table structure for jsh_material_category

View File

@@ -1111,4 +1111,11 @@ alter table jsh_account_item add need_debt decimal(24,6) DEFAULT NULL COMMENT '
alter table jsh_account_item add finish_debt decimal(24,6) DEFAULT NULL COMMENT '已收欠款' after need_debt;
alter table jsh_depot_head add file_name varchar(500) DEFAULT NULL COMMENT '附件名称' after remark;
alter table jsh_account_head add file_name varchar(500) DEFAULT NULL COMMENT '附件名称' after remark;
alter table jsh_account_head add discount_money decimal(24,6) DEFAULT NULL COMMENT '优惠金额' after change_amount;
alter table jsh_account_head add discount_money decimal(24,6) DEFAULT NULL COMMENT '优惠金额' after change_amount;
-- --------------------------------------------------------
-- 时间 2021年7月1日
-- by jishenghua
-- 给商品表增加附件名称字段
-- --------------------------------------------------------
alter table jsh_material add img_name varchar(500) DEFAULT NULL COMMENT '图片名称' after remark;

View File

@@ -23,6 +23,8 @@ public class Material {
private String remark;
private String imgName;
private Long unitId;
private Boolean enabled;
@@ -119,6 +121,14 @@ public class Material {
this.remark = remark == null ? null : remark.trim();
}
public String getImgName() {
return imgName;
}
public void setImgName(String imgName) {
this.imgName = imgName == null ? null : imgName.trim();
}
public Long getUnitId() {
return unitId;
}

View File

@@ -775,6 +775,76 @@ public class MaterialExample {
return (Criteria) this;
}
public Criteria andImgNameIsNull() {
addCriterion("img_name is null");
return (Criteria) this;
}
public Criteria andImgNameIsNotNull() {
addCriterion("img_name is not null");
return (Criteria) this;
}
public Criteria andImgNameEqualTo(String value) {
addCriterion("img_name =", value, "imgName");
return (Criteria) this;
}
public Criteria andImgNameNotEqualTo(String value) {
addCriterion("img_name <>", value, "imgName");
return (Criteria) this;
}
public Criteria andImgNameGreaterThan(String value) {
addCriterion("img_name >", value, "imgName");
return (Criteria) this;
}
public Criteria andImgNameGreaterThanOrEqualTo(String value) {
addCriterion("img_name >=", value, "imgName");
return (Criteria) this;
}
public Criteria andImgNameLessThan(String value) {
addCriterion("img_name <", value, "imgName");
return (Criteria) this;
}
public Criteria andImgNameLessThanOrEqualTo(String value) {
addCriterion("img_name <=", value, "imgName");
return (Criteria) this;
}
public Criteria andImgNameLike(String value) {
addCriterion("img_name like", value, "imgName");
return (Criteria) this;
}
public Criteria andImgNameNotLike(String value) {
addCriterion("img_name not like", value, "imgName");
return (Criteria) this;
}
public Criteria andImgNameIn(List<String> values) {
addCriterion("img_name in", values, "imgName");
return (Criteria) this;
}
public Criteria andImgNameNotIn(List<String> values) {
addCriterion("img_name not in", values, "imgName");
return (Criteria) this;
}
public Criteria andImgNameBetween(String value1, String value2) {
addCriterion("img_name between", value1, value2, "imgName");
return (Criteria) this;
}
public Criteria andImgNameNotBetween(String value1, String value2) {
addCriterion("img_name not between", value1, value2, "imgName");
return (Criteria) this;
}
public Criteria andUnitIdIsNull() {
addCriterion("unit_id is null");
return (Criteria) this;

View File

@@ -18,7 +18,6 @@ import com.jsh.erp.utils.StringUtil;
import com.jsh.erp.utils.Tools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
@@ -50,8 +49,6 @@ public class AccountHeadService {
private LogService logService;
@Resource
private AccountItemMapperEx accountItemMapperEx;
@Value(value="${file.path}")
private String filePath;
public AccountHead getAccountHead(long id) throws Exception {
AccountHead result=null;

View File

@@ -257,6 +257,6 @@ public class AccountItemService {
}
public BigDecimal getEachAmountByBillId(Long billId) {
return accountItemMapperEx.getEachAmountByBillId(billId);
return accountItemMapperEx.getEachAmountByBillId(billId).abs();
}
}

View File

@@ -12,6 +12,7 @@
<result column="color" jdbcType="VARCHAR" property="color" />
<result column="unit" jdbcType="VARCHAR" property="unit" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="img_name" jdbcType="VARCHAR" property="imgName" />
<result column="unit_id" jdbcType="BIGINT" property="unitId" />
<result column="enabled" jdbcType="BIT" property="enabled" />
<result column="other_field1" jdbcType="VARCHAR" property="otherField1" />
@@ -81,7 +82,7 @@
</sql>
<sql id="Base_Column_List">
id, category_id, name, mfrs, safety_stock, model, standard, color, unit, remark,
unit_id, enabled, other_field1, other_field2, other_field3, enable_serial_number,
img_name, unit_id, enabled, other_field1, other_field2, other_field3, enable_serial_number,
tenant_id, delete_flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="BaseResultMap">
@@ -118,17 +119,17 @@
insert into jsh_material (id, category_id, name,
mfrs, safety_stock, model,
standard, color, unit,
remark, unit_id, enabled,
other_field1, other_field2, other_field3,
enable_serial_number, tenant_id, delete_flag
)
remark, img_name, unit_id,
enabled, other_field1, other_field2,
other_field3, enable_serial_number, tenant_id,
delete_flag)
values (#{id,jdbcType=BIGINT}, #{categoryId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{mfrs,jdbcType=VARCHAR}, #{safetyStock,jdbcType=DECIMAL}, #{model,jdbcType=VARCHAR},
#{standard,jdbcType=VARCHAR}, #{color,jdbcType=VARCHAR}, #{unit,jdbcType=VARCHAR},
#{remark,jdbcType=VARCHAR}, #{unitId,jdbcType=BIGINT}, #{enabled,jdbcType=BIT},
#{otherField1,jdbcType=VARCHAR}, #{otherField2,jdbcType=VARCHAR}, #{otherField3,jdbcType=VARCHAR},
#{enableSerialNumber,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
)
#{remark,jdbcType=VARCHAR}, #{imgName,jdbcType=VARCHAR}, #{unitId,jdbcType=BIGINT},
#{enabled,jdbcType=BIT}, #{otherField1,jdbcType=VARCHAR}, #{otherField2,jdbcType=VARCHAR},
#{otherField3,jdbcType=VARCHAR}, #{enableSerialNumber,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT},
#{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Material">
insert into jsh_material
@@ -163,6 +164,9 @@
<if test="remark != null">
remark,
</if>
<if test="imgName != null">
img_name,
</if>
<if test="unitId != null">
unit_id,
</if>
@@ -219,6 +223,9 @@
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="imgName != null">
#{imgName,jdbcType=VARCHAR},
</if>
<if test="unitId != null">
#{unitId,jdbcType=BIGINT},
</if>
@@ -284,6 +291,9 @@
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.imgName != null">
img_name = #{record.imgName,jdbcType=VARCHAR},
</if>
<if test="record.unitId != null">
unit_id = #{record.unitId,jdbcType=BIGINT},
</if>
@@ -325,6 +335,7 @@
color = #{record.color,jdbcType=VARCHAR},
unit = #{record.unit,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
img_name = #{record.imgName,jdbcType=VARCHAR},
unit_id = #{record.unitId,jdbcType=BIGINT},
enabled = #{record.enabled,jdbcType=BIT},
other_field1 = #{record.otherField1,jdbcType=VARCHAR},
@@ -367,6 +378,9 @@
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="imgName != null">
img_name = #{imgName,jdbcType=VARCHAR},
</if>
<if test="unitId != null">
unit_id = #{unitId,jdbcType=BIGINT},
</if>
@@ -405,6 +419,7 @@
color = #{color,jdbcType=VARCHAR},
unit = #{unit,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
img_name = #{imgName,jdbcType=VARCHAR},
unit_id = #{unitId,jdbcType=BIGINT},
enabled = #{enabled,jdbcType=BIT},
other_field1 = #{otherField1,jdbcType=VARCHAR},