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
9561741f
Commit
9561741f
authored
Jun 13, 2022
by
季圣华
Browse files
优化根据仓库和商品查询单据列表接口
parent
b164fa3f
Changes
4
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/DepotItemController.java
View file @
9561741f
...
@@ -72,10 +72,11 @@ public class DepotItemController {
...
@@ -72,10 +72,11 @@ public class DepotItemController {
@RequestParam
(
value
=
Constants
.
PAGE_SIZE
,
required
=
false
)
Integer
pageSize
,
@RequestParam
(
value
=
Constants
.
PAGE_SIZE
,
required
=
false
)
Integer
pageSize
,
@RequestParam
(
value
=
Constants
.
CURRENT_PAGE
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
Constants
.
CURRENT_PAGE
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"depotIds"
,
required
=
false
)
String
depotIds
,
@RequestParam
(
value
=
"depotIds"
,
required
=
false
)
String
depotIds
,
@RequestParam
(
value
=
"sku"
,
required
=
false
)
String
sku
,
@RequestParam
(
"materialId"
)
Long
mId
,
@RequestParam
(
"materialId"
)
Long
mId
,
HttpServletRequest
request
)
throws
Exception
{
HttpServletRequest
request
)
throws
Exception
{
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
List
<
DepotItemVo4DetailByTypeAndMId
>
list
=
depotItemService
.
findDetailByDepotIdsAndMaterialIdList
(
depotIds
,
mId
,
(
currentPage
-
1
)*
pageSize
,
pageSize
);
List
<
DepotItemVo4DetailByTypeAndMId
>
list
=
depotItemService
.
findDetailByDepotIdsAndMaterialIdList
(
depotIds
,
sku
,
mId
,
(
currentPage
-
1
)*
pageSize
,
pageSize
);
JSONArray
dataArray
=
new
JSONArray
();
JSONArray
dataArray
=
new
JSONArray
();
if
(
list
!=
null
)
{
if
(
list
!=
null
)
{
for
(
DepotItemVo4DetailByTypeAndMId
d:
list
)
{
for
(
DepotItemVo4DetailByTypeAndMId
d:
list
)
{
...
@@ -102,7 +103,7 @@ public class DepotItemController {
...
@@ -102,7 +103,7 @@ public class DepotItemController {
return
returnJson
(
objectMap
,
"查找不到数据"
,
ErpInfo
.
OK
.
code
);
return
returnJson
(
objectMap
,
"查找不到数据"
,
ErpInfo
.
OK
.
code
);
}
}
objectMap
.
put
(
"rows"
,
dataArray
);
objectMap
.
put
(
"rows"
,
dataArray
);
objectMap
.
put
(
"total"
,
depotItemService
.
findDetailByDepotIdsAndMaterialIdCount
(
depotIds
,
mId
));
objectMap
.
put
(
"total"
,
depotItemService
.
findDetailByDepotIdsAndMaterialIdCount
(
depotIds
,
sku
,
mId
));
return
returnJson
(
objectMap
,
ErpInfo
.
OK
.
name
,
ErpInfo
.
OK
.
code
);
return
returnJson
(
objectMap
,
ErpInfo
.
OK
.
name
,
ErpInfo
.
OK
.
code
);
}
}
...
...
jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java
View file @
9561741f
...
@@ -31,12 +31,14 @@ public interface DepotItemMapperEx {
...
@@ -31,12 +31,14 @@ public interface DepotItemMapperEx {
List
<
DepotItemVo4DetailByTypeAndMId
>
findDetailByDepotIdsAndMaterialIdList
(
List
<
DepotItemVo4DetailByTypeAndMId
>
findDetailByDepotIdsAndMaterialIdList
(
@Param
(
"depotIdArray"
)
String
[]
depotIdArray
,
@Param
(
"depotIdArray"
)
String
[]
depotIdArray
,
@Param
(
"sku"
)
String
sku
,
@Param
(
"mId"
)
Long
mId
,
@Param
(
"mId"
)
Long
mId
,
@Param
(
"offset"
)
Integer
offset
,
@Param
(
"offset"
)
Integer
offset
,
@Param
(
"rows"
)
Integer
rows
);
@Param
(
"rows"
)
Integer
rows
);
Long
findDetailByDepotIdsAndMaterialIdCount
(
Long
findDetailByDepotIdsAndMaterialIdCount
(
@Param
(
"depotIdArray"
)
String
[]
depotIdArray
,
@Param
(
"depotIdArray"
)
String
[]
depotIdArray
,
@Param
(
"sku"
)
String
sku
,
@Param
(
"mId"
)
Long
mId
);
@Param
(
"mId"
)
Long
mId
);
List
<
DepotItemVo4WithInfoEx
>
getDetailList
(
List
<
DepotItemVo4WithInfoEx
>
getDetailList
(
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
View file @
9561741f
...
@@ -168,28 +168,28 @@ public class DepotItemService {
...
@@ -168,28 +168,28 @@ public class DepotItemService {
return
list
==
null
?
0
:
list
.
size
();
return
list
==
null
?
0
:
list
.
size
();
}
}
public
List
<
DepotItemVo4DetailByTypeAndMId
>
findDetailByDepotIdsAndMaterialIdList
(
String
depotIds
,
Long
mId
,
int
offset
,
int
rows
)
throws
Exception
{
public
List
<
DepotItemVo4DetailByTypeAndMId
>
findDetailByDepotIdsAndMaterialIdList
(
String
depotIds
,
String
sku
,
Long
mId
,
int
offset
,
int
rows
)
throws
Exception
{
String
[]
depotIdArray
=
null
;
String
[]
depotIdArray
=
null
;
if
(
StringUtil
.
isNotEmpty
(
depotIds
))
{
if
(
StringUtil
.
isNotEmpty
(
depotIds
))
{
depotIdArray
=
depotIds
.
split
(
","
);
depotIdArray
=
depotIds
.
split
(
","
);
}
}
List
<
DepotItemVo4DetailByTypeAndMId
>
list
=
null
;
List
<
DepotItemVo4DetailByTypeAndMId
>
list
=
null
;
try
{
try
{
list
=
depotItemMapperEx
.
findDetailByDepotIdsAndMaterialIdList
(
depotIdArray
,
mId
,
offset
,
rows
);
list
=
depotItemMapperEx
.
findDetailByDepotIdsAndMaterialIdList
(
depotIdArray
,
sku
,
mId
,
offset
,
rows
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
JshException
.
readFail
(
logger
,
e
);
JshException
.
readFail
(
logger
,
e
);
}
}
return
list
;
return
list
;
}
}
public
Long
findDetailByDepotIdsAndMaterialIdCount
(
String
depotIds
,
Long
mId
)
throws
Exception
{
public
Long
findDetailByDepotIdsAndMaterialIdCount
(
String
depotIds
,
String
sku
,
Long
mId
)
throws
Exception
{
String
[]
depotIdArray
=
null
;
String
[]
depotIdArray
=
null
;
if
(
StringUtil
.
isNotEmpty
(
depotIds
))
{
if
(
StringUtil
.
isNotEmpty
(
depotIds
))
{
depotIdArray
=
depotIds
.
split
(
","
);
depotIdArray
=
depotIds
.
split
(
","
);
}
}
Long
result
=
null
;
Long
result
=
null
;
try
{
try
{
result
=
depotItemMapperEx
.
findDetailByDepotIdsAndMaterialIdCount
(
depotIdArray
,
mId
);
result
=
depotItemMapperEx
.
findDetailByDepotIdsAndMaterialIdCount
(
depotIdArray
,
sku
,
mId
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
JshException
.
readFail
(
logger
,
e
);
JshException
.
readFail
(
logger
,
e
);
}
}
...
...
jshERP-boot/src/main/resources/mapper_xml/DepotItemMapperEx.xml
View file @
9561741f
...
@@ -165,6 +165,9 @@
...
@@ -165,6 +165,9 @@
<foreach
collection=
"depotIdArray"
item=
"depotId"
separator=
","
>
#{depotId}
</foreach>
<foreach
collection=
"depotIdArray"
item=
"depotId"
separator=
","
>
#{depotId}
</foreach>
)
)
</if>
</if>
<if
test=
"sku != null and sku !=''"
>
and di.sku = #{sku}
</if>
and di.material_id = #{mId}
and di.material_id = #{mId}
and ifnull(dh.delete_flag,'0') !='1'
and ifnull(dh.delete_flag,'0') !='1'
union all
union all
...
@@ -183,6 +186,9 @@
...
@@ -183,6 +186,9 @@
<foreach
collection=
"depotIdArray"
item=
"depotId"
separator=
","
>
#{depotId}
</foreach>
<foreach
collection=
"depotIdArray"
item=
"depotId"
separator=
","
>
#{depotId}
</foreach>
)
)
</if>
</if>
<if
test=
"sku != null and sku !=''"
>
and di.sku = #{sku}
</if>
and di.material_id = #{mId}
and di.material_id = #{mId}
and ifnull(dh.delete_flag,'0') !='1') tb
and ifnull(dh.delete_flag,'0') !='1') tb
order by tb.oTime desc
order by tb.oTime desc
...
@@ -204,6 +210,9 @@
...
@@ -204,6 +210,9 @@
<foreach
collection=
"depotIdArray"
item=
"depotId"
separator=
","
>
#{depotId}
</foreach>
<foreach
collection=
"depotIdArray"
item=
"depotId"
separator=
","
>
#{depotId}
</foreach>
)
)
</if>
</if>
<if
test=
"sku != null and sku !=''"
>
and di.sku = #{sku}
</if>
and di.material_id =#{mId}
and di.material_id =#{mId}
and ifnull(dh.delete_flag,'0') !='1'
and ifnull(dh.delete_flag,'0') !='1'
union all
union all
...
@@ -216,6 +225,9 @@
...
@@ -216,6 +225,9 @@
<foreach
collection=
"depotIdArray"
item=
"depotId"
separator=
","
>
#{depotId}
</foreach>
<foreach
collection=
"depotIdArray"
item=
"depotId"
separator=
","
>
#{depotId}
</foreach>
)
)
</if>
</if>
<if
test=
"sku != null and sku !=''"
>
and di.sku = #{sku}
</if>
and di.material_id = #{mId}
and di.material_id = #{mId}
and ifnull(dh.delete_flag,'0') !='1') tb
and ifnull(dh.delete_flag,'0') !='1') tb
</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