店铺区域接口
This commit is contained in:
parent
d8791107a6
commit
3520a4cc07
|
|
@ -1,11 +1,19 @@
|
|||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.account.entity.ShopTableArea;
|
||||
import com.czg.account.service.ShopTableAreaService;
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 区域管理
|
||||
* @author Administrator
|
||||
|
|
@ -13,10 +21,28 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@RestController
|
||||
@RequestMapping("/shopArea")
|
||||
public class ShopTableAreaController {
|
||||
@Resource
|
||||
private ShopTableAreaService shopTableAreaService;
|
||||
|
||||
// @SaAdminCheckPermission("shopArea:list")
|
||||
// @GetMapping
|
||||
// public CzgResult<?> list() {
|
||||
//
|
||||
// }
|
||||
/**
|
||||
* 区域添加
|
||||
* @param name 区域名称
|
||||
* @return 是否成功
|
||||
*/
|
||||
@SaAdminCheckPermission("shopArea:list")
|
||||
@GetMapping
|
||||
public CzgResult<Page<ShopTableArea>> list(String name) {
|
||||
return CzgResult.success(shopTableAreaService.pageInfo(StpKit.USER.getShopId(), name));
|
||||
}
|
||||
|
||||
/**
|
||||
* 区域修改
|
||||
* @param name 区域名称
|
||||
* @return 是否成功
|
||||
*/
|
||||
@SaAdminCheckPermission("shopArea:edit")
|
||||
@PutMapping
|
||||
public CzgResult<Page<ShopTableArea>> edit(String name) {
|
||||
return CzgResult.success(shopTableAreaService.pageInfo(StpKit.USER.getShopId(), name));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
|
||||
package com.czg.account.dto;
|
||||
package com.czg.account.dto.area;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
|
@ -18,14 +20,12 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ShopAreaDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
public class ShopAreaEditDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@NotNull
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
|
|
@ -43,8 +43,5 @@ public class ShopAreaDTO implements Serializable {
|
|||
*/
|
||||
private String name;
|
||||
|
||||
private Long createdAt;
|
||||
|
||||
private Long updatedAt;
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
package com.czg.account.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
|
@ -49,8 +51,10 @@ public class ShopTableArea implements Serializable {
|
|||
*/
|
||||
private String name;
|
||||
|
||||
private Long createdAt;
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
private Long updatedAt;
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private Long updatedTime;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.czg.account.service;
|
||||
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.account.entity.ShopTableArea;
|
||||
|
||||
|
|
@ -9,6 +10,7 @@ import com.czg.account.entity.ShopTableArea;
|
|||
* @author zs
|
||||
* @since 2025-02-18
|
||||
*/
|
||||
public interface ShopAreaService extends IService<ShopTableArea> {
|
||||
public interface ShopTableAreaService extends IService<ShopTableArea> {
|
||||
|
||||
Page<ShopTableArea> pageInfo(Long shopId, String name);
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.account.entity.ShopTableArea;
|
||||
import com.czg.account.service.ShopAreaService;
|
||||
import com.czg.service.account.mapper.ShopAreaMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 店铺区域 服务层实现。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-02-18
|
||||
*/
|
||||
@Service
|
||||
public class ShopAreaServiceImpl extends ServiceImpl<ShopAreaMapper, ShopTableArea> implements ShopAreaService{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.account.entity.ShopTableArea;
|
||||
import com.czg.account.service.ShopTableAreaService;
|
||||
import com.czg.service.account.mapper.ShopAreaMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 店铺区域 服务层实现。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-02-18
|
||||
*/
|
||||
@Service
|
||||
public class ShopTableAreaServiceImpl extends ServiceImpl<ShopAreaMapper, ShopTableArea> implements ShopTableAreaService {
|
||||
|
||||
@Override
|
||||
public Page<ShopTableArea> pageInfo(Long shopId, String name) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper().eq(ShopTableArea::getShopId, shopId);
|
||||
|
||||
if (StrUtil.isNotBlank(name)) {
|
||||
queryWrapper.like(ShopTableArea::getName, name);
|
||||
}
|
||||
return page(PageUtil.buildPage(), queryWrapper);
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ import com.czg.account.dto.table.ShopTableAddDTO;
|
|||
import com.czg.account.dto.table.ShopTableBindDTO;
|
||||
import com.czg.account.entity.ShopTableArea;
|
||||
import com.czg.account.entity.ShopTableCode;
|
||||
import com.czg.account.service.ShopAreaService;
|
||||
import com.czg.account.service.ShopTableAreaService;
|
||||
import com.czg.account.service.ShopTableCodeService;
|
||||
import com.czg.enums.ShopTableStatusEnum;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
|
|
@ -42,7 +42,7 @@ import java.util.zip.ZipOutputStream;
|
|||
@Service
|
||||
public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable> implements ShopTableService{
|
||||
@Resource
|
||||
private ShopAreaService shopAreaService;
|
||||
private ShopTableAreaService shopAreaService;
|
||||
@Resource
|
||||
private ShopTableCodeService shopTableCodeService;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue