后台-分页查询餐线列表

This commit is contained in:
tqzhang 2025-03-05 09:42:40 +08:00
parent e3cbbe4a16
commit 46af1f9e09
7 changed files with 385 additions and 42 deletions

View File

@ -1,10 +1,13 @@
package com.bonus.canteen.core.allocation.canteen.controller;
import com.bonus.canteen.core.allocation.canteen.param.AllocCanteenStallPageParam;
import com.bonus.canteen.core.allocation.canteen.service.AllocMealLineService;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.canteen.core.allocation.canteen.dto.AllocMobileCanteenQueryDTO;
import com.bonus.canteen.core.allocation.canteen.model.AllocCanteen;
import com.bonus.canteen.core.allocation.canteen.service.AllocCanteenService;
import com.bonus.canteen.core.allocation.canteen.service.AllocStallService;
import com.bonus.common.houqin.utils.LeRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
@ -29,10 +32,13 @@ public class AllocCanteenController {
@Lazy
private AllocCanteenService allocCanteenService;
@Autowired
@Resource
@Lazy
private AllocStallService allocStallService;
@Resource
@Lazy
private AllocMealLineService allocMealLineService;
@ApiOperation("查询食堂所有开启的支付方式")
@PostMapping({"/list-avail-pay-type"})
public AjaxResult listAvailPayTypeForApp(@RequestBody AllocCanteen bean) {
@ -54,4 +60,10 @@ public class AllocCanteenController {
public AjaxResult listReserveDate(@RequestBody AllocMobileCanteenQueryDTO bean) {
return AjaxResult.success(this.allocStallService.listReserveDate(bean));
}
@ApiOperation("分页查询餐线列表")
@PostMapping({"/page-meal-line"})
public AjaxResult pageMealLine(@RequestBody AllocCanteenStallPageParam dto) {
return AjaxResult.success(this.allocMealLineService.pageMealLine(dto));
}
}

View File

@ -3,6 +3,10 @@ package com.bonus.canteen.core.allocation.canteen.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bonus.canteen.core.allocation.canteen.model.AllocMealLine;
import com.bonus.canteen.core.allocation.canteen.param.AllocCanteenStallPageParam;
import com.bonus.canteen.core.allocation.canteen.vo.AllocMealLineVO;
import com.bonus.canteen.core.autth.config.LeNiuDataPermission;
import com.bonus.canteen.core.autth.enums.DataPermissionTypeEnum;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@ -14,11 +18,11 @@ public interface AllocMealLineMapper extends BaseMapper<AllocMealLine> {
@Select({"SELECT MAX(meal_line_num) FROM alloc_meal_line WHERE if_del = 2 AND stall_id = #{stallId}"})
String getLatestMealLineNum(Long stallId);
// @LeNiuDataPermission(
// alias = "t1",
// permissionType = DataPermissionTypeEnum.PERMISSION_STALL
// )
// Page<AllocMealLineVO> pageMealLine(@Param("page") Page<AllocMealLineVO> page, @Param("param") AllocCanteenStallPageParam param);
@LeNiuDataPermission(
alias = "t1",
permissionType = DataPermissionTypeEnum.PERMISSION_STALL
)
Page<AllocMealLineVO> pageMealLine(@Param("page") Page<AllocMealLineVO> page, @Param("param") AllocCanteenStallPageParam param);
//
// List<AllocMealLineVO> listMultipleMealLine(@Param("stallIdList") List<Long> stallIdList);
}

View File

@ -0,0 +1,130 @@
package com.bonus.canteen.core.allocation.canteen.param;
import com.bonus.canteen.core.common.page.PageDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
@ApiModel("食堂档口 param")
public class AllocCanteenStallPageParam extends PageDTO {
@ApiModelProperty("区域id")
private Long areaId;
private List<Long> areaIdList;
@ApiModelProperty("食堂id")
private Long canteenId;
@ApiModelProperty("食堂名称")
private String canteenName;
@ApiModelProperty("档口id")
private Long stallId;
@ApiModelProperty("档口名称")
private String stallName;
@ApiModelProperty("档口业务类型")
private Integer stallType;
@ApiModelProperty("餐线名称")
private String mealLineName;
@ApiModelProperty("是否删除")
private Integer ifDel;
@ApiModelProperty("食堂/档口 id")
private Long commonId;
@ApiModelProperty("食堂业务类型")
private Integer canteenType;
@ApiModelProperty("食堂树类型")
private Integer canteenTreeType;
public Long getAreaId() {
return this.areaId;
}
public List<Long> getAreaIdList() {
return this.areaIdList;
}
public Long getCanteenId() {
return this.canteenId;
}
public String getCanteenName() {
return this.canteenName;
}
public Long getStallId() {
return this.stallId;
}
public String getStallName() {
return this.stallName;
}
public Integer getStallType() {
return this.stallType;
}
public String getMealLineName() {
return this.mealLineName;
}
public Integer getIfDel() {
return this.ifDel;
}
public Long getCommonId() {
return this.commonId;
}
public Integer getCanteenType() {
return this.canteenType;
}
public Integer getCanteenTreeType() {
return this.canteenTreeType;
}
public void setAreaId(final Long areaId) {
this.areaId = areaId;
}
public void setAreaIdList(final List<Long> areaIdList) {
this.areaIdList = areaIdList;
}
public void setCanteenId(final Long canteenId) {
this.canteenId = canteenId;
}
public void setCanteenName(final String canteenName) {
this.canteenName = canteenName;
}
public void setStallId(final Long stallId) {
this.stallId = stallId;
}
public void setStallName(final String stallName) {
this.stallName = stallName;
}
public void setStallType(final Integer stallType) {
this.stallType = stallType;
}
public void setMealLineName(final String mealLineName) {
this.mealLineName = mealLineName;
}
public void setIfDel(final Integer ifDel) {
this.ifDel = ifDel;
}
public void setCommonId(final Long commonId) {
this.commonId = commonId;
}
public void setCanteenType(final Integer canteenType) {
this.canteenType = canteenType;
}
public void setCanteenTreeType(final Integer canteenTreeType) {
this.canteenTreeType = canteenTreeType;
}
}

View File

@ -3,6 +3,8 @@ package com.bonus.canteen.core.allocation.canteen.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bonus.canteen.core.allocation.canteen.model.AllocMealLine;
import com.bonus.canteen.core.allocation.canteen.param.AllocCanteenStallPageParam;
import com.bonus.canteen.core.allocation.canteen.vo.AllocMealLineVO;
import java.util.List;
@ -11,7 +13,7 @@ public interface AllocMealLineService extends IService<AllocMealLine> {
//
// List<AllocMealLineVO> listMultipleMealLine(AllocCanteenStallParam param);
//
// Page<AllocMealLineVO> pageMealLine(AllocCanteenStallPageParam param);
Page<AllocMealLineVO> pageMealLine(AllocCanteenStallPageParam param);
//
// void addMealLine(AllocMealLineAddDTO addDTO);
//

View File

@ -1,35 +1,28 @@
package com.bonus.canteen.core.allocation.canteen.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bonus.canteen.core.allocation.canteen.mapper.AllocMealLineMapper;
import com.bonus.canteen.core.allocation.canteen.model.AllocMealLine;
import com.bonus.canteen.core.allocation.canteen.param.AllocCanteenStallPageParam;
import com.bonus.canteen.core.allocation.canteen.service.AllocAreaService;
import com.bonus.canteen.core.allocation.canteen.service.AllocMealLineService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.bonus.canteen.core.allocation.canteen.vo.AllocMealLineVO;
import com.bonus.common.houqin.constant.LeConstants;
import com.bonus.common.houqin.utils.AesEncryptUtil;
import com.bonus.common.houqin.utils.LeBeanUtil;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import java.lang.invoke.SerializedLambda;
import java.util.Iterator;
import java.util.List;
import javax.annotation.Resource;
@Service
public class AllocMealLineServiceImpl extends ServiceImpl<AllocMealLineMapper, AllocMealLine> implements AllocMealLineService {
// private static final Logger log = LoggerFactory.getLogger(AllocMealLineServiceImpl.class);
// @Autowired
// @Lazy
// private AllocAreaService allocAreaService;
// @Resource
// private AesEncryptUtil aesEncryptUtil;
@Resource
@Lazy
private AllocAreaService allocAreaService;
// @Resource
// private AllocStallMapper allocStallMapper;
// @Autowired
@ -53,24 +46,20 @@ public class AllocMealLineServiceImpl extends ServiceImpl<AllocMealLineMapper, A
// return ((AllocMealLineMapper)this.baseMapper).listMultipleMealLine(param.getStallIdList());
// }
//
// public Page<AllocMealLineVO> pageMealLine(AllocCanteenStallPageParam param) {
// param.setMealLineName(LeBeanUtil.fieldLikeHandle(param.getMealLineName()));
// param.setIfDel(LeConstants.COMMON_NO);
// Page<AllocMealLineVO> page = new Page(param.getCurrent(), param.getSize());
// if (ObjectUtil.isNotNull(param.getAreaId())) {
// param.setAreaIdList(this.allocAreaService.getAllChildrenId(param.getAreaId()));
// }
//
// page = ((AllocMealLineMapper)this.baseMapper).pageMealLine(page, param);
// Iterator var3 = page.getRecords().iterator();
//
// while(var3.hasNext()) {
// AllocMealLineVO mealLine = (AllocMealLineVO)var3.next();
// mealLine.setContactTel(this.aesEncryptUtil.aesEncrypt(mealLine.getContactTel()));
// }
//
// return page;
// }
@Override
public Page<AllocMealLineVO> pageMealLine(AllocCanteenStallPageParam param) {
param.setMealLineName(LeBeanUtil.fieldLikeHandle(param.getMealLineName()));
param.setIfDel(LeConstants.COMMON_NO);
Page<AllocMealLineVO> page = new Page(param.getCurrent(), param.getSize());
if (ObjectUtil.isNotNull(param.getAreaId())) {
param.setAreaIdList(this.allocAreaService.getAllChildrenId(param.getAreaId()));
}
page = this.baseMapper.pageMealLine(page, param);
for (AllocMealLineVO mealLine : page.getRecords()) {
mealLine.setContactTel(AesEncryptUtil.aesEncrypt(mealLine.getContactTel()));
}
return page;
}
//
// public void addMealLine(AllocMealLineAddDTO addDTO) {
// this.checkMealLineNameExist(addDTO.getMealLineName(), (Long)null);

View File

@ -0,0 +1,153 @@
package com.bonus.canteen.core.allocation.canteen.vo;
import com.bonus.canteen.core.common.encrypt.LeNiuDecryptDataProcess;
import com.bonus.canteen.core.common.encrypt.LeNiuDecryptField;
import com.bonus.canteen.core.common.utils.SysUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel("餐线VO")
@LeNiuDecryptDataProcess
public class AllocMealLineVO {
@ApiModelProperty("餐线id")
private Long mealLineId;
@ApiModelProperty("餐线编号")
private String mealLineNum;
@ApiModelProperty("餐线名称")
private String mealLineName;
@ApiModelProperty("餐线图片链接")
private String imgUrl;
@ApiModelProperty("餐线类型")
private Integer mealLineType;
@ApiModelProperty("区域id")
private Long areaId;
@ApiModelProperty("当前区域名称")
private String areaName;
@ApiModelProperty("食堂id")
private Long canteenId;
@ApiModelProperty("食堂名称")
private String canteenName;
@ApiModelProperty("档口id")
private Long stallId;
@ApiModelProperty("档口名称")
private String stallName;
@ApiModelProperty("人员id")
private Long custId;
@ApiModelProperty("人员姓名")
@LeNiuDecryptField
private String custName;
@ApiModelProperty("联系电话")
private String contactTel;
public String getImgUrl() {
return SysUtil.getCutFileUrl(this.imgUrl);
}
public Long getMealLineId() {
return this.mealLineId;
}
public String getMealLineNum() {
return this.mealLineNum;
}
public String getMealLineName() {
return this.mealLineName;
}
public Integer getMealLineType() {
return this.mealLineType;
}
public Long getAreaId() {
return this.areaId;
}
public String getAreaName() {
return this.areaName;
}
public Long getCanteenId() {
return this.canteenId;
}
public String getCanteenName() {
return this.canteenName;
}
public Long getStallId() {
return this.stallId;
}
public String getStallName() {
return this.stallName;
}
public Long getCustId() {
return this.custId;
}
public String getCustName() {
return this.custName;
}
public String getContactTel() {
return this.contactTel;
}
public void setMealLineId(final Long mealLineId) {
this.mealLineId = mealLineId;
}
public void setMealLineNum(final String mealLineNum) {
this.mealLineNum = mealLineNum;
}
public void setMealLineName(final String mealLineName) {
this.mealLineName = mealLineName;
}
public void setImgUrl(final String imgUrl) {
this.imgUrl = imgUrl;
}
public void setMealLineType(final Integer mealLineType) {
this.mealLineType = mealLineType;
}
public void setAreaId(final Long areaId) {
this.areaId = areaId;
}
public void setAreaName(final String areaName) {
this.areaName = areaName;
}
public void setCanteenId(final Long canteenId) {
this.canteenId = canteenId;
}
public void setCanteenName(final String canteenName) {
this.canteenName = canteenName;
}
public void setStallId(final Long stallId) {
this.stallId = stallId;
}
public void setStallName(final String stallName) {
this.stallName = stallName;
}
public void setCustId(final Long custId) {
this.custId = custId;
}
public void setCustName(final String custName) {
this.custName = custName;
}
public void setContactTel(final String contactTel) {
this.contactTel = contactTel;
}
}

View File

@ -0,0 +1,53 @@
<?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.bonus.canteen.core.allocation.canteen.mapper.AllocMealLineMapper">
<!-- 分页查询餐线列表 -->
<select id="pageMealLine" resultType="com.bonus.canteen.core.allocation.canteen.vo.AllocMealLineVO">
SELECT
t1.meal_line_id, t1.meal_line_num, t1.meal_line_name, t1.img_url, t1.meal_line_type, t1.area_id,
t1.canteen_id, t1.stall_id, t1.cust_id, t1.contact_tel,
t4.cust_name, t2.canteen_name, t3.stall_name, t5.area_name
FROM
alloc_meal_line t1
INNER JOIN alloc_canteen t2 ON t1.canteen_id = t2.canteen_id
INNER JOIN alloc_stall t3 ON t1.stall_id = t3.stall_id
LEFT JOIN cust_info t4 ON t1.cust_id = t4.cust_id
INNER JOIN alloc_area t5 ON t2.area_id = t5.area_id
WHERE
t1.if_del = #{param.ifDel}
<if test="param.canteenId != null">
AND t1.canteen_id = #{param.canteenId}
</if>
<if test="param.stallId != null">
AND t1.stall_id = #{param.stallId}
</if>
<if test="param.mealLineName != null and param.mealLineName != ''">
AND t1.meal_line_name LIKE #{param.mealLineName}
</if>
<if test="param.areaIdList != null and param.areaIdList.size() > 0">
AND t2.area_id IN
<foreach collection="param.areaIdList" item="areaId" separator="," open="(" close=")">
#{areaId}
</foreach>
</if>
ORDER BY t1.meal_line_id DESC
</select>
<!-- 查询餐线列表,支持多个档口 -->
<select id="listMultipleMealLine" resultType="com.bonus.canteen.core.allocation.canteen.vo.AllocMealLineVO">
SELECT
t1.meal_line_id, t1.meal_line_name
FROM
alloc_meal_line t1
WHERE
t1.if_del = 2
<if test="stallIdList != null and stallIdList.size() > 0">
AND t1.stall_id IN
<foreach collection="stallIdList" item="stallId" separator="," open="(" close=")">
#{stallId}
</foreach>
</if>
</select>
</mapper>