fix
This commit is contained in:
@@ -20,7 +20,13 @@ public interface IPlayShopArticleInfoService extends IService<PlayShopArticleInf
|
|||||||
*/
|
*/
|
||||||
PlayShopArticleInfoEntity selectById(String id);
|
PlayShopArticleInfoEntity selectById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据文章类型查询店铺文章
|
||||||
|
*
|
||||||
|
* @param type 店铺文章类型
|
||||||
|
* @return 店铺文章信息
|
||||||
|
*/
|
||||||
|
PlayShopArticleInfoEntity selectByType(String type);
|
||||||
/**
|
/**
|
||||||
* 查询店铺文章信息列表
|
* 查询店铺文章信息列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.starry.admin.common.exception.CustomException;
|
||||||
import com.starry.admin.modules.shop.mapper.PlayShopArticleInfoMapper;
|
import com.starry.admin.modules.shop.mapper.PlayShopArticleInfoMapper;
|
||||||
import com.starry.admin.modules.shop.mapper.PlayShopCarouselInfoMapper;
|
import com.starry.admin.modules.shop.mapper.PlayShopCarouselInfoMapper;
|
||||||
import com.starry.admin.modules.shop.module.entity.PlayShopArticleInfoEntity;
|
import com.starry.admin.modules.shop.module.entity.PlayShopArticleInfoEntity;
|
||||||
@@ -27,6 +28,14 @@ public class PlayShopArticleInfoServiceImpl extends ServiceImpl<PlayShopArticleI
|
|||||||
@Resource
|
@Resource
|
||||||
private PlayShopCarouselInfoMapper playCarouselInfoMapper;
|
private PlayShopCarouselInfoMapper playCarouselInfoMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PlayShopArticleInfoEntity selectByType(String type) {
|
||||||
|
LambdaQueryWrapper<PlayShopArticleInfoEntity> lambdaWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaWrapper.eq(PlayShopArticleInfoEntity::getArticleType, type);
|
||||||
|
return this.baseMapper.selectOne(lambdaWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询店铺首页轮播
|
* 查询店铺首页轮播
|
||||||
*
|
*
|
||||||
@@ -35,7 +44,11 @@ public class PlayShopArticleInfoServiceImpl extends ServiceImpl<PlayShopArticleI
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PlayShopArticleInfoEntity selectById(String id) {
|
public PlayShopArticleInfoEntity selectById(String id) {
|
||||||
return this.baseMapper.selectById(id);
|
PlayShopArticleInfoEntity entity = this.baseMapper.selectById(id);
|
||||||
|
if (entity == null) {
|
||||||
|
throw new CustomException("对象不存在");
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
package com.starry.admin.modules.weichat.controller;
|
package com.starry.admin.modules.weichat.controller;
|
||||||
|
|
||||||
|
import com.starry.admin.common.aspect.ClerkUserLogin;
|
||||||
|
import com.starry.admin.modules.shop.module.entity.PlayShopArticleInfoEntity;
|
||||||
import com.starry.admin.modules.shop.module.entity.PlayShopCarouselInfoEntity;
|
import com.starry.admin.modules.shop.module.entity.PlayShopCarouselInfoEntity;
|
||||||
|
import com.starry.admin.modules.shop.service.IPlayShopArticleInfoService;
|
||||||
import com.starry.admin.modules.shop.service.IPlayShopCarouselInfoService;
|
import com.starry.admin.modules.shop.service.IPlayShopCarouselInfoService;
|
||||||
|
import com.starry.admin.modules.weichat.entity.PlayShopArticleInfoQueryVo;
|
||||||
|
import com.starry.admin.modules.weichat.entity.PlayShopArticleInfoReturnVo;
|
||||||
|
import com.starry.admin.modules.weichat.entity.PlayShopReadArticleVo;
|
||||||
import com.starry.admin.modules.weichat.entity.shop.ShopHomeCarouseInfoReturnVo;
|
import com.starry.admin.modules.weichat.entity.shop.ShopHomeCarouseInfoReturnVo;
|
||||||
import com.starry.common.result.R;
|
import com.starry.common.result.R;
|
||||||
import com.starry.common.utils.ConvertUtil;
|
import com.starry.common.utils.ConvertUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@@ -14,7 +21,7 @@ import javax.annotation.Resource;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态接口
|
* 店铺接口
|
||||||
*
|
*
|
||||||
* @author admin
|
* @author admin
|
||||||
* @since 2024/5/20 下午11:19
|
* @since 2024/5/20 下午11:19
|
||||||
@@ -28,7 +35,12 @@ public class WxShopController {
|
|||||||
@Resource
|
@Resource
|
||||||
private IPlayShopCarouselInfoService playShopCarouselInfoService;
|
private IPlayShopCarouselInfoService playShopCarouselInfoService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IPlayShopArticleInfoService playShopArticleInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取首页轮播图
|
||||||
|
*/
|
||||||
@GetMapping(value = "custom/getShopHomeCarouseInfo")
|
@GetMapping(value = "custom/getShopHomeCarouseInfo")
|
||||||
public R getShopHomeCarouseInfo() {
|
public R getShopHomeCarouseInfo() {
|
||||||
List<PlayShopCarouselInfoEntity> entities = playShopCarouselInfoService.selectHomeCarouselInfo();
|
List<PlayShopCarouselInfoEntity> entities = playShopCarouselInfoService.selectHomeCarouselInfo();
|
||||||
@@ -36,4 +48,28 @@ public class WxShopController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取店铺文章
|
||||||
|
*/
|
||||||
|
@ClerkUserLogin
|
||||||
|
@GetMapping(value = "clerk/getShopArticleInfo")
|
||||||
|
public R getShopArticleInfo(@RequestBody PlayShopArticleInfoQueryVo vo) {
|
||||||
|
PlayShopArticleInfoEntity entity = playShopArticleInfoService.selectByType(vo.getType());
|
||||||
|
return R.ok(ConvertUtil.entityToVo(entity, PlayShopArticleInfoReturnVo.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阅读店铺文章
|
||||||
|
*/
|
||||||
|
@ClerkUserLogin
|
||||||
|
@GetMapping(value = "clerk/readShopArticleInfo")
|
||||||
|
public R readShopArticleInfo(@RequestBody PlayShopReadArticleVo vo) {
|
||||||
|
PlayShopArticleInfoEntity entity = playShopArticleInfoService.selectById(vo.getId());
|
||||||
|
entity.setVisitsNumber(entity.getVisitsNumber() + 1);
|
||||||
|
playShopArticleInfoService.update(entity);
|
||||||
|
return R.ok("成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.starry.admin.modules.weichat.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @since 2024/7/24 上午9:36
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class PlayShopArticleInfoQueryVo {
|
||||||
|
|
||||||
|
@NotNull(message = "type不能为空")
|
||||||
|
private String type;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.starry.admin.modules.weichat.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @since 2024/7/24 上午9:36
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class PlayShopArticleInfoReturnVo {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 文章标题
|
||||||
|
**/
|
||||||
|
private String articleTitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章内容
|
||||||
|
**/
|
||||||
|
private String articleContent;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.starry.admin.modules.weichat.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @since 2024/7/24 上午9:36
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class PlayShopReadArticleVo {
|
||||||
|
|
||||||
|
@NotNull(message = "id不能为空")
|
||||||
|
private String id;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user