Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
654a246d
Commit
654a246d
authored
Aug 30, 2022
by
季圣华
Browse files
完善商品属性接口,支持新增、删除和查询
parent
52bd683c
Changes
10
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/docs/jsh_erp.sql
View file @
654a246d
...
...
@@ -437,7 +437,6 @@ INSERT INTO `jsh_material` VALUES ('619', null, '衣服', null, null, null, null
DROP
TABLE
IF
EXISTS
`jsh_material_attribute`
;
CREATE
TABLE
`jsh_material_attribute`
(
`id`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
,
`attribute_field`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'属性字段'
,
`attribute_name`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'属性名'
,
`attribute_value`
varchar
(
500
)
DEFAULT
NULL
COMMENT
'属性值'
,
`tenant_id`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'租户id'
,
...
...
@@ -448,11 +447,11 @@ CREATE TABLE `jsh_material_attribute` (
-- ----------------------------
-- Records of jsh_material_attribute
-- ----------------------------
INSERT
INTO
`jsh_material_attribute`
VALUES
(
'1'
,
'manyColor'
,
'多颜色'
,
'红色|橙色|黄色|绿色|蓝色|紫色'
,
'63'
,
'0'
);
INSERT
INTO
`jsh_material_attribute`
VALUES
(
'2'
,
'manySize'
,
'多尺寸'
,
'S|M|L|XL|XXL|XXXL'
,
'63'
,
'0'
);
INSERT
INTO
`jsh_material_attribute`
VALUES
(
'3'
,
'other1'
,
'自定义1'
,
'小米|华为'
,
'63'
,
'0'
);
INSERT
INTO
`jsh_material_attribute`
VALUES
(
'4'
,
'other2'
,
'自定义2'
,
null
,
'63'
,
'0'
);
INSERT
INTO
`jsh_material_attribute`
VALUES
(
'5'
,
'other3'
,
'自定义3'
,
null
,
'63'
,
'0'
);
INSERT
INTO
`jsh_material_attribute`
VALUES
(
'1'
,
'多颜色'
,
'红色|橙色|黄色|绿色|蓝色|紫色'
,
'63'
,
'0'
);
INSERT
INTO
`jsh_material_attribute`
VALUES
(
'2'
,
'多尺寸'
,
'S|M|L|XL|XXL|XXXL'
,
'63'
,
'0'
);
INSERT
INTO
`jsh_material_attribute`
VALUES
(
'3'
,
'自定义1'
,
'小米|华为'
,
'63'
,
'0'
);
INSERT
INTO
`jsh_material_attribute`
VALUES
(
'4'
,
'自定义2'
,
null
,
'63'
,
'0'
);
INSERT
INTO
`jsh_material_attribute`
VALUES
(
'5'
,
'自定义3'
,
null
,
'63'
,
'0'
);
-- ----------------------------
-- Table structure for jsh_material_category
...
...
jshERP-boot/docs/华夏ERP数据库设计汇总.xlsx
View file @
654a246d
No preview for this file type
jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt
View file @
654a246d
...
...
@@ -1392,4 +1392,11 @@ alter table jsh_person add sort varchar(10) DEFAULT NULL COMMENT '排序' after
update jsh_person set enabled=1;
alter table jsh_role add enabled bit(1) DEFAULT NULL COMMENT '启用' after description;
alter table jsh_role add sort varchar(10) DEFAULT NULL COMMENT '排序' after enabled;
update jsh_role set enabled=1;
\ No newline at end of file
update jsh_role set enabled=1;
-- --------------------------------------------------------
-- 时间 2022年08月30日
-- by jishenghua
-- 给产品属性表移除属性字段
-- --------------------------------------------------------
alter table jsh_material_attribute drop column attribute_field;
\ No newline at end of file
jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/MaterialAttribute.java
View file @
654a246d
...
...
@@ -3,8 +3,6 @@ package com.jsh.erp.datasource.entities;
public
class
MaterialAttribute
{
private
Long
id
;
private
String
attributeField
;
private
String
attributeName
;
private
String
attributeValue
;
...
...
@@ -21,14 +19,6 @@ public class MaterialAttribute {
this
.
id
=
id
;
}
public
String
getAttributeField
()
{
return
attributeField
;
}
public
void
setAttributeField
(
String
attributeField
)
{
this
.
attributeField
=
attributeField
==
null
?
null
:
attributeField
.
trim
();
}
public
String
getAttributeName
()
{
return
attributeName
;
}
...
...
jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/MaterialAttributeExample.java
View file @
654a246d
...
...
@@ -164,76 +164,6 @@ public class MaterialAttributeExample {
return
(
Criteria
)
this
;
}
public
Criteria
andAttributeFieldIsNull
()
{
addCriterion
(
"attribute_field is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAttributeFieldIsNotNull
()
{
addCriterion
(
"attribute_field is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAttributeFieldEqualTo
(
String
value
)
{
addCriterion
(
"attribute_field ="
,
value
,
"attributeField"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAttributeFieldNotEqualTo
(
String
value
)
{
addCriterion
(
"attribute_field <>"
,
value
,
"attributeField"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAttributeFieldGreaterThan
(
String
value
)
{
addCriterion
(
"attribute_field >"
,
value
,
"attributeField"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAttributeFieldGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"attribute_field >="
,
value
,
"attributeField"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAttributeFieldLessThan
(
String
value
)
{
addCriterion
(
"attribute_field <"
,
value
,
"attributeField"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAttributeFieldLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"attribute_field <="
,
value
,
"attributeField"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAttributeFieldLike
(
String
value
)
{
addCriterion
(
"attribute_field like"
,
value
,
"attributeField"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAttributeFieldNotLike
(
String
value
)
{
addCriterion
(
"attribute_field not like"
,
value
,
"attributeField"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAttributeFieldIn
(
List
<
String
>
values
)
{
addCriterion
(
"attribute_field in"
,
values
,
"attributeField"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAttributeFieldNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"attribute_field not in"
,
values
,
"attributeField"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAttributeFieldBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"attribute_field between"
,
value1
,
value2
,
"attributeField"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAttributeFieldNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"attribute_field not between"
,
value1
,
value2
,
"attributeField"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAttributeNameIsNull
()
{
addCriterion
(
"attribute_name is null"
);
return
(
Criteria
)
this
;
...
...
jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/MaterialAttributeMapperEx.java
View file @
654a246d
...
...
@@ -8,7 +8,7 @@ import java.util.List;
public
interface
MaterialAttributeMapperEx
{
List
<
MaterialAttribute
>
selectByConditionMaterialAttribute
(
@Param
(
"attribute
Field
"
)
String
attribute
Field
,
@Param
(
"attribute
Name
"
)
String
attribute
Name
,
@Param
(
"offset"
)
Integer
offset
,
@Param
(
"rows"
)
Integer
rows
);
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/materialAttribute/MaterialAttributeComponent.java
View file @
654a246d
...
...
@@ -31,8 +31,8 @@ public class MaterialAttributeComponent implements ICommonQuery {
private
List
<?>
getMaterialList
(
Map
<
String
,
String
>
map
)
throws
Exception
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
attribute
Field
=
StringUtil
.
getInfo
(
search
,
"attribute
Field
"
);
return
materialAttributeService
.
select
(
attribute
Field
,
QueryUtils
.
offset
(
map
),
QueryUtils
.
rows
(
map
));
String
attribute
Name
=
StringUtil
.
getInfo
(
search
,
"attribute
Name
"
);
return
materialAttributeService
.
select
(
attribute
Name
,
QueryUtils
.
offset
(
map
),
QueryUtils
.
rows
(
map
));
}
@Override
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/materialAttribute/MaterialAttributeService.java
View file @
654a246d
...
...
@@ -49,6 +49,7 @@ public class MaterialAttributeService {
public
List
<
MaterialAttribute
>
getMaterialAttribute
()
throws
Exception
{
MaterialAttributeExample
example
=
new
MaterialAttributeExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"id desc"
);
List
<
MaterialAttribute
>
list
=
null
;
try
{
list
=
materialAttributeMapper
.
selectByExample
(
example
);
...
...
@@ -58,31 +59,11 @@ public class MaterialAttributeService {
return
list
;
}
public
List
<
MaterialAttribute
>
select
(
String
attribute
Field
,
int
offset
,
int
rows
)
public
List
<
MaterialAttribute
>
select
(
String
attribute
Name
,
int
offset
,
int
rows
)
throws
Exception
{
String
[]
arr
=
{
"manyColor"
,
"manySize"
,
"other1"
,
"other2"
,
"other3"
};
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"manyColor"
,
"多颜色"
);
map
.
put
(
"manySize"
,
"多尺寸"
);
map
.
put
(
"other1"
,
"自定义1"
);
map
.
put
(
"other2"
,
"自定义2"
);
map
.
put
(
"other3"
,
"自定义3"
);
List
<
MaterialAttribute
>
list
=
new
ArrayList
<>();
try
{
List
<
MaterialAttribute
>
maList
=
materialAttributeMapperEx
.
selectByConditionMaterialAttribute
(
attributeField
,
offset
,
rows
);
for
(
String
field:
arr
)
{
MaterialAttribute
materialAttribute
=
new
MaterialAttribute
();
materialAttribute
.
setAttributeField
(
field
);
materialAttribute
.
setAttributeName
(
map
.
get
(
field
));
for
(
MaterialAttribute
ma:
maList
)
{
if
(
field
.
equals
(
ma
.
getAttributeField
())){
materialAttribute
.
setId
(
ma
.
getId
());
materialAttribute
.
setAttributeName
(
ma
.
getAttributeName
());
materialAttribute
.
setAttributeValue
(
ma
.
getAttributeValue
());
}
}
list
.
add
(
materialAttribute
);
}
list
=
materialAttributeMapperEx
.
selectByConditionMaterialAttribute
(
attributeName
,
offset
,
rows
);
}
catch
(
Exception
e
){
JshException
.
readFail
(
logger
,
e
);
}
...
...
jshERP-boot/src/main/resources/mapper_xml/MaterialAttributeMapper.xml
View file @
654a246d
...
...
@@ -3,7 +3,6 @@
<mapper
namespace=
"com.jsh.erp.datasource.mappers.MaterialAttributeMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.jsh.erp.datasource.entities.MaterialAttribute"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"attribute_field"
jdbcType=
"VARCHAR"
property=
"attributeField"
/>
<result
column=
"attribute_name"
jdbcType=
"VARCHAR"
property=
"attributeName"
/>
<result
column=
"attribute_value"
jdbcType=
"VARCHAR"
property=
"attributeValue"
/>
<result
column=
"tenant_id"
jdbcType=
"BIGINT"
property=
"tenantId"
/>
...
...
@@ -68,7 +67,7 @@
</where>
</sql>
<sql
id=
"Base_Column_List"
>
id,
attribute_field,
attribute_name, attribute_value, tenant_id, delete_flag
id, attribute_name, attribute_value, tenant_id, delete_flag
</sql>
<select
id=
"selectByExample"
parameterType=
"com.jsh.erp.datasource.entities.MaterialAttributeExample"
resultMap=
"BaseResultMap"
>
select
...
...
@@ -101,12 +100,10 @@
</if>
</delete>
<insert
id=
"insert"
parameterType=
"com.jsh.erp.datasource.entities.MaterialAttribute"
>
insert into jsh_material_attribute (id, attribute_field, attribute_name,
attribute_value, tenant_id, delete_flag
)
values (#{id,jdbcType=BIGINT}, #{attributeField,jdbcType=VARCHAR}, #{attributeName,jdbcType=VARCHAR},
#{attributeValue,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
)
insert into jsh_material_attribute (id, attribute_name, attribute_value,
tenant_id, delete_flag)
values (#{id,jdbcType=BIGINT}, #{attributeName,jdbcType=VARCHAR}, #{attributeValue,jdbcType=VARCHAR},
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.jsh.erp.datasource.entities.MaterialAttribute"
>
insert into jsh_material_attribute
...
...
@@ -114,9 +111,6 @@
<if
test=
"id != null"
>
id,
</if>
<if
test=
"attributeField != null"
>
attribute_field,
</if>
<if
test=
"attributeName != null"
>
attribute_name,
</if>
...
...
@@ -134,9 +128,6 @@
<if
test=
"id != null"
>
#{id,jdbcType=BIGINT},
</if>
<if
test=
"attributeField != null"
>
#{attributeField,jdbcType=VARCHAR},
</if>
<if
test=
"attributeName != null"
>
#{attributeName,jdbcType=VARCHAR},
</if>
...
...
@@ -163,9 +154,6 @@
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=BIGINT},
</if>
<if
test=
"record.attributeField != null"
>
attribute_field = #{record.attributeField,jdbcType=VARCHAR},
</if>
<if
test=
"record.attributeName != null"
>
attribute_name = #{record.attributeName,jdbcType=VARCHAR},
</if>
...
...
@@ -186,7 +174,6 @@
<update
id=
"updateByExample"
parameterType=
"map"
>
update jsh_material_attribute
set id = #{record.id,jdbcType=BIGINT},
attribute_field = #{record.attributeField,jdbcType=VARCHAR},
attribute_name = #{record.attributeName,jdbcType=VARCHAR},
attribute_value = #{record.attributeValue,jdbcType=VARCHAR},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
...
...
@@ -198,9 +185,6 @@
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.jsh.erp.datasource.entities.MaterialAttribute"
>
update jsh_material_attribute
<set>
<if
test=
"attributeField != null"
>
attribute_field = #{attributeField,jdbcType=VARCHAR},
</if>
<if
test=
"attributeName != null"
>
attribute_name = #{attributeName,jdbcType=VARCHAR},
</if>
...
...
@@ -218,8 +202,7 @@
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.jsh.erp.datasource.entities.MaterialAttribute"
>
update jsh_material_attribute
set attribute_field = #{attributeField,jdbcType=VARCHAR},
attribute_name = #{attributeName,jdbcType=VARCHAR},
set attribute_name = #{attributeName,jdbcType=VARCHAR},
attribute_value = #{attributeValue,jdbcType=VARCHAR},
tenant_id = #{tenantId,jdbcType=BIGINT},
delete_flag = #{deleteFlag,jdbcType=VARCHAR}
...
...
jshERP-boot/src/main/resources/mapper_xml/MaterialAttributeMapperEx.xml
View file @
654a246d
...
...
@@ -5,8 +5,9 @@
<select
id=
"selectByConditionMaterialAttribute"
resultType=
"com.jsh.erp.datasource.entities.MaterialAttribute"
>
select * from jsh_material_attribute ma
where 1=1
<if
test=
"attributeField != null"
>
and ma.attribute_field = #{attributeField}
<if
test=
"attributeName != null"
>
<bind
name=
"bindAttributeName"
value=
"'%'+attributeName+'%'"
/>
and ma.attribute_name like #{bindAttributeName}
</if>
and ifnull(ma.delete_flag,'0') !='1'
order by ma.id desc
...
...
@@ -18,8 +19,9 @@
<select
id=
"countsByMaterialAttribute"
resultType=
"java.lang.Long"
>
SELECT count(ma.id) from jsh_material_attribute ma
where 1=1
<if
test=
"attributeField != null"
>
and ma.attribute_field = #{attributeField}
<if
test=
"attributeName != null"
>
<bind
name=
"bindAttributeName"
value=
"'%'+attributeName+'%'"
/>
and ma.attribute_name like #{bindAttributeName}
</if>
and ifnull(ma.delete_flag,'0') !='1'
</select>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment