UserTalentSubsidyMiniDao_getAllEntities.sql 1.0 KB

12345678910111213141516171819202122232425
  1. select talent.id id,
  2. talent.user_id userid,
  3. du.id dutiesid,
  4. talent.description as description,
  5. if(talent.money < 0,talentStrategy.money, talent.money) as money,
  6. talent.talent_strategy_id talentStrategyId,
  7. talentStrategy.factor talentStrategyName,
  8. if(talent.money < 0, '1','0') as isDefaultMoney,
  9. u.realname as realname,sus.userNum as userNum, d.departname,d.id as departid,du.duties_name as dutiesname from t_bus_user_talent_subsidy talent
  10. left join t_s_base_user u on u.id = talent.user_id
  11. left join t_s_user sus on u.id= sus.id
  12. LEFT JOIN t_s_user_org uo ON u.ID = uo.user_id and uo.ifpluralism = 0 and uo.status = 0
  13. left join t_s_depart d on uo.org_id = d.id
  14. left join t_bus_user_personnel p on p.userid = u.id
  15. left join t_bus_duties du on du.id = p.belong_dutiesid
  16. left join t_bus_talent_subsidy_strategy talentStrategy on talentStrategy.id = talent.talent_strategy_id
  17. where 1=1
  18. and talent.delete_flag != '1' and u.delete_flag != '1'
  19. <#if (userquery)?? && userquery ?length gt 0>
  20. /* 员工 */
  21. and u.id = :userquery
  22. </#if>