<if test="userRole != null and userId != null"> case #{userRole} when "SALES_STAFF" then (and a.salesmanId = #{userId}) when "FINANCE_STAFF" then (and a.financeId = #{userId}) when "DESIGN_STAFF" then (and a.designId = #{userId}) when "PRODUCTION_STAFF" then (and a.produceId = #{userId}) when "TEST_STAFF" then (and a.testId = #{userId}) when "AFTER_SALE_STAFF" then (and a.ministerId = #{userId}) end </if> userRole = "SALES_STAFF" userId = 11 形成的sql
时间: 2024-04-08 19:30:08 浏览: 110
如何使用CASE WHEN语法判断入参代替if test=user-name != null and user-name !=
根据您提供的信息,形成的SQL语句如下:
```sql
case #SALES_STAFF
when "SALES_STAFF" then (and a.salesmanId = 11)
when "FINANCE_STAFF" then (and a.financeId = 11)
when "DESIGN_STAFF" then (and a.designId = 11)
when "PRODUCTION_STAFF" then (and a.produceId = 11)
when "TEST_STAFF" then (and a.testId = 11)
when "AFTER_SALE_STAFF" then (and a.ministerId = 11)
end
```
请注意,这只是一个片段,可能还有其他的SQL语句部分。
阅读全文