| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?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.template.mapper.SmartVisitorMapper">
- <resultMap type="com.template.model.vo.VisitorPageVo" id="visitorPageMap">
- <result property="id" column="id"/>
- <result property="userId" column="user_id"/>
- <result property="userName" column="user_name"/>
- <result property="createTime" column="create_time"/>
- <result property="statu" column="statu"/>
- <result property="visitorTime" column="visitor_time"/>
- <result property="visitReason" column="visit_reason"/>
- </resultMap>
- <select id="queryVisitorPage" resultType="com.template.model.vo.VisitorPageVo" resultMap="visitorPageMap">
- select sv.id,sv.user_id,su.name as user_name,sv.create_time,sv.statu,sv.visitor_time,sv.visit_reason from
- smart_visitor sv
- left join smart_user su on su.deleted = 0 and sv.user_id = su.id
- where sv.deleted = 0
- <if test="userId != null and userId != ''">
- and sv.user_id = #{userId}
- </if>
- <if test="statu != null and statu != ''">
- and sv.statu = #{statu}
- </if>
- </select>
- <select id="queryVisitorCount" resultType="java.lang.Integer">
- select Count(*) from smart_visitor
- where 1=1
- <if test="cardNo != null and cardNo != ''">
- and user_number = #{cardNo}
- </if>
- <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
- and (
- <if test="startTime != null and startTime != ''">
- (visitor_time < #{startTime} and visitor_deadline > #{startTime})
- </if>
- <if test="endTime != null and endTime != ''">
- or (visitor_time < #{endTime} and visitor_deadline > #{endTime})
- </if>
- )
- </if>
- and deleted = 0 and statu != 2
- </select>
- </mapper>
|