Traverse map parameters in xml

Traversing the map in xml is the same as traversing the list in the map

Unnecessary can be removed

param.remove("navTabId");

param.remove("callbackType");

param.remove("menuitemId");

param.put("PROVINCE_AREA_KEY", param.get("provinceAreaKey"));

param.put("CITY_AREA_KEY", param.get("cityAreaKey"));//Replace with database field

param.put("COUNTY_AREA_KEY", param.get("country"));

param.remove("provinceAreaKey");

param.remove("cityAreaKey");

param.remove("country");

param.remove("button2");

Map<String,Object> paramm = new HashMap<String,Object>();

paramm.put("param", param);

tbCusFirmChgMapper.saveDataMapFIRM (paramm);

tbCusFirmChgMapper.saveDataMapFIRMCHG (paramm);

 It is directly that the things in paramm can be directly accepted by xml. If there is a map or list in the paramm, it should be received like the following (after the map is passed in, only one layer is peeled off by default)

 

  Traversing map in xml

 <insert id="saveDataMapFIRMCHG" parameterType="map" >

    INSERT INTO TB_CUS_FIRM_CHG

    <foreach collection="param.keys" item="k" open="(" close=")" separator=",">   

        ${k} 

   </foreach> 

     VALUES

    <foreach collection="param.keys" item="k" open="(" close=")" separator=",">   

    <if test="null != param[k]">    

        #{param[${k}]}  

    </if>  

   </foreach> 

  

  </insert>

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326565470&siteId=291194637