Guwan-smartSchool/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml

968 lines
37 KiB
XML

<?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="net.shapelight.modules.ten.dao.TenPersonDao">
<resultMap id="BaseResultMap" type="net.shapelight.modules.ten.entity.TenPersonEntity">
<result column="member_id" jdbcType="INTEGER" property="memberId"/>
<result column="person_id" jdbcType="BIGINT" property="personId"/>
<result column="username" jdbcType="VARCHAR" property="username"/>
<result column="password" jdbcType="VARCHAR" property="password"/>
<result column="salt" jdbcType="VARCHAR" property="salt"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="gender" jdbcType="TINYINT" property="gender"/>
<result column="nation" jdbcType="TINYINT" property="nation"/>
<result column="mobile" jdbcType="VARCHAR" property="mobile"/>
<result column="cell_id" jdbcType="BIGINT" property="cellId"/>
<result column="build_id" jdbcType="BIGINT" property="buildId"/>
<result column="room_id" jdbcType="BIGINT" property="roomId"/>
<result column="person_type" jdbcType="INTEGER" property="personType"/>
<result column="org_image" jdbcType="VARCHAR" property="orgImage"/>
<result column="face_image" jdbcType="VARCHAR" property="faceImage"/>
<result column="label_id" jdbcType="INTEGER" property="labelId"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="app_flag" jdbcType="TINYINT" property="appFlag"/>
<result column="id_card" jdbcType="VARCHAR" property="idCard"/>
<result column="id_type" jdbcType="TINYINT" property="idType"/>
<result column="id_front_image" jdbcType="VARCHAR" property="idFrontImage"/>
<result column="id_back_image" jdbcType="VARCHAR" property="idBackImage"/>
<result column="live_start" jdbcType="TIMESTAMP" property="liveStart"/>
<result column="live_end" jdbcType="TIMESTAMP" property="liveEnd"/>
<result column="email" jdbcType="VARCHAR" property="email"/>
<result column="work" jdbcType="VARCHAR" property="work"/>
<result column="status" jdbcType="TINYINT" property="status"/>
<result column="note" jdbcType="VARCHAR" property="note"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="last_update_time" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
<result column="last_update_by" jdbcType="VARCHAR" property="lastUpdateBy"/>
<result column="login_time" jdbcType="TIMESTAMP" property="loginTime"/>
<result column="open_id" jdbcType="VARCHAR" property="openId"/>
<result column="ryid" jdbcType="VARCHAR" property="ryid"/>
<result column="uuid" jdbcType="VARCHAR" property="uuid"/>
<result column="delete_flag" jdbcType="TINYINT" property="deleteFlag"/>
<result column="register_type" jdbcType="TINYINT" property="registerType"/>
<result column="tenant_id" jdbcType="BIGINT" property="tenantId"/>
<result column="face_failure" jdbcType="TINYINT" property="faceFailure"/>
<result column="xa_sync" jdbcType="TINYINT" property="xaSync" />
<result column="xa_sync_card" jdbcType="TINYINT" property="xaSyncCard" />
<result column="xa_sync_image" jdbcType="TINYINT" property="xaSyncImage" />
<result column="depth" jdbcType="VARCHAR" property="depth" />
<result column="face_model" jdbcType="VARCHAR" property="faceModel" />
<result column="source_file" jdbcType="VARCHAR" property="sourceFile" />
<result column="camera_param" jdbcType="VARCHAR" property="cameraParam" />
<association property="cellName" javaType="String"
select="net.shapelight.modules.ten.dao.TenCellDao.getCellName"
column="cellId=cell_id">
</association>
<association property="areaName" javaType="String"
select="net.shapelight.modules.ten.dao.TenCellDao.getAreaNameByCellId"
column="cellId=cell_id">
</association>
<association property="buildName" javaType="String"
select="net.shapelight.modules.ten.dao.TenBuildDao.getBuildName"
column="buildId=build_id,cellId=cell_id">
</association>
<association property="buildUnit" javaType="String"
select="net.shapelight.modules.ten.dao.TenBuildDao.getBuildUnit"
column="buildId=build_id,cellId=cell_id">
</association>
<association property="roomName" javaType="String"
select="net.shapelight.modules.ten.dao.TenRoomDao.getRoomName"
column="roomId=room_id,cellId=cell_id">
</association>
<association property="labelName" javaType="String"
select="net.shapelight.modules.ten.dao.TenLabelDao.getLabelName"
column="labelId=label_id">
</association>
</resultMap>
<resultMap id="updateMap" type="net.shapelight.modules.vo.TenPersonVo">
<result column="member_id" jdbcType="INTEGER" property="memberId"/>
<result column="person_id" jdbcType="BIGINT" property="personId"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<!--<result column="gender" jdbcType="TINYINT" property="gender"/>-->
<!--<result column="mobile" jdbcType="VARCHAR" property="mobile"/>-->
<result column="person_type" jdbcType="INTEGER" property="personType"/>
<result column="org_image" jdbcType="VARCHAR" property="orgImage"/>
<result column="face_image" jdbcType="VARCHAR" property="faceImage"/>
<!--<result column="label_id" jdbcType="INTEGER" property="labelId"/>-->
<result column="live_start" jdbcType="TIMESTAMP" property="liveStart"/>
<result column="live_end" jdbcType="TIMESTAMP" property="liveEnd"/>
<!--<result column="door_card" jdbcType="VARCHAR" property="doorCard"/>-->
<!--<result column="valid_begin" jdbcType="TIMESTAMP" property="validBegin"/>-->
<!--<result column="valid_end" jdbcType="TIMESTAMP" property="validEnd"/>-->
<result column="status" jdbcType="TINYINT" property="status"/>
<result column="last_update_time" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
<result column="ryid" jdbcType="VARCHAR" property="ryid"/>
<result column="delete_flag" jdbcType="TINYINT" property="deleteFlag"/>
</resultMap>
<resultMap id="idupdateMap" type="net.shapelight.modules.vo.TenPersonIdUpdateAllVo">
<result column="person_id" jdbcType="BIGINT" property="uid"/>
<result column="last_update_time" jdbcType="TIMESTAMP" property="last_update_stamp"/>
</resultMap>
<insert id="insert" parameterType="net.shapelight.modules.ten.entity.TenPersonEntity">
insert into ten_person
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="personId != null">
person_id,
</if>
<if test="username != null">
username,
</if>
<if test="password != null">
password,
</if>
<if test="salt != null">
salt,
</if>
<if test="name != null">
name,
</if>
<if test="gender != null">
gender,
</if>
<if test="nation != null">
nation,
</if>
<if test="mobile != null">
mobile,
</if>
<if test="cellId != null">
cell_id,
</if>
<if test="buildId != null">
build_id,
</if>
<if test="roomId != null">
room_id,
</if>
<if test="personType != null">
person_type,
</if>
<if test="orgImage != null">
org_image,
</if>
<if test="faceImage != null">
face_image,
</if>
<if test="labelId != null">
label_id,
</if>
<if test="remark != null">
remark,
</if>
<if test="appFlag != null">
app_flag,
</if>
<if test="idCard != null">
id_card,
</if>
<if test="idType != null">
id_type,
</if>
<if test="idFrontImage != null">
id_front_image,
</if>
<if test="idBackImage != null">
id_back_image,
</if>
<if test="liveStart != null">
live_start,
</if>
<if test="liveEnd != null">
live_end,
</if>
<if test="email != null">
email,
</if>
<if test="work != null">
work,
</if>
<if test="status != null">
status,
</if>
<if test="note != null">
note,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="lastUpdateTime != null">
last_update_time,
</if>
<if test="lastUpdateBy != null">
last_update_by,
</if>
<if test="loginTime != null">
login_time,
</if>
<if test="openId != null">
open_id,
</if>
<if test="ryid != null">
ryid,
</if>
<if test="uuid != null">
uuid,
</if>
<if test="deleteFlag != null">
delete_flag,
</if>
<if test="registerType != null">
register_type,
</if>
<if test="tenantId != null">
tenant_id,
</if>
<if test="faceFailure != null">
face_failure,
</if>
<if test="xaSync != null">
xa_sync,
</if>
<if test="xaSyncCard != null">
xa_sync_card,
</if>
<if test="xaSyncImage != null">
xa_sync_image,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="personId != null">
#{personId,jdbcType=BIGINT},
</if>
<if test="username != null">
#{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="salt != null">
#{salt,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="gender != null">
#{gender,jdbcType=TINYINT},
</if>
<if test="nation != null">
#{nation,jdbcType=TINYINT},
</if>
<if test="mobile != null">
#{mobile,jdbcType=VARCHAR},
</if>
<if test="cellId != null">
#{cellId,jdbcType=BIGINT},
</if>
<if test="buildId != null">
#{buildId,jdbcType=BIGINT},
</if>
<if test="roomId != null">
#{roomId,jdbcType=BIGINT},
</if>
<if test="personType != null">
#{personType,jdbcType=INTEGER},
</if>
<if test="orgImage != null">
#{orgImage,jdbcType=VARCHAR},
</if>
<if test="faceImage != null">
#{faceImage,jdbcType=VARCHAR},
</if>
<if test="labelId != null">
#{labelId,jdbcType=INTEGER},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="appFlag != null">
#{appFlag,jdbcType=TINYINT},
</if>
<if test="idCard != null">
#{idCard,jdbcType=VARCHAR},
</if>
<if test="idType != null">
#{idType,jdbcType=TINYINT},
</if>
<if test="idFrontImage != null">
#{idFrontImage,jdbcType=VARCHAR},
</if>
<if test="idBackImage != null">
#{idBackImage,jdbcType=VARCHAR},
</if>
<if test="liveStart != null">
#{liveStart,jdbcType=TIMESTAMP},
</if>
<if test="liveEnd != null">
#{liveEnd,jdbcType=TIMESTAMP},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="work != null">
#{work,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=TINYINT},
</if>
<if test="note != null">
#{note,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="lastUpdateTime != null">
#{lastUpdateTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdateBy != null">
#{lastUpdateBy,jdbcType=VARCHAR},
</if>
<if test="loginTime != null">
#{loginTime,jdbcType=TIMESTAMP},
</if>
<if test="openId != null">
#{openId,jdbcType=VARCHAR},
</if>
<if test="ryid != null">
#{ryid,jdbcType=VARCHAR},
</if>
<if test="uuid != null">
#{uuid,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=TINYINT},
</if>
<if test="registerType != null">
#{registerType,jdbcType=TINYINT},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
</if>
<if test="faceFailure != null">
#{faceFailure,jdbcType=TINYINT},
</if>
<if test="xaSync != null">
#{xaSync,jdbcType=TINYINT},
</if>
<if test="xaSyncCard != null">
#{xaSyncCard,jdbcType=TINYINT},
</if>
<if test="xaSyncImage != null">
#{xaSyncImage,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenPersonEntity">
update ten_person
<set>
<if test="personId != null">
person_id = #{personId,jdbcType=BIGINT},
</if>
<if test="username != null">
username = #{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="salt != null">
salt = #{salt,jdbcType=VARCHAR},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="gender != null">
gender = #{gender,jdbcType=TINYINT},
</if>
<if test="nation != null">
nation = #{nation,jdbcType=TINYINT},
</if>
<if test="mobile != null">
mobile = #{mobile,jdbcType=VARCHAR},
</if>
<if test="cellId != null">
cell_id = #{cellId,jdbcType=BIGINT},
</if>
<if test="buildId != null">
build_id = #{buildId,jdbcType=BIGINT},
</if>
<if test="roomId != null">
room_id = #{roomId,jdbcType=BIGINT},
</if>
<if test="personType != null">
person_type = #{personType,jdbcType=INTEGER},
</if>
<if test="orgImage != null">
org_image = #{orgImage,jdbcType=VARCHAR},
</if>
<if test="faceImage != null">
face_image = #{faceImage,jdbcType=VARCHAR},
</if>
<if test="labelId != null">
label_id = #{labelId,jdbcType=INTEGER},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="appFlag != null">
app_flag = #{appFlag,jdbcType=TINYINT},
</if>
<if test="idCard != null">
id_card = #{idCard,jdbcType=VARCHAR},
</if>
<if test="idType != null">
id_type = #{idType,jdbcType=TINYINT},
</if>
<if test="idFrontImage != null">
id_front_image = #{idFrontImage,jdbcType=VARCHAR},
</if>
<if test="idBackImage != null">
id_back_image = #{idBackImage,jdbcType=VARCHAR},
</if>
<if test="liveStart != null">
live_start = #{liveStart,jdbcType=TIMESTAMP},
</if>
<if test="liveEnd != null">
live_end = #{liveEnd,jdbcType=TIMESTAMP},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="work != null">
work = #{work,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=TINYINT},
</if>
<if test="note != null">
note = #{note,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="lastUpdateTime != null">
last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdateBy != null">
last_update_by = #{lastUpdateBy,jdbcType=VARCHAR},
</if>
<if test="loginTime != null">
login_time = #{loginTime,jdbcType=TIMESTAMP},
</if>
<if test="openId != null">
open_id = #{openId,jdbcType=VARCHAR},
</if>
<if test="ryid != null">
ryid = #{ryid,jdbcType=VARCHAR},
</if>
<if test="uuid != null">
uuid = #{uuid,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null">
delete_flag = #{deleteFlag,jdbcType=TINYINT},
</if>
<if test="registerType != null">
register_type = #{registerType,jdbcType=TINYINT},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
<if test="faceFailure != null">
face_failure = #{faceFailure,jdbcType=TINYINT},
</if>
<if test="xaSync != null">
xa_sync = #{xaSync,jdbcType=TINYINT},
</if>
<if test="xaSyncCard != null">
xa_sync_card = #{xaSyncCard,jdbcType=TINYINT},
</if>
<if test="xaSyncImage != null">
xa_sync_image = #{xaSyncImage,jdbcType=TINYINT},
</if>
<if test="cameraParam != null">
camera_param = #{cameraParam,jdbcType=VARCHAR},
</if>
<if test="sourceFile != null">
source_file = #{sourceFile,jdbcType=VARCHAR},
</if>
</set>
where person_id = #{personId,jdbcType=BIGINT}
</update>
<delete id="deleteById">
delete from ten_person
where person_id = #{personId,jdbcType=BIGINT}
</delete>
<delete id="logicDeleteById">
update ten_person set delete_flag = 1
where person_id = #{personId}
</delete>
<select id="selectById" resultMap="BaseResultMap">
select p.*,r.layer,r.room_name from ten_person p left join ten_room r
on p.room_id = r.room_id where person_id = #{personId}
</select>
<select id="selectByMemberId" resultMap="BaseResultMap">
select * from ten_person where member_id = #{memberId}
</select>
<select id="selectByRoomId" resultMap="BaseResultMap">
select p.*,r.layer,r.room_name from ten_person p left join ten_room r
on p.room_id = r.room_id where p.room_id = #{roomId} and p.delete_flag = 0
<if test="key != null and key!=''">
and (p.name like CONCAT('%', '${key}', '%')
or p.mobile like CONCAT('%', '${key}', '%'))
</if>
order by p.person_id desc
</select>
<select id="selectByRoomIdForGuest" resultMap="BaseResultMap">
select p.*,r.layer,r.room_name from ten_person p left join ten_room r
on p.room_id = r.room_id where p.room_id = #{roomId} and p.delete_flag = 0
and p.person_type = 5005
<if test="key != null and key!=''">
and (p.name like CONCAT('%', '${key}', '%')
or p.mobile like CONCAT('%', '${key}', '%'))
</if>
</select>
<select id="findByName" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person
where room_id = #{roomId} and delete_flag = 0
and name = #{name} and (person_type = 5000 or person_type = 5001 or person_type = 5002)
</select>
<select id="findByIdCard" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person
where room_id = #{roomId} and delete_flag = 0
and id_card = #{idCard} and (person_type = 5000 or person_type = 5001 or person_type = 5002)
</select>
<select id="selectByCellId" resultMap="BaseResultMap">
select p.*,r.layer,r.room_name from ten_person p left join ten_room r
on p.room_id = r.room_id where p.delete_flag = 0
and p.cell_id = #{cellId}
<if test="key != null and key!=''">
and (p.name like CONCAT('%', '${key}', '%')
or p.mobile like CONCAT('%', '${key}', '%'))
</if>
order by p.person_id desc
</select>
<select id="findPageAll" resultMap="BaseResultMap">
<!--SELECT alias.* from (-->
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
<!--select p.*,r.layer,r.room_name from ten_person_${item} p left join ten_room_${item} r-->
<!--on p.room_id = r.room_id where p.delete_flag = 0-->
<!--<if test="params.buildId != null and params.buildId!=''">-->
<!--and r.build_id = #{params.buildId}-->
<!--</if>-->
<!--<if test="params.layer != null and params.layer!=''">-->
<!--and r.layer = #{params.layer}-->
<!--</if>-->
<!--<if test="params.roomName != null and params.roomName!=''">-->
<!--and r.room_name like CONCAT('%', '${params.roomName}', '%')-->
<!--</if>-->
<!--<if test="params.name != null and params.name!=''">-->
<!--and p.name like CONCAT('%', '${params.name}', '%')-->
<!--</if>-->
<!--<if test="params.gender != null and params.gender!=''">-->
<!--and p.gender = #{params.gender}-->
<!--</if>-->
<!--<if test="params.status != null and params.status!=''">-->
<!--and p.status = #{params.status}-->
<!--</if>-->
<!--<if test="params.idCard != null and params.idCard!=''">-->
<!--and p.id_card like CONCAT('%', '${params.idCard}', '%')-->
<!--</if>-->
<!--<if test="params.mobile != null and params.mobile!=''">-->
<!--and p.mobile like CONCAT('%', '${params.mobile}', '%')-->
<!--</if>-->
<!--<if test="params.personType != null and params.personType!=''">-->
<!--and p.person_type = #{params.personType}-->
<!--</if>-->
<!--<if test="params.faceFailure != null and params.faceFailure!=''">-->
<!--and p.face_failure = #{params.faceFailure}-->
<!--</if>-->
<!--<if test="params.personTypeList != null">-->
<!--and p.person_type in-->
<!--<foreach item="personType" collection="params.personTypeList" open="(" separator="," close=")">-->
<!--#{personType}-->
<!--</foreach>-->
<!--</if>-->
<!--</foreach>-->
<!--) alias where 1 = 1 order by alias.person_id desc-->
select p.*,r.layer,r.room_name from ten_person p left join ten_room r
on p.room_id = r.room_id where p.delete_flag = 0
<if test="params.buildId != null and params.buildId!=''">
and r.build_id = #{params.buildId}
</if>
<if test="params.layer != null and params.layer!=''">
and r.layer = #{params.layer}
</if>
<if test="params.roomName != null and params.roomName!=''">
and r.room_name like CONCAT('%', '${params.roomName}', '%')
</if>
<if test="params.roomId != null and params.roomId!=''">
and r.room_id = #{params.roomId}
</if>
<if test="params.name != null and params.name!=''">
and p.name like CONCAT('%', '${params.name}', '%')
</if>
<if test="params.gender != null and params.gender!=''">
and p.gender = #{params.gender}
</if>
<if test="params.status != null and params.status!=''">
and p.status = #{params.status}
</if>
<if test="params.idCard != null and params.idCard!=''">
and p.id_card like CONCAT('%', '${params.idCard}', '%')
</if>
<if test="params.mobile != null and params.mobile!=''">
and p.mobile like CONCAT('%', '${params.mobile}', '%')
</if>
<if test="params.personType != null and params.personType!=''">
and p.person_type = #{params.personType}
</if>
<if test="params.faceFailure != null and params.faceFailure!=''">
and p.face_failure = #{params.faceFailure}
</if>
<if test="params.personTypeList != null">
and p.person_type in
<foreach item="personType" collection="params.personTypeList" open="(" separator="," close=")">
#{personType}
</foreach>
</if>
<if test="cellIds != null">
and p.cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
#{cellId}
</foreach>
</if>
order by p.create_time desc
</select>
<select id="findAllCount" resultType="int">
<!--SELECT count(*) from (-->
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
<!--select person_id from ten_person_${item} where delete_flag = 0-->
<!--<if test="params.status != null and params.status!=''">-->
<!--and status = #{params.status}-->
<!--</if>-->
<!--<if test="params.personType != null and params.personType!=''">-->
<!--and person_type = #{params.personType}-->
<!--</if>-->
<!--<if test="params.personTypeList != null">-->
<!--and person_type in-->
<!--<foreach item="personType" collection="params.personTypeList" open="(" separator="," close=")">-->
<!--#{personType}-->
<!--</foreach>-->
<!--</if>-->
<!--</foreach>-->
<!--) alias where 1 = 1 order by alias.person_id desc-->
select count(*) from ten_person where delete_flag = 0
<if test="params.status != null and params.status!=''">
and status = #{params.status}
</if>
<if test="params.personType != null and params.personType!=''">
and person_type = #{params.personType}
</if>
<if test="params.personTypeList != null">
and person_type in
<foreach item="personType" collection="params.personTypeList" open="(" separator="," close=")">
#{personType}
</foreach>
</if>
<if test="cellIds != null">
and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
#{cellId}
</foreach>
</if>
</select>
<select id="findVerifyPageAll" resultMap="BaseResultMap">
<!--SELECT alias.* from (-->
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
<!--select p.*,r.layer,r.room_name from ten_person_${item} p left join ten_room_${item} r-->
<!--on p.room_id = r.room_id where p.delete_flag = 0 and p.status != 0-->
<!--<if test="params.name != null and params.name!=''">-->
<!--and p.name like CONCAT('%', '${params.name}', '%')-->
<!--</if>-->
<!--<if test="params.gender != null and params.gender!=''">-->
<!--and p.gender = #{params.gender}-->
<!--</if>-->
<!--<if test="params.idCard != null and params.idCard!=''">-->
<!--and p.id_card like CONCAT('%', '${params.idCard}', '%')-->
<!--</if>-->
<!--<if test="params.mobile != null and params.mobile!=''">-->
<!--and p.mobile = #{params.mobile}-->
<!--</if>-->
<!--</foreach>-->
<!--) alias where 1 = 1 order by alias.person_id desc-->
select p.*,r.layer,r.room_name from ten_person p left join ten_room r
on p.room_id = r.room_id where p.delete_flag = 0 and p.status != 0
<if test="params.name != null and params.name!=''">
and p.name like CONCAT('%', '${params.name}', '%')
</if>
<if test="params.gender != null and params.gender!=''">
and p.gender = #{params.gender}
</if>
<if test="params.idCard != null and params.idCard!=''">
and p.id_card like CONCAT('%', '${params.idCard}', '%')
</if>
<if test="params.mobile != null and params.mobile!=''">
and p.mobile = #{params.mobile}
</if>
<if test="cellIds != null">
and p.cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
#{cellId}
</foreach>
</if>
order by p.create_time desc
</select>
<select id="globalSearchPageAll" resultMap="BaseResultMap">
<!--SELECT alias.* from (-->
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
<!--select p.* from ten_person_${item} p-->
<!--where p.delete_flag = 0-->
<!--<if test="params.key != null and params.key!=''">-->
<!--and (p.name like CONCAT('%', '${params.key}', '%')-->
<!--or p.id_card like CONCAT('%', '${params.key}', '%')-->
<!--or p.mobile like CONCAT('%', '${params.key}', '%'))-->
<!--</if>-->
<!--</foreach>-->
<!--) alias where 1 = 1-->
select * from ten_person
where delete_flag = 0
<if test="params.key != null and params.key!=''">
and (name like CONCAT('%', '${params.key}', '%')
or id_card like CONCAT('%', '${params.key}', '%')
or mobile like CONCAT('%', '${params.key}', '%'))
</if>
<if test="cellIds != null">
and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
#{cellId}
</foreach>
</if>
</select>
<select id="findUpdatePerson" resultMap="updateMap">
select * from ten_person
where 1=1
<if test="cellId != null and cellId!=''">
and cell_id = #{cellId}
</if>
<if test="buildId != null and buildId!=''">
and build_id = #{buildId}
</if>
<if test="roomId != null and roomId!=''">
and room_id = #{roomId}
</if>
<if test="lastUpdateTime != null and lastUpdateTime!=''">
and last_update_time > #{lastUpdateTime}
</if>
order by last_update_time asc
limit 100
</select>
<select id="findAllPersonIdUpdate" resultType="net.shapelight.modules.vo.TenPersonIdUpdateVo">
select member_id,last_update_time from ten_person
where 1=1
<if test="cellId != null and cellId!=''">
and cell_id = #{cellId}
</if>
<if test="buildId != null and buildId!=''">
and build_id = #{buildId}
</if>
<if test="roomId != null and roomId!=''">
and room_id = #{roomId}
</if>
</select>
<select id="findAllPersonIdUpdateAll" resultMap="idupdateMap">
select person_id,last_update_time from ten_person
where delete_flag = 0 and status = 0
<if test="cellId != null and cellId!=''">
and cell_id = #{cellId}
</if>
<if test="buildId != null and buildId!=''">
and build_id = #{buildId}
</if>
<if test="roomId != null and roomId!=''">
and room_id = #{roomId}
</if>
</select>
<select id="findByLastUpdatePerson" resultMap="updateMap">
select * from ten_person
where 1=1
<if test="cellId != null and cellId!=''">
and cell_id = #{cellId}
</if>
<if test="buildId != null and buildId!=''">
and build_id = #{buildId}
</if>
<if test="roomId != null and roomId!=''">
and room_id = #{roomId}
</if>
<if test="lastUpdateTime != null and lastUpdateTime!=''">
and last_update_time = #{lastUpdateTime}
</if>
</select>
<select id="findAllByCellId" resultMap="updateMap">
select * from ten_person
where cell_id = #{cellId}
</select>
<select id="findRoomCount" resultType="int">
select count(*) from ten_person
where delete_flag = 0
<if test="cellId != null and cellId!=''">
and cell_id = #{cellId}
</if>
<if test="roomId != null and roomId!=''">
and room_id = #{roomId}
</if>
</select>
<select id="findBuildCount" resultType="int">
select count(*) from ten_person
where delete_flag = 0
<if test="cellId != null and cellId!=''">
and cell_id = #{cellId}
</if>
<if test="buildId != null and buildId!=''">
and build_id = #{buildId}
</if>
</select>
<select id="findCellCount" resultType="int">
select count(*) from ten_person
where delete_flag = 0
and cell_id = #{cellId}
</select>
<select id="findCellOwnerCount" resultType="int">
select count(*) from ten_person
where delete_flag = 0
and person_type in(5000,5001,5002)
and cell_id = #{cellId}
<!--<if test="cellId != null and cellId!=''">-->
<!--and cell_id = #{cellId}-->
<!--</if>-->
</select>
<select id="findLabelCount" resultType="int">
select count(*) from ten_person
where delete_flag = 0
and label_id = #{labelId}
where cell_id = #{cellId}
</select>
<select id="getAllExpireGuest" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
SELECT * FROM ten_person
where person_type = 5005
and live_end &lt; NOW()
and delete_flag = 0
</select>
<select id="getOwner" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person
where room_id = #{roomId}
and delete_flag = 0 and person_type = 5000
limit 1
</select>
<select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person p left join ten_room r
on p.room_id = r.room_id
where p.cell_id = #{cellId}
and p.delete_flag = 0 and (p.person_type = 5000 || p.person_type = 5001)
and p.xa_sync = 0
and r.xa_sync = 1
</select>
<select id="getNotSyncCard" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person
where cell_id = #{cellId}
and delete_flag = 0 and (person_type = 5000 || person_type = 5001)
and xa_sync_card = 0
</select>
<select id="getNotSyncImage" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person
where cell_id = #{cellId}
and delete_flag = 0 and (person_type = 5000 || person_type = 5001)
and xa_sync_image = 0
and xa_sync = 1
</select>
<select id="getByHaveMobilePersonByRoomId" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person
where room_id = #{roomId} and trim(mobile) != ''
</select>
</mapper>