123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- using Infrastructure;
- using Infrastructure.Attribute;
- using Infrastructure.Enums;
- using Infrastructure.Model;
- using Mapster;
- using Microsoft.AspNetCore.Mvc;
- using ZR.Model.Dto;
- using ZR.Model.Models;
- using ZR.Service.Business.IBusinessService;
- using ZR.Admin.WebApi.Extensions;
- using ZR.Admin.WebApi.Filters;
- using ZR.Common;
- namespace ZR.Admin.WebApi.Controllers
- {
- /// <summary>
- /// 质检管理/质检记录表Controller
- ///
- /// @tableName qa_inspect_record
- /// @author admin
- /// @date 2023-05-05
- /// </summary>
- [Verify]
- [Route("business/QaInspectRecord")]
- public class QaInspectRecordController : BaseController
- {
- /// <summary>
- /// 质检管理/质检记录表接口
- /// </summary>
- private readonly IQaInspectRecordService _QaInspectRecordService;
- public QaInspectRecordController(IQaInspectRecordService QaInspectRecordService)
- {
- _QaInspectRecordService = QaInspectRecordService;
- }
- /// <summary>
- /// 查询质检管理/质检记录表列表
- /// </summary>
- /// <param name="parm"></param>
- /// <returns></returns>
- [HttpGet("list")]
- [ActionPermissionFilter(Permission = "business:qainspectrecord:list")]
- public IActionResult QueryQaInspectRecord([FromQuery] QaInspectRecordQueryDto parm)
- {
- var response = _QaInspectRecordService.GetList(parm);
- return SUCCESS(response);
- }
- /// <summary>
- /// 查询质检管理/质检记录表详情
- /// </summary>
- /// <param name="InspectId"></param>
- /// <returns></returns>
- [HttpGet("{InspectId}")]
- [ActionPermissionFilter(Permission = "business:qainspectrecord:query")]
- public IActionResult GetQaInspectRecord(int InspectId)
- {
- var response = _QaInspectRecordService.GetFirst(x => x.InspectId == InspectId);
- return SUCCESS(response);
- }
- /// <summary>
- /// 添加质检管理/质检记录表
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ActionPermissionFilter(Permission = "business:qainspectrecord:add")]
- [Log(Title = "质检管理/质检记录表", BusinessType = BusinessType.INSERT)]
- public IActionResult AddQaInspectRecord([FromBody] QaInspectRecordDto parm)
- {
- if (parm == null)
- {
- throw new CustomException("请求参数错误");
- }
- var modal = parm.Adapt<QaInspectRecord>().ToCreate(HttpContext);
- var response = _QaInspectRecordService.AddQaInspectRecord(modal);
- return ToResponse(response);
- }
- /// <summary>
- /// 更新质检管理/质检记录表
- /// </summary>
- /// <returns></returns>
- [HttpPut]
- [ActionPermissionFilter(Permission = "business:qainspectrecord:edit")]
- [Log(Title = "质检管理/质检记录表", BusinessType = BusinessType.UPDATE)]
- public IActionResult UpdateQaInspectRecord([FromBody] QaInspectRecordDto parm)
- {
- if (parm == null)
- {
- throw new CustomException("请求实体不能为空");
- }
- var modal = parm.Adapt<QaInspectRecord>().ToUpdate(HttpContext);
- var response = _QaInspectRecordService.UpdateQaInspectRecord(modal);
- return ToResponse(response);
- }
- /// <summary>
- /// 删除质检管理/质检记录表
- /// </summary>
- /// <returns></returns>
- [HttpDelete("{ids}")]
- [ActionPermissionFilter(Permission = "business:qainspectrecord:delete")]
- [Log(Title = "质检管理/质检记录表", BusinessType = BusinessType.DELETE)]
- public IActionResult DeleteQaInspectRecord(string ids)
- {
- int[] idsArr = Tools.SpitIntArrary(ids);
- if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
- var response = _QaInspectRecordService.Delete(idsArr);
- return ToResponse(response);
- }
- }
- }
|