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

165 lines
6.5 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_${tenantId}` like `ten_build_0`;
</update>
<update id="createTenRoom" parameterType="String">
create table if not exists `ten_room_${tenantId}` like `ten_room_0`;
</update>
<update id="createTenPerson" parameterType="String">
create table if not exists `ten_person_${tenantId}` like `ten_person_0`;
</update>
<update id="createTenRecord" parameterType="String">
create table if not exists `ten_record_${tenantId}` like `ten_record_0`;
</update>
<update id="createTenCar" parameterType="String">
create table if not exists `ten_car_${tenantId}` like `ten_car_0`;
</update>
<update id="createTenPackRecord" parameterType="String">
create table if not exists `ten_pack_record_${tenantId}` like `ten_pack_record_0`;
</update>
<update id="createTenPersonExtract" parameterType="String">
create table if not exists `ten_person_extract_${tenantId}` like `ten_person_extract_0`;
</update>
<update id="createTenPersonSync" parameterType="String">
create table if not exists `ten_person_sync_${tenantId}` like `ten_person_sync_0`;
</update>
<update id="createTenCellDept" parameterType="String">
create table if not exists `ten_cell_dept_${cellId}` like `ten_cell_dept_0`;
</update>
<update id="createTenParent" parameterType="String">
create table if not exists `ten_parent_${cellId}` like `ten_parent_0`;
</update>
<update id="createTenRelation" parameterType="String">
create table if not exists `ten_relation_${cellId}` like `ten_relation_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 &gt;= #{createTimeStart} and create_time &lt;= 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>
<select id="findByName" resultType="net.shapelight.modules.vo.SchoolNameVo">
select a.cell_id, a.name from ten_cell a where a.name like CONCAT('%', '${name}', '%')
</select>
</mapper>