package com.ruoyi.web.controller.api; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.domain.BasePage; import com.ruoyi.common.core.domain.R; import com.ruoyi.system.model.TBanner; import com.ruoyi.system.model.TEmploymentEntrepreneurship; import com.ruoyi.system.model.TEmploymentInfo; import com.ruoyi.system.service.TEmploymentEntrepreneurshipService; import com.ruoyi.system.service.TEmploymentInfoService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import java.util.List; @Slf4j @RestController @RequestMapping("/employment") @Api(tags = "新就业模块") public class EmploymentController { private final TEmploymentInfoService employmentInfoService; private final TEmploymentEntrepreneurshipService employmentEntrepreneurshipService; public EmploymentController(TEmploymentInfoService employmentInfoService, TEmploymentEntrepreneurshipService employmentEntrepreneurshipService) { this.employmentInfoService = employmentInfoService; this.employmentEntrepreneurshipService = employmentEntrepreneurshipService; } @PostMapping("/getEmploymentInfoList") @ApiOperation(value = "新就业模块--新就业信息列表",response = TEmploymentInfo.class) public R> getEmploymentInfoList(@RequestBody BasePage basePage) { Page page = new Page<>(basePage.getPageNum(), basePage.getPageSize()); Page pageEmploymentInfo = employmentInfoService.page(page, Wrappers.lambdaQuery().orderByDesc(TEmploymentInfo::getCreateTime)); return R.ok(pageEmploymentInfo); } @PostMapping("/getEmploymentInfoDetail/{id}") @ApiOperation(value = "新就业模块--新就业信息详情",response = TEmploymentInfo.class) public R getEmploymentInfoDetail(@PathVariable String id) { TEmploymentInfo employmentInfo = employmentInfoService.getById(id); employmentInfo.setReadCount(employmentInfo.getReadCount() + 1); employmentInfoService.updateById(employmentInfo); return R.ok(employmentInfo); } @PostMapping("/getEntrepreneurshipList") @ApiOperation(value = "创业模块--创业信息列表",response = TEmploymentEntrepreneurship.class) public R> getEntrepreneurshipList(@RequestBody BasePage basePage) { Page page = new Page<>(basePage.getPageNum(), basePage.getPageSize()); Page tEmploymentEntrepreneurshipPage = employmentEntrepreneurshipService.page(page, Wrappers.lambdaQuery().orderByDesc(TEmploymentEntrepreneurship::getCreateTime)); return R.ok(tEmploymentEntrepreneurshipPage); } @PostMapping("/getEntrepreneurshipDetail/{id}") @ApiOperation(value = "创业模块--创业信息详情",response = TEmploymentEntrepreneurship.class) public R getEntrepreneurshipDetail(@PathVariable String id) { TEmploymentEntrepreneurship employmentEntrepreneurship = employmentEntrepreneurshipService.getById(id); employmentEntrepreneurship.setReadCount(employmentEntrepreneurship.getReadCount() + 1); employmentEntrepreneurshipService.updateById(employmentEntrepreneurship); return R.ok(employmentEntrepreneurship); } }