142 lines
5.7 KiB
XML
142 lines
5.7 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.TenCellDao">
|
||
|
|
||
|
<!-- 可根据自己的需求,是否要使用 -->
|
||
|
<resultMap type="net.shapelight.modules.ten.entity.TenCellEntity" id="tenCellMap">
|
||
|
<result property="cellId" column="cell_id"/>
|
||
|
<result property="areaId" column="area_id"/>
|
||
|
<result property="name" column="name"/>
|
||
|
<result property="cellType" column="cell_type"/>
|
||
|
<result property="contactPerson" column="contact_person"/>
|
||
|
<result property="contactMobile" column="contact_mobile"/>
|
||
|
<result property="email" column="email"/>
|
||
|
<result property="province" column="province"/>
|
||
|
<result property="city" column="city"/>
|
||
|
<result property="district" column="district"/>
|
||
|
<result property="street" column="street"/>
|
||
|
<result property="lat" column="lat"/>
|
||
|
<result property="lon" column="lon"/>
|
||
|
<result property="createTime" column="create_time"/>
|
||
|
<result property="createBy" column="create_by"/>
|
||
|
<result property="lastUpdateTime" column="last_update_time"/>
|
||
|
<result property="lastUpdateBy" column="last_update_by"/>
|
||
|
<result property="idCardMust" column="id_card_must"/>
|
||
|
<result property="deleteFlag" column="delete_flag"/>
|
||
|
<result property="openPassword" column="open_password"/>
|
||
|
<result property="thirdId" column="third_id"/>
|
||
|
<result property="tenantId" column="tenantId"/>
|
||
|
<association property="areaName" javaType="String"
|
||
|
select="net.shapelight.modules.ten.dao.TenAreaDao.getAreaName"
|
||
|
column="areaId=area_id">
|
||
|
</association>
|
||
|
</resultMap>
|
||
|
|
||
|
|
||
|
<update id="createTenBuild" parameterType="String">
|
||
|
create table if not exists `ten_build_${cellId}` like `ten_build_0`;
|
||
|
</update>
|
||
|
|
||
|
|
||
|
<update id="createTenRoom" parameterType="String">
|
||
|
create table if not exists `ten_room_${cellId}` like `ten_room_0`;
|
||
|
</update>
|
||
|
|
||
|
|
||
|
<update id="createTenPerson" parameterType="String">
|
||
|
create table if not exists `ten_person_${cellId}` like `ten_person_0`;
|
||
|
</update>
|
||
|
|
||
|
<update id="createTenRecord" parameterType="String">
|
||
|
create table if not exists `ten_record_${cellId}` like `ten_record_0`;
|
||
|
</update>
|
||
|
|
||
|
<update id="createTenCar" parameterType="String">
|
||
|
create table if not exists `ten_car_${cellId}` like `ten_car_0`;
|
||
|
</update>
|
||
|
|
||
|
<update id="createTenPackRecord" parameterType="String">
|
||
|
create table if not exists `ten_pack_record_${cellId}` like `ten_pack_record_0`;
|
||
|
</update>
|
||
|
|
||
|
<select id="queryList" resultMap="tenCellMap">
|
||
|
select * from ten_cell where delete_flag = 0 and tenant_id = #{params.tenantId}
|
||
|
<if test="params.sql_filter != null">
|
||
|
and ${params.sql_filter}
|
||
|
</if>
|
||
|
|
||
|
|
||
|
<if test="params.areaIds != null">
|
||
|
and area_id in
|
||
|
<foreach item="areaId" collection="params.areaIds" open="(" separator="," close=")">
|
||
|
#{areaId}
|
||
|
</foreach>
|
||
|
</if>
|
||
|
|
||
|
<if test="params.name != null and params.name!=''">
|
||
|
and `name` like CONCAT('%', '${params.name}', '%')
|
||
|
</if>
|
||
|
<if test="params.contactPerson != null and params.contactPerson!=''">
|
||
|
and contact_person like CONCAT('%', '${params.contactPerson}', '%')
|
||
|
</if>
|
||
|
<if test="params.contactMobile != null and params.contactMobile!=''">
|
||
|
and contact_mobile like CONCAT('%', '${params.contactMobile}', '%')
|
||
|
</if>
|
||
|
|
||
|
|
||
|
<!--<if test="groupId != null and groupId!=''">-->
|
||
|
<!--and group_id = #{groupId}-->
|
||
|
<!--</if>-->
|
||
|
|
||
|
<!--<if test="reviewFlag != null and reviewFlag!=''">-->
|
||
|
<!--and fence_review in-->
|
||
|
<!--<foreach item="status" collection="reviewFlag" open="(" separator="," close=")">-->
|
||
|
<!--#{status}-->
|
||
|
<!--</foreach>-->
|
||
|
<!--</if>-->
|
||
|
|
||
|
|
||
|
<!--<choose>-->
|
||
|
<!--<when test="createTimeStart != null and createTimeStart!='' and createTimeEnd != null and createTimeEnd!=''">-->
|
||
|
<!--and create_time >= #{createTimeStart} and create_time <= DATE_SUB(#{createTimeEnd},INTERVAL -1 DAY)-->
|
||
|
<!--</when>-->
|
||
|
<!--<otherwise>-->
|
||
|
<!--<choose>-->
|
||
|
<!--<when test="createTimeStart != null and createTimeStart!='' and (createTimeEnd == null or createTimeEnd=='')">-->
|
||
|
<!--and TO_DAYS(create_time) = TO_DAYS(#{createTimeStart})-->
|
||
|
<!--</when>-->
|
||
|
<!--<otherwise>-->
|
||
|
<!--<choose>-->
|
||
|
<!--<when test="(createTimeStart == null or createTimeStart=='') and createTimeEnd != null and createTimeEnd!=''">-->
|
||
|
<!--and TO_DAYS(create_time) = TO_DAYS(#{createTimeEnd})-->
|
||
|
<!--</when>-->
|
||
|
<!--</choose>-->
|
||
|
<!--</otherwise>-->
|
||
|
<!--</choose>-->
|
||
|
<!--</otherwise>-->
|
||
|
<!--</choose>-->
|
||
|
|
||
|
</select>
|
||
|
|
||
|
<select id="queryAll" resultMap="tenCellMap">
|
||
|
select * from ten_cell where delete_flag = 0 and tenant_id = #{tenantId}
|
||
|
<if test="sql_filter != null">
|
||
|
and ${sql_filter}
|
||
|
</if>
|
||
|
</select>
|
||
|
|
||
|
<select id="getCellName" resultType="string">
|
||
|
select name from ten_cell where cell_id = #{cellId}
|
||
|
</select>
|
||
|
|
||
|
<select id="getAreaNameByCellId" resultType="string">
|
||
|
select a.name from ten_cell c
|
||
|
left join ten_area a
|
||
|
on c.area_id = a.area_id
|
||
|
where c.cell_id = #{cellId}
|
||
|
</select>
|
||
|
|
||
|
|
||
|
</mapper>
|