pad点餐接口

This commit is contained in:
张松
2025-02-20 10:47:51 +08:00
parent 2c324221a9
commit 9207cabc2a
41 changed files with 1581 additions and 2 deletions

View File

@@ -0,0 +1,14 @@
package com.czg.service.account.mapper;
import com.mybatisflex.core.BaseMapper;
import com.czg.account.entity.PadLayout;
/**
* Pad商品布局版式 映射层。
*
* @author zs
* @since 2025-02-20
*/
public interface PadLayoutMapper extends BaseMapper<PadLayout> {
}

View File

@@ -0,0 +1,17 @@
package com.czg.service.account.mapper;
import com.czg.account.dto.pad.PadProductCategoryDTO;
import com.mybatisflex.core.BaseMapper;
import com.czg.account.entity.PadProductCategoryDetail;
import com.mybatisflex.core.paginate.Page;
/**
* Pad商品自定义分类明细 映射层。
*
* @author zs
* @since 2025-02-20
*/
public interface PadProductCategoryDetailMapper extends BaseMapper<PadProductCategoryDetail> {
Page<PadProductCategoryDTO> selectPageByKeyAndShopId();
Page<PadProductCategoryDTO> selectPageByKeyAndShopId_COUNT();
}

View File

@@ -0,0 +1,14 @@
package com.czg.service.account.mapper;
import com.mybatisflex.core.BaseMapper;
import com.czg.account.entity.PadProductCategory;
/**
* Pad商品自定义分类 映射层。
*
* @author zs
* @since 2025-02-20
*/
public interface PadProductCategoryMapper extends BaseMapper<PadProductCategory> {
}

View File

@@ -0,0 +1,14 @@
package com.czg.service.account.mapper;
import com.mybatisflex.core.BaseMapper;
import com.czg.account.entity.Product;
/**
* 商品 映射层。
*
* @author zs
* @since 2025-02-20
*/
public interface ProductMapper extends BaseMapper<Product> {
}

View File

@@ -0,0 +1,14 @@
package com.czg.service.account.mapper;
import com.mybatisflex.core.BaseMapper;
import com.czg.account.entity.ShopProdCategory;
/**
* 商品分类 映射层。
*
* @author zs
* @since 2025-02-20
*/
public interface ShopProdCategoryMapper extends BaseMapper<ShopProdCategory> {
}

View File

@@ -0,0 +1,18 @@
package com.czg.service.account.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.PadLayout;
import com.czg.account.service.PadLayoutService;
import com.czg.service.account.mapper.PadLayoutMapper;
import org.springframework.stereotype.Service;
/**
* Pad商品布局版式 服务层实现。
*
* @author zs
* @since 2025-02-20
*/
@Service
public class PadLayoutServiceImpl extends ServiceImpl<PadLayoutMapper, PadLayout> implements PadLayoutService{
}

View File

@@ -0,0 +1,77 @@
package com.czg.service.account.service.impl;
import com.czg.account.dto.pad.PadDetailAddDTO;
import com.czg.account.dto.pad.PadDetailDTO;
import com.czg.account.dto.pad.PadDetailEditDTO;
import com.czg.account.dto.pad.PadProductCategoryDTO;
import com.czg.account.entity.PadProductCategory;
import com.czg.account.entity.PadProductCategoryDetail;
import com.czg.account.entity.Product;
import com.czg.account.entity.ShopProdCategory;
import com.czg.account.service.PadProdService;
import com.czg.account.service.PadProductCategoryService;
import com.czg.account.service.ProductService;
import com.czg.account.service.ShopProdCategoryService;
import com.czg.exception.ApiNotPrintException;
import com.czg.service.account.mapper.PadProductCategoryDetailMapper;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Administrator
*/
@Service
public class PadProdServiceImpl implements PadProdService {
@Resource
private PadProductCategoryDetailMapper padProductCategoryDetailMapper;
@Resource
private PadProductCategoryService padProductCategoryService;
@Resource
private ProductService productService;
@Resource
private ShopProdCategoryService shopProdCategoryService;
@Override
public Page<PadProductCategoryDTO> pageInfo(Page<PadProductCategoryDTO> objectPage, Long productCategoryId, Long shopId) {
QueryWrapper queryWrapper = new QueryWrapper().eq(PadProductCategoryDetail::getPadProductCategoryId, shopId);
if (productCategoryId != null) {
queryWrapper.eq(PadProductCategoryDetail::getPadProductCategoryId, productCategoryId);
}
return padProductCategoryDetailMapper.xmlPaginate("selectPageByKeyAndShopId", objectPage, queryWrapper);
}
@Override
public PadDetailDTO detail(Long shopId, Long padProductCategory) {
PadProductCategory padCategory = padProductCategoryService.getOne(new QueryWrapper().eq(PadProductCategory::getShopId, shopId).eq(PadProductCategory::getId, padProductCategory));
if (padCategory == null) {
throw new ApiNotPrintException("pad商品分类不存在");
}
PadDetailDTO padDetailDTO = new PadDetailDTO();
padDetailDTO.setId(padProductCategory);
padDetailDTO.setPadLayoutId(padCategory.getPadLayoutId());
List<Long> productIds = padProductCategoryDetailMapper.selectListByQuery(new QueryWrapper().eq(PadProductCategoryDetail::getPadProductCategoryId, padProductCategory)).stream().map(PadProductCategoryDetail::getProductId).toList();
padDetailDTO.setProductIdList(productIds);
if (!productIds.isEmpty()) {
List<Product> products = productService.list(new QueryWrapper().in(Product::getId, productIds).eq(Product::getShopId, shopId));
padDetailDTO.setProductList(products);
}
return padDetailDTO;
}
@Override
public Boolean add(Long shopId, PadDetailAddDTO padDetailAddDTO) {
shopProdCategoryService.getOne(new QueryWrapper().eq(ShopProdCategory::getId, padDetailAddDTO.getProductCategoryId()));
return null;
}
@Override
public Boolean edit(Long shopId, PadDetailEditDTO padDetailEditDTO) {
return null;
}
}

