Commit c25c406f by 裴大威

Merge branch 'feat-custom-youhua' into 'master'

优化压测环境定制服务事务插入报错

See merge request rays/pcloud-book!598
parents 33f37fa2 08dd00ae
...@@ -203,12 +203,16 @@ public class CustomPlanBizImpl implements CustomPlanBiz { ...@@ -203,12 +203,16 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
customPlanModuleMapper.insert(parentPlanModule); customPlanModuleMapper.insert(parentPlanModule);
if(PlanModuleTypeEnum.GROUP.value.equals(parentPlanModuleVO.getModuleType()) if(PlanModuleTypeEnum.GROUP.value.equals(parentPlanModuleVO.getModuleType())
&& !CollectionUtils.isEmpty(parentPlanModuleVO.getCustomPlanModuleVOList())) { && !CollectionUtils.isEmpty(parentPlanModuleVO.getCustomPlanModuleVOList())) {
List<CustomPlanModule> itemList=new ArrayList<>();
for(CustomPlanModuleVO planModuleVO : parentPlanModuleVO.getCustomPlanModuleVOList()) { for(CustomPlanModuleVO planModuleVO : parentPlanModuleVO.getCustomPlanModuleVOList()) {
CustomPlanModule planModule = new CustomPlanModule(); CustomPlanModule planModule = new CustomPlanModule();
BeanUtils.copyProperties(planModuleVO, planModule); BeanUtils.copyProperties(planModuleVO, planModule);
planModule.setParentId(parentPlanModule.getId()); planModule.setParentId(parentPlanModule.getId());
planModule.setPlanId(planId); planModule.setPlanId(planId);
customPlanModuleMapper.insert(planModule); itemList.add(planModule);
}
if(!ListUtils.isEmpty(itemList)) {
customPlanModuleMapper.batchInsert(itemList);
} }
} }
} }
......
...@@ -15,5 +15,7 @@ public interface CustomPlanModuleMapper { ...@@ -15,5 +15,7 @@ public interface CustomPlanModuleMapper {
void insert(CustomPlanModule planModule); void insert(CustomPlanModule planModule);
void batchInsert(List<CustomPlanModule> planModuleList);
List<CustomPlanModuleVO> getCustomPlanModuleByPlanId(@Param("planId") Integer planId, @Param("parentId") Integer parentId); List<CustomPlanModuleVO> getCustomPlanModuleByPlanId(@Param("planId") Integer planId, @Param("parentId") Integer parentId);
} }
\ No newline at end of file
...@@ -41,6 +41,22 @@ ...@@ -41,6 +41,22 @@
NOW(), NOW(), #{openFeedback}, #{bookName}, #{readType}) NOW(), NOW(), #{openFeedback}, #{bookName}, #{readType})
</insert> </insert>
<insert id="batchInsert" parameterType="list" useGeneratedKeys="true" keyProperty="id">
insert into custom_plan_module (plan_id,parent_id, module_type, pic_url,
type_name, title, content,
skill_id, skill_cover, app_id, agent_name,
product_id, merchant_name, product_unique_number, link_url, create_time,
update_time, open_feedback, book_name, read_type)
values
<foreach collection="list" separator="," item="item">
(#{item.planId,jdbcType=INTEGER}, #{item.parentId,jdbcType=INTEGER}, #{item.moduleType,jdbcType=INTEGER}, #{item.picUrl,jdbcType=VARCHAR},
#{item.typeName,jdbcType=VARCHAR}, #{item.title,jdbcType=VARCHAR}, #{item.content,jdbcType=VARCHAR},
#{item.skillId,jdbcType=INTEGER}, #{item.skillCover,jdbcType=VARCHAR}, #{item.appId,jdbcType=BIGINT}, #{item.agentName,jdbcType=VARCHAR},
#{item.productId,jdbcType=BIGINT}, #{item.merchantName,jdbcType=VARCHAR}, #{item.productUniqueNumber,jdbcType=VARCHAR}, #{item.linkUrl,jdbcType=VARCHAR},
NOW(), NOW(), #{item.openFeedback}, #{item.bookName}, #{item.readType})
</foreach>
</insert>
<update id="update" parameterType="CustomPlanModule"> <update id="update" parameterType="CustomPlanModule">
update custom_plan_module update custom_plan_module
<set> <set>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment