lixiaojun
2022-08-02 66b07025421f9a1c68c9298b3cc8345280bfc0c7
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
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/ProductModifyRecord")]
    [ApiVersion("v1")]
    public class ProductModifyRecord_StandardController : ApiController
    {
 
        private readonly Service.ProductModifyRecord _service = new Service.ProductModifyRecord();
 
        /// <summary>
        /// 通过 ProductID 获取
        /// </summary>
        [Route("GetByProductID")]
        [HttpGet]
        public Result GetByProductID(long CorpID, long ProductID)
        {
            if (CorpID < 1)
            {
                return new Result(Code.Alert, "CorpID 参数错误");
            }
            if (ProductID < 1)
            {
                return new Result(Code.Alert, "ProductID 参数错误");
            }
            var list = _service.GetByProductID(CorpID,ProductID);
            var vm_list = list?.Select(x => new ViewModel.ProductModifyRecord(x)).ToList();
            var service_file = new Service.AttachmentFile();
            vm_list.ForEach(x=>x.FileCount=service_file.GetCountByBelongTypeAndBelongID(x.CorpID,IStation.ObjectType.Product_设备变更记录,x.ID));
            return new Result<List<ViewModel.ProductModifyRecord>>(vm_list);
        }
 
 
 
 
    }
}