添加直播带岗相关功能。
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
|
||||
import com.ruoyi.cms.domain.CompanyJobLive;
|
||||
import com.ruoyi.cms.service.impl.CompanyJobLiveServiceImpl;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业直播带岗Controller
|
||||
*
|
||||
* @author chenyanchang
|
||||
* @date 2026-06-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/live")
|
||||
@Api(tags = "后台:企业直播带岗管理")
|
||||
public class AppCompanyJobLiveController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private CompanyJobLiveServiceImpl companyJobLiveService;
|
||||
|
||||
/**
|
||||
* 企业直播带岗列表
|
||||
*/
|
||||
@ApiOperation("企业直播带岗列表")
|
||||
// @PreAuthorize("@ss.hasPermi('cms:live-all:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CompanyJobLive companyJobLive)
|
||||
{
|
||||
startPage();
|
||||
List<CompanyJobLive> list = companyJobLiveService.selectAll(companyJobLive);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
|
||||
import com.ruoyi.cms.domain.CompanyJobLive;
|
||||
import com.ruoyi.cms.domain.query.CompanySearch;
|
||||
import com.ruoyi.cms.service.ICompanyService;
|
||||
import com.ruoyi.cms.service.impl.CompanyJobLiveServiceImpl;
|
||||
import com.ruoyi.cms.util.RoleUtils;
|
||||
import com.ruoyi.cms.util.sensitiveWord.SensitiveWordChecker;
|
||||
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.domain.entity.Company;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业直播带岗Controller
|
||||
*
|
||||
* @author chenyanchang
|
||||
* @date 2026-06-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/live")
|
||||
@Api(tags = "后台:企业直播带岗管理")
|
||||
public class CompanyJobLiveController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private CompanyJobLiveServiceImpl companyJobLiveService;
|
||||
|
||||
// /**
|
||||
// * 企业直播带岗列表
|
||||
// */
|
||||
// @ApiOperation("企业直播带岗列表")
|
||||
// @PreAuthorize("@ss.hasPermi('cms:live-all:list')")
|
||||
// @GetMapping("/all/list")
|
||||
// public TableDataInfo list()
|
||||
// {
|
||||
// startPage();
|
||||
// List<CompanyJobLive> list = companyJobLiveService.selectAll();
|
||||
// return getDataTable(list);
|
||||
// }
|
||||
|
||||
@ApiOperation("获取直播详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('cms:live:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(companyJobLiveService.selectById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("新增直播带岗")
|
||||
@PreAuthorize("@ss.hasPermi('cms:live:add')")
|
||||
@Log(title = "企业带岗直播", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody CompanyJobLive companyJobLive)
|
||||
{
|
||||
return toAjax(companyJobLiveService.insert(companyJobLive));
|
||||
}
|
||||
|
||||
@ApiOperation("修改直播带岗")
|
||||
@PreAuthorize("@ss.hasPermi('cms:live:edit')")
|
||||
@Log(title = "企业直播带岗", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody CompanyJobLive companyJobLive)
|
||||
{
|
||||
return toAjax(companyJobLiveService.update(companyJobLive));
|
||||
}
|
||||
|
||||
@ApiOperation("删除企业直播带岗")
|
||||
@PreAuthorize("@ss.hasPermi('cms:live:remove')")
|
||||
@Log(title = "企业直播带岗", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
{
|
||||
return toAjax(companyJobLiveService.delete(id));
|
||||
}
|
||||
|
||||
@ApiOperation("按企业id查询公司直播带岗列表")
|
||||
@PreAuthorize("@ss.hasPermi('cms:live:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo listPage()
|
||||
{
|
||||
startPage();
|
||||
List<CompanyJobLive> list = companyJobLiveService.selectByCompanyId();
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业直播带岗位
|
||||
* @author chenyanchang
|
||||
* @date 2026-06-17
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("企业直播带岗")
|
||||
@TableName(value = "company_job_live")
|
||||
public class CompanyJobLive extends BaseEntity
|
||||
{
|
||||
@TableField(exist = false)
|
||||
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 liveUrl;
|
||||
|
||||
@Excel(name = "直播描述")
|
||||
@ApiModelProperty("直播描述")
|
||||
private String description;
|
||||
|
||||
@Excel(name = "开始时间")
|
||||
@ApiModelProperty("开始时间")
|
||||
private String startTime;
|
||||
|
||||
@Excel(name = "结束时间")
|
||||
@ApiModelProperty("结束时间")
|
||||
private String endTime;
|
||||
|
||||
|
||||
@ApiModelProperty("公司ID")
|
||||
private Long companyId;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "公司名称")
|
||||
@ApiModelProperty("公司名称")
|
||||
private String companyName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.ruoyi.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.cms.domain.CompanyJobLive;
|
||||
import com.ruoyi.cms.domain.query.CompanySearch;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 直播带岗Mapper接口
|
||||
* @author chenyanchang
|
||||
* @date 2026-06-17
|
||||
*/
|
||||
@Mapper
|
||||
public interface CompanyJobLiveMapper extends BaseMapper<CompanyJobLive>
|
||||
{
|
||||
|
||||
List<CompanyJobLive> selectAll(CompanyJobLive companyJobLive);
|
||||
|
||||
List<CompanyJobLive> selectByCompanyId(@Param("companyId") Long companyId);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.cms.domain.CompanyCard;
|
||||
import com.ruoyi.cms.domain.CompanyJobLive;
|
||||
import com.ruoyi.cms.domain.query.CompanySearch;
|
||||
import com.ruoyi.cms.domain.query.LabelQuery;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业直播带岗Service接口
|
||||
*
|
||||
* @author chenyanchang
|
||||
* @date 2026-06-17
|
||||
*/
|
||||
public interface ICompanyJobLiveService
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询公司列表
|
||||
*
|
||||
* @param id
|
||||
* @return 公司集合
|
||||
*/
|
||||
public CompanyJobLive selectById(Long id);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public int insert(CompanyJobLive companyJobLive);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public int update(CompanyJobLive companyJobLive);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public int delete(Long id);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
* @return
|
||||
*/
|
||||
List<CompanyJobLive> selectAll(CompanyJobLive companyJobLive);
|
||||
|
||||
/**
|
||||
* 按公司id查询
|
||||
* @return
|
||||
*/
|
||||
List<CompanyJobLive> selectByCompanyId();
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.cms.domain.CompanyJobLive;
|
||||
import com.ruoyi.cms.mapper.CompanyJobLiveMapper;
|
||||
import com.ruoyi.cms.mapper.CompanyMapper;
|
||||
import com.ruoyi.cms.service.ICompanyJobLiveService;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: chenyanchang
|
||||
* @Date: 2026/6/17 下午1:44
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class CompanyJobLiveServiceImpl implements ICompanyJobLiveService {
|
||||
|
||||
@Autowired
|
||||
private CompanyJobLiveMapper companyJobLiveMapper;
|
||||
|
||||
@Autowired
|
||||
private CompanyMapper companyMapper;
|
||||
|
||||
@Override
|
||||
public CompanyJobLive selectById(Long id) {
|
||||
return companyJobLiveMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(CompanyJobLive companyJobLive) {
|
||||
return companyJobLiveMapper.insert(companyJobLive);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(CompanyJobLive companyJobLive) {
|
||||
return companyJobLiveMapper.updateById(companyJobLive);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id) {
|
||||
return companyJobLiveMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompanyJobLive> selectAll(CompanyJobLive companyJobLive) {
|
||||
return companyJobLiveMapper.selectAll(companyJobLive);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompanyJobLive> selectByCompanyId() {
|
||||
LoginUser logUser = SecurityUtils.getLoginUser();
|
||||
SysUser sysUser = logUser.getUser();
|
||||
Company company = companyMapper.selectOne(Wrappers.lambdaQuery(Company.class).eq(Company::getCode, sysUser.getIdCard()).orderByDesc(Company::getUpdateTime).last("LIMIT 1"));
|
||||
return companyJobLiveMapper.selectByCompanyId(company.getCompanyId());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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.ruoyi.cms.mapper.CompanyJobLiveMapper">
|
||||
|
||||
<resultMap type="CompanyJobLive" id="CompanyJobLiveResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="title" column="title" />
|
||||
<result property="liveUrl" column="live_url" />
|
||||
<result property="description" column="description" />
|
||||
<result property="startTime" column="start_time" />
|
||||
<result property="endTime" column="end_time" />
|
||||
<result property="companyId" column="company_id" />
|
||||
<result property="companyName" column="company_name" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCompanyJobLiveVo">
|
||||
select l.id, l.title, l.live_url, l.description, l.start_time, l.end_time, l.company_id, c.name company_name, l.create_by, l.create_time, l.update_by, l.update_time
|
||||
from company_job_live l
|
||||
left join company c on l.company_id = c.company_id
|
||||
</sql>
|
||||
|
||||
<select id="selectAll" parameterType="companyJobLive" resultMap="CompanyJobLiveResult">
|
||||
<include refid="selectCompanyJobLiveVo"/>
|
||||
where 1=1
|
||||
<if test="title != null and title != ''">
|
||||
and l.title like CONCAT('%',#{title},'%')
|
||||
</if>
|
||||
<if test="companyName != null and companyName != ''">
|
||||
and c.name like CONCAT('%',#{companyName},'%')
|
||||
</if>
|
||||
order by l.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectByCompanyId" resultMap="CompanyJobLiveResult">
|
||||
<include refid="selectCompanyJobLiveVo"/>
|
||||
where l.company_id = #{companyId}
|
||||
order by l.create_time desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user