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