package com.hxhq.business.controller;

import com.hxhq.business.dto.gyzj.FfjlListDto;
import com.hxhq.business.dto.gyzj.ListDto;
import com.hxhq.business.form.gyzj.ArchiveForm;
import com.hxhq.business.form.gyzj.FfjlSearchForm;
import com.hxhq.business.form.gyzj.SearchForm;
import com.hxhq.business.service.IGyzjFfjlService;
import com.hxhq.common.core.web.controller.BaseController;
import com.hxhq.common.core.web.domain.AjaxResult;
import com.hxhq.common.core.web.page.TableDataInfo;
import com.hxhq.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;


/**
 * 给药制剂发放记录档案Controller
 *
 * @author hxhq
 * @date 2025-12-18
 */
@RestController
@RequestMapping("/business/gyzjFfjlArchive")
public class GyzjFfjlArchiveController extends BaseController
{
    @Autowired
    private IGyzjFfjlService gyzjFfjlService;


    /**
     * 列表
     */
    @RequiresPermissions("business:archive:gyzjFfjl:list")
    @GetMapping("/list")
    public TableDataInfo list(FfjlSearchForm form)
    {
        startPage();
        List<FfjlListDto> list = gyzjFfjlService.queryArchiveList(form);
        return getDataTable(list);
    }

    /**
     * 同意归档
     */
    @PostMapping("/tygd")
    @RequiresPermissions("business:archive:gyzjFfjl:tygd")
    public AjaxResult tygd(@RequestBody ArchiveForm form)
    {
        gyzjFfjlService.tygd(form);
        return AjaxResult.success("操作成功");
    }


    /**
     * 拒绝归档
     */
    @PostMapping("/jjgd")
    @RequiresPermissions("business:archive:gyzjFfjl:jjgd")
    public AjaxResult jjgd(@RequestBody ArchiveForm form)
    {
        gyzjFfjlService.jjgd(form);
        return AjaxResult.success("操作成功");
    }

    /**
     * 同意解档
     */
    @PostMapping("/tyjd")
    @RequiresPermissions("business:archive:gyzjFfjl:tyjd")
    public AjaxResult tyjd(@RequestBody ArchiveForm form)
    {
        gyzjFfjlService.tyjd(form);
        return AjaxResult.success("操作成功");
    }


    /**
     * 拒绝解档
     */
    @PostMapping("/jjjd")
    @RequiresPermissions("business:archive:gyzjFfjl:jjjd")
    public AjaxResult jjjd(@RequestBody ArchiveForm form)
    {
        gyzjFfjlService.jjjd(form);
        return AjaxResult.success("操作成功");
    }

    /**
     * 同意借阅
     */
    @PostMapping("/tyjy")
    @RequiresPermissions("business:archive:gyzjFfjl:tyjy")
    public AjaxResult tyjy(@RequestBody ArchiveForm form)
    {
        gyzjFfjlService.tyjy(form);
        return AjaxResult.success("操作成功");
    }


    /**
     * 拒绝借阅
     */
    @PostMapping("/jjjy")
    @RequiresPermissions("business:archive:gyzjFfjl:jjjy")
    public AjaxResult jjjy(@RequestBody ArchiveForm form)
    {
        gyzjFfjlService.jjjy(form);
        return AjaxResult.success("操作成功");
    }


    /**
     * 确认归还
     */
    @PostMapping("/qrgh")
    @RequiresPermissions("business:archive:gyzjFfjl:qrgh")
    public AjaxResult qrgh(@RequestBody ArchiveForm form)
    {
        gyzjFfjlService.qrgh(form);
        return AjaxResult.success("操作成功");
    }

}
