UserwagestrategyMinidaoDao_getExcelPutOut.sql 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. select w.id id,
  2. w.userid userid,
  3. w.belong_unitid belong_unitid,
  4. w.dutiesid dutiesid,
  5. os.strategy_name as overtimepay_strategyid,
  6. ds.strategy_name as duty_strategyid,
  7. ts.subsidy_name as traffic_subsidyid,
  8. ms.subsidy_name as megathermal_subsidyid,
  9. mes.subsidy_name as fixedmeals_subsidyid,
  10. mes1.subsidy_name as nofixedmeals_subsidyid,
  11. ots.subsidy_name as other_subsidyid,
  12. sss.social_security_unit as social_security_strategyid,
  13. pfs.provident_fund_name as provident_fund_strategyid,
  14. w.append_pay append_pay,
  15. w.deduct_pay deduct_pay,
  16. w.daikou_fee daikou_fee,
  17. w.jiaojin_subsidyid jiaojin_subsidyid,
  18. w.project_performance project_performance,
  19. w.onlychild_pay onlychild_pay,
  20. w.strategy_type as strategy_type,
  21. u.realname,u.username,sus.userNum as userNum,dt.departname,d.id as departid,du.duties_name as dutiesname,du.id as dutid,u.id as userids from t_bus_user_wagestrategy w
  22. left join t_s_base_user u on u.id = w.userid
  23. left join t_s_user sus on sus.id = w.userid
  24. LEFT JOIN t_s_user_org uo ON u.ID = uo.user_id and uo.ifpluralism = 0 and uo.status = 0
  25. left join t_s_depart d on uo.org_id = d.id
  26. left join t_s_depart dt on w.pjt_id = dt.id
  27. left join t_bus_user_personnel p on p.userid = u.id
  28. left join t_bus_duties du on du.id = p.belong_dutiesid
  29. LEFT JOIN t_bus_overtimepay_strategy os
  30. ON w.overtimepay_strategyid = os.id and os.status = '0' and os.delete_flag = '0'
  31. LEFT JOIN t_bus_dutyfee_strategy ds
  32. ON w.duty_strategyid = ds.id and ds.status = '0' and ds.delete_flag = '0'
  33. LEFT JOIN t_bus_traffic_subsidy ts
  34. ON w.traffic_subsidyid = ts.id and ts.status = '0' and ts.delete_flag = '0'
  35. LEFT JOIN t_bus_megathermal_subsidy ms
  36. ON w.megathermal_subsidyid = ms.id and ms.status = '0' and ms.delete_flag = '0'
  37. LEFT JOIN t_bus_meals_subsidy mes
  38. ON w.fixedmeals_subsidyid = mes.id and mes.status = '0' and mes.delete_flag = '0' and mes.subsidy_type = 'anyueguding'
  39. LEFT JOIN t_bus_meals_subsidy mes1
  40. ON w.nofixedmeals_subsidyid = mes1.id and mes1.status = '0' and mes1.delete_flag = '0' and mes1.subsidy_type = 'anciguding'
  41. LEFT JOIN t_bus_other_subsidy ots
  42. ON w.other_subsidyid = ots.id and ots.status = '0' and ots.delete_flag = '0'
  43. LEFT JOIN t_bus_social_security_strategy sss
  44. ON w.social_security_strategyid = sss.id and sss.status = '0' and sss.delete_flag = '0'
  45. LEFT JOIN t_bus_provident_fund_strategy pfs
  46. ON w.provident_fund_strategyid = pfs.id and pfs.status = '0' and pfs.delete_flag = '0'
  47. where 1=1 and (p.leave_date is null or p.leave_date = '')
  48. <#if (userWagestrategyDao.username )?? && userWagestrategyDao.username ?length gt 0>
  49. /* 转正人编号 */
  50. and u.username like CONCAT('%', :userWagestrategyDao.username ,'%')
  51. </#if>
  52. <#if (userWagestrategyDao.realname )?? && userWagestrategyDao.realname ?length gt 0>
  53. /* 转正人名称 */
  54. and u.realname like CONCAT('%', :userWagestrategyDao.realname ,'%')
  55. </#if>
  56. <#if ( userWagestrategyDao.orgIdList )?? && userWagestrategyDao.orgIdList ?size gt 0>
  57. /* 所属单位*/
  58. and d.id in(
  59. <#list userWagestrategyDao.orgIdList as item>
  60. '${item}'
  61. <#if item_has_next>,</#if>
  62. </#list>
  63. )
  64. </#if>
  65. <#if ( useridList )?? && useridList ?size gt 0>
  66. /* 可见的用户id */
  67. and u.id in(
  68. <#list useridList as item>
  69. '${item}'
  70. <#if item_has_next>,</#if>
  71. </#list>
  72. )
  73. </#if>
  74. ORDER BY p.leave_date