123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- <?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.AcceptPlanMapper">
- <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.assistant.AcceptPlan">
- <!--@mbg.generated-->
- <id column="id" property="id" />
- <result column="site_id" property="siteId" />
- <result column="batch_no" property="batchNo" />
- <result column="accept_time" property="acceptTime" />
- <result column="accept_sponsor" property="acceptSponsor" />
- <result column="accept_confirm_user" property="acceptConfirmUser" />
- <result column="remark" property="remark" />
- <result column="is_finished" property="isFinished" />
- <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="customer_id" property="customerId" />
- </resultMap>
- <sql id="Base_Column_List">
- <!--@mbg.generated-->
- id, site_id,batch_no, accept_time, accept_sponsor, accept_confirm_user, remark, is_finished,
- date_create, date_update, create_by, update_by,status,customer_id
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
- <!--@mbg.generated-->
- select
- <include refid="Base_Column_List" />
- from sc_accept_plan
- where id = #{id}
- and status = 1
- </select>
- <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.bz.smart_city.entity.assistant.AcceptPlan" useGeneratedKeys="true">
- <!--@mbg.generated-->
- insert into sc_accept_plan (site_id,batch_no, accept_time, accept_sponsor, accept_confirm_user, remark,
- is_finished, date_create, date_update, create_by, update_by,status,customer_id)
- values (#{siteId},#{batchNo}, #{acceptTime}, #{acceptSponsor}, #{acceptConfirmUser}, #{remark},
- #{isFinished}, #{dateCreate}, #{dateUpdate}, #{createBy}, #{updateBy},#{status},#{customerId})
- </insert>
- <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bz.smart_city.entity.assistant.AcceptPlan" useGeneratedKeys="true">
- <!--@mbg.generated-->
- insert into sc_accept_plan
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="siteId != null">
- site_id,
- </if>
- <if test="batchNo != null">
- batch_no,
- </if>
- <if test="acceptTime != null">
- accept_time,
- </if>
- <if test="acceptSponsor != null">
- accept_sponsor,
- </if>
- <if test="acceptConfirmUser != null">
- accept_confirm_user,
- </if>
- <if test="remark != null">
- remark,
- </if>
- <if test="isFinished != null">
- is_finished,
- </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>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="siteId != null">
- #{siteId},
- </if>
- <if test="batchNo != null">
- #{batchNo},
- </if>
- <if test="acceptTime != null">
- #{acceptTime},
- </if>
- <if test="acceptSponsor != null">
- #{acceptSponsor},
- </if>
- <if test="acceptConfirmUser != null">
- #{acceptConfirmUser},
- </if>
- <if test="remark != null">
- #{remark},
- </if>
- <if test="isFinished != null">
- #{isFinished},
- </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>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.bz.smart_city.entity.assistant.AcceptPlan">
- <!--@mbg.generated-->
- update sc_accept_plan
- <set>
- <if test="batchNo != null">
- batch_no = #{batchNo},
- </if>
- <if test="acceptTime != null">
- accept_time = #{acceptTime},
- </if>
- <if test="acceptSponsor != null">
- accept_sponsor = #{acceptSponsor},
- </if>
- <if test="acceptConfirmUser != null">
- accept_confirm_user = #{acceptConfirmUser},
- </if>
- <if test="remark != null">
- remark = #{remark},
- </if>
- <if test="isFinished != null">
- is_finished = #{isFinished},
- </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>
- </set>
- where id = #{id}
- </update>
- <select id="queryAcceptPlanList" resultType="com.bz.smart_city.dto.assistant.AcceptPlanDTO">
- SELECT
- p.id,
- p.batch_no,
- p.accept_time,
- p.accept_sponsor,
- p.accept_confirm_user,
- p.remark,
- p.is_finished,
- p.customer_id,
- (select count(1) from sc_install_list l where l.accept_plan_id = p.id and l.`status` = 1) as meter_number,
- p.date_create,
- c.customer_name
- FROM
- sc_accept_plan p
- left join sc_customer c on (c.id = p.customer_id)
- WHERE
- p.status = 1
- <if test="siteId != null">
- and p.site_id = #{siteId}
- </if>
- <if test= "batchNo != null and batchNo != '' ">
- and batch_no like #{batchNo}
- </if>
- <if test="isFinished != null">
- and is_finished = #{isFinished}
- </if>
- <if test="customerId != null">
- and customer_id = #{customerId}
- </if>
- <if test="customers != null and customers.size() != 0">
- and customer_id in
- <foreach collection="customers" item="customer" open="(" separator="," close=")">
- #{customer.id}
- </foreach>
- </if>
- order by p.date_create desc
- </select>
- <select id="check" resultType="com.bz.smart_city.dto.assistant.InstallListDTO">
- SELECT
- t.id as id,
- t.install_time as install_time,
- t.device_no as device_no,
- t.electronic_no as electronic_no,
- t.new_meter_start as new_meter_start,
- ct.customer_name as customer_name,
- t.customer_id,
- c.`name` as community_name,
- b.community as community_id,
- b.`name` as building_name,
- t.building_id,
- t.door_no as door_no
- FROM
- sc_install_list t
- left join sc_building b on (t.building_id = b.id) and b.status = 1
- left join sc_community c on (c.id = b.community) and c.status = 1
- left join sc_customer ct on (t.customer_id = ct.id) and ct.status = 1
- WHERE
- t.is_installed = 1 and t.status = 1
- <if test="siteId != null">
- and t.site_id = #{siteId}
- </if> and t.accept_plan_id = #{acceptPlanId}
- </select>
- </mapper>
|