123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- package com.ruoyi.project.plant.controller;
- import java.util.List;
- import com.ruoyi.project.plant.domain.TConfRoom;
- import com.ruoyi.project.plant.mapper.TConfInfoMapper;
- import com.ruoyi.project.plant.mapper.TConfRoomMapper;
- import com.ruoyi.project.plant.service.ITConfRoomService;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.PutMapping;
- import org.springframework.web.bind.annotation.DeleteMapping;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import com.ruoyi.framework.aspectj.lang.annotation.Log;
- import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
- import com.ruoyi.project.plant.domain.TConfInfo;
- import com.ruoyi.project.plant.service.ITConfInfoService;
- import com.ruoyi.framework.web.controller.BaseController;
- import com.ruoyi.framework.web.domain.AjaxResult;
- import com.ruoyi.common.utils.poi.ExcelUtil;
- import com.ruoyi.framework.web.page.TableDataInfo;
- import javax.annotation.Resource;
- /**
- * 会议预约信息Controller
- *
- * @author ssy
- * @date 2024-05-07
- */
- @RestController
- @RequestMapping("/plant/confInfo")
- public class TConfInfoController extends BaseController
- {
- @Autowired
- private ITConfInfoService tConfInfoService;
- @Autowired
- private ITConfRoomService tConfRoomService;
- @Resource
- private TConfRoomMapper tConfRoomMapper;
- @Resource
- private TConfInfoMapper tConfInfoMapper;
- /**
- * 查询会议预约信息列表
- */
- @PreAuthorize("@ss.hasPermi('plant:confInfo:list')")
- @GetMapping("/list")
- public TableDataInfo list(TConfInfo tConfInfo)
- {
- startPage();
- List<TConfInfo> list = tConfInfoService.selectTConfInfoList(tConfInfo);
- return getDataTable(list);
- }
- /**
- * 导出会议预约信息列表
- */
- @PreAuthorize("@ss.hasPermi('plant:confInfo:export')")
- @Log(title = "会议预约信息", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult export(TConfInfo tConfInfo)
- {
- List<TConfInfo> list = tConfInfoService.selectTConfInfoList(tConfInfo);
- ExcelUtil<TConfInfo> util = new ExcelUtil<TConfInfo>(TConfInfo.class);
- return util.exportExcel(list, "confInfo");
- }
- /**
- * 获取会议预约信息详细信息
- */
- @PreAuthorize("@ss.hasPermi('plant:confInfo:query')")
- @GetMapping(value = "/{id}")
- public AjaxResult getInfo(@PathVariable("id") Long id)
- {
- return AjaxResult.success(tConfInfoService.selectTConfInfoById(id));
- }
- /**
- * 新增会议预约信息
- */
- @PreAuthorize("@ss.hasPermi('plant:confInfo:add')")
- @Log(title = "会议预约信息", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody TConfInfo tConfInfo)
- {
- //判断会议时间是否合法
- if (!this.checktime(tConfInfo)) {
- return AjaxResult.error("会议时间冲突");
- }
- TConfRoom room = tConfRoomService.selectTConfRoomById(tConfInfo.getRoomId());
- tConfInfo.setRoomName(room.getRoomName());
- return toAjax(tConfInfoService.insertTConfInfo(tConfInfo));
- }
- /**
- * 修改会议预约信息
- */
- @PreAuthorize("@ss.hasPermi('plant:confInfo:edit')")
- @Log(title = "会议预约信息", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody TConfInfo tConfInfo)
- {
- TConfRoom room = tConfRoomService.selectTConfRoomById(tConfInfo.getRoomId());
- tConfInfo.setRoomName(room.getRoomName());
- return toAjax(tConfInfoService.updateTConfInfo(tConfInfo));
- }
- /**
- * 删除会议预约信息
- */
- @PreAuthorize("@ss.hasPermi('plant:confInfo:remove')")
- @Log(title = "会议预约信息", businessType = BusinessType.DELETE)
- @DeleteMapping("/{ids}")
- public AjaxResult remove(@PathVariable Long[] ids)
- {
- return toAjax(tConfInfoService.deleteTConfInfoByIds(ids));
- }
- public boolean checktime(TConfInfo tConfInfo) {
- List<TConfInfo> list = tConfInfoMapper.selectTConfInfoByTime(tConfInfo);
- if (list.size() > 0) {
- return false;
- }
- return true;
- };
- }
|