提交 f2a1432b 作者: xiaowang

新增:商品列表

上级 1a012e0e
package com.mmc.pms.controller; package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.model.categories.dto.AllCategoryDTO; import com.mmc.pms.model.categories.dto.AllCategoryDTO;
import com.mmc.pms.model.categories.dto.ClassifyDetailsDTO; import com.mmc.pms.model.categories.dto.ClassifyDetailsDTO;
import com.mmc.pms.model.categories.dto.ClassifyInfoDTO; import com.mmc.pms.model.categories.dto.ClassifyInfoDTO;
import com.mmc.pms.model.categories.vo.CategoriesInfoVO;
import com.mmc.pms.model.categories.vo.ClassifyInfoVO; import com.mmc.pms.model.categories.vo.ClassifyInfoVO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO; import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import com.mmc.pms.model.categories.vo.RelevantBusinessVO; import com.mmc.pms.model.categories.vo.RelevantBusinessVO;
...@@ -17,10 +15,8 @@ import io.swagger.annotations.*; ...@@ -17,10 +15,8 @@ import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import java.util.List;
/** /**
* @Author lw @Date 2023/5/15 13:24 @Version 1.0 * @Author lw @Date 2023/5/15 13:24 @Version 1.0
...@@ -29,8 +25,7 @@ import java.util.List; ...@@ -29,8 +25,7 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/classify") @RequestMapping("/classify")
public class BackstageCategoriesController { public class BackstageCategoriesController {
@Autowired @Autowired private CategoriesService categoriesService;
private CategoriesService categoriesService;
@ApiOperation(value = "新增or修改目录") @ApiOperation(value = "新增or修改目录")
@PostMapping("addOrEditDirectory") @PostMapping("addOrEditDirectory")
...@@ -42,41 +37,48 @@ public class BackstageCategoriesController { ...@@ -42,41 +37,48 @@ public class BackstageCategoriesController {
@ApiOperation(value = "目录列表") @ApiOperation(value = "目录列表")
@GetMapping("directoryList") @GetMapping("directoryList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)})
public ResultBody directoryList(@RequestParam Integer pageNo, @RequestParam Integer pageSize, @RequestParam(required = false) Integer type) { public ResultBody directoryList(
@RequestParam Integer pageNo,
@RequestParam Integer pageSize,
@RequestParam(required = false) Integer type) {
return ResultBody.success(categoriesService.directoryList(pageNo, pageSize, type)); return ResultBody.success(categoriesService.directoryList(pageNo, pageSize, type));
} }
@ApiOperation(value = "删除目录") @ApiOperation(value = "删除目录")
@GetMapping("removeDirectory") @GetMapping("removeDirectory")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody removeDirectory(@ApiParam(value = "id") @RequestParam(value = "id") Integer id) { public ResultBody removeDirectory(
@ApiParam(value = "id") @RequestParam(value = "id") Integer id) {
return categoriesService.removeDirectory(id); return categoriesService.removeDirectory(id);
} }
@ApiOperation(value = "分类新增") @ApiOperation(value = "分类新增")
@PostMapping("addClassification") @PostMapping("addClassification")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addClassification(@Validated(Create.class) @RequestBody ClassifyInfoVO classifyInfoVO) { public ResultBody addClassification(
@Validated(Create.class) @RequestBody ClassifyInfoVO classifyInfoVO) {
return categoriesService.addClassification(classifyInfoVO); return categoriesService.addClassification(classifyInfoVO);
} }
@ApiOperation(value = "分类修改") @ApiOperation(value = "分类修改")
@PostMapping("updateClassification") @PostMapping("updateClassification")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody updateClassification(@Validated(Update.class) @RequestBody ClassifyInfoVO classifyInfoVO) { public ResultBody updateClassification(
@Validated(Update.class) @RequestBody ClassifyInfoVO classifyInfoVO) {
return categoriesService.updateClassification(classifyInfoVO); return categoriesService.updateClassification(classifyInfoVO);
} }
@ApiOperation(value = "分类信息-排序") @ApiOperation(value = "分类信息-排序")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("exchangeSortType") @GetMapping("exchangeSortType")
public ResultBody exchangeSortType(@ApiParam(value = "第一个分类id", required = true) @RequestParam(value = "firstId") Integer firstId, public ResultBody exchangeSortType(
@ApiParam(value = "第二个分类id", required = true) @RequestParam(value = "secondId") Integer secondId) { @ApiParam(value = "第一个分类id", required = true) @RequestParam(value = "firstId")
Integer firstId,
@ApiParam(value = "第二个分类id", required = true) @RequestParam(value = "secondId")
Integer secondId) {
return categoriesService.exchangeSortType(firstId, secondId); return categoriesService.exchangeSortType(firstId, secondId);
} }
@ApiOperation(value = "分类信息-列表") @ApiOperation(value = "分类信息-列表")
@PostMapping("getClassificationList") @PostMapping("getClassificationList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyInfoDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyInfoDTO.class)})
...@@ -84,26 +86,30 @@ public class BackstageCategoriesController { ...@@ -84,26 +86,30 @@ public class BackstageCategoriesController {
return ResultBody.success(categoriesService.getClassificationList(queryClassifyVO)); return ResultBody.success(categoriesService.getClassificationList(queryClassifyVO));
} }
@ApiOperation(value = "分类详情") @ApiOperation(value = "分类详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyDetailsDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyDetailsDTO.class)})
@GetMapping("getClassifyDetails") @GetMapping("getClassifyDetails")
public ResultBody getClassifyDetails(@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id) { public ResultBody getClassifyDetails(
@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id) {
return categoriesService.getClassifyDetails(id); return categoriesService.getClassifyDetails(id);
} }
@ApiOperation(value = "分类详情") @ApiOperation(value = "分类详情下关联业务列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)})
@GetMapping("queryRelevantBusiness") @GetMapping("queryRelevantBusiness")
public ResultBody queryRelevantBusiness(@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id, public ResultBody queryRelevantBusiness(
@ApiParam(value = "业务类型", required = true) @Min(value = 0) @RequestParam(value = "type") Integer type) { @ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id,
@ApiParam(value = "业务类型", required = true) @Min(value = 0) @RequestParam(value = "type")
Integer type) {
return categoriesService.queryRelevantBusiness(id, type); return categoriesService.queryRelevantBusiness(id, type);
} }
@ApiOperation(value = "分类删除") @ApiOperation(value = "分类删除")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)})
@GetMapping("deleteRelevantBusiness") @GetMapping("deleteRelevantBusiness")
public ResultBody deleteRelevantBusiness(@ApiParam(value = "分类id", required = true) @Min(value = 1) @RequestParam(value = "id") Integer id) { public ResultBody deleteRelevantBusiness(
@ApiParam(value = "分类id", required = true) @Min(value = 1) @RequestParam(value = "id")
Integer id) {
return categoriesService.deleteRelevantBusiness(id); return categoriesService.deleteRelevantBusiness(id);
} }
...@@ -117,8 +123,9 @@ public class BackstageCategoriesController { ...@@ -117,8 +123,9 @@ public class BackstageCategoriesController {
@ApiOperation(value = "根据类型获取各个目录及分类信息") @ApiOperation(value = "根据类型获取各个目录及分类信息")
@GetMapping("queryCategoryInfoByType") @GetMapping("queryCategoryInfoByType")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = AllCategoryDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = AllCategoryDTO.class)})
public ResultBody queryCategoryInfoByType(@ApiParam(value = "类型:1:作业服务 2:设备 3:培训 4:产品商城", required = true) @RequestParam(value = "type") Integer type) { public ResultBody queryCategoryInfoByType(
@ApiParam(value = "类型:1:作业服务 2:设备 3:培训 4:产品商城", required = true) @RequestParam(value = "type")
Integer type) {
return categoriesService.queryCategoryInfoByType(type); return categoriesService.queryCategoryInfoByType(type);
} }
} }
...@@ -8,6 +8,7 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDTO; ...@@ -8,6 +8,7 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDTO;
import com.mmc.pms.model.qo.MallOrderGoodsInfoQO; import com.mmc.pms.model.qo.MallOrderGoodsInfoQO;
import com.mmc.pms.model.qo.ProductSpecPriceQO; import com.mmc.pms.model.qo.ProductSpecPriceQO;
import com.mmc.pms.model.sale.dto.*; import com.mmc.pms.model.sale.dto.*;
import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.GoodsAddVO; import com.mmc.pms.model.sale.vo.GoodsAddVO;
import com.mmc.pms.service.GoodsInfoService; import com.mmc.pms.service.GoodsInfoService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
...@@ -51,6 +52,13 @@ public class BackstageGoodsManageController { ...@@ -51,6 +52,13 @@ public class BackstageGoodsManageController {
return goodsInfoService.getGoodsInfoDetail(goodsInfoId); return goodsInfoService.getGoodsInfoDetail(goodsInfoId);
} }
@ApiOperation(value = "商品列表-分页")
@PostMapping("listPageGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = GoodsInfoListDTO.class)})
public ResultBody listPageGoodsInfo(@ApiParam("商品查询条件QO") @RequestBody MallGoodsQO param) {
return ResultBody.success(goodsInfoService.listPageGoodsInfo(param));
}
@ApiOperation(value = "单位信息") @ApiOperation(value = "单位信息")
@GetMapping("getSkuUnit") @GetMapping("getSkuUnit")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = SkuUnitDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = SkuUnitDTO.class)})
......
package com.mmc.pms.controller; package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.model.lease.dto.BrandDTO;
import com.mmc.pms.model.lease.dto.DeviceCategoryDTO;
import com.mmc.pms.model.lease.dto.WareInfoDTO;
import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.other.dto.AdDTO; import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.other.dto.DistrictInfoDTO; import com.mmc.pms.model.other.dto.DistrictInfoDTO;
import com.mmc.pms.model.other.dto.ModelDTO;
import com.mmc.pms.service.WebDeviceService; import com.mmc.pms.service.WebDeviceService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @Author small @Date 2023/5/15 13:25 @Version 1.0 * @Author small @Date 2023/5/15 13:25 @Version 1.0
...@@ -25,8 +21,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -25,8 +21,7 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping("/webDevice") @RequestMapping("/webDevice")
public class WebDeviceController { public class WebDeviceController {
@Autowired @Autowired private WebDeviceService webDeviceService;
private WebDeviceService webDeviceService;
@ApiOperation(value = "地域") @ApiOperation(value = "地域")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
...@@ -35,65 +30,9 @@ public class WebDeviceController { ...@@ -35,65 +30,9 @@ public class WebDeviceController {
return webDeviceService.listSecondDistrict(); return webDeviceService.listSecondDistrict();
} }
@ApiOperation("设备类目")
@GetMapping("/category")
public ResultBody<DeviceCategoryDTO> category() {
return webDeviceService.category();
}
@ApiOperation("品牌")
@GetMapping("/brand")
public ResultBody<BrandDTO> brand() {
return webDeviceService.brand();
}
@ApiOperation("型号")
@GetMapping("/model")
public ResultBody<ModelDTO> model() {
return webDeviceService.model();
}
@ApiOperation("设备品牌")
@GetMapping("/deviceBrand")
public ResultBody<BrandDTO> deviceBrand() {
return webDeviceService.deviceBrand();
}
@ApiOperation("设备型号")
@GetMapping("/deviceModel")
public ResultBody<ModelDTO> deviceModel() {
return webDeviceService.deviceModel();
}
@ApiOperation(value = "设备详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("/detail")
public ResultBody<WareInfoDTO> detail(@RequestParam(value = "id", required = true) Integer id) {
WareInfoDTO wareInfoDTO = webDeviceService.getWareInfoById(id);
return wareInfoDTO == null
? ResultBody.error(ResultEnum.NOT_FOUND)
: ResultBody.success(wareInfoDTO);
}
@ApiOperation(value = "立即租赁")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("/update")
public ResultBody update(@RequestBody LeaseVo param) {
return webDeviceService.update(param);
}
@ApiOperation("设备广告位") @ApiOperation("设备广告位")
@GetMapping("/ad") @GetMapping("/ad")
public ResultBody<AdDTO> ad() { public ResultBody<AdDTO> ad() {
return webDeviceService.ad(); return webDeviceService.ad();
} }
//
// @ApiOperation(value = "设备列表筛选")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = WareInfoItemDTO.class)})
// @PostMapping("/deviceList")
// public ResultBody<WareInfoItemDTO> listWareInfoPage(
// @RequestBody @Validated(Page.class) WareInfoQO param) {
// return webDeviceService.listWareInfoPage(param, request);
// }
} }
package com.mmc.pms.dao; package com.mmc.pms.dao;
import com.mmc.pms.entity.*; import com.mmc.pms.entity.*;
import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.GoodsAddVO; import com.mmc.pms.model.sale.vo.GoodsAddVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -96,4 +97,8 @@ public interface GoodsInfoDao { ...@@ -96,4 +97,8 @@ public interface GoodsInfoDao {
List<MallProdSkuInfoSpecDO> listMallprodSpecById(List<Integer> goodsIds); List<MallProdSkuInfoSpecDO> listMallprodSpecById(List<Integer> goodsIds);
List<SaleServiceDO> listSaleServiceInfo(); List<SaleServiceDO> listSaleServiceInfo();
int countListGoodsInfo(MallGoodsQO param);
List<GoodsInfo> listGoodsInfo(MallGoodsQO param);
} }
...@@ -82,8 +82,6 @@ public interface ProductDao { ...@@ -82,8 +82,6 @@ public interface ProductDao {
void removeProductSku(Integer id); void removeProductSku(Integer id);
List<MallProdInfoDO> listMallProdInfo(String id);
void removeProductSpec(Integer id); void removeProductSpec(Integer id);
List<IndustrySpecDO> listIndustrySpec(@Param("industrySpecIds") Set<Integer> industrySpecIds); List<IndustrySpecDO> listIndustrySpec(@Param("industrySpecIds") Set<Integer> industrySpecIds);
......
...@@ -2,6 +2,7 @@ package com.mmc.pms.entity; ...@@ -2,6 +2,7 @@ package com.mmc.pms.entity;
import com.mmc.pms.model.categories.vo.RelevanceGoodsInfoVO; import com.mmc.pms.model.categories.vo.RelevanceGoodsInfoVO;
import com.mmc.pms.model.lease.dto.LeaseGoodsInfoDTO; import com.mmc.pms.model.lease.dto.LeaseGoodsInfoDTO;
import com.mmc.pms.model.sale.dto.GoodsInfoListDTO;
import com.mmc.pms.model.sale.vo.GoodsAddVO; import com.mmc.pms.model.sale.vo.GoodsAddVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
...@@ -11,8 +12,7 @@ import java.io.Serializable; ...@@ -11,8 +12,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* @author 23214 * @author 23214 @TableName goods_info
* @TableName goods_info
*/ */
@Data @Data
@NoArgsConstructor @NoArgsConstructor
...@@ -56,6 +56,10 @@ public class GoodsInfo implements Serializable { ...@@ -56,6 +56,10 @@ public class GoodsInfo implements Serializable {
private String mainImg; private String mainImg;
private Integer isCoupons;
private String directoryName;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public GoodsInfo(GoodsAddVO goodsAddVO) { public GoodsInfo(GoodsAddVO goodsAddVO) {
...@@ -74,10 +78,28 @@ public class GoodsInfo implements Serializable { ...@@ -74,10 +78,28 @@ public class GoodsInfo implements Serializable {
} }
public RelevanceGoodsInfoVO buildRelevanceGoodsInfoVO() { public RelevanceGoodsInfoVO buildRelevanceGoodsInfoVO() {
return RelevanceGoodsInfoVO.builder().id(id).goodsName(goodsName).shelf(shelfStatus).mainImage(mainImg).build(); return RelevanceGoodsInfoVO.builder()
.id(id)
.goodsName(goodsName)
.shelf(shelfStatus)
.mainImage(mainImg)
.build();
} }
public LeaseGoodsInfoDTO buildLeaseGoodsInfoDTO() { public LeaseGoodsInfoDTO buildLeaseGoodsInfoDTO() {
return LeaseGoodsInfoDTO.builder().id(id).goodsName(goodsName).images(mainImg).build(); return LeaseGoodsInfoDTO.builder().id(id).goodsName(goodsName).images(mainImg).build();
} }
public GoodsInfoListDTO buildGoodsInfoListDTO() {
return GoodsInfoListDTO.builder()
.id(id)
.goodsName(goodsName)
.directoryName(directoryName)
.directoryId(directoryId)
.createTime(createTime)
.imgUrl(mainImg)
.status(shelfStatus)
.isCoupons(this.isCoupons)
.build();
}
} }
package com.mmc.pms.model.sale.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* @Author LW
*
* @date 2022/3/22 9:44 概要:商品列表查询QO
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MallGoodsQO {
@ApiModelProperty(value = "商品名称", example = "商品名称")
private String goodsName;
@ApiModelProperty(value = "商品类型 0:销售 1:租赁", example = "0")
private Integer goodsType;
@ApiModelProperty(value = "开始时间", example = "2023-06-09 00:00:00")
private String startTime;
@ApiModelProperty(value = "结束时间", example = "2023-06-11 23:59:59")
private String endTime;
@ApiModelProperty(value = "状态 0:下架(仓库中)1:上架", example = "1")
private Integer status;
@ApiModelProperty(value = "目录id", example = "1")
private Integer directoryId;
@ApiModelProperty(value = "页码", required = true, example = "1")
@NotNull(
message = "页码不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true, example = "10")
@NotNull(
message = "每页显示数不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
...@@ -8,7 +8,9 @@ import com.mmc.pms.model.qo.ProductSpecPriceQO; ...@@ -8,7 +8,9 @@ import com.mmc.pms.model.qo.ProductSpecPriceQO;
import com.mmc.pms.model.sale.dto.MallGoodsShopCarDTO; import com.mmc.pms.model.sale.dto.MallGoodsShopCarDTO;
import com.mmc.pms.model.sale.dto.MallProductSpecPriceDTO; import com.mmc.pms.model.sale.dto.MallProductSpecPriceDTO;
import com.mmc.pms.model.sale.dto.ProductSpecPriceDTO; import com.mmc.pms.model.sale.dto.ProductSpecPriceDTO;
import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.GoodsAddVO; import com.mmc.pms.model.sale.vo.GoodsAddVO;
import com.mmc.pms.page.PageResult;
import java.util.List; import java.util.List;
...@@ -38,4 +40,6 @@ public interface GoodsInfoService { ...@@ -38,4 +40,6 @@ public interface GoodsInfoService {
List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO); List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO); List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
PageResult listPageGoodsInfo(MallGoodsQO param);
} }
...@@ -12,7 +12,9 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDetailDTO; ...@@ -12,7 +12,9 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDetailDTO;
import com.mmc.pms.model.qo.MallOrderGoodsInfoQO; import com.mmc.pms.model.qo.MallOrderGoodsInfoQO;
import com.mmc.pms.model.qo.ProductSpecPriceQO; import com.mmc.pms.model.qo.ProductSpecPriceQO;
import com.mmc.pms.model.sale.dto.*; import com.mmc.pms.model.sale.dto.*;
import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.*; import com.mmc.pms.model.sale.vo.*;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.GoodsInfoService; import com.mmc.pms.service.GoodsInfoService;
import com.mmc.pms.util.CodeUtil; import com.mmc.pms.util.CodeUtil;
import com.mmc.pms.util.TDateUtil; import com.mmc.pms.util.TDateUtil;
...@@ -1102,4 +1104,18 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -1102,4 +1104,18 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
} }
return mallGoodsInfoSimpleDOS; return mallGoodsInfoSimpleDOS;
} }
@Override
public PageResult listPageGoodsInfo(MallGoodsQO param) {
int count = goodsInfoDao.countListGoodsInfo(param);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<GoodsInfo> goodsInfo = goodsInfoDao.listGoodsInfo(param);
List<GoodsInfoListDTO> pageList =
goodsInfo.stream().map(GoodsInfo::buildGoodsInfoListDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
}
} }
...@@ -3,12 +3,9 @@ package com.mmc.pms.service.Impl; ...@@ -3,12 +3,9 @@ package com.mmc.pms.service.Impl;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum; import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.dao.MiniProgramProductMallDao; import com.mmc.pms.dao.MiniProgramProductMallDao;
import com.mmc.pms.dao.WebDeviceDao;
import com.mmc.pms.entity.*; import com.mmc.pms.entity.*;
import com.mmc.pms.model.qo.GoodsInfoQO;
import com.mmc.pms.model.sale.dto.*; import com.mmc.pms.model.sale.dto.*;
import com.mmc.pms.model.sale.vo.GoodsProductSkuVO; import com.mmc.pms.model.sale.vo.GoodsProductSkuVO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.MiniProgramProductMallService; import com.mmc.pms.service.MiniProgramProductMallService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -26,10 +23,7 @@ import java.util.stream.Collectors; ...@@ -26,10 +23,7 @@ import java.util.stream.Collectors;
@Service @Service
public class MiniProgramProductMallServiceImpl implements MiniProgramProductMallService { public class MiniProgramProductMallServiceImpl implements MiniProgramProductMallService {
@Autowired @Autowired private MiniProgramProductMallDao goodsInfoDao;
private MiniProgramProductMallDao goodsInfoDao;
@Autowired
private WebDeviceDao webDeviceDao;
@Override @Override
public ResultBody getAppGoodsInfoDetail(Integer goodsId) { public ResultBody getAppGoodsInfoDetail(Integer goodsId) {
...@@ -127,68 +121,44 @@ public class MiniProgramProductMallServiceImpl implements MiniProgramProductMall ...@@ -127,68 +121,44 @@ public class MiniProgramProductMallServiceImpl implements MiniProgramProductMall
return ResultBody.success(appGoodsInfoDetailDTO); return ResultBody.success(appGoodsInfoDetailDTO);
} }
@Override
public ResultBody listGoodsByQO(GoodsInfoQO param) {
int count = goodsInfoDao.countListGoodsByQO(param);
if (count == 0) {
return ResultBody.success(
PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
}
int pageNo = param.getPageNo();
param.buildCurrentPage();
List<GoodsInfoDO> list = goodsInfoDao.listGoodsByQO(param);
// 找出行业对应的序号
List<GoodsTypeDO> ids = goodsInfoDao.listIndustryIdBySort();
int order = 0;
/*if (param.getMasterTypeId() != null) {
for (int i = 0; i < ids.size(); i++) {
if (param.getMasterTypeId().toString().equals(ids.get(i).getId().toString())) {
order = i + 1;
break;
}
}
}*/
List<AppGoodsInfoDTO> pageList = new ArrayList<>();
for (GoodsInfoDO d : list) {
AppGoodsInfoDTO appGoodsInfoDTO = d.buildAppGoodsInfoDTO();
// 直接看该服务在当前行业对应所有服务中在第几个
for (int j = 0; j < list.size(); j++) {
if (appGoodsInfoDTO.getId().toString().equals(list.get(j).getId().toString())) {
if (j < 9) {
appGoodsInfoDTO.setCode(order + "0" + (j + 1));
} else {
appGoodsInfoDTO.setCode(order + "" + (j + 1));
}
break;
}
}
if (appGoodsInfoDTO.getShelfStatus() == 1) {
pageList.add(appGoodsInfoDTO);
}
}
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) { private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) {
// 获取商品对应绑定的行业sku信息 // 获取商品对应绑定的行业sku信息
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList = goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId); List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList =
List<GoodsSpecDTO> list = mallIndustrySkuInfoList.stream().map(MallIndustrySkuInfoDO::buildGoodsSpecDTO).collect(Collectors.toList()); goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId);
List<GoodsSpecDTO> list =
mallIndustrySkuInfoList.stream()
.map(MallIndustrySkuInfoDO::buildGoodsSpecDTO)
.collect(Collectors.toList());
// 根据商品id查出该商品下绑定的规格信息 // 根据商品id查出该商品下绑定的规格信息
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec = goodsInfoDao.getIndustrySkuInfoSpec(goodsInfoId); List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec =
list = list.stream().peek(d -> { goodsInfoDao.getIndustrySkuInfoSpec(goodsInfoId);
list =
list.stream()
.peek(
d -> {
List<MallIndustrySpecDTO> industrySpec = new ArrayList<>(); List<MallIndustrySpecDTO> industrySpec = new ArrayList<>();
for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) { for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) {
if (d.getId().equals(e.getMallIndustrySkuInfoId())) { if (d.getId().equals(e.getMallIndustrySkuInfoId())) {
IndustrySpecDO industrySpecDO = e.getIndustrySpecDO(); IndustrySpecDO industrySpecDO = e.getIndustrySpecDO();
// 获取商品清单信息 // 获取商品清单信息
List<IndustryProductInventoryDO> industryProdInventory = goodsInfoDao.getIndustryProductInventory(e.getIndustrySpecId()); List<IndustryProductInventoryDO> industryProdInventory =
goodsInfoDao.getIndustryProductInventory(e.getIndustrySpecId());
List<ProductInventoryVO> productInventoryList = new ArrayList<>(); List<ProductInventoryVO> productInventoryList = new ArrayList<>();
// 获取行业规格绑定的产品规格信息 // 获取行业规格绑定的产品规格信息
List<InventorySpecDO> inventorySpecDOList = goodsInfoDao.listInventorySpec(industryProdInventory.stream().map(IndustryProductInventoryDO::getId).collect(Collectors.toList())); List<InventorySpecDO> inventorySpecDOList =
Map<Integer, List<InventorySpecDO>> inventoryMap = inventorySpecDOList.stream().collect(Collectors.groupingBy(InventorySpecDO::getIndustryProductInventoryId)); goodsInfoDao.listInventorySpec(
getIndustrySpecOnProdSpecInfo(industryProdInventory, productInventoryList, inventoryMap); industryProdInventory.stream()
MallIndustrySpecDTO industrySpecDTO = industrySpecDO.buildMallIndustrySpecDTO(); .map(IndustryProductInventoryDO::getId)
.collect(Collectors.toList()));
Map<Integer, List<InventorySpecDO>> inventoryMap =
inventorySpecDOList.stream()
.collect(
Collectors.groupingBy(
InventorySpecDO::getIndustryProductInventoryId));
getIndustrySpecOnProdSpecInfo(
industryProdInventory, productInventoryList, inventoryMap);
MallIndustrySpecDTO industrySpecDTO =
industrySpecDO.buildMallIndustrySpecDTO();
industrySpecDTO.setId(e.getId()); industrySpecDTO.setId(e.getId());
industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId()); industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId());
industrySpecDTO.setIndustrySkuId(d.getSkuId()); industrySpecDTO.setIndustrySkuId(d.getSkuId());
...@@ -197,7 +167,8 @@ public class MiniProgramProductMallServiceImpl implements MiniProgramProductMall ...@@ -197,7 +167,8 @@ public class MiniProgramProductMallServiceImpl implements MiniProgramProductMall
} }
} }
d.setIndustrySpecList(industrySpec); d.setIndustrySpecList(industrySpec);
}).collect(Collectors.toList()); })
.collect(Collectors.toList());
return list; return list;
} }
......
...@@ -3,9 +3,13 @@ package com.mmc.pms.service.Impl; ...@@ -3,9 +3,13 @@ package com.mmc.pms.service.Impl;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.dao.WebProductMallDao; import com.mmc.pms.dao.WebProductMallDao;
import com.mmc.pms.entity.AdDO; import com.mmc.pms.entity.AdDO;
import com.mmc.pms.entity.GoodsInfoDO;
import com.mmc.pms.entity.ProductCategory; import com.mmc.pms.entity.ProductCategory;
import com.mmc.pms.model.other.dto.AdDTO; import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.qo.GoodsInfoQO;
import com.mmc.pms.model.sale.dto.GoodsInfoListDTO;
import com.mmc.pms.model.sale.dto.ProductCategoryDTO; import com.mmc.pms.model.sale.dto.ProductCategoryDTO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.WebProductMallService; import com.mmc.pms.service.WebProductMallService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -72,4 +76,24 @@ public class WebProductMallServiceImpl implements WebProductMallService { ...@@ -72,4 +76,24 @@ public class WebProductMallServiceImpl implements WebProductMallService {
.collect(Collectors.toList()); .collect(Collectors.toList());
return ResultBody.success(collect); return ResultBody.success(collect);
} }
@Override
public PageResult listPageGoodsInfo(GoodsInfoQO param) {
int count = webProductMallDao.countListGoodsInfo(param);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<GoodsInfoDO> goodsInfo = webProductMallDao.listGoodsInfo(param);
goodsInfo.stream()
.forEach(
t -> {
Integer product = webProductMallDao.findProduct(t.getId());
t.setIsCoupons(product);
});
List<GoodsInfoListDTO> pageList =
goodsInfo.stream().map(GoodsInfoDO::buildGoodsInfoListDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
}
} }
package com.mmc.pms.service; package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.qo.GoodsInfoQO;
/** /**
* @Author small @Date 2023/5/16 15:08 @Version 1.0 * @Author small @Date 2023/5/16 15:08 @Version 1.0
*/ */
public interface MiniProgramProductMallService { public interface MiniProgramProductMallService {
ResultBody getAppGoodsInfoDetail(Integer id); ResultBody getAppGoodsInfoDetail(Integer id);
ResultBody listGoodsByQO(GoodsInfoQO param);
} }
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
<foreach collection="list" item="d" separator=";"> <foreach collection="list" item="d" separator=";">
update mall_prod_info update mall_prod_info
<set> <set>
prod_sku_id = #{d.prodSkuId}, product_id = #{d.prodSkuId},
categories_id = #{d.categoriesId}, categories_id = #{d.categoriesId},
prod_spec_name = #{d.prodSkuSpecName}, prod_spec_name = #{d.prodSkuSpecName},
choose_type = #{d.chooseType}, choose_type = #{d.chooseType},
...@@ -487,4 +487,65 @@ ...@@ -487,4 +487,65 @@
FROM sale_service FROM sale_service
WHERE is_deleted = 0 WHERE is_deleted = 0
</select> </select>
<select id="countListGoodsInfo" resultType="java.lang.Integer">
SELECT
count(*)
FROM
goods_info gi
<where>
gi.is_deleted = 0 and gi.goods_type = #{goodsType}
<if test="goodsName != null and goodsName !=''">
AND (gi.goods_name LIKE CONCAT('%',#{goodsName},'%'))
</if>
<if test="status != null">
AND (gi.shelf_status = #{status})
</if>
<if test="startTime != null and startTime != '' ">
and gi.create_time &gt;= STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="endTime != null and endTime != '' ">
and gi.create_time &lt;= STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="directoryId != null">
and (gi.directory_id = #{directoryId})
</if>
</where>
</select>
<select id="listGoodsInfo" resultType="com.mmc.pms.entity.GoodsInfo">
SELECT
gi.id,
gi.goods_name,
gi.shelf_status,
gi.create_time,
gi.directory_id,
img.img_url mainImg,
d.directory_name
FROM
goods_info gi
LEFT JOIN goods_img img ON gi.id = img.goods_info_id
AND img.img_type = 0
AND img.is_deleted = 0
INNER JOIN `directory` d ON gi.directory_id = d.id
<where>
gi.is_deleted = 0 and gi.goods_type = #{goodsType}
<if test="goodsName != null and goodsName !=''">
AND (gi.goods_name LIKE CONCAT('%',#{goodsName},'%'))
</if>
<if test="status != null">
AND (gi.shelf_status = #{status})
</if>
<if test="startTime != null and startTime != '' ">
and gi.create_time &gt;= STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="endTime != null and endTime != '' ">
and gi.create_time &lt;= STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="directoryId != null">
and (gi.directory_id = #{directoryId})
</if>
</where>
ORDER BY
gi.shelf_status DESC , gi.create_time DESC
limit #{pageNo},#{pageSize}
</select>
</mapper> </mapper>
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
<select id="getMallProdInfoByGoodsId" resultType="com.mmc.pms.entity.MallProdInfoDO"> <select id="getMallProdInfoByGoodsId" resultType="com.mmc.pms.entity.MallProdInfoDO">
SELECT mp.id, SELECT mp.id,
mp.prod_sku_id prodSkuId, mp.product_id prodSkuId,
mp.prod_spec_name prodSkuSpecName, mp.prod_spec_name prodSkuSpecName,
mp.goods_type_id goodsTypeId, mp.goods_type_id goodsTypeId,
mp.choose_type chooseType, mp.choose_type chooseType,
...@@ -133,9 +133,9 @@ ...@@ -133,9 +133,9 @@
ps.product_name productSkuName, ps.product_name productSkuName,
ps.brand_info_id brandInfoId, ps.brand_info_id brandInfoId,
gt.type_name typeName gt.type_name typeName
FROM mall_prod_sku_info mp FROM mall_prod_info mp
INNER JOIN sku_unit su ON su.id = mp.sku_unit_id INNER JOIN sku_unit su ON su.id = mp.sku_unit_id
INNER JOIN product ps ON ps.id = mp.prod_sku_id INNER JOIN product ps ON ps.id = mp.product_id
LEFT JOIN goods_type gt ON mp.goods_type_id = gt.id LEFT JOIN goods_type gt ON mp.goods_type_id = gt.id
WHERE mp.goods_info_id = #{goodsId} WHERE mp.goods_info_id = #{goodsId}
AND mp.is_deleted = 0 AND mp.is_deleted = 0
...@@ -143,9 +143,9 @@ ...@@ -143,9 +143,9 @@
<select id="listMallProdSkuInfoSpec" resultType="com.mmc.pms.entity.MallProdSkuInfoSpecDO"> <select id="listMallProdSkuInfoSpec" resultType="com.mmc.pms.entity.MallProdSkuInfoSpecDO">
SELECT id, SELECT id,
mall_prod_sku_info_id mallProdSkuInfoId, mall_prod_info_id mallProdSkuInfoId,
product_spec_id productSpecId product_spec_id productSpecId
FROM mall_prod_sku_info_spec FROM mall_prod_info_spec
WHERE goods_info_id = #{goodsId} WHERE goods_info_id = #{goodsId}
AND is_deleted = 0 AND is_deleted = 0
</select> </select>
......
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
</insert> </insert>
<insert id="insertMallProdSkuInfo" parameterType="com.mmc.pms.entity.MallProdInfoDO" <insert id="insertMallProdSkuInfo" parameterType="com.mmc.pms.entity.MallProdInfoDO"
keyProperty="id" useGeneratedKeys="true"> keyProperty="id" useGeneratedKeys="true">
insert into mall_prod_info (goods_info_id, prod_sku_id, prod_spec_name, category_id, choose_type, insert into mall_prod_info (goods_info_id, product_id, prod_spec_name, categories_id, choose_type,
sku_unit_id, is_must, product_spec_id_list, flag) sku_unit_id, is_must, flag)
values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoryId}, #{chooseType}, #{skuUnitId}, #{must}, values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoriesId}, #{chooseType}, #{skuUnitId}, #{must},
#{flag}) #{flag})
</insert> </insert>
<update id="updateProductSku"> <update id="updateProductSku">
......
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
SELECT count(1) SELECT count(1)
FROM goods_info gi FROM goods_info gi
INNER JOIN mall_prod_sku_info mpsi ON mpsi.goods_info_id = gi.id INNER JOIN mall_prod_sku_info mpsi ON mpsi.goods_info_id = gi.id
INNER JOIN product ps ON mpsi.prod_sku_id = ps.id INNER JOIN product ps ON mpsi.product_id = ps.id
AND ps.is_deleted = 0 AND ps.is_deleted = 0
INNER JOIN brand_info bi ON ps.brand_info_id = bi.id INNER JOIN brand_info bi ON ps.brand_info_id = bi.id
AND bi.is_delete = 0 AND bi.is_delete = 0
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论