CODE,
ID,
NM,
PROVINCIAL,
PTYPE,
LGTD,
LTTD,
LGTDPC,
LTTDPC,
OBJ_ID,ORG_ID,AD_CODE,OBJ_AD_CODE
#{code},
#{id},
#{nm},
#{provincial},
#{ptype},
#{lgtd},
#{lttd},
#{lgtdpc},
#{lttdpc},
#{objId},#{orgId},#{adCode},#{objAdCode}
and ID = #{id}and NM = #{nm}and PROVINCIAL = #{provincial}and AD_CODE = #{adCode}and ORG_ID = #{orgId}and PTYPE = #{ptype}and LGTD = #{lgtd}and LTTD = #{lttd}and OBJ_ID = #{objId}and CODE = #{code}and LGTDPC = #{lgtdpc}and LTTDPC = #{lttdpc}and OBJ_AD_CODE = #{objAdCode}
SELECT CONCAT(substr(e.adm_div,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,r.uptm as obj_intm,o.nm,r.hyst_site as ad_name
from bis_insp_all_obj o inner join bis_insp_rsvr_rgstr r on o.obj_id=r.obj_id left join att_rs_base e on o.code=e.rs_code where o.ptype in (1,36) and r.state='2'
union all
SELECT CONCAT(substr(o.code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,r.uptm as obj_intm,o.nm,b.ad_full_name as ad_name from bis_insp_all_obj o
,BIS_INSP_VILL_RGSTR r,att_ad_x_base b where r.obj_id = o.obj_id and o.code=b.ad_code and r.state = '2' and o.ptype=2
union all
SELECT CONCAT(SUBSTRING(ob.loc_ad,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,t.uptm as obj_intm,o.nm,t.loac as ad_name from bis_insp_all_obj o
inner join bis_insp_wtdst_track t on o.obj_id=t.obj_id left join BIS_INSP_WTDST OB ON o.CODE = OB.WTDST_ID where o.ptype=3 and t.state='2'
union all
SELECT CONCAT(SUBSTRING(ke.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,t.uptm as obj_intm,o.nm,t.nm as ad_name
from bis_insp_all_obj o inner join bis_insp_key_register t on o.obj_id=t.obj_id left join ATT_EMPWTPRJ_BASE ke ON o.code = ke.id
where o.ptype in (4,7) and t.state='2'
union all
SELECT CONCAT(SUBSTRING(ob.adcd,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,w.uptm as obj_intm,o.nm,ob.stlc as ad_name from bis_insp_all_obj o
inner join BIS_INSP_GRW w on o.obj_id=w.obj_id left join ATT_GRW_BASE OB ON o.CODE = OB.stcd where o.ptype=5 and w.insp_state='2'
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,g.uptm as obj_intm,o.nm,ob.location_xiang as ad_name from bis_insp_all_obj o
inner join att_waga_rgstr g on o.obj_id=g.obj_id left join ATT_WAGA_BASE OB ON o.CODE = OB.obj_code where o.ptype=6 and g.state='2'
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.location as ad_name from bis_insp_all_obj o
inner join bis_insp_fsc_rgstr g on o.obj_id=g.obj_id left join att_fsc_base OB ON o.CODE = OB.id where o.ptype=9 and g.state='2'
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.location as ad_name from bis_insp_all_obj o
inner join bis_insp_other_rgstr g on o.obj_id=g.obj_id left join att_other_base OB ON o.CODE = OB.id where o.ptype=10 and g.state='2'
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.note as ad_name from bis_insp_all_obj o
inner join bis_insp_sd_rgstr g on o.obj_id=g.obj_id left join att_sd_base OB ON o.CODE = OB.SD_CODE where o.ptype=11 and g.state='2'
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.WINT_POS as ad_name from bis_insp_all_obj o
inner join bis_insp_wiu_rgstr g on o.obj_id=g.obj_id left join att_wain_base OB ON o.CODE = OB.OBJ_CODE where o.ptype=12 and g.state='2'
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.SWHS_LOC as ad_name from bis_insp_all_obj o
inner join BIS_INSP_SWHS_RGSTR g on o.obj_id=g.obj_id left join ATT_SWHS_BASE OB ON o.CODE = OB.id where o.ptype=13 and g.state='2'
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.AD_FULL_NAME as ad_name from bis_insp_all_obj o
inner join bis_insp_wint_rgstr g on o.obj_id=g.obj_id left join ATT_AD_X_BASE OB ON o.CODE = OB.AD_CODE where o.ptype=14 and g.state='2'
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.AD_FULL_NAME as ad_name from bis_insp_all_obj o
inner join bis_insp_svwt_area_rgstr g on o.obj_id=g.obj_id left join ATT_AD_X_BASE OB ON o.CODE = OB.AD_CODE where o.ptype=15 and g.state='2'
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
inner join bis_insp_svwt_wunt_rgstr g on o.obj_id=g.obj_id left join att_wunt_base OB ON o.CODE = OB.ID where o.ptype=16 and g.state='2'
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
inner join BIS_INSP_OPRD_CSTR_PROJ_RGSTR g on o.obj_id=g.obj_id left join ATT_PRD_CSTR_PROJ_BASE OB ON o.CODE = OB.ID where o.ptype=17 and g.state='2'
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
inner join ATT_JSKEJIAN_FLKDIS_RGSTR g on o.obj_id=g.obj_id left join ATT_JSKEJIAN_FLKDIS_BASE OB ON o.CODE = OB.ID where o.ptype=18 and g.state='2'
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
inner join ATT_JSKEJIAN_WATER_RGSTR g on o.obj_id=g.obj_id left join ATT_JSKEJIAN_WATER_BASE OB ON o.CODE = OB.ID where o.ptype=19 and g.state='2'
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
inner join ATT_JSKEJIAN_ECOFRD_RGSTR g on o.obj_id=g.obj_id left join ATT_JSKEJIAN_ECOFRD_BASE OB ON o.CODE = OB.ID where o.ptype=20 and g.state='2'
union all
SELECT CONCAT(SUBSTRING(e.adm_div,1,${length}), '${otherLength}') as ad_code,o.ptype,o.id,o.obj_id,r.uptm as obj_intm,o.nm,r.hyst_site as ad_name
from bis_insp_all_obj o inner join bis_insp_RSML_rgstr r on o.obj_id=r.obj_id left join att_rs_base e on o.code=e.rs_code where o.ptype = 22 and r.state='2'
and o.ad_code = '${province}'
and o.ad_code is null
insert into BIS_INSP_ALL_OBJ( )
values ( )
insert into BIS_INSP_ALL_OBJ( )
values ( )
delete from BIS_INSP_ALL_OBJ where ID = #{id}
delete from BIS_INSP_ALL_OBJ
update BIS_INSP_ALL_OBJ set flag_valid = 0 where ID = #{id}
update BIS_INSP_ALL_OBJ
ID = #{id},NM = #{nm},PTYPE = #{ptype},LGTD = #{lgtd},LTTD = #{lttd},OBJ_ID = #{objId},LGTDPC = #{lgtdpc}, LTTDPC = #{lttdpc},AD_CODE = #{adCode},ORG_ID = #{orgId},OBJ_AD_CODE = #{objAdCode},obj_id = #{objId}
update BIS_INSP_ALL_OBJ
ID = #{id},NM = #{nm},PTYPE = #{ptype},LGTD = #{lgtd},LTTD = #{lttd},OBJ_ID = #{objId},LGTDPC = #{lgtdpc},LTTDPC = #{lttdpc},OBJ_AD_CODE = #{objAdCode},
AND o.ad_code=#{province}
AND o.ad_code is null
SELECT CONCAT(SUBSTRING(e.adm_div,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,e.location as ad_name
from bis_insp_all_obj o left join att_rs_base e on o.code=e.rs_code where o.ptype in (1,36,22)
union all
SELECT CONCAT(SUBSTRING(o.code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,s.ad_full_name as ad_name from bis_insp_all_obj o,att_ad_x_base s where o.code=s.ad_code and o.ptype=2
union all
SELECT CONCAT(SUBSTRING(ob.loc_ad,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.loc_nm as ad_name from bis_insp_all_obj o left join BIS_INSP_WTDST OB ON o.CODE = OB.WTDST_ID where o.ptype=3
union all
SELECT CONCAT(SUBSTRING(ke.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ba.ad_full_name as ad_name from bis_insp_all_obj o
left join ATT_EMPWTPRJ_BASE ke ON o.code = ke.id
left join att_ad_x_base ba on ke.ad_code=ba.ad_code
where o.ptype in (4,7)
union all
SELECT CONCAT(SUBSTRING(ob.adcd,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.adnm as ad_name from bis_insp_all_obj o left join ATT_GRW_BASE OB ON o.CODE = OB.stcd where o.ptype=5
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.location_xiang as ad_name from bis_insp_all_obj o left join ATT_WAGA_BASE OB ON o.CODE = OB.obj_code where o.ptype=6
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.location as ad_name from bis_insp_all_obj o
left join att_fsc_base OB ON o.CODE = OB.id where o.ptype=9
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,ob.location as ad_name from bis_insp_all_obj o
left join att_other_base OB ON o.CODE = OB.id where o.ptype=10
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.note as ad_name from bis_insp_all_obj o
left join att_sd_base OB ON o.CODE = OB.SD_CODE where o.ptype=11
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.WINT_POS as ad_name from bis_insp_all_obj o
left join att_wain_base OB ON o.CODE = OB.OBJ_CODE where o.ptype=12
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.SWHS_LOC as ad_name from bis_insp_all_obj o
left join ATT_SWHS_BASE OB ON o.CODE = OB.id where o.ptype=13
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.AD_FULL_NAME as ad_name from bis_insp_all_obj o
left join ATT_AD_X_BASE OB ON o.CODE = OB.AD_CODE where o.ptype=14
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.AD_FULL_NAME as ad_name from bis_insp_all_obj o
left join ATT_AD_X_BASE OB ON o.CODE = OB.AD_CODE where o.ptype=15
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
left join att_wunt_base OB ON o.CODE = OB.ID where o.ptype=16
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
left join ATT_PRD_CSTR_PROJ_BASE OB ON o.CODE = OB.ID where o.ptype=17
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
left join ATT_JSKEJIAN_FLKDIS_BASE OB ON o.CODE = OB.ID where o.ptype=18
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
left join ATT_JSKEJIAN_WATER_BASE OB ON o.CODE = OB.ID where o.ptype=19
union all
SELECT CONCAT(SUBSTRING(ob.ad_code,1,${length}), '${otherLength}') as ad_code,o.code,o.ptype,o.id,o.obj_id,o.obj_intm,o.nm,OB.ad_name from bis_insp_all_obj o
left join ATT_JSKEJIAN_Ecofrd_BASE OB ON o.CODE = OB.ID where o.ptype=20
update ${tableName} SET ${stateName} = ${state}
WHERE
OBJ_ID IN
${objIds}
OBJ_ID = #{objId}