Commit 7ac9fa44 authored by licc's avatar licc

Merge remote-tracking branch 'origin/master'

parents 84dc2c63 e68a244d
package cn.wisenergy.common.utils;
/**
* 分页请求
* Created by m1991 on 2021/3/7 15:09
*/
public class PageRequest {
/**
* 当前页码
*/
private int pageNum;
/**
* 每页数量
*/
private int pageSize;
public int getPageNum() {
return pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
}
package cn.wisenergy.common.utils;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* Created by m1991 on 2021/3/7 15:11
*/
@Component
@EnableCaching
public class PageResult {
/**
* 当前页码
*/
private int pageNum;
/**
* 每页数量
*/
private int pageSize;
/**
* 记录总数
*/
private long totalSize;
/**
* 页码总数
*/
private int totalPages;
/**
* 数据模型
*/
private List<?> content;
public int getPageNum() {
return pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public long getTotalSize() {
return totalSize;
}
public void setTotalSize(long totalSize) {
this.totalSize = totalSize;
}
public int getTotalPages() {
return totalPages;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public List<?> getContent() {
return content;
}
public void setContent(List<?> content) {
this.content = content;
}
}
package cn.wisenergy.common.utils;
import com.github.pagehelper.PageInfo;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.stereotype.Component;
/**
* Created by m1991 on 2021/3/7 15:12
*/
@Component
@EnableCaching
public class PageUtils {
/**
* 将分页信息封装到统一的接口
* @param pageRequest
* @param
* @return
*/
public static PageResult getPageResult(PageRequest pageRequest, PageInfo<?> pageInfo) {
PageResult pageResult = new PageResult();
pageResult.setPageNum(pageInfo.getPageNum());
pageResult.setPageSize(pageInfo.getPageSize());
pageResult.setTotalSize(pageInfo.getTotal());
pageResult.setTotalPages(pageInfo.getPages());
pageResult.setContent(pageInfo.getList());
return pageResult;
}
}
......@@ -21,6 +21,7 @@
<artifactId>wisenergy-model</artifactId>
<version>${moduleVersion.wisenergy-model}</version>
</dependency>
</dependencies>
<!-- MAVEN构建 -->
......
......@@ -27,12 +27,14 @@ public interface ShopZxMapper extends BaseMapper<shopZx> {
* @param
* @return
*/
List<shopZx> selectAll(@Param("PageSize") int PageSize,@Param("beginPos") int beginPos);
// List selectAll( @Param("beginPos") int beginPos,@Param("PageSize") int PageSize);
// /**查询方法
// * @param
// * @return
// */
// List<shopZx> selectAllNum(@Param("") int ,@Param("") int );
/**
* 分页查询资讯
* @return
*/
// List<shopZx> selectPage();
}
......@@ -90,7 +90,7 @@ public interface UsersMapper extends BaseMapper<User> {
public List<User> getUsersListByMap(Map<String,Object> param);
//根据手机号查询用户Integer
Integer queryUsersByPhone(@Param("userId")String userId);
User queryUsersByPhone(@Param("userId")String userId);
//根据用户的推荐人邀请码比对推荐人的本人邀请码,查询推荐人的用户ID
Integer inviteCodeBeInvitedCode(@Param("beInvitedCode")Integer beInvitedCode);
......
......@@ -48,7 +48,7 @@
<!--</insert>-->
<!--资讯内容倒叙查询-->
<select id="selectAll" parameterType="cn.wisenergy.model.app.shopZx" resultType="cn.wisenergy.model.app.shopZx">
<select id="selectAll" parameterType="java.lang.Integer" 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,
......@@ -60,6 +60,13 @@
select count (*) from shop_zx
</select>
<select id="selectPage" resultMap="zxMap">
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,
imgUrl as imgUrl,zxAddress as zxAddress from shop_zx order by zxid desc limit #{beginPos},#{pageSize}
</select>
</mapper>
\ No newline at end of file
......@@ -169,9 +169,9 @@
insert into user_info(user_id,be_invited_code) value (#{userId},#{beInvitedCode})
</insert>
<select id="queryUsersByPhone" resultType="java.lang.Integer">
<select id="queryUsersByPhone" resultType="cn.wisenergy.model.app.User">
select
user_id
<include refid="vals"/>
from
<include refid="table"/>
<where>
......
package cn.wisenergy.model.app;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* Created by m1991 on 2021/3/1 14:00
*/
public class UsersDto extends User{
public class UsersDto extends User implements Serializable {
/**
* 主键id
*/
private Integer id;
/**
* 手机号作为用户账号
*/
private String userId;
/**
* 用户头像
*/
private String headImage;
/**
* 用户会员等级
*/
private int userLevel;
/**
* 跨境额度
*/
private BigDecimal crossBorderLine;
/**
* 用户本人邀请码
*/
private String inviteCode;
/**
* 推荐人邀请码
*/
private String beInvitedCode;
/**
* 创建时间
*/
private Date createTime;
//用户token
private String token;
@Override
public Integer getId() {
return id;
}
@Override
public void setId(Integer id) {
this.id = id;
}
@Override
public String getUserId() {
return userId;
}
@Override
public void setUserId(String userId) {
this.userId = userId;
}
@Override
public String getHeadImage() {
return headImage;
}
@Override
public void setHeadImage(String headImage) {
this.headImage = headImage;
}
@Override
public int getUserLevel() {
return userLevel;
}
@Override
public void setUserLevel(int userLevel) {
this.userLevel = userLevel;
}
@Override
public BigDecimal getCrossBorderLine() {
return crossBorderLine;
}
@Override
public void setCrossBorderLine(BigDecimal crossBorderLine) {
this.crossBorderLine = crossBorderLine;
}
@Override
public String getInviteCode() {
return inviteCode;
}
@Override
public void setInviteCode(String inviteCode) {
this.inviteCode = inviteCode;
}
@Override
public String getBeInvitedCode() {
return beInvitedCode;
}
@Override
public void setBeInvitedCode(String beInvitedCode) {
this.beInvitedCode = beInvitedCode;
}
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getToken() {
return token;
}
......
package cn.wisenergy.service.app;
import cn.wisenergy.model.app.Page;
import cn.wisenergy.common.utils.PageRequest;
import cn.wisenergy.common.utils.PageResult;
import cn.wisenergy.model.app.shopZx;
import org.springframework.core.io.Resource;
import org.springframework.web.multipart.MultipartFile;
......@@ -56,5 +57,14 @@ public interface UploadService {
// public Page<shopZx> find();
/**
* 分页查询接口
* 这里统一封装了分页请求和结果,避免直接引入具体框架的分页对象, 如MyBatis或JPA的分页对象
* 从而避免因为替换ORM框架而导致服务层、控制层的分页接口也需要变动的情况,替换ORM框架也不会
* 影响服务层以上的分页接口,起到了解耦的作用
* @param pageRequest 自定义,统一分页查询请求
* @return PageResult 自定义,统一分页查询结果
*/
// PageResult findPage(PageRequest pageRequest);
}
......@@ -11,23 +11,22 @@ import java.util.Map;
* @ Description: 用户接口
* @ Author : 86187
* @ Date : 2021/1/6 16:08
* @author 86187
*/
public interface UserService {
/**
* 获取用户信息
*
* @param userId 用户id
* @return 用户信息
*/
User getById(String userId);
User getById(String userId);
R<Integer> getById1(String userId);
R<Integer> getById1(String userId);
/**
* 获取用户信息
*
* @param userId 用户id
* @return 用户信息
*/
......@@ -38,7 +37,6 @@ public interface UserService {
//根据OpenId查询用户
public User queryUsersByOpenId(String openId);
/**
*用户注册
*/
......@@ -48,19 +46,7 @@ public interface UserService {
//
Integer getuserIdById(String userId);
/**
* 获取空投池列表
*
* @return 空投池列表
*/
R<AerialDeliveryVo> queryAerialDelivery();
/**
* 设置用户头像
* @param userId 用户id
* @param headImage 头像地址
* @return true or false
*/
R<Boolean> setHeadImage(String userId,String headImage);
R<Boolean> setHeadImage(String userId, String headImage);
}
package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.FileException;
import cn.wisenergy.common.utils.FileUtils;
import cn.wisenergy.common.utils.FrameGrabberKit;
import cn.wisenergy.common.utils.*;
import cn.wisenergy.common.utils.StringUtil;
import cn.wisenergy.model.app.Page;
import cn.wisenergy.model.app.shopZx;
import com.alibaba.fastjson.JSON;
import com.youzan.cloud.open.sdk.common.util.CheckUtils;
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;
......@@ -47,7 +44,8 @@ public class UploadServiceImpl implements UploadService {
@Autowired
private ShopZxMapper shopZxMapper;
/**
/**
* 视频文件上传
*/
@Override
......@@ -324,38 +322,30 @@ public class UploadServiceImpl implements UploadService {
@Override
public Map getList(int beginPos, int pageSize) {
Map map =new HashMap();
String[] ImgUrl = new String[0];
List<shopZx> 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;
}else {
map.put("date",date);
map.put("ImgUrl",ImgUrl);
map.put("code",0);
map.put("msg","获取资讯分页数据成功!");
return map;
}
return null;
}
// @Override
// public Page<shopZx> find() {
// if (null == page) {
// page = 0;
// 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 (CheckUtils.isEmpty(size)) {
// size = 10;
// }
// PageRequest pageable = PageRequest.of(page, size, Sort.Direction.DESC, "updateTime");
// Page<User> users = userRepository.findAll(pageable);
// return users;
// 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;
// }
// }
}
package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.common.utils.RedisUtils;
import cn.wisenergy.common.utils.ResultUtils;
import cn.wisenergy.common.utils.ShareCodeUtil;
import cn.wisenergy.mapper.RecommendUserMapper;
import cn.wisenergy.mapper.TeamUserInfoMapper;
......@@ -67,7 +69,8 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
if(!CollectionUtils.isEmpty(usersList)){
return usersList.get(0);
}
return null;
// return ResultUtils.returnFail("","");
return null;
}
@Override
......@@ -78,14 +81,14 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
@Override
public Map userByZx(String userId, String beInvitedCode) {
//查询数据库,看看是否存在该用户
// Integer yh=usersMapper.getuserIdById(userId);
// Integer yh=usersMapper.getuserIdById(userId);
User byUserId = usersMapper.getByUserId(userId);
if(null != byUserId){
R.error(0,"该用户已存在!请直接登录!") ;
Map map=new HashMap();
map.put("code",0);
map.put("msg","该用户已存在!请直接登录!");
return map;
R.error(0,"该用户已存在!请直接登录!") ;
Map map=new HashMap();
map.put("code",0);
map.put("msg","该用户已存在!请直接登录!");
return map;
}
/**
* 判断用户推荐人的邀请码是否为空,空的话填写1
......@@ -105,16 +108,16 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
int idb=usersMapper.beInvitedCode1(beInvitedCode);
//判断被邀请用户的创建时间是否比推荐人的用户时间晚
if(idb<ida){
Map map=new HashMap();
R.error(1,"注册失败!邀请码无效,请重新填写!");
map.put("code:",1);
map.put("msg:","注册失败!邀请码无效,请重新填写!");
Map map=new HashMap();
R.error(1,"注册失败!邀请码无效,请重新填写!");
map.put("code:",1);
map.put("msg:","注册失败!邀请码无效,请重新填写!");
return map;
}
if (null == beInvitedCode || "" == beInvitedCode) {
beInvitedCode = String.valueOf(1);
}
if (null == beInvitedCode || "" == beInvitedCode) {
beInvitedCode = String.valueOf(1);
}
}
//根据插入的用户手机号,查询用户唯一ID
......@@ -136,7 +139,7 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
Map map =new HashMap();
map.put("code",0);
map.put("msg","注册成功!");
return map;
return map;
}
//插入直推用户表
RecommendUser recommendUser = new RecommendUser();
......
......@@ -13,8 +13,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
*/
@EnableCaching
@SpringBootApplication(exclude = {MultipartAutoConfiguration.class})
@MapperScan(
basePackages = "cn.wisenergy.mapper")
@EnableSwagger2
@EnableScheduling
public class Application {
......
......@@ -30,11 +30,11 @@ import java.util.Map;
@RequestMapping("/api/user")
@RestController
public class LoginController {
@Autowired
private RedisUtils redisUtils;
@Autowired
private RedisUtils redisUtils;
@Autowired
private UserService usersService;
@Autowired
private UserService usersService;
// @Autowired
// private Result result;
......@@ -51,84 +51,83 @@ public class LoginController {
@ApiImplicitParams({
@ApiImplicitParam(name = "sms", value = "验证码", dataType = "String"),
@ApiImplicitParam(name = "userId", value = "用户手机号", required = true, dataType = "String")})
@RequestMapping("/login")
public Result loginBySms(String userId, String sms)throws Exception{
User users=null;
String key= StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.SMS_PRIFIX,userId,Constants.Sms.CodeType.LOGIN_OR_REGISTER+"");
String redisCode=redisUtils.getValue(key);
if(StringUtil.isBlank(redisCode) || !sms.equals(redisCode)){
throw new BaseException(ResultEnum.FAIL_VERIFY);
}
redisUtils.delete(key);
//根据手机号判断用户是否存在
//不存在则保存用户信息--修改为提示用户注册
users=usersService.queryUsersByPhone(userId);
@RequestMapping("/login")
public Result loginBySms(String userId, String sms)throws Exception{
User users=null;
String key= StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.SMS_PRIFIX,userId,Constants.Sms.CodeType.LOGIN_OR_REGISTER+"");
String redisCode=redisUtils.getValue(key);
if(StringUtil.isBlank(redisCode) || !sms.equals(redisCode)){
throw new BaseException(ResultEnum.FAIL_VERIFY);
}
redisUtils.delete(key);
//根据手机号判断用户是否存在
//不存在则保存用户信息--修改为提示用户注册
users=usersService.queryUsersByPhone(userId);
if(null==users){
throw new BaseException(ResultEnum.FAIL_ACCOUNT_NOT_EXIST);
if(null==users){
throw new BaseException(ResultEnum.FAIL_ACCOUNT_NOT_EXIST);
// users=new User();
// users.setUserId(userId);
// usersService.qdtxAddUsers(users);;
}
String token=createToken(users);
if(!StringUtil.isBlank(token)){
return ResultUtils.returnDataSuccess(StringUtil.createSimpleMap("token",token));
}
return ResultUtils.returnFail();
}
public String createToken(User users)throws Exception{
String token=StringUtil.createToken();
//保存token
String tokenKey=StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.TOKEN_PRIFIX,token);
UsersDto usersDto=new UsersDto();
BeanUtils.copyProperties(users,usersDto);
redisUtils.set(tokenKey, JSONObject.toJSONString(usersDto),Constants.Duration.HALF_HOUR_INT);
return token;
String token=createToken(users);
if(!StringUtil.isBlank(token)){
return ResultUtils.returnDataSuccess(StringUtil.createSimpleMap("token",token));
}
return ResultUtils.returnFail();
}
public String createToken(User users)throws Exception{
String token=StringUtil.createToken();
//保存token
String tokenKey=StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.TOKEN_PRIFIX,token);
UsersDto usersDto=new UsersDto();
BeanUtils.copyProperties(users,usersDto);
redisUtils.set(tokenKey, JSONObject.toJSONString(usersDto),Constants.Duration.HALF_HOUR_INT);
return token;
}
@ApiOperation(value = "获取用户登录token信息", notes = "获取用户登录token信息", httpMethod = "POST", produces = "application/json; charset=UTF-8")
@RequestMapping("/info")
public Result info(HttpServletRequest request)throws Exception{
String token=request.getHeader("token");
String tokenKey=StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.TOKEN_PRIFIX,token);
String userDtoJson=redisUtils.getValue(tokenKey);
if(StringUtil.isBlank(userDtoJson)){
throw new BaseException(ResultEnum.FILE_NOT_LOGIN);
}
UsersDto usersDto=JSONObject.parseObject(userDtoJson,UsersDto.class);
usersDto.setPassword(null);
return ResultUtils.returnDataSuccess(userDtoJson);
@ApiOperation(value = "获取用户登录token信息", notes = "获取用户登录token信息", httpMethod = "POST", produces = "application/json; charset=UTF-8")
@RequestMapping("/info")
public Result info(HttpServletRequest request)throws Exception{
String token=request.getHeader("token");
String tokenKey=StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.TOKEN_PRIFIX,token);
String userDtoJson=redisUtils.getValue(tokenKey);
if(StringUtil.isBlank(userDtoJson)){
throw new BaseException(ResultEnum.FILE_NOT_LOGIN);
}
UsersDto usersDto=JSONObject.parseObject(userDtoJson,UsersDto.class);
usersDto.setPassword(null);
return ResultUtils.returnDataSuccess(userDtoJson);
}
//用户注册
@ApiOperation(value = "用户注册", notes = "用户注册", httpMethod = "POST", produces = "application/json; charset=UTF-8")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户手机号", required = true, dataType = "String"),
@ApiImplicitParam(name = "beInvitedCode", value = "推荐人邀请码", required = false, dataType = "String"),
@ApiImplicitParam(name = "sms", value = "验证码",required = true, dataType = "String")
})
@RequestMapping("/register")
public Map register(@RequestParam String userId, String beInvitedCode, @RequestParam String sms)throws Exception {
User users=null;
String key= StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.SMS_PRIFIX,userId,Constants.Sms.CodeType.LOGIN_OR_REGISTER+"");
String redisCode=redisUtils.getValue(key);
if(StringUtil.isBlank(redisCode) || !sms.equals(redisCode)){
throw new BaseException(ResultEnum.FAIL_VERIFY);
}
redisUtils.delete(key);
//判断phone是否符合输入类型
if(!userId.matches(Constants.RegConstant.PHONE_REGSTR)){
throw new BaseException(ResultEnum.PHONE_ERROR);
}
//用户注册
@ApiOperation(value = "用户注册", notes = "用户注册", httpMethod = "POST", produces = "application/json; charset=UTF-8")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户手机号", required = true, dataType = "String"),
@ApiImplicitParam(name = "beInvitedCode", value = "推荐人邀请码", required = false, dataType = "String"),
@ApiImplicitParam(name = "sms", value = "验证码",required = true, dataType = "String")
})
@RequestMapping("/register")
public Map register(@RequestParam String userId, String beInvitedCode, @RequestParam String sms)throws Exception {
User users=null;
String key= StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.SMS_PRIFIX,userId,Constants.Sms.CodeType.LOGIN_OR_REGISTER+"");
String redisCode=redisUtils.getValue(key);
if(StringUtil.isBlank(redisCode) || !sms.equals(redisCode)){
throw new BaseException(ResultEnum.FAIL_VERIFY);
}
redisUtils.delete(key);
//判断phone是否符合输入类型
if(!userId.matches(Constants.RegConstant.PHONE_REGSTR)){
throw new BaseException(ResultEnum.PHONE_ERROR);
}
// if(userId.equals())){
// throw new BaseException(ResultEnum.PHONE_ERROR);
// }
return usersService.userByZx(userId,beInvitedCode);
}
return usersService.userByZx(userId,beInvitedCode);
}
}
......@@ -37,27 +37,6 @@ public class SmsController {
@ApiImplicitParam(name = "codeType", value = "验证码类型用途 0注册/登录验证 1修改密码 2订单通知信息", dataType = "Integer")})
@RequestMapping("/verifyCode")
public Result verifyCode(String phone, Integer codeType) throws Exception {
// //判断phone和codeType是否符合输入类型
// if(!phone.matches(Constants.RegConstant.PHONE_REGSTR)){
// throw new BaseException(ResultEnum.PHONE_ERROR);
// }
// if(codeType!=Constants.Sms.CodeType.LOGIN_OR_REGISTER && codeType!=Constants.Sms.CodeType.PASS_UPDATE && codeType!=Constants.Sms.CodeType.ORDER_NOTICE){
// throw new BaseException(ResultEnum.CODETYPE_ERROR);
// }
// String key= StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.SMS_PRIFIX,phone,codeType+"");
// //判断是否超过60S
// String oldCode=redisUtils.getValue(key);
// if(!StringUtils.isBlank(oldCode)){
// throw new BaseException(ResultEnum.CODESEND_ERROR);
// }
// //生成随机数
// String code= MathUtils.random();
// //保存至Redis
// redisUtils.set(key,code,Constants.Duration.MINUTE_INT);
//
//
// boolean flag=smsUtils.sendMessage(phone,Constants.Sms.TemplateCode.LOGIN_DL_REGISTER,code);
// return flag? ResultUtils.returnSuccess():ResultUtils.returnFail();
//判断phone和codeType是否符合输入类型
if(!phone.matches(Constants.RegConstant.PHONE_REGSTR)){
throw new BaseException(ResultEnum.PHONE_ERROR);
......
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.Result;
import cn.wisenergy.model.app.Page;
import cn.wisenergy.model.app.shopZx;
import cn.wisenergy.service.app.UploadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -112,16 +110,15 @@ public class UploadController {
* @param pageSize
* @return
*/
@ApiOperation(value = "资讯信息-文字/多图片上传接口", notes = "上传图片,返回路径给前台", httpMethod = "POST", produces = "application/json; charset=UTF-8")
@ApiOperation(value = "资讯信息接口", notes = "资讯信息接口", httpMethod = "GET", produces = "application/json; charset=UTF-8")
@ApiImplicitParams({
@ApiImplicitParam(name = "beginPos", value = "从几开始", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "展示数量(条数)", required = true, dataType = "Integer")})
@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) {
Page<shopZx> shopZxPage = (Page<shopZx>) uploadService.getList(beginPos, pageSize);
Map shopZxPage = uploadService.getList(beginPos, pageSize);
return new Result(String.valueOf(0), "success", shopZxPage);
return new Result("0", "success", shopZxPage);
}
......
package cn.wisenergy.web.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@MapperScan(basePackages = "cn.wisenergy.mapper*")
@EnableConfigurationProperties(MybatisPlusProperties.class)
public class MyBatisPlusConfig {
/**
* 分页插件
* mybatis-plus分页插件
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
// 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求 默认false
// paginationInterceptor.setOverflow(false);
// 设置最大单页限制数量,默认 500 条,-1 不受限制
// paginationInterceptor.setLimit(500);
// 开启 count 的 join 优化,只针对部分 left join
paginationInterceptor.setDbType(DbType.MYSQL);
paginationInterceptor.setCountSqlParser(new JsqlParserCountOptimize(true));
return paginationInterceptor;
}
......
......@@ -32,9 +32,9 @@ public class LoginInterceptor extends HandlerInterceptorAdapter {
* 直接放行的接口
*/
public static String[] EXCLUDE_URI = new String[]{
"/api/user/login",
"shop-mall/api/*",
"/pay/alipay/notify",
"/ZX/**",
"shop-mall/ZX/**",
"/pay/alipay/return",
"/user/wechat/callback"};
......
......@@ -30,22 +30,24 @@ spring:
#mybatis
mybatis-plus:
check-config-location: true
mapper-locations: classpath*:/mapper/**/*.xml
#实体扫描,多个package用逗号或者分号分隔
#typeAliasesPackage: cn.wisenergy.service.*
type-aliases-package: cn.wisenergy.model.app.**
global-config:
#数据库相关配置
db-config:
#主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
id-type: AUTO
#驼峰下划线转换
column-underline: true
logic-delete-value: -1
logic-not-delete-value: 0
banner: false
#原生配置
configuration:
lazy-loading-enabled: true
aggressive-lazy-loading: false
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
jdbc-type-for-null: 'null'
jdbc-type-for-null: 'null'
\ No newline at end of file
This diff is collapsed.
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