hytos / ID2.Manager / ID2.Manager.Dapper / Repository / ID2Repository.cs @ 7066b8a9
이력 | 보기 | 이력해설 | 다운로드 (1.54 KB)
1 | be2dacfc | yoush97 | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Text; |
||
5 | using System.Threading.Tasks; |
||
6 | |||
7 | using System.Data.SQLite; |
||
8 | |||
9 | using ID2.Manager.Data.Models; |
||
10 | |||
11 | namespace ID2.Manager.Dapper.Repository |
||
12 | { |
||
13 | public class ID2Repository : BaseRepository |
||
14 | { |
||
15 | public ID2Repository(string connectionStr, DatabaseType databaseType) : base(connectionStr, databaseType) { } |
||
16 | |||
17 | 81d15568 | yoush97 | public IEnumerable<ID2ProjectInfo> GetID2ProjectList() |
18 | be2dacfc | yoush97 | { |
19 | e8b34346 | yoush97 | IEnumerable<ID2ProjectInfo> results = null; |
20 | |||
21 | try |
||
22 | { |
||
23 | string query = $@" |
||
24 | 473ee829 | yoush97 | select pj.Id, pj.ProjectID, pj.ProjectNo, pj.Name, pj.Desc, pj.Unit, pj.NPSUnit, pj.Path, pj.AreaName, pj.PlantName, pj.CreatedDate, pj.UpdatedDate |
25 | ,ty.UID as DBTypeID ,ty.Name as DBTypeName |
||
26 | ,db.Host, db.User, db.Password, db.FilePath as DBPath |
||
27 | from ( |
||
28 | select p.* |
||
29 | from Projects p |
||
30 | inner join |
||
31 | ( |
||
32 | select Min(Id) as Id, Name |
||
33 | from Projects |
||
34 | where ifnull(Name, '') <> '' |
||
35 | group by Name |
||
36 | ) g on p.Id=g.Id |
||
37 | ) pj |
||
38 | inner join DBSettings db on pj.Id=db.Projects_UID |
||
39 | inner join DBTypes ty on db.DBTypes_UID=ty.UID |
||
40 | order by pj.Id;"; |
||
41 | 1abdd7c3 | yoush97 | |
42 | e8b34346 | yoush97 | results = Query<ID2ProjectInfo>(query); |
43 | } |
||
44 | catch |
||
45 | { |
||
46 | results = new List<ID2ProjectInfo>(); |
||
47 | } |
||
48 | |||
49 | return results; |
||
50 | be2dacfc | yoush97 | } |
51 | } |
||
52 | } |