Commit d47124e9 authored by liqin's avatar liqin 💬

Merge branch 'master' of http://111.203.232.171:8888/licc/shop-mall into master

parents 41ed8626 d3255498
......@@ -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);
/**
* 查询全部资讯
* @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);
int insertSelective(shopZx userId);
shopZx selectByPrimaryKey(Long userId);
int updateByPrimaryKeySelective(shopZx userId);
int updateByPrimaryKey(shopZx userId);
List<shopZx> selectPage(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);
}
......@@ -60,7 +60,7 @@
select count (*) from shop_zx
</select>
<select id="selectPage" resultMap="zxMap">
<select id="selectPage" resultType="cn.wisenergy.model.app.shopZx">
select zxid as zxid,zxUrl as zxUrl,
zxLikes as zxLikes,userid as userid,zxName as zxName,
zxShenHe as zxShenHe,zxField as zxField,zxDate as zxDate,
......
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 org.springframework.core.io.Resource;
import org.springframework.web.multipart.MultipartFile;
......@@ -28,9 +25,12 @@ public interface UploadService {
/**
* TODO 图片文件上传
* @param request
* @param userId
* @param zxField
* @param zxAddress
* @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 项目目录下的图片文件上传
......@@ -49,30 +49,13 @@ public interface UploadService {
Resource loadFileAsResource(String fileName);
/**
* 根据用户ID查找用户资讯
* @param userId
* TODO 资讯信息展示
* @param pageNum
* @param pageSize
* @return
*/
shopZx findByUserId(Long userId);
/**
* 查询所有资讯
* @return
*/
List<shopZx> findAll();
/**
* 分页查询接口 资讯分页
* 这里统一封装了分页请求和结果,避免直接引入具体框架的分页对象, 如MyBatis或JPA的分页对象
* 从而避免因为替换ORM框架而导致服务层、控制层的分页接口也需要变动的情况,替换ORM框架也不会
* 影响服务层以上的分页接口,起到了解耦的作用
* @param pageRequest 自定义,统一分页查询请求
* @return PageResult 自定义,统一分页查询结果
*/
PageResult findPage(PageRequest pageRequest);
List<shopZx> selectPage(Integer pageNum, Integer pageSize);
}
......@@ -4,8 +4,6 @@ import cn.wisenergy.common.utils.*;
import cn.wisenergy.model.app.shopZx;
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.core.io.Resource;
import org.springframework.core.io.UrlResource;
......@@ -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
public PageResult findPage(PageRequest pageRequest) {
return PageUtils.getPageResult(pageRequest, getPageInfo(pageRequest));
public List selectPage(Integer pageNum, Integer pageSize) {
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;
// }
// }
}
......@@ -53,10 +53,13 @@ public class TestController {
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 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")
......
......@@ -2,6 +2,7 @@ package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.PageRequest;
import cn.wisenergy.common.utils.Result;
import cn.wisenergy.model.app.shopZx;
import cn.wisenergy.service.app.UploadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -105,37 +106,11 @@ public class UploadController {
}
@GetMapping(value="/findByUserId")
public Object findByUserId(@RequestParam Long userId) {
return uploadService.findByUserId(userId);
}
@GetMapping(value="/findAll")
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);
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "从几开始", required = true,dataType = "integer"),
@ApiImplicitParam(name = "pageSize", value = "一页展示数量", required = true, dataType = "Integger")})
@RequestMapping(method = RequestMethod.GET, value = "/zxAll")
public List<shopZx> selectPage(int pageNum, int pageSize){
return uploadService.selectPage(pageNum,pageSize);
}
// /**
// * 资讯分页展示接口
// * @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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment