VisitPlanMapper.xml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  4. <mapper namespace="com.management.platform.mapper.VisitPlanMapper">
  5. <sql id="baseColumns">
  6. id, plan_name, custom_id, custom_name, incharger_id, visit_goal, visit_time, remark, remind_type
  7. , remind_time, finish_state, create_by, company_id,final_remind_time,corpwx_userid
  8. </sql>
  9. <select id="getPageVisitPlan" resultType="com.management.platform.entity.vo.VisitPlanVO">
  10. select vs.id, vs.plan_name, vs.custom_id, vs.custom_name
  11. , vs.incharger_id, u.name as inchargerName
  12. , vs.visit_goal,sd1.name as visitGoalName
  13. , vs.visit_time, vs.remark
  14. , vs.remind_type, case remind_type when -1 then '自定义时间' else sd2.name end as remindTypeName
  15. ,vs.remind_time, vs.finish_state
  16. , vs.create_by
  17. from visit_plan vs
  18. left join user u on vs.incharger_id = u.id
  19. left join (select * from sys_dict where code = 'VisitGoal') sd1 on vs.visit_goal = sd1.id
  20. left join (select * from sys_dict where code = 'RemindType') sd2 on vs.remind_type = sd2.id
  21. where vs.create_by = #{query.userId} and date_format(vs.visit_time,'%Y-%m-%d') = #{query.calenderDate}
  22. </select>
  23. <select id="getListVisitPlan" resultType="com.management.platform.entity.vo.VisitPlanVO">
  24. select vs.id, vs.plan_name, vs.custom_id, vs.custom_name
  25. , vs.incharger_id, u.name as inchargerName
  26. , vs.visit_goal,sd1.name as visitGoalName
  27. , vs.visit_time, vs.remark
  28. , vs.remind_type, case remind_type when -1 then '自定义时间' else sd2.name end as remindTypeName
  29. ,vs.remind_time, vs.finish_state
  30. , vs.create_by,c.tel_phone
  31. from visit_plan vs
  32. left join user u on vs.incharger_id = u.id
  33. left join (select * from sys_dict where code = 'VisitGoal') sd1 on vs.visit_goal = sd1.id
  34. left join (select * from sys_dict where code = 'RemindType') sd2 on vs.remind_type = sd2.id
  35. left join custom c on vs.custom_id = c.id
  36. where vs.create_by = #{query.userId} and date_format(vs.visit_time,'%Y-%m-%d') = #{query.calenderDate}
  37. order by vs.visit_time asc
  38. </select>
  39. <select id="getDetail" resultType="com.management.platform.entity.vo.VisitPlanDetailVO">
  40. select vs.id, vs.plan_name, vs.custom_id, vs.custom_name
  41. , vs.incharger_id, u.name as inchargerName
  42. , vs.visit_goal,sd1.name as visitGoalName
  43. , vs.visit_time, vs.remark
  44. , vs.remind_type, case remind_type when -1 then '自定义时间' else sd2.name end as remindTypeName
  45. ,vs.remind_time, vs.finish_state
  46. , vs.create_by,c.tel_phone
  47. from visit_plan vs
  48. left join user u on vs.incharger_id = u.id
  49. left join (select * from sys_dict where code = 'VisitGoal') sd1 on vs.visit_goal = sd1.id
  50. left join (select * from sys_dict where code = 'RemindType') sd2 on vs.remind_type = sd2.id
  51. left join custom c on vs.custom_id = c.id
  52. where vs.id = #{planId}
  53. </select>
  54. <select id="getMinuteVisitPlans" resultType="com.management.platform.entity.VisitPlan">
  55. select <include refid="baseColumns"></include>
  56. from visit_plan
  57. where
  58. finish_state != 1
  59. and date_format(final_remind_time,'%Y-%m-%d %H:%i')=date_format(#{queryDate},'%Y-%m-%d %H:%i')
  60. </select>
  61. </mapper>