package com.jg.project.about.controller;
import java.util.List;
import javax.annotation.Resource;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jg.common.utils.ListPage;
import com.jg.common.utils.PageUtils;
import com.jg.common.utils.QueryPage;
import com.jg.framework.web.controller.BaseController;
import com.jg.framework.web.page.TableDataInfo;
import com.jg.project.about.mapper.AboutPartThreeMapper;
import lombok.extern.slf4j.Slf4j;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jg.project.about.domain.AboutPartThree;
import com.jg.project.about.service.IAboutPartThreeService;
import com.jg.framework.web.domain.R;

/**
 * 关于第三部分Controller
 *
 * @author wyd
 * @date 2024-04-19
 */
@Slf4j
@Api(tags = "关于第三部分")
@RestController
@RequestMapping("/PartThree")
public class AboutPartThreeController extends BaseController {
    @Resource
    private IAboutPartThreeService aboutPartThreeService;

    /**
     * 关于第三部分列表
     */
    @PreAuthorize("@ss.hasPermi('PartThree:partthree:list')")
    @ApiOperation(value = "关于第三部分列表", notes = "关于第三部分列表信息")
    @GetMapping("/list")
    public R<List<AboutPartThree>> list() {
        List<AboutPartThree> list = aboutPartThreeService.list();
        return R.ok(list);
    }
    /**
     * 关于第三部分分页列表
     */
    @PreAuthorize("@ss.hasPermi('PartThree:partthree:listpage')")
    @ApiOperation(value = "关于第三部分分页列表", notes = "关于第三部分分页列表信息")
    @PostMapping("/listPage")
    public R listPage(QueryPage queryPage, AboutPartThree aboutPartThree) {
        startPage();
        List<AboutPartThree> list = aboutPartThreeService.selectAboutPartThreeList(aboutPartThree);
        return R.page(queryPage.getPageNum(),queryPage.getPageSize(),list.size(),list);
    }
    /**
     * 关于第三部分id详细信息
     */
    @PreAuthorize("@ss.hasPermi('PartThree:partthree:query')")
    @ApiOperation(value = "关于第三部分id详细信息", notes = "关于第三部分id详细信息")
    @GetMapping("/query")
    public R<AboutPartThree> query(Long  id) {
       AboutPartThree queryinfo = aboutPartThreeService.getById(id);
        return R.ok(queryinfo);
    }
    /**
     * 关于第三部分新增信息
     */
    @PreAuthorize("@ss.hasPermi('PartThree:partthree:add')")
    @ApiOperation(value = "关于第三部分新增信息", notes = "关于第三部分新增信息")
    @PostMapping("/add")
    public R<Boolean> add(AboutPartThree aboutPartThree) {
        boolean res = aboutPartThreeService.save(aboutPartThree);
        return R.ok(res);
    }
    /**
     * 关于第三部分修改信息
     */
    @PreAuthorize("@ss.hasPermi('PartThree:partthree:edit')")
    @ApiOperation(value = "关于第三部分修改信息", notes = "关于第三部分修改信息")
    @PostMapping("/edit")
    public R<Boolean> edit(AboutPartThree aboutPartThree) {
        boolean res = aboutPartThreeService.updateById(aboutPartThree);
        return R.ok(res);
    }
    /**
     * 关于第三部分删除信息
     */
    @PreAuthorize("@ss.hasPermi('PartThree:partthree:remove')")
    @ApiOperation(value = "关于第三部分删除信息", notes = "关于第三部分删除信息")
    @PostMapping("/remove")
    public R<Boolean> remove(Long id) {
        boolean res = aboutPartThreeService.removeById(id);
        return R.ok(res);
    }
}
