提交 d569bfda 作者: xiaowang

新增:web首页分类信息

上级 54b07385
......@@ -3,14 +3,12 @@ package com.mmc.pms.controller;
import com.mmc.pms.common.Page;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.constant.TokenConstant;
import com.mmc.pms.model.categories.dto.CategoryTypeDTO;
import com.mmc.pms.model.lease.dto.LeaseGoodsInfoDTO;
import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.model.sale.dto.MallGoodsDetailDTO;
import com.mmc.pms.service.WebDeviceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
......@@ -33,11 +31,12 @@ public class ProductMallController extends BaseController {
@PostMapping("/deviceList")
public ResultBody<LeaseGoodsInfoDTO> listWareInfoPage(
@RequestBody @Validated(Page.class) WareInfoQO param, HttpServletRequest request) {
if (request.getHeader(TokenConstant.TOKEN) == null) {
return webDeviceService.listWareInfoPage(param, null, null);
}
return webDeviceService.listWareInfoPage(
param, request, this.getUserLoginInfoFromRedis(request).getUserAccountId());
param,
request,
request.getHeader(TokenConstant.TOKEN) == null
? null
: this.getUserLoginInfoFromRedis(request).getUserAccountId());
}
@ApiOperation(value = "设备设备详情")
......@@ -45,10 +44,19 @@ public class ProductMallController extends BaseController {
@GetMapping("/getLeaseGoodsDetail")
public ResultBody<MallGoodsDetailDTO> getLeaseGoodsDetail(
Integer goodsId, HttpServletRequest request) {
if (request.getHeader(TokenConstant.TOKEN) == null) {
return webDeviceService.getLeaseGoodsDetail(goodsId, null, null);
}
return webDeviceService.getLeaseGoodsDetail(
goodsId, this.getUserLoginInfoFromRedis(request).getUserAccountId(), request);
goodsId,
request.getHeader(TokenConstant.TOKEN) == null
? null
: this.getUserLoginInfoFromRedis(request).getUserAccountId(),
request);
}
@ApiOperation(value = "web-首页分类数据-展示")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = CategoryTypeDTO.class)})
@GetMapping("/getPageHomeCategories")
public ResultBody<CategoryTypeDTO> getPageHomeCategories(
@ApiParam(value = "类型:1:作业服务 2:设备 3:培训 4:产品商城") @RequestParam(value = "type") Integer type) {
return webDeviceService.getPageHomeCategories(type);
}
}
......@@ -60,4 +60,6 @@ public interface CategoriesDao {
List<Categories> getCategoriesListByIds(@Param("ids") Set<Integer> ids);
List<Categories> selectCategoryByDirectoryId(List<Integer> directoryIds);
List<Categories> getCategoriesListByDirectoryIds(List<Integer> directoryIds);
}
package com.mmc.pms.entity;
import com.mmc.pms.model.categories.dto.CategoriesInfoListDTO;
import com.mmc.pms.model.categories.dto.CategoryTypeDTO;
import com.mmc.pms.model.categories.dto.ClassifyDetailsDTO;
import com.mmc.pms.model.categories.dto.ClassifyInfoDTO;
import com.mmc.pms.model.categories.vo.ClassifyInfoVO;
......@@ -83,4 +84,8 @@ public class Categories implements Serializable {
.name(name)
.build();
}
public CategoryTypeDTO buildCategoryTypeDTO() {
return CategoryTypeDTO.builder().id(id).categoryName(name).build();
}
}
package com.mmc.pms.model.categories.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @Author LW
*
* @date 2023/6/10 13:46 概要:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class CategoryTypeDTO implements Serializable {
private Integer id;
private String categoryName;
}
......@@ -474,14 +474,14 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
}
}
}
// 2、对自定义的sku进行操作
List<GoodsProdSpecVO> zdySpecInfo =
goodsAddVO.getProductSpec().stream()
.filter(spec -> spec.getFlag().equals(1))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(zdySpecInfo)) {
updateCustomize(goodsInfo, zdySpecInfo, goodsAddVO.getId());
}
}
// 2、对自定义的sku进行操作
List<GoodsProdSpecVO> zdySpecInfo =
goodsAddVO.getProductSpec().stream()
.filter(spec -> spec.getFlag().equals(1))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(zdySpecInfo)) {
updateCustomize(goodsInfo, zdySpecInfo, goodsAddVO.getId());
}
}
......
......@@ -4,6 +4,7 @@ import com.mmc.pms.auth.dto.UserAccountSimpleDTO;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.constant.TokenConstant;
import com.mmc.pms.dao.CategoriesDao;
import com.mmc.pms.dao.GoodsInfoDao;
import com.mmc.pms.dao.ProductDao;
import com.mmc.pms.dao.WebDeviceDao;
......@@ -19,6 +20,7 @@ import com.mmc.pms.model.sale.dto.MallGoodsDetailDTO;
import com.mmc.pms.model.sale.dto.SkuInfoDTO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.WebDeviceService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -41,8 +43,11 @@ public class WebDeviceServiceImpl implements WebDeviceService {
@Autowired ProductDao productDao;
@Autowired GoodsInfoDao goodsInfoDao;
@Autowired GoodsInfoServiceImpl goodsInfoService;
@Autowired private CategoriesDao categoriesDao;
@Override
public ResultBody listSecondDistrict() {
List<DistrictDO> list = webDeviceDao.listSecondDistrict();
......@@ -246,6 +251,21 @@ public class WebDeviceServiceImpl implements WebDeviceService {
}
@Override
public ResultBody getPageHomeCategories(Integer type) {
List<DirectoryDO> directoryList = categoriesDao.getDirectoryList(type);
if (CollectionUtils.isNotEmpty(directoryList)) {
List<Integer> directoryIds =
directoryList.stream().map(DirectoryDO::getId).collect(Collectors.toList());
List<Categories> categoriesList = categoriesDao.getCategoriesListByDirectoryIds(directoryIds);
return ResultBody.success(
categoriesList.stream()
.map(Categories::buildCategoryTypeDTO)
.collect(Collectors.toList()));
}
return ResultBody.success();
}
@Override
public ResultBody<AdDTO> ad() {
List<AdDO> ad = webDeviceDao.ad();
List<AdDTO> collect =
......
package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.categories.dto.CategoryTypeDTO;
import com.mmc.pms.model.lease.dto.WareInfoDTO;
import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.other.dto.AdDTO;
......@@ -42,4 +43,6 @@ public interface WebDeviceService {
ResultBody getLeaseGoodsDetail(
Integer goodsId, Integer userAccountId, HttpServletRequest request);
ResultBody<CategoryTypeDTO> getPageHomeCategories(Integer type);
}
......@@ -204,6 +204,19 @@
where id = #{id}
and is_default = 0
</select>
<select id="getCategoriesListByDirectoryIds" resultType="com.mmc.pms.entity.Categories">
SELECT
id,
`name`
FROM
categories
<where>
is_deleted = 0
<foreach collection="list" item="d" index="index" open="directory_id IN (" close=")" separator=",">
#{d}
</foreach>
</where>
</select>
<update id="deleteById">
UPDATE `categories`
......
......@@ -155,9 +155,8 @@
<select id="countListWareInfoPage" parameterType="com.mmc.pms.entity.GoodsInfo" resultType="int">
SELECT count(*)
FROM goods_info gi
INNER JOIN goods_img img ON gi.id = img.goods_info_id
<where>
gi.is_deleted = 0 and gi.shelf_status = 0 and gi.goods_type = #{type}
gi.is_deleted = 0 and gi.shelf_status = 1 and gi.goods_type = #{type}
<if test="categoryIds != null and categoryIds.size != 0">
<foreach collection="categoryIds" item="item" index="index" open="and gi.category_by_one IN (" close=")"
separator=",">
......@@ -180,7 +179,7 @@
goods_info gi
INNER JOIN goods_img img ON gi.id = img.goods_info_id and img.img_type = 0
<where>
gi.is_deleted = 0 and gi.shelf_status = 0 and gi.goods_type = #{type}
gi.is_deleted = 0 and gi.shelf_status = 1 and gi.goods_type = #{type}
<if test="param.categoryId != null">
<foreach collection="param" item="item" index="index" open="and gi.category_by_one IN (" close=")"
separator=",">
......
......@@ -10,3 +10,4 @@ data-filter:
- /pms/product/mall/deviceList
- /pms/classify/queryCategoryInfoByType
- /pms/product/mall/getLeaseGoodsDetail
- /pms/product/mall/getPageHomeCategories
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论