Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
shop-Mall
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
licc
shop-Mall
Commits
d3255498
Commit
d3255498
authored
Mar 08, 2021
by
m1991
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资讯模块数据——展示功能实现
parent
7c76de52
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
143 deletions
+25
-143
ShopZxMapper.java
...apper/src/main/java/cn/wisenergy/mapper/ShopZxMapper.java
+2
-37
ShopZxMapper.xml
wisenergy-mapper/src/main/resources/mapper/ShopZxMapper.xml
+1
-1
UploadService.java
...src/main/java/cn/wisenergy/service/app/UploadService.java
+8
-25
UploadServiceImpl.java
...java/cn/wisenergy/service/app/impl/UploadServiceImpl.java
+3
-47
TestController.java
...cn/wisenergy/web/admin/controller/app/TestController.java
+4
-1
UploadController.java
.../wisenergy/web/admin/controller/app/UploadController.java
+7
-32
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/ShopZxMapper.java
View file @
d3255498
...
@@ -22,43 +22,8 @@ public interface ShopZxMapper extends BaseMapper<shopZx> {
...
@@ -22,43 +22,8 @@ public interface ShopZxMapper extends BaseMapper<shopZx> {
*/
*/
int
zxadd
(
@Param
(
"zxUrl"
)
String
zxUrl
,
@Param
(
"userId"
)
String
userId
,
@Param
(
"zxName"
)
String
zxName
,
@Param
(
"zxField"
)
String
zxField
,
@Param
(
"imgUrl"
)
String
imgUrl
,
@Param
(
"zxAddress"
)
String
zxAddress
);
int
zxadd
(
@Param
(
"zxUrl"
)
String
zxUrl
,
@Param
(
"userId"
)
String
userId
,
@Param
(
"zxName"
)
String
zxName
,
@Param
(
"zxField"
)
String
zxField
,
@Param
(
"imgUrl"
)
String
imgUrl
,
@Param
(
"zxAddress"
)
String
zxAddress
);
/**
* 查询全部资讯
* @return
*/
List
<
shopZx
>
findAll
();
/**分页 资讯内容倒叙查询
* PageSize int, --每页的记录数量,比如10条#{beginPos},#{pageSize}
* @param
* @return
*/
List
<
shopZx
>
selectPage
();
/**
* 根据手机号删除资讯
* @param userId
* @return
*/
int
deleteByPrimaryKey
(
Long
userId
);
/**
/**
* 根据手机号查询资讯
* 查询资讯数据
* @param userId
* @return
*/
*/
int
insert
(
shopZx
userId
);
List
<
shopZx
>
selectPage
(
@Param
(
"pageNum"
)
Integer
pageNum
,
@Param
(
"pageSize"
)
Integer
pageSize
);
int
insertSelective
(
shopZx
userId
);
shopZx
selectByPrimaryKey
(
Long
userId
);
int
updateByPrimaryKeySelective
(
shopZx
userId
);
int
updateByPrimaryKey
(
shopZx
userId
);
}
}
wisenergy-mapper/src/main/resources/mapper/ShopZxMapper.xml
View file @
d3255498
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
select count (*) from shop_zx
select count (*) from shop_zx
</select>
</select>
<select
id=
"selectPage"
result
Map=
"zxMap
"
>
<select
id=
"selectPage"
result
Type=
"cn.wisenergy.model.app.shopZx
"
>
select zxid as zxid,zxUrl as zxUrl,
select zxid as zxid,zxUrl as zxUrl,
zxLikes as zxLikes,userid as userid,zxName as zxName,
zxLikes as zxLikes,userid as userid,zxName as zxName,
zxShenHe as zxShenHe,zxField as zxField,zxDate as zxDate,
zxShenHe as zxShenHe,zxField as zxField,zxDate as zxDate,
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/UploadService.java
View file @
d3255498
package
cn
.
wisenergy
.
service
.
app
;
package
cn
.
wisenergy
.
service
.
app
;
import
cn.wisenergy.common.utils.PageRequest
;
import
cn.wisenergy.common.utils.PageResult
;
import
cn.wisenergy.mapper.ShopZxMapper
;
import
cn.wisenergy.model.app.shopZx
;
import
cn.wisenergy.model.app.shopZx
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
...
@@ -28,9 +25,12 @@ public interface UploadService {
...
@@ -28,9 +25,12 @@ public interface UploadService {
/**
/**
* TODO 图片文件上传
* TODO 图片文件上传
* @param request
* @param request
* @param userId
* @param zxField
* @param zxAddress
* @return
* @return
*/
*/
Map
<
String
,
Object
>
uploadImage
(
MultipartFile
file
,
HttpServletRequest
request
,
String
userId
,
String
zxField
,
String
zxAddress
)
throws
Exception
;
Map
<
String
,
Object
>
uploadImage
(
MultipartFile
file
,
HttpServletRequest
request
,
String
userId
,
String
zxField
,
String
zxAddress
)
throws
Exception
;
/**
/**
* TODO 项目目录下的图片文件上传
* TODO 项目目录下的图片文件上传
...
@@ -49,30 +49,13 @@ public interface UploadService {
...
@@ -49,30 +49,13 @@ public interface UploadService {
Resource
loadFileAsResource
(
String
fileName
);
Resource
loadFileAsResource
(
String
fileName
);
/**
/**
* 根据用户ID查找用户资讯
* TODO 资讯信息展示
* @param userId
* @param pageNum
* @param pageSize
* @return
* @return
*/
*/
shopZx
findByUserId
(
Long
userId
);
List
<
shopZx
>
selectPage
(
Integer
pageNum
,
Integer
pageSize
);
/**
* 查询所有资讯
* @return
*/
List
<
shopZx
>
findAll
();
/**
* 分页查询接口 资讯分页
* 这里统一封装了分页请求和结果,避免直接引入具体框架的分页对象, 如MyBatis或JPA的分页对象
* 从而避免因为替换ORM框架而导致服务层、控制层的分页接口也需要变动的情况,替换ORM框架也不会
* 影响服务层以上的分页接口,起到了解耦的作用
* @param pageRequest 自定义,统一分页查询请求
* @return PageResult 自定义,统一分页查询结果
*/
PageResult
findPage
(
PageRequest
pageRequest
);
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UploadServiceImpl.java
View file @
d3255498
...
@@ -4,8 +4,6 @@ import cn.wisenergy.common.utils.*;
...
@@ -4,8 +4,6 @@ import cn.wisenergy.common.utils.*;
import
cn.wisenergy.model.app.shopZx
;
import
cn.wisenergy.model.app.shopZx
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.UrlResource
;
import
org.springframework.core.io.UrlResource
;
...
@@ -313,55 +311,13 @@ public class UploadServiceImpl implements UploadService {
...
@@ -313,55 +311,13 @@ public class UploadServiceImpl implements UploadService {
}
}
}
}
@Override
public
shopZx
findByUserId
(
Long
userId
)
{
return
shopZxMapper
.
selectByPrimaryKey
(
userId
);
}
@Override
public
List
<
shopZx
>
findAll
()
{
return
shopZxMapper
.
findAll
();
}
/**
/**
* 调用分页插件完成分页
* 资讯文件展示
* @param pageRequest
* @return
*/
*/
private
PageInfo
<
shopZx
>
getPageInfo
(
PageRequest
pageRequest
)
{
int
pageNum
=
pageRequest
.
getPageNum
();
int
pageSize
=
pageRequest
.
getPageSize
();
PageHelper
.
startPage
(
pageNum
,
pageSize
);
List
<
shopZx
>
sysMenus
=
shopZxMapper
.
selectPage
();
return
new
PageInfo
<
shopZx
>(
sysMenus
);
}
@Override
@Override
public
PageResult
findPage
(
PageRequest
pageRequest
)
{
public
List
selectPage
(
Integer
pageNum
,
Integer
pageSize
)
{
return
PageUtils
.
getPageResult
(
pageRequest
,
getPageInfo
(
pageRequest
)
);
return
shopZxMapper
.
selectPage
(
pageNum
,
pageSize
);
}
}
// @Override
// public Map getList(int beginPos, int pageSize) {
// Map map =new HashMap();
// String[] ImgUrl = new String[0];
// List date=shopZxMapper.selectAll(beginPos,pageSize);
// for(int i=0;date.size()>0;i++){
// shopZx s = (shopZx)date.get(i);
// ImgUrl=s.getImgUrl().split(",");
// }
// if(null==date){
// map.put("code",1);
// map.put("msg","获取资讯分页数据失败!");
// return (Map) map;
// }else {
// map.put("date",date);
// map.put("ImgUrl",ImgUrl);
// map.put("code",0);
// map.put("msg","获取资讯分页数据成功!");
// return map;
// }
// }
}
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/TestController.java
View file @
d3255498
...
@@ -53,10 +53,13 @@ public class TestController {
...
@@ -53,10 +53,13 @@ public class TestController {
public
static
void
main
(
String
[]
args
){
public
static
void
main
(
String
[]
args
){
String
str
=
"1,2,3,4,5,6,7,8,9"
;
String
repStr
=
str
.
replaceAll
(
","
,
""
);
String
b
=
ShareCodeUtil
.
idToCode
(
1
);
String
b
=
ShareCodeUtil
.
idToCode
(
1
);
String
a
=
ShareCodeUtil
.
idToCode
(
1
,
0
+
1
);
String
a
=
ShareCodeUtil
.
idToCode
(
1
,
0
+
1
);
System
.
out
.
println
(
b
);
System
.
out
.
println
(
repStr
);
}
}
@ApiOperation
(
value
=
"测试短信服务,发送手机号"
,
notes
=
"测试短信服务,发送手机号"
,
httpMethod
=
"POST"
,
produces
=
"application/json; charset=UTF-8"
)
@ApiOperation
(
value
=
"测试短信服务,发送手机号"
,
notes
=
"测试短信服务,发送手机号"
,
httpMethod
=
"POST"
,
produces
=
"application/json; charset=UTF-8"
)
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/UploadController.java
View file @
d3255498
...
@@ -2,6 +2,7 @@ package cn.wisenergy.web.admin.controller.app;
...
@@ -2,6 +2,7 @@ package cn.wisenergy.web.admin.controller.app;
import
cn.wisenergy.common.utils.PageRequest
;
import
cn.wisenergy.common.utils.PageRequest
;
import
cn.wisenergy.common.utils.Result
;
import
cn.wisenergy.common.utils.Result
;
import
cn.wisenergy.model.app.shopZx
;
import
cn.wisenergy.service.app.UploadService
;
import
cn.wisenergy.service.app.UploadService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
...
@@ -105,37 +106,11 @@ public class UploadController {
...
@@ -105,37 +106,11 @@ public class UploadController {
}
}
@GetMapping
(
value
=
"/findByUserId"
)
@ApiImplicitParams
({
public
Object
findByUserId
(
@RequestParam
Long
userId
)
{
@ApiImplicitParam
(
name
=
"pageNum"
,
value
=
"从几开始"
,
required
=
true
,
dataType
=
"integer"
),
return
uploadService
.
findByUserId
(
userId
);
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"一页展示数量"
,
required
=
true
,
dataType
=
"Integger"
)})
}
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/zxAll"
)
public
List
<
shopZx
>
selectPage
(
int
pageNum
,
int
pageSize
){
@GetMapping
(
value
=
"/findAll"
)
return
uploadService
.
selectPage
(
pageNum
,
pageSize
);
public
Object
findAll
()
{
return
uploadService
.
findAll
();
}
@ApiOperation
(
value
=
"资讯信息接口"
,
notes
=
"资讯信息接口"
,
httpMethod
=
"POST"
,
produces
=
"application/json; charset=UTF-8"
)
@PostMapping
(
value
=
"/findPage"
)
public
Object
findPage
(
@RequestBody
PageRequest
pageQuery
)
{
return
uploadService
.
findPage
(
pageQuery
);
}
}
// /**
// * 资讯分页展示接口
// * @param pageOffset
// * @param pageSize
// * @return
// */
// @ApiOperation(value = "资讯信息接口", notes = "资讯信息接口", httpMethod = "GET", produces = "application/json; charset=UTF-8")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "beginPos", value = "从几开始", required = true, dataType = "int"),
// @ApiImplicitParam(name = "pageSize", value = "展示数量(条数)", required = true, dataType = "int")})
// @RequestMapping(value = "/shop", method = {RequestMethod.POST, RequestMethod.GET})
// public Result find(Integer beginPos, Integer pageSize) {
// Map shopZxPage = uploadService.getList(beginPos, pageSize);
//
// return new Result("0", "success", shopZxPage);
// }
}
}
\ No newline at end of file
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