diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/MyApplicationRunner.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/MyApplicationRunner.java index 0d2cda41c..4dfd26f46 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/MyApplicationRunner.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/MyApplicationRunner.java @@ -3,8 +3,12 @@ package com.stdiet.web.controller; import com.stdiet.common.utils.AliyunVideoUtils; import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.poi.ExcelUtil; +import com.stdiet.custom.domain.SysCustomerHealthy; +import com.stdiet.custom.domain.SysCustomerHealthyExtended; import com.stdiet.custom.domain.SysNutritionQuestion; import com.stdiet.custom.domain.SysNutritionalVideo; +import com.stdiet.custom.mapper.SysCustomerHealthyExtendedMapper; +import com.stdiet.custom.mapper.SysCustomerHealthyMapper; import com.stdiet.custom.mapper.SysWxUserInfoMapper; import com.stdiet.custom.mapper.SysWxUserLogMapper; import com.stdiet.custom.service.ISysNutritionQuestionService; @@ -36,6 +40,11 @@ public class MyApplicationRunner implements ApplicationRunner { @Autowired private ISysNutritionalVideoService sysNutritionalVideoService; + @Autowired + private SysCustomerHealthyMapper sysCustomerHealthyMapper; + + @Autowired + private SysCustomerHealthyExtendedMapper sysCustomerHealthyExtendedMapper; @Override public void run(ApplicationArguments args) throws Exception { @@ -44,6 +53,26 @@ public class MyApplicationRunner implements ApplicationRunner { System.out.println("--------------项目启动调用方法结束-------------"); } + /** + * 给所有的健康信息加上扩展信息 + * + */ + public void addExtendedHealthy(){ + List sysCustomerHealthies = sysCustomerHealthyMapper.selectSysCustomerHealthyList(new SysCustomerHealthy()); + System.out.println("总条数:"+sysCustomerHealthies.size()); + int success = 0; + if(sysCustomerHealthies != null && sysCustomerHealthies.size() > 0){ + for (SysCustomerHealthy sysCustomerHealthy : sysCustomerHealthies) { + SysCustomerHealthyExtended extended = new SysCustomerHealthyExtended(); + extended.setHealthyId(sysCustomerHealthy.getId()); + if(sysCustomerHealthyExtendedMapper.insertSysCustomerHealthyExtended(extended) > 0){ + success++; + } + } + } + System.out.println("成功条数:"+success); + } + /** * 给现有视频更新截图图片 */ diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHealthyServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHealthyServiceImpl.java index 94704a4e6..66619c53b 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHealthyServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHealthyServiceImpl.java @@ -111,7 +111,11 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService */ @Override public int updateSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy){ - return sysCustomerHealthyMapper.updateSysCustomerHealthy(sysCustomerHealthy); + int rows = sysCustomerHealthyMapper.updateSysCustomerHealthy(sysCustomerHealthy); + if(rows > 0){ + rows = sysCustomerHealthyExtendedMapper.updateSysCustomerHealthyExtended(sysCustomerHealthy.getHealthyExtend()); + } + return rows; } /** diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHealthyMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHealthyMapper.xml index fe07a1836..0cf157490 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHealthyMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHealthyMapper.xml @@ -557,7 +557,7 @@ \ No newline at end of file diff --git a/stdiet-ui/src/components/HealthyForm/Form9.vue b/stdiet-ui/src/components/HealthyForm/Form9.vue index 5338170cb..282374057 100644 --- a/stdiet-ui/src/components/HealthyForm/Form9.vue +++ b/stdiet-ui/src/components/HealthyForm/Form9.vue @@ -1,6 +1,6 @@