1. add price list
This commit is contained in:
2025-10-13 23:08:53 +08:00
parent 88114f285d
commit bc56726a4e
6 changed files with 152 additions and 4 deletions

View File

@@ -37,6 +37,7 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.annotation.PreAuth; import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.modules.kiosk.pojo.vo.PriceListSummaryVO;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.kiosk.pojo.entity.PriceListEntity; import org.springblade.modules.kiosk.pojo.entity.PriceListEntity;
@@ -45,6 +46,7 @@ import org.springblade.modules.kiosk.wrapper.PriceListWrapper;
import org.springblade.modules.kiosk.service.IPriceListService; import org.springblade.modules.kiosk.service.IPriceListService;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@@ -148,4 +150,25 @@ public class PriceListController extends BladeController {
return R.status(priceListService.initPrice(Func.toLong(id))); return R.status(priceListService.initPrice(Func.toLong(id)));
} }
/**
* 自助终端价格表 汇总分页
*/
@GetMapping("/summary-page")
@ApiOperationSupport(order = 9)
@Operation(summary = "分页", description = "传入priceList")
public R<IPage<PriceListSummaryVO>> summaryPage(Long deptId, Query query) {
IPage<PriceListSummaryVO> pages = priceListService.selectSummaryListPage(Condition.getPage(query), deptId);
return R.data(pages);
}
/**
* 自助终端价格表 详情列表
*/
@GetMapping("/detail-list")
@ApiOperationSupport(order = 10)
@Operation(summary = "详情列表", description = "传入priceList")
public R<List<PriceListVO>> detailList(PriceListVO priceList) {
return R.data(priceListService.selectDetailList(priceList));
}
} }

View File

@@ -26,6 +26,7 @@
package org.springblade.modules.kiosk.mapper; package org.springblade.modules.kiosk.mapper;
import org.springblade.modules.kiosk.pojo.entity.PriceListEntity; import org.springblade.modules.kiosk.pojo.entity.PriceListEntity;
import org.springblade.modules.kiosk.pojo.vo.PriceListSummaryVO;
import org.springblade.modules.kiosk.pojo.vo.PriceListVO; import org.springblade.modules.kiosk.pojo.vo.PriceListVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -50,4 +51,7 @@ public interface PriceListMapper extends BaseMapper<PriceListEntity> {
boolean initByCrossJoin(String tenantId, Long targetDept, Long deptId, Long userId ); boolean initByCrossJoin(String tenantId, Long targetDept, Long deptId, Long userId );
List<PriceListSummaryVO> selectSummaryListPage(IPage page, Long deptId);
List<PriceListVO> selectPriceList(PriceListVO priceList);
} }

View File

@@ -32,7 +32,40 @@
from kiosk_price_list kpl from kiosk_price_list kpl
left join kiosk_category kc on kpl.category_id = kc.id left join kiosk_category kc on kpl.category_id = kc.id
where kpl.is_deleted = 0 where kpl.is_deleted = 0
<if test="priceList.deptId !=null">
and kpl.dept_id = #{priceList.deptId} and kpl.dept_id = #{priceList.deptId}
</if>
<if test="priceList.categoryId !=null">
and kpl.category_id = #{priceList.categoryId}
</if>
<if test="priceList.shape !=null">
and kpl.shape = #{priceList.shape}
</if>
<if test="priceList.material !=null">
and kpl.material = #{priceList.material}
</if>
order by kpl.price, kc.type
</select>
<select id="selectPriceList" resultType="org.springblade.modules.kiosk.pojo.vo.PriceListVO">
select kpl.*,
kc.name as categoryName,
kc.type as categoryType
from kiosk_price_list kpl
left join kiosk_category kc on kpl.category_id = kc.id
where kpl.is_deleted = 0
<if test="deptId !=null">
and kpl.dept_id = #{deptId}
</if>
<if test="categoryId !=null">
and kpl.category_id = #{categoryId}
</if>
<if test="shape !=null">
and kpl.shape = #{shape}
</if>
<if test="material !=null">
and kpl.material = #{material}
</if>
order by kpl.price, kc.type order by kpl.price, kc.type
</select> </select>
@@ -59,4 +92,17 @@
AND c.tenant_id = #{tenantId}; AND c.tenant_id = #{tenantId};
</insert> </insert>
<select id="selectSummaryListPage" resultType="org.springblade.modules.kiosk.pojo.vo.PriceListSummaryVO">
select distinct kpl.category_id as categoryId,
kc.name as categoryName,
kc.type as categoryType,
kc.image_url as imageUrl,
kc.photo_limit as photoLimit
from kiosk_price_list kpl
left join kiosk_category kc on kpl.category_id = kc.id
where kpl.is_deleted = 0
and kpl.dept_id = #{deptId}
order by kc.type
</select>
</mapper> </mapper>

