图库需求
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.account.dto.PictureGalleryDTO;
|
||||
import com.czg.account.param.PictureGalleryParam;
|
||||
import com.czg.account.service.PictureGalleryService;
|
||||
import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.resp.CzgResult;
|
||||
@@ -42,8 +43,8 @@ public class PictureGalleryController {
|
||||
@PostMapping
|
||||
@OperationLog("图库-添加图片")
|
||||
//@SaAdminCheckPermission("pictureGallery:add")
|
||||
public CzgResult<Void> addPictureGallery(@RequestBody @Validated({InsertGroup.class, DefaultGroup.class}) PictureGalleryDTO dto) {
|
||||
pictureGalleryService.addPictureGallery(dto);
|
||||
public CzgResult<Void> addPictureGallery(@RequestBody @Validated({InsertGroup.class, DefaultGroup.class}) PictureGalleryParam param) {
|
||||
pictureGalleryService.addPictureGallery(param);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@ import java.util.List;
|
||||
public class ProdGroupController {
|
||||
private final ProdGroupService prodGroupService;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@GetMapping("page")
|
||||
@OperationLog("商品分组-分页")
|
||||
//@SaAdminCheckPermission("prodGroup:page")
|
||||
@@ -36,6 +39,9 @@ public class ProdGroupController {
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@GetMapping("list")
|
||||
@OperationLog("商品分组-列表")
|
||||
//@SaAdminCheckPermission("prodGroup:list")
|
||||
@@ -44,6 +50,11 @@ public class ProdGroupController {
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param id 分组id
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
@OperationLog("商品分组-详情")
|
||||
//@SaAdminCheckPermission("prodGroup:info")
|
||||
@@ -53,6 +64,9 @@ public class ProdGroupController {
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping
|
||||
@OperationLog("商品分组-新增")
|
||||
//@SaAdminCheckPermission("prodGroup:add")
|
||||
@@ -61,6 +75,9 @@ public class ProdGroupController {
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping
|
||||
@OperationLog("商品分组-修改")
|
||||
//@SaAdminCheckPermission("prodGroup:update")
|
||||
@@ -69,6 +86,9 @@ public class ProdGroupController {
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@DeleteMapping("{id}")
|
||||
@OperationLog("商品分组-删除")
|
||||
//@SaAdminCheckPermission("prodGroup:delete")
|
||||
@@ -79,6 +99,9 @@ public class ProdGroupController {
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁用
|
||||
*/
|
||||
@PostMapping("disable/{id}")
|
||||
@OperationLog("商品分组-禁用")
|
||||
//@SaAdminCheckPermission("prodGroup:able")
|
||||
@@ -89,6 +112,9 @@ public class ProdGroupController {
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用
|
||||
*/
|
||||
@PostMapping("enable/{id}")
|
||||
@OperationLog("商品分组-启用")
|
||||
//@SaAdminCheckPermission("prodGroup:able")
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.czg.account.service;
|
||||
|
||||
import com.czg.account.dto.PictureGalleryDTO;
|
||||
import com.czg.account.entity.PictureGallery;
|
||||
import com.czg.account.param.PictureGalleryParam;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
@@ -23,9 +24,9 @@ public interface PictureGalleryService extends IService<PictureGallery> {
|
||||
/**
|
||||
* 添加图库图片
|
||||
*
|
||||
* @param dto 图片数据
|
||||
* @param param 图片数据
|
||||
*/
|
||||
void addPictureGallery(PictureGalleryDTO dto);
|
||||
void addPictureGallery(PictureGalleryParam param);
|
||||
|
||||
/**
|
||||
* 删除图库图片
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.dto.PictureGalleryDTO;
|
||||
import com.czg.account.entity.PictureGallery;
|
||||
import com.czg.account.param.PictureGalleryParam;
|
||||
import com.czg.account.service.PictureGalleryService;
|
||||
import com.czg.enums.DeleteEnum;
|
||||
import com.czg.sa.StpKit;
|
||||
@@ -47,11 +47,15 @@ public class PictureGalleryServiceImpl extends ServiceImpl<PictureGalleryMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPictureGallery(PictureGalleryDTO dto) {
|
||||
public void addPictureGallery(PictureGalleryParam param) {
|
||||
Long shopId = StpKit.USER.getLoginIdAsLong();
|
||||
PictureGallery entity = BeanUtil.copyProperties(dto, PictureGallery.class);
|
||||
entity.setShopId(shopId);
|
||||
super.save(entity);
|
||||
for (String url : param.getUrls()) {
|
||||
PictureGallery entity = new PictureGallery();
|
||||
entity.setShopId(shopId);
|
||||
entity.setPictureClassifyId(param.getPictureClassifyId());
|
||||
entity.setUrl(url);
|
||||
super.save(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user