wuxw
2019-12-01 7987c4f005f5bd8739411d08e4e3bfb67e4df9ef
java110-db/src/main/resources/mapper/hardwareAdapation/MachineTranslateServiceDaoImplMapper.xml
@@ -4,6 +4,34 @@
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="machineTranslateServiceDaoImpl">
    <!-- 保存设备同步信息 add by wuxw 2018-07-03 -->
    <insert id="saveMachineTranslate" parameterType="Map">
    insert into machine_translate(
    machine_id,machine_code,status_cd,type_cd,machine_translate_id,obj_id,obj_name,state,community_id,b_id
    ) values (
    #{machineId},#{machineCode},'0',#{typeCd},#{machineTranslateId},#{objId},#{objName},#{state},#{communityId},#{bId}
    )
 </insert>
    <update id="updateMachineTranslate" parameterType="Map">
        update machine_translate t set
        <if test="statusCd !=null and statusCd != ''">
             t.status_cd= #{statusCd},
        </if>
        <if test="state !=null and state != ''">
             t.state= #{state}
        </if>
        where 1=1
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="objId !=null and objId != ''">
            and t.obj_id= #{objId}
        </if>
        <if test="machineId !=null and machineId != ''">
            and t.machine_id= #{machineId}
        </if>
    </update>
    <!-- 保存设备同步信息 add by wuxw 2018-07-03 -->
    <insert id="saveBusinessMachineTranslateInfo" parameterType="Map">
           insert into business_machine_translate(
@@ -100,9 +128,15 @@
        select t.machine_id,t.machine_id machineId,t.machine_code,t.machine_code machineCode,t.type_cd,t.type_cd
        typeCd,t.machine_translate_id,t.machine_translate_id machineTranslateId,t.obj_id,t.obj_id
        objId,t.status_cd,t.status_cd statusCd,t.obj_name,t.obj_name objName,t.state,t.community_id,t.community_id
        communityId,t.b_id,t.b_id bId
        from machine_translate t
        communityId,t.b_id,t.b_id bId,td.name typeCdName,td1.name stateName
        from machine_translate t,t_dict td,t_dict td1
        where 1 =1
        and t.type_cd=td.status_cd
        and td.table_name='machine_translate'
        and td.table_columns='type_cd'
        and t.state=td1.status_cd
        and td1.table_name='machine_translate'
        and td1.table_columns='state'
        <if test="machineId !=null and machineId != ''">
            and t.machine_id= #{machineId}
        </if>
@@ -180,8 +214,14 @@
    <!-- 查询设备同步数量 add by wuxw 2018-07-03 -->
    <select id="queryMachineTranslatesCount" parameterType="Map" resultType="Map">
        select count(1) count
        from machine_translate t
        from machine_translate t,t_dict td,t_dict td1
        where 1 =1
        and t.type_cd=td.status_cd
        and td.table_name='machine_translate'
        and td.table_columns='type_cd'
        and t.state=td1.status_cd
        and td1.table_name='machine_translate'
        and td1.table_columns='state'
        <if test="machineId !=null and machineId != ''">
            and t.machine_id= #{machineId}
        </if>
@@ -216,13 +256,16 @@
    </select>
    <update id="updateMachineTranslateState" parameterMap="Map">
    <update id="updateMachineTranslateState" parameterType="Map">
        update machine_translate t set t.state = #{state}
        where
        t.machine_code= #{machineCode}
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="objId !=null and objId != ''">
            and t.obj_id= #{objId}
        </if>
    </update>
</mapper>