You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							46 lines
						
					
					
						
							1.3 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							46 lines
						
					
					
						
							1.3 KiB
						
					
					
				| using System; | |
| 
 | |
| using System.Collections.Generic; | |
| using Pingchuan.BeijingSafeguard.Model; | |
| 
 | |
| namespace Pingchuan.BeijingSafeguard.DAL | |
| { | |
|     public class TagDAL : BaseDAL | |
|     { | |
|         public static int Add(Tag tag) | |
|         { | |
|            return Convert.ToInt32(db.Insert(tag));   | |
|         } | |
| 
 | |
|         public static void Delete(int tagId) | |
|         { | |
|             db.Execute("DELETE FROM tags WHERE id = @0", tagId); | |
|         } | |
| 
 | |
|         public static void DeleteByTagName(string userId, string taskIds, string tagName) | |
|         { | |
|             string sql = $@"DELETE FROM tags WHERE user_id = {userId} AND task_id IN({taskIds}) AND `name` = '{tagName}'"; | |
|             db.Execute(sql); | |
|         } | |
| 
 | |
|         public static void DeleteByTaskId(string id) | |
|         { | |
|             db.Execute("DELETE FROM tags WHERE task_id = @0", id); | |
|         } | |
| 
 | |
|         public static List<Tag> GetList(int userId) | |
|         { | |
|             string sql = @"SELECT DISTINCT(`name`) FROM tags WHERE user_id = @0"; | |
| 
 | |
|             return db.Fetch<Tag>(sql, userId); | |
|         } | |
| 
 | |
|         public static List<Tag> GetList(int userId, string taskId) | |
|         { | |
|             string sql = $@"select * from tags where user_id = @0 and task_id = @1  | |
|                             order by create_time desc"; | |
| 
 | |
|             return db.Fetch<Tag>(sql, userId, taskId); | |
|         } | |
|     } | |
| } |