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> { ...@@ -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);
} }
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
select count (*) from shop_zx select count (*) from shop_zx
</select> </select>
<select id="selectPage" resultMap="zxMap"> <select id="selectPage" resultType="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,
......
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);
} }
...@@ -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;
// }
// }
} }
...@@ -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")
......
...@@ -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
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