View File

@@ -0,0 +1,18 @@
package com.czg.service.account.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.PadProductCategoryDetail;
import com.czg.account.service.PadProductCategoryDetailService;
import com.czg.service.account.mapper.PadProductCategoryDetailMapper;
import org.springframework.stereotype.Service;
/**
* Pad商品自定义分类明细 服务层实现。
*
* @author zs
* @since 2025-02-20
*/
@Service
public class PadProductCategoryDetailServiceImpl extends ServiceImpl<PadProductCategoryDetailMapper, PadProductCategoryDetail> implements PadProductCategoryDetailService{
}

View File

@@ -0,0 +1,18 @@
package com.czg.service.account.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.PadProductCategory;
import com.czg.account.service.PadProductCategoryService;
import com.czg.service.account.mapper.PadProductCategoryMapper;
import org.springframework.stereotype.Service;
/**
* Pad商品自定义分类 服务层实现。
*
* @author zs
* @since 2025-02-20
*/
@Service
public class PadProductCategoryServiceImpl extends ServiceImpl<PadProductCategoryMapper, PadProductCategory> implements PadProductCategoryService{
}

View File

@@ -0,0 +1,18 @@
package com.czg.service.account.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.Product;
import com.czg.account.service.ProductService;
import com.czg.service.account.mapper.ProductMapper;
import org.springframework.stereotype.Service;
/**
* 商品 服务层实现。
*
* @author zs
* @since 2025-02-20
*/
@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService{
}

View File

@@ -0,0 +1,18 @@
package com.czg.service.account.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.ShopProdCategory;
import com.czg.account.service.ShopProdCategoryService;
import com.czg.service.account.mapper.ShopProdCategoryMapper;
import org.springframework.stereotype.Service;
/**
* 商品分类 服务层实现。
*
* @author zs
* @since 2025-02-20
*/
@Service
public class ShopProdCategoryServiceImpl extends ServiceImpl<ShopProdCategoryMapper, ShopProdCategory> implements ShopProdCategoryService{
}

View File

@@ -140,6 +140,7 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
SysUser sysUser = sysUserService.getById(shopStaff.getId());
shopStaff.setAccountName(StrUtil.subAfter(sysUser.getAccount(), "@", true));
shopStaff.setAccountPwd("*******");
shopStaff.setPhone(sysUser.getPhone());
return shopStaff;
}
}

View File

@@ -0,0 +1,7 @@
<?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.czg.service.account.mapper.PadLayoutMapper">
</mapper>

View File

@@ -0,0 +1,34 @@
<?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.czg.service.account.mapper.PadProductCategoryDetailMapper">
<select id="selectPageByKeyAndShopId" resultType="com.czg.account.dto.pad.PadProductCategoryDTO">
SELECT tb_pad_product_category.id,
tb_shop_prod_category.`name` AS productCategoryName,
GROUP_CONCAT(tb_product.NAME) AS productNames,
tb_pad_layout.code AS padLayoutCode,
tb_pad_layout.NAME AS padLayoutName
FROM tb_pad_product_category
LEFT JOIN tb_pad_product_category_detail
ON tb_pad_product_category.id = tb_pad_product_category_detail.pad_product_category_id
LEFT JOIN tb_shop_prod_category
ON tb_pad_product_category.product_category_id = tb_shop_prod_category.id
LEFT JOIN tb_product ON tb_pad_product_category_detail.product_id = tb_product.id
LEFT JOIN tb_pad_layout ON tb_pad_product_category.pad_layout_id = tb_pad_layout.id
${qwSql}
limit ${pageOffset}, ${pageSize}
</select>
<select id="selectPageByKeyAndShopId_COUNT" resultType="com.czg.account.dto.pad.PadProductCategoryDTO">
SELECT count(1)
FROM tb_pad_product_category
LEFT JOIN tb_pad_product_category_detail
ON tb_pad_product_category.id = tb_pad_product_category_detail.pad_product_category_id
LEFT JOIN tb_shop_prod_category
ON tb_pad_product_category.product_category_id = tb_shop_prod_category.id
LEFT JOIN tb_product ON tb_pad_product_category_detail.product_id = tb_product.id
LEFT JOIN tb_pad_layout ON tb_pad_product_category.pad_layout_id = tb_pad_layout.id
${qwSql}
</select>
</mapper>

View File

@@ -0,0 +1,7 @@
<?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.czg.service.account.mapper.PadProductCategoryMapper">
</mapper>

View File

@@ -0,0 +1,7 @@
<?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.czg.service.account.mapper.ProductMapper">
</mapper>

View File

@@ -0,0 +1,7 @@
<?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.czg.service.account.mapper.ShopProdCategoryMapper">
</mapper>

View File

@@ -23,7 +23,7 @@
<select id="selectUserSummary" resultType="com.czg.account.dto.shopuser.ShopUserSummaryDTO">
select count(a.id) userTotal, sum(IFNULL(a.amount, 0)) balanceTotal,sum(IFNULL(b.amount,0)) chargeTotal from
tb_shop_user as a
left join tb_shop_user_flow as b on a.id=b.user_id and b.type='+' and b.biz_code in ('cashIn', 'wechatIn',
left join tb_shop_user_flow as b on a.id=b.user_id and b.biz_code in ('cashIn', 'wechatIn',
'alipayIn')
where a.shop_id = #{shopId}
<if test="isVip !=null">