| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- <?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="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,machine_cmd,obj_b_id,remark
- ) values (
- #{machineId},#{machineCode},'0',#{typeCd},#{machineTranslateId},#{objId},#{objName},#{state},#{communityId},#{bId},#{machineCmd},
- #{objBId},#{remark}
- )
- </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>
- <if test="updateTime !=null ">
- t.update_time= #{updateTime},
- </if>
- <if test="remark !=null and remark != ''">
- t.remark= #{remark}
- </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(
- machine_id,machine_code,operate,type_cd,machine_translate_id,obj_id,obj_name,state,community_id,b_id,machine_cmd,obj_b_id,remark
- ) values (
- #{machineId},#{machineCode},#{operate},#{typeCd},#{machineTranslateId},#{objId},#{objName},#{state},#{communityId},#{bId},
- #{machineCmd},
- #{objBId},#{remark}
- )
- </insert>
- <!-- 查询设备同步信息(Business) add by wuxw 2018-07-03 -->
- <select id="getBusinessMachineTranslateInfo" parameterType="Map" resultType="Map">
- select t.machine_id,t.machine_id machineId,t.machine_code,t.machine_code
- machineCode,t.operate,t.type_cd,t.type_cd typeCd,t.machine_translate_id,t.machine_translate_id
- machineTranslateId,t.obj_id,t.obj_id objId,t.obj_name,t.obj_name objName,t.state,t.community_id,t.community_id
- communityId,t.b_id,t.b_id bId,t.machine_cmd,t.obj_b_id,t.remark
- from business_machine_translate t
- where 1 =1
- <if test="machineId !=null and machineId != ''">
- and t.machine_id= #{machineId}
- </if>
- <if test="machineCode !=null and machineCode != ''">
- and t.machine_code= #{machineCode}
- </if>
- <if test="operate !=null and operate != ''">
- and t.operate= #{operate}
- </if>
- <if test="typeCd !=null and typeCd != ''">
- and t.type_cd= #{typeCd}
- </if>
- <if test="machineTranslateId !=null and machineTranslateId != ''">
- and t.machine_translate_id= #{machineTranslateId}
- </if>
- <if test="objId !=null and objId != ''">
- and t.obj_id= #{objId}
- </if>
- <if test="objName !=null and objName != ''">
- and t.obj_name= #{objName}
- </if>
- <if test="state !=null and state != ''">
- and t.state= #{state}
- </if>
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
- </if>
- <if test="bId !=null and bId != ''">
- and t.b_id= #{bId}
- </if>
- </select>
- <!-- 保存设备同步信息至 instance表中 add by wuxw 2018-07-03 -->
- <insert id="saveMachineTranslateInfoInstance" parameterType="Map">
- insert into machine_translate(
- machine_id,machine_code,type_cd,machine_translate_id,obj_id,status_cd,obj_name,state,community_id,b_id,
- machine_cmd,obj_b_id,remark
- ) select
- t.machine_id,t.machine_code,t.type_cd,t.machine_translate_id,t.obj_id,'0',t.obj_name,t.state,t.community_id,t.b_id,
- t.machine_cmd,t.obj_b_id,t.remark
- from business_machine_translate t where 1=1
- <if test="machineId !=null and machineId != ''">
- and t.machine_id= #{machineId}
- </if>
- <if test="machineCode !=null and machineCode != ''">
- and t.machine_code= #{machineCode}
- </if>
- and t.operate= 'ADD'
- <if test="typeCd !=null and typeCd != ''">
- and t.type_cd= #{typeCd}
- </if>
- <if test="machineTranslateId !=null and machineTranslateId != ''">
- and t.machine_translate_id= #{machineTranslateId}
- </if>
- <if test="objId !=null and objId != ''">
- and t.obj_id= #{objId}
- </if>
- <if test="objName !=null and objName != ''">
- and t.obj_name= #{objName}
- </if>
- <if test="state !=null and state != ''">
- and t.state= #{state}
- </if>
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
- </if>
- <if test="bId !=null and bId != ''">
- and t.b_id= #{bId}
- </if>
- </insert>
- <!-- 查询设备同步信息 add by wuxw 2018-07-03 -->
- <select id="getMachineTranslateInfo" parameterType="Map" resultType="Map">
- 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,td.name typeCdName,td1.name stateName,t.create_time createTime,t.update_time
- updateTime,t.machine_cmd,t.obj_b_id,t.machine_cmd machineCmd,t.obj_b_id objBId,t.remark
- 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>
- <if test="machineCode !=null and machineCode != ''">
- and t.machine_code= #{machineCode}
- </if>
- <if test="typeCd !=null and typeCd != ''">
- and t.type_cd= #{typeCd}
- </if>
- <if test="machineTranslateId !=null and machineTranslateId != ''">
- and t.machine_translate_id= #{machineTranslateId}
- </if>
- <if test="objId !=null and objId != ''">
- and t.obj_id= #{objId}
- </if>
- <if test="statusCd !=null and statusCd != ''">
- and t.status_cd= #{statusCd}
- </if>
- <if test="objName !=null and objName != ''">
- and t.obj_name= #{objName}
- </if>
- <if test="state !=null and state != ''">
- and t.state= #{state}
- </if>
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
- </if>
- <if test="bId !=null and bId != ''">
- and t.b_id= #{bId}
- </if>
- order by t.update_time desc
- <if test="page != -1 and page != null ">
- limit #{page}, #{row}
- </if>
- </select>
- <!-- 修改设备同步信息 add by wuxw 2018-07-03 -->
- <update id="updateMachineTranslateInfoInstance" parameterType="Map">
- update machine_translate t set t.status_cd = #{statusCd}
- <if test="newBId != null and newBId != ''">
- ,t.b_id = #{newBId}
- </if>
- <if test="machineId !=null and machineId != ''">
- , t.machine_id= #{machineId}
- </if>
- <if test="machineCode !=null and machineCode != ''">
- , t.machine_code= #{machineCode}
- </if>
- <if test="typeCd !=null and typeCd != ''">
- , t.type_cd= #{typeCd}
- </if>
- <if test="objId !=null and objId != ''">
- , t.obj_id= #{objId}
- </if>
- <if test="objName !=null and objName != ''">
- , t.obj_name= #{objName}
- </if>
- <if test="state !=null and state != ''">
- , t.state= #{state}
- </if>
- <if test="communityId !=null and communityId != ''">
- , t.community_id= #{communityId}
- </if>
- <if test="remark !=null and remark != ''">
- ,t.remark= #{remark}
- </if>
- where 1=1
- <if test="machineTranslateId !=null and machineTranslateId != ''">
- and t.machine_translate_id= #{machineTranslateId}
- </if>
- <if test="bId !=null and bId != ''">
- and t.b_id= #{bId}
- </if>
- </update>
- <!-- 查询设备同步数量 add by wuxw 2018-07-03 -->
- <select id="queryMachineTranslatesCount" parameterType="Map" resultType="Map">
- select count(1) count
- 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>
- <if test="machineCode !=null and machineCode != ''">
- and t.machine_code= #{machineCode}
- </if>
- <if test="typeCd !=null and typeCd != ''">
- and t.type_cd= #{typeCd}
- </if>
- <if test="machineTranslateId !=null and machineTranslateId != ''">
- and t.machine_translate_id= #{machineTranslateId}
- </if>
- <if test="objId !=null and objId != ''">
- and t.obj_id= #{objId}
- </if>
- <if test="statusCd !=null and statusCd != ''">
- and t.status_cd= #{statusCd}
- </if>
- <if test="objName !=null and objName != ''">
- and t.obj_name= #{objName}
- </if>
- <if test="state !=null and state != ''">
- and t.state= #{state}
- </if>
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
- </if>
- <if test="bId !=null and bId != ''">
- and t.b_id= #{bId}
- </if>
- </select>
- <update id="updateMachineTranslateState" 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>
- <if test="updateTime !=null ">
- t.update_time= #{updateTime},
- </if>
- <if test="remark !=null and remark != ''">
- t.remark= #{remark}
- </if>
- 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>
|