pad点餐bug修复

This commit is contained in:
张松 2025-04-03 16:47:33 +08:00
parent 50931a80b4
commit 046259c8da
3 changed files with 16 additions and 23 deletions

View File

@ -4,6 +4,9 @@ import com.czg.account.dto.pad.PadProductCategoryDTO;
import com.mybatisflex.core.BaseMapper;
import com.czg.account.entity.PadProductCategoryDetail;
import com.mybatisflex.core.paginate.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Pad商品自定义分类明细 映射层
@ -12,6 +15,5 @@ import com.mybatisflex.core.paginate.Page;
* @since 2025-02-20
*/
public interface PadProductCategoryDetailMapper extends BaseMapper<PadProductCategoryDetail> {
Page<PadProductCategoryDTO> selectPageByKeyAndShopId();
long selectPageByKeyAndShopId_COUNT();
List<PadProductCategoryDTO> selectPageByKeyAndShopId(@Param("shopId") Long shopId, @Param("categoryId") Long categoryId);
}

View File

@ -8,6 +8,9 @@ import com.czg.product.entity.Product;
import com.czg.product.service.ProductService;
import com.czg.service.account.mapper.PadProductCategoryDetailMapper;
import com.czg.utils.JoinQueryWrapper;
import com.czg.utils.PageUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
@ -37,13 +40,8 @@ public class PadProdServiceImpl implements PadProdService {
@Override
public Page<PadProductCategoryDTO> pageInfo(Page<PadProductCategoryDTO> objectPage, Long productCategoryId, Long shopId) {
JoinQueryWrapper queryWrapper = new JoinQueryWrapper().eq(PadProductCategory::getShopId, shopId);
if (productCategoryId != null) {
queryWrapper.eq(PadProductCategory::getProductCategoryId, productCategoryId);
}
queryWrapper.groupBy(PadProductCategory::getId);
queryWrapper.orderBy(PadProductCategory::getSort, true).orderBy(PadProductCategory::getId, false);
return padProductCategoryDetailMapper.xmlPaginate("selectPageByKeyAndShopId", objectPage, queryWrapper);
PageHelper.startPage(PageUtil.buildPageHelp());
return PageUtil.convert(new PageInfo<>(padProductCategoryDetailMapper.selectPageByKeyAndShopId(shopId, productCategoryId)));
}
@Override

View File

@ -17,19 +17,12 @@
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}
where tb_pad_product_category.shop_id=#{shopId}
<if test="categoryId != null">
and tb_pad_product_category.product_category_id=#{categoryId}
</if>
group by tb_pad_product_category.id
order by tb_pad_product_category.sort desc
</select>
limit ${pageOffset}, ${pageSize}
</select>
<select id="selectPageByKeyAndShopId_COUNT" resultType="java.lang.Long">
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>