| | |
| | | @PreventRepeat |
| | | @ApiOperation("新建") |
| | | @PostMapping("/create") |
| | | @RequiresPermissions("business:basecategory:create") |
| | | // @RequiresPermissions("business:basecategory:create") |
| | | public ApiResponse create(@RequestBody BaseCategoryRequest baseCategory) { |
| | | return ApiResponse.success(baseCategoryService.create(baseCategory)); |
| | | } |
| | |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("根据ID修改") |
| | | @ApiOperation(value = "根据ID修改-列表属性修改") |
| | | @PostMapping("/updateById") |
| | | @RequiresPermissions("business:basecategory:update") |
| | | // @RequiresPermissions("business:basecategory:update") |
| | | public ApiResponse updateById(@RequestBody BaseCategory baseCategory) { |
| | | baseCategoryService.updateById(baseCategory); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | /** |
| | | * 主键更新 |
| | | * |
| | | * @param baseCategory 实体对象 |
| | | */ |
| | | @ApiOperation("根据ID修改-编辑修改") |
| | | @PostMapping("/update") |
| | | // @RequiresPermissions("business:basecategory:update") |
| | | public ApiResponse update(@RequestBody BaseCategoryRequest baseCategory){ |
| | | baseCategoryService.update(baseCategory); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("分页查询") |
| | | @PostMapping("/page") |
| | | @RequiresPermissions("business:basecategory:query") |
| | | // @RequiresPermissions("business:basecategory:query") |
| | | public ApiResponse<PageData<BaseCategory>> findPage (@RequestBody PageWrap<BaseCategory> pageWrap) { |
| | | return ApiResponse.success(baseCategoryService.findPage(pageWrap)); |
| | | } |
| | |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.dao.business.model.BaseGoods; |
| | | import com.doumee.dao.business.model.dto.BaseGoodsCreateOrUpdateRequest; |
| | | import com.doumee.dao.business.model.dto.BaseGoodsDTO; |
| | | import com.doumee.service.business.BaseGoodsService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | @PreventRepeat |
| | | @ApiOperation("新建") |
| | | @PostMapping("/create") |
| | | @RequiresPermissions("business:basegoods:create") |
| | | // @RequiresPermissions("business:basegoods:create") |
| | | public ApiResponse create(@RequestBody BaseGoodsCreateOrUpdateRequest baseGoods) { |
| | | return ApiResponse.success(baseGoodsService.create(baseGoods)); |
| | | } |
| | |
| | | |
| | | @ApiOperation("根据ID查询") |
| | | @GetMapping("/{id}") |
| | | @RequiresPermissions("business:basegoods:query") |
| | | // @RequiresPermissions("business:basegoods:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(baseGoodsService.findById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 主键上下架 |
| | | * |
| | | * @param idList 实体对象 |
| | | */ |
| | | @ApiOperation("根据ID查询") |
| | | @PostMapping("/{status") |
| | | @RequiresPermissions("business:basegoods:query") |
| | | public ApiResponse updateStatusByIds(@RequestBody List<Integer> idList, @PathVariable Integer status){ |
| | | baseGoodsService.updateStatusByIds(idList,status); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 主键上下架 |
| | | * |
| | | * @param id 实体对象 |
| | | */ |
| | | @ApiOperation("根据ID查询") |
| | | @GetMapping("/updateStatusById") |
| | | @RequiresPermissions("business:basegoods:query") |
| | | public ApiResponse updateStatusById(@RequestParam Integer id,@RequestParam Integer status){ |
| | | baseGoodsService.updateStatusById(id,status); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | /** |
| | | * 主键查询 |
| | | * |
| | | * @param id 主键 |
| | | * @return BaseGoods |
| | | */ |
| | | @ApiOperation("根据ID查询平台商品详细信息") |
| | | @GetMapping("/findByIdBaseGoods") |
| | | // @RequiresPermissions("business:basegoods:query") |
| | | public ApiResponse<BaseGoodsDTO> findByIdBaseGoods(@RequestParam Integer id){ |
| | | BaseGoodsDTO byIdBaseGoods = baseGoodsService.findByIdBaseGoods(id); |
| | | return ApiResponse.success(byIdBaseGoods); |
| | | } |
| | | |
| | | /** |
| | | * 主键更新 |
| | | * |
| | | * @param baseGoods 实体对象 |
| | | */ |
| | | @ApiOperation("根据ID修改-编辑修改") |
| | | @PostMapping("/update") |
| | | // @RequiresPermissions("business:basegoods:update") |
| | | public ApiResponse update(@RequestBody BaseGoodsCreateOrUpdateRequest baseGoods){ |
| | | baseGoodsService.update(baseGoods); |
| | | return ApiResponse.success(null); |
| | | } |
| | | } |
| | |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(companyService.findById(id)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param pageWrap 分页对象 |
| | | * @return PageData<Company> |
| | | */ |
| | | @ApiOperation("平台查询企业信息-分页查询") |
| | | @PostMapping("/findPlatformPage") |
| | | @RequiresPermissions("company:company:query") |
| | | public ApiResponse<PageData<Company>> findPlatformPage(@RequestBody PageWrap<Company> pageWrap){ |
| | | return ApiResponse.success(companyService.findPlatformPage(pageWrap)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 主键查询 |
| | | * |
| | | * @param companyId 主键 |
| | | * @return Company |
| | | */ |
| | | @ApiOperation("根据企业企业id 查询企业用户") |
| | | @PostMapping("/findPlatformById") |
| | | @RequiresPermissions("company:company:query") |
| | | public ApiResponse<Company> findPlatformById(@RequestParam Integer companyId){ |
| | | return ApiResponse.success(companyService.findPlatformById(companyId)); |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "所属品牌编码(base_brand)", example = "1") |
| | | @ExcelColumn(name="所属品牌name") |
| | | @TableField(exist = false) |
| | | private Integer brandName; |
| | | private String brandName; |
| | | |
| | | @ApiModelProperty(value = "指导价(元)", example = "1") |
| | | @ExcelColumn(name="指导价(元)") |
| | |
| | | |
| | | @ApiModelProperty(value = "分类加价系数", example = "1") |
| | | @ExcelColumn(name="分类加价系数") |
| | | @TableField(exist = false) |
| | | private BigDecimal cateRatePrice; |
| | | |
| | | |
| | |
| | | public class Multifile { |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | | @ApiModelProperty(value = "主键", example = "1") |
| | | @ApiModelProperty(value = "主键") |
| | | @ExcelColumn(name="主键") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "创建人编码", example = "1") |
| | | @ApiModelProperty(value = "创建人编码") |
| | | @ExcelColumn(name="创建人编码") |
| | | private Integer creator; |
| | | |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createDate; |
| | | |
| | | @ApiModelProperty(value = "更新人编码", example = "1") |
| | | @ApiModelProperty(value = "更新人编码") |
| | | @ExcelColumn(name="更新人编码") |
| | | private Integer editor; |
| | | |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date editDate; |
| | | |
| | | @ApiModelProperty(value = "是否删除0否 1是", example = "1") |
| | | @ApiModelProperty(value = "是否删除0否 1是") |
| | | @ExcelColumn(name="是否删除0否 1是") |
| | | private Integer isdeleted; |
| | | |
| | |
| | | @ExcelColumn(name="备注") |
| | | private String info; |
| | | |
| | | @ApiModelProperty(value = "关联对象编码", example = "1") |
| | | @ApiModelProperty(value = "关联对象编码") |
| | | @ExcelColumn(name="关联对象编码") |
| | | private Integer objId; |
| | | |
| | | @ApiModelProperty(value = "类型0图片 1视频 2其他", example = "1") |
| | | @ApiModelProperty(value = "类型0图片 1视频 2其他") |
| | | @ExcelColumn(name="类型0图片 1视频 2其他") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "关联对象类型 0商品多图", example = "1") |
| | | @ApiModelProperty(value = "关联对象类型 0商品多图") |
| | | @ExcelColumn(name="关联对象类型 0商品多图 1 平台商品多图") |
| | | private Integer objType; |
| | | |
| | |
| | | @ApiModelProperty(value = "企业编码") |
| | | @ExcelColumn(name="企业编码") |
| | | private Integer companyId; |
| | | @ApiModelProperty(value = "排序码", example = "1") |
| | | |
| | | @ApiModelProperty(value = "排序码") |
| | | @ExcelColumn(name="排序码") |
| | | private Integer sortnum; |
| | | |
| | |
| | | @ApiModelProperty(value = "属性2名称") |
| | | private String attrSecond; |
| | | |
| | | @ApiModelProperty(value = "状态 0启用 1禁用", example = "1") |
| | | @ApiModelProperty(value = "状态 0启用 1禁用") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "排序码", example = "1") |
| | | @ApiModelProperty(value = "排序码") |
| | | private Integer sortnum; |
| | | |
| | | @ApiModelProperty(value = "图标") |
| | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "状态 0启用 1禁用", example = "1") |
| | | @ApiModelProperty(value = "状态 0启用 1禁用") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "排序码", example = "1") |
| | | @ApiModelProperty(value = "排序码") |
| | | private Integer sortnum; |
| | | |
| | | @ApiModelProperty(value = "所属品类编码(关联category表)", example = "1") |
| | | @ApiModelProperty(value = "所属品类编码(关联category表)") |
| | | private Integer categoryId; |
| | | |
| | | } |
| | |
| | | package com.doumee.dao.business.model.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import com.doumee.dao.business.model.Multifile; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | @ApiModelProperty(value = "名称(不可重复)") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "状态 0启用 1禁用", example = "1") |
| | | @ApiModelProperty(value = "状态 0启用 1禁用") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "图标") |
| | | private String imgurl; |
| | | |
| | | @ApiModelProperty(value = "所属品类编码(base_category)", example = "1") |
| | | @ApiModelProperty(value = "所属品类编码(base_category)") |
| | | private Integer categoryId; |
| | | |
| | | @ApiModelProperty(value = "所属品牌编码(base_brand)", example = "1") |
| | | @ApiModelProperty(value = "所属品牌编码(base_brand)") |
| | | private Integer brandId; |
| | | |
| | | @ApiModelProperty(value = "指导价(元)", example = "1") |
| | | @ApiModelProperty(value = "指导价(元)") |
| | | private BigDecimal zdPrice; |
| | | |
| | | @ApiModelProperty(value = "入手价格(元)", example = "1") |
| | | @ApiModelProperty(value = "入手价格(元)") |
| | | private BigDecimal price; |
| | | |
| | | @ApiModelProperty(value = "商品详情") |
| | |
| | | @ApiModelProperty(value = "名称(不可重复)") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "状态 0启用 1禁用", example = "1") |
| | | @ApiModelProperty(value = "状态 0启用 1禁用") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "图标") |
| | |
| | | @ApiModelProperty(value = "图标") |
| | | private String imgfullurl; |
| | | |
| | | @ApiModelProperty(value = "所属品类编码(base_category)", example = "1") |
| | | @ApiModelProperty(value = "所属品类编码(base_category)") |
| | | private Integer categoryId; |
| | | |
| | | @ApiModelProperty(value = "所属品类编码(base_category)", example = "1") |
| | | @ApiModelProperty(value = "所属品类编码(base_category)") |
| | | private Integer categoryName; |
| | | |
| | | @ApiModelProperty(value = "所属品牌编码(base_brand)", example = "1") |
| | | @ApiModelProperty(value = "所属品牌编码(base_brand)") |
| | | private Integer brandId; |
| | | |
| | | @ApiModelProperty(value = "所属品牌编码(base_brand)", example = "1") |
| | | private Integer brandName; |
| | | @ApiModelProperty(value = "所属品牌编码(base_brand)") |
| | | private String brandName; |
| | | |
| | | @ApiModelProperty(value = "指导价(元)", example = "1") |
| | | @ApiModelProperty(value = "指导价(元)") |
| | | private BigDecimal zdPrice; |
| | | |
| | | @ApiModelProperty(value = "入手价格(元)", example = "1") |
| | | @ApiModelProperty(value = "入手价格(元)") |
| | | private BigDecimal price; |
| | | |
| | | @ApiModelProperty(value = "商品详情") |
| | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "状态 0启用 1禁用", example = "1") |
| | | @ApiModelProperty(value = "状态 0启用 1禁用") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "排序码", example = "1") |
| | | @ApiModelProperty(value = "排序码") |
| | | private Integer sortnum; |
| | | |
| | | @ApiModelProperty(value = "关联品类参数编码(关联base_cate_param表)", example = "1") |
| | | @ApiModelProperty(value = "关联品类参数编码(关联base_cate_param表)") |
| | | private Integer pramaId; |
| | | |
| | | @ApiModelProperty(value = "参数值") |
| | | private String val; |
| | | |
| | | @ApiModelProperty(value = "商品编码(关联base_goods表)", example = "1") |
| | | @ApiModelProperty(value = "商品编码(关联base_goods表)") |
| | | private Integer goodsId; |
| | | } |
| | |
| | | * |
| | | * @param baseCategory 实体对象 |
| | | */ |
| | | void updateById(BaseCategoryRequest baseCategory); |
| | | void update(BaseCategoryRequest baseCategory); |
| | | |
| | | /** |
| | | * 主键更新 |
| | |
| | | * |
| | | * @param id 实体对象 |
| | | */ |
| | | void updateStatusByIds(Integer id,Integer status); |
| | | void updateStatusById(Integer id,Integer status); |
| | | |
| | | /** |
| | | * 主键更新 |
| | |
| | | baseCategory2.setShortPinyin(baseCategory.getShortPinyin()); |
| | | baseCategoryMapper.insert(baseCategory2); |
| | | |
| | | if (CollectionUtils.isEmpty(baseCategory.getBaseCategoryRequestParamList())){ |
| | | if (!CollectionUtils.isEmpty(baseCategory.getBaseCategoryRequestParamList())){ |
| | | |
| | | long count = baseCategory.getBaseCategoryRequestParamList().stream().map(s -> s.getName().trim()).distinct().count(); |
| | | |
| | |
| | | |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | @Override |
| | | public void updateById(BaseCategoryRequest baseCategory) { |
| | | public void update(BaseCategoryRequest baseCategory) { |
| | | |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo)SecurityUtils.getSubject().getPrincipal(); |
| | | |
| | | if (Objects.nonNull(baseCategory.getId())){ |
| | | if (Objects.isNull(baseCategory.getId())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"品类主键缺失"); |
| | | } |
| | | |
| | |
| | | .set(BaseCategory::getName,baseCategory.getName()) |
| | | .set(BaseCategory::getImgurl,baseCategory.getImgurl()) |
| | | .set(BaseCategory::getSortnum,baseCategory.getSortnum()); |
| | | baseCategoryMapper.update(null,wrapper); |
| | | baseCategoryMapper.update(null,updateWrapper); |
| | | |
| | | if (CollectionUtils.isEmpty(baseCategory.getBaseCategoryRequestParamList())){ |
| | | if (!CollectionUtils.isEmpty(baseCategory.getBaseCategoryRequestParamList())){ |
| | | |
| | | long count = baseCategory.getBaseCategoryRequestParamList().stream().map(s -> s.getName().trim()).distinct().count(); |
| | | if (baseCategory.getBaseCategoryRequestParamList().size() != count){ |
| | |
| | | |
| | | IPage<BaseCategory> baseCategoryIPage = baseCategoryMapper.selectPage(page, queryWrapper); |
| | | if (!CollectionUtils.isEmpty(baseCategoryIPage.getRecords())){ |
| | | baseCategoryIPage.getRecords().forEach(s->s.setImgfullurl(getPreUrl()+s.getImgfullurl())); |
| | | baseCategoryIPage.getRecords().forEach(s->s.setImgfullurl(getPreUrl()+s.getImgurl())); |
| | | } |
| | | |
| | | return PageData.from(baseCategoryIPage); |
| | |
| | | wrapper.lambda() |
| | | .eq(BaseGoods::getId,baseGoods.getId()) |
| | | .set(BaseGoods::getName,baseGoods.getName()) |
| | | .set(BaseGoods::getName,baseGoods.getName()) |
| | | .set(BaseGoods::getName,baseGoods.getName()) |
| | | .set(BaseGoods::getName,baseGoods.getName()); |
| | | .set(BaseGoods::getBrandId,baseGoods.getBrandId()) |
| | | .set(BaseGoods::getCategoryId,baseGoods.getCategoryId()) |
| | | .set(BaseGoods::getImgurl,baseGoods.getImgurl()) |
| | | .set(BaseGoods::getPrice,baseGoods.getPrice()) |
| | | .set(BaseGoods::getZdPrice,baseGoods.getZdPrice()); |
| | | baseGoodsMapper.update(null,wrapper); |
| | | |
| | | multifileMapper.delete(new QueryWrapper<Multifile>().eq("OBJ_ID",baseGoods.getId())); |
| | | multifileMapper.delete(new QueryWrapper<Multifile>().eq("OBJ_ID",baseGoods.getId()) |
| | | .eq("OBJ_TYPE",Constants.ONE)); |
| | | List<Multifile> multifileList = baseGoods.getMultifileList(); |
| | | if(!Objects.isNull(multifileList)&&multifileList.size()>Constants.ZERO){ |
| | | for (int i = 0; i < multifileList.size(); i++) { |
| | |
| | | if (CollectionUtils.isEmpty(idList)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"商品状态不能为空"); |
| | | } |
| | | idList.forEach(s->updateStatusByIds(s,status)); |
| | | idList.forEach(s->updateStatusById(s,status)); |
| | | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | @Override |
| | | public void updateStatusByIds(Integer id, Integer status) { |
| | | public void updateStatusById(Integer id, Integer status) { |
| | | |
| | | if (Objects.isNull(status)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"商品状态不能为空"); |
| | |
| | | .leftJoin(BaseCategory.class,BaseCategory::getId,BaseGoods::getBaseDataId) |
| | | .selectAll(BaseGoods.class) |
| | | .selectAs(Brand::getName,BaseGoodsDTO::getBrandName) |
| | | .selectAs(BaseCategory::getSortnum,BaseGoodsDTO::getCategoryName); |
| | | .selectAs(BaseCategory::getSortnum,BaseGoodsDTO::getCategoryName) |
| | | .eq(BaseGoods::getId,id); |
| | | |
| | | BaseGoodsDTO baseGoodsDTO = baseGoodsJoinMapper.selectJoinOne(BaseGoodsDTO.class, queryWrapper); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FILE_DIR).getCode() |
| | |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(brandMapper.selectCount(new QueryWrapper<Brand>() |
| | | .eq("ISDELETED",Constants.ZERO) |
| | | .eq(user.getType().equals(Constants.UserType.SYSTEM),"name",brand.getName()) |
| | | .and(user.getType().equals(Constants.UserType.COMPANY), |
| | | .eq(user.getType().equals(Constants.UserType.SYSTEM.getKey()),"name",brand.getName()) |
| | | .and(user.getType().equals(Constants.UserType.COMPANY.getKey()), |
| | | i->i.apply(" name = '"+brand.getName()+"' and type = 1 ") |
| | | .or().apply( " name = '"+brand.getName()+"' and COMPANY_ID = '"+user.getCompanyId()+"' and type = 0 ") |
| | | ) |
| | |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(brandMapper.selectCount(new QueryWrapper<Brand>() |
| | | .eq("ISDELETED",Constants.ZERO) |
| | | .eq(user.getType().equals(Constants.UserType.SYSTEM),"name",brand.getName()) |
| | | .and(user.getType().equals(Constants.UserType.COMPANY), |
| | | .eq(user.getType().equals(Constants.UserType.SYSTEM.getKey()),"name",brand.getName()) |
| | | .and(user.getType().equals(Constants.UserType.COMPANY.getKey()), |
| | | i->i.apply(" name = '"+brand.getName()+"' and type = 1 ") |
| | | .or().apply( " name = '"+brand.getName()+"' and COMPANY_ID = '"+user.getCompanyId()+"' and type = 0 ") |
| | | ) |