我一直在构建一个API,它在我尝试添加内连接之前一直工作正常
当我在Beaver中运行时,我正在通过返回的SQL返回(我正在使用Mac)
然而,当我尝试通过我的API端点访问它时,而不是组合结果,我只得到我在连接中添加的表的结果
我认为我做的事情非常愚蠢...
来自我的控制器:
result = dbtest.FromDatabase(
"SELECT A.FAMILY_ID
,A.START_TIME
,A.END_TIME
,A.WORKER_ID
,A.WEEK_NO
,A.ID
,A.SHIFT_NO
,A.DAY_OF_WEEK
,A.HOLIDAY_OR_TERM
,B.WORKER_NAME
FROM SHIFT_REQ_TBL A
INNER JOIN WORKER_TBL B ON A.WORKER_ID = B.WORKER_ID
WHERE A.FAMILY_ID = '" + FAMILY.FAMILY_ID + "'");
从我的模特
if (query.Contains("SHIFT_REQ_TBL"))
{
var tbl_type = new TimekeeperTables.SHIFT_REQ_TBL();
tbl_type.FAMILY_ID = Convert.ToInt32(reader["FAMILY_ID"]);
tbl_type.ID = Convert.ToInt32(reader["ID"]);
tbl_type.WEEK_NO = Convert.ToInt32(reader["WEEK_NO"]);
tbl_type.WORKER_ID = Convert.ToInt32(reader["WORKER_ID"]);
tbl_type.SHIFT_NO = reader["SHIFT_NO"].ToString();
tbl_type.START_TIME = reader["START_TIME"].ToString();
tbl_type.END_TIME = reader["END_TIME"].ToString();
tbl_type.DAY_OF_WEEK = reader["DAY_OF_WEEK"].ToString();
tbl_type.HOLIDAY_OR_TERM = reader["HOLIDAY_OR_TERM"].ToString();
tbl_type.WORKER_NAME = reader["WORKER_NAME"].ToString();
db_results.Add(tbl_type);
jsonDoc = JsonConvert.SerializeObject(db_results);
}
结果(来自邮递员)
" [{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\ " WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \" :1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \ ":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\ " WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \" :1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \ ":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\ " WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \" :1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\&#34 ; UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{ \" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \&#34 ;:1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\&#34 ; UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{ \" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \&#34 ;:1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\&#34 ; UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{ \" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \&#3 4;:1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\&# 34; UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"}, {\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \&# 34;:1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\&# 34; UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"}, {\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \&# 34;:1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\&# 34; UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \" },{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \ ":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\&# 34; WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\ " UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \" },{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \ ":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\&# 34; WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\ " UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \" },{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \ ":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\&# 34; WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \&#34 ;: \" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \&#34 ;},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\& #34; WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \&#34 ;: \" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \&#34 ;},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\& #34; WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \&#34 ;: \" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \&#34 ;},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\& #34; WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \&#34 ;: \" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \&#34 ;},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\& #34; WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \&#34 ;: \" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \&#34 ;},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\& #34; WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \&#34 ;: \" UNASSIGNED \"},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \&#34 ;},{\" WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\&#3 4; WORKER_ID \":1,\" WORKER_NAME \":\" UNASSIGNED \"},{\" WORKER_ID \":1 ,\" WORKER_NAME \":\" UNASSIGNED \"}]"
答案 0 :(得分:0)
对不起,我傻了,想通了
我使用了一种非常愚蠢的方法来识别在早期案例中已经检查SHIFT_TBL的调用URL