<?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.zehong.system.mapper.TPatrolCheckInMapper"> <resultMap type="TPatrolCheckIn" id="TPatrolCheckInResult"> <result property="checkInId" column="check_in_id" /> <result property="deviceName" column="device_name" /> <result property="photoUrl" column="photo_url" /> <result property="patrolDescribe" column="patrol_describe" /> <result property="reportTime" column="report_time" /> <result property="reportPerson" column="report_person" /> <result property="longitude" column="longitude" /> <result property="latitude" column="latitude" /> <result property="isDel" column="is_del" /> <result property="remark" column="remark" /> <result property="personName" column="person_name" /> </resultMap> <sql id="selectTPatrolCheckInVo"> SELECT patrol.check_in_id, patrol.device_name, patrol.photo_url, patrol.patrol_describe, patrol.report_time, patrol.report_person, patrol.longitude, patrol.latitude, patrol.is_del, patrol.remark, u.nick_name AS person_name FROM t_patrol_check_in patrol LEFT JOIN sys_user u ON patrol.report_person = u.user_id </sql> <select id="selectTPatrolCheckInList" parameterType="TPatrolCheckIn" resultMap="TPatrolCheckInResult"> <include refid="selectTPatrolCheckInVo"/> <where> <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if> <if test="photoUrl != null and photoUrl != ''"> and photo_url = #{photoUrl}</if> <if test="patrolDescribe != null and patrolDescribe != ''"> and patrol_describe = #{patrolDescribe}</if> <if test="reportTimeBegin != null and reportTimeEnd != null"> and patrol.report_time BETWEEN #{reportTimeBegin} AND #{reportTimeEnd}</if> <if test="reportPerson != null "> and report_person = #{reportPerson}</if> <if test="longitude != null "> and longitude = #{longitude}</if> <if test="latitude != null "> and latitude = #{latitude}</if> <if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if> </where> </select> <select id="selectTPatrolCheckInById" parameterType="Long" resultMap="TPatrolCheckInResult"> <include refid="selectTPatrolCheckInVo"/> where check_in_id = #{checkInId} </select> <insert id="insertTPatrolCheckIn" parameterType="TPatrolCheckIn" useGeneratedKeys="true" keyProperty="checkInId"> insert into t_patrol_check_in <trim prefix="(" suffix=")" suffixOverrides=","> <if test="deviceName != null">device_name,</if> <if test="photoUrl != null">photo_url,</if> <if test="patrolDescribe != null">patrol_describe,</if> <if test="reportTime != null">report_time,</if> <if test="reportPerson != null">report_person,</if> <if test="longitude != null">longitude,</if> <if test="latitude != null">latitude,</if> <if test="isDel != null">is_del,</if> <if test="remark != null">remark,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="deviceName != null">#{deviceName},</if> <if test="photoUrl != null">#{photoUrl},</if> <if test="patrolDescribe != null">#{patrolDescribe},</if> <if test="reportTime != null">#{reportTime},</if> <if test="reportPerson != null">#{reportPerson},</if> <if test="longitude != null">#{longitude},</if> <if test="latitude != null">#{latitude},</if> <if test="isDel != null">#{isDel},</if> <if test="remark != null">#{remark},</if> </trim> </insert> <update id="updateTPatrolCheckIn" parameterType="TPatrolCheckIn"> update t_patrol_check_in <trim prefix="SET" suffixOverrides=","> <if test="deviceName != null">device_name = #{deviceName},</if> <if test="photoUrl != null">photo_url = #{photoUrl},</if> <if test="patrolDescribe != null">patrol_describe = #{patrolDescribe},</if> <if test="reportTime != null">report_time = #{reportTime},</if> <if test="reportPerson != null">report_person = #{reportPerson},</if> <if test="longitude != null">longitude = #{longitude},</if> <if test="latitude != null">latitude = #{latitude},</if> <if test="isDel != null">is_del = #{isDel},</if> <if test="remark != null">remark = #{remark},</if> </trim> where check_in_id = #{checkInId} </update> <delete id="deleteTPatrolCheckInById" parameterType="Long"> delete from t_patrol_check_in where check_in_id = #{checkInId} </delete> <delete id="deleteTPatrolCheckInByIds" parameterType="String"> delete from t_patrol_check_in where check_in_id in <foreach item="checkInId" collection="array" open="(" separator="," close=")"> #{checkInId} </foreach> </delete> </mapper>