diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysRecipesPlanController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysRecipesPlanController.java index d3383d550..4980da27f 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysRecipesPlanController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysRecipesPlanController.java @@ -1,19 +1,19 @@ package com.stdiet.web.controller.custom; -import java.util.List; - -import com.stdiet.common.utils.StringUtils; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; import com.stdiet.common.annotation.Log; import com.stdiet.common.core.controller.BaseController; import com.stdiet.common.core.domain.AjaxResult; +import com.stdiet.common.core.page.TableDataInfo; import com.stdiet.common.enums.BusinessType; +import com.stdiet.common.utils.StringUtils; +import com.stdiet.common.utils.poi.ExcelUtil; import com.stdiet.custom.domain.SysRecipesPlan; import com.stdiet.custom.service.ISysRecipesPlanService; -import com.stdiet.common.utils.poi.ExcelUtil; -import com.stdiet.common.core.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; /** * 食谱计划Controller @@ -23,8 +23,7 @@ import com.stdiet.common.core.page.TableDataInfo; */ @RestController @RequestMapping("/recipes/recipesPlan") -public class SysRecipesPlanController extends BaseController -{ +public class SysRecipesPlanController extends BaseController { @Autowired private ISysRecipesPlanService sysRecipesPlanService; @@ -33,25 +32,29 @@ public class SysRecipesPlanController extends BaseController */ @PreAuthorize("@ss.hasPermi('recipes:plan:list')") @GetMapping("/list") - public TableDataInfo list(SysRecipesPlan sysRecipesPlan) - { + public TableDataInfo list(SysRecipesPlan sysRecipesPlan) { startPage(); List list = sysRecipesPlanService.selectPlanListByCondition(sysRecipesPlan); - for(SysRecipesPlan plan : list){ - if(StringUtils.isNotEmpty(plan.getPhone())){ + for (SysRecipesPlan plan : list) { + if (StringUtils.isNotEmpty(plan.getPhone())) { plan.setHidePhone(StringUtils.hiddenPhoneNumber(plan.getPhone())); } } return getDataTable(list); } + @PreAuthorize("@ss.hasPermi('recipes:plan:add')") + @PostMapping("/add") + public AjaxResult add(@RequestBody SysRecipesPlan sysRecipesPlan) { + return toAjax(sysRecipesPlanService.insertSysRecipesPlan(sysRecipesPlan)); + } + /** * 根据订单查询完整食谱计划列表 */ @PreAuthorize("@ss.hasPermi('recipes:plan:list')") @GetMapping("/getAllPlanByOrderId") - public TableDataInfo getAllPlanByOrderId(SysRecipesPlan sysRecipesPlan) - { + public TableDataInfo getAllPlanByOrderId(SysRecipesPlan sysRecipesPlan) { startPage(); List list = sysRecipesPlanService.selectPlanListByOrderId(sysRecipesPlan); return getDataTable(list); @@ -68,8 +71,7 @@ public class SysRecipesPlanController extends BaseController */ @PreAuthorize("@ss.hasPermi('recipes:plan:query')") @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { + public AjaxResult getInfo(@PathVariable("id") Long id) { return AjaxResult.success(sysRecipesPlanService.selectSysRecipesPlanById(id)); } @@ -79,8 +81,7 @@ public class SysRecipesPlanController extends BaseController @PreAuthorize("@ss.hasPermi('recipes:plan:edit')") @Log(title = "食谱计划", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody SysRecipesPlan sysRecipesPlan) - { + public AjaxResult edit(@RequestBody SysRecipesPlan sysRecipesPlan) { return toAjax(sysRecipesPlanService.updateSysRecipesPlan(sysRecipesPlan)); } @@ -90,11 +91,10 @@ public class SysRecipesPlanController extends BaseController @PreAuthorize("@ss.hasPermi('recipes:plan:export')") @Log(title = "食谱计划", businessType = BusinessType.EXPORT) @GetMapping("/export") - public AjaxResult export(SysRecipesPlan sysRecipesPlan) - { + public AjaxResult export(SysRecipesPlan sysRecipesPlan) { List list = sysRecipesPlanService.selectPlanListByCondition(sysRecipesPlan); - for(SysRecipesPlan plan : list){ - if(StringUtils.isNotEmpty(plan.getPhone())){ + for (SysRecipesPlan plan : list) { + if (StringUtils.isNotEmpty(plan.getPhone())) { plan.setHidePhone(StringUtils.hiddenPhoneNumber(plan.getPhone())); } } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java index d97e1cd66..6ec60aca3 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java @@ -39,6 +39,8 @@ public class SysCustomer extends BaseEntity @Excel(name = "进粉日期", width = 30, dateFormat = "yyyy-MM-dd") private Date fansTime; + private Integer fansChannel; + /** 邮箱 */ @Excel(name = "邮箱") private String email; diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml index 2b3904328..9bf06d611 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml @@ -13,6 +13,7 @@ + @@ -28,7 +29,7 @@ - select id, name, phone, email, fans_time, address, pay_date, start_date, purchase_num, pay_total, main_dietitian, assistant_dietitian, after_dietitian, salesman, charge_person, follow_status, create_time, create_by, update_time, update_by from sys_customer + select id, name, phone, email, fans_time, fans_channel, address, pay_date, start_date, purchase_num, pay_total, main_dietitian, assistant_dietitian, after_dietitian, salesman, charge_person, follow_status, create_time, create_by, update_time, update_by from sys_customer