123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- <?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.bz.smart_city.dao.InspectionObjectMapper">
- <!--auto generated Code-->
- <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.InspectionObject">
- <result column="id" property="id" jdbcType="INTEGER"/>
- <result column="site_id" property="siteId" jdbcType="INTEGER"/>
- <result column="object_name" property="objectName" jdbcType="VARCHAR"/>
- <result column="location" property="location" jdbcType="VARCHAR"/>
- <result column="is_flag" property="isFlag" jdbcType="VARCHAR"/>
- <result column="longitude" property="longitude" jdbcType="DECIMAL"/>
- <result column="latitude" property="latitude" jdbcType="DECIMAL"/>
- <result column="mark_location" property="markLocation" jdbcType="VARCHAR"/>
- <result column="standard_id" property="standardId" jdbcType="INTEGER"/>
- <result column="object_status" property="objectStatus" jdbcType="INTEGER"/>
- <result column="device_id" property="deviceId" jdbcType="BIGINT"/>
- <result column="status" property="status" jdbcType="INTEGER"/>
- <result column="date_create" property="dateCreate" jdbcType="TIMESTAMP"/>
- <result column="date_update" property="dateUpdate" jdbcType="TIMESTAMP"/>
- <result column="create_by" property="createBy" jdbcType="VARCHAR"/>
- <result column="update_by" property="updateBy" jdbcType="VARCHAR"/>
- <result column="plan_id" property="planId" jdbcType="INTEGER"/>
- <result column="x_coordinates" property="xCoordinates" jdbcType="DECIMAL"/>
- <result column="y_coordinates" property="yCoordinates" jdbcType="DECIMAL"/>
- </resultMap>
- <!--auto generated Code-->
- <sql id="Base_Column_List">
- id,
- site_id,
- object_name,
- location,
- is_flag,
- longitude,
- latitude,
- mark_location,
- standard_id,
- object_status,
- device_id,
- status,
- date_create,
- date_update,
- create_by,
- update_by,
- plan_id,
- x_coordinates,
- y_coordinates
- </sql>
- <!--auto generated Code-->
- <insert id="insert" useGeneratedKeys="true" keyProperty="inspectionObject.id">
- INSERT INTO sc_inspection_object (
- id,
- site_id,
- object_name,
- location,
- is_flag,
- longitude,
- latitude,
- mark_location,
- standard_id,
- object_status,
- device_id,
- status,
- date_create,
- date_update,
- create_by,
- update_by,
- plan_id,
- x_coordinates,
- y_coordinates
- ) VALUES (
- #{inspectionObject.id,jdbcType=INTEGER},
- #{inspectionObject.siteId,jdbcType=INTEGER},
- #{inspectionObject.objectName,jdbcType=VARCHAR},
- #{inspectionObject.location,jdbcType=VARCHAR},
- #{inspectionObject.isFlag,jdbcType=VARCHAR},
- #{inspectionObject.longitude,jdbcType=DECIMAL},
- #{inspectionObject.latitude,jdbcType=DECIMAL},
- #{inspectionObject.markLocation,jdbcType=VARCHAR},
- #{inspectionObject.standardId,jdbcType=INTEGER},
- #{inspectionObject.objectStatus,jdbcType=INTEGER},
- #{inspectionObject.deviceId,jdbcType=BIGINT},
- #{inspectionObject.status,jdbcType=INTEGER},
- #{inspectionObject.dateCreate,jdbcType=TIMESTAMP},
- #{inspectionObject.dateUpdate,jdbcType=TIMESTAMP},
- #{inspectionObject.createBy,jdbcType=VARCHAR},
- #{inspectionObject.updateBy,jdbcType=VARCHAR},
- #{inspectionObject.planId,jdbcType=INTEGER},
- #{inspectionObject.xCoordinates,jdbcType=DECIMAL},
- #{inspectionObject.yCoordinates,jdbcType=DECIMAL}
- )
- </insert>
- <!--auto generated Code-->
- <insert id="insertSelective" useGeneratedKeys="true" keyProperty="inspectionObject.id">
- INSERT INTO sc_inspection_object
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="inspectionObject.id!=null"> id,</if>
- <if test="inspectionObject.siteId!=null"> site_id,</if>
- <if test="inspectionObject.objectName!=null"> object_name,</if>
- <if test="inspectionObject.location!=null"> location,</if>
- <if test="inspectionObject.isFlag!=null"> is_flag,</if>
- <if test="inspectionObject.longitude!=null"> longitude,</if>
- <if test="inspectionObject.latitude!=null"> latitude,</if>
- <if test="inspectionObject.markLocation!=null"> mark_location,</if>
- <if test="inspectionObject.standardId!=null"> standard_id,</if>
- <if test="inspectionObject.objectStatus!=null"> object_status,</if>
- <if test="inspectionObject.deviceId!=null"> device_id,</if>
- <if test="inspectionObject.status!=null"> status,</if>
- <if test="inspectionObject.dateCreate!=null"> date_create,</if>
- <if test="inspectionObject.dateUpdate!=null"> date_update,</if>
- <if test="inspectionObject.createBy!=null"> create_by,</if>
- <if test="inspectionObject.updateBy!=null"> update_by,</if>
- <if test="inspectionObject.planId!=null"> plan_id,</if>
- <if test="inspectionObject.xCoordinates!=null"> x_coordinates,</if>
- <if test="inspectionObject.yCoordinates!=null"> y_coordinates,</if>
- </trim>
- VALUES
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="inspectionObject.id!=null">#{inspectionObject.id,jdbcType=INTEGER},
- </if>
- <if test="inspectionObject.siteId!=null">#{inspectionObject.siteId,jdbcType=INTEGER},
- </if>
- <if test="inspectionObject.objectName!=null">#{inspectionObject.objectName,jdbcType=VARCHAR},
- </if>
- <if test="inspectionObject.location!=null">#{inspectionObject.location,jdbcType=VARCHAR},
- </if>
- <if test="inspectionObject.isFlag!=null">#{inspectionObject.isFlag,jdbcType=VARCHAR},
- </if>
- <if test="inspectionObject.longitude!=null">#{inspectionObject.longitude,jdbcType=DECIMAL},
- </if>
- <if test="inspectionObject.latitude!=null">#{inspectionObject.latitude,jdbcType=DECIMAL},
- </if>
- <if test="inspectionObject.markLocation!=null">#{inspectionObject.markLocation,jdbcType=VARCHAR},
- </if>
- <if test="inspectionObject.standardId!=null">#{inspectionObject.standardId,jdbcType=INTEGER},
- </if>
- <if test="inspectionObject.objectStatus!=null">#{inspectionObject.objectStatus,jdbcType=INTEGER},
- </if>
- <if test="inspectionObject.deviceId!=null">#{inspectionObject.deviceId,jdbcType=BIGINT},
- </if>
- <if test="inspectionObject.status!=null">#{inspectionObject.status,jdbcType=INTEGER},
- </if>
- <if test="inspectionObject.dateCreate!=null">#{inspectionObject.dateCreate,jdbcType=TIMESTAMP},
- </if>
- <if test="inspectionObject.dateUpdate!=null">#{inspectionObject.dateUpdate,jdbcType=TIMESTAMP},
- </if>
- <if test="inspectionObject.createBy!=null">#{inspectionObject.createBy,jdbcType=VARCHAR},
- </if>
- <if test="inspectionObject.updateBy!=null">#{inspectionObject.updateBy,jdbcType=VARCHAR},
- </if>
- <if test="inspectionObject.planId!=null">#{inspectionObject.planId,jdbcType=INTEGER},
- </if>
- <if test="inspectionObject.xCoordinates!=null">#{inspectionObject.xCoordinates,jdbcType=DECIMAL},
- </if>
- <if test="inspectionObject.yCoordinates!=null">#{inspectionObject.yCoordinates,jdbcType=DECIMAL},
- </if>
- </trim>
- </insert>
- <!--auto generated Code-->
- <insert id="insertList">
- INSERT INTO sc_inspection_object (
- id,
- site_id,
- object_name,
- location,
- is_flag,
- longitude,
- latitude,
- mark_location,
- standard_id,
- object_status,
- device_id,
- status,
- date_create,
- date_update,
- create_by,
- update_by,
- plan_id,
- x_coordinates,
- y_coordinates
- )VALUES
- <foreach collection="inspectionObjects" item="inspectionObject" index="index" separator=",">
- (
- #{inspectionObject.id,jdbcType=INTEGER},
- #{inspectionObject.siteId,jdbcType=INTEGER},
- #{inspectionObject.objectName,jdbcType=VARCHAR},
- #{inspectionObject.location,jdbcType=VARCHAR},
- #{inspectionObject.isFlag,jdbcType=VARCHAR},
- #{inspectionObject.longitude,jdbcType=DECIMAL},
- #{inspectionObject.latitude,jdbcType=DECIMAL},
- #{inspectionObject.markLocation,jdbcType=VARCHAR},
- #{inspectionObject.standardId,jdbcType=INTEGER},
- #{inspectionObject.objectStatus,jdbcType=INTEGER},
- #{inspectionObject.deviceId,jdbcType=BIGINT},
- #{inspectionObject.status,jdbcType=INTEGER},
- #{inspectionObject.dateCreate,jdbcType=TIMESTAMP},
- #{inspectionObject.dateUpdate,jdbcType=TIMESTAMP},
- #{inspectionObject.createBy,jdbcType=VARCHAR},
- #{inspectionObject.updateBy,jdbcType=VARCHAR},
- #{inspectionObject.planId,jdbcType=INTEGER},
- #{inspectionObject.xCoordinates,jdbcType=DECIMAL},
- #{inspectionObject.yCoordinates,jdbcType=DECIMAL}
- )
- </foreach>
- </insert>
- <!--auto generated Code-->
- <update id="updateByPrimaryKeySelective">
- UPDATE sc_inspection_object
- <set>
- <if test="inspectionObject.siteId != null"> site_id= #{inspectionObject.siteId,jdbcType=INTEGER},</if>
- <if test="inspectionObject.objectName != null"> object_name= #{inspectionObject.objectName,jdbcType=VARCHAR},</if>
- <if test="inspectionObject.location != null"> location= #{inspectionObject.location,jdbcType=VARCHAR},</if>
- <if test="inspectionObject.isFlag != null"> is_flag= #{inspectionObject.isFlag,jdbcType=VARCHAR},</if>
- <if test="inspectionObject.longitude != null"> longitude= #{inspectionObject.longitude,jdbcType=DECIMAL},</if>
- <if test="inspectionObject.latitude != null"> latitude= #{inspectionObject.latitude,jdbcType=DECIMAL},</if>
- <if test="inspectionObject.markLocation != null"> mark_location= #{inspectionObject.markLocation,jdbcType=VARCHAR},</if>
- <if test="inspectionObject.standardId != null"> standard_id= #{inspectionObject.standardId,jdbcType=INTEGER},</if>
- <if test="inspectionObject.objectStatus != null"> object_status= #{inspectionObject.objectStatus,jdbcType=INTEGER},</if>
- <if test="inspectionObject.deviceId != null"> device_id= #{inspectionObject.deviceId,jdbcType=BIGINT},</if>
- <if test="inspectionObject.status != null"> status= #{inspectionObject.status,jdbcType=INTEGER},</if>
- <if test="inspectionObject.dateCreate != null"> date_create= #{inspectionObject.dateCreate,jdbcType=TIMESTAMP},</if>
- <if test="inspectionObject.dateUpdate != null"> date_update= #{inspectionObject.dateUpdate,jdbcType=TIMESTAMP},</if>
- <if test="inspectionObject.createBy != null"> create_by= #{inspectionObject.createBy,jdbcType=VARCHAR},</if>
- <if test="inspectionObject.updateBy != null"> update_by= #{inspectionObject.updateBy,jdbcType=VARCHAR},</if>
- <if test="inspectionObject.planId != null"> plan_id= #{inspectionObject.planId,jdbcType=INTEGER},</if>
- <if test="inspectionObject.xCoordinates != null"> x_coordinates= #{inspectionObject.xCoordinates,jdbcType=DECIMAL},</if>
- <if test="inspectionObject.yCoordinates != null"> y_coordinates= #{inspectionObject.yCoordinates,jdbcType=DECIMAL}</if>
- </set>
- WHERE id = #{inspectionObject.id,jdbcType=INTEGER}
- </update>
- <select id="getList" resultType="com.bz.smart_city.dto.InspectionObjectDto">
- select
- sio.*,sis.standard_name,sd.device_no,sd.device_type as device_type_id,sd.manufacturer_id
- from sc_inspection_object sio
- left join sc_inspection_standard sis on (sis.id = sio.standard_id and sis.status = 1)
- left join sc_device sd on (sd.id = sio.device_id and sd.status = 1)
- where sio.status = 1
- <if test="siteId != null"> and sio.site_id = #{siteId} </if>
- <if test="name != null and name != ''"> AND sio.object_name LIKE concat('%',#{name},'%')</if>
- <if test="location != null and location != ''"> AND sio.location LIKE concat('%',#{location} ,'%')</if>
- <if test="objectStatus != null"> and sio.object_status = #{objectStatus} </if>
- <if test="objectIds != null and objectIds.size() != 0">
- and sio.id in
- <foreach collection="objectIds" item="item" open="(" separator="," close=")">#{item}</foreach>
- </if>
- order by sio.date_create desc
- </select>
- <select id="findByNameUnique" resultType="java.lang.Integer">
- select count(1) from sc_inspection_object
- where status = 1 and object_name = #{objectName}
- <if test="siteId != null"> and site_id = #{siteId} </if>
- <if test="id != null"> and id != #{id}</if>
- </select>
- <select id="countByStandardId" resultType="java.lang.Integer">
- select id from sc_inspection_object where status = 1 and standard_id = #{standardId}
- </select>
- </mapper>
|