| | |
| | | |
| | | |
| | | <insert id="addPro"> |
| | | REPLACE into db_ram_db.tb_fbs9100s_dfu_state(dev_id,dfu_wr_stat,dfu_data_blocknum) |
| | | SELECT DISTINCT fBSDeviceId,0,1 FROM db_battinf.tb_battinf |
| | | <where> |
| | | fBSDeviceId not in(select DISTINCT dev_id from db_ram_db.tb_fbs9100s_dfu_state where dfu_en=true) |
| | | <if test="num == 0"> |
| | | and stationid=#{stationName} |
| | | </if> |
| | | <if test="num == 1"> |
| | | and stationname1=#{stationName} |
| | | </if> |
| | | <if test="num == 2"> |
| | | and stationname2=#{stationName} |
| | | </if> |
| | | <if test="num == 5"> |
| | | and stationname5=#{stationName} |
| | | </if> |
| | | </where> |
| | | merge into db_ram_db.tb_fbs9100s_dfu_state tgt |
| | | using( |
| | | SELECT DISTINCT fBSDeviceId,0,1 FROM db_battinf.tb_battinf |
| | | <where> |
| | | fBSDeviceId not in(select DISTINCT dev_id from db_ram_db.tb_fbs9100s_dfu_state where dfu_en=true) |
| | | <if test="num == 0"> |
| | | and stationid=#{stationName} |
| | | </if> |
| | | <if test="num == 1"> |
| | | and stationname1=#{stationName} |
| | | </if> |
| | | <if test="num == 2"> |
| | | and stationname2=#{stationName} |
| | | </if> |
| | | <if test="num == 5"> |
| | | and stationname5=#{stationName} |
| | | </if> |
| | | </where> |
| | | ) src on tgt.dev_id=src.fBSDeviceId |
| | | when not matched then |
| | | insert(dev_id,dfu_wr_stat,dfu_data_blocknum) values(src.fBSDeviceId,0,1) |
| | | when matched then |
| | | update set dfu_wr_stat=0,dfu_data_blocknum=1 |
| | | |
| | | </insert> |
| | | |
| | | <update id="updatePro"> |