View File

@@ -0,0 +1,56 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.kiosk.pojo.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.modules.kiosk.pojo.entity.PriceListEntity;
import java.io.Serial;
import java.io.Serializable;
/**
* 自助终端价格表 视图实体类
*
* @author Ray
* @since 2025-10-13
*/
@Data
public class PriceListSummaryVO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long categoryId;
private String categoryName;
private String categoryType;
private String imageUrl;
private Integer photoLimit;
}

View File

@@ -26,10 +26,13 @@
package org.springblade.modules.kiosk.service; package org.springblade.modules.kiosk.service;
import org.springblade.modules.kiosk.pojo.entity.PriceListEntity; import org.springblade.modules.kiosk.pojo.entity.PriceListEntity;
import org.springblade.modules.kiosk.pojo.vo.PriceListSummaryVO;
import org.springblade.modules.kiosk.pojo.vo.PriceListVO; import org.springblade.modules.kiosk.pojo.vo.PriceListVO;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import java.util.List;
/** /**
* 自助终端价格表 服务类 * 自助终端价格表 服务类
* *
@@ -47,4 +50,8 @@ public interface IPriceListService extends BaseService<PriceListEntity> {
IPage<PriceListVO> selectPriceListPage(IPage<PriceListVO> page, PriceListVO priceList); IPage<PriceListVO> selectPriceListPage(IPage<PriceListVO> page, PriceListVO priceList);
boolean initPrice(Long deptId); boolean initPrice(Long deptId);
IPage<PriceListSummaryVO> selectSummaryListPage(IPage<PriceListSummaryVO> page, Long deptId);
List<PriceListVO> selectDetailList(PriceListVO priceList);
} }

View File

@@ -30,6 +30,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.kiosk.pojo.entity.PriceListEntity; import org.springblade.modules.kiosk.pojo.entity.PriceListEntity;
import org.springblade.modules.kiosk.pojo.vo.PriceListSummaryVO;
import org.springblade.modules.kiosk.pojo.vo.PriceListVO; import org.springblade.modules.kiosk.pojo.vo.PriceListVO;
import org.springblade.modules.kiosk.mapper.PriceListMapper; import org.springblade.modules.kiosk.mapper.PriceListMapper;
import org.springblade.modules.kiosk.service.IPriceListService; import org.springblade.modules.kiosk.service.IPriceListService;
@@ -39,6 +40,7 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import java.util.List;
import java.util.Objects; import java.util.Objects;
/** /**
@@ -68,4 +70,14 @@ public class PriceListServiceImpl extends BaseServiceImpl<PriceListMapper, Price
return baseMapper.initByCrossJoin(AuthUtil.getTenantId(), deptId, Long.valueOf(AuthUtil.getDeptId()), AuthUtil.getUserId() ); return baseMapper.initByCrossJoin(AuthUtil.getTenantId(), deptId, Long.valueOf(AuthUtil.getDeptId()), AuthUtil.getUserId() );
} }
@Override
public IPage<PriceListSummaryVO> selectSummaryListPage(IPage<PriceListSummaryVO> page, Long deptId) {
return page.setRecords(baseMapper.selectSummaryListPage(page, deptId));
}
@Override
public List<PriceListVO> selectDetailList(PriceListVO priceList) {
return baseMapper.selectPriceList(priceList);
}
} }