新增场地信息管理功能,包括场地信息控制器、服务、数据模型及数据库表结构
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.cms.domain.VenueInfo;
|
||||
|
||||
/**
|
||||
* 场地信息Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
public interface IVenueInfoService extends IService<VenueInfo>
|
||||
{
|
||||
/**
|
||||
* 查询场地信息列表
|
||||
*
|
||||
* @param venueInfo 场地信息
|
||||
* @return 场地信息集合
|
||||
*/
|
||||
List<VenueInfo> selectVenueInfoList(VenueInfo venueInfo);
|
||||
|
||||
/**
|
||||
* 新增场地信息相关字典项
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictLabel 字典标签
|
||||
* @param createBy 创建人
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertVenueInfoDictData(String dictType, String dictLabel, String createBy);
|
||||
}
|
||||
@@ -39,6 +39,7 @@ public class OutdoorFairServiceImpl extends ServiceImpl<OutdoorFairMapper, Outdo
|
||||
queryWrapper.like(StringUtils.isNotBlank(outdoorFair.getHostUnit()), OutdoorFair::getHostUnit, outdoorFair.getHostUnit());
|
||||
queryWrapper.eq(StringUtils.isNotBlank(outdoorFair.getFairType()), OutdoorFair::getFairType, outdoorFair.getFairType());
|
||||
queryWrapper.eq(StringUtils.isNotBlank(outdoorFair.getRegion()), OutdoorFair::getRegion, outdoorFair.getRegion());
|
||||
queryWrapper.eq(outdoorFair.getVenueId() != null, OutdoorFair::getVenueId, outdoorFair.getVenueId());
|
||||
queryWrapper.orderByDesc(OutdoorFair::getHoldTime);
|
||||
queryWrapper.orderByDesc(OutdoorFair::getCreateTime);
|
||||
return list(queryWrapper);
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cms.domain.VenueInfo;
|
||||
import com.ruoyi.cms.mapper.VenueInfoMapper;
|
||||
import com.ruoyi.cms.service.IVenueInfoService;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DictUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 场地信息Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
@Service
|
||||
public class VenueInfoServiceImpl extends ServiceImpl<VenueInfoMapper, VenueInfo> implements IVenueInfoService
|
||||
{
|
||||
private static final String VENUE_TYPE_DICT = "venue_info_type";
|
||||
|
||||
/**
|
||||
* 查询场地信息列表
|
||||
*
|
||||
* @param venueInfo 场地信息
|
||||
* @return 场地信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<VenueInfo> selectVenueInfoList(VenueInfo venueInfo)
|
||||
{
|
||||
LambdaQueryWrapper<VenueInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotBlank(venueInfo.getVenueType()), VenueInfo::getVenueType, venueInfo.getVenueType());
|
||||
queryWrapper.like(StringUtils.isNotBlank(venueInfo.getVenueName()), VenueInfo::getVenueName, venueInfo.getVenueName());
|
||||
queryWrapper.like(StringUtils.isNotBlank(venueInfo.getVenueAddress()), VenueInfo::getVenueAddress, venueInfo.getVenueAddress());
|
||||
queryWrapper.orderByDesc(VenueInfo::getCreateTime);
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增场地信息相关字典项
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictLabel 字典标签
|
||||
* @param createBy 创建人
|
||||
* @return 影响行数
|
||||
*/
|
||||
@Override
|
||||
public int insertVenueInfoDictData(String dictType, String dictLabel, String createBy)
|
||||
{
|
||||
if (!VENUE_TYPE_DICT.equals(dictType)) {
|
||||
throw new ServiceException("只允许维护场地类型字典");
|
||||
}
|
||||
String trimmedLabel = StringUtils.trim(dictLabel);
|
||||
if (StringUtils.isBlank(trimmedLabel)) {
|
||||
throw new ServiceException("字典名称不能为空");
|
||||
}
|
||||
if (trimmedLabel.length() > 100) {
|
||||
throw new ServiceException("字典名称长度不能超过100个字符");
|
||||
}
|
||||
if (baseMapper.countDictDataByTypeAndValue(dictType, trimmedLabel) > 0) {
|
||||
return 1;
|
||||
}
|
||||
Long dictSort = baseMapper.selectNextDictSort(dictType);
|
||||
int rows = baseMapper.insertDictData(dictSort, trimmedLabel, trimmedLabel, dictType, createBy);
|
||||
if (rows > 0) {
|
||||
DictUtils.removeDictCache(dictType);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user