12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.usky.dxtop.mapper.StaffMapper">
- <select id="page" resultType="com.usky.dxtop.model.Staff">
- select s.*,d.name as deptName,tr.identity,tr.proportion,tr.id as radioId
- from staff as s
- left join dept as d
- on s.dept_id = d.id
- left join staff_radio as sr
- on s.s_id = sr.staff_id
- left join top_radio as tr
- on sr.radio_id = tr.id
- <where>
- <if test="startTime !=null and endTime != null">
- and s.create_time between #{startTime} and #{endTime}
- </if>
- <if test="name !=null and name != ''">
- and s.name like concat('%', #{name}, '%')
- </if>
- <if test="phone !=null and phone != ''">
- and s.contacts like concat('%', #{phone}, '%')
- </if>
- <if test="card !=null and card != ''">
- and s.card_id like concat('%', #{card}, '%')
- </if>
- <if test="deptId !=null">
- and s.dept_id = #{deptId}
- </if>
- </where>
- order by s.id desc
- </select>
- <select id="one" resultType="com.usky.dxtop.model.Staff">
- select s.*,d.name as deptName,tr.identity,tr.proportion,tr.id as radioId
- from staff as s
- left join dept as d
- on s.dept_id = d.id
- left join staff_radio as sr
- on s.s_id = sr.staff_id
- left join top_radio as tr
- on sr.radio_id = tr.id
- <where>
- <if test="id !=null and id != ''">
- and s.id =#{id}
- </if>
- <if test="phone !=null and phone != ''">
- and s.contacts = #{phone}
- </if>
- <if test="card !=null and card != ''">
- and s.card_id = #{card}
- </if>
- </where>
- </select>
- <select id="selectListByPhones" resultType="com.usky.dxtop.model.Staff">
- select s.*,d.name as deptName,tr.identity,tr.proportion,tr.id as radioId
- from staff as s
- left join dept as d
- on s.dept_id = d.id
- left join staff_radio as sr
- on s.s_id = sr.staff_id
- left join top_radio as tr
- on sr.radio_id = tr.id
- where s.contacts in
- <foreach collection="phoneList" item="phone" index="index" open="(" close=")" separator=",">
- #{phone}
- </foreach>
- </select>
- </mapper>
|