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
cce885fd
Commit
cce885fd
authored
Dec 24, 2018
by
季圣华
Browse files
解决商品的bug
parent
c0e43886
Changes
7
Hide whitespace changes
Inline
Side-by-side
erp_web/pages/materials/material.html
View file @
cce885fd
...
@@ -610,8 +610,8 @@
...
@@ -610,8 +610,8 @@
var
str
=
''
;
var
str
=
''
;
var
rowInfo
=
rec
.
id
+
'
AaBb
'
+
rec
.
name
+
'
AaBb
'
+
rec
.
model
+
'
AaBb
'
+
rec
.
color
+
'
AaBb
'
+
rec
.
unit
+
'
AaBb
'
+
rec
.
retailprice
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
.
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
.
category
n
ame
+
'
AaBb
'
+
rec
.
color
+
'
AaBb
'
+
rec
.
packing
+
'
AaBb
'
+
rec
.
safetystock
+
'
AaBb
'
+
rec
.
categoryid
+
'
AaBb
'
+
rec
.
category
N
ame
+
'
AaBb
'
+
rec
.
unitid
+
'
AaBb
'
+
rec
.
unit
n
ame
+
'
AaBb
'
+
rec
.
firstoutunit
+
'
AaBb
'
+
rec
.
firstinunit
+
'
AaBb
'
+
rec
.
unitid
+
'
AaBb
'
+
rec
.
unit
N
ame
+
'
AaBb
'
+
rec
.
firstoutunit
+
'
AaBb
'
+
rec
.
firstinunit
+
'
AaBb
'
+
rec
.
mfrs
+
'
AaBb
'
+
rec
.
otherfield1
+
'
AaBb
'
+
rec
.
otherfield2
+
'
AaBb
'
+
rec
.
otherfield3
;
+
'
AaBb
'
+
rec
.
mfrs
+
'
AaBb
'
+
rec
.
otherfield1
+
'
AaBb
'
+
rec
.
otherfield2
+
'
AaBb
'
+
rec
.
otherfield3
;
str
+=
'
<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editMaterial(
\'
'
+
rowInfo
+
'
\'
);"/>
'
;
str
+=
'
<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editMaterial(
\'
'
+
rowInfo
+
'
\'
);"/>
'
;
str
+=
'
<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteMaterial(
'
+
rec
.
id
+
'
);"/>
'
;
str
+=
'
<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteMaterial(
'
+
rec
.
id
+
'
);"/>
'
;
...
@@ -620,7 +620,7 @@
...
@@ -620,7 +620,7 @@
},
},
{
title
:
'
品名
'
,
field
:
'
name
'
,
width
:
100
},
{
title
:
'
品名
'
,
field
:
'
name
'
,
width
:
100
},
{
title
:
'
型号
'
,
field
:
'
model
'
,
width
:
80
},
{
title
:
'
型号
'
,
field
:
'
model
'
,
width
:
80
},
{
title
:
'
扩展信息
'
,
field
:
'
material
o
ther
'
,
width
:
150
},
{
title
:
'
扩展信息
'
,
field
:
'
material
O
ther
'
,
width
:
150
},
{
title
:
'
单位
'
,
field
:
'
unit
'
,
width
:
60
},
{
title
:
'
单位
'
,
field
:
'
unit
'
,
width
:
60
},
{
title
:
'
安全存量
'
,
field
:
'
safetystock
'
,
width
:
70
},
{
title
:
'
安全存量
'
,
field
:
'
safetystock
'
,
width
:
70
},
{
{
...
@@ -1071,9 +1071,9 @@
...
@@ -1071,9 +1071,9 @@
//表格模板变更
//表格模板变更
$
(
"
.tb-other-info
"
).
html
(
""
);
$
(
"
.tb-other-info
"
).
html
(
""
);
for
(
var
i
=
0
;
i
<
mPropertyList
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
mPropertyList
.
length
;
i
++
)
{
if
(
mPropertyList
[
i
].
native
N
ame
===
"
颜色
"
)
{
if
(
mPropertyList
[
i
].
native
n
ame
===
"
颜色
"
)
{
$
(
"
.tb-other-info
"
).
append
(
trColor
);
$
(
"
.tb-other-info
"
).
append
(
trColor
);
$
(
"
.tr-color td
"
).
first
().
text
(
mPropertyList
[
i
].
another
N
ame
);
$
(
"
.tr-color td
"
).
first
().
text
(
mPropertyList
[
i
].
another
n
ame
);
if
(
mPropertyList
[
i
].
enabled
)
{
if
(
mPropertyList
[
i
].
enabled
)
{
$
(
"
.tr-color
"
).
show
();
$
(
"
.tr-color
"
).
show
();
}
}
...
@@ -1081,9 +1081,9 @@
...
@@ -1081,9 +1081,9 @@
$
(
"
.tr-color
"
).
hide
();
$
(
"
.tr-color
"
).
hide
();
}
}
}
}
if
(
mPropertyList
[
i
].
native
N
ame
===
"
规格
"
)
{
if
(
mPropertyList
[
i
].
native
n
ame
===
"
规格
"
)
{
$
(
"
.tb-other-info
"
).
append
(
trStandard
);
$
(
"
.tb-other-info
"
).
append
(
trStandard
);
$
(
"
.tr-standard td
"
).
first
().
text
(
mPropertyList
[
i
].
another
N
ame
);
$
(
"
.tr-standard td
"
).
first
().
text
(
mPropertyList
[
i
].
another
n
ame
);
if
(
mPropertyList
[
i
].
enabled
)
{
if
(
mPropertyList
[
i
].
enabled
)
{
$
(
"
.tr-standard
"
).
show
();
$
(
"
.tr-standard
"
).
show
();
}
}
...
@@ -1091,9 +1091,9 @@
...
@@ -1091,9 +1091,9 @@
$
(
"
.tr-standard
"
).
hide
();
$
(
"
.tr-standard
"
).
hide
();
}
}
}
}
if
(
mPropertyList
[
i
].
native
N
ame
===
"
制造商
"
)
{
if
(
mPropertyList
[
i
].
native
n
ame
===
"
制造商
"
)
{
$
(
"
.tb-other-info
"
).
append
(
trMfrs
);
$
(
"
.tb-other-info
"
).
append
(
trMfrs
);
$
(
"
.tr-mfrs td
"
).
first
().
text
(
mPropertyList
[
i
].
another
N
ame
);
$
(
"
.tr-mfrs td
"
).
first
().
text
(
mPropertyList
[
i
].
another
n
ame
);
if
(
mPropertyList
[
i
].
enabled
)
{
if
(
mPropertyList
[
i
].
enabled
)
{
$
(
"
.tr-mfrs
"
).
show
();
$
(
"
.tr-mfrs
"
).
show
();
}
}
...
@@ -1101,9 +1101,9 @@
...
@@ -1101,9 +1101,9 @@
$
(
"
.tr-mfrs
"
).
hide
();
$
(
"
.tr-mfrs
"
).
hide
();
}
}
}
}
if
(
mPropertyList
[
i
].
native
N
ame
===
"
自定义1
"
)
{
if
(
mPropertyList
[
i
].
native
n
ame
===
"
自定义1
"
)
{
$
(
"
.tb-other-info
"
).
append
(
trOtherField1
);
$
(
"
.tb-other-info
"
).
append
(
trOtherField1
);
$
(
"
.tr-otherField1 td
"
).
first
().
text
(
mPropertyList
[
i
].
another
N
ame
);
$
(
"
.tr-otherField1 td
"
).
first
().
text
(
mPropertyList
[
i
].
another
n
ame
);
if
(
mPropertyList
[
i
].
enabled
)
{
if
(
mPropertyList
[
i
].
enabled
)
{
$
(
"
.tr-otherField1
"
).
show
();
$
(
"
.tr-otherField1
"
).
show
();
}
}
...
@@ -1111,9 +1111,9 @@
...
@@ -1111,9 +1111,9 @@
$
(
"
.tr-otherField1
"
).
hide
();
$
(
"
.tr-otherField1
"
).
hide
();
}
}
}
}
if
(
mPropertyList
[
i
].
native
N
ame
===
"
自定义2
"
)
{
if
(
mPropertyList
[
i
].
native
n
ame
===
"
自定义2
"
)
{
$
(
"
.tb-other-info
"
).
append
(
trOtherField2
);
$
(
"
.tb-other-info
"
).
append
(
trOtherField2
);
$
(
"
.tr-otherField2 td
"
).
first
().
text
(
mPropertyList
[
i
].
another
N
ame
);
$
(
"
.tr-otherField2 td
"
).
first
().
text
(
mPropertyList
[
i
].
another
n
ame
);
if
(
mPropertyList
[
i
].
enabled
)
{
if
(
mPropertyList
[
i
].
enabled
)
{
$
(
"
.tr-otherField2
"
).
show
();
$
(
"
.tr-otherField2
"
).
show
();
}
}
...
@@ -1121,9 +1121,9 @@
...
@@ -1121,9 +1121,9 @@
$
(
"
.tr-otherField2
"
).
hide
();
$
(
"
.tr-otherField2
"
).
hide
();
}
}
}
}
if
(
mPropertyList
[
i
].
native
N
ame
===
"
自定义3
"
)
{
if
(
mPropertyList
[
i
].
native
n
ame
===
"
自定义3
"
)
{
$
(
"
.tb-other-info
"
).
append
(
trOtherField3
);
$
(
"
.tb-other-info
"
).
append
(
trOtherField3
);
$
(
"
.tr-otherField3 td
"
).
first
().
text
(
mPropertyList
[
i
].
another
N
ame
);
$
(
"
.tr-otherField3 td
"
).
first
().
text
(
mPropertyList
[
i
].
another
n
ame
);
if
(
mPropertyList
[
i
].
enabled
)
{
if
(
mPropertyList
[
i
].
enabled
)
{
$
(
"
.tr-otherField3
"
).
show
();
$
(
"
.tr-otherField3
"
).
show
();
}
}
...
@@ -1373,7 +1373,7 @@
...
@@ -1373,7 +1373,7 @@
$
(
"
#mTypeName
"
).
text
(
categoryName
).
show
();
//类型显示
$
(
"
#mTypeName
"
).
text
(
categoryName
).
show
();
//类型显示
$
(
"
#mTypeChange
"
).
show
();
//按钮显示
$
(
"
#mTypeChange
"
).
show
();
//按钮显示
$
(
"
#Packing
"
).
focus
().
val
(
materialInfo
[
12
]);
$
(
"
#Packing
"
).
focus
().
val
(
materialInfo
[
12
]);
$
(
"
#SafetyStock
"
).
focus
().
val
(
materialInfo
[
13
]);
$
(
"
#SafetyStock
"
).
focus
().
val
(
materialInfo
[
13
]
==
"
undefined
"
?
""
:
materialInfo
[
13
]);
$
(
"
#Model
"
).
val
(
materialInfo
[
2
]);
$
(
"
#Model
"
).
val
(
materialInfo
[
2
]);
$
(
"
#Standard
"
).
val
(
materialInfo
[
10
]
==
"
undefined
"
?
""
:
materialInfo
[
10
]);
$
(
"
#Standard
"
).
val
(
materialInfo
[
10
]
==
"
undefined
"
?
""
:
materialInfo
[
10
]);
$
(
"
#Color
"
).
val
(
materialInfo
[
3
]
==
"
undefined
"
?
""
:
materialInfo
[
3
]);
$
(
"
#Color
"
).
val
(
materialInfo
[
3
]
==
"
undefined
"
?
""
:
materialInfo
[
3
]);
...
@@ -1388,7 +1388,7 @@
...
@@ -1388,7 +1388,7 @@
$
(
"
#PresetPriceTwo
"
).
val
(
materialInfo
[
8
]);
$
(
"
#PresetPriceTwo
"
).
val
(
materialInfo
[
8
]);
$
(
"
#Remark
"
).
val
(
materialInfo
[
9
]);
$
(
"
#Remark
"
).
val
(
materialInfo
[
9
]);
$
(
"
#manyUnit
"
).
val
(
materialInfo
[
16
]);
$
(
"
#manyUnit
"
).
val
(
materialInfo
[
16
]);
if
(
materialInfo
[
16
])
{
if
(
materialInfo
[
16
]
!=
"
undefined
"
)
{
$
(
"
#manyUnitCheck
"
).
prop
(
"
checked
"
,
true
);
$
(
"
#manyUnitCheck
"
).
prop
(
"
checked
"
,
true
);
//当前为选中状态
//当前为选中状态
$
(
"
#Unit
"
).
hide
();
$
(
"
#Unit
"
).
hide
();
...
@@ -1430,8 +1430,9 @@
...
@@ -1430,8 +1430,9 @@
type
:
"
get
"
,
type
:
"
get
"
,
dataType
:
"
json
"
,
dataType
:
"
json
"
,
success
:
function
(
res
)
{
success
:
function
(
res
)
{
if
(
res
&&
res
.
rows
&&
res
.
rows
[
0
])
{
if
(
res
&&
res
.
code
===
200
&&
res
.
data
&&
res
.
data
[
0
])
{
var
PriceStrategy
=
res
.
rows
[
0
].
PriceStrategy
;
var
PriceStrategy
=
res
.
data
[
0
].
pricestrategy
;
PriceStrategy
=
JSON
.
parse
(
PriceStrategy
);
if
(
PriceStrategy
&&
PriceStrategy
[
0
]
&&
PriceStrategy
[
1
])
{
if
(
PriceStrategy
&&
PriceStrategy
[
0
]
&&
PriceStrategy
[
1
])
{
//基本单位
//基本单位
$
(
"
#basicUnit
"
).
text
(
PriceStrategy
[
0
].
basic
.
Unit
);
$
(
"
#basicUnit
"
).
text
(
PriceStrategy
[
0
].
basic
.
Unit
);
...
...
src/main/java/com/jsh/erp/controller/MaterialCategoryController.java
View file @
cce885fd
...
@@ -55,7 +55,7 @@ public class MaterialCategoryController {
...
@@ -55,7 +55,7 @@ public class MaterialCategoryController {
}
}
}
}
res
.
code
=
200
;
res
.
code
=
200
;
res
.
data
=
dataList
;
res
.
data
=
outer
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
res
.
code
=
500
;
res
.
code
=
500
;
...
...
src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java
View file @
cce885fd
...
@@ -50,6 +50,10 @@ public class MaterialVo4Unit {
...
@@ -50,6 +50,10 @@ public class MaterialVo4Unit {
private
String
unitName
;
private
String
unitName
;
private
String
categoryName
;
private
String
materialOther
;
public
Long
getId
()
{
public
Long
getId
()
{
return
id
;
return
id
;
}
}
...
@@ -241,4 +245,20 @@ public class MaterialVo4Unit {
...
@@ -241,4 +245,20 @@ public class MaterialVo4Unit {
public
void
setUnitName
(
String
unitName
)
{
public
void
setUnitName
(
String
unitName
)
{
this
.
unitName
=
unitName
;
this
.
unitName
=
unitName
;
}
}
public
String
getCategoryName
()
{
return
categoryName
;
}
public
void
setCategoryName
(
String
categoryName
)
{
this
.
categoryName
=
categoryName
;
}
public
String
getMaterialOther
()
{
return
materialOther
;
}
public
void
setMaterialOther
(
String
materialOther
)
{
this
.
materialOther
=
materialOther
;
}
}
}
\ No newline at end of file
src/main/java/com/jsh/erp/datasource/mappers/MaterialMapper.java
View file @
cce885fd
...
@@ -96,15 +96,21 @@ public interface MaterialMapper {
...
@@ -96,15 +96,21 @@ public interface MaterialMapper {
*/
*/
int
updateByPrimaryKey
(
Material
record
);
int
updateByPrimaryKey
(
Material
record
);
List
<
Material
>
selectByConditionMaterial
(
List
<
Material
Vo4Unit
>
selectByConditionMaterial
(
@Param
(
"name"
)
String
name
,
@Param
(
"name"
)
String
name
,
@Param
(
"model"
)
String
model
,
@Param
(
"model"
)
String
model
,
@Param
(
"categoryId"
)
Long
categoryId
,
@Param
(
"categoryIds"
)
String
categoryIds
,
@Param
(
"mpList"
)
String
mpList
,
@Param
(
"offset"
)
Integer
offset
,
@Param
(
"offset"
)
Integer
offset
,
@Param
(
"rows"
)
Integer
rows
);
@Param
(
"rows"
)
Integer
rows
);
int
countsByMaterial
(
int
countsByMaterial
(
@Param
(
"name"
)
String
name
,
@Param
(
"name"
)
String
name
,
@Param
(
"model"
)
String
model
);
@Param
(
"model"
)
String
model
,
@Param
(
"categoryId"
)
Long
categoryId
,
@Param
(
"categoryIds"
)
String
categoryIds
,
@Param
(
"mpList"
)
String
mpList
);
String
findUnitName
(
@Param
(
"mId"
)
Long
mId
);
String
findUnitName
(
@Param
(
"mId"
)
Long
mId
);
...
...
src/main/java/com/jsh/erp/service/material/MaterialComponent.java
View file @
cce885fd
...
@@ -34,8 +34,11 @@ public class MaterialComponent implements ICommonQuery {
...
@@ -34,8 +34,11 @@ public class MaterialComponent implements ICommonQuery {
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
String
model
=
StringUtil
.
getInfo
(
search
,
"model"
);
String
model
=
StringUtil
.
getInfo
(
search
,
"model"
);
Long
categoryId
=
Long
.
parseLong
(
StringUtil
.
getInfo
(
search
,
"categoryId"
));
String
categoryIds
=
StringUtil
.
getInfo
(
search
,
"categoryIds"
);
String
mpList
=
StringUtil
.
getInfo
(
search
,
"mpList"
);
String
order
=
QueryUtils
.
order
(
map
);
String
order
=
QueryUtils
.
order
(
map
);
return
materialService
.
select
(
name
,
model
,
QueryUtils
.
offset
(
map
),
QueryUtils
.
rows
(
map
));
return
materialService
.
select
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
,
QueryUtils
.
offset
(
map
),
QueryUtils
.
rows
(
map
));
}
}
@Override
@Override
...
@@ -43,7 +46,10 @@ public class MaterialComponent implements ICommonQuery {
...
@@ -43,7 +46,10 @@ public class MaterialComponent implements ICommonQuery {
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
String
model
=
StringUtil
.
getInfo
(
search
,
"model"
);
String
model
=
StringUtil
.
getInfo
(
search
,
"model"
);
return
materialService
.
countMaterial
(
name
,
model
);
Long
categoryId
=
Long
.
parseLong
(
StringUtil
.
getInfo
(
search
,
"categoryId"
));
String
categoryIds
=
StringUtil
.
getInfo
(
search
,
"categoryIds"
);
String
mpList
=
StringUtil
.
getInfo
(
search
,
"mpList"
);
return
materialService
.
countMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
);
}
}
@Override
@Override
...
...
src/main/java/com/jsh/erp/service/material/MaterialService.java
View file @
cce885fd
...
@@ -31,12 +31,43 @@ public class MaterialService {
...
@@ -31,12 +31,43 @@ public class MaterialService {
return
materialMapper
.
selectByExample
(
example
);
return
materialMapper
.
selectByExample
(
example
);
}
}
public
List
<
Material
>
select
(
String
name
,
String
model
,
int
offset
,
int
rows
)
{
public
List
<
MaterialVo4Unit
>
select
(
String
name
,
String
model
,
Long
categoryId
,
String
categoryIds
,
String
mpList
,
int
offset
,
int
rows
)
{
return
materialMapper
.
selectByConditionMaterial
(
name
,
model
,
offset
,
rows
);
String
[]
mpArr
=
mpList
.
split
(
","
);
List
<
MaterialVo4Unit
>
resList
=
new
ArrayList
<
MaterialVo4Unit
>();
List
<
MaterialVo4Unit
>
list
=
materialMapper
.
selectByConditionMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
,
offset
,
rows
);
if
(
null
!=
list
)
{
for
(
MaterialVo4Unit
m
:
list
)
{
//扩展信息
String
materialOther
=
""
;
for
(
int
i
=
0
;
i
<
mpArr
.
length
;
i
++)
{
if
(
mpArr
[
i
].
equals
(
"颜色"
))
{
materialOther
=
materialOther
+
((
m
.
getColor
()
==
null
||
m
.
getColor
().
equals
(
""
))
?
""
:
"("
+
m
.
getColor
()
+
")"
);
}
if
(
mpArr
[
i
].
equals
(
"规格"
))
{
materialOther
=
materialOther
+
((
m
.
getStandard
()
==
null
||
m
.
getStandard
().
equals
(
""
))
?
""
:
"("
+
m
.
getStandard
()
+
")"
);
}
if
(
mpArr
[
i
].
equals
(
"制造商"
))
{
materialOther
=
materialOther
+
((
m
.
getMfrs
()
==
null
||
m
.
getMfrs
().
equals
(
""
))
?
""
:
"("
+
m
.
getMfrs
()
+
")"
);
}
if
(
mpArr
[
i
].
equals
(
"自定义1"
))
{
materialOther
=
materialOther
+
((
m
.
getOtherfield1
()
==
null
||
m
.
getOtherfield1
().
equals
(
""
))
?
""
:
"("
+
m
.
getOtherfield1
()
+
")"
);
}
if
(
mpArr
[
i
].
equals
(
"自定义2"
))
{
materialOther
=
materialOther
+
((
m
.
getOtherfield2
()
==
null
||
m
.
getOtherfield2
().
equals
(
""
))
?
""
:
"("
+
m
.
getOtherfield2
()
+
")"
);
}
if
(
mpArr
[
i
].
equals
(
"自定义3"
))
{
materialOther
=
materialOther
+
((
m
.
getOtherfield3
()
==
null
||
m
.
getOtherfield3
().
equals
(
""
))
?
""
:
"("
+
m
.
getOtherfield3
()
+
")"
);
}
}
m
.
setMaterialOther
(
materialOther
);
resList
.
add
(
m
);
}
}
return
resList
;
}
}
public
int
countMaterial
(
String
name
,
String
model
)
{
public
int
countMaterial
(
String
name
,
String
model
,
Long
categoryId
,
String
categoryIds
,
String
mpList
)
{
return
materialMapper
.
countsByMaterial
(
name
,
model
);
return
materialMapper
.
countsByMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
);
}
}
public
int
insertMaterial
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertMaterial
(
String
beanJson
,
HttpServletRequest
request
)
{
...
...
src/main/resources/mapper_xml/MaterialMapperEx.xml
View file @
cce885fd
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jsh.erp.datasource.mappers.MaterialMapper"
>
<mapper
namespace=
"com.jsh.erp.datasource.mappers.MaterialMapper"
>
<resultMap
extends=
"BaseResultMap"
id=
"ResultMapList"
type=
"com.jsh.erp.datasource.entities.MaterialVo4Unit"
>
<result
column=
"unitName"
jdbcType=
"VARCHAR"
property=
"unitName"
/>
<result
column=
"categoryName"
jdbcType=
"VARCHAR"
property=
"categoryName"
/>
</resultMap>
<resultMap
extends=
"BaseResultMap"
id=
"ResultAndUnitMap"
type=
"com.jsh.erp.datasource.entities.MaterialVo4Unit"
>
<resultMap
extends=
"BaseResultMap"
id=
"ResultAndUnitMap"
type=
"com.jsh.erp.datasource.entities.MaterialVo4Unit"
>
<result
column=
"UName"
jdbcType=
"VARCHAR"
property=
"unitName"
/>
<result
column=
"UName"
jdbcType=
"VARCHAR"
property=
"unitName"
/>
</resultMap>
</resultMap>
<select
id=
"selectByConditionMaterial"
parameterType=
"com.jsh.erp.datasource.entities.MaterialExample"
resultMap=
"BaseResultMap"
>
<select
id=
"selectByConditionMaterial"
parameterType=
"com.jsh.erp.datasource.entities.MaterialExample"
resultMap=
"ResultMapList"
>
select *
select m.*,u.uname unitName, mc.name categoryName
FROM jsh_material
FROM jsh_material m
left JOIN jsh_unit u on m.UnitId = u.id
left JOIN jsh_materialcategory mc on m.CategoryId = mc.id
where 1=1
where 1=1
<if
test=
"name != null"
>
<if
test=
"name != null"
>
and name like '%${name}%'
and
m.
name like '%${name}%'
</if>
</if>
<if
test=
"model != null"
>
<if
test=
"model != null"
>
and model like '%${model}%'
and
m.
model like '%${model}%'
</if>
</if>
<if
test=
"categoryId != 1"
>
and m.CategoryId in (${categoryIds})
</if>
order by m.id asc
<if
test=
"offset != null and rows != null"
>
<if
test=
"offset != null and rows != null"
>
limit #{offset},#{rows}
limit #{offset},#{rows}
</if>
</if>
...
@@ -22,14 +33,19 @@
...
@@ -22,14 +33,19 @@
<select
id=
"countsByMaterial"
resultType=
"java.lang.Integer"
>
<select
id=
"countsByMaterial"
resultType=
"java.lang.Integer"
>
SELECT
SELECT
COUNT(id)
COUNT(m.id)
FROM jsh_material
FROM jsh_material m
left JOIN jsh_unit u on m.UnitId = u.id
left JOIN jsh_materialcategory mc on m.CategoryId = mc.id
WHERE 1=1
WHERE 1=1
<if
test=
"name != null"
>
<if
test=
"name != null"
>
and name like '%${name}%'
and
m.
name like '%${name}%'
</if>
</if>
<if
test=
"model != null"
>
<if
test=
"model != null"
>
and model like '%${model}%'
and m.model like '%${model}%'
</if>
<if
test=
"categoryId != 1"
>
and m.CategoryId in (${categoryIds})
</if>
</if>
</select>
</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