FloorShareMeterV1ServiceDaoImplMapper.xml 6.17 KB
<?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="floorShareMeterV1ServiceDaoImpl">


    <!-- 保存楼栋公摊表信息 add by wuxw 2018-07-03 -->
    <insert id="saveFloorShareMeterInfo" parameterType="Map">
        insert into floor_share_meter(
        floor_id,meter_num,meter_type,fsm_id,formula_value,community_id,cur_degree,share_type,floor_num,cur_reading_time,
        config_id,config_name,share_price
        ) values (
        #{floorId},#{meterNum},#{meterType},#{fsmId},#{formulaValue},#{communityId},#{curDegree},#{shareType},#{floorNum},#{curReadingTime},
        #{configId},#{configName},#{sharePrice}
        )
    </insert>


    <!-- 查询楼栋公摊表信息 add by wuxw 2018-07-03 -->
    <select id="getFloorShareMeterInfo" parameterType="Map" resultType="Map">
        select t.floor_id floorId,t.meter_num meterNum,t.meter_type meterType,t.fsm_id fsmId,t.formula_value
        formulaValue,t.status_cd statusCd,t.community_id communityId,t.cur_degree curDegree,t.share_type
        shareType,t.floor_num floorNum,t.cur_reading_time curReadingTime,t.create_time createTime,td.name meterTypeName,
        td1.name shareTypeName,t.config_id configId,t.config_name configName,t.share_price sharePrice
        from floor_share_meter t
        left join t_dict td on t.meter_type = td.status_cd and td.table_name = 'floor_share_meter' and td.table_columns = 'meter_type'
        left join t_dict td1 on t.share_type = td1.status_cd and td1.table_name = 'floor_share_meter' and td1.table_columns = 'share_type'

        where 1 =1
        <if test="floorId !=null and floorId != ''">
            and t.floor_id= #{floorId}
        </if>
        <if test="meterNum !=null and meterNum != ''">
            and t.meter_num= #{meterNum}
        </if>
        <if test="meterType !=null and meterType != ''">
            and t.meter_type= #{meterType}
        </if>
        <if test="fsmId !=null and fsmId != ''">
            and t.fsm_id= #{fsmId}
        </if>
        <if test="formulaValue !=null and formulaValue != ''">
            and t.formula_value= #{formulaValue}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="curDegree !=null and curDegree != ''">
            and t.cur_degree= #{curDegree}
        </if>
        <if test="shareType !=null and shareType != ''">
            and t.share_type= #{shareType}
        </if>
        <if test="floorNum !=null and floorNum != ''">
            and t.floor_num= #{floorNum}
        </if>
        <if test="curReadingTime !=null and curReadingTime != ''">
            and t.cur_reading_time= #{curReadingTime}
        </if>
        order by t.create_time desc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>

    </select>


    <!-- 修改楼栋公摊表信息 add by wuxw 2018-07-03 -->
    <update id="updateFloorShareMeterInfo" parameterType="Map">
        update floor_share_meter t set t.status_cd = #{statusCd}
        <if test="meterNum !=null and meterNum != ''">
            , t.meter_num= #{meterNum}
        </if>
        <if test="meterType !=null and meterType != ''">
            , t.meter_type= #{meterType}
        </if>
        <if test="formulaValue !=null and formulaValue != ''">
            , t.formula_value= #{formulaValue}
        </if>

        <if test="curDegree !=null and curDegree != ''">
            , t.cur_degree= #{curDegree}
        </if>
        <if test="shareType !=null and shareType != ''">
            , t.share_type= #{shareType}
        </if>
        <if test="floorNum !=null and floorNum != ''">
            , t.floor_num= #{floorNum}
        </if>
        <if test="curReadingTime !=null and curReadingTime != ''">
            , t.cur_reading_time= #{curReadingTime}
        </if>
        <if test="configId !=null and configId != ''">
            , t.config_id= #{configId}
        </if>
        <if test="configName !=null and configName != ''">
            , t.config_name= #{configName}
        </if>
        <if test="sharePrice !=null and sharePrice != ''">
            , t.share_price= #{sharePrice}
        </if>
        where 1=1
        <if test="fsmId !=null and fsmId != ''">
            and t.fsm_id= #{fsmId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="floorId !=null and floorId != ''">
            and t.floor_id= #{floorId}
        </if>

    </update>

    <!-- 查询楼栋公摊表数量 add by wuxw 2018-07-03 -->
    <select id="queryFloorShareMetersCount" parameterType="Map" resultType="Map">
        select count(1) count
        from floor_share_meter t
        where 1 =1
        <if test="floorId !=null and floorId != ''">
            and t.floor_id= #{floorId}
        </if>
        <if test="meterNum !=null and meterNum != ''">
            and t.meter_num= #{meterNum}
        </if>
        <if test="meterType !=null and meterType != ''">
            and t.meter_type= #{meterType}
        </if>
        <if test="fsmId !=null and fsmId != ''">
            and t.fsm_id= #{fsmId}
        </if>
        <if test="formulaValue !=null and formulaValue != ''">
            and t.formula_value= #{formulaValue}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="curDegree !=null and curDegree != ''">
            and t.cur_degree= #{curDegree}
        </if>
        <if test="shareType !=null and shareType != ''">
            and t.share_type= #{shareType}
        </if>
        <if test="floorNum !=null and floorNum != ''">
            and t.floor_num= #{floorNum}
        </if>
        <if test="curReadingTime !=null and curReadingTime != ''">
            and t.cur_reading_time= #{curReadingTime}
        </if>


    </select>

</mapper>