123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?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.yijia.station.mapper.StationPersonnelMapper">
- <resultMap type="StationPersonnel" id="StationPersonnelResult">
- <result property="personnelId" column="personnel_id" />
- <result property="personnelName" column="personnel_name" />
- <result property="gunNo" column="gun_no" />
- <result property="stationId" column="station_id" />
- <result property="stationName" column="station_name" />
- <result property="qrCode" column="qr_code" />
- <result property="personnelPhone" column="personnel_phone" />
- <result property="delFlag" column="del_flag" />
- </resultMap>
- <sql id="selectStationPersonnelVo">
- select personnel_id, personnel_name, gun_no, station_id, d.dept_name as station_name, qr_code, personnel_phone,p.del_flag
- from station_personnel p join sys_dept d on p.station_id = d.dept_id
- </sql>
- <select id="selectStationPersonnelList" parameterType="StationPersonnel" resultMap="StationPersonnelResult">
- <include refid="selectStationPersonnelVo"/>
- where p.del_flag ='0'
- <if test="personnelName != null and personnelName != ''"> and p.personnel_name like concat('%', #{personnelName}, '%')</if>
- <if test="gunNo != null and gunNo != ''"> and p.gun_no = #{gunNo}</if>
- <if test="stationId != null "> and p.station_id = #{stationId}</if>
- <if test="stationName != null and stationName != ''"> and d.dept_name like concat('%', #{stationName}, '%')</if>
- <if test="qrCode != null and qrCode != ''"> and qr_code = #{qrCode}</if>
- <if test="personnelPhone != null and personnelPhone != ''"> and personnel_phone = #{personnelPhone}</if>
- <if test="stationIdList != null ">
- and p.station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- order by personnel_id desc
- </select>
- <select id="selectStationPersonnelById" parameterType="Long" resultMap="StationPersonnelResult">
- <include refid="selectStationPersonnelVo"/>
- where personnel_id = #{personnelId}
- </select>
- <insert id="insertStationPersonnel" parameterType="StationPersonnel">
- insert into station_personnel
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="personnelId != null">personnel_id,</if>
- <if test="personnelName != null">personnel_name,</if>
- <if test="gunNo != null">gun_no,</if>
- <if test="stationId != null">station_id,</if>
- <if test="qrCode != null">qr_code,</if>
- <if test="personnelPhone != null">personnel_phone,</if>
- <if test="delFlag != null">del_flag,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="personnelId != null">#{personnelId},</if>
- <if test="personnelName != null">#{personnelName},</if>
- <if test="gunNo != null">#{gunNo},</if>
- <if test="stationId != null">#{stationId},</if>
- <if test="qrCode != null">#{qrCode},</if>
- <if test="personnelPhone != null">#{personnelPhone},</if>
- <if test="delFlag != null">#{delFlag},</if>
- </trim>
- </insert>
- <update id="updateStationPersonnel" parameterType="StationPersonnel">
- update station_personnel
- <trim prefix="SET" suffixOverrides=",">
- <if test="personnelName != null">personnel_name = #{personnelName},</if>
- <if test="gunNo != null">gun_no = #{gunNo},</if>
- <if test="stationId != null">station_id = #{stationId},</if>
- <if test="qrCode != null">qr_code = #{qrCode},</if>
- <if test="personnelPhone != null">personnel_phone = #{personnelPhone},</if>
- <if test="delFlag != null">del_flag = #{delFlag},</if>
- </trim>
- where personnel_id = #{personnelId}
- </update>
- <delete id="deleteStationPersonnelById" parameterType="Long">
- delete from station_personnel where personnel_id = #{personnelId}
- </delete>
- <delete id="deleteStationPersonnelByIds" parameterType="String">
- update station_personnel set del_flag = '1' where personnel_id in
- <foreach collection="array" item="personnelId" open="(" separator="," close=")">
- #{personnelId}
- </foreach>
- </delete>
- </mapper>
|