WXDao_getUserAccessory.sql 1.2 KB

12345678910111213141516171819202122232425
  1. select
  2. user.id userid,
  3. openid,
  4. user.mobilePhone mobilePhone,
  5. post.post_name post,
  6. baseuser.realname userName,
  7. max(case acc.gatet_type when 'shenfenzhengfuyinjian2' then file.file_url else '' end ) picture0id,
  8. max(case acc.gatet_type when 'zhengshencailiao5' then file.file_url else '' end) picture1id,
  9. max(case acc.gatet_type when 'zhengshencailiao6' then file.file_url else '' end) picture2id,
  10. max(case acc.gatet_type when 'tijianbiao1' then file.file_url else '' end) picture3id,
  11. max(case acc.gatet_type when 'tijianbaogao7' then file.file_url else '' end) picture4id,
  12. max(case acc.gatet_type when 'hukoubenshouye3' then file.file_url else '' end) picture5id,
  13. max(case acc.gatet_type when 'hukoubenbenrenye4' then file.file_url else '' end) picture6id
  14. from t_bus_accessory acc
  15. left join t_sys_file file on file.busi_id = acc.id
  16. left join t_s_user user on acc.userid = user.id
  17. LEFT JOIN t_bus_user_personnel AS userpersonnel ON user.id = userpersonnel.userid
  18. left join t_bus_post post on userpersonnel.in_postid = post.id
  19. left join t_s_base_user baseuser on user.id = baseuser.id
  20. where acc.delete_flag = '0'
  21. and baseuser.delete_flag <> '1'
  22. <#if userid ?exists && userid ?length gt 0>
  23. AND user.id = :userid
  24. </#if>
  25. group by openid,userid,mobilePhone,post,userName