新增户外招聘会相关功能,包括控制器、服务、数据模型及数据库表结构
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.cms.domain.OutdoorFair;
|
||||
import com.ruoyi.cms.domain.OutdoorFairDictDataRequest;
|
||||
import com.ruoyi.cms.service.IOutdoorFairService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 户外招聘会Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/outdoor-fair")
|
||||
@Api(tags = "后台:户外招聘会")
|
||||
public class OutdoorFairController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IOutdoorFairService outdoorFairService;
|
||||
|
||||
/**
|
||||
* 查询户外招聘会列表
|
||||
*/
|
||||
@ApiOperation("查询户外招聘会列表")
|
||||
@PreAuthorize("@ss.hasPermi('cms:outdoorFair:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(OutdoorFair outdoorFair)
|
||||
{
|
||||
startPage();
|
||||
List<OutdoorFair> list = outdoorFairService.selectOutdoorFairList(outdoorFair);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取户外招聘会详细信息
|
||||
*/
|
||||
@ApiOperation("获取户外招聘会详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('cms:outdoorFair:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(outdoorFairService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增户外招聘会
|
||||
*/
|
||||
@ApiOperation("新增户外招聘会")
|
||||
@PreAuthorize("@ss.hasPermi('cms:outdoorFair:add')")
|
||||
@Log(title = "户外招聘会", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody OutdoorFair outdoorFair)
|
||||
{
|
||||
return toAjax(outdoorFairService.save(outdoorFair));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改户外招聘会
|
||||
*/
|
||||
@ApiOperation("修改户外招聘会")
|
||||
@PreAuthorize("@ss.hasPermi('cms:outdoorFair:edit')")
|
||||
@Log(title = "户外招聘会", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody OutdoorFair outdoorFair)
|
||||
{
|
||||
return toAjax(outdoorFairService.updateById(outdoorFair));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除户外招聘会
|
||||
*/
|
||||
@ApiOperation("删除户外招聘会")
|
||||
@PreAuthorize("@ss.hasPermi('cms:outdoorFair:remove')")
|
||||
@Log(title = "户外招聘会", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(outdoorFairService.removeByIds(Arrays.asList(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增户外招聘会页面使用的字典项
|
||||
*/
|
||||
@ApiOperation("新增户外招聘会字典项")
|
||||
@PreAuthorize("@ss.hasAnyPermi('cms:outdoorFair:add,cms:outdoorFair:edit')")
|
||||
@Log(title = "户外招聘会字典项", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/dict-data")
|
||||
public AjaxResult addDictData(@Validated @RequestBody OutdoorFairDictDataRequest request)
|
||||
{
|
||||
return toAjax(outdoorFairService.insertOutdoorFairDictData(request.getDictType(), request.getDictLabel(), getUsername()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 户外招聘会对象 cms_outdoor_fair
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("户外招聘会")
|
||||
@TableName("cms_outdoor_fair")
|
||||
public class OutdoorFair extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@Excel(name = "招聘会标题")
|
||||
@ApiModelProperty("招聘会标题")
|
||||
private String title;
|
||||
|
||||
@Excel(name = "举办单位")
|
||||
@ApiModelProperty("举办单位")
|
||||
private String hostUnit;
|
||||
|
||||
@Excel(name = "招聘会类型")
|
||||
@ApiModelProperty("招聘会类型")
|
||||
private String fairType;
|
||||
|
||||
@Excel(name = "举办区域")
|
||||
@ApiModelProperty("举办区域")
|
||||
private String region;
|
||||
|
||||
@Excel(name = "举办地址")
|
||||
@ApiModelProperty("举办地址")
|
||||
private String address;
|
||||
|
||||
@Excel(name = "展位数量")
|
||||
@ApiModelProperty("展位数量")
|
||||
private Integer boothCount;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "举办时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("举办时间")
|
||||
private Date holdTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "截止时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("截止时间")
|
||||
private Date endTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "开放申请时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("开放申请时间")
|
||||
private Date applyStartTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "截止申请时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("截止申请时间")
|
||||
private Date applyEndTime;
|
||||
|
||||
@Excel(name = "是否开启线上申请")
|
||||
@ApiModelProperty("是否开启线上申请")
|
||||
private Boolean onlineApply;
|
||||
|
||||
@Excel(name = "招聘会照片")
|
||||
@ApiModelProperty("招聘会照片")
|
||||
private String photoUrl;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 户外招聘会字典新增请求
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("户外招聘会字典新增请求")
|
||||
public class OutdoorFairDictDataRequest
|
||||
{
|
||||
@NotBlank(message = "字典类型不能为空")
|
||||
@ApiModelProperty(value = "字典类型", required = true)
|
||||
private String dictType;
|
||||
|
||||
@NotBlank(message = "字典标签不能为空")
|
||||
@ApiModelProperty(value = "字典标签", required = true)
|
||||
private String dictLabel;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.ruoyi.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.cms.domain.OutdoorFair;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 户外招聘会Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
public interface OutdoorFairMapper extends BaseMapper<OutdoorFair>
|
||||
{
|
||||
/**
|
||||
* 查询字典项是否存在
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictValue 字典值
|
||||
* @return 存在数量
|
||||
*/
|
||||
@Select("select count(1) from sys_dict_data where dict_type = #{dictType} and dict_value = #{dictValue}")
|
||||
int countDictDataByTypeAndValue(@Param("dictType") String dictType, @Param("dictValue") String dictValue);
|
||||
|
||||
/**
|
||||
* 获取字典下一个排序
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 下一个排序值
|
||||
*/
|
||||
@Select("select coalesce(max(dict_sort), 0) + 1 from sys_dict_data where dict_type = #{dictType}")
|
||||
Long selectNextDictSort(@Param("dictType") String dictType);
|
||||
|
||||
/**
|
||||
* 新增系统字典项
|
||||
*
|
||||
* @param dictSort 字典排序
|
||||
* @param dictLabel 字典标签
|
||||
* @param dictValue 字典值
|
||||
* @param dictType 字典类型
|
||||
* @param createBy 创建人
|
||||
* @return 影响行数
|
||||
*/
|
||||
@Insert("insert into sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, list_class, is_default, status, create_by, create_time, remark) " +
|
||||
"values ((select coalesce(max(dict_code), 0) + 1 from sys_dict_data), #{dictSort}, #{dictLabel}, #{dictValue}, #{dictType}, 'default', 'N', '0', #{createBy}, sysdate(), '户外招聘会页面新增')")
|
||||
int insertDictData(@Param("dictSort") Long dictSort,
|
||||
@Param("dictLabel") String dictLabel,
|
||||
@Param("dictValue") String dictValue,
|
||||
@Param("dictType") String dictType,
|
||||
@Param("createBy") String createBy);
|
||||
}
|
||||
@@ -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.OutdoorFair;
|
||||
|
||||
/**
|
||||
* 户外招聘会Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
public interface IOutdoorFairService extends IService<OutdoorFair>
|
||||
{
|
||||
/**
|
||||
* 查询户外招聘会列表
|
||||
*
|
||||
* @param outdoorFair 户外招聘会
|
||||
* @return 户外招聘会集合
|
||||
*/
|
||||
List<OutdoorFair> selectOutdoorFairList(OutdoorFair outdoorFair);
|
||||
|
||||
/**
|
||||
* 新增户外招聘会相关字典项
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictLabel 字典标签
|
||||
* @param createBy 创建人
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertOutdoorFairDictData(String dictType, String dictLabel, String createBy);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
/**
|
||||
* 项目启动时,初始化索引及数据
|
||||
*/
|
||||
@PostConstruct
|
||||
// @PostConstruct
|
||||
public void init()
|
||||
{
|
||||
boolean isLockAcquired = false;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class InterviewInvitationServiceImpl implements InterviewInvitationServic
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
@PostConstruct
|
||||
// @PostConstruct
|
||||
public void initTable() {
|
||||
try (Connection conn = dataSource.getConnection();
|
||||
Statement stmt = conn.createStatement()) {
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
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.OutdoorFair;
|
||||
import com.ruoyi.cms.mapper.OutdoorFairMapper;
|
||||
import com.ruoyi.cms.service.IOutdoorFairService;
|
||||
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 OutdoorFairServiceImpl extends ServiceImpl<OutdoorFairMapper, OutdoorFair> implements IOutdoorFairService
|
||||
{
|
||||
private static final String OUTDOOR_FAIR_TYPE_DICT = "outdoor_fair_type";
|
||||
|
||||
private static final String OUTDOOR_FAIR_REGION_DICT = "outdoor_fair_region";
|
||||
|
||||
/**
|
||||
* 查询户外招聘会列表
|
||||
*
|
||||
* @param outdoorFair 户外招聘会
|
||||
* @return 户外招聘会集合
|
||||
*/
|
||||
@Override
|
||||
public List<OutdoorFair> selectOutdoorFairList(OutdoorFair outdoorFair)
|
||||
{
|
||||
LambdaQueryWrapper<OutdoorFair> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.isNotBlank(outdoorFair.getTitle()), OutdoorFair::getTitle, outdoorFair.getTitle());
|
||||
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.orderByDesc(OutdoorFair::getHoldTime);
|
||||
queryWrapper.orderByDesc(OutdoorFair::getCreateTime);
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增户外招聘会相关字典项
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictLabel 字典标签
|
||||
* @param createBy 创建人
|
||||
* @return 影响行数
|
||||
*/
|
||||
@Override
|
||||
public int insertOutdoorFairDictData(String dictType, String dictLabel, String createBy)
|
||||
{
|
||||
if (!OUTDOOR_FAIR_TYPE_DICT.equals(dictType) && !OUTDOOR_FAIR_REGION_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