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
09cf3540
Commit
09cf3540
authored
Jun 20, 2021
by
季圣华
Browse files
增加商品校验
parent
e5ce3194
Changes
4
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/MaterialController.java
View file @
09cf3540
...
...
@@ -55,8 +55,9 @@ public class MaterialController {
@RequestParam
(
"otherField3"
)
String
otherField3
,
@RequestParam
(
"unit"
)
String
unit
,
@RequestParam
(
"unitId"
)
Long
unitId
,
HttpServletRequest
request
)
throws
Exception
{
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<
String
,
Object
>();
int
exist
=
materialService
.
checkIsExist
(
id
,
name
,
model
,
color
,
standard
,
mfrs
,
otherField1
,
otherField2
,
otherField3
,
unit
,
unitId
);
int
exist
=
materialService
.
checkIsExist
(
id
,
name
,
StringUtil
.
toNull
(
model
),
StringUtil
.
toNull
(
color
),
StringUtil
.
toNull
(
standard
),
StringUtil
.
toNull
(
mfrs
),
StringUtil
.
toNull
(
otherField1
),
StringUtil
.
toNull
(
otherField2
),
StringUtil
.
toNull
(
otherField3
),
StringUtil
.
toNull
(
unit
),
unitId
);
if
(
exist
>
0
)
{
objectMap
.
put
(
"status"
,
true
);
}
else
{
...
...
jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java
View file @
09cf3540
...
...
@@ -102,4 +102,17 @@ public interface MaterialMapperEx {
@Param
(
"depotId"
)
Long
depotId
,
@Param
(
"idList"
)
List
<
Long
>
idList
,
@Param
(
"materialParam"
)
String
materialParam
);
int
checkIsExist
(
@Param
(
"id"
)
Long
id
,
@Param
(
"name"
)
String
name
,
@Param
(
"model"
)
String
model
,
@Param
(
"color"
)
String
color
,
@Param
(
"standard"
)
String
standard
,
@Param
(
"mfrs"
)
String
mfrs
,
@Param
(
"otherField1"
)
String
otherField1
,
@Param
(
"otherField2"
)
String
otherField2
,
@Param
(
"otherField3"
)
String
otherField3
,
@Param
(
"unit"
)
String
unit
,
@Param
(
"unitId"
)
Long
unitId
);
}
jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java
View file @
09cf3540
...
...
@@ -298,28 +298,8 @@ public class MaterialService {
public
int
checkIsExist
(
Long
id
,
String
name
,
String
model
,
String
color
,
String
standard
,
String
mfrs
,
String
otherField1
,
String
otherField2
,
String
otherField3
,
String
unit
,
Long
unitId
)
throws
Exception
{
MaterialExample
example
=
new
MaterialExample
();
MaterialExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andNameEqualTo
(
name
).
andModelEqualTo
(
model
).
andColorEqualTo
(
color
)
.
andStandardEqualTo
(
standard
).
andMfrsEqualTo
(
mfrs
)
.
andOtherField1EqualTo
(
otherField1
).
andOtherField2EqualTo
(
otherField2
).
andOtherField2EqualTo
(
otherField3
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
if
(
id
>
0
)
{
criteria
.
andIdNotEqualTo
(
id
);
}
if
(!
StringUtil
.
isEmpty
(
unit
))
{
criteria
.
andUnitEqualTo
(
unit
);
}
if
(
unitId
!=
null
)
{
criteria
.
andUnitIdEqualTo
(
unitId
);
}
List
<
Material
>
list
=
null
;
try
{
list
=
materialMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
JshException
.
readFail
(
logger
,
e
);
}
return
list
==
null
?
0
:
list
.
size
();
return
materialMapperEx
.
checkIsExist
(
id
,
name
,
model
,
color
,
standard
,
mfrs
,
otherField1
,
otherField2
,
otherField3
,
unit
,
unitId
);
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
...
...
jshERP-boot/src/main/resources/mapper_xml/MaterialMapperEx.xml
View file @
09cf3540
...
...
@@ -406,4 +406,42 @@
</if>
and ifnull(m.delete_flag,'0') !='1'
</select>
<select
id=
"checkIsExist"
resultType=
"java.lang.Integer"
>
select count(1) from jsh_material m
where ifnull(m.delete_flag,'0') !='1'
<if
test=
"name != null"
>
and m.name = #{name}
</if>
<if
test=
"model != null"
>
and m.model = #{model}
</if>
<if
test=
"color != null"
>
and m.color = #{color}
</if>
<if
test=
"standard != null"
>
and m.standard = #{standard}
</if>
<if
test=
"mfrs != null"
>
and m.mfrs = #{mfrs}
</if>
<if
test=
"otherField1 != null"
>
and m.other_field1 = #{otherField1}
</if>
<if
test=
"otherField2 != null"
>
and m.other_field2 = #{otherField2}
</if>
<if
test=
"otherField3 != null"
>
and m.other_field3 = #{otherField3}
</if>
<if
test=
"unit != null"
>
and m.unit = #{unit}
</if>
<if
test=
"unitId != null"
>
and m.unit_id = #{unitId}
</if>
<if
test=
"id != null"
>
and m.id != #{id}
</if>
</select>
</mapper>
\ No newline at end of file
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