餐次配置

This commit is contained in:
sxu 2025-04-16 17:46:47 +08:00
parent b174488936
commit 2b6d71ed50
5 changed files with 109 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package com.bonus.canteen.core.alloc.domain;
import java.util.Date;
import java.util.List;
import com.bonus.canteen.core.common.utils.FileUrlUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
@ -151,6 +152,8 @@ public class AllocStall extends BaseEntity {
@ApiModelProperty(value = "档口收款码链接")
private String payCodeUrl;
private List<AllocStallMealtime> allocStallMealtimeList;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;

View File

@ -0,0 +1,54 @@
package com.bonus.canteen.core.alloc.domain;
import com.bonus.canteen.core.common.utils.FileUrlUtil;
import com.bonus.common.core.annotation.Excel;
import com.bonus.common.core.web.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.util.Date;
/**
* 档口信息对象 alloc_stall_mealtime
*
* @author xsheng
* @date 2025-04-03
*/
@Data
@ToString
public class AllocStallMealtime extends BaseEntity {
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 档口id */
private Long stallId;
/** 餐次类型 */
@Excel(name = "餐次类型")
@ApiModelProperty(value = "餐次类型")
private Long mealtimeType;
/** 餐次名称 */
@Excel(name = "餐次名称")
@ApiModelProperty(value = "餐次名称")
private String mealtimeName;
/** 开始时间 */
@ApiModelProperty(value = "开始时间")
@JsonFormat(pattern = "HH:mm:ss")
@Excel(name = "开始时间", width = 30, dateFormat = "HH:mm:ss")
private Date startTime;
/** 结束时间 */
@ApiModelProperty(value = "结束时间")
@JsonFormat(pattern = "HH:mm:ss")
@Excel(name = "结束时间", width = 30, dateFormat = "HH:mm:ss")
private Date endTime;
}

View File

@ -2,6 +2,8 @@ package com.bonus.canteen.core.alloc.mapper;
import java.util.List;
import com.bonus.canteen.core.alloc.domain.AllocStall;
import com.bonus.canteen.core.alloc.domain.AllocStallMealtime;
import org.apache.ibatis.annotations.Param;
/**
* 档口信息Mapper接口
@ -57,4 +59,10 @@ public interface AllocStallMapper {
* @return 结果
*/
public int deleteAllocStallByStallIds(Long[] stallIds);
public int deleteMealtimeByStallId(Long stallId);
public List<AllocStallMealtime> selectMealtimeByStallId(Long stallId);
public int insertAllocStallMealtime(@Param("list") List<AllocStallMealtime> allocStallMealtimes);
}

View File

@ -3,12 +3,14 @@ package com.bonus.canteen.core.alloc.service.impl;
import java.util.List;
import com.bonus.canteen.core.alloc.domain.AllocStall;
import com.bonus.canteen.core.alloc.domain.AllocStallMealtime;
import com.bonus.canteen.core.alloc.mapper.AllocStallMapper;
import com.bonus.canteen.core.alloc.service.IAllocStallService;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
/**
* 档口信息Service业务层处理
@ -29,7 +31,10 @@ public class AllocStallServiceImpl implements IAllocStallService {
*/
@Override
public AllocStall selectAllocStallByStallId(Long stallId) {
return allocStallMapper.selectAllocStallByStallId(stallId);
List<AllocStallMealtime> allocStallMealtimes = allocStallMapper.selectMealtimeByStallId(stallId);
AllocStall allocStall = allocStallMapper.selectAllocStallByStallId(stallId);
allocStall.setAllocStallMealtimeList(allocStallMealtimes);
return allocStall;
}
/**
@ -53,7 +58,12 @@ public class AllocStallServiceImpl implements IAllocStallService {
public int insertAllocStall(AllocStall allocStall) {
allocStall.setCreateTime(DateUtils.getNowDate());
try {
return allocStallMapper.insertAllocStall(allocStall);
int stallCount = allocStallMapper.insertAllocStall(allocStall);
if (stallCount > 0 && !CollectionUtils.isEmpty(allocStall.getAllocStallMealtimeList())) {
allocStallMapper.deleteMealtimeByStallId(allocStall.getStallId());
allocStallMapper.insertAllocStallMealtime(allocStall.getAllocStallMealtimeList());
}
return stallCount;
} catch (Exception e) {
throw new ServiceException("错误信息描述");
}
@ -69,7 +79,12 @@ public class AllocStallServiceImpl implements IAllocStallService {
public int updateAllocStall(AllocStall allocStall) {
allocStall.setUpdateTime(DateUtils.getNowDate());
try {
return allocStallMapper.updateAllocStall(allocStall);
int stallCount = allocStallMapper.updateAllocStall(allocStall);
if (stallCount > 0 && !CollectionUtils.isEmpty(allocStall.getAllocStallMealtimeList())) {
allocStallMapper.deleteMealtimeByStallId(allocStall.getStallId());
allocStallMapper.insertAllocStallMealtime(allocStall.getAllocStallMealtimeList());
}
return stallCount;
} catch (Exception e) {
throw new ServiceException("错误信息描述");
}
@ -83,6 +98,9 @@ public class AllocStallServiceImpl implements IAllocStallService {
*/
@Override
public int deleteAllocStallByStallIds(Long[] stallIds) {
for (int i = 0; i < stallIds.length; i++) {
allocStallMapper.deleteMealtimeByStallId(stallIds[i]);
}
return allocStallMapper.deleteAllocStallByStallIds(stallIds);
}
@ -94,6 +112,7 @@ public class AllocStallServiceImpl implements IAllocStallService {
*/
@Override
public int deleteAllocStallByStallId(Long stallId) {
allocStallMapper.deleteMealtimeByStallId(stallId);
return allocStallMapper.deleteAllocStallByStallId(stallId);
}
}

View File

@ -185,4 +185,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{stallId}
</foreach>
</delete>
<delete id="deleteMealtimeByStallId" parameterType="Long">
delete from alloc_stall_meantime where stall_id = #{stallId}
</delete>
<select id="selectMealtimeByStallId" parameterType="Long" resultType="com.bonus.canteen.core.alloc.domain.AllocStallMealtime">
select * from alloc_stall_meantime where stall_id = #{stallId}
</select>
<insert id="insertAllocStallMealtime" parameterType="com.bonus.canteen.core.alloc.domain.AllocStall" useGeneratedKeys="true" keyProperty="id">
insert into alloc_stall_time(stall_id, mealtime_type, mealtime_name, start_time, end_time)
values
<foreach collection="list" item="item" separator=",">
(
#{item.stallId},
#{item.mealtimeType},
#{item.mealtimeName},
#{item.startTime},
#{item.endTime}
)
</foreach>
</insert>
</mapper>