亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

前者能夠獲取到我要的數據,后者我怎么都是0? 請問這兩段代碼有什么不同?

前者能夠獲取到我要的數據,后者我怎么都是0? 請問這兩段代碼有什么不同?

白衣非少年 2023-03-21 17:13:40
數據庫 MySQL 開發環境 SSH 第一段原生態sql語句: select lookum_crop_ids, capture_time, gene_symbol, patch_id, max(case when gene_ids = 23 then gene_real else 0 end) as kw, max(case when gene_ids = 24 then gene_real else 0 end) as ks, max(case when gene_ids = 25 then gene_real else 0 end) as co2, max(case when gene_ids = 26 then gene_real else 0 end) as gz, max(case when gene_ids = 27 then gene_real else 0 end) as tw, max(case when gene_ids = 28 then gene_real else 0 end) as ts from lookum_monitor_hisinfo where 1=1 and lookum_crop_ids = 67 group by patch_id, lookum_crop_ids; 第二段是經過hibernate加工后的hql select lookummoni0_.lookum_crop_ids as col_0_0_, lookummoni0_.capture_time as col_1_0_, lookummoni0_.gene_symbol as col_2_0_, lookummoni0_.patch_id as col_3_0_, max(case when lookummoni0_.cropgene_ids=23 then lookummoni0_.gene_real else 0 end) as col_4_0_, max(case when lookummoni0_.cropgene_ids=24 then lookummoni0_.gene_real else 0 end) as col_5_0_, max(case when lookummoni0_.cropgene_ids=25 then lookummoni0_.gene_real else 0 end) as col_6_0_, max(case when lookummoni0_.cropgene_ids=26 then lookummoni0_.gene_real else 0 end) as col_7_0_, max(case when lookummoni0_.cropgene_ids=27 then lookummoni0_.gene_real else 0 end) as col_8_0_, max(case when lookummoni0_.cropgene_ids=28 then lookummoni0_.gene_real else 0 end) as col_9_0_ from lookum_monitor_hisinfo lookummoni0_ where 1=1 and lookummoni0_.lookum_crop_ids=67 group by lookummoni0_.patch_id , lookummoni0_.lookum_crop_ids 
查看完整描述

2 回答

?
陪伴而非守候

TA貢獻1757條經驗 獲得超8個贊

如果是注解的話變量與字段要一致, 如果不一致需要添加@Column(name = "xxx")

查看完整回答
反對 回復 2023-03-24
?
Cats萌萌

TA貢獻1805條經驗 獲得超9個贊

上一句case中的字段是gene_ids 
hibernate的語句中case中的字段是cropgene_ids 
2個不是相同的字段,能查出來有鬼了

查看完整回答
反對 回復 2023-03-24
  • 2 回答
  • 0 關注
  • 112 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號