feat:智慧超市接口
This commit is contained in:
1 parent
6170c52550
commit
7e0a1f96f3
9 files changed
+239
-11
No files matched your search
+16
-5
@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuCategoryDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuCategoryEntity;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuCategoryService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -42,6 +44,14 @@ public class HardSpuCategoryController {
|
||||
return R.ok(hardSpuCategoryService.page(page, wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuCategory_view')")
|
||||
public R pageJoin(@ParameterObject Page page, @ParameterObject HardSpuCategoryDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(hardSpuCategoryService.scopPageJoin(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuCategory_view')")
|
||||
@@ -53,16 +63,16 @@ public class HardSpuCategoryController {
|
||||
@SysLog("新增硬件商品分类")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuCategory_add')")
|
||||
public R save(@RequestBody HardSpuCategoryEntity hardSpuCategory) {
|
||||
return R.ok(hardSpuCategoryService.save(hardSpuCategory));
|
||||
public R save(@RequestBody HardSpuCategoryEntity entity) {
|
||||
return R.ok(hardSpuCategoryService.create(entity));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改硬件商品分类", description = "修改硬件商品分类")
|
||||
@SysLog("修改硬件商品分类")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuCategory_edit')")
|
||||
public R updateById(@RequestBody HardSpuCategoryEntity hardSpuCategory) {
|
||||
return R.ok(hardSpuCategoryService.updateById(hardSpuCategory));
|
||||
public R updateById(@RequestBody HardSpuCategoryEntity entity) {
|
||||
return R.ok(hardSpuCategoryService.edit(entity));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除硬件商品分类", description = "通过id删除硬件商品分类")
|
||||
@@ -70,7 +80,8 @@ public class HardSpuCategoryController {
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuCategory_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(hardSpuCategoryService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
hardSpuCategoryService.delByIds(CollUtil.toList(ids));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
|
||||
+14
-3
@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -42,6 +44,14 @@ public class HardSpuController {
|
||||
return R.ok(hardSpuService.page(page, wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpu_view')")
|
||||
public R pageJoin(@ParameterObject Page page, @ParameterObject HardSpuDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(hardSpuService.scopPageJoin(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpu_view')")
|
||||
@@ -54,7 +64,7 @@ public class HardSpuController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpu_add')")
|
||||
public R save(@RequestBody HardSpuEntity hardSpu) {
|
||||
return R.ok(hardSpuService.save(hardSpu));
|
||||
return R.ok(hardSpuService.create(hardSpu));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改硬件商品", description = "修改硬件商品")
|
||||
@@ -62,7 +72,7 @@ public class HardSpuController {
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpu_edit')")
|
||||
public R updateById(@RequestBody HardSpuEntity hardSpu) {
|
||||
return R.ok(hardSpuService.updateById(hardSpu));
|
||||
return R.ok(hardSpuService.edit(hardSpu));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除硬件商品", description = "通过id删除硬件商品")
|
||||
@@ -70,7 +80,8 @@ public class HardSpuController {
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpu_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(hardSpuService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
hardSpuService.delByIds(CollUtil.toList(ids));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
|
||||
+15
@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuRepertoryDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuRepertoryEntity;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuRepertoryService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -34,6 +36,11 @@ public class HardSpuRepertoryController {
|
||||
|
||||
private final HardSpuRepertoryService hardSpuRepertoryService;
|
||||
|
||||
/* ************************************* start app start ************************************* */
|
||||
|
||||
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuRepertory_view')")
|
||||
@@ -42,6 +49,14 @@ public class HardSpuRepertoryController {
|
||||
return R.ok(hardSpuRepertoryService.page(page, wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页复杂查询", description = "分页复杂查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuRepertory_view')")
|
||||
public R pageJoin(@ParameterObject Page page, @ParameterObject HardSpuRepertoryDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(hardSpuRepertoryService.scopePageJoin(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuRepertory_view')")
|
||||
|
||||
+25
@@ -1,8 +1,33 @@
|
||||
package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuCategoryDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuCategoryEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuCategoryVo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface HardSpuCategoryService extends IService<HardSpuCategoryEntity> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
Page<HardSpuCategoryVo> scopPageJoin(Page page, HardSpuCategoryDto dto, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
Long create(HardSpuCategoryEntity entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
Long edit(HardSpuCategoryEntity entity);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
void delByIds(ArrayList<Long> list);
|
||||
}
|
||||
+6
@@ -1,8 +1,14 @@
|
||||
package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuRepertoryDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuRepertoryEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuRepertoryVo;
|
||||
|
||||
public interface HardSpuRepertoryService extends IService<HardSpuRepertoryEntity> {
|
||||
|
||||
Page<HardSpuRepertoryVo> scopePageJoin(Page page, HardSpuRepertoryDto dto, DataScope dataScope);
|
||||
|
||||
}
|
||||
+26
@@ -1,8 +1,34 @@
|
||||
package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuVo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface HardSpuService extends IService<HardSpuEntity> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
Page<HardSpuVo> scopPageJoin(Page page, HardSpuDto dto, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
Long create(HardSpuEntity entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
Long edit(HardSpuEntity entity);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
void delByIds(ArrayList<Long> list);
|
||||
|
||||
}
|
||||
+66
@@ -1,14 +1,80 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.spu;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuCategoryDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuCategoryEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuCategoryVo;
|
||||
import com.bsd.pjcloud.hard.mapper.spu.HardSpuCategoryMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuCategoryService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 硬件商品分类
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HardSpuCategoryServiceImpl extends ServiceImpl<HardSpuCategoryMapper, HardSpuCategoryEntity> implements HardSpuCategoryService {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@Override
|
||||
public Page<HardSpuCategoryVo> scopPageJoin(Page page, HardSpuCategoryDto dto, DataScope dataScope) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@Override
|
||||
public Long create(HardSpuCategoryEntity entity) {
|
||||
|
||||
|
||||
baseMapper.insert(entity);
|
||||
return entity.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
@Override
|
||||
public Long edit(HardSpuCategoryEntity entity) {
|
||||
|
||||
baseMapper.updateById(entity);
|
||||
return entity.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Override
|
||||
public void delByIds(ArrayList<Long> list) {
|
||||
|
||||
baseMapper.deleteByIds(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类名是否重复
|
||||
*/
|
||||
private boolean existName(HardSpuCategoryEntity dto) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<HardSpuCategoryEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getName()), HardSpuCategoryEntity::getName, dto.getName())
|
||||
.ne(ObjectUtil.isNotEmpty(dto.getId()), HardSpuCategoryEntity::getId, dto.getId())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(dto.getId())) {
|
||||
return count >= 1;
|
||||
}
|
||||
return count > 0;
|
||||
}
|
||||
}
|
||||
+15
-3
@@ -1,17 +1,29 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.spu;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuRepertoryDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuRepertoryEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuRepertoryVo;
|
||||
import com.bsd.pjcloud.hard.mapper.spu.HardSpuRepertoryMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuRepertoryService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* 硬件商品库存更新记录
|
||||
*
|
||||
* @author dzc
|
||||
* @date 2025-04-02 18:59:41
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HardSpuRepertoryServiceImpl extends ServiceImpl<HardSpuRepertoryMapper, HardSpuRepertoryEntity> implements HardSpuRepertoryService {
|
||||
|
||||
@Override
|
||||
public Page<HardSpuRepertoryVo> scopePageJoin(Page page, HardSpuRepertoryDto dto, DataScope dataScope) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+56
@@ -1,15 +1,71 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.spu;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuVo;
|
||||
import com.bsd.pjcloud.hard.mapper.spu.HardSpuMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 硬件商品
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HardSpuServiceImpl extends ServiceImpl<HardSpuMapper, HardSpuEntity> implements HardSpuService {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@Override
|
||||
public Page<HardSpuVo> scopPageJoin(Page page, HardSpuDto dto, DataScope dataScope) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long create(HardSpuEntity entity) {
|
||||
|
||||
baseMapper.insert(entity);
|
||||
return entity.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long edit(HardSpuEntity entity) {
|
||||
|
||||
baseMapper.updateById(entity);
|
||||
return entity.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delByIds(ArrayList<Long> list) {
|
||||
|
||||
baseMapper.deleteByIds(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品是否重复
|
||||
*/
|
||||
private boolean existName(HardSpuEntity dto) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<HardSpuEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getName()), HardSpuEntity::getName, dto.getName())
|
||||
.ne(ObjectUtil.isNotEmpty(dto.getId()), HardSpuEntity::getId, dto.getId())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(dto.getId())) {
|
||||
return count >= 1;
|
||||
}
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user