package com.zd.laboratory.controller;

import com.zd.common.core.domain.per.PerFun;
import com.zd.common.core.domain.per.PerPrefix;
import com.zd.common.core.utils.SecurityUtils;
import com.zd.common.core.utils.poi.ExcelUtil;
import com.zd.common.core.web.controller.BaseController;
import com.zd.common.core.web.domain.AjaxResult;
import com.zd.common.core.web.page.TableDataInfo;
import com.zd.common.log.annotation.Log;
import com.zd.common.log.enums.BusinessType;
import com.zd.common.security.annotation.PreAuthorize;
import com.zd.laboratory.domain.LabViolation;
import com.zd.laboratory.domain.dto.LabViolationDTO;
import com.zd.laboratory.domain.vo.LabViolationVO;
import com.zd.laboratory.service.ILabViolationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * my违规记录Controller
 *
 * @author zhoupan
 * @date 2021-09-01
 */
@RestController
@Api(tags = {"我的违规记录"})
@RequestMapping("/violation/my")
public class LabMyViolationController extends BaseController {
    @Autowired
    private ILabViolationService labViolationService;

    /**
     * 查询my的违规记录列表
     */
    @ApiOperation("查询my违规记录列表")
    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_MYVIOLATION + PerFun.LIST)
    @GetMapping("/list")
    public TableDataInfo list(LabViolationDTO labViolation) {
        //设置当前用户
        labViolation.setJoinUserId(SecurityUtils.getUserId());
        startPage();
        List<LabViolationVO> list = labViolationService.selectLabViolationVOList(labViolation);
        return getDataTable(list);
    }


}
