提交 317c12fa 作者: zhenjie

Merge branch 'develop'

...@@ -18,4 +18,4 @@ patches: ...@@ -18,4 +18,4 @@ patches:
images: images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG - name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/pms newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/pms
newTag: 37582a668837033ad61d64321c6fa7620ea17d45 newTag: 2e525557874dabcb58b6516aefc612e98bf6e76e
package com.mmc.pms.auth.dto; package com.mmc.pms.auth.dto;
import com.mmc.pms.model.other.dto.RoleInfoDTO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
...@@ -17,15 +18,16 @@ import java.io.Serializable; ...@@ -17,15 +18,16 @@ import java.io.Serializable;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class LoginSuccessDTO implements Serializable { public class LoginSuccessDTO implements Serializable {
private static final long serialVersionUID = -1200834589953161925L; private static final long serialVersionUID = -1200834589953161925L;
private String token; private String token;
private Integer userAccountId; private Integer userAccountId;
private String accountNo; private String accountNo;
private Integer portType; private Integer portType;
private String uid; private String uid;
private String phoneNum; private String phoneNum;
private String userName; private String userName;
private String nickName; private String nickName;
private CompanyInfoVO companyInfoVO; private CompanyInfoVO companyInfoVO;
// private RoleInfoDTO roleInfo; private RoleInfoDTO roleInfo;
private Integer appUserAccountId;
} }
package com.mmc.pms.controller.category;
import com.mmc.pms.common.Page;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.category.dto.CategoryPrimaryDTO;
import com.mmc.pms.model.category.dto.CategorySubDTO;
import com.mmc.pms.model.category.qo.CategoryQO;
import com.mmc.pms.model.category.vo.CategoryPrimaryVO;
import com.mmc.pms.model.category.vo.CategorySubVO;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Others;
import com.mmc.pms.model.group.Update;
import com.mmc.pms.service.category.CategoryService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @Author small
* @Date 2023/7/20 16:17
* @Version 1.0
* <p>
* 新版本分类管理
*/
@RestController
@RequestMapping("/category")
@Api(tags = {"后台-新版-分类管理"})
public class CategoryController {
@Autowired
private CategoryService categoryService;
@ApiOperation(value = "一级分类————新增")
@PostMapping("/addPrimaryCategory")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addPrimaryCategory(HttpServletRequest request, @RequestBody @Validated(value = {Create.class}) CategoryPrimaryVO primaryVO) {
return categoryService.addPrimaryCategory(primaryVO);
}
@ApiOperation(value = "一级分类————编辑")
@PostMapping("/updatePrimaryCategory")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody updatePrimaryCategory(HttpServletRequest request, @RequestBody @Validated(value = {Update.class}) CategoryPrimaryVO primaryVO) {
return categoryService.updatePrimaryCategory(primaryVO);
}
@ApiOperation(value = "一级分类————删除")
@GetMapping("/deletePrimaryCategory")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody deletePrimaryCategory(HttpServletRequest request, @RequestParam(value = "id", required = true) Integer id) {
return categoryService.deletePrimaryCategory(id);
}
@ApiOperation(value = "一级分类————列表/包含二级分类")
@PostMapping("/categoryList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody<CategoryPrimaryDTO> categoryList(HttpServletRequest request, @Validated(value = {Page.class}) @ApiParam(value = "角色查询QO", required = true) @RequestBody CategoryQO param) {
return ResultBody.success(categoryService.categoryList(param));
}
@ApiOperation(value = "二级分类————新增")
@PostMapping("/addSubCategory")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addSubCategory(HttpServletRequest request, @RequestBody @Validated(value = {Create.class}) CategorySubVO subVO) {
return categoryService.addSubCategory(subVO);
}
@ApiOperation(value = "二级分类————编辑")
@PostMapping("/updateSubCategory")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody updateSubCategory(HttpServletRequest request, @RequestBody @Validated(value = {Update.class}) CategorySubVO subVO) {
return categoryService.updateSubCategory(subVO);
}
@ApiOperation(value = "二级分类————删除")
@GetMapping("/deleteSubCategory")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody deleteSubCategory(HttpServletRequest request, @RequestParam(value = "id", required = true) Integer id) {
return categoryService.deleteSubCategory(id);
}
@ApiOperation(value = "二级分类————详情")
@GetMapping("/detailSubCategory")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody<CategorySubDTO> detailSubCategory(HttpServletRequest request, @RequestParam(value = "id", required = true) Integer id) {
return categoryService.detailSubCategory(id);
}
@ApiOperation(value = "一级分类——排序交换")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("exchange")
public ResultBody exchangeBannerInfo(@Validated(Others.class) @RequestBody List<CategoryPrimaryVO> list) {
return categoryService.exchange(list);
}
@ApiOperation(value = "小程序分类信息--含一二级分类")
@GetMapping("/appCategoryInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = CategoryPrimaryDTO.class)})
public ResultBody<CategoryPrimaryDTO> appCategoryInfo() {
return categoryService.appCategoryInfo();
}
}
package com.mmc.pms.controller.mall;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.controller.BaseController;
import com.mmc.pms.model.mall.MallGoodsVO;
import com.mmc.pms.service.mall.AppMallGoodsService;
import com.mmc.pms.service.mall.MallGoodsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author LW
* @date 2023/7/26 14:26
* 概要:
*/
@RestController
@RequestMapping("/app/goods")
@Api(tags = {"V1.0.3-小程序商城商品-相关接口"})
public class AppMallGoodsController extends BaseController {
@Resource
private MallGoodsService mallGoodsService;
@Resource
private AppMallGoodsService appMallGoodsService;
@ApiOperation(value = "小程序商品详情")
@GetMapping("appMallGoodsDetails")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsVO.class)})
public ResultBody<MallGoodsVO> appMallGoodsDetails(@RequestParam Integer id) {
return mallGoodsService.mallGoodsDetails(id);
}
@ApiOperation(value = "查询品牌方的商品")
@GetMapping("queryBrandGoods")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsVO.class)})
public ResultBody<MallGoodsVO> queryBrandGoods(@RequestParam Integer userAccountId) {
return appMallGoodsService.queryBrandGoods(userAccountId);
}
@ApiOperation(value = "根据子分类查询商品信息")
@PostMapping("queryGoodsInfoByCategorySub")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsVO.class)})
public ResultBody<MallGoodsVO> queryGoodsInfoByCategorySub(@RequestBody List<Integer> categorySubIds) {
return appMallGoodsService.queryGoodsInfoByCategorySub(categorySubIds);
}
}
package com.mmc.pms.controller.mall;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.controller.BaseController;
import com.mmc.pms.model.mall.MallGoodsVO;
import com.mmc.pms.model.sale.dto.SkuUnitDTO;
import com.mmc.pms.model.sale.qo.MallGoodsInfoQO;
import com.mmc.pms.service.mall.MallGoodsService;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/**
* @Author LW
* @date 2023/7/24 16:56 概要:
*/
@RestController
@RequestMapping("/mall/goods")
@Api(tags = {"V1.0.3-商城商品-相关接口"})
public class MallGoodsController extends BaseController {
@Resource
private MallGoodsService mallGoodsService;
@ApiOperation(value = "新增商城商品")
@PostMapping("addMallGoods")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addMallGoods(@RequestBody MallGoodsVO mallGoodsVO, HttpServletRequest request) {
return mallGoodsService.addMallGoods(mallGoodsVO, this.getUserLoginInfoFromRedis(request).getUserAccountId());
}
@ApiOperation(value = "商城商品详情")
@GetMapping("mallGoodsDetails")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsVO.class)})
public ResultBody<MallGoodsVO> mallGoodsDetails(@RequestParam Integer id) {
return mallGoodsService.mallGoodsDetails(id);
}
@ApiOperation(value = "编辑商城商品")
@PostMapping("editMallGoods")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody editMallGoods(@RequestBody MallGoodsVO mallGoodsVO, HttpServletRequest request) {
return mallGoodsService.editMallGoods(mallGoodsVO, this.getUserLoginInfoFromRedis(request).getUserAccountId());
}
@ApiOperation(value = "单位信息")
@GetMapping("getSkuUnit")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = SkuUnitDTO.class)})
public ResultBody getSkuUnit() {
return mallGoodsService.getSkuUnit();
}
@ApiOperation(value = "商品列表-分页")
@PostMapping("listPageGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsVO.class)})
public ResultBody<MallGoodsVO> listPageGoodsInfo(@ApiParam("商品查询条件QO") @RequestBody MallGoodsInfoQO param, HttpServletRequest request) {
return ResultBody.success(mallGoodsService.listPageGoodsInfo(param, this.getUserLoginInfoFromRedis(request)));
}
@ApiOperation(value = "商品列表-排序")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("exchange")
public ResultBody exchange(@ApiParam(value = "第一个商品id", required = true) @RequestParam(value = "firstId") Integer firstId,
@ApiParam(value = "第二个商品id", required = true) @RequestParam(value = "secondId") Integer secondId) {
return mallGoodsService.exchange(firstId, secondId);
}
@ApiOperation(value = "商品列表-上架或下架")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("upOrDownShelf")
public ResultBody upOrDownShelf(@ApiParam(value = "商品id", required = true) @RequestParam(value = "id") Integer id,
@ApiParam(value = "状态 0:下架 1: 上架", required = true) @RequestParam(value = "status") Integer status) {
return mallGoodsService.upOrDownShelf(id, status);
}
@ApiOperation(value = "商品列表-删除")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("removeMallGoods")
public ResultBody removeMallGoods(@ApiParam(value = "商品id", required = true) @RequestParam(value = "id") Integer id) {
return mallGoodsService.removeMallGoods(id);
}
@ApiOperation(value = "删除用户时对应的商品也删除", hidden = true)
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("feignRemoveGoodsByBackUserAccountId")
public ResultBody feignRemoveGoodsByUserAccountId(@RequestParam(value = "id") Integer id) {
return mallGoodsService.feignRemoveGoodsByBackUserAccountId(id);
}
}
...@@ -18,102 +18,102 @@ import java.util.Set; ...@@ -18,102 +18,102 @@ import java.util.Set;
@Mapper @Mapper
public interface GoodsInfoDao { public interface GoodsInfoDao {
int countGoodsInfoByName(GoodsAddVO goodsAddVO); int countGoodsInfoByName(GoodsAddVO goodsAddVO);
void insertGoodsInfo(GoodsInfo goodsInfo); void insertGoodsInfo(GoodsInfo goodsInfo);
int countGoodsInfo(); int countGoodsInfo();
void insertGoodsImgInfo(List<GoodsImgDO> list); void insertGoodsImgInfo(List<GoodsImgDO> list);
void insertVideoInfo(GoodsVideoDO goodsVideoDO); void insertVideoInfo(GoodsVideoDO goodsVideoDO);
void insertGoodsDetail(GoodsDetailDO goodsDetailDO); void insertGoodsDetail(GoodsDetailDO goodsDetailDO);
void insertGoodsService(List<GoodsServiceDO> otherList); void insertGoodsService(List<GoodsServiceDO> otherList);
int countGoodsInfoById(Integer id); int countGoodsInfoById(Integer id);
void updateGoodsInfo(GoodsInfo goodsInfo); void updateGoodsInfo(GoodsInfo goodsInfo);
void updateGoodsDetail(GoodsDetailDO goodsDetailDO); void updateGoodsDetail(GoodsDetailDO goodsDetailDO);
List<GoodsImgDO> listGoodsInfoByGoodsId(Integer id); List<GoodsImgDO> listGoodsInfoByGoodsId(Integer id);
void deleteImgByIds(List<Integer> deleteIds); void deleteImgByIds(List<Integer> deleteIds);
void deleteGoodsVideoById(Integer id); void deleteGoodsVideoById(Integer id);
void deleteGoodsServiceByGoodsId(Integer id); void deleteGoodsServiceByGoodsId(Integer id);
void insertMallIndustrySkuInfo(MallIndustrySkuInfoDO mallIndustrySkuInfoDO); void insertMallIndustrySkuInfo(MallIndustrySkuInfoDO mallIndustrySkuInfoDO);
void insertMallIndustrySkuInfoSpec(MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO); void insertMallIndustrySkuInfoSpec(MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO);
List<MallProdInfoDO> getMallProSkuInfo(Integer id); List<MallProdInfoDO> getMallProSkuInfo(Integer id);
void batchUpdateMallProductSku(List<Integer> delIds); void batchUpdateMallProductSku(List<Integer> delIds);
void batchUpdateMallProdSkuInfo(List<MallProdInfoDO> list); void batchUpdateMallProdSkuInfo(List<MallProdInfoDO> list);
List<MallIndustrySkuInfoDO> getMallIndustrySkuInfo(Integer id); List<MallIndustrySkuInfoDO> getMallIndustrySkuInfo(Integer id);
GoodsInfo getGoodsSimpleInfo(Integer goodsInfoId); GoodsInfo getGoodsSimpleInfo(Integer goodsInfoId);
GoodsDetailDO getGoodsDetailByGoodsId(Integer goodsInfoId); GoodsDetailDO getGoodsDetailByGoodsId(Integer goodsInfoId);
List<GoodsServiceDO> listGoodsServiceByGoodsId(Integer goodsInfoId); List<GoodsServiceDO> listGoodsServiceByGoodsId(Integer goodsInfoId);
List<SkuUnitDO> getSkuUnit(); List<SkuUnitDO> getSkuUnit();
List<GoodsInfo> listSimpleGoodsInfoByIds(@Param("ids") Set<Integer> ids); List<GoodsInfo> listSimpleGoodsInfoByIds(@Param("ids") Set<Integer> ids);
void insertMallProdSkuInfoSpec(MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO); void insertMallProdSkuInfoSpec(MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO);
void batchUpdateMallProSpec(@Param("list") List<Integer> list, @Param("id") Integer id); void batchUpdateMallProSpec(@Param("list") List<Integer> list, @Param("id") Integer id);
List<MallProdSkuInfoSpecDO> listMallProdSpecInfo(List<Integer> mallSkuIds); List<MallProdSkuInfoSpecDO> listMallProdSpecInfo(List<Integer> mallSkuIds);
void batchUpdateMallProdSpec(List<Integer> delSpecId); void batchUpdateMallProdSpec(List<Integer> delSpecId);
List<MallGoodsSpecInfoDO> listProdSpecInfo(@Param("prodIds") Set<Integer> prodIds); List<MallGoodsSpecInfoDO> listProdSpecInfo(@Param("prodIds") Set<Integer> prodIds);
List<MallGoodsSpecInfoDO> listIndstSpecInfo(@Param("indstIds") Set<Integer> indstIds); List<MallGoodsSpecInfoDO> listIndstSpecInfo(@Param("indstIds") Set<Integer> indstIds);
List<GoodsServiceDO> listGoodsService(List<Integer> goodsIds); List<GoodsServiceDO> listGoodsService(List<Integer> goodsIds);
List<MallGoodsInfoSimpleDO> listMallGoodsIndstSimpleInfo( List<MallGoodsInfoSimpleDO> listMallGoodsIndstSimpleInfo(
@Param("indstSkuSpecIds") Set<Integer> indstSkuSpecIds); @Param("indstSkuSpecIds") Set<Integer> indstSkuSpecIds);
List<Integer> listIndustrySpecIds(Set<Integer> mallIndstSkuSpecIds); List<Integer> listIndustrySpecIds(Set<Integer> mallIndstSkuSpecIds);
List<MallGoodsProductDO> listIndustryProductList(List<Integer> industrySpecIds); List<MallGoodsProductDO> listIndustryProductList(List<Integer> industrySpecIds);
List<GoodsInfo> ListGoodsInfoByCategoryId(Integer pageNo,Integer pageSize,Integer id,int type); List<GoodsInfo> ListGoodsInfoByCategoryId(Integer pageNo, Integer pageSize, Integer id, int type);
List<MallProdSkuInfoSpecDO> getMallProSkuInfoSpec(Integer goodsInfoId); List<MallProdSkuInfoSpecDO> getMallProSkuInfoSpec(Integer goodsInfoId);
List<MallProdSkuInfoSpecDO> listMallprodSpecById(List<Integer> goodsIds); List<MallProdSkuInfoSpecDO> listMallprodSpecById(List<Integer> goodsIds);
List<SaleServiceDO> listSaleServiceInfo(); List<SaleServiceDO> listSaleServiceInfo();
int countListGoodsInfo(MallGoodsQO param); int countListGoodsInfo(MallGoodsQO param);
List<GoodsInfo> listGoodsInfo(MallGoodsQO param); List<GoodsInfo> listGoodsInfo(MallGoodsQO param);
void batchUpOrDownWare(@Param("ids") List<Integer> ids, @Param("status") Integer status); void batchUpOrDownWare(@Param("ids") List<Integer> ids, @Param("status") Integer status);
void removeWareInfo(List<Integer> ids); void removeWareInfo(List<Integer> ids);
List<SpecPriceVO> getPriceBySpecId(Integer productSpecId, Integer leaseTerm); List<SpecPriceVO> getPriceBySpecId(Integer productSpecId, Integer leaseTerm);
int countGoodsInfoByCategoryId(Integer id); int countGoodsInfoByCategoryId(Integer id);
void updateMallProdSkuInfo(MallProdInfoDO mallProdInfoDO); void updateMallProdSkuInfo(MallProdInfoDO mallProdInfoDO);
List<MallProdInfoDO> getAllMallProSkuInfo(Integer goodsInfoId); List<MallProdInfoDO> getAllMallProSkuInfo(Integer goodsInfoId);
int updateGoodsInfoSort(Integer id, Integer sort); int updateGoodsInfoSort(Integer id, Integer sort);
int countServiceByCategoryId(Integer id); int countServiceByCategoryId(Integer id);
} }
package com.mmc.pms.dao.category;
import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.entity.category.CategoryPrimaryDO;
import com.mmc.pms.entity.category.CategorySubDO;
import com.mmc.pms.model.category.qo.CategoryQO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Author small
* @Date 2023/7/21 10:20
* @Version 1.0
*/
@Mapper
public interface CategoryDao {
int getCountName(String name);
void addPrimaryCategory(CategoryPrimaryDO primaryDO);
void updateSort(Integer id);
void deletePrimaryCategory(Integer id);
Integer categoryCount(CategoryPrimaryDO primaryDO);
void updatePrimaryCategory(CategoryPrimaryDO primaryDO);
int getCountSubName(String name, Integer categoryPrimaryId);
void addSubCategory(CategorySubDO subDO);
Integer categorySubCount(CategorySubDO subDO);
void updateSubCategory(CategorySubDO subDO);
void deleteSubCategory(Integer id);
CategorySubDO detailSubCategory(Integer id);
List<CategoryPrimaryDO> categoryList(CategoryQO param);
List<CategorySubDO> selectSubList(Integer id);
int categoryListCount(CategoryQO param);
void exchange(ServiceDO serviceDO);
List<CategoryPrimaryDO> selectPrimaryList();
List<CategorySubDO> selectCategorySubList(List<Integer> ids);
Integer selectSubMallGoods(Integer id);
Integer selectPrimary(Integer id);
}
package com.mmc.pms.dao.mall;
import com.mmc.pms.entity.mall.MallGoodsDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author LW
* @date 2023/7/26 14:57
* 概要:
*/
@Mapper
public interface AppMallGoodsDao {
List<MallGoodsDO> queryGoodsInfo(@Param("userAccountId") Integer userAccountId, @Param("categorySubIds") List<Integer> categorySubIds);
}
package com.mmc.pms.dao.mall;
import com.mmc.pms.entity.SkuUnitDO;
import com.mmc.pms.entity.mall.GoodsSpecDO;
import com.mmc.pms.entity.mall.GoodsSpecValuesDO;
import com.mmc.pms.entity.mall.MallGoodsDO;
import com.mmc.pms.entity.mall.MallGoodsResourcesDO;
import com.mmc.pms.model.mall.MallGoodsVO;
import com.mmc.pms.model.sale.qo.MallGoodsInfoQO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author LW
* @date 2023/7/24 17:38 概要:
*/
@Mapper
public interface MallGoodsDao {
int countMallGoodsByName(@Param("mallGoodsVO") MallGoodsVO mallGoodsVO, @Param("userAccountId") Integer userAccountId);
int countMallGoods(Integer userAccountId);
void insertMallGoodsBaseInfo(MallGoodsDO mallGoodsDO);
void insertGoodsSpec(GoodsSpecDO goodsSpecDO);
void batchInsertSpecValues(List<GoodsSpecValuesDO> goodsSpecValuesList);
void batchInsertMallGoodsResources(List<MallGoodsResourcesDO> mallGoodsResourcesList);
MallGoodsDO getMallGoodsBaseInfo(Integer id);
List<MallGoodsResourcesDO> getMallGoodsResources(Integer id);
List<GoodsSpecDO> getMallGoodsSpec(Integer id);
List<GoodsSpecValuesDO> getMallGoodsSpecValues(List<Integer> ids);
void updateMallGoods(@Param("mallGoodsDO") MallGoodsDO mallGoodsDO);
void deleteMallGoodsResources(Integer id);
void deleteGoodsSpec(List<Integer> deleteSpec);
void updateGoodsSpec(GoodsSpecDO goodsSpecDO);
void deleteGoodsSpecValues(List<Integer> deleteSpecValueId);
void updateGoodsSpecValue(GoodsSpecValuesDO goodsSpecValuesDO);
List<SkuUnitDO> getSkuUnit();
int countListMallGoods(MallGoodsInfoQO param);
List<MallGoodsDO> listMallGoods(MallGoodsInfoQO param);
int updateMallGoodsSort(Integer id, Integer sort);
void updateMallGoodsByShelf(Integer id, Integer status);
void removeMallGoods(Integer id);
void feignRemoveGoodsByBackUserAccountId(Integer id);
}
package com.mmc.pms.entity.category;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mmc.pms.model.category.dto.CategoryPrimaryDTO;
import com.mmc.pms.model.category.vo.CategoryPrimaryVO;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
/**
* @Author small
* @Date 2023/7/21 10:15
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class CategoryPrimaryDO {
@ApiModelProperty(value = "id")
@NotNull(message = "id不能为空", groups = {Update.class})
@Min(value = 1, groups = {Update.class})
@TableId(type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "分类名称", required = true, example = "无人机")
@Size(max = 15, message = "分类名称不能超过15个字", groups = {Update.class, Create.class})
@NotBlank(message = "分类名称不能为空或空字符", groups = {Update.class, Create.class})
private String name;
@ApiModelProperty(value = "描述")
@Size(max = 70, message = "分类描述不能超过70个字", groups = {Update.class, Create.class})
private String description;
@ApiModelProperty(value = "icon图标")
private String icon;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间", example = "2023-07-14 10:13:12", required = true)
private Date createTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间", example = "2023-07-14 10:13:12", required = true)
private Date updateTime;
@ApiModelProperty(value = "子分类")
private List<CategorySubDO> subDOList;
@ApiModelProperty(value = "顺序")
private Integer sort;
public CategoryPrimaryDO(CategoryPrimaryVO primaryVO) {
this.id = primaryVO.getId();
this.name = primaryVO.getName();
this.description = primaryVO.getDescription();
this.icon = primaryVO.getIcon();
}
public CategoryPrimaryDTO buildCategoryPrimaryDTO() {
return CategoryPrimaryDTO.builder()
.id(this.id)
.name(this.name)
.description(this.description)
.icon(this.icon)
.createTime(this.createTime)
.updateTime(this.updateTime)
.subDTOList(this.subDOList)
.sort(this.sort)
.build();
}
}
package com.mmc.pms.entity.category;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mmc.pms.model.category.dto.CategorySubDTO;
import com.mmc.pms.model.category.vo.CategorySubVO;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
/**
* @Author small
* @Date 2023/7/21 10:16
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class CategorySubDO {
@ApiModelProperty(value = "id")
@NotNull(message = "id不能为空", groups = {Update.class})
@Min(value = 1, groups = {Update.class})
@TableId(type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "分类名称", required = true, example = "无人机")
@Size(max = 15, message = "分类名称不能超过15个字", groups = {Update.class, Create.class})
@NotBlank(message = "分类名称不能为空或空字符", groups = {Update.class, Create.class})
private String name;
@ApiModelProperty(value = "描述")
@Size(max = 70, message = "分类描述不能超过70个字", groups = {Update.class, Create.class})
private String description;
@ApiModelProperty(value = "一级id不能为空", required = true, example = "1")
@NotNull(message = "一级id不能为空", groups = {Update.class, Create.class})
private Integer categoryPrimaryId;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间", example = "2023-07-14 10:13:12", required = true)
private Date createTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间", example = "2023-07-14 10:13:12", required = true)
private Date updateTime;
public CategorySubDO(CategorySubVO subVO) {
this.id = subVO.getId();
this.name = subVO.getName();
this.description = subVO.getDescription();
this.categoryPrimaryId = subVO.getCategoryPrimaryId();
}
public CategorySubDTO buildCategorySubDTO() {
return CategorySubDTO.builder()
.id(this.id)
.name(this.name)
.description(this.description)
.categoryPrimaryId(this.categoryPrimaryId)
.createTime(this.createTime)
.updateTime(this.updateTime)
.build();
}
}
package com.mmc.pms.entity.mall;
import com.mmc.pms.model.mall.GoodsSpecVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* (GoodsSpecDO)实体类
*
* @author makejava
* @since 2023-07-24 21:16:41
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GoodsSpecDO implements Serializable {
private static final long serialVersionUID = 381669128695968475L;
private Integer id;
/**
* 商品id
*/
private Integer mallGoodsId;
/**
* 规格名称
*/
private String specName;
/**
* 0单选,1多选
*/
private Integer chooseType;
/**
* 0 非必选 1 必选
*/
private Integer must;
/**
* 单位id
*/
private Integer skuUnitId;
private Date createTime;
private Date updateTime;
public GoodsSpecDO(GoodsSpecVO goodsSpecVO) {
this.id = goodsSpecVO.getId();
this.mallGoodsId = goodsSpecVO.getMallGoodsId();
this.specName = goodsSpecVO.getSpecName();
this.chooseType = goodsSpecVO.getChooseType();
this.must = goodsSpecVO.getMust();
this.skuUnitId = goodsSpecVO.getSkuUnitId();
}
public GoodsSpecVO buildGoodsSpecVO() {
return GoodsSpecVO.builder().id(id).mallGoodsId(mallGoodsId).specName(specName)
.chooseType(chooseType).must(must).skuUnitId(skuUnitId).build();
}
}
package com.mmc.pms.entity.mall;
import com.mmc.pms.model.mall.GoodsSpecValuesVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* (GoodsSpecValuesDO)实体类
*
* @author makejava
* @since 2023-07-24 21:18:28
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GoodsSpecValuesDO implements Serializable {
private static final long serialVersionUID = -35192084826222973L;
private Integer id;
/**
* 规格id
*/
private Integer goodsSpecId;
/**
* 选项名称
*/
private String specValueName;
/**
* 料号
*/
private String partNo;
/**
* 规格图片
*/
private String specValueImage;
/**
* 销售价是否显示 0:否 1:是
*/
private Integer showPrice;
/**
* 库存
*/
private Integer stock;
/**
* 销售价格
*/
private BigDecimal salePrice;
/**
* 渠道价格
*/
private BigDecimal channelPrice;
private Date createTime;
private Date updateTime;
public GoodsSpecValuesDO(GoodsSpecValuesVO d) {
this.id = d.getId();
this.goodsSpecId = d.getGoodsSpecId();
this.specValueName = d.getSpecValueName();
this.partNo = d.getPartNo();
this.specValueImage = d.getSpecValueImage();
this.showPrice = d.getShowPrice();
this.channelPrice = d.getChannelPrice();
this.salePrice = d.getSalePrice();
this.stock = d.getStock();
}
public GoodsSpecValuesVO buildGoodsSpecValuesVO() {
return GoodsSpecValuesVO.builder().id(id).goodsSpecId(goodsSpecId)
.specValueName(specValueName).specValueImage(specValueImage)
.partNo(partNo).showPrice(showPrice).stock(stock)
.salePrice(salePrice).channelPrice(channelPrice).build();
}
}
package com.mmc.pms.entity.mall;
import com.mmc.pms.model.mall.GoodsResourcesVO;
import com.mmc.pms.model.mall.MallGoodsVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 商品基本信息(MallGoodsDO)实体类
*
* @author makejava
* @since 2023-07-24 21:10:02
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MallGoodsDO implements Serializable {
private static final long serialVersionUID = 709941898403563905L;
private Integer id;
/**
* 商品编号(ID12345678)
*/
private String goodsNo;
/**
* 商品名称
*/
private String tradeName;
/**
* 商品描述
*/
private String description;
/**
* 商品一级分类
*/
private Integer categoryPrimaryId;
/**
* 商品二级分类
*/
private Integer categorySubId;
/**
* 状态:0: 下架 1:上架
*/
private Integer shelfStatus;
/**
* 商品标签
*/
private String goodsLabel;
/**
* 标签是否显示0:否1:是
*/
private Integer labelShow;
/**
* 商品详情图 富文本
*/
private String goodsDetails;
/**
* 创建商品用户id
*/
private Integer userAccountId;
/**
* 排序字段
*/
private Integer sort;
private Date createTime;
private Date updateTime;
private Integer deleted;
private String url;
private Integer type;
private Integer imgId;
public MallGoodsDO(MallGoodsVO mallGoodsVO) {
this.id = mallGoodsVO.getId();
this.tradeName = mallGoodsVO.getTradeName();
this.description = mallGoodsVO.getDescription();
this.categoryPrimaryId = mallGoodsVO.getCategoryPrimaryId();
this.categorySubId = mallGoodsVO.getCategorySubId();
this.shelfStatus = mallGoodsVO.getShelfStatus();
this.goodsLabel = mallGoodsVO.getGoodsLabel();
this.labelShow = mallGoodsVO.getLabelShow();
this.goodsDetails = mallGoodsVO.getGoodsDetails();
}
public MallGoodsVO buildMallGoodsVO() {
return MallGoodsVO.builder().id(id).userAccountId(userAccountId).tradeName(tradeName).description(description)
.categoryPrimaryId(categoryPrimaryId).categorySubId(categorySubId).shelfStatus(shelfStatus)
.goodsLabel(goodsLabel).labelShow(labelShow).goodsDetails(goodsDetails).build();
}
public MallGoodsVO buildListMallGoodsVO() {
List<GoodsResourcesVO> resourcesList = new ArrayList<>();
GoodsResourcesVO goodsResourcesVO = new GoodsResourcesVO();
goodsResourcesVO.setId(imgId);
goodsResourcesVO.setUrl(url);
goodsResourcesVO.setType(type);
resourcesList.add(goodsResourcesVO);
return MallGoodsVO.builder().id(id).userAccountId(userAccountId).tradeName(tradeName).resourcesList(resourcesList)
.categoryPrimaryId(categoryPrimaryId).labelShow(labelShow).goodsLabel(goodsLabel).categorySubId(categorySubId)
.shelfStatus(shelfStatus).createTime(createTime).description(description).build();
}
}
package com.mmc.pms.entity.mall;
import com.mmc.pms.model.mall.GoodsResourcesVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* (MallGoodsResourcesDO)实体类
*
* @author makejava
* @since 2023-07-24 21:13:15
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MallGoodsResourcesDO implements Serializable {
private static final long serialVersionUID = -98370711703270379L;
private Integer id;
private Integer mallGoodsId;
/**
* 资源url
*/
private String url;
/**
* 类型:0主图 1副图 2视频
*/
private Integer type;
private Date createTime;
private Date updateTime;
public MallGoodsResourcesDO(GoodsResourcesVO d) {
this.type = d.getType();
this.id = d.getId();
this.url = d.getUrl();
}
public GoodsResourcesVO buildGoodsResourcesVO() {
return GoodsResourcesVO.builder().id(id).url(url).type(type).build();
}
}
package com.mmc.pms.model.category.dto;
import com.mmc.pms.entity.category.CategorySubDO;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
/**
* @Author small
* @Date 2023/7/20 16:35
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CategoryPrimaryDTO {
@ApiModelProperty(value = "id")
@NotNull(message = "id不能为空", groups = {Update.class})
@Min(value = 1, groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "分类名称", required = true, example = "无人机")
@Size(max = 15, message = "分类名称不能超过15个字", groups = {Update.class, Create.class})
@NotBlank(message = "分类名称不能为空或空字符", groups = {Update.class, Create.class})
private String name;
@ApiModelProperty(value = "描述")
@Size(max = 70, message = "分类描述不能超过70个字", groups = {Update.class, Create.class})
private String description;
@ApiModelProperty(value = "icon图标")
private String icon;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间", example = "2023-07-14 10:13:12", required = true)
private Date createTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间", example = "2023-07-14 10:13:12", required = true)
private Date updateTime;
@ApiModelProperty(value = "二级分类")
private List<CategorySubDO> subDTOList;
@ApiModelProperty(value = "顺序")
private Integer sort;
}
package com.mmc.pms.model.category.dto;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
/**
* @Author small
* @Date 2023/7/21 10:10
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CategorySubDTO {
@ApiModelProperty(value = "id")
@NotNull(message = "id不能为空", groups = {Update.class})
@Min(value = 1, groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "分类名称", required = true, example = "无人机")
@Size(max = 15, message = "分类名称不能超过15个字", groups = {Update.class, Create.class})
@NotBlank(message = "分类名称不能为空或空字符", groups = {Update.class, Create.class})
private String name;
@ApiModelProperty(value = "描述")
@Size(max = 70, message = "分类描述不能超过70个字", groups = {Update.class, Create.class})
private String description;
@ApiModelProperty(value = "一级id不能为空", required = true, example = "1")
@NotNull(message = "一级id不能为空", groups = {Update.class, Create.class})
private Integer categoryPrimaryId;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间", example = "2023-07-14 10:13:12", required = true)
private Date createTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间", example = "2023-07-14 10:13:12", required = true)
private Date updateTime;
}
package com.mmc.pms.model.category.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* @Author small
* @Date 2023/7/21 15:22
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CategoryQO {
private static final long serialVersionUID = -3729786590325257669L;
@ApiModelProperty(value = "一级分类id", required = false, example = "1")
private Integer id;
@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;
}
}
package com.mmc.pms.model.category.vo;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Others;
import com.mmc.pms.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* @Author small
* @Date 2023/7/20 16:34
* @Version 1.0
*/
@Data
public class CategoryPrimaryVO {
@ApiModelProperty(value = "id", example = "1")
@NotNull(message = "id不能为空", groups = {Update.class, Others.class})
@Min(value = 1, groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "分类名称", required = true, example = "无人机")
@Size(max = 15, message = "分类名称不能超过15个字", groups = {Update.class, Create.class})
@NotBlank(message = "分类名称不能为空或空字符", groups = {Update.class, Create.class})
private String name;
@ApiModelProperty(value = "描述", example = "描述一下")
@Size(max = 70, message = "分类描述不能超过70个字", groups = {Update.class, Create.class})
private String description;
@ApiModelProperty(value = "icon图标", example = "http://")
private String icon;
@ApiModelProperty(value = "顺序")
@NotNull(message = "sort不能为空", groups = {Others.class})
private Integer sort;
}
package com.mmc.pms.model.category.vo;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* @Author small
* @Date 2023/7/21 10:10
* @Version 1.0
*/
@Data
public class CategorySubVO {
@ApiModelProperty(value = "id", example = "1")
@NotNull(message = "id不能为空", groups = {Update.class})
@Min(value = 1, groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "分类名称", required = true, example = "无人机")
@Size(max = 15, message = "分类名称不能超过15个字", groups = {Update.class, Create.class})
@NotBlank(message = "分类名称不能为空或空字符", groups = {Update.class, Create.class})
private String name;
@ApiModelProperty(value = "描述", example = "描述001")
@Size(max = 70, message = "分类描述不能超过70个字", groups = {Update.class, Create.class})
private String description;
@ApiModelProperty(value = "一级分类id不能为空", required = true, example = "1")
@NotNull(message = "一级分类id不能为空", groups = {Update.class, Create.class})
private Integer categoryPrimaryId;
}
package com.mmc.pms.model.mall;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author LW
* @date 2023/7/24 17:57
* 概要:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class GoodsResourcesVO {
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "url")
private String url;
@ApiModelProperty(value = "类型:0主图 1副图 2视频")
private Integer type;
}
package com.mmc.pms.model.mall;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @Author LW
* @date 2023/7/24 20:16
* 概要:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class GoodsSpecVO {
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "商品id")
private Integer mallGoodsId;
@ApiModelProperty(value = "规格名称", example = "规格名称", required = true)
private String specName;
@ApiModelProperty(value = "选择方式 :0单选,1多选", example = "1", required = true)
private Integer chooseType;
@ApiModelProperty(value = "是否必选 : 0 非必选 1 必选", example = "0", required = true)
private Integer must;
@ApiModelProperty(value = "单位id", example = "1", required = true)
private Integer skuUnitId;
@ApiModelProperty(value = "规格值信息", required = true)
private List<GoodsSpecValuesVO> goodsSpecValuesList;
}
package com.mmc.pms.model.mall;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @Author LW
* @date 2023/7/24 20:26
* 概要:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class GoodsSpecValuesVO {
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "规格id", example = "1")
private Integer goodsSpecId;
@ApiModelProperty(value = "选项名称", example = "规格值名称", required = true)
private String specValueName;
@ApiModelProperty(value = "料号", example = "料号", required = true)
private String partNo;
@ApiModelProperty(value = "规格值图片url", example = "1.jpg", required = true)
private String specValueImage;
@ApiModelProperty(value = "是否展示销售价格 0:否 1:是", example = "1", required = true)
private Integer showPrice;
@ApiModelProperty(value = "库存数量", example = "100")
private Integer stock;
@ApiModelProperty(value = "销售价格", example = "100.00", required = true)
private BigDecimal salePrice;
@ApiModelProperty(value = "渠道价格", example = "50.00")
private BigDecimal channelPrice;
}
package com.mmc.pms.model.mall;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
* @Author LW
* @date 2023/7/24 17:44
* 概要:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class MallGoodsVO {
@ApiModelProperty(value = "id", example = "1")
@NotNull(message = "id不能为空", groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "商品名称", example = "这是商品名称", required = true)
@NotBlank(message = "商品名称不能为空", groups = {Update.class, Create.class})
private String tradeName;
@ApiModelProperty(value = "商品描述", example = "商品描述", required = true)
@NotBlank(message = "商品描述不能为空", groups = {Update.class, Create.class})
private String description;
@ApiModelProperty(value = "商品资源:图片or视频及其他")
@NotEmpty(message = "图片不能为空")
private List<GoodsResourcesVO> resourcesList;
@ApiModelProperty(value = "一级分类id", example = "1", required = true)
@NotNull(message = "一级分类id不能为空", groups = {Update.class, Create.class})
private Integer categoryPrimaryId;
@ApiModelProperty(value = "二级分类id", example = "2", required = true)
@NotNull(message = "二级分类id不能为空", groups = {Update.class, Create.class})
private Integer categorySubId;
@ApiModelProperty(value = "商品状态", example = "1", required = true)
@NotNull(message = "商品状态不能为空", groups = {Update.class, Create.class})
private Integer shelfStatus;
@ApiModelProperty(value = "商品标签")
private String goodsLabel;
@ApiModelProperty(value = "标签是否显示 0否 1是")
private Integer labelShow;
@ApiModelProperty(value = "规格")
@NotEmpty(message = "规格不能为空", groups = {Update.class, Create.class})
private List<GoodsSpecVO> goodsSpecList;
@ApiModelProperty(value = "商品详情 富文本")
private String goodsDetails;
@ApiModelProperty(value = "创建时间 用作列表回显")
private Date createTime;
@ApiModelProperty(value = "店铺id 小程序用")
private Integer userAccountId;
}
package com.mmc.pms.model.other.dto; package com.mmc.pms.model.other.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
...@@ -10,40 +9,27 @@ import lombok.NoArgsConstructor; ...@@ -10,40 +9,27 @@ import lombok.NoArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
/** /**
* @Author small @Date 2023/5/25 9:57 @Version 1.0 * @Author small
* @Date 2023/7/10 16:03
* @Version 1.0
*/ */
@Builder @Builder
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ApiModel(description = "角色信息DTO")
public class RoleInfoDTO implements Serializable { public class RoleInfoDTO implements Serializable {
private static final long serialVersionUID = -4791023169682602298L; private static final long serialVersionUID = -4791023169682602298L;
@ApiModelProperty(value = "角色ID")
private Integer id;
@ApiModelProperty(value = "角色编号")
private String roleNo;
@ApiModelProperty(value = "角色名称/权限角色")
private String roleName;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "账号名称/创建人")
private String userName;
@ApiModelProperty(value = "0不是超级管理员 1是超级管理员")
private Integer superAdmin;
@ApiModelProperty(value = "角色ID")
private Integer id;
@ApiModelProperty(value = "角色编号")
private String roleNo;
@ApiModelProperty(value = "角色名称")
private String roleName;
@ApiModelProperty(value = "是否为管理角色:0否 1是")
private Integer admin; // 是否为管理角色
@ApiModelProperty(value = "是否为运营角色:0否 1是")
private Integer operate;
@ApiModelProperty(value = "是否为系统角色:0否 1是")
private Integer system;
@ApiModelProperty(value = "是否为PMC发货角色:0否 1是")
private Integer pmc; // PMC发货角色
@ApiModelProperty(value = "是否可用:0否 1是")
private Integer roleStatus;
@ApiModelProperty(value = "备注")
private String remark;
} }
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 MallGoodsInfoQO {
@ApiModelProperty(value = "商品名称", example = "商品名称")
private String tradeName;
@ApiModelProperty(value = "商品一级分类", example = "1")
private Integer categoryPrimaryId;
@ApiModelProperty(value = "用户id", hidden = true)
private Integer userAccountId;
@ApiModelProperty(value = "商品状态 0:下架 1:上架")
private Integer shelfStatus;
@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;
}
}
...@@ -13,7 +13,6 @@ import javax.validation.constraints.NotNull; ...@@ -13,7 +13,6 @@ import javax.validation.constraints.NotNull;
/** /**
* @Author LW * @Author LW
*
* @date 2022/3/22 9:44 概要:商品列表查询QO * @date 2022/3/22 9:44 概要:商品列表查询QO
*/ */
@Builder @Builder
...@@ -21,39 +20,39 @@ import javax.validation.constraints.NotNull; ...@@ -21,39 +20,39 @@ import javax.validation.constraints.NotNull;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class MallGoodsQO { public class MallGoodsQO {
@ApiModelProperty(value = "商品名称", example = "商品名称") @ApiModelProperty(value = "商品名称", example = "商品名称")
private String goodsName; private String goodsName;
@ApiModelProperty(value = "商品类型 0:销售 1:租赁", example = "0") @ApiModelProperty(value = "商品类型 0:销售 1:租赁", example = "0")
private Integer goodsType; private Integer goodsType;
@ApiModelProperty(value = "开始时间", example = "2023-06-09 00:00:00") @ApiModelProperty(value = "开始时间", example = "2023-06-09 00:00:00")
private String startTime; private String startTime;
@ApiModelProperty(value = "结束时间", example = "2023-06-11 23:59:59") @ApiModelProperty(value = "结束时间", example = "2023-06-11 23:59:59")
private String endTime; private String endTime;
@ApiModelProperty(value = "状态 0:下架(仓库中)1:上架", example = "1") @ApiModelProperty(value = "状态 0:下架(仓库中)1:上架", example = "1")
private Integer status; private Integer status;
@ApiModelProperty(value = "目录id", example = "1") @ApiModelProperty(value = "目录id", example = "1")
private Integer directoryId; private Integer directoryId;
@ApiModelProperty(value = "页码", required = true, example = "1") @ApiModelProperty(value = "页码", required = true, example = "1")
@NotNull( @NotNull(
message = "页码不能为空", message = "页码不能为空",
groups = {Page.class, Freeze.class}) groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class) @Min(value = 1, groups = Page.class)
private Integer pageNo; private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true, example = "10") @ApiModelProperty(value = "每页显示数", required = true, example = "10")
@NotNull( @NotNull(
message = "每页显示数不能为空", message = "每页显示数不能为空",
groups = {Page.class, Freeze.class}) groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class) @Min(value = 1, groups = Page.class)
private Integer pageSize; private Integer pageSize;
public void buildCurrentPage() { public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize; this.pageNo = (pageNo - 1) * pageSize;
} }
} }
package com.mmc.pms.model.sale.vo;
import com.mmc.pms.model.sale.dto.ProductSpecVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @Author small @Date 2023/5/16 15:27 @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class GoodsSpecVO implements Serializable {
private static final long serialVersionUID = -8681372139970849591L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "规格名称")
private String goodsSpecName;
@ApiModelProperty(value = "产品类型")
private Integer goodsTypeId;
@ApiModelProperty(value = "产品:自定义时此字段可不用填写")
private Integer skuId;
@ApiModelProperty(value = "规格来源 0:获取 1:自定义")
private Integer flag;
@ApiModelProperty(value = "产品名称(自定义的时候才需要传值)")
private String productName;
@ApiModelProperty(value = "选项来源")
private List<MallProductSpecVO> specIds;
@ApiModelProperty(value = "选择方式")
private Integer chooseType;
@ApiModelProperty(value = "规格单位")
private Integer skuUnitId;
@ApiModelProperty(value = "是否必选")
private Integer must;
@ApiModelProperty(value = "自定义的信息填充")
private List<ProductSpecVO> customizeInfo;
@ApiModelProperty(value = "删除的自定义规格id")
private List<Integer> delProductSpecId;
}
...@@ -21,31 +21,31 @@ import java.util.List; ...@@ -21,31 +21,31 @@ import java.util.List;
*/ */
public interface GoodsInfoService { public interface GoodsInfoService {
ResultBody addGoods(GoodsAddVO goodsAddVO, Integer userAccountId); ResultBody addGoods(GoodsAddVO goodsAddVO, Integer userAccountId);
ResultBody editGoodsInfo(GoodsAddVO goodsAddVO); ResultBody editGoodsInfo(GoodsAddVO goodsAddVO);
ResultBody getGoodsInfoDetail(Integer goodsInfoId, Integer type, Integer leaseTerm); ResultBody getGoodsInfoDetail(Integer goodsInfoId, Integer type, Integer leaseTerm);
ResultBody getSkuUnit(); ResultBody getSkuUnit();
ResultBody getSaleServiceInfoToList(); ResultBody getSaleServiceInfoToList();
List<MallGoodsShopCarDTO> fillGoodsInfo(List<MallGoodsShopCarDTO> param); List<MallGoodsShopCarDTO> fillGoodsInfo(List<MallGoodsShopCarDTO> param);
List<MallProductSpecPriceDTO> feignListProductSpecPrice(ProductSpecPriceQO productSpecPriceQO); List<MallProductSpecPriceDTO> feignListProductSpecPrice(ProductSpecPriceQO productSpecPriceQO);
ProductSpecPriceDTO feignGetUnitPriceByTag(Integer specId, Integer tagId); ProductSpecPriceDTO feignGetUnitPriceByTag(Integer specId, Integer tagId);
List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO); List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO); List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
PageResult listPageGoodsInfo(MallGoodsQO param); PageResult listPageGoodsInfo(MallGoodsQO param);
ResultBody batchOnShelfOrTakeDown(List<Integer> goodsIds, Integer status); ResultBody batchOnShelfOrTakeDown(List<Integer> goodsIds, Integer status);
ResultBody batchRemoveWareInfo(List<Integer> ids); ResultBody batchRemoveWareInfo(List<Integer> ids);
ResultBody exchangeGoodsInfo(Integer firstId, Integer secondId); ResultBody exchangeGoodsInfo(Integer firstId, Integer secondId);
} }
package com.mmc.pms.service.category;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.category.dto.CategoryPrimaryDTO;
import com.mmc.pms.model.category.qo.CategoryQO;
import com.mmc.pms.model.category.vo.CategoryPrimaryVO;
import com.mmc.pms.model.category.vo.CategorySubVO;
import com.mmc.pms.page.PageResult;
import java.util.List;
/**
* @Author small
* @Date 2023/7/20 16:26
* @Version 1.0
*/
public interface CategoryService {
ResultBody addPrimaryCategory(CategoryPrimaryVO primaryVO);
ResultBody deletePrimaryCategory(Integer id);
ResultBody updatePrimaryCategory(CategoryPrimaryVO primaryVO);
ResultBody addSubCategory(CategorySubVO subVO);
ResultBody updateSubCategory(CategorySubVO subVO);
ResultBody deleteSubCategory(Integer id);
ResultBody detailSubCategory(Integer id);
PageResult<CategoryPrimaryDTO> categoryList(CategoryQO param);
ResultBody exchange(List<CategoryPrimaryVO> list);
ResultBody<CategoryPrimaryDTO> appCategoryInfo();
}
package com.mmc.pms.service.category.impl;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.dao.category.CategoryDao;
import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.entity.category.CategoryPrimaryDO;
import com.mmc.pms.entity.category.CategorySubDO;
import com.mmc.pms.model.category.dto.CategoryPrimaryDTO;
import com.mmc.pms.model.category.dto.CategorySubDTO;
import com.mmc.pms.model.category.qo.CategoryQO;
import com.mmc.pms.model.category.vo.CategoryPrimaryVO;
import com.mmc.pms.model.category.vo.CategorySubVO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.category.CategoryService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author small
* @Date 2023/7/20 16:26
* @Version 1.0
*/
@Service
public class CategoryServiceImpl implements CategoryService {
@Autowired
private CategoryDao categoryDao;
@Override
public ResultBody addPrimaryCategory(CategoryPrimaryVO primaryVO) {
int count = categoryDao.getCountName(primaryVO.getName());
if (count > 0) {
return ResultBody.error(ResultEnum.THE_NAME_OF_A_CLASS_MUST_BE_UNIQUE);
}
CategoryPrimaryDO primaryDO = new CategoryPrimaryDO(primaryVO);
categoryDao.addPrimaryCategory(primaryDO);
Integer id = primaryDO.getId();
categoryDao.updateSort(id);
return ResultBody.success();
}
@Override
public ResultBody deletePrimaryCategory(Integer id) {
Integer integer = categoryDao.selectPrimary(id);
if (integer != 0) {
return ResultBody.error(ResultEnum.THE_CURRENT_CATEGORY_IS_ASSOCIATED_WITH_GOODS);
}
categoryDao.deletePrimaryCategory(id);
return ResultBody.success();
}
@Override
public ResultBody updatePrimaryCategory(CategoryPrimaryVO primaryVO) {
CategoryPrimaryDO primaryDO = new CategoryPrimaryDO(primaryVO);
Integer count = categoryDao.categoryCount(primaryDO);
if (count > 0) {
return ResultBody.error(ResultEnum.THE_NAME_OF_A_CLASS_MUST_BE_UNIQUE);
}
categoryDao.updatePrimaryCategory(primaryDO);
return ResultBody.success();
}
@Override
public ResultBody addSubCategory(CategorySubVO subVO) {
int count = categoryDao.getCountSubName(subVO.getName(), subVO.getCategoryPrimaryId());
if (count > 0) {
return ResultBody.error(ResultEnum.THE_NAME_OF_THE_SECONDARY_CLASS_MUST_BE_UNIQUE);
}
CategorySubDO subDO = new CategorySubDO(subVO);
int number = (int) (Math.random() * 90 + 10);
subDO.setId(subVO.getCategoryPrimaryId() + 1 + number);
categoryDao.addSubCategory(subDO);
return ResultBody.success();
}
@Override
public ResultBody updateSubCategory(CategorySubVO subVO) {
CategorySubDO subDO = new CategorySubDO(subVO);
Integer count = categoryDao.categorySubCount(subDO);
if (count > 0) {
return ResultBody.error(ResultEnum.THE_NAME_OF_THE_SECONDARY_CLASS_MUST_BE_UNIQUE);
}
categoryDao.updateSubCategory(subDO);
return ResultBody.success();
}
@Override
public ResultBody deleteSubCategory(Integer id) {
Integer integer = categoryDao.selectSubMallGoods(id);
if (integer != 0) {
return ResultBody.error(ResultEnum.THE_CURRENT_CATEGORY_IS_ASSOCIATED_WITH_GOODS);
}
categoryDao.deleteSubCategory(id);
return ResultBody.success();
}
@Override
public ResultBody<CategorySubDTO> detailSubCategory(Integer id) {
CategorySubDO subDO = categoryDao.detailSubCategory(id);
CategorySubDTO categorySubDTO = null;
if (subDO != null) {
categorySubDTO = subDO.buildCategorySubDTO();
}
return ResultBody.success(categorySubDTO);
}
@Override
public PageResult<CategoryPrimaryDTO> categoryList(CategoryQO param) {
int count = categoryDao.categoryListCount(param);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
param.buildCurrentPage();
List<CategoryPrimaryDO> categoryPrimaryDOS = categoryDao.categoryList(param);
List<CategoryPrimaryDTO> collect = categoryPrimaryDOS.stream().map(t -> t.buildCategoryPrimaryDTO()).collect(Collectors.toList());
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count, collect);
}
@Transactional
@Override
public ResultBody exchange(List<CategoryPrimaryVO> list) {
Integer sort = list.get(0).getSort();
ServiceDO serviceDO = new ServiceDO();
serviceDO.setId(list.get(0).getId());
serviceDO.setSort(list.get(1).getSort());
categoryDao.exchange(serviceDO);
ServiceDO serviceDO1 = new ServiceDO();
serviceDO1.setId(list.get(1).getId());
serviceDO1.setSort(sort);
categoryDao.exchange(serviceDO1);
return ResultBody.success();
}
@Override
public ResultBody<CategoryPrimaryDTO> appCategoryInfo() {
// 获取所有以及分类
List<CategoryPrimaryDO> categoryPrimaryList = categoryDao.selectPrimaryList();
if (CollectionUtils.isEmpty(categoryPrimaryList)) {
return ResultBody.success();
}
List<CategoryPrimaryDTO> primaryList = categoryPrimaryList.stream()
.map(CategoryPrimaryDO::buildCategoryPrimaryDTO).collect(Collectors.toList());
List<Integer> ids = primaryList.stream().map(CategoryPrimaryDTO::getId).collect(Collectors.toList());
// 批量查找二级分类
List<CategorySubDO> categorySubList = categoryDao.selectCategorySubList(ids);
if (CollectionUtils.isNotEmpty(categorySubList)) {
Map<Integer, List<CategorySubDO>> subMap = categorySubList.stream().collect(Collectors.groupingBy(CategorySubDO::getCategoryPrimaryId));
for (CategoryPrimaryDTO categoryPrimaryDTO : primaryList) {
List<CategorySubDO> categorySubDOList = subMap.get(categoryPrimaryDTO.getId());
categoryPrimaryDTO.setSubDTOList(categorySubDOList);
}
}
return ResultBody.success(primaryList);
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
package com.mmc.pms.service.mall;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.mall.MallGoodsVO;
import java.util.List;
/**
* @Author LW
* @date 2023/7/26 14:55
* 概要:
*/
public interface AppMallGoodsService {
ResultBody<MallGoodsVO> queryBrandGoods(Integer userAccountId);
ResultBody<MallGoodsVO> queryGoodsInfoByCategorySub(List<Integer> categorySubIds);
}
package com.mmc.pms.service.mall;
import com.mmc.pms.auth.dto.LoginSuccessDTO;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.mall.MallGoodsVO;
import com.mmc.pms.model.sale.qo.MallGoodsInfoQO;
import com.mmc.pms.page.PageResult;
/**
* @Author LW
* @date 2023/7/24 17:37 概要:
*/
public interface MallGoodsService {
ResultBody addMallGoods(MallGoodsVO mallGoodsVO, Integer userAccountId);
ResultBody<MallGoodsVO> mallGoodsDetails(Integer id);
ResultBody editMallGoods(MallGoodsVO mallGoodsVO, Integer userAccountId);
ResultBody getSkuUnit();
PageResult listPageGoodsInfo(MallGoodsInfoQO param, LoginSuccessDTO loginSuccessDTO);
ResultBody exchange(Integer firstId, Integer secondId);
ResultBody upOrDownShelf(Integer id, Integer status);
ResultBody removeMallGoods(Integer id);
ResultBody feignRemoveGoodsByBackUserAccountId(Integer id);
}
package com.mmc.pms.service.mall.impl;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.dao.mall.AppMallGoodsDao;
import com.mmc.pms.entity.mall.MallGoodsDO;
import com.mmc.pms.model.mall.MallGoodsVO;
import com.mmc.pms.service.mall.AppMallGoodsService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author LW
* @date 2023/7/26 14:55
* 概要:
*/
@Service
public class AppMallGoodsServiceImpl implements AppMallGoodsService {
@Resource
private AppMallGoodsDao appMallGoodsDao;
@Override
public ResultBody<MallGoodsVO> queryBrandGoods(Integer userAccountId) {
List<MallGoodsDO> mallGoodsList = appMallGoodsDao.queryGoodsInfo(userAccountId, null);
return checkGoodsInfo(mallGoodsList);
}
@Override
public ResultBody<MallGoodsVO> queryGoodsInfoByCategorySub(List<Integer> categorySubIds) {
List<MallGoodsDO> mallGoodsList = appMallGoodsDao.queryGoodsInfo(null, categorySubIds);
return checkGoodsInfo(mallGoodsList);
}
private ResultBody<MallGoodsVO> checkGoodsInfo(List<MallGoodsDO> mallGoodsList) {
if (CollectionUtils.isNotEmpty(mallGoodsList)) {
return ResultBody.success(mallGoodsList.stream().map(MallGoodsDO::buildListMallGoodsVO).collect(Collectors.toList()));
}
return ResultBody.success();
}
}
package com.mmc.pms.util;
/**
* @author 作者 geDuo
* @version 创建时间:2022年2月21日 下午3:55:10
* https://www.cnblogs.com/sgh1023/p/14094592.html
* @explain 雪花算法-分布式id
*/
public class SnowFlake {
/**
* 起始的时间戳
*/
private final static long START_STMP = 1480166465631L;
/**
* 每一部分占用的位数
*/
private final static long SEQUENCE_BIT = 12; // 序列号占用的位数
private final static long MACHINE_BIT = 5; // 机器标识占用的位数
private final static long DATACENTER_BIT = 5;// 数据中心占用的位数
/**
* 每一部分的最大值
*/
private final static long MAX_DATACENTER_NUM = -1L ^ (-1L << DATACENTER_BIT);
private final static long MAX_MACHINE_NUM = -1L ^ (-1L << MACHINE_BIT);
private final static long MAX_SEQUENCE = -1L ^ (-1L << SEQUENCE_BIT);
/**
* 每一部分向左的位移
*/
private final static long MACHINE_LEFT = SEQUENCE_BIT;
private final static long DATACENTER_LEFT = SEQUENCE_BIT + MACHINE_BIT;
private final static long TIMESTMP_LEFT = DATACENTER_LEFT + DATACENTER_BIT;
private long datacenterId; // 数据中心
private long machineId; // 机器标识
private long sequence = 0L; // 序列号
private long lastStmp = -1L;// 上一次时间戳
public SnowFlake(long datacenterId, long machineId) {
if (datacenterId > MAX_DATACENTER_NUM || datacenterId < 0) {
throw new IllegalArgumentException("datacenterId can't be greater than MAX_DATACENTER_NUM or less than 0");
}
if (machineId > MAX_MACHINE_NUM || machineId < 0) {
throw new IllegalArgumentException("machineId can't be greater than MAX_MACHINE_NUM or less than 0");
}
this.datacenterId = datacenterId;
this.machineId = machineId;
}
/**
* 产生下一个ID
*
* @return
*/
public synchronized long nextId() {
long currStmp = getNewstmp();
if (currStmp < lastStmp) {
throw new RuntimeException("Clock moved backwards. Refusing to generate id");
}
if (currStmp == lastStmp) {
// 相同毫秒内,序列号自增
sequence = (sequence + 1) & MAX_SEQUENCE;
// 同一毫秒的序列数已经达到最大
if (sequence == 0L) {
currStmp = getNextMill();
}
} else {
// 不同毫秒内,序列号置为0
sequence = 0L;
}
lastStmp = currStmp;
return (currStmp - START_STMP) << TIMESTMP_LEFT // 时间戳部分
| datacenterId << DATACENTER_LEFT // 数据中心部分
| machineId << MACHINE_LEFT // 机器标识部分
| sequence; // 序列号部分
}
private long getNextMill() {
long mill = getNewstmp();
while (mill <= lastStmp) {
mill = getNewstmp();
}
return mill;
}
private long getNewstmp() {
return System.currentTimeMillis();
}
public static void main(String[] args) {
SnowFlake snowFlake = new SnowFlake(2, 3);
for (int i = 0; i < (1 << 12); i++) {
System.out.println(snowFlake.nextId());
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mmc.pms.dao.category.CategoryDao">
<resultMap id="CategoryList" type="com.mmc.pms.entity.category.CategoryPrimaryDO">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="description" column="description"/>
<result property="icon" column="icon"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<collection property="subDOList" ofType="com.mmc.pms.entity.category.CategorySubDO"
select="selectSubList"
column="{categoryPrimaryId=id}">
</collection>
</resultMap>
<select id="selectSubList" resultType="com.mmc.pms.entity.category.CategorySubDO">
select id,
`name`,
description,
category_primary_id AS categoryPrimaryId,
create_time AS createTime,
update_time AS updateTime
from category_sub
where category_primary_id = #{categoryPrimaryId}
order by create_time desc
</select>
<select id="categoryListCount" resultType="int" parameterType="com.mmc.pms.model.category.qo.CategoryQO">
SELECT count(*)
FROM
category_primary
WHERE 1=1
<if test=" id != null and id != '' ">
and id=#{id}
</if>
</select>
<select id="getCountName" resultType="java.lang.Integer">
select count(*)
from category_primary
where 1=1
<if test=" name != null and name != '' ">
and `name` = #{name}
</if>
</select>
<update id="exchange" parameterType="com.mmc.pms.entity.ServiceDO">
update category_primary
<set>
<if test=" sort != null ">
sort = #{sort}
</if>
</set>
where id = #{id}
</update>
<insert id="addPrimaryCategory" useGeneratedKeys="true"
keyProperty="id" parameterType="com.mmc.pms.entity.category.CategoryPrimaryDO">
insert into category_primary(`name`, description, create_time, update_time, icon)
values (#{name}, #{description}, NOW(), NOW(), #{icon})
</insert>
<update id="updateSort">
update category_primary
<set>
<if test="id!=null">
sort = #{id}
</if>
</set>
where id=#{id}
</update>
<delete id="deletePrimaryCategory">
delete
from category_primary
where id = #{id}
</delete>
<select id="categoryCount" resultType="java.lang.Integer">
select count(*)
from category_primary
where 1=1
<if test=" name != null and name != '' ">
and `name` = #{name}
</if>
<if test=" id != null and id != '' ">
and id != #{id}
</if>
</select>
<update id="updatePrimaryCategory"
parameterType="com.mmc.pms.entity.category.CategoryPrimaryDO">
UPDATE category_primary
<set>
<if test=" name != null and name != '' ">
`name` = #{name},
</if>
<if test=" description != null and description != '' ">
description = #{description},
</if>
<if test=" icon != null and icon != '' ">
icon = #{icon},
</if>
update_time=NOW()
</set>
where id = #{id}
</update>
<select id="getCountSubName" resultType="java.lang.Integer">
select count(*)
from category_sub
where 1=1
<if test=" name != null and name != '' ">
and `name` = #{name}
</if>
<if test=" categoryPrimaryId != null and categoryPrimaryId != '' ">
and category_primary_id = #{categoryPrimaryId}
</if>
</select>
<insert id="addSubCategory" useGeneratedKeys="true"
keyProperty="id" parameterType="com.mmc.pms.entity.category.CategorySubDO">
insert into category_sub(id, `name`, description, create_time, update_time, category_primary_id)
values (#{id}, #{name}, #{description}, NOW(), NOW(), #{categoryPrimaryId})
</insert>
<select id="categorySubCount" resultType="java.lang.Integer">
select count(*)
from category_sub
where 1=1
<if test=" name != null and name != '' ">
and `name` = #{name}
</if>
<if test=" id != null and id != '' ">
and id != #{id}
</if>
<if test=" categoryPrimaryId != null and categoryPrimaryId != '' ">
and category_primary_id != #{categoryPrimaryId}
</if>
</select>
<update id="updateSubCategory"
parameterType="com.mmc.pms.entity.category.CategorySubDO">
UPDATE category_sub
<set>
<if test=" name != null and name != '' ">
`name` = #{name},
</if>
<if test=" description != null and description != '' ">
description = #{description},
</if>
update_time=NOW()
</set>
where id = #{id}
</update>
<delete id="deleteSubCategory">
delete
from category_sub
where id = #{id}
</delete>
<select id="detailSubCategory" resultType="com.mmc.pms.entity.category.CategorySubDO">
select id,
`name`,
description,
create_time AS createTime,
update_time AS updateTime,
category_primary_id AS categoryPrimaryId
from category_sub
where id = #{id}
</select>
<select id="categoryList" resultMap="CategoryList">
select id, `name`, description, create_time, update_time, icon,sort
from category_primary where 1=1
<if test=" id != null and id != '' ">
and id =#{id}
</if>
order by sort desc, update_time desc, create_time desc
limit #{pageNo},#{pageSize}
</select>
<select id="selectPrimaryList" resultType="com.mmc.pms.entity.category.CategoryPrimaryDO">
select id,
`name`,
description,
create_time,
icon,
sort
from category_primary
order by sort desc, update_time desc, create_time desc
</select>
<select id="selectCategorySubList" resultType="com.mmc.pms.entity.category.CategorySubDO">
select id,
`name`,
description,
create_time,
update_time,
category_primary_id
from category_sub
<where>
<foreach collection="list" separator="," item="item" open="category_primary_id in (" close=")">
#{item}
</foreach>
</where>
</select>
<select id="selectSubMallGoods" resultType="java.lang.Integer">
select count(*)
from mall_goods
where category_sub_id = #{id}
</select>
<select id="selectPrimary" resultType="java.lang.Integer">
select count(*)
from mall_goods
where category_primary_id = #{id}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mmc.pms.dao.mall.AppMallGoodsDao">
<select id="queryGoodsInfo" resultType="com.mmc.pms.entity.mall.MallGoodsDO">
SELECT mg.id,
mg.trade_name,
mg.shelf_status,
mg.create_time,
mg.description,
mg.category_primary_id,
mg.user_account_id,
mg.goods_label,
mg.label_show,
mg.category_sub_id,
mg.goods_label,
img.id as imgId, img.url,
img.type
FROM mall_goods mg
INNER JOIN mall_goods_resources img ON mg.id = img.mall_goods_id
AND img.type = 0
<where>
mg.is_deleted = 0 and mg.shelf_status = 1
<if test="userAccountId != null">
and mg.user_account_id = #{userAccountId}
</if>
<if test="categorySubIds != null">
<foreach collection="categorySubIds" item="item" open="and mg.category_sub_id in (" close=")"
separator=",">
#{item}
</foreach>
</if>
</where>
ORDER BY
mg.sort DESC,mg.create_time DESC
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mmc.pms.dao.mall.MallGoodsDao">
<insert id="insertMallGoodsBaseInfo" keyProperty="id"
useGeneratedKeys="true" parameterType="com.mmc.pms.entity.mall.MallGoodsDO">
insert into mall_goods(goods_no,
trade_name,
description,
category_primary_id,
category_sub_id,
shelf_status,
goods_label,
label_show,
goods_details,
user_account_id,
sort)
values ( #{goodsNo}, #{tradeName}, #{description}, #{categoryPrimaryId}, #{categorySubId}
, #{shelfStatus}, #{goodsLabel}, #{labelShow}, #{goodsDetails}, #{userAccountId}, #{sort})
</insert>
<insert id="insertGoodsSpec" parameterType="com.mmc.pms.entity.mall.GoodsSpecDO"
keyProperty="id" useGeneratedKeys="true">
insert into goods_spec (mall_goods_id,
spec_name,
choose_type,
must,
sku_unit_id)
values (#{mallGoodsId}, #{specName}, #{chooseType}, #{must}, #{skuUnitId})
</insert>
<insert id="batchInsertSpecValues" parameterType="list">
insert into goods_spec_values (goods_spec_id,
spec_value_name,
part_no,
spec_value_image,
show_price,
stock,
sale_price,
channel_price)
values
<foreach collection="list" item="item" separator=",">
(#{item.goodsSpecId},#{item.specValueName},#{item.partNo},#{item.specValueImage}
,#{item.showPrice},#{item.stock},#{item.salePrice},#{item.channelPrice})
</foreach>
</insert>
<insert id="batchInsertMallGoodsResources">
insert into mall_goods_resources (mall_goods_id,
url,
`type`
)
values
<foreach collection="list" item="item" separator=",">
(#{item.mallGoodsId},#{item.url},#{item.type})
</foreach>
</insert>
<update id="updateMallGoods">
UPDATE mall_goods
SET trade_name = #{mallGoodsDO.tradeName},
description = #{mallGoodsDO.description},
category_primary_id = #{mallGoodsDO.categoryPrimaryId},
category_sub_id = #{mallGoodsDO.categorySubId},
shelf_status = #{mallGoodsDO.shelfStatus},
goods_label = #{mallGoodsDO.goodsLabel},
label_show = #{mallGoodsDO.labelShow},
goods_details = #{mallGoodsDO.goodsDetails}
WHERE id = #{mallGoodsDO.id}
</update>
<update id="updateGoodsSpec">
update goods_spec
set spec_name = #{specName},
choose_type = #{chooseType},
must = #{must},
sku_unit_id = #{skuUnitId}
where id = #{id}
</update>
<update id="updateGoodsSpecValue">
update goods_spec_values
set goods_spec_id = #{goodsSpecId},
spec_value_name = #{specValueName},
part_no =#{partNo},
spec_value_image = #{specValueImage},
show_price = #{showPrice},
stock = #{stock},
sale_price = #{salePrice},
channel_price =#{channelPrice}
where id = #{id}
</update>
<update id="updateMallGoodsSort">
update mall_goods
set sort = #{sort}
where id = #{id}
</update>
<update id="updateMallGoodsByShelf">
update mall_goods
set shelf_status = #{status}
where id = #{id}
</update>
<update id="removeMallGoods">
update mall_goods
set is_deleted = 1
where id = #{id}
</update>
<update id="feignRemoveGoodsByBackUserAccountId">
update mall_goods
set is_deleted = 1
where user_account_id = #{id}
</update>
<delete id="deleteMallGoodsResources">
delete
from mall_goods_resources
where mall_goods_id = #{id}
</delete>
<delete id="deleteGoodsSpec">
delete
from goods_spec
<where>
<foreach collection="list" open="id in (" close=")" item="item" separator=",">
#{item}
</foreach>
</where>
</delete>
<delete id="deleteGoodsSpecValues">
delete
from goods_spec_values
<where>
<foreach collection="list" open="id in (" close=")" item="item" separator=",">
#{item}
</foreach>
</where>
</delete>
<select id="countMallGoodsByName" resultType="java.lang.Integer">
select count(*)
from mall_goods
where is_deleted = 0
and trade_name = #{mallGoodsVO.tradeName}
and user_account_id = #{userAccountId}
<if test="mallGoodsVO.id!=null">
and id <![CDATA[<>]]> #{mallGoodsVO.id}
</if>
</select>
<select id="countMallGoods" resultType="java.lang.Integer">
select count(*)
from mall_goods
where user_account_id = #{userAccountId}
</select>
<select id="getMallGoodsBaseInfo" resultType="com.mmc.pms.entity.mall.MallGoodsDO">
SELECT id,
goods_no,
trade_name,
description,
category_primary_id,
category_sub_id,
shelf_status,
goods_label,
label_show,
goods_details,
user_account_id,
sort
FROM mall_goods
WHERE id = #{id}
and is_deleted = 0
</select>
<select id="getMallGoodsResources" resultType="com.mmc.pms.entity.mall.MallGoodsResourcesDO">
SELECT id,
mall_goods_id,
url,
`type`
from mall_goods_resources
where mall_goods_id = #{id}
</select>
<select id="getMallGoodsSpec" resultType="com.mmc.pms.entity.mall.GoodsSpecDO">
select id,
mall_goods_id,
spec_name,
choose_type,
must,
sku_unit_id
from goods_spec
where mall_goods_id = #{id}
</select>
<select id="getMallGoodsSpecValues" resultType="com.mmc.pms.entity.mall.GoodsSpecValuesDO">
select id,
goods_spec_id,
spec_value_name,
part_no,
spec_value_image,
show_price,
stock,
sale_price,
channel_price
from goods_spec_values
<where>
<foreach collection="list" separator="," item="item" open="goods_spec_id in (" close=")">
#{item}
</foreach>
</where>
</select>
<select id="getSkuUnit" resultType="com.mmc.pms.entity.SkuUnitDO">
SELECT id,
unit_name unitName,
create_time createTime
FROM sku_unit
WHERE is_deleted = 0
</select>
<select id="countListMallGoods" resultType="java.lang.Integer">
SELECT
count(*)
FROM
mall_goods
<where>
is_deleted = 0
<if test="tradeName != null and tradeName !=''">
AND (trade_name LIKE CONCAT('%',#{tradeName},'%'))
</if>
<if test="categoryPrimaryId != null">
and category_primary_id = #{categoryPrimaryId}
</if>
<if test="userAccountId != null">
and user_account_id = #{userAccountId}
</if>
<if test="shelfStatus != null">
and shelf_status = #{shelfStatus}
</if>
</where>
</select>
<select id="listMallGoods" resultType="com.mmc.pms.entity.mall.MallGoodsDO">
SELECT
mg.id,
mg.trade_name,
mg.shelf_status,
mg.create_time,
mg.category_primary_id,
mg.category_sub_id,
mg.user_account_id,
mg.description,
img.id as imgId,
img.url,
img.type
FROM
mall_goods mg
INNER JOIN mall_goods_resources img ON mg.id = img.mall_goods_id
AND img.type = 0
<where>
mg.is_deleted = 0
<if test="tradeName != null and tradeName !=''">
AND (mg.trade_name LIKE CONCAT('%',#{tradeName},'%'))
</if>
<if test="categoryPrimaryId != null">
and mg.category_primary_id = #{categoryPrimaryId}
</if>
<if test="userAccountId != null">
and mg.user_account_id = #{userAccountId}
</if>
<if test="shelfStatus != null">
and mg.shelf_status = #{shelfStatus}
</if>
</where>
ORDER BY
mg.shelf_status DESC , mg.sort DESC,mg.create_time DESC
limit #{pageNo},#{pageSize}
</select>
</mapper>
...@@ -18,3 +18,8 @@ data-filter: ...@@ -18,3 +18,8 @@ data-filter:
- /pms/webDevice/getSecondDistrictInfo - /pms/webDevice/getSecondDistrictInfo
- /pms/webDevice/ad - /pms/webDevice/ad
- /pms/actuator/health/readiness - /pms/actuator/health/readiness
- /pms/app/goods/appMallGoodsDetails
- /pms/category/appCategoryInfo
- /pms/app/goods/queryBrandGoods
- /pms/app/goods/queryGoodsInfoByCategorySub
- /pms/mall/goods/feignRemoveGoodsByBackUserAccountId
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论