驼峰转下划线 别名问题 返回

SqlSugar 沟通中
4 143
该叫什么 华强 发布于1周前
悬赏:0 飞吻

表名,列名已经通过,驼峰转下划线,但是子查询 select 一个实体对象后,别名没有转下划线,全部转成了小写,导致子查询sql 错误

sql如下:

SELECT

"l"."registration_id" AS "registrationid",

"r"."registration_org_id" AS "registrationorgid",

"r"."registration_org_name" AS "registrationorgname",

"r"."registration_department_id" AS "registrationdepartmentid",

"r"."registration_department_name" AS "registrationdepartmentname",

"r"."registration_staff_id" AS "registrationstaffid",

"r"."registration_staff_no" AS "registrationstaffno",

"r"."registration_staff_name" AS "registrationstaffname",

"r"."category_id" AS "categoryid",

"r"."category_name" AS "categoryname",

"r"."material_id" AS "materialid",

"r"."specification" AS "specification",

"bo"."id" AS "proorgid",

"bo"."org_name" AS "proorgname",

"bd"."id" AS "prodepartmentid",

"bd"."department_name" AS "prodepartmentname" 

FROM

"n_j_waste_handover_line" "l"

LEFT JOIN (

SELECT

"d"."id" AS "registrationid",

"d"."org_id" AS "registrationorgid",

"bo"."org_name" AS "registrationorgname",

"d"."department_id" AS "registrationdepartmentid",

"bd"."department_name" AS "registrationdepartmentname",

"d"."staff_id" AS "registrationstaffid",

"bs"."staff_no" AS "registrationstaffno",

"bs"."staff_name" AS "registrationstaffname",

"bm"."category_id" AS "categoryid",

"bc"."category_name" AS "categoryname",

"d"."material_id" AS "materialid",

"bm"."specification" AS "specification" 

FROM

"fabric_registration" "d"

LEFT JOIN "base_staff" "bs" ON ( "d"."staff_id" = "bs"."id" ) 

AND ( "bs"."is_delete" = FALSE )

LEFT JOIN "base_department" "bd" ON ( "d"."department_id" = "bd"."id" ) 

AND ( "bd"."is_delete" = FALSE )

LEFT JOIN "base_org" "bo" ON ( "d"."org_id" = "bo"."id" ) 

AND ( "bo"."is_delete" = FALSE )

LEFT JOIN "base_material" "bm" ON ( "d"."material_id" = "bm"."id" ) 

AND ( "bm"."is_delete" = FALSE )

LEFT JOIN "base_category" "bc" ON ( "bm"."category_id" = "bc"."id" ) 

AND ( "bc"."is_delete" = FALSE ) 

WHERE

( "d"."is_delete" = FALSE ) 

) "r" ON ( "l"."registration_id" = "r"."registrationid" )

LEFT JOIN "pro_recovery_line" "prl" ON ( "prl"."registration_id" = "l"."source_table_id" ) 

AND ( "prl"."is_delete" = FALSE )

LEFT JOIN "pro_recovery" "pr" ON ( "pr"."id" = "prl"."recovery_id" ) 

AND ( "pr"."is_delete" = FALSE )

LEFT JOIN "base_department_area" "bda" ON ( "bda"."id" = "pr"."department_area_id" ) 

AND ( "bda"."is_delete" = FALSE )

LEFT JOIN "base_department" "bd" ON ( "bda"."id" = "pr"."department_area_id" ) 

AND ( "bd"."is_delete" = FALSE )

LEFT JOIN "base_org" "bo" ON ( "bo"."id" = "bd"."org_id" ) 

AND ( "bo"."is_delete" = FALSE ) 

WHERE

( "l"."waste_handover_id" = N 'bf7e03ab-bb96-452a-875f-52d506d54aad' ) 

AND ( "l"."is_delete" = FALSE )


热忱回答4

  • 提供代码

    0 回复
  • 是不是写select后面了,一般要写select前面。

    0 回复
  • 代码和关键SQL描述清楚

    0 回复
  • 谢谢 解决了,我在驼峰转下划线配置那里,过滤了自定义的dto 

    0 回复