多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# Java后台导入代码示例 > Service ``` package com.scpyun.platform.ctcm.service.impl; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.scpyun.base.core.annotation.Api; import com.scpyun.base.core.annotation.ApiOperation; import com.scpyun.base.core.exception.CustomException; import com.scpyun.base.core.utils.UnifyLogger; import com.scpyun.base.db.service.CommonService; @Api("excel数据导入") @Service("excelService") public class ExcelServiceImpl { @Autowired CommonService commonService; private static String namespace = "com.juyou.platform.standard.ctcm.excel."; @ApiOperation(value = "excel数据导入", desc = "测试专用") public Map saveExcelData(Map map) { Map rtn = new HashMap(); if (map.get("dataList") == null || "".equals(map.get("dataList"))) { throw new CustomException("参数异常!"); } UnifyLogger.parent("入参:" + map); List> list = (List>) map.get("dataList"); List> falseList = new ArrayList>(); for(Map oneMap : list) { try { if (commonService.insert(namespace + "insertExcelData", oneMap) != 1) { falseList.add(oneMap); } } catch (Exception e) { falseList.add(oneMap); } } Map returnMap = new HashMap(); returnMap.put("falseList", falseList); return returnMap; } } ``` >XML ##### 此部分仅展示SQL,外框请符合公司后台框架要求,示例如下 ```` INSERT into ctc_n_user_permit_international_users_test( name, card_no, import_nation_name, sex, address, phone, create_time, create_by ) VALUES( #{name, jdbcType=VARCHAR}, #{card_no, jdbcType=VARCHAR}, #{import_nation_name, jdbcType=VARCHAR}, #{sex, jdbcType=VARCHAR}, #{address, jdbcType=VARCHAR}, #{phone, jdbcType=VARCHAR}, now(), #{_user.id, jdbcType=VARCHAR} )