微信模块迁移

This commit is contained in:
hupeng
2019-11-24 21:49:15 +08:00
parent 6afcb7083a
commit 8c4c9b0387
34 changed files with 290 additions and 136 deletions

View File

@ -0,0 +1,37 @@
package co.yixiang.modules.shop.service;
import co.yixiang.common.service.BaseService;
import co.yixiang.common.web.vo.Paging;
import co.yixiang.modules.shop.entity.YxArticle;
import co.yixiang.modules.shop.web.param.YxArticleQueryParam;
import co.yixiang.modules.shop.web.vo.YxArticleQueryVo;
import java.io.Serializable;
/**
* <p>
* 文章管理表 服务类
* </p>
*
* @author hupeng
* @since 2019-10-02
*/
public interface ArticleService extends BaseService<YxArticle> {
void incVisitNum(int id);
/**
* 根据ID获取查询对象
* @param id
* @return
*/
YxArticleQueryVo getYxArticleById(Serializable id) throws Exception;
/**
* 获取分页对象
* @param yxArticleQueryParam
* @return
*/
Paging<YxArticleQueryVo> getYxArticlePageList(YxArticleQueryParam yxArticleQueryParam);
}

View File

@ -0,0 +1,53 @@
package co.yixiang.modules.shop.service.impl;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.web.vo.Paging;
import co.yixiang.modules.shop.entity.YxArticle;
import co.yixiang.modules.shop.mapper.YxArticleMapper;
import co.yixiang.modules.shop.service.ArticleService;
import co.yixiang.modules.shop.web.param.YxArticleQueryParam;
import co.yixiang.modules.shop.web.vo.YxArticleQueryVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
/**
* <p>
* 文章管理表 服务实现类
* </p>
*
* @author hupeng
* @since 2019-10-02
*/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class ArticleServiceImpl extends BaseServiceImpl<YxArticleMapper, YxArticle> implements ArticleService {
@Autowired
private YxArticleMapper yxArticleMapper;
@Override
public YxArticleQueryVo getYxArticleById(Serializable id) throws Exception{
return yxArticleMapper.getYxArticleById(id);
}
@Override
public Paging<YxArticleQueryVo> getYxArticlePageList(YxArticleQueryParam yxArticleQueryParam){
Page page = setPageParam(yxArticleQueryParam,OrderItem.desc("add_time"));
IPage<YxArticleQueryVo> iPage = yxArticleMapper.getYxArticlePageList(page,yxArticleQueryParam);
return new Paging(iPage);
}
@Override
public void incVisitNum(int id) {
yxArticleMapper.incVisitNum(id);
}
}

View File

@ -27,7 +27,7 @@ import java.io.Serializable;
* @since 2019-10-02
*/
@Slf4j
@Service
//@Service
@Transactional(rollbackFor = Exception.class)
public class YxArticleServiceImpl extends BaseServiceImpl<YxArticleMapper, YxArticle> implements YxArticleService {

View File

@ -6,7 +6,7 @@ import co.yixiang.common.web.param.IdParam;
import co.yixiang.common.web.vo.Paging;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.modules.shop.entity.YxArticle;
import co.yixiang.modules.shop.service.YxArticleService;
import co.yixiang.modules.shop.service.ArticleService;
import co.yixiang.modules.shop.web.param.YxArticleQueryParam;
import co.yixiang.modules.shop.web.vo.YxArticleQueryVo;
import io.swagger.annotations.Api;
@ -32,7 +32,7 @@ import javax.validation.Valid;
public class ArticleController extends BaseController {
@Autowired
private YxArticleService yxArticleService;
private ArticleService articleService;
/**
@ -41,8 +41,8 @@ public class ArticleController extends BaseController {
@GetMapping("/details/{id}")
@ApiOperation(value = "文章详情",notes = "文章详情",response = YxArticleQueryVo.class)
public ApiResult<YxArticleQueryVo> getYxArticle(@PathVariable Integer id) throws Exception{
YxArticleQueryVo yxArticleQueryVo = yxArticleService.getYxArticleById(id);
yxArticleService.incVisitNum(id);
YxArticleQueryVo yxArticleQueryVo = articleService.getYxArticleById(id);
articleService.incVisitNum(id);
return ApiResult.ok(yxArticleQueryVo);
}
@ -59,7 +59,7 @@ public class ArticleController extends BaseController {
YxArticleQueryParam yxArticleQueryParam = new YxArticleQueryParam();
yxArticleQueryParam.setCurrent(page);
yxArticleQueryParam.setSize(limit);
Paging<YxArticleQueryVo> paging = yxArticleService.getYxArticlePageList(yxArticleQueryParam);
Paging<YxArticleQueryVo> paging = articleService.getYxArticlePageList(yxArticleQueryParam);
return ApiResult.ok(paging.getRecords());
}

View File

@ -36,7 +36,6 @@ public class IndexController {
private final YxSystemGroupDataService systemGroupDataService;
private final YxSystemConfigService systemConfigService;
private final YxStoreProductService storeProductService;
private final YxArticleService articleService;
@GetMapping("/index")
@ApiOperation(value = "首页数据",notes = "首页数据")

View File

@ -6,7 +6,7 @@ spring:
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://localhost:3306/yshop?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
username: yshop
password:
password:
# 初始化配置
initial-size: 3