123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420 |
- <?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.assistant.InstallPlanMapper">
- <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.assistant.InstallPlan">
- <!--@mbg.generated-->
- <id column="id" property="id" />
- <result column="site_id" property="siteId" />
- <result column="plan_name" property="planName" />
- <result column="province" property="province" />
- <result column="city" property="city" />
- <result column="region" property="region" />
- <result column="community_id" property="communityId" />
- <result column="community_name" property="communityName" />
- <result column="pre_install_number" property="preInstallNumber" />
- <result column="customer_id" property="customerId" />
- <result column="device_type_id" property="deviceTypeId" />
- <result column="install_group_name" property="installGroupName" />
- <result column="install_group_header" property="installGroupHeader" />
- <result column="phone" property="phone" />
- <result column="plan_start_date" property="planStartDate" />
- <result column="plan_end_date" property="planEndDate" />
- <result column="plan_status" property="planStatus" />
- <result column="date_create" property="dateCreate" />
- <result column="date_update" property="dateUpdate" />
- <result column="create_by" property="createBy" />
- <result column="update_by" property="updateBy" />
- <result column="status" property="status" />
- <result column="remark" property="remark" />
- <result column="enable_unit" property="enableUnit" />
- <result column="building_number" property="buildingNumber" />
- <result column="unit_number" property="unitNumber" />
- <result column="file_path" property="filePath" />
- <result column="enable_download" property="enableDownload" />
- <result column="platform_type" property="platformType"/>
- </resultMap>
- <sql id="Base_Column_List">
- <!--@mbg.generated-->
- id, site_id, plan_name, province, city, region, community_id, community_name, pre_install_number,
- customer_id, device_type_id, install_group_name, install_group_header, phone, plan_start_date,
- plan_end_date, plan_status, date_create, date_update, create_by, update_by, `status`,
- remark, enable_unit, building_number, unit_number, file_path, enable_download
- </sql>
- <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bz.smart_city.entity.assistant.InstallPlan" useGeneratedKeys="true">
- <!--@mbg.generated-->
- insert into sc_install_plan
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="siteId != null">
- site_id,
- </if>
- <if test="planName != null">
- plan_name,
- </if>
- <if test="province != null">
- province,
- </if>
- <if test="city != null">
- city,
- </if>
- <if test="region != null">
- region,
- </if>
- <if test="communityId != null">
- community_id,
- </if>
- <if test="communityName != null">
- community_name,
- </if>
- <if test="preInstallNumber != null">
- pre_install_number,
- </if>
- <if test="customerId != null">
- customer_id,
- </if>
- <if test="deviceTypeId != null">
- device_type_id,
- </if>
- <if test="installGroupName != null">
- install_group_name,
- </if>
- <if test="installGroupHeader != null">
- install_group_header,
- </if>
- <if test="phone != null">
- phone,
- </if>
- <if test="planStartDate != null">
- plan_start_date,
- </if>
- <if test="planEndDate != null">
- plan_end_date,
- </if>
- <if test="planStatus != null">
- plan_status,
- </if>
- <if test="dateCreate != null">
- date_create,
- </if>
- <if test="dateUpdate != null">
- date_update,
- </if>
- <if test="createBy != null">
- create_by,
- </if>
- <if test="updateBy != null">
- update_by,
- </if>
- <if test="status != null">
- `status`,
- </if>
- <if test="remark != null">
- remark,
- </if>
- <if test="enableUnit != null">
- enable_unit,
- </if>
- <if test="buildingNumber != null">
- building_number,
- </if>
- <if test="unitNumber != null">
- unit_number,
- </if>
- <if test="filePath != null">
- file_path,
- </if>
- <if test="enableDownload != null">
- enable_download,
- </if>
- <if test="platformType != null">
- platform_type,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="siteId != null">
- #{siteId},
- </if>
- <if test="planName != null">
- #{planName},
- </if>
- <if test="province != null">
- #{province},
- </if>
- <if test="city != null">
- #{city},
- </if>
- <if test="region != null">
- #{region},
- </if>
- <if test="communityId != null">
- #{communityId},
- </if>
- <if test="communityName != null">
- #{communityName},
- </if>
- <if test="preInstallNumber != null">
- #{preInstallNumber},
- </if>
- <if test="customerId != null">
- #{customerId},
- </if>
- <if test="deviceTypeId != null">
- #{deviceTypeId},
- </if>
- <if test="installGroupName != null">
- #{installGroupName},
- </if>
- <if test="installGroupHeader != null">
- #{installGroupHeader},
- </if>
- <if test="phone != null">
- #{phone},
- </if>
- <if test="planStartDate != null">
- #{planStartDate},
- </if>
- <if test="planEndDate != null">
- #{planEndDate},
- </if>
- <if test="planStatus != null">
- #{planStatus},
- </if>
- <if test="dateCreate != null">
- #{dateCreate},
- </if>
- <if test="dateUpdate != null">
- #{dateUpdate},
- </if>
- <if test="createBy != null">
- #{createBy},
- </if>
- <if test="updateBy != null">
- #{updateBy},
- </if>
- <if test="status != null">
- #{status},
- </if>
- <if test="remark != null">
- #{remark},
- </if>
- <if test="enableUnit != null">
- #{enableUnit},
- </if>
- <if test="buildingNumber != null">
- #{buildingNumber},
- </if>
- <if test="unitNumber != null">
- #{unitNumber},
- </if>
- <if test="filePath != null">
- #{filePath},
- </if>
- <if test="enableDownload != null">
- #{enableDownload},
- </if>
- <if test="platformType != null">
- #{platformType},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.bz.smart_city.entity.assistant.InstallPlan">
- <!--@mbg.generated-->
- update sc_install_plan
- <set>
- <if test="siteId != null">
- site_id = #{siteId},
- </if>
- <if test="planName != null">
- plan_name = #{planName},
- </if>
- <if test="province != null">
- province = #{province},
- </if>
- <if test="city != null">
- city = #{city},
- </if>
- <if test="region != null">
- region = #{region},
- </if>
- <if test="communityId != null">
- community_id = #{communityId},
- </if>
- <if test="communityName != null">
- community_name = #{communityName},
- </if>
- <if test="preInstallNumber != null">
- pre_install_number = #{preInstallNumber},
- </if>
- <if test="customerId != null">
- customer_id = #{customerId},
- </if>
- <if test="deviceTypeId != null">
- device_type_id = #{deviceTypeId},
- </if>
- <if test="installGroupName != null">
- install_group_name = #{installGroupName},
- </if>
- <if test="installGroupHeader != null">
- install_group_header = #{installGroupHeader},
- </if>
- <if test="phone != null">
- phone = #{phone},
- </if>
- <if test="planStartDate != null">
- plan_start_date = #{planStartDate},
- </if>
- <if test="planEndDate != null">
- plan_end_date = #{planEndDate},
- </if>
- <if test="planStatus != null">
- plan_status = #{planStatus},
- </if>
- <if test="dateCreate != null">
- date_create = #{dateCreate},
- </if>
- <if test="dateUpdate != null">
- date_update = #{dateUpdate},
- </if>
- <if test="createBy != null">
- create_by = #{createBy},
- </if>
- <if test="updateBy != null">
- update_by = #{updateBy},
- </if>
- <if test="status != null">
- `status` = #{status},
- </if>
- <if test="remark != null">
- remark = #{remark},
- </if>
- <if test="enableUnit != null">
- enable_unit = #{enableUnit},
- </if>
- <if test="buildingNumber != null">
- building_number = #{buildingNumber},
- </if>
- <if test="unitNumber != null">
- unit_number = #{unitNumber},
- </if>
- <if test="filePath != null">
- file_path = #{filePath},
- </if>
- <if test="enableDownload != null">
- enable_download = #{enableDownload},
- </if>
- </set>
- where id = #{id}
- </update>
- <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
- <!--@mbg.generated-->
- insert into sc_install_plan
- (site_id, plan_name, province, city, region, community_id, community_name, pre_install_number,
- customer_id, device_type_id, install_group_name, install_group_header, phone, plan_start_date,
- plan_end_date, plan_status, date_create, date_update, create_by, update_by, `status`,
- remark, enable_unit, building_number, unit_number, file_path, enable_download)
- values
- <foreach collection="list" item="item" separator=",">
- (#{item.siteId}, #{item.planName}, #{item.province}, #{item.city}, #{item.region},
- #{item.communityId}, #{item.communityName}, #{item.preInstallNumber}, #{item.customerId},
- #{item.deviceTypeId}, #{item.installGroupName}, #{item.installGroupHeader}, #{item.phone},
- #{item.planStartDate}, #{item.planEndDate}, #{item.planStatus}, #{item.dateCreate},
- #{item.dateUpdate}, #{item.createBy}, #{item.updateBy}, #{item.status}, #{item.remark},
- #{item.enableUnit}, #{item.buildingNumber}, #{item.unitNumber}, #{item.filePath},
- #{item.enableDownload})
- </foreach>
- </insert>
- <select id="getList" resultType="com.bz.smart_city.dto.assistant.InstallPlanDTO">
- select
- ip.id,
- ip.site_id,
- ip.plan_name,
- ip.province,
- ip.city,
- ip.region,
- ip.community_id,
- ip.pre_install_number,
- ip.customer_id,
- ip.device_type_id,
- ip.install_group_name,
- ip.install_group_header,
- ip.phone,
- ip.plan_start_date,
- ip.plan_end_date,
- ip.plan_status,
- ip.date_create,
- ip.date_update,
- ip.create_by,
- ip.update_by,
- ip.`status`,
- ip.remark,
- ip.enable_unit,
- ip.building_number,
- ip.unit_number,
- ip.enable_download,
- ip.platform_type,
- com.name as community_name,
- com.address as address,
- cus.customer_name,
- dt.equipment_type as device_type_name,
- sa1.name as province_name,
- sa2.name as city_name,
- sa3.name as region_name
- from sc_install_plan ip
- left join sc_community com on(com.id = ip.community_id)
- left join sc_customer cus on(cus.id = ip.customer_id)
- left join sc_device_type dt on(dt.id = ip.device_type_id)
- left join sc_area sa1 on sa1.id = ip.province
- left join sc_area sa2 on sa2.id = ip.city
- left join sc_area sa3 on sa3.id = ip.region
- where ip.status = 1
- <if test="type != null and type != ''"> and ip.platform_type = #{type} </if>
- <if test="siteId != null"> and ip.site_id = #{siteId} </if>
- <if test="name != null and name != ''"> AND com.name LIKE concat('%',#{name},'%')</if>
- <if test="customerList != null and customerList.size() != 0">
- and ip.customer_id in <foreach close=")" collection="customerList" item="item" open="(" separator=",">#{item.id} </foreach>
- </if>
- order by ip.date_create desc
- </select>
- <select id="findById" resultType="com.bz.smart_city.dto.assistant.InstallPlanDTO">
- select
- ip.id,
- ip.site_id,
- ip.plan_name,
- ip.province,
- ip.city,
- ip.region,
- ip.community_id,
- ip.pre_install_number,
- ip.customer_id,
- ip.device_type_id,
- ip.install_group_name,
- ip.install_group_header,
- ip.phone,
- ip.plan_start_date,
- ip.plan_end_date,
- ip.plan_status,
- ip.date_create,
- ip.date_update,
- ip.create_by,
- ip.update_by,
- ip.`status`,
- ip.remark,
- ip.enable_unit,
- ip.file_path,
- com.address as address,
- com.name as community_name,
- cus.customer_name,
- dt.equipment_type as device_type_name,
- sa1.name as province_name,
- sa2.name as city_name,
- sa3.name as region_name
- from sc_install_plan ip
- left join sc_community com on(com.id = ip.community_id)
- left join sc_customer cus on(cus.id = ip.customer_id)
- left join sc_device_type dt on(dt.id = ip.device_type_id)
- left join sc_area sa1 on sa1.id = ip.province
- left join sc_area sa2 on sa2.id = ip.city
- left join sc_area sa3 on sa3.id = ip.region
- where ip.status = 1 and ip.id = #{planId}
- </select>
- </mapper>
|