|
@@ -0,0 +1,116 @@
|
|
|
+<?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.ruoyi.qdtl.mapper.TlInspectionLocationMapper">
|
|
|
+
|
|
|
+ <resultMap type="TlInspectionLocation" id="TlInspectionLocationResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="locationCode" column="location_code" />
|
|
|
+ <result property="locationName" column="location_name" />
|
|
|
+ <result property="detail" column="detail" />
|
|
|
+ <result property="deviceIds" column="device_ids" />
|
|
|
+ <result property="areaId" column="area_id" />
|
|
|
+ <result property="lnglat" column="lnglat" />
|
|
|
+ <result property="remark" column="remark" />
|
|
|
+ <result property="delFlag" column="del_flag" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectTlInspectionLocationVo">
|
|
|
+ select id, location_code, location_name, detail, device_ids, area_id, lnglat, remark, del_flag, create_by, create_time, update_by, update_time from tl_inspection_location
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectTlInspectionLocationList" parameterType="TlInspectionLocation" resultMap="TlInspectionLocationResult">
|
|
|
+ <include refid="selectTlInspectionLocationVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="locationCode != null and locationCode != ''"> and location_code like concat('%', #{locationCode}, '%')</if>
|
|
|
+ <if test="locationName != null and locationName != ''"> and location_name like concat('%', #{locationName}, '%')</if>
|
|
|
+ <if test="areaId != null "> and area_id = #{areaId}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectTlInspectionLocationById" parameterType="Long" resultMap="TlInspectionLocationResult">
|
|
|
+ <include refid="selectTlInspectionLocationVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectExist" resultType="java.lang.Integer">
|
|
|
+ select count(1) from tl_inspection_location
|
|
|
+ where (location_code = #{locationCode}
|
|
|
+ or location_name = #{locationName})
|
|
|
+ and del_flag = '0'
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryLocationByArea" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select area_id as areaId, count(1) as cnt
|
|
|
+ from tl_inspection_location
|
|
|
+ where del_flag = 0
|
|
|
+ group by area_id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertTlInspectionLocation" parameterType="TlInspectionLocation" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into tl_inspection_location
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="locationCode != null">location_code,</if>
|
|
|
+ <if test="locationName != null">location_name,</if>
|
|
|
+ <if test="detail != null">detail,</if>
|
|
|
+ <if test="deviceIds != null">device_ids,</if>
|
|
|
+ <if test="areaId != null">area_id,</if>
|
|
|
+ <if test="lnglat != null">lnglat,</if>
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
+ <if test="delFlag != null">del_flag,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="locationCode != null">#{locationCode},</if>
|
|
|
+ <if test="locationName != null">#{locationName},</if>
|
|
|
+ <if test="detail != null">#{detail},</if>
|
|
|
+ <if test="deviceIds != null">#{deviceIds},</if>
|
|
|
+ <if test="areaId != null">#{areaId},</if>
|
|
|
+ <if test="lnglat != null">#{lnglat},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ <if test="delFlag != null">#{delFlag},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateTlInspectionLocation" parameterType="TlInspectionLocation">
|
|
|
+ update tl_inspection_location
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="locationCode != null">location_code = #{locationCode},</if>
|
|
|
+ <if test="locationName != null">location_name = #{locationName},</if>
|
|
|
+ <if test="detail != null">detail = #{detail},</if>
|
|
|
+ <if test="deviceIds != null">device_ids = #{deviceIds},</if>
|
|
|
+ <if test="areaId != null">area_id = #{areaId},</if>
|
|
|
+ <if test="lnglat != null">lnglat = #{lnglat},</if>
|
|
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
+ <if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteTlInspectionLocationById" parameterType="Long">
|
|
|
+ delete from tl_inspection_location where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteTlInspectionLocationByIds" parameterType="String">
|
|
|
+ delete from tl_inspection_location where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|