UserDepartOrgDealMiniDao_getProjectDepartAll.sql 949 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <#-- 部门信息表 -->
  2. <#-- 查询所有项目 -->
  3. SELECT
  4. tsd.id,
  5. tsd.parentdepartid,
  6. tsd.departname,
  7. tsd.org_code AS orgCode,
  8. tsd.org_type AS orgType,
  9. tsd.status,
  10. tsd.fincode as finCode
  11. FROM
  12. t_s_depart tsd
  13. where 1=1 and tsd.parentdepartid = '4028e4a55f6c84ec015f6ca5c6ab0001'
  14. <#if ( projectDepartDto.orgTypeList )?? && projectDepartDto.orgTypeList ?size gt 0>
  15. and tsd.org_type in(
  16. <#list projectDepartDto.orgTypeList as item>
  17. '${item}'
  18. <#if item_has_next>,</#if>
  19. </#list>
  20. )
  21. <#else >
  22. and tsd.org_type=null
  23. </#if>
  24. <#if ( projectDepartDto.departName )?? && projectDepartDto.departName ?length gt 0>
  25. and tsd.departname like CONCAT('%', :projectDepartDto.departName ,'%')
  26. </#if>
  27. <#if ( projectDepartDto.userid )?? && projectDepartDto.userid ?length gt 0>
  28. and tsd.id in (
  29. select org.org_id from t_s_user_org org where org.user_id=:projectDepartDto.userid and org.status=0
  30. )
  31. </#if>
  32. and tsd.status = '0'