tijian_tieying/web/dccdc.DAL/professionalExamProjectResultImgsDal.cs

43 lines
1.4 KiB
C#
Raw Normal View History

2025-02-20 12:14:39 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using dccdc.Models;
using Dapper;
using System.Data;
namespace dccdc.DAL
{
public class professionalExamProjectResultImgsDal
{
public int saveResultImgs(List<ProfessionalExamProjectResultImgsModel> list)
{
using (var conn = CommHelper.GetSqlConnection())
{
string delsql = "delete from professionalExam_project_result_imgs where person_id=@person_id and project_id=@project_id and project_result_id=@project_result_id";
conn.Execute(delsql, list.First());
string sql = "insert into professionalExam_project_result_imgs values";
list.ForEach(item =>
{
sql += "('" + item.person_id + "','" + item.project_id + "','" + item.img_path + "','"
+ item.project_result_id + "','" + item.img_type + "'),";
});
return conn.Execute(sql.TrimEnd(','));
}
}
public List<ProfessionalExamProjectResultImgsModel> getCaiChaoInfo(int resultId)
{
using (IDbConnection conn = CommHelper.GetSqlConnection())
{
string sql = "select * from professionalExam_project_result_imgs where project_result_id = '" + resultId + "' ";
return conn.Query<ProfessionalExamProjectResultImgsModel>(sql).ToList();
}
}
}
}