<?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.casic.missiles.modular.system.dao.VisitorApplyMapper"> <select id="selectApplyList" resultType="com.casic.missiles.modular.system.model.VisitorApply"> SELECT * FROM bus_visit_apply WHERE 1=1 <if test="request.keywords != null and request.keywords !=''"> and (apply_no like concat('%',#{request.keywords},'%') or staff_code like concat('%',#{request.keywords},'%') or visitor_name like concat('%',#{request.keywords},'%') or visitor_phone like concat('%',#{request.keywords},'%')) </if> <if test="request.startTime != null and request.startTime !=''"> and DATE_FORMAT( in_time, '%Y-%m-%d' ) >= #{request.startTime} </if> <if test="request.endTime != null and request.endTime != ''"> and DATE_FORMAT( out_time, '%Y-%m-%d' ) <= #{request.endTime} </if> <if test="request.status != null and request.status != ''"> and visitor_apply_status = #{request.status} </if> <if test="request.account != null and request.account != ''"> and staff_code = #{request.account} </if> ORDER BY create_time DESC </select> <select id="getApplyList" resultType="com.casic.missiles.modular.system.model.VisitorApply"> SELECT * FROM bus_visit_apply WHERE 1=1 <if test="request.applyNo != null and request.applyNo != ''"> and apply_no like CONCAT('%',#{request.applyNo},'%') </if> <if test="request.visitorName != null and request.visitorName != ''"> and visitor_name like concat('%', #{request.visitorName}, '%') </if> <if test="request.staffCode != null and request.staffCode != ''"> and staff_code like CONCAT('%',#{request.staffCode},'%') </if> <if test="request.staffName != null and request.staffName != ''"> and staff_name like concat('%', #{request.staffName}, '%') </if> <if test="request.visitReason != null and request.visitReason != ''"> and visit_reason = #{request.visitReason} </if> <if test="request.visitPosition != null and request.visitPosition != ''"> and visit_position = #{request.visitPosition} </if> <if test="request.inTime != null and request.inTime !=''"> and DATE_FORMAT( in_time, '%Y-%m-%d %H:%i:%s' ) >= #{request.inTime} </if> <if test="request.outTime != null and request.outTime != ''"> and DATE_FORMAT( out_time, '%Y-%m-%d %H:%i:%s' ) <= #{request.outTime} </if> ORDER BY create_time DESC </select> <select id="selectPassedApply" resultType="com.casic.missiles.modular.system.model.VisitorApply"> SELECT * FROM bus_visit_apply WHERE 1=1 <if test="visitorIdCard != null and visitorIdCard !=''"> and visitor_id_card = #{visitorIdCard} </if> <if test="startDate != null and startDate !=''"> and DATE_FORMAT( out_time, '%Y-%m-%d %H:%i:%s' ) >= #{startDate} </if> <if test="endDate != null and endDate != ''"> and DATE_FORMAT( out_time, '%Y-%m-%d %H:%i:%s' ) <= #{endDate} </if> and visitor_apply_status = '2' ORDER BY create_time DESC </select> <select id="getMessageList" parameterType="string" resultType="hashmap"> SELECT t1.message_id, t2.staff_code, t2.visitor_name, <if test="flag == 'regularEmployee'"> IF(t1.apply_status = '',t2.visitor_apply_status,t1.apply_status) AS visitor_apply_status, </if> <if test="flag == 'propertyPersonnel'"> t2.visitor_apply_status, </if> DATE_FORMAT(t2.in_time,'%Y/%m/%d %H:%i:%s') as in_time, DATE_FORMAT(t2.out_time,'%Y/%m/%d %H:%i:%s') as out_time, DATE_FORMAT(t1.create_time,'%Y/%m/%d %H:%i:%s') as create_time FROM bus_message t1 LEFT JOIN bus_visit_apply t2 ON t1.message_id = t2.id WHERE 1 = 1 AND t1.open_id = #{openid} <if test="flag == 'regularEmployee'"> AND t2.staff_code = #{user} </if> <if test="flag == 'propertyPersonnel'"> AND t2.staff_code IS NOT NULL </if> ORDER BY t1.create_time desc </select> <select id="selectApplyNo" resultType="java.lang.String"> SELECT IFNULL(max(apply_no), 0) from bus_visit_apply </select> </mapper>