14 changed files with 562 additions and 46 deletions
@ -0,0 +1,60 @@ |
|||
package com.ccsens.tcm.api; |
|||
|
|||
import com.ccsens.tcm.service.IImportService; |
|||
import com.ccsens.tcm.uitl.Constant; |
|||
import com.ccsens.util.JsonResponse; |
|||
import com.ccsens.util.PropUtil; |
|||
import com.ccsens.util.UploadFileUtil_Servlet3; |
|||
import io.swagger.annotations.*; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.annotation.Resource; |
|||
import javax.servlet.http.Part; |
|||
import java.io.File; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Slf4j |
|||
@Api(tags = "试题相关接口") |
|||
@RestController |
|||
@RequestMapping("/import") |
|||
public class ImportController { |
|||
@Resource |
|||
private IImportService importService; |
|||
|
|||
|
|||
@ApiOperation(value = "导入试题类型",notes = "文件大小不能超过20M,支持后缀:.xls|.xlsx") |
|||
@ApiImplicitParams({}) |
|||
@RequestMapping(value = "/code", method = RequestMethod.POST) |
|||
public JsonResponse importCode(@RequestParam(required = true) Part file) throws Exception{ |
|||
|
|||
//1.上传文件
|
|||
String allowedExts = "xls,xlsx"; |
|||
String dir = PropUtil.path; |
|||
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir); |
|||
File excelFile = new File(dir+path); |
|||
|
|||
importService.importReport(excelFile); |
|||
log.info("导入试题类型成功"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
@ApiOperation(value = "导入病史相关",notes = "文件大小不能超过20M,支持后缀:.xls|.xlsx") |
|||
@ApiImplicitParams({}) |
|||
@RequestMapping(value = "/BSXG", method = RequestMethod.POST) |
|||
public JsonResponse importBsxg(@RequestParam(required = true) Part file) throws Exception{ |
|||
|
|||
//1.上传文件
|
|||
String allowedExts = "xls,xlsx"; |
|||
String dir = PropUtil.path; |
|||
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir); |
|||
File excelFile = new File(dir+path); |
|||
|
|||
importService.importBsxg(excelFile, Constant.Report.CODE_BSXG); |
|||
log.info("导入病史相关成功"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.ccsens.tcm.persist.dao; |
|||
|
|||
import com.ccsens.tcm.bean.po.Question; |
|||
import com.ccsens.tcm.persist.mapper.QuestionMapper; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Repository |
|||
public interface QuestionDao extends QuestionMapper { |
|||
/** |
|||
* 批量添加题目 |
|||
* @param questionList 读取的题目 |
|||
*/ |
|||
void insertBatch(List<Question> questionList); |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.ccsens.tcm.persist.dao; |
|||
|
|||
import com.ccsens.tcm.bean.po.QuestionOption; |
|||
import com.ccsens.tcm.persist.mapper.QuestionOptionMapper; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Repository |
|||
public interface QuestionOptionDao extends QuestionOptionMapper { |
|||
/** |
|||
* 批量添加题目选项 |
|||
* @param optionList 选项 |
|||
*/ |
|||
void insertBatch(List<QuestionOption> optionList); |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.ccsens.tcm.persist.dao; |
|||
|
|||
import com.ccsens.tcm.bean.po.ReportCode; |
|||
import com.ccsens.tcm.persist.mapper.ReportCodeMapper; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Repository |
|||
public interface ReportCodeDao extends ReportCodeMapper { |
|||
/** |
|||
* 批量添加测试类型 |
|||
* @param reportList 从表里读取的类型对象数组 |
|||
*/ |
|||
void insertBatch(List<ReportCode> reportList); |
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.ccsens.tcm.service; |
|||
|
|||
import java.io.File; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
public interface IImportService { |
|||
/** |
|||
* 导入测试的类型 |
|||
* @param excelFile excel文件 |
|||
*/ |
|||
void importReport(File excelFile) throws Exception; |
|||
|
|||
/** |
|||
* 导入病史相关试题 |
|||
* @param excelFile excel文件 |
|||
* @param codeBsxg sheet名 |
|||
*/ |
|||
void importBsxg(File excelFile, String codeBsxg) throws Exception; |
|||
} |
@ -0,0 +1,223 @@ |
|||
package com.ccsens.tcm.service; |
|||
|
|||
import cn.hutool.core.lang.Snowflake; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.ccsens.tcm.bean.po.*; |
|||
import com.ccsens.tcm.persist.dao.QuestionDao; |
|||
import com.ccsens.tcm.persist.dao.QuestionOptionDao; |
|||
import com.ccsens.tcm.persist.dao.ReportCodeDao; |
|||
import com.ccsens.tcm.uitl.Constant; |
|||
import com.ccsens.util.PoiUtil; |
|||
import com.ccsens.util.PropUtil; |
|||
import com.ccsens.util.StringUtil; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Propagation; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.util.CollectionUtils; |
|||
import org.springframework.util.StringUtils; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.io.File; |
|||
import java.util.*; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
|||
public class ImportService implements IImportService { |
|||
@Resource |
|||
private ReportCodeDao reportCodeDao; |
|||
@Resource |
|||
private Snowflake snowflake; |
|||
@Resource |
|||
private QuestionDao questionDao; |
|||
@Resource |
|||
private QuestionOptionDao questionOptionDao; |
|||
|
|||
@Override |
|||
public void importReport(File excelFile) throws Exception { |
|||
List<Object[]> reports = PoiUtil.readExce(excelFile, 0, null,1, false); |
|||
log.info("读取数据完成"); |
|||
List<ReportCode> reportList = new ArrayList<>(); |
|||
for (Object[] objs: reports) { |
|||
if (!(objs != null && objs.length >= 2 && !StringUtils.isEmpty(objs[0]) && !StringUtils.isEmpty(objs[1]))) { |
|||
log.info("测评报告单数据不足,跳转下一行"); |
|||
continue; |
|||
} |
|||
ReportCode report = initReport(objs); |
|||
reportList.add(report); |
|||
} |
|||
if (!reportList.isEmpty()) { |
|||
reportCodeDao.insertBatch(reportList); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void importBsxg(File excelFile, String codeBsxg) throws Exception { |
|||
log.info("导入试题参数:{}, {}", excelFile, codeBsxg); |
|||
List<String> types = new ArrayList<>(); |
|||
if (Constant.Question.ALL.equalsIgnoreCase(codeBsxg)) { |
|||
types.addAll(Constant.Question.QUESTION_TYPE); |
|||
} else { |
|||
types.add(codeBsxg); |
|||
} |
|||
log.info("导入试题类型:{}", types); |
|||
for (String sheetName: types) { |
|||
List<Object[]> questions = PoiUtil.readExce(excelFile, -1, sheetName,1, true); |
|||
saveQuestions(questions, sheetName); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 保存试题 |
|||
* */ |
|||
private void saveQuestions(List<Object[]> questions , String evaluationCode) throws Exception{ |
|||
List<Question> questionList = new ArrayList<>(); |
|||
List<QuestionOption> optionList = new ArrayList<>(); |
|||
|
|||
//关联的选项的id
|
|||
Long optionId = null; |
|||
for(Object[] objs : questions) { |
|||
if (objs == null || objs.length < 4 || StringUtils.isEmpty(objs[2])) { |
|||
log.info("数据不足,跳转下一行"); |
|||
continue; |
|||
} |
|||
int sort = StringUtil.checkNum(String.valueOf(objs[3]), false) ? Integer.parseInt(String.valueOf(objs[3])) : 1; |
|||
String code = StringUtils.isEmpty(objs[1]) ? Constant.STRING_DEFAULT : String.valueOf(objs[1]); |
|||
String type = String.valueOf(objs[0]); |
|||
switch (type) { |
|||
case "题目" : |
|||
Question question = initQuestion(objs, code, sort,null); |
|||
questionList.add(question); |
|||
break; |
|||
case "选项" : |
|||
if (questionList.isEmpty()) { |
|||
break; |
|||
} |
|||
QuestionOption option = initOption(objs, questionList.get(questionList.size()-1).getId(), sort); |
|||
optionList.add(option); |
|||
optionId = option.getId(); |
|||
break; |
|||
case "关联题目" : |
|||
if (optionList.isEmpty()) { |
|||
break; |
|||
} |
|||
Question relevanceQuestion = initQuestion(objs, code, sort, optionId); |
|||
questionList.add(relevanceQuestion); |
|||
break; |
|||
case "关联题目的选项" : |
|||
if (questionList.isEmpty()) { |
|||
break; |
|||
} |
|||
QuestionOption relevanceOption = initOption(objs, questionList.get(questionList.size()-1).getId(), sort); |
|||
optionList.add(relevanceOption); |
|||
break; |
|||
default: |
|||
log.info("{}类型未知,不解析", type); |
|||
break; |
|||
} |
|||
} |
|||
if (!questionList.isEmpty()) { |
|||
questionDao.insertBatch(questionList); |
|||
} |
|||
if (!optionList.isEmpty()) { |
|||
questionOptionDao.insertBatch(optionList); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 初始化选项 |
|||
* @param objs 表格内读取的数据 |
|||
* @param questionId 试题id |
|||
* @param sort 排序 |
|||
* @return 返回选项 |
|||
*/ |
|||
private QuestionOption initOption(Object[] objs, Long questionId, int sort) { |
|||
QuestionOptionExample example = new QuestionOptionExample(); |
|||
example.createCriteria().andQuestionIdEqualTo(questionId).andSortEqualTo(sort); |
|||
List<QuestionOption> options = questionOptionDao.selectByExample(example); |
|||
//转化option
|
|||
QuestionOption option; |
|||
if (CollectionUtils.isEmpty(options)) { |
|||
option = new QuestionOption(); |
|||
option.setId(snowflake.nextId()); |
|||
} else { |
|||
option = options.get(0); |
|||
} |
|||
|
|||
option.setQuestionId(questionId); |
|||
option.setSort(sort); |
|||
String value = objs.length>2 && StringUtils.isEmpty(objs[2]) ? Constant.STRING_DEFAULT : String.valueOf(objs[2]); |
|||
option.setShowValue(value); |
|||
option.setSubmitValue(value); |
|||
option.setAfterOperation(objs.length>7 && StringUtil.checkNum(String.valueOf(objs[7]), false) ? Byte.parseByte(String.valueOf(objs[7])) : Constant.NUMBER_DEFAULT); |
|||
|
|||
log.info("导入选项:{}", option); |
|||
return option; |
|||
} |
|||
|
|||
/** |
|||
* 初始化报告单对象,若该对象已存在,则返回null |
|||
* @param objs 表格内读取的数据 |
|||
* @return 返回测试类型 |
|||
*/ |
|||
private ReportCode initReport(Object[] objs) { |
|||
ReportCodeExample example = new ReportCodeExample(); |
|||
example.createCriteria().andCodeEqualTo((String) objs[0]); |
|||
List<ReportCode> list = reportCodeDao.selectByExample(example); |
|||
ReportCode report; |
|||
if (!CollectionUtils.isEmpty(list)) { |
|||
report = list.get(0); |
|||
} else { |
|||
report = new ReportCode(); |
|||
report.setId(snowflake.nextId()); |
|||
} |
|||
report.setCode((String) objs[0]); |
|||
report.setName((String) objs[1]); |
|||
report.setParentCode(objs.length > 2 && !StringUtils.isEmpty(objs[2]) ? (String) objs[2] : Constant.STRING_DEFAULT); |
|||
report.setReportType(objs.length > 3 && StringUtil.checkNum(String.valueOf(objs[3]),false)? Byte.parseByte((String) objs[3]) : Constant.NUMBER_DEFAULT); |
|||
report.setMust(objs.length > 4 && StringUtil.checkNum(String.valueOf(objs[4]), false) ? Byte.parseByte((String) (objs[4])) : Constant.NUMBER_DEFAULT); |
|||
report.setSort(objs.length > 5 && StringUtil.checkNum(String.valueOf(objs[5]), false) ? Integer.parseInt((String) (objs[5])) : Constant.NUMBER_DEFAULT_SORT); |
|||
report.setLevel(objs.length > 6 && StringUtil.checkNum(String.valueOf(objs[6]), false) ? Byte.parseByte((String)(objs[6])) : Constant.NUMBER_DEFAULT_SORT); |
|||
report.setRemark(objs.length > 7 && !StringUtils.isEmpty(objs[7]) ? (String) objs[7] : Constant.STRING_DEFAULT); |
|||
return report; |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 初始化试题 |
|||
* @param objs 表格内读取的数据 |
|||
* @param evaluationCode 试题类型 |
|||
* @param sort 排序 |
|||
* @return 返回试题 |
|||
*/ |
|||
private Question initQuestion(Object[] objs, String evaluationCode, int sort,Long optionId) { |
|||
QuestionExample example = new QuestionExample(); |
|||
example.createCriteria().andCodeEqualTo(evaluationCode).andSortEqualTo(sort); |
|||
List<Question> questions = questionDao.selectByExample(example); |
|||
Question question; |
|||
if (CollectionUtils.isEmpty(questions)) { |
|||
question = new Question(); |
|||
question.setId(snowflake.nextId()); |
|||
} else { |
|||
question = questions.get(0); |
|||
} |
|||
question.setCode(StringUtils.isEmpty(objs[1]) ? Constant.STRING_DEFAULT : String.valueOf(objs[1])); |
|||
question.setQuestion(StringUtils.isEmpty(objs[2]) ? Constant.STRING_DEFAULT : String.valueOf(objs[2])); |
|||
question.setSort(sort); |
|||
question.setType(objs.length>4 && StringUtil.checkNum(String.valueOf(objs[4]), false) ? Byte.parseByte(String.valueOf(objs[4])) : Constant.Question.QUESTION_SHOW_TYPE); |
|||
question.setUnits(objs.length>5 && StringUtils.isEmpty(objs[5]) ? Constant.STRING_DEFAULT : String.valueOf(objs[5])); |
|||
question.setSearchCriteria(objs.length>6 && StringUtil.checkNum(String.valueOf(objs[6]), false) ? Byte.parseByte(String.valueOf(objs[6])) : Constant.Question.QUESTION_SHOW_TYPE); |
|||
question.setRemark(objs.length > 8 && !StringUtils.isEmpty(objs[8]) ? (String) objs[8] : Constant.STRING_DEFAULT); |
|||
question.setRelevanceOptionId(optionId == null ? 0 : optionId); |
|||
|
|||
log.info("导入试题:{}", question); |
|||
return question; |
|||
} |
|||
} |
@ -0,0 +1,56 @@ |
|||
package com.ccsens.tcm.uitl; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: wuHuiJuan |
|||
* @create: 2019/11/29 17:21 |
|||
*/ |
|||
public class Constant { |
|||
/**逗号*/ |
|||
public static final String COMMA = "[,,]"; |
|||
/**图片*/ |
|||
public static final String IMG = ".png,.jpg,.jpeg,.gif,.bmp"; |
|||
/**视频音频*/ |
|||
public static final String VIDEO = ".flv,swf,mkv,avi,rm,rmvb,mpeg,mpg,.ogg,ogv,mov,wmv,mp4,webm,mp3,wav,mid,.wma"; |
|||
/**上传图片访问路径*/ |
|||
public static final String UPLOAD_URL = "uploads/"; |
|||
|
|||
/**数字默认值*/ |
|||
public final static byte NUMBER_DEFAULT = 0; |
|||
/**排序默认值*/ |
|||
public final static byte NUMBER_DEFAULT_SORT = 1; |
|||
/**数字默认值*/ |
|||
public final static BigDecimal NUMBER_DEFAULT_BIGDECIMAL = BigDecimal.valueOf(0); |
|||
/**字符串默认值*/ |
|||
public final static String STRING_DEFAULT = ""; |
|||
public final static byte SEX_MAN = 0; |
|||
public final static byte SEX_WOMAN = 1; |
|||
|
|||
public static class Report{ |
|||
public final static String PARENT_CODE = "TCM"; |
|||
public final static String CODE_BSXG = "BSXG"; |
|||
|
|||
} |
|||
|
|||
public static class Question { |
|||
public final static String ALL = "all"; |
|||
/**默认题目类型*/ |
|||
public final static byte QUESTION_SHOW_TYPE = 1; |
|||
/**默认选项类型*/ |
|||
public final static byte RULE_TYPE_DEFAULT = 1; |
|||
/**测评分类*/ |
|||
public final static List<String> QUESTION_TYPE = new ArrayList<>(); |
|||
public final static Map<String, Byte> TYPE = new HashMap<>(); |
|||
static { |
|||
QUESTION_TYPE.add("TCM"); |
|||
QUESTION_TYPE.add("BSXG"); |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,31 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.ccsens.tcm.persist.dao.QuestionDao"> |
|||
<resultMap id="BaseResultMap" type="com.ccsens.tcm.bean.po.Question"> |
|||
<id column="id" jdbcType="BIGINT" property="id" /> |
|||
<result column="question" jdbcType="VARCHAR" property="question" /> |
|||
<result column="code" jdbcType="VARCHAR" property="code" /> |
|||
<result column="sort" jdbcType="INTEGER" property="sort" /> |
|||
<result column="units" jdbcType="VARCHAR" property="units" /> |
|||
<result column="type" jdbcType="TINYINT" property="type" /> |
|||
<result column="relevance_option_id" jdbcType="BIGINT" property="relevanceOptionId" /> |
|||
<result column="search_criteria" jdbcType="TINYINT" property="searchCriteria" /> |
|||
<result column="remark" jdbcType="VARCHAR" property="remark" /> |
|||
<result column="operator" jdbcType="BIGINT" property="operator" /> |
|||
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" /> |
|||
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" /> |
|||
<result column="rec_status" jdbcType="TINYINT" property="recStatus" /> |
|||
</resultMap> |
|||
<insert id="insertBatch"> |
|||
replace into t_question (id, question, code, |
|||
sort, units, type, |
|||
relevance_option_id, search_criteria, remark) |
|||
values |
|||
<foreach collection="list" item="question" separator=","> |
|||
(#{question.id,jdbcType=BIGINT}, #{question.question,jdbcType=VARCHAR}, #{question.code,jdbcType=VARCHAR}, |
|||
#{question.sort,jdbcType=INTEGER}, #{question.units,jdbcType=VARCHAR}, #{question.type,jdbcType=TINYINT}, |
|||
#{question.relevanceOptionId,jdbcType=BIGINT}, #{question.searchCriteria,jdbcType=TINYINT}, #{question.remark,jdbcType=VARCHAR}) |
|||
</foreach> |
|||
</insert> |
|||
|
|||
</mapper> |
@ -0,0 +1,26 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.ccsens.tcm.persist.dao.QuestionOptionDao"> |
|||
<resultMap id="BaseResultMap" type="com.ccsens.tcm.bean.po.QuestionOption"> |
|||
<id column="id" jdbcType="BIGINT" property="id" /> |
|||
<result column="question_id" jdbcType="BIGINT" property="questionId" /> |
|||
<result column="sort" jdbcType="INTEGER" property="sort" /> |
|||
<result column="show_value" jdbcType="VARCHAR" property="showValue" /> |
|||
<result column="submit_value" jdbcType="VARCHAR" property="submitValue" /> |
|||
<result column="after_operation" jdbcType="TINYINT" property="afterOperation" /> |
|||
<result column="operator" jdbcType="BIGINT" property="operator" /> |
|||
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" /> |
|||
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" /> |
|||
<result column="rec_status" jdbcType="TINYINT" property="recStatus" /> |
|||
</resultMap> |
|||
<insert id="insertBatch"> |
|||
replace into t_question_option (id, question_id, sort, |
|||
show_value, submit_value, after_operation) |
|||
values |
|||
<foreach collection="list" item="option" separator=","> |
|||
(#{option.id,jdbcType=BIGINT}, #{option.questionId,jdbcType=BIGINT}, #{option.sort,jdbcType=INTEGER}, |
|||
#{option.showValue,jdbcType=VARCHAR}, #{option.submitValue,jdbcType=VARCHAR}, #{option.afterOperation,jdbcType=TINYINT}) |
|||
</foreach> |
|||
</insert> |
|||
|
|||
</mapper> |
@ -0,0 +1,32 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.ccsens.tcm.persist.dao.ReportCodeDao"> |
|||
<resultMap id="BaseResultMap" type="com.ccsens.tcm.bean.po.ReportCode"> |
|||
<id column="id" jdbcType="BIGINT" property="id" /> |
|||
<result column="code" jdbcType="VARCHAR" property="code" /> |
|||
<result column="name" jdbcType="VARCHAR" property="name" /> |
|||
<result column="parent_code" jdbcType="VARCHAR" property="parentCode" /> |
|||
<result column="must" jdbcType="TINYINT" property="must" /> |
|||
<result column="level" jdbcType="TINYINT" property="level" /> |
|||
<result column="sort" jdbcType="INTEGER" property="sort" /> |
|||
<result column="remark" jdbcType="VARCHAR" property="remark" /> |
|||
<result column="report_type" jdbcType="TINYINT" property="reportType" /> |
|||
<result column="operator" jdbcType="BIGINT" property="operator" /> |
|||
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" /> |
|||
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" /> |
|||
<result column="rec_status" jdbcType="TINYINT" property="recStatus" /> |
|||
</resultMap> |
|||
<insert id="insertBatch"> |
|||
replace into t_report_code (id, code, name, |
|||
parent_code, must, level, |
|||
sort, remark, report_type) |
|||
values |
|||
<foreach collection="list" item="report" separator=","> |
|||
(#{report.id,jdbcType=BIGINT}, #{report.code,jdbcType=VARCHAR}, #{report.name,jdbcType=VARCHAR}, |
|||
#{report.parentCode,jdbcType=VARCHAR}, #{report.must,jdbcType=TINYINT}, #{report.level,jdbcType=TINYINT}, |
|||
#{report.sort,jdbcType=INTEGER}, #{report.remark,jdbcType=VARCHAR}, #{report.reportType,jdbcType=TINYINT}) |
|||
</foreach> |
|||
</insert> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue