tangxu
2023-03-20 3bf8bf5179de8b83bbd6ad997e82d98302abd1c3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using IStation.Model.Api;
using AutoMapper;
using IStation.WebApi.Models;
using IStation.ViewModel;
using IStation.Untity;
using Microsoft.Web.Http;
 
namespace IStation.WebApi.Controllers
{
    /// <summary>
    /// 附件标准api
    /// </summary>
    [RoutePrefix("v1/Standard/AttachmentFile")]
    [ApiVersion("v1")]
    public class AttachmentFile_StandardController : ApiController
    {
 
        private readonly Service.AttachmentFile _service = new Service.AttachmentFile();
 
        /// <summary>
        /// 通过 BelongType 和 BelongID 获取
        /// </summary>
        [Route("GetByBelongTypeAndBelongID")]
        [HttpGet]
        public Result GetByBelongTypeAndBelongID(long CorpID, string BelongType,long BelongID)
        {
            if (CorpID < 1)
            {
                return new Result(Code.Alert, "CorpID 参数错误");
            }
            if (string.IsNullOrEmpty(BelongType))
            {
                return new Result(Code.Alert, "BelongType 参数错误");
            }
            if (BelongID < 1)
            {
                return new Result(Code.Alert, "BelongID 参数错误");
            }
            var list = _service.GetByBelongTypeAndBelongID(CorpID, BelongType,BelongID);
            var vm_list = list?.Select(x => new ViewModel.AttachmentFile(x)).ToList();
            return new Result<List<ViewModel.AttachmentFile>>(vm_list);
        }
 
 
 
 
    }
}