UserDepartOrgDealMiniDao_getProjectDepartAllWithChildren.sql 865 B

12345678910111213141516171819202122232425262728293031323334353637
  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. FROM
  11. t_s_depart tsd
  12. where 1=1
  13. <#if ( projectDepartDto.orgTypeList )?? && projectDepartDto.orgTypeList ?size gt 0>
  14. and tsd.org_type in(
  15. <#list projectDepartDto.orgTypeList as item>
  16. '${item}'
  17. <#if item_has_next>,</#if>
  18. </#list>
  19. )
  20. <#else >
  21. and tsd.org_type=null
  22. </#if>
  23. <#if ( projectDepartDto.departName )?? && projectDepartDto.departName ?length gt 0>
  24. and tsd.departname like CONCAT('%', :projectDepartDto.departName ,'%')
  25. </#if>
  26. <#if ( projectDepartDto.userid )?? && projectDepartDto.userid ?length gt 0>
  27. and tsd.id in (
  28. select org.org_id from t_s_user_org org where org.user_id=:projectDepartDto.userid and org.status=0
  29. )
  30. </#if>
  31. and tsd.status = '0'