Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
shop
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
shop
Commits
48c07c77
Commit
48c07c77
authored
Sep 04, 2018
by
chang20170705
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GetCategoryGoods
parent
b72ae1ef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
0 deletions
+74
-0
GoodsController.java
src/main/java/com/egolm/shop/controller/GoodsController.java
+26
-0
GoodsService.java
src/main/java/com/egolm/shop/service/GoodsService.java
+2
-0
GoodsServiceImpl.java
...in/java/com/egolm/shop/service/impl/GoodsServiceImpl.java
+46
-0
No files found.
src/main/java/com/egolm/shop/controller/GoodsController.java
View file @
48c07c77
...
...
@@ -93,4 +93,30 @@ public class GoodsController {
listMap
=
goodsService
.
getHotSaleGoods
(
params
,
page
);
return
Rjx
.
jsonOk
().
set
(
"list"
,
listMap
).
set
(
"page"
,
page
).
toJson
();
}
@ApiOperation
(
"分类商品页数据"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"OrgNO"
,
dataType
=
"String"
,
required
=
true
,
value
=
"区域编号"
,
defaultValue
=
"SHBS"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"ShopNO"
,
dataType
=
"String"
,
required
=
false
,
value
=
"店铺件编号"
,
defaultValue
=
"00029997"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"CategoryNOA"
,
dataType
=
"String"
,
required
=
false
,
value
=
"一级分类编码"
,
defaultValue
=
"%"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"CategoryNOB"
,
dataType
=
"String"
,
required
=
false
,
value
=
"二级分类编码"
,
defaultValue
=
"%"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"index"
,
dataType
=
"String"
,
required
=
false
,
value
=
"第几页"
,
defaultValue
=
"1"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"limit"
,
dataType
=
"String"
,
required
=
false
,
value
=
"每页数量"
,
defaultValue
=
"20"
),
})
@RequestMapping
(
value
=
"/GetCategoryGoods"
,
method
=
RequestMethod
.
GET
)
public
String
GetCategoryGoods
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
List
<
Map
<
String
,
Object
>>
listMap
;
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"OrgNO"
,
request
.
getParameter
(
"OrgNO"
));
params
.
put
(
"ShopNO"
,
request
.
getParameter
(
"ShopNO"
)==
null
?
""
:
request
.
getParameter
(
"ShopNO"
));
params
.
put
(
"CategoryNOA"
,
request
.
getParameter
(
"CategoryNOA"
)==
null
?
"%"
:
request
.
getParameter
(
"CategoryNOA"
));
params
.
put
(
"CategoryNOB"
,
request
.
getParameter
(
"CategoryNOB"
)==
null
?
"%"
:
request
.
getParameter
(
"CategoryNOB"
));
Page
page
=
new
Page
();
page
.
setIndex
(
Long
.
valueOf
(
request
.
getParameter
(
"index"
)==
null
?
"1"
:
request
.
getParameter
(
"index"
)));
page
.
setLimit
(
Long
.
valueOf
(
request
.
getParameter
(
"limit"
)==
null
?
"20"
:
request
.
getParameter
(
"limit"
)));
page
.
setLimitKey
(
"GoodsID desc"
);
listMap
=
goodsService
.
GetCategoryGoods
(
params
,
page
);
return
Rjx
.
jsonOk
().
set
(
"list"
,
listMap
).
set
(
"page"
,
page
).
toJson
();
}
}
src/main/java/com/egolm/shop/service/GoodsService.java
View file @
48c07c77
...
...
@@ -10,4 +10,6 @@ public interface GoodsService {
public
List
<
Map
<
String
,
Object
>>
listThinkLike
(
Map
<
String
,
Object
>
params
,
Page
page
);
public
List
<
Map
<
String
,
Object
>>
getHotSaleGoods
(
Map
<
String
,
Object
>
map
,
Page
page
);
public
List
<
Map
<
String
,
Object
>>
GetCategoryGoods
(
Map
<
String
,
Object
>
map
,
Page
page
);
}
src/main/java/com/egolm/shop/service/impl/GoodsServiceImpl.java
View file @
48c07c77
...
...
@@ -9,6 +9,7 @@ import java.util.Map;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.dao.EmptyResultDataAccessException
;
import
org.springframework.stereotype.Service
;
import
com.egolm.common.DateUtil
;
...
...
@@ -75,6 +76,51 @@ public class GoodsServiceImpl implements GoodsService {
jdbcTemplate
.
setDialect
(
new
SqlServerDialect
());
return
jdbcTemplate
.
limit
(
sql
,
page
,
OrgNO
);
}
@Override
public
List
<
Map
<
String
,
Object
>>
GetCategoryGoods
(
Map
<
String
,
Object
>
map
,
Page
page
)
{
String
OrgNO
=(
String
)
map
.
get
(
"OrgNO"
);
String
ShopNO
=(
String
)
map
.
get
(
"ShopNO"
);
String
CategoryNOA
=(
String
)
map
.
get
(
"CategoryNOA"
);
String
CategoryNOB
=(
String
)
map
.
get
(
"CategoryNOB"
);
String
DistrictID
;
String
sql_0
=
"SELECT DistrictID=sDistrictID FROM tShop WHERE sOrgNO =? AND sShopNO = ?"
;
try
{
DistrictID
=
jdbcTemplate
.
queryForString
(
sql_0
,
OrgNO
,
ShopNO
);
}
catch
(
EmptyResultDataAccessException
e
)
{
DistrictID
=
""
;
}
String
sql
=
" SELECT GoodsID = acg.nGoodsID,"
+
" GoodsNO = acg.sGoodsNO, "
+
" GoodsName = acg.sGoodsDesc, "
+
" Price = acg.nSalePrice, "
+
" Unit = acg.sUnit, "
+
" Spec = acg.sSpec, "
+
" MinQty = acg.nMinSaleQty, "
+
" SaleUnit = acg.nSaleUnits, "
+
" MarketPrice = acg.nMarketPrice, "
+
" MarketUnit = acg.sMarketUnit, "
+
" ImagePath = ISNULL(g.sURL,''),"
+
" PopImagePath = '' "
+
" FROM tAgentContractWarehouse acw, tAgentContractGoods acg "
+
"LEFT JOIN tGoodsPic g ON acg.nGoodsID = g.nGoodsID "
+
" AND g.sPicTypeID = '1' "
+
" AND g.nItem = 1, "
+
"(SELECT a.sWarehouseNO FROM tWarehouseDistrict a, (SELECT sDistrictID, nDCPriority = max(nDCPriority) FROM tWarehouseDistrict "
+
" GROUP BY sDistrictID) b WHERE a.sDistrictID = b.sDistrictID AND a.nDCPriority = b.nDCPriority AND (a.sDistrictID = ? OR ? = '') "
+
" ) d, tCategory c "
+
" WHERE acw.sAgentContractNO = acg.sAgentContractNO "
+
" AND acw.sWarehouseNO = d.sWarehouseNO "
+
" AND acg.sCategoryNO = c.sCategoryNO "
+
" AND acg.nTag&1=0 "
+
" AND acg.sOrgNO = 'SHBS' "
+
" AND (c.sPath LIKE ISNULL((SELECT sPath FROM tCategory WHERE sCategoryNO = ?),'') + '%') "
+
" AND (c.sPath LIKE ISNULL((SELECT sPath FROM tCategory WHERE sCategoryNO = ?),'') + '%') "
;
jdbcTemplate
.
setDialect
(
new
SqlServerDialect
());
return
jdbcTemplate
.
limit
(
sql
,
page
,
DistrictID
,
DistrictID
,
CategoryNOA
,
CategoryNOB
);
}
}
Write
Preview
Markdown
is supported
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