343 lines
12 KiB
XML
343 lines
12 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.TenBuildDao">
|
|
|
|
<!-- 可根据自己的需求,是否要使用 -->
|
|
<!--<resultMap type="net.shapelight.modules.ten.entity.TenBuildEntity" id="tenBuildMap">-->
|
|
<!--<result property="id" column="id"/>-->
|
|
<!--<result property="cellId" column="cell_id"/>-->
|
|
<!--<result property="unit" column="unit"/>-->
|
|
<!--<result property="number" column="number"/>-->
|
|
<!--<result property="name" column="name"/>-->
|
|
<!--<result property="layerCount" column="layer_count"/>-->
|
|
<!--<result property="roomEach" column="room_each"/>-->
|
|
<!--<result property="lat" column="lat"/>-->
|
|
<!--<result property="lon" column="lon"/>-->
|
|
<!--<result property="other" column="other"/>-->
|
|
<!--<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="deleteFlag" column="delete_flag"/>-->
|
|
<!--<result property="tenantId" column="tenant_id"/>-->
|
|
<!--</resultMap>-->
|
|
|
|
|
|
<resultMap id="tenBuildMap" type="net.shapelight.modules.ten.entity.TenBuildEntity">
|
|
<id column="build_id" jdbcType="BIGINT" property="buildId" />
|
|
<result column="cell_id" jdbcType="BIGINT" property="cellId" />
|
|
<result column="area_id" jdbcType="BIGINT" property="areaId" />
|
|
<result column="unit" jdbcType="VARCHAR" property="unit" />
|
|
<result column="number" jdbcType="VARCHAR" property="number" />
|
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
|
<result column="layer_count" jdbcType="INTEGER" property="layerCount" />
|
|
<result column="room_each" jdbcType="INTEGER" property="roomEach" />
|
|
<result column="lat" jdbcType="VARCHAR" property="lat" />
|
|
<result column="lon" jdbcType="VARCHAR" property="lon" />
|
|
<result column="other" jdbcType="VARCHAR" property="other" />
|
|
<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="delete_flag" jdbcType="TINYINT" property="deleteFlag" />
|
|
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
|
|
<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.TenAreaDao.getAreaName"
|
|
column="areaId=area_id">
|
|
</association>
|
|
|
|
</resultMap>
|
|
|
|
<insert id="insert" parameterType="net.shapelight.modules.ten.entity.TenBuildEntity">
|
|
insert into ten_build
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="buildId != null">
|
|
build_id,
|
|
</if>
|
|
<if test="cellId != null">
|
|
cell_id,
|
|
</if>
|
|
<if test="areaId != null">
|
|
area_id,
|
|
</if>
|
|
<if test="unit != null">
|
|
unit,
|
|
</if>
|
|
<if test="number != null">
|
|
number,
|
|
</if>
|
|
<if test="name != null">
|
|
name,
|
|
</if>
|
|
<if test="layerCount != null">
|
|
layer_count,
|
|
</if>
|
|
<if test="roomEach != null">
|
|
room_each,
|
|
</if>
|
|
<if test="lat != null">
|
|
lat,
|
|
</if>
|
|
<if test="lon != null">
|
|
lon,
|
|
</if>
|
|
<if test="other != null">
|
|
other,
|
|
</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="deleteFlag != null">
|
|
delete_flag,
|
|
</if>
|
|
<if test="tenantId != null">
|
|
tenant_id,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="buildId != null">
|
|
#{buildId,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="cellId != null">
|
|
#{cellId,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="areaId != null">
|
|
#{areaId,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="unit != null">
|
|
#{unit,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="number != null">
|
|
#{number,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="name != null">
|
|
#{name,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="layerCount != null">
|
|
#{layerCount,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="roomEach != null">
|
|
#{roomEach,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="lat != null">
|
|
#{lat,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="lon != null">
|
|
#{lon,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="other != null">
|
|
#{other,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="deleteFlag != null">
|
|
#{deleteFlag,jdbcType=TINYINT},
|
|
</if>
|
|
<if test="tenantId != null">
|
|
#{tenantId,jdbcType=BIGINT},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenBuildEntity">
|
|
update ten_build
|
|
<set>
|
|
<if test="buildId != null">
|
|
build_id = #{buildId,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="cellId != null">
|
|
cell_id = #{cellId,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="areaId != null">
|
|
area_id = #{areaId,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="unit != null">
|
|
unit = #{unit,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="number != null">
|
|
number = #{number,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="name != null">
|
|
name = #{name,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="layerCount != null">
|
|
layer_count = #{layerCount,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="roomEach != null">
|
|
room_each = #{roomEach,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="lat != null">
|
|
lat = #{lat,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="lon != null">
|
|
lon = #{lon,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="other != null">
|
|
other = #{other,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="deleteFlag != null">
|
|
delete_flag = #{deleteFlag,jdbcType=TINYINT},
|
|
</if>
|
|
<if test="tenantId != null">
|
|
tenant_id = #{tenantId,jdbcType=BIGINT},
|
|
</if>
|
|
</set>
|
|
where build_id = #{buildId,jdbcType=BIGINT}
|
|
</update>
|
|
|
|
|
|
<delete id="logicDeleteById">
|
|
update ten_build set delete_flag = 1
|
|
where build_id = #{buildId,jdbcType=BIGINT}
|
|
</delete>
|
|
<delete id="logicDeleteByCellId">
|
|
update ten_build set delete_flag = 1
|
|
where cell_id = #{cellId,jdbcType=BIGINT}
|
|
</delete>
|
|
|
|
<delete id="deleteById">
|
|
delete from ten_build
|
|
where build_id = #{buildId,jdbcType=BIGINT}
|
|
</delete>
|
|
|
|
|
|
<select id="selectById" resultMap="tenBuildMap">
|
|
select * from ten_build
|
|
where build_id = #{buildId}
|
|
</select>
|
|
|
|
<select id="selectByCellId" resultMap="tenBuildMap">
|
|
select * from ten_build
|
|
where cell_id = #{cellId} and delete_flag = 0
|
|
</select>
|
|
|
|
<select id="getBuildName" resultType="string">
|
|
select name from ten_build
|
|
where build_id = #{buildId}
|
|
</select>
|
|
|
|
<select id="getBuildUnit" resultType="string">
|
|
select unit from ten_build
|
|
where build_id = #{buildId}
|
|
</select>
|
|
|
|
<!--<select id="findPageAll" resultMap="tenBuildMap">-->
|
|
<!--select * from ten_build_${cellId}-->
|
|
<!--where delete_flag = 0-->
|
|
<!--</select>-->
|
|
|
|
<select id="queryByNumberAndUnit" resultMap="tenBuildMap">
|
|
select * from ten_build where delete_flag = 0
|
|
and number = #{number} and unit = #{unit} and cell_id = #{cellId}
|
|
</select>
|
|
|
|
<select id="queryByNameAndUnit" resultMap="tenBuildMap">
|
|
select * from ten_build where delete_flag = 0
|
|
and name = #{name} and unit = #{unit} and cell_id = #{cellId}
|
|
</select>
|
|
|
|
|
|
<select id="findPageAll" resultMap="tenBuildMap" >
|
|
<!--SELECT alias.* from (-->
|
|
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
|
|
<!--select * from ten_build_${item}-->
|
|
<!--</foreach>-->
|
|
<!--) alias where delete_flag = 0-->
|
|
<!--<if test="params.areaId != null and params.areaId!=''">-->
|
|
<!--and alias.area_id = #{params.areaId}-->
|
|
<!--</if>-->
|
|
<!--<if test="params.cellId != null and params.cellId!=''">-->
|
|
<!--and alias.cell_id = #{params.cellId}-->
|
|
<!--</if>-->
|
|
<!--<if test="params.name != null and params.name!=''">-->
|
|
<!--and `name` like CONCAT('%', '${params.name}', '%')-->
|
|
<!--</if>-->
|
|
|
|
select * from ten_build
|
|
where delete_flag = 0
|
|
<if test="params.areaId != null and params.areaId!=''">
|
|
and area_id = #{params.areaId}
|
|
</if>
|
|
<if test="params.cellId != null and params.cellId!=''">
|
|
and cell_id = #{params.cellId}
|
|
</if>
|
|
<if test="params.name != null and params.name!=''">
|
|
and `name` like CONCAT('%', '${params.name}', '%')
|
|
</if>
|
|
|
|
<if test="cellIds != null">
|
|
and cell_id in
|
|
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
|
|
#{cellId}
|
|
</foreach>
|
|
</if>
|
|
|
|
|
|
</select>
|
|
|
|
<select id="findAll" resultMap="tenBuildMap" >
|
|
<!--SELECT alias.* from (-->
|
|
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
|
|
<!--select * from ten_build_${item}-->
|
|
<!--</foreach>-->
|
|
<!--) alias where delete_flag = 0-->
|
|
|
|
select * from ten_build
|
|
where delete_flag = 0
|
|
<if test="cellIds != null">
|
|
and cell_id in
|
|
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
|
|
#{cellId}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getBuildNumber" resultType="string">
|
|
select number from ten_build
|
|
where build_id = #{buildId}
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|