招聘、首页添加字段

This commit is contained in:
liuxiao 2024-07-18 13:22:44 +08:00
parent d69c862e66
commit 032d28a049
10 changed files with 116 additions and 32 deletions

View File

@ -41,18 +41,16 @@ public class GwJobInfoController extends BaseController {
private final IGwJobInfoService iGwJobInfoService;
/**
* 查询招聘信息
列表
* 查询招聘信息列表
*/
@SaCheckPermission("official:jobInfo:list")
/* @SaCheckPermission("official:jobInfo:list")*/
@GetMapping("/list")
public TableDataInfo<GwJobInfoVo> list(GwJobInfoBo bo, PageQuery pageQuery) {
return iGwJobInfoService.queryPageList(bo, pageQuery);
}
/**
* 导出招聘信息
列表
* 导出招聘信息列表
*/
@SaCheckPermission("official:jobInfo:export")
@Log(title = "招聘信息", businessType = BusinessType.EXPORT)
@ -63,8 +61,7 @@ public class GwJobInfoController extends BaseController {
}
/**
* 获取招聘信息
详细信息
* 获取招聘信息详细信息
*
* @param id 主键
*/

View File

@ -37,7 +37,7 @@ public class GwIndex extends BaseEntity {
*/
private String fileType;
/**
* 业务类型 0石油化工业务 1基建业务 2铁矿石业务 3燃气业务
* 业务类型 0石油化工业务 1基建业务 2铁矿石业务 3燃气业务
*/
private String businessType;
/**
@ -48,6 +48,11 @@ public class GwIndex extends BaseEntity {
* 图片标题英文描述
*/
private String titleEnglish;
/**
* 排序
*/
private String orders;
/**
* 图片标题中文描述
*/

View File

@ -39,8 +39,7 @@ public class GwJobInfo extends BaseEntity {
/**
* 薪资范围
*/
private String
salaryRange;
private String salaryRange;
/**
* 工作地点
*/
@ -53,6 +52,12 @@ public class GwJobInfo extends BaseEntity {
* 年龄范围
*/
private String ageRange;
/**
* 福利
*/
private String welfare;
/**
* 发布时间
*/

View File

@ -25,13 +25,13 @@ public class GwIndexBo extends BaseEntity {
/**
* 主键id
*/
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
private Long id;
/**
* 图片上传地址
*/
@NotBlank(message = "图片上传地址不能为空", groups = { AddGroup.class, EditGroup.class })
private String imageurl;
/**
@ -42,33 +42,39 @@ public class GwIndexBo extends BaseEntity {
/**
* 业务类型 0石油化工业务 1基建业务 2铁矿石业务 3燃气业务
*/
@NotBlank(message = "业务类型 0石油化工业务 1基建业务 2铁矿石业务 3燃气业务 不能为空", groups = { AddGroup.class, EditGroup.class })
private String businessType;
/**
* 业务名称
*/
@NotBlank(message = "业务名称不能为空", groups = { AddGroup.class, EditGroup.class })
private String businessName;
/**
* 图片标题英文描述
*/
@NotBlank(message = "图片标题英文描述不能为空", groups = { AddGroup.class, EditGroup.class })
private String titleEnglish;
/**
* 图片标题中文描述
*/
@NotBlank(message = "图片标题中文描述不能为空", groups = { AddGroup.class, EditGroup.class })
private String titleChinese;
/**
* 是否置顶 0 1
*/
@NotBlank(message = "是否置顶 0否 1是不能为空", groups = { AddGroup.class, EditGroup.class })
private String isIndex;
/**
* 排序
*/
private String orders;
/**
* 标题名称
*/
@ -78,13 +84,13 @@ public class GwIndexBo extends BaseEntity {
/**
* 创建者id
*/
@NotNull(message = "创建者id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long createUserId;
/**
* 更新者id
*/
@NotNull(message = "更新者id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long updateUserId;

View File

@ -1,5 +1,6 @@
package com.ruoyi.official.domain.bo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import lombok.Data;
@ -9,6 +10,7 @@ import javax.validation.constraints.*;
import java.util.Date;
import com.ruoyi.common.core.domain.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 招聘信息
@ -25,7 +27,7 @@ public class GwJobInfoBo extends BaseEntity {
/**
* 主键id
*/
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
private Long id;
/**
@ -68,7 +70,8 @@ public class GwJobInfoBo extends BaseEntity {
/**
* 发布时间
*/
@NotNull(message = "发布时间不能为空", groups = { AddGroup.class, EditGroup.class })
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date releaseTime;
/**
@ -77,6 +80,12 @@ public class GwJobInfoBo extends BaseEntity {
@NotBlank(message = "是否置顶 0否 1是不能为空", groups = { AddGroup.class, EditGroup.class })
private String isTop;
/**
* 福利
*/
private String welfare;
/**
* 岗位职责
*/
@ -98,13 +107,11 @@ public class GwJobInfoBo extends BaseEntity {
/**
* 创建者id
*/
@NotNull(message = "创建者id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long createUserId;
/**
* 更新者id
*/
@NotNull(message = "更新者id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long updateUserId;

View File

@ -41,11 +41,18 @@ public class GwIndexVo {
private String fileType;
/**
* 业务类型 0石油化工业务 1基建业务 2铁矿石业务 3燃气业务
* 业务类型 0石油化工业务 1基建业务 2铁矿石业务 3燃气业务
*/
@ExcelProperty(value = "业务类型 0石油化工业务 1基建业务 2铁矿石业务 3燃气业务 ")
private String businessType;
/**
* 排序
*/
private String orders;
/**
* 业务名称
*/

View File

@ -40,6 +40,11 @@ public class GwJobInfoVo {
@ExcelProperty(value = "岗位职责")
private String postStatement;
/**
* 福利
*/
private String welfare;
/**
* 薪资范围
*/

View File

@ -3,6 +3,7 @@ package com.ruoyi.official.mapper;
import com.ruoyi.official.domain.GwJobInfo;
import com.ruoyi.official.domain.vo.GwJobInfoVo;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Update;
/**
* 招聘信息
@ -13,4 +14,8 @@ Mapper接口
*/
public interface GwJobInfoMapper extends BaseMapperPlus<GwJobInfoMapper, GwJobInfo, GwJobInfoVo> {
//
@Update("UPDATE gw_job_info SET release_time = #{releaseTime} WHERE id = #{id}")
void updateReleaseTime(GwJobInfo gwJobInfo);
}

View File

@ -1,12 +1,18 @@
package com.ruoyi.official.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.domain.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.official.domain.GwSlideshow;
import com.ruoyi.official.domain.vo.GwSlideshowVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.ruoyi.official.domain.bo.GwJobInfoBo;
@ -15,9 +21,11 @@ import com.ruoyi.official.domain.GwJobInfo;
import com.ruoyi.official.mapper.GwJobInfoMapper;
import com.ruoyi.official.service.IGwJobInfoService;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.stream.Collectors;
/**
* 招聘信息Service业务层处理
@ -48,9 +56,19 @@ public class GwJobInfoServiceImpl implements IGwJobInfoService {
public TableDataInfo<GwJobInfoVo> queryPageList(GwJobInfoBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<GwJobInfo> lqw = buildQueryWrapper(bo);
Page<GwJobInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
//取置顶数据放在首条
if (CollUtil.isNotEmpty(result.getRecords())){
List<GwJobInfoVo> records = result.getRecords();
List<GwJobInfoVo> fist = records.stream().filter(itx -> itx.getIsTop().equals("1")).collect(Collectors.toList());
fist.addAll(records.stream().filter(itx->!itx.getIsTop().equals("1")).collect(Collectors.toList()));
result.setRecords(fist);
}
return TableDataInfo.build(result);
}
/**
* 查询招聘信息
列表
@ -77,6 +95,8 @@ public class GwJobInfoServiceImpl implements IGwJobInfoService {
lqw.eq(StringUtils.isNotBlank(bo.getReleaseState()), GwJobInfo::getReleaseState, bo.getReleaseState());
lqw.eq(bo.getCreateUserId() != null, GwJobInfo::getCreateUserId, bo.getCreateUserId());
lqw.eq(bo.getUpdateUserId() != null, GwJobInfo::getUpdateUserId, bo.getUpdateUserId());
lqw.orderByDesc(GwJobInfo::getIsTop);
lqw.orderByDesc(GwJobInfo::getReleaseTime);
return lqw;
}
@ -102,7 +122,16 @@ public class GwJobInfoServiceImpl implements IGwJobInfoService {
@Override
public Boolean updateByBo(GwJobInfoBo bo) {
GwJobInfo update = BeanUtil.toBean(bo, GwJobInfo.class);
validEntityBeforeSave(update);
GwJobInfoVo gwJobInfoVo = baseMapper.selectVoById(bo.getId());
//判断之前是否为发布状态
if (ObjectUtil.equal(update.getReleaseState(),"0")){
update.setReleaseTime(null);
baseMapper.updateReleaseTime(update);
};
//判断之前是否为发布状态
if (ObjectUtil.equal(update.getReleaseState(),"1")&&ObjectUtil.equal(gwJobInfoVo.getReleaseState(),"0"))update.setReleaseTime(new Date());
//置顶校验
validIsTop(BeanUtil.toBean(bo,GwJobInfo.class));
return baseMapper.updateById(update) > 0;
}
@ -111,6 +140,29 @@ public class GwJobInfoServiceImpl implements IGwJobInfoService {
*/
private void validEntityBeforeSave(GwJobInfo entity){
//TODO 做一些数据校验,如唯一约束
//发布时间校验
if(ObjectUtil.equal(entity.getReleaseState(),"1")){
entity.setReleaseTime(new Date());
}
validIsTop(entity);
}
/**
* 置顶校验
*/
private void validIsTop(GwJobInfo entity) {
if (!ObjectUtil.equal(entity.getIsTop(),"1")) return;
//存在想置顶得数据将原来得数据修改为非置顶
List<GwJobInfoVo> vos = baseMapper.selectVoList(Wrappers.<GwJobInfo>lambdaQuery().eq(GwJobInfo::getIsTop, "1"));
if ( CollUtil.isEmpty(vos)) return;
UpdateWrapper<GwJobInfo> updateWrapper = new UpdateWrapper<>();
vos.stream().forEach(ixt->{
// updateWrapper.("id", list).set("is_top", "0");
updateWrapper.eq("id",ixt.getId()).set("is_top", "0");
baseMapper.update(BeanUtil.toBean(ixt,GwJobInfo.class),updateWrapper);
});
}
/**

View File

@ -43,7 +43,7 @@ public class GwSlideshowServiceImpl implements IGwSlideshowService {
public GwSlideshowVo queryById(Long id) {
GwSlideshowVo gwSlideshowVo = baseMapper.selectVoById(id);
//查询详情时返回上一篇下一篇处理
List<GwSlideshow> list = baseMapper.selectList(Wrappers.<GwSlideshow>lambdaQuery().orderByDesc(GwSlideshow::getCreateTime));
List<GwSlideshow> list = baseMapper.selectList(Wrappers.<GwSlideshow>lambdaQuery().eq(GwSlideshow::getType,gwSlideshowVo.getType()).orderByDesc(GwSlideshow::getCreateTime));
getPrevNextArticles(id, gwSlideshowVo, list);
return gwSlideshowVo;
}
@ -70,12 +70,6 @@ public class GwSlideshowServiceImpl implements IGwSlideshowService {
public TableDataInfo<GwSlideshowVo> queryPageList(GwSlideshowBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<GwSlideshow> lqw = buildQueryWrapper(bo);
Page<GwSlideshowVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
if (CollUtil.isNotEmpty(result.getRecords())){
List<GwSlideshowVo> records = result.getRecords();
List<GwSlideshowVo> fist = records.stream().filter(itx -> itx.getIsTop().equals("1")).collect(Collectors.toList());
fist.addAll(records.stream().filter(itx->!itx.getIsTop().equals("1")).collect(Collectors.toList()));
result.setRecords(fist);
}
return TableDataInfo.build(result);
}
@ -99,6 +93,7 @@ public class GwSlideshowServiceImpl implements IGwSlideshowService {
lqw.eq(StringUtils.isNotBlank(bo.getType()), GwSlideshow::getType, bo.getType());
lqw.eq(StringUtils.isNotBlank(bo.getAbstracts()), GwSlideshow::getAbstracts, bo.getAbstracts());
lqw.eq(StringUtils.isNotBlank(bo.getIsTop()), GwSlideshow::getIsTop, bo.getIsTop());
lqw.orderByDesc(GwSlideshow::getIsTop);
lqw.orderByDesc(GwSlideshow::getReleaseTime);
return lqw;
}