/**
* 增加批量導入映射.
*
* @param
* @return
*/
@Action(value = "addImportMapper", results = { @Result(name = "addImportMapper", type = "json", params = {
"root", "jsonResult" }) })
public String addImportMapper() {
Boolean operateResult = getImportMapperService().addImportMapper(
assembleParameterToAddImportMapper());
Map<String, Object> map = new HashMap<String, Object>();
map.put("result", operateResult);
jsonResult = map;
return "addImportMapper";
}
/**
* 由於是對外提供接口,不宜顯式地暴露對象. <br/>
* 故將參數組裝成對象.
*
* @return
*/
@SuppressWarnings("unchecked")
private ImportMapper assembleParameterToAddImportMapper() {
ImportMapper importMapper = new ImportMapper();
importMapper.setUuid(UUIDGenerator.genUuidStr());
importMapper.setMapperName("教職工姓名");
importMapper.setMatchedOrgUuid("123456");
importMapper.setMapperRule("name=>name,age=>20"); //hstore類型
importMapper.setCreatorUuid("789456");
return importMapper;
}
<insert id="insertImportMapper"
parameterType="net.firstelite.bicp.dtd.personnel$manage.system.ImportMapper">
insert into t_pm_sys_import_mapper (
uuid,
mapper_name,
matched_org_uuid,
mapper_rule,
creator_uuid,
create_time,
modify_time
)values(
#{uuid},
#{mapperName},
#{matchedOrgUuid},
#{mapperRule},
#{creatorUuid},
current_timestamp(0),
current_timestamp(0)
)
</insert>
XXXMapper.xml裡面的配置為如下
insert into hstore_tb(key_value) values(#{key_value}::hstore);