StaffMapper.xml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 and sr.del_flag = 0
  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 and sr.del_flag = 0
  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. </mapper>