StaffMapper.xml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.usky.dxtop.mapper.StaffMapper">
  4. <select id="page" resultType="com.usky.dxtop.model.Staff">
  5. select s.*,d.name as deptName,tr.identity,tr.proportion,tr.id as radioId
  6. from staff as s
  7. left join dept as d
  8. on s.dept_id = d.id
  9. left join staff_radio as sr
  10. on s.s_id = sr.staff_id
  11. left join top_radio as tr
  12. on sr.radio_id = tr.id
  13. <where>
  14. <if test="startTime !=null and endTime != null">
  15. and s.create_time between #{startTime} and #{endTime}
  16. </if>
  17. <if test="name !=null and name != ''">
  18. and s.name like concat('%', #{name}, '%')
  19. </if>
  20. <if test="phone !=null and phone != ''">
  21. and s.contacts like concat('%', #{phone}, '%')
  22. </if>
  23. <if test="card !=null and card != ''">
  24. and s.card_id like concat('%', #{card}, '%')
  25. </if>
  26. <if test="deptId !=null">
  27. and s.dept_id = #{deptId}
  28. </if>
  29. </where>
  30. order by s.id desc
  31. </select>
  32. <select id="one" resultType="com.usky.dxtop.model.Staff">
  33. select s.*,d.name as deptName,tr.identity,tr.proportion,tr.id as radioId
  34. from staff as s
  35. left join dept as d
  36. on s.dept_id = d.id
  37. left join staff_radio as sr
  38. on s.s_id = sr.staff_id
  39. left join top_radio as tr
  40. on sr.radio_id = tr.id
  41. <where>
  42. <if test="id !=null and id != ''">
  43. and s.id =#{id}
  44. </if>
  45. <if test="phone !=null and phone != ''">
  46. and s.contacts = #{phone}
  47. </if>
  48. <if test="card !=null and card != ''">
  49. and s.card_id = #{card}
  50. </if>
  51. </where>
  52. </select>
  53. <select id="selectListByPhones" resultType="com.usky.dxtop.model.Staff">
  54. select s.*,d.name as deptName,tr.identity,tr.proportion,tr.id as radioId
  55. from staff as s
  56. left join dept as d
  57. on s.dept_id = d.id
  58. left join staff_radio as sr
  59. on s.s_id = sr.staff_id
  60. left join top_radio as tr
  61. on sr.radio_id = tr.id
  62. where s.contacts in
  63. <foreach collection="phoneList" item="phone" index="index" open="(" close=")" separator=",">
  64. #{phone}
  65. </foreach>
  66. </select>
  67. </mapper>