客户体征优化、客户健康修改
This commit is contained in:
		| @@ -19,9 +19,17 @@ public class SysCustomerHealthy extends BaseEntity | ||||
|     private Long id; | ||||
|  | ||||
|     /** 客户ID */ | ||||
|     @Excel(name = "客户ID") | ||||
|     //@Excel(name = "客户ID") | ||||
|     private Long customerId; | ||||
|  | ||||
|     /** 客户姓名,非持久化字段 */ | ||||
|     @Excel(name = "客户姓名") | ||||
|     private String name; | ||||
|  | ||||
|     /** 客户手机号,非持久化字段 */ | ||||
|     @Excel(name = "客户手机号") | ||||
|     private String phone; | ||||
|  | ||||
|     /** 调理项目id */ | ||||
|     @Excel(name = "调理项目id") | ||||
|     private Long conditioningProjectId; | ||||
| @@ -1145,6 +1153,22 @@ public class SysCustomerHealthy extends BaseEntity | ||||
|         return delFlag; | ||||
|     } | ||||
|  | ||||
|     public String getName() { | ||||
|         return name; | ||||
|     } | ||||
|  | ||||
|     public void setName(String name) { | ||||
|         this.name = name; | ||||
|     } | ||||
|  | ||||
|     public String getPhone() { | ||||
|         return phone; | ||||
|     } | ||||
|  | ||||
|     public void setPhone(String phone) { | ||||
|         this.phone = phone; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public String toString() { | ||||
|         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | ||||
|   | ||||
| @@ -17,13 +17,21 @@ public class SysCustomerPhysicalSigns extends BaseEntity | ||||
| { | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
|     /** $column.columnComment */ | ||||
|     /** 体征ID */ | ||||
|     private Long id; | ||||
|  | ||||
|     /** 客户id */ | ||||
|     @Excel(name = "客户id") | ||||
|     //@Excel(name = "客户id") | ||||
|     private Long customerId; | ||||
|  | ||||
|     /** 客户姓名,非持久化字段 */ | ||||
|     @Excel(name = "客户姓名") | ||||
|     private String name; | ||||
|  | ||||
|     /** 客户手机号,非持久化字段 */ | ||||
|     @Excel(name = "客户手机号") | ||||
|     private String phone; | ||||
|  | ||||
|     /** 客户性别  0男 1女 */ | ||||
|     @Excel(name = "客户性别  0男 1女") | ||||
|     private Integer sex; | ||||
| @@ -425,6 +433,22 @@ public class SysCustomerPhysicalSigns extends BaseEntity | ||||
|         this.delFlag = delFlag; | ||||
|     } | ||||
|  | ||||
|     public String getName() { | ||||
|         return name; | ||||
|     } | ||||
|  | ||||
|     public void setName(String name) { | ||||
|         this.name = name; | ||||
|     } | ||||
|  | ||||
|     public String getPhone() { | ||||
|         return phone; | ||||
|     } | ||||
|  | ||||
|     public void setPhone(String phone) { | ||||
|         this.phone = phone; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public String toString() { | ||||
|         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | ||||
|   | ||||
| @@ -15,9 +15,12 @@ public class CustomerInvestigateRequest extends BaseEntity | ||||
|  | ||||
|     //基础信息 | ||||
|  | ||||
|     /** $column.columnComment */ | ||||
|     /** 体征信息ID */ | ||||
|     private Long id; | ||||
|  | ||||
|     /** 客户ID */ | ||||
|     private Long customerId; | ||||
|  | ||||
|     /** 名字 */ | ||||
|     @Excel(name = "名字") | ||||
|     private String name; | ||||
| @@ -26,16 +29,7 @@ public class CustomerInvestigateRequest extends BaseEntity | ||||
|     @Excel(name = "手机号") | ||||
|     private String phone; | ||||
|  | ||||
|     /** 邮箱 */ | ||||
|     @Excel(name = "邮箱") | ||||
|     private String email; | ||||
|  | ||||
|     /** 地址 */ | ||||
|     @Excel(name = "地址") | ||||
|     private String address; | ||||
|  | ||||
|     //体征信息 | ||||
|  | ||||
|     /** 客户性别  0男 1女 */ | ||||
|     @Excel(name = "客户性别  0男 1女") | ||||
|     private Integer sex; | ||||
| @@ -152,42 +146,34 @@ public class CustomerInvestigateRequest extends BaseEntity | ||||
|         return id; | ||||
|     } | ||||
|  | ||||
|     public String getName() { | ||||
|         return name; | ||||
|     } | ||||
|  | ||||
|     public String getPhone() { | ||||
|         return phone; | ||||
|     } | ||||
|  | ||||
|     public String getEmail() { | ||||
|         return email; | ||||
|     } | ||||
|  | ||||
|     public String getAddress() { | ||||
|         return address; | ||||
|     } | ||||
|  | ||||
|     public void setId(Long id) { | ||||
|         this.id = id; | ||||
|     } | ||||
|  | ||||
|     public Long getCustomerId() { | ||||
|         return customerId; | ||||
|     } | ||||
|  | ||||
|     public void setCustomerId(Long customerId) { | ||||
|         this.customerId = customerId; | ||||
|     } | ||||
|  | ||||
|     public String getName() { | ||||
|         return name; | ||||
|     } | ||||
|  | ||||
|     public void setName(String name) { | ||||
|         this.name = name; | ||||
|     } | ||||
|  | ||||
|     public String getPhone() { | ||||
|         return phone; | ||||
|     } | ||||
|  | ||||
|     public void setPhone(String phone) { | ||||
|         this.phone = phone; | ||||
|     } | ||||
|  | ||||
|     public void setEmail(String email) { | ||||
|         this.email = email; | ||||
|     } | ||||
|  | ||||
|     public void setAddress(String address) { | ||||
|         this.address = address; | ||||
|     } | ||||
|  | ||||
|     public Integer getSex() { | ||||
|         return sex; | ||||
|     } | ||||
|   | ||||
| @@ -1,7 +1,10 @@ | ||||
| package com.stdiet.custom.mapper; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import com.stdiet.custom.domain.SysCustomer; | ||||
| import com.stdiet.custom.domain.SysCustomerHealthy; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| /** | ||||
|  * 客户健康Mapper接口 | ||||
| @@ -58,4 +61,10 @@ public interface SysCustomerHealthyMapper | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public int deleteSysCustomerHealthyByIds(Long[] ids); | ||||
|  | ||||
|     /** | ||||
|      * 根据手机号查询客户健康评估信息 | ||||
|      * @param phone | ||||
|      */ | ||||
|     SysCustomerHealthy selectSysCustomerHealthyByPhone(@Param("phone") String phone); | ||||
| } | ||||
| @@ -67,14 +67,4 @@ public interface SysCustomerMapper | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     SysCustomer getCustomerByPhone(@Param("phone")String phone); | ||||
|  | ||||
|     //查询客户基础信息以及体征信息 | ||||
|     List<SysCustomer> selectSysCustomerAndSignList(SysCustomer sysCustomer); | ||||
|  | ||||
|     /** | ||||
|      * 根据手机号查询客户以及体征 | ||||
|      * @param phone | ||||
|      * @return | ||||
|      */ | ||||
|     SysCustomer selectSysCustomerAndSignByPhone(String phone); | ||||
| } | ||||
| @@ -1,6 +1,8 @@ | ||||
| package com.stdiet.custom.mapper; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import com.stdiet.custom.domain.SysCustomer; | ||||
| import com.stdiet.custom.domain.SysCustomerPhysicalSigns; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| @@ -20,14 +22,6 @@ public interface SysCustomerPhysicalSignsMapper | ||||
|      */ | ||||
|     public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsById(Long id); | ||||
|  | ||||
|     /** | ||||
|      * 查询客户体征信息列表 | ||||
|      * | ||||
|      * @param sysCustomerPhysicalSigns 客户体征信息 | ||||
|      * @return 客户体征信息集合 | ||||
|      */ | ||||
|     public List<SysCustomerPhysicalSigns> selectSysCustomerPhysicalSignsList(SysCustomerPhysicalSigns sysCustomerPhysicalSigns); | ||||
|  | ||||
|     /** | ||||
|      * 新增客户体征信息 | ||||
|      * | ||||
| @@ -60,13 +54,14 @@ public interface SysCustomerPhysicalSignsMapper | ||||
|      */ | ||||
|     public int deleteSysCustomerPhysicalSignsByIds(Long[] ids); | ||||
|  | ||||
|     /** | ||||
|      * 根据客户id修改客户体征信息 | ||||
|      * | ||||
|      * @param sysCustomerPhysicalSigns 客户体征信息 | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     int updateSysCustomerPhysicalSignsByCustomerId(SysCustomerPhysicalSigns sysCustomerPhysicalSigns); | ||||
|  | ||||
|     int deleteSysCustomerPhysicalSignsByCustomerIds(Long[] ids); | ||||
|     //查询客户体征信息 | ||||
|     List<SysCustomerPhysicalSigns> selectSysCustomerAndSignList(SysCustomerPhysicalSigns sysCustomerPhysicalSigns); | ||||
|  | ||||
|     /** | ||||
|      * 根据手机号查询客户以及体征 | ||||
|      * @param phone | ||||
|      * @return | ||||
|      */ | ||||
|     SysCustomerPhysicalSigns selectSysCustomerAndSignByPhone(String phone); | ||||
| } | ||||
| @@ -1,7 +1,10 @@ | ||||
| package com.stdiet.custom.service; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import com.stdiet.common.core.domain.AjaxResult; | ||||
| import com.stdiet.custom.domain.SysCustomerHealthy; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| /** | ||||
|  * 客户健康Service接口 | ||||
| @@ -28,20 +31,12 @@ public interface ISysCustomerHealthyService | ||||
|     public List<SysCustomerHealthy> selectSysCustomerHealthyList(SysCustomerHealthy sysCustomerHealthy); | ||||
|  | ||||
|     /** | ||||
|      * 新增客户健康 | ||||
|      * 新增或修改客户健康 | ||||
|      * | ||||
|      * @param sysCustomerHealthy 客户健康 | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public int insertSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy); | ||||
|  | ||||
|     /** | ||||
|      * 修改客户健康 | ||||
|      * | ||||
|      * @param sysCustomerHealthy 客户健康 | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public int updateSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy); | ||||
|     public AjaxResult insertOrUpdateSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy); | ||||
|  | ||||
|     /** | ||||
|      * 批量删除客户健康 | ||||
| @@ -58,4 +53,10 @@ public interface ISysCustomerHealthyService | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public int deleteSysCustomerHealthyById(Long id); | ||||
|  | ||||
|     /** | ||||
|      * 根据手机号查询客户健康评估信息 | ||||
|      * @param phone | ||||
|      */ | ||||
|     SysCustomerHealthy selectSysCustomerHealthyByPhone(String phone); | ||||
| } | ||||
| @@ -1,7 +1,11 @@ | ||||
| package com.stdiet.custom.service; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import com.stdiet.common.core.domain.AjaxResult; | ||||
| import com.stdiet.custom.domain.SysCustomer; | ||||
| import com.stdiet.custom.domain.SysCustomerPhysicalSigns; | ||||
| import com.stdiet.custom.dto.request.CustomerInvestigateRequest; | ||||
|  | ||||
| /** | ||||
|  * 客户体征信息Service接口 | ||||
| @@ -18,14 +22,6 @@ public interface ISysCustomerPhysicalSignsService { | ||||
|      */ | ||||
|     public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsById(Long id); | ||||
|  | ||||
|     /** | ||||
|      * 查询客户体征信息列表 | ||||
|      * | ||||
|      * @param sysCustomerPhysicalSigns 客户体征信息 | ||||
|      * @return 客户体征信息集合 | ||||
|      */ | ||||
|     public List<SysCustomerPhysicalSigns> selectSysCustomerPhysicalSignsList(SysCustomerPhysicalSigns sysCustomerPhysicalSigns); | ||||
|  | ||||
|     /** | ||||
|      * 新增客户体征信息 | ||||
|      * | ||||
| @@ -57,4 +53,28 @@ public interface ISysCustomerPhysicalSignsService { | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public int deleteSysCustomerPhysicalSignsById(Long id); | ||||
|  | ||||
|     /** | ||||
|      * 客户体征资料填写 | ||||
|      * | ||||
|      * @param customerInvestigateRequest 客户建档相关资料 | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     AjaxResult addOrupdateCustomerAndSign(CustomerInvestigateRequest customerInvestigateRequest) throws Exception; | ||||
|  | ||||
|     /** | ||||
|      *  查询客户基础信息以及体征信息列表 | ||||
|      * | ||||
|      * @param sysCustomerPhysicalSigns 查询条件 | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     List<SysCustomerPhysicalSigns> selectSysCustomerAndSignList(SysCustomerPhysicalSigns sysCustomerPhysicalSigns); | ||||
|  | ||||
|     /** | ||||
|      * 根据手机号查询客户以及体征 | ||||
|      * @param phone | ||||
|      * @return | ||||
|      */ | ||||
|     SysCustomerPhysicalSigns  selectSysCustomerAndSignByPhone(String phone); | ||||
|  | ||||
| } | ||||
| @@ -67,37 +67,4 @@ public interface ISysCustomerService | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     SysCustomer getCustomerByPhone(String phone); | ||||
|  | ||||
|     /** | ||||
|      * 客户建档资料填写 | ||||
|      * | ||||
|      * @param customerInvestigateRequest 客户建档相关资料 | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     int addOrupdateCustomerAndSign( CustomerInvestigateRequest customerInvestigateRequest) throws Exception; | ||||
|  | ||||
|     /** | ||||
|      *  查询客户基础信息以及体征信息列表 | ||||
|      * | ||||
|      * @param sysCustomer 查询条件 | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     List<SysCustomer> selectSysCustomerAndSignList(SysCustomer sysCustomer); | ||||
|  | ||||
|     /** | ||||
|      *  根据id查询客户信息(基础信息以及体征信息) | ||||
|      * | ||||
|      * @param id 客户id | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     SysCustomer getCustomerAndSignById(Long id); | ||||
|  | ||||
|     int delCustomerAndSignById(Long[] ids); | ||||
|  | ||||
|     /** | ||||
|      * 根据手机号查询客户以及体征 | ||||
|      * @param phone | ||||
|      * @return | ||||
|      */ | ||||
|     SysCustomer selectSysCustomerAndSignByPhone(String phone); | ||||
| } | ||||
| @@ -1,7 +1,12 @@ | ||||
| package com.stdiet.custom.service.impl; | ||||
|  | ||||
| import java.util.List; | ||||
| import com.stdiet.common.utils.DateUtils; | ||||
|  | ||||
| import com.stdiet.common.core.domain.AjaxResult; | ||||
| import com.stdiet.common.utils.bean.ObjectUtils; | ||||
| import com.stdiet.custom.domain.SysCustomer; | ||||
| import com.stdiet.custom.domain.SysCustomerPhysicalSigns; | ||||
| import com.stdiet.custom.service.ISysCustomerService; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| import com.stdiet.custom.mapper.SysCustomerHealthyMapper; | ||||
| @@ -20,6 +25,9 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService | ||||
|     @Autowired | ||||
|     private SysCustomerHealthyMapper sysCustomerHealthyMapper; | ||||
|  | ||||
|     @Autowired | ||||
|     private ISysCustomerService sysCustomerService; | ||||
|  | ||||
|     /** | ||||
|      * 查询客户健康 | ||||
|      * | ||||
| @@ -51,23 +59,64 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     @Override | ||||
|     public int insertSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy) | ||||
|     public AjaxResult insertOrUpdateSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy) | ||||
|     { | ||||
|         sysCustomerHealthy.setCreateTime(DateUtils.getNowDate()); | ||||
|         return sysCustomerHealthyMapper.insertSysCustomerHealthy(sysCustomerHealthy); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 修改客户健康 | ||||
|      * | ||||
|      * @param sysCustomerHealthy 客户健康 | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     @Override | ||||
|     public int updateSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy) | ||||
|     { | ||||
|         sysCustomerHealthy.setUpdateTime(DateUtils.getNowDate()); | ||||
|         return sysCustomerHealthyMapper.updateSysCustomerHealthy(sysCustomerHealthy); | ||||
|         //当前登录用户 | ||||
|         //LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
|         Long cutomerId = 0L; | ||||
|         //新增 | ||||
|         if(sysCustomerHealthy.getId() == null){ | ||||
|             //根据手机号查询客户健康信息,判断是否已存在 | ||||
|             SysCustomerHealthy customerHealthy = selectSysCustomerHealthyByPhone(sysCustomerHealthy.getPhone()); | ||||
|             if(customerHealthy != null){ | ||||
|                 return AjaxResult.error("该手机号已存在"); | ||||
|             } | ||||
|             //根据手机号查询客户基础信息,判断是否已存在 | ||||
|             SysCustomer phoneCustomer = sysCustomerService.getCustomerByPhone(sysCustomerHealthy.getPhone()); | ||||
|             if(phoneCustomer != null){ | ||||
|                 if(!sysCustomerHealthy.getName().equals(phoneCustomer.getName())){ | ||||
|                     return AjaxResult.error("该手机号与姓名不符"); | ||||
|                 } | ||||
|                 cutomerId = phoneCustomer.getId(); | ||||
|             }else{ | ||||
|                 SysCustomer newSysCustomer  = new SysCustomer(); | ||||
|                 newSysCustomer.setName(sysCustomerHealthy.getName()); | ||||
|                 newSysCustomer.setPhone(sysCustomerHealthy.getPhone()); | ||||
|                 if(sysCustomerService.insertSysCustomer(newSysCustomer) > 0){ | ||||
|                     cutomerId = newSysCustomer.getId(); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         //更新 | ||||
|         else{ | ||||
|             SysCustomer oldCustomer = sysCustomerService.selectSysCustomerById(sysCustomerHealthy.getCustomerId()); | ||||
|             //如果修改了手机号,则需要判断手机号是否已经存在 | ||||
|             if(oldCustomer != null && !oldCustomer.getPhone().equals(sysCustomerHealthy.getPhone())) { | ||||
|                 //验证该手机号是否已存在客户健康信息 | ||||
|                 SysCustomerHealthy customerHealthy = selectSysCustomerHealthyByPhone(sysCustomerHealthy.getPhone()); | ||||
|                 if (customerHealthy != null) { | ||||
|                     return AjaxResult.error("该手机号已存在"); | ||||
|                 } | ||||
|                 //根据手机号查询客户基础信息,判断是否已存在 | ||||
|                 SysCustomer phoneCustomer = sysCustomerService.getCustomerByPhone(sysCustomerHealthy.getPhone()); | ||||
|                 if(phoneCustomer != null) { | ||||
|                     return AjaxResult.error("该手机号已存在"); | ||||
|                 } | ||||
|             } | ||||
|             SysCustomer newSysCustomer  = new SysCustomer(); | ||||
|             newSysCustomer.setId(sysCustomerHealthy.getCustomerId()); | ||||
|             newSysCustomer.setName(sysCustomerHealthy.getName()); | ||||
|             newSysCustomer.setPhone(sysCustomerHealthy.getPhone()); | ||||
|             if(sysCustomerService.updateSysCustomer(newSysCustomer) > 0){ | ||||
|                 cutomerId = newSysCustomer.getId(); | ||||
|             } | ||||
|         } | ||||
|         int rows = 0; | ||||
|         if(cutomerId != null && cutomerId > 0){ | ||||
|             sysCustomerHealthy.setCustomerId(cutomerId); | ||||
|             rows = sysCustomerHealthy.getId() == null ? sysCustomerHealthyMapper.insertSysCustomerHealthy(sysCustomerHealthy) : sysCustomerHealthyMapper.updateSysCustomerHealthy(sysCustomerHealthy); | ||||
|         } | ||||
|         return rows > 0 ? AjaxResult.success() : AjaxResult.error(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -93,4 +142,13 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService | ||||
|     { | ||||
|         return sysCustomerHealthyMapper.deleteSysCustomerHealthyById(id); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 根据手机号查询客户健康评估信息 | ||||
|      * @param phone | ||||
|      */ | ||||
|     @Override | ||||
|     public SysCustomerHealthy selectSysCustomerHealthyByPhone(String phone){ | ||||
|         return sysCustomerHealthyMapper.selectSysCustomerHealthyByPhone(phone); | ||||
|     } | ||||
| } | ||||
| @@ -1,7 +1,13 @@ | ||||
| package com.stdiet.custom.service.impl; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import com.stdiet.common.core.domain.AjaxResult; | ||||
| import com.stdiet.common.utils.DateUtils; | ||||
| import com.stdiet.common.utils.bean.ObjectUtils; | ||||
| import com.stdiet.custom.domain.SysCustomer; | ||||
| import com.stdiet.custom.dto.request.CustomerInvestigateRequest; | ||||
| import com.stdiet.custom.service.ISysCustomerService; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| import com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper; | ||||
| @@ -20,6 +26,9 @@ public class SysCustomerPhysicalSignsServiceImpl implements ISysCustomerPhysical | ||||
|     @Autowired | ||||
|     private SysCustomerPhysicalSignsMapper sysCustomerPhysicalSignsMapper; | ||||
|  | ||||
|     @Autowired | ||||
|     private ISysCustomerService sysCustomerService; | ||||
|  | ||||
|     /** | ||||
|      * 查询客户体征信息 | ||||
|      * | ||||
| @@ -32,18 +41,6 @@ public class SysCustomerPhysicalSignsServiceImpl implements ISysCustomerPhysical | ||||
|         return sysCustomerPhysicalSignsMapper.selectSysCustomerPhysicalSignsById(id); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 查询客户体征信息列表 | ||||
|      * | ||||
|      * @param sysCustomerPhysicalSigns 客户体征信息 | ||||
|      * @return 客户体征信息 | ||||
|      */ | ||||
|     @Override | ||||
|     public List<SysCustomerPhysicalSigns> selectSysCustomerPhysicalSignsList(SysCustomerPhysicalSigns sysCustomerPhysicalSigns) | ||||
|     { | ||||
|         return sysCustomerPhysicalSignsMapper.selectSysCustomerPhysicalSignsList(sysCustomerPhysicalSigns); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 新增客户体征信息 | ||||
|      * | ||||
| @@ -93,4 +90,91 @@ public class SysCustomerPhysicalSignsServiceImpl implements ISysCustomerPhysical | ||||
|     { | ||||
|         return sysCustomerPhysicalSignsMapper.deleteSysCustomerPhysicalSignsById(id); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 客户体征资料填写 | ||||
|      * | ||||
|      * @param customerInvestigateRequest 客户体征资料 | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public AjaxResult addOrupdateCustomerAndSign(CustomerInvestigateRequest customerInvestigateRequest) throws Exception{ | ||||
|         //当前登录用户 | ||||
|         //LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
|         Long cutomerId = 0L; | ||||
|         //新增 | ||||
|         if(customerInvestigateRequest.getId() == null){ | ||||
|             //根据手机号查询客户体征信息,判断是否已存在 | ||||
|             SysCustomerPhysicalSigns sysCustomerPhysicalSigns = selectSysCustomerAndSignByPhone(customerInvestigateRequest.getPhone()); | ||||
|             if(sysCustomerPhysicalSigns != null){ | ||||
|                 return AjaxResult.error("该手机号已存在"); | ||||
|             } | ||||
|             //根据手机号查询客户基础信息,判断是否已存在 | ||||
|             SysCustomer phoneCustomer = sysCustomerService.getCustomerByPhone(customerInvestigateRequest.getPhone()); | ||||
|             if(phoneCustomer != null){ | ||||
|                 if(!customerInvestigateRequest.getName().equals(phoneCustomer.getName())){ | ||||
|                     return AjaxResult.error("该手机号与姓名不符"); | ||||
|                 } | ||||
|                 cutomerId = phoneCustomer.getId(); | ||||
|             }else{ | ||||
|                 SysCustomer newSysCustomer  = new SysCustomer(); | ||||
|                 newSysCustomer.setName(customerInvestigateRequest.getName()); | ||||
|                 newSysCustomer.setPhone(customerInvestigateRequest.getPhone()); | ||||
|                 if(sysCustomerService.insertSysCustomer(newSysCustomer) > 0){ | ||||
|                     cutomerId = newSysCustomer.getId(); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         //更新 | ||||
|         else{ | ||||
|             SysCustomer oldCustomer = sysCustomerService.selectSysCustomerById(customerInvestigateRequest.getCustomerId()); | ||||
|             //如果修改了手机号,则需要判断手机号是否已经存在 | ||||
|             if(oldCustomer != null && !oldCustomer.getPhone().equals(customerInvestigateRequest.getPhone())) { | ||||
|                 //验证该手机号是否已存在客户体征信息 | ||||
|                 SysCustomerPhysicalSigns sysCustomerPhysicalSigns = selectSysCustomerAndSignByPhone(customerInvestigateRequest.getPhone()); | ||||
|                 if (sysCustomerPhysicalSigns != null) { | ||||
|                     return AjaxResult.error("该手机号已存在"); | ||||
|                 } | ||||
|                 //根据手机号查询客户基础信息,判断是否已存在 | ||||
|                 SysCustomer phoneCustomer = sysCustomerService.getCustomerByPhone(customerInvestigateRequest.getPhone()); | ||||
|                 if(phoneCustomer != null) { | ||||
|                     return AjaxResult.error("该手机号已存在"); | ||||
|                 } | ||||
|             } | ||||
|             SysCustomer newSysCustomer  = new SysCustomer(); | ||||
|             newSysCustomer.setId(customerInvestigateRequest.getCustomerId()); | ||||
|             newSysCustomer.setName(customerInvestigateRequest.getName()); | ||||
|             newSysCustomer.setPhone(customerInvestigateRequest.getPhone()); | ||||
|             if(sysCustomerService.updateSysCustomer(newSysCustomer) > 0){ | ||||
|                 cutomerId = newSysCustomer.getId(); | ||||
|             } | ||||
|         } | ||||
|         int rows = 0; | ||||
|         if(cutomerId != null && cutomerId > 0){ | ||||
|             SysCustomerPhysicalSigns customerSigns = ObjectUtils.getObjectByObject(customerInvestigateRequest, SysCustomerPhysicalSigns.class); | ||||
|             customerSigns.setCustomerId(cutomerId); | ||||
|             customerSigns.setId(customerInvestigateRequest.getId()); | ||||
|             rows = customerInvestigateRequest.getId() == null ? insertSysCustomerPhysicalSigns(customerSigns) : updateSysCustomerPhysicalSigns(customerSigns); | ||||
|         } | ||||
|         return rows > 0 ? AjaxResult.success() : AjaxResult.error(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      *  查询客户基础信息以及体征信息列表 | ||||
|      * | ||||
|      * @param sysCustomerPhysicalSigns 查询条件 | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public List<SysCustomerPhysicalSigns> selectSysCustomerAndSignList(SysCustomerPhysicalSigns sysCustomerPhysicalSigns){ | ||||
|         return sysCustomerPhysicalSignsMapper.selectSysCustomerAndSignList(sysCustomerPhysicalSigns); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 根据手机号查询客户以及体征 | ||||
|      * @param phone | ||||
|      * @return | ||||
|      */ | ||||
|     @Override | ||||
|     public SysCustomerPhysicalSigns  selectSysCustomerAndSignByPhone(String phone){ | ||||
|         return sysCustomerPhysicalSignsMapper.selectSysCustomerAndSignByPhone(phone); | ||||
|     } | ||||
| } | ||||
| @@ -115,77 +115,4 @@ public class SysCustomerServiceImpl implements ISysCustomerService | ||||
|     public SysCustomer getCustomerByPhone(String phone){ | ||||
|         return sysCustomerMapper.getCustomerByPhone(phone); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 客户建档资料填写 | ||||
|      * | ||||
|      * @param customerInvestigateRequest 客户建档相关资料 | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public int addOrupdateCustomerAndSign(CustomerInvestigateRequest customerInvestigateRequest) throws Exception{ | ||||
|         //当前登录用户 | ||||
|         //LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
|         SysCustomer sysCustomer  = new SysCustomer(); | ||||
|         sysCustomer.setId(customerInvestigateRequest.getId()); | ||||
|         sysCustomer.setName(customerInvestigateRequest.getName()); | ||||
|         sysCustomer.setPhone(customerInvestigateRequest.getPhone()); | ||||
|         //添加人、更新人 | ||||
|         /*if(loginUser != null){ | ||||
|             if(customerInvestigateRequest.getId() == null){ | ||||
|                 sysCustomer.setCreateBy(loginUser.getUser().getUserId()+""); | ||||
|             }else{ | ||||
|                 sysCustomer.setUpdateBy(loginUser.getUser().getUserId()+""); | ||||
|             } | ||||
|         }*/ | ||||
|         //sysCustomer.setEmail(customerInvestigateRequest.getEmail()); | ||||
|         //sysCustomer.setAddress(customerInvestigateRequest.getAddress()); | ||||
|         int addOrUpdateRow = customerInvestigateRequest.getId() == null ? insertSysCustomer(sysCustomer) : updateSysCustomer(sysCustomer); | ||||
|         if(addOrUpdateRow > 0){ | ||||
|             SysCustomerPhysicalSigns customerSigns = ObjectUtils.getObjectByObject(customerInvestigateRequest, SysCustomerPhysicalSigns.class); | ||||
|             customerSigns.setCustomerId(sysCustomer.getId()); | ||||
|             customerSigns.setId(null); | ||||
|             addOrUpdateRow = customerInvestigateRequest.getId() == null ? sysCustomerPhysicalSignsMapper.insertSysCustomerPhysicalSigns(customerSigns) : sysCustomerPhysicalSignsMapper.updateSysCustomerPhysicalSignsByCustomerId(customerSigns); | ||||
|         } | ||||
|         return addOrUpdateRow; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      *  查询客户基础信息以及体征信息列表 | ||||
|      * | ||||
|      * @param sysCustomer 查询条件 | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public List<SysCustomer> selectSysCustomerAndSignList(SysCustomer sysCustomer){ | ||||
|         return sysCustomerMapper.selectSysCustomerAndSignList(sysCustomer); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      *  根据id查询客户信息(基础信息以及体征信息) | ||||
|      * | ||||
|      * @param id 客户id | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public SysCustomer getCustomerAndSignById(Long id){ | ||||
|         SysCustomer sysCustomer = new SysCustomer(); | ||||
|         sysCustomer.setId(id); | ||||
|         List<SysCustomer> list = sysCustomerMapper.selectSysCustomerAndSignList(sysCustomer); | ||||
|         return list.size() > 0 ? list.get(0) : null; | ||||
|     } | ||||
|  | ||||
|     public int delCustomerAndSignById(Long[] ids){ | ||||
|         if(deleteSysCustomerByIds(ids) > 0){ | ||||
|             return sysCustomerPhysicalSignsMapper.deleteSysCustomerPhysicalSignsByCustomerIds(ids); | ||||
|         } | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 根据手机号查询客户以及体征 | ||||
|      * @param phone | ||||
|      * @return | ||||
|      */ | ||||
|     @Override | ||||
|     public SysCustomer selectSysCustomerAndSignByPhone(String phone){ | ||||
|         return sysCustomerMapper.selectSysCustomerAndSignByPhone(phone); | ||||
|     } | ||||
| } | ||||
| @@ -7,6 +7,10 @@ | ||||
|     <resultMap type="SysCustomerHealthy" id="SysCustomerHealthyResult"> | ||||
|         <result property="id"    column="id"    /> | ||||
|         <result property="customerId"    column="customer_id"    /> | ||||
|         <!-- 非持久化字段 --> | ||||
|         <result property="name" column="name"></result> | ||||
|         <!-- 非持久化字段 --> | ||||
|         <result property="phone" column="phone"></result> | ||||
|         <result property="conditioningProjectId"    column="conditioning_project_id"    /> | ||||
|         <result property="sex"    column="sex"    /> | ||||
|         <result property="age"    column="age"    /> | ||||
| @@ -99,19 +103,22 @@ | ||||
|     </resultMap> | ||||
|  | ||||
|     <sql id="selectSysCustomerHealthyVo"> | ||||
|         select id, customer_id, conditioning_project_id, sex, age, condiment, other_condiment, cooking_style, cooking_style_rate, wash_vegetables_style, other_wash_vegetables_style, breakfast_type, breakfast_food, lunch_type, dinner, vegetable_rate, common_meat, dinner_time, supper_num, supper_food, diet_hot_and_cold, diet_flavor, vegetables_num, vegetables_rate_type, fruits_num, fruits_time, fruits_rate, rice_num, rice_full, eating_speed, snacks, other_snacks, health_products_flag, health_products_brand, health_products_name, health_products_week_rate, health_products_day_rate, water_num, water_type, water_habit, drinks_num, drink_wine_flag, drink_wine_classify, other_wine_classify, drink_wine_amount, smoke_flag, smoke_rate, second_smoke, work_industry, work_type, defecation_num, other_defecation_num, defecation_time, defecation_shape, defecation_smell, defecation_speed, defecation_color, motion_num, motion_duration, motion_time, aerobic_motion_classify, anaerobic_motion_classify, anaerobic_aerobic_motion_classify, other_motion_classify, motion_field, other_motion_field, sleep_time, sleep_quality, sleep_drug_flag, sleep_drug, stayup_late_flag, stayup_late_week_num, family_illness_history, other_family_illness_history, operation_history, other_operation_history, near_operation_flag, recoverye_situation, long_eat_drug_flag, long_eat_drug_classify, other_long_eat_drug_classify, allergy_flag, allergy_situation, allergen, other_allergen, medical_report, create_time, create_by, update_time, update_by, del_flag from sys_customer_healthy | ||||
|         select sch.id, customer_id, conditioning_project_id, sex, age, condiment, other_condiment, cooking_style, cooking_style_rate, wash_vegetables_style, other_wash_vegetables_style, breakfast_type, breakfast_food, lunch_type, dinner, vegetable_rate, common_meat, dinner_time, supper_num, supper_food, diet_hot_and_cold, diet_flavor, vegetables_num, vegetables_rate_type, fruits_num, fruits_time, fruits_rate, rice_num, rice_full, eating_speed, snacks, other_snacks, health_products_flag, health_products_brand, health_products_name, health_products_week_rate, health_products_day_rate, water_num, water_type, water_habit, drinks_num, drink_wine_flag, drink_wine_classify, other_wine_classify, drink_wine_amount, smoke_flag, smoke_rate, second_smoke, work_industry, work_type, defecation_num, other_defecation_num, defecation_time, defecation_shape, defecation_smell, defecation_speed, defecation_color, motion_num, motion_duration, motion_time, aerobic_motion_classify, anaerobic_motion_classify, anaerobic_aerobic_motion_classify, other_motion_classify, motion_field, other_motion_field, sleep_time, sleep_quality, sleep_drug_flag, sleep_drug, stayup_late_flag, stayup_late_week_num, family_illness_history, other_family_illness_history, operation_history, other_operation_history, near_operation_flag, recoverye_situation, long_eat_drug_flag, long_eat_drug_classify, other_long_eat_drug_classify, allergy_flag, allergy_situation, allergen, other_allergen, medical_report, sch.create_time, sch.create_by,sch. update_time, sch.update_by, sch.del_flag | ||||
|     </sql> | ||||
|  | ||||
|     <select id="selectSysCustomerHealthyList" parameterType="SysCustomerHealthy" resultMap="SysCustomerHealthyResult"> | ||||
|         <include refid="selectSysCustomerHealthyVo"/> | ||||
|         <where> | ||||
|             <if test="conditioningProjectId != null "> and conditioning_project_id = #{conditioningProjectId}</if> | ||||
|         </where> | ||||
|         <include refid="selectSysCustomerHealthyVo"/>,sc.name,sc.phone | ||||
|         from sys_customer_healthy as sch | ||||
|         left join sys_customer sc on sc.id = sch.customer_id | ||||
|         where sch.del_flag = 0 and sc.del_flag = 0 | ||||
|         <if test="conditioningProjectId != null "> and sch.conditioning_project_id = #{conditioningProjectId}</if> | ||||
|     </select> | ||||
|  | ||||
|     <select id="selectSysCustomerHealthyById" parameterType="Long" resultMap="SysCustomerHealthyResult"> | ||||
|         <include refid="selectSysCustomerHealthyVo"/> | ||||
|         where id = #{id} | ||||
|         <include refid="selectSysCustomerHealthyVo"/>,sc.name,sc.phone | ||||
|         from sys_customer_healthy as sch | ||||
|         left join sys_customer sc on sc.id = sch.customer_id | ||||
|         where sch.del_flag = 0 and sc.del_flag = 0 and sch.id = #{id} | ||||
|     </select> | ||||
|  | ||||
|     <insert id="insertSysCustomerHealthy" parameterType="SysCustomerHealthy"> | ||||
| @@ -401,15 +408,23 @@ | ||||
|         where id = #{id} | ||||
|     </update> | ||||
|  | ||||
|     <delete id="deleteSysCustomerHealthyById" parameterType="Long"> | ||||
|         delete from sys_customer_healthy where id = #{id} | ||||
|     </delete> | ||||
|     <update id="deleteSysCustomerHealthyById" parameterType="Long"> | ||||
|         update sys_customer_healthy set del_flag = 1 where id = #{id} | ||||
|     </update> | ||||
|  | ||||
|     <delete id="deleteSysCustomerHealthyByIds" parameterType="String"> | ||||
|         delete from sys_customer_healthy where id in | ||||
|     <update id="deleteSysCustomerHealthyByIds" parameterType="String"> | ||||
|         update sys_customer_healthy set del_flag = 1 where id in | ||||
|         <foreach item="id" collection="array" open="(" separator="," close=")"> | ||||
|             #{id} | ||||
|         </foreach> | ||||
|     </delete> | ||||
|     </update> | ||||
|  | ||||
|     <!-- 根据手机号查询客户健康评估信息 --> | ||||
|     <select id="selectSysCustomerHealthyByPhone" parameterType="String" resultMap="SysCustomerHealthyResult"> | ||||
|         <include refid="selectSysCustomerHealthyVo"/>,sc.name,sc.phone from sys_customer_healthy as sch | ||||
|         left join sys_customer sc on sc.id = sch.customer_id | ||||
|         where sch.del_flag = 0 and sc.del_flag = 0 and sc.phone = #{phone} limit 1 | ||||
|     </select> | ||||
|  | ||||
|  | ||||
| </mapper> | ||||
| @@ -26,62 +26,6 @@ | ||||
|         <result property="updateBy"    column="update_by"    /> | ||||
|     </resultMap> | ||||
|  | ||||
|     <resultMap type="SysCustomer" id="SysCustomerSignResult"> | ||||
|         <result property="id"    column="id"    /> | ||||
|         <result property="name"    column="name"    /> | ||||
|         <result property="phone"    column="phone"    /> | ||||
|         <result property="email"    column="email"    /> | ||||
|         <result property="address"    column="address"    /> | ||||
|         <result property="payDate"    column="pay_date"    /> | ||||
|         <result property="startDate"    column="start_date"    /> | ||||
|         <result property="purchaseNum"    column="purchase_num"    /> | ||||
|         <result property="payTotal"    column="pay_total"    /> | ||||
|         <result property="mainDietitian"    column="main_dietitian"    /> | ||||
|         <result property="assistantDietitian"    column="assistant_dietitian"    /> | ||||
|         <result property="afterDietitian"    column="after_dietitian"    /> | ||||
|         <result property="salesman"    column="salesman"    /> | ||||
|         <result property="chargePerson"    column="charge_person"    /> | ||||
|         <result property="followStatus"    column="follow_status"    /> | ||||
|         <result property="createTime"    column="create_time"    /> | ||||
|         <result property="createBy"    column="create_by"    /> | ||||
|         <result property="updateTime"    column="update_time"    /> | ||||
|         <result property="updateBy"    column="update_by"    /> | ||||
|         <association property="sign" javaType="com.stdiet.custom.domain.SysCustomerPhysicalSigns"> | ||||
|             <result property="id"    column="id"    /> | ||||
|             <result property="customerId"    column="customer_id"    /> | ||||
|             <result property="sex"    column="sex"    /> | ||||
|             <result property="age"    column="age"    /> | ||||
|             <result property="tall"    column="tall"    /> | ||||
|             <result property="weight"    column="weight"    /> | ||||
|             <result property="physicalSignsId"    column="physical_signs_id"    /> | ||||
|             <result property="dishesIngredientId"    column="dishes_ingredient_id"    /> | ||||
|             <result property="photo"    column="photo"    /> | ||||
|             <result property="constipation"    column="constipation"    /> | ||||
|             <result property="staylate"    column="stayLate"    /> | ||||
|             <result property="motion"    column="motion"    /> | ||||
|             <result property="makeFoodType"    column="make_food_type"    /> | ||||
|             <result property="makeFoodTaste"    column="make_food_taste"    /> | ||||
|             <result property="walk"    column="walk"    /> | ||||
|             <result property="difficulty"    column="difficulty"    /> | ||||
|             <result property="weakness"    column="weakness"    /> | ||||
|             <result property="rebound"    column="rebound"    /> | ||||
|             <result property="crux"    column="crux"    /> | ||||
|             <result property="position"    column="position"    /> | ||||
|             <result property="sleepTime"    column="sleep_time"    /> | ||||
|             <result property="getupTime"    column="getup_time"    /> | ||||
|             <result property="connectTime"    column="connect_time"    /> | ||||
|             <result property="remarks"    column="remarks"    /> | ||||
|             <result property="bloodData"    column="blood_data"    /> | ||||
|             <result property="moistureDate"    column="moisture_date"    /> | ||||
|             <result property="vocation"    column="vocation"    /> | ||||
|             <result property="night"    column="night"    /> | ||||
|             <result property="experience"    column="experience"    /> | ||||
|             <result property="comments" column="comments"/> | ||||
|             <!-- column是传的参数, select是调用的查询 --> | ||||
|             <association property="signList" column="physical_signs_id" select="getSignByIds"/> | ||||
|         </association> | ||||
|     </resultMap> | ||||
|  | ||||
|     <sql id="selectSysCustomerVo"> | ||||
|         select id, name, phone, email, 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 | ||||
|     </sql> | ||||
| @@ -184,38 +128,6 @@ | ||||
|         where phone = #{phone} and del_flag = 0 | ||||
|     </select> | ||||
|  | ||||
|     <sql id="selectSysCustomerAndSign"> | ||||
|         <!--sc.email, sc.address, sc.pay_date, sc.start_date, sc.purchase_num, sc.pay_total, sc.main_dietitian, sc.assistant_dietitian, | ||||
|         sc.after_dietitian, sc.salesman, sc.charge_person, sc.follow_status, --> | ||||
|         select sc.id, sc.name, sc.phone, sc.create_time, sc.create_by, sc.update_time, sc.update_by, | ||||
|         <include refid="selectSysCustomerPhysicalSigns"></include> | ||||
|         from sys_customer sc | ||||
|         left join sys_customer_physical_signs scps on scps.customer_id = sc.id and scps.del_flag = 0 | ||||
|     </sql> | ||||
|  | ||||
|     <sql id="selectSysCustomerPhysicalSigns"> | ||||
|         scps.sex, scps.age, scps.tall, scps.weight, scps.physical_signs_id, scps.dishes_ingredient_id, scps.photo, scps.constipation, | ||||
|         scps.stayLate, scps.motion, scps.make_food_type, scps.make_food_taste, scps.walk, scps.difficulty, scps.weakness, scps.rebound, scps.crux, scps.position, | ||||
|         scps.sleep_time, scps.getup_time, scps.connect_time, scps.remarks, scps.blood_data, scps.moisture_date, scps.vocation, | ||||
|         scps.night, scps.experience, scps.comments | ||||
|     </sql> | ||||
|  | ||||
|     <select id="selectSysCustomerAndSignList" parameterType="SysCustomer" resultMap="SysCustomerSignResult"> | ||||
|         <include refid="selectSysCustomerAndSign"/> where sc.del_flag = 0 | ||||
|         <if test="id != null"> and sc.id = #{id} </if> | ||||
|         <if test="name != null  and name != ''"> and sc.name like concat('%', #{name}, '%')</if> | ||||
|         <if test="phone != null  and phone != ''"> and sc.phone like concat('%', #{phone}, '%')</if> | ||||
|         order by sc.create_time desc | ||||
|     </select> | ||||
|  | ||||
|     <!-- 根据体征id获取体征 --> | ||||
|     <select id="getSignByIds" parameterType="String" resultType="SysPhysicalSigns"> | ||||
|         select * from sys_physical_signs sps where FIND_IN_SET(id, #{physical_signs_id}) | ||||
|     </select> | ||||
|  | ||||
|     <!-- 根据手机号查询体征 --> | ||||
|     <select id="selectSysCustomerAndSignByPhone" parameterType="String" resultMap="SysCustomerSignResult"> | ||||
|         <include refid="selectSysCustomerAndSign"/> where sc.del_flag = 0 and sc.phone = #{phone} limit 1 | ||||
|     </select> | ||||
|  | ||||
| </mapper> | ||||
| @@ -4,9 +4,13 @@ | ||||
|         "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper"> | ||||
|  | ||||
|     <resultMap type="SysCustomerPhysicalSigns" id="SysCustomerPhysicalSignsResult"> | ||||
|     <resultMap type="SysCustomerPhysicalSigns" id="SysCustomerSignResult"> | ||||
|         <result property="id"    column="id"    /> | ||||
|         <result property="customerId"    column="customer_id"    /> | ||||
|         <!-- 非持久化字段 --> | ||||
|         <result property="name" column="name"/> | ||||
|         <!-- 非持久化字段 --> | ||||
|         <result property="phone" column="phone" /> | ||||
|         <result property="sex"    column="sex"    /> | ||||
|         <result property="age"    column="age"    /> | ||||
|         <result property="tall"    column="tall"    /> | ||||
| @@ -39,48 +43,28 @@ | ||||
|         <result property="updateTime"    column="update_time"    /> | ||||
|         <result property="updateBy"    column="update_by"    /> | ||||
|         <result property="comments" column="comments"/> | ||||
|         <!-- column是传的参数, select是调用的查询 --> | ||||
|         <association property="signList" column="physical_signs_id" select="getSignByIds"/> | ||||
|     </resultMap> | ||||
|  | ||||
|     <sql id="selectSysCustomerPhysicalSignsVo"> | ||||
|         select id, customer_id, sex, age, tall, weight, physical_signs_id, dishes_ingredient_id, photo, constipation, stayLate, motion, make_food_type, make_food_taste, walk, difficulty, weakness, rebound, crux, position, sleep_time, getup_time, connect_time, remarks, blood_data, moisture_date, vocation, | ||||
|       night, experience, comments, create_time, create_by, update_time, update_by from sys_customer_physical_signs | ||||
|     <sql id="selectSysCustomerPhysicalSigns"> | ||||
|         select scps.id,scps.customer_id,scps.sex, scps.age, scps.tall, scps.weight, scps.physical_signs_id, scps.dishes_ingredient_id, scps.photo, scps.constipation, | ||||
|         scps.stayLate, scps.motion, scps.make_food_type, scps.make_food_taste, scps.walk, scps.difficulty, scps.weakness, scps.rebound, scps.crux, scps.position, | ||||
|         scps.sleep_time, scps.getup_time, scps.connect_time, scps.remarks, scps.blood_data, scps.moisture_date, scps.vocation, | ||||
|         scps.night, scps.experience, scps.comments, scps.create_time, sc.name, sc.phone | ||||
|         from sys_customer_physical_signs scps | ||||
|         left join sys_customer sc on scps.customer_id = sc.id | ||||
|     </sql> | ||||
|  | ||||
|     <select id="selectSysCustomerPhysicalSignsList" parameterType="SysCustomerPhysicalSigns" resultMap="SysCustomerPhysicalSignsResult"> | ||||
|         <include refid="selectSysCustomerPhysicalSignsVo"/> where del_flag = 0 | ||||
|         <if test="customerId != null "> and customer_id = #{customerId}</if> | ||||
|         <if test="sex != null "> and sex = #{sex}</if> | ||||
|         <if test="age != null "> and age = #{age}</if> | ||||
|         <if test="tall != null "> and tall = #{tall}</if> | ||||
|         <if test="weight != null "> and weight = #{weight}</if> | ||||
|         <if test="physicalSignsId != null  and physicalSignsId != ''"> and physical_signs_id = #{physicalSignsId}</if> | ||||
|         <if test="dishesIngredientId != null  and dishesIngredientId != ''"> and dishes_ingredient_id = #{dishesIngredientId}</if> | ||||
|         <if test="photo != null  and photo != ''"> and photo = #{photo}</if> | ||||
|         <if test="constipation != null "> and constipation = #{constipation}</if> | ||||
|         <if test="staylate != null "> and stayLate = #{staylate}</if> | ||||
|         <if test="motion != null "> and motion = #{motion}</if> | ||||
|         <if test="makeFoodType != null "> and make_food_type = #{makeFoodType}</if> | ||||
|         <if test="makeFoodTaste != null "> and make_food_taste = #{makeFoodTaste}</if> | ||||
|         <if test="walk != null "> and walk = #{walk}</if> | ||||
|         <if test="difficulty != null  and difficulty != ''"> and difficulty = #{difficulty}</if> | ||||
|         <if test="weakness != null "> and weakness = #{weakness}</if> | ||||
|         <if test="rebound != null "> and rebound = #{rebound}</if> | ||||
|         <if test="crux != null "> and crux = #{crux}</if> | ||||
|         <if test="position != null "> and position = #{position}</if> | ||||
|         <if test="sleepTime != null "> and sleep_time = #{sleepTime}</if> | ||||
|         <if test="getupTime != null "> and getup_time = #{getupTime}</if> | ||||
|         <if test="connectTime != null "> and connect_time = #{connectTime}</if> | ||||
|         <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if> | ||||
|         <if test="bloodData != null  and bloodData != ''"> and blood_data = #{bloodData}</if> | ||||
|         <if test="moistureDate != null  and moistureDate != ''"> and moisture_date = #{moistureDate}</if> | ||||
|         <if test="vocation != null  and vocation != ''"> and vocation = #{vocation}</if> | ||||
|         <if test="night != null "> and  night = #{night}</if> | ||||
|         <if test="experience != null  and experience != ''"> and experience = #{experience}</if> | ||||
|     <select id="selectSysCustomerAndSignList" parameterType="SysCustomerPhysicalSigns" resultMap="SysCustomerSignResult"> | ||||
|         <include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0 | ||||
|         <if test="name != null  and name != ''"> and sc.name like concat('%', #{name}, '%')</if> | ||||
|         <if test="phone != null  and phone != ''"> and sc.phone like concat('%', #{phone}, '%')</if> | ||||
|         order by scps.create_time desc | ||||
|     </select> | ||||
|  | ||||
|     <select id="selectSysCustomerPhysicalSignsById" parameterType="Long" resultMap="SysCustomerPhysicalSignsResult"> | ||||
|         <include refid="selectSysCustomerPhysicalSignsVo"/> | ||||
|         where id = #{id} and del_flag = 0 | ||||
|     <select id="selectSysCustomerPhysicalSignsById" parameterType="Long" resultMap="SysCustomerSignResult"> | ||||
|         <include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0 and scps.id = #{id} | ||||
|     </select> | ||||
|  | ||||
|     <insert id="insertSysCustomerPhysicalSigns" parameterType="SysCustomerPhysicalSigns" useGeneratedKeys="true" keyProperty="id"> | ||||
| @@ -198,61 +182,24 @@ | ||||
|     </update> | ||||
|  | ||||
|     <update id="deleteSysCustomerPhysicalSignsById" parameterType="Long"> | ||||
|         update sys_customer_physical_signs set del_flag = 0 where id = #{id} | ||||
|         update sys_customer_physical_signs set del_flag = 1 where id = #{id} | ||||
|     </update> | ||||
|  | ||||
|     <update id="deleteSysCustomerPhysicalSignsByIds" parameterType="String"> | ||||
|         update sys_customer_physical_signs set del_flag = 0 where id in | ||||
|         update sys_customer_physical_signs set del_flag = 1 where id in | ||||
|         <foreach item="id" collection="array" open="(" separator="," close=")"> | ||||
|             #{id} | ||||
|         </foreach> | ||||
|     </update> | ||||
|  | ||||
|     <!-- 根据客户id更新体征信息 --> | ||||
|     <update id="updateSysCustomerPhysicalSignsByCustomerId" parameterType="SysCustomerPhysicalSigns"> | ||||
|         update sys_customer_physical_signs | ||||
|         <trim prefix="SET" suffixOverrides=","> | ||||
|             <if test="sex != null">sex = #{sex},</if> | ||||
|             <if test="age != null">age = #{age},</if> | ||||
|             <if test="tall != null">tall = #{tall},</if> | ||||
|             <if test="weight != null">weight = #{weight},</if> | ||||
|             <if test="physicalSignsId != null">physical_signs_id = #{physicalSignsId},</if> | ||||
|             <if test="dishesIngredientId != null">dishes_ingredient_id = #{dishesIngredientId},</if> | ||||
|             <if test="photo != null">photo = #{photo},</if> | ||||
|             <if test="constipation != null">constipation = #{constipation},</if> | ||||
|             <if test="staylate != null">stayLate = #{staylate},</if> | ||||
|             <if test="motion != null">motion = #{motion},</if> | ||||
|             <if test="makeFoodType != null">make_food_type = #{makeFoodType},</if> | ||||
|             <if test="makeFoodTaste != null">make_food_taste = #{makeFoodTaste},</if> | ||||
|             <if test="walk != null">walk = #{walk},</if> | ||||
|             <if test="difficulty != null">difficulty = #{difficulty},</if> | ||||
|             <if test="weakness != null">weakness = #{weakness},</if> | ||||
|             <if test="rebound != null">rebound = #{rebound},</if> | ||||
|             <if test="crux != null">crux = #{crux},</if> | ||||
|             <if test="position != null">position = #{position},</if> | ||||
|             <if test="sleepTime != null">sleep_time = #{sleepTime},</if> | ||||
|             <if test="getupTime != null">getup_time = #{getupTime},</if> | ||||
|             <if test="connectTime != null">connect_time = #{connectTime},</if> | ||||
|             <if test="remarks != null">remarks = #{remarks},</if> | ||||
|             <if test="bloodData != null">blood_data = #{bloodData},</if> | ||||
|             <if test="moistureDate != null">moisture_date = #{moistureDate},</if> | ||||
|             <if test="vocation != null">vocation = #{vocation},</if> | ||||
|             <if test="night != null">night = #{night},</if> | ||||
|             <if test="experience != null">experience = #{experience},</if> | ||||
|             <if test="comments != null">comments = #{comments},</if> | ||||
|             <if test="createTime != null">create_time = #{createTime},</if> | ||||
|             <if test="createBy != null">create_by = #{createBy},</if> | ||||
|             <if test="updateTime != null">update_time = #{updateTime},</if> | ||||
|             <if test="updateBy != null">update_by = #{updateBy},</if> | ||||
|         </trim> | ||||
|         where customer_id = #{customerId} | ||||
|     </update> | ||||
|     <!-- 根据体征id获取体征 --> | ||||
|     <select id="getSignByIds" parameterType="String" resultType="SysPhysicalSigns"> | ||||
|         select * from sys_physical_signs sps where FIND_IN_SET(id, #{physical_signs_id}) | ||||
|     </select> | ||||
|  | ||||
|     <update id="deleteSysCustomerPhysicalSignsByCustomerIds" parameterType="String"> | ||||
|         update sys_customer_physical_signs set del_flag = 0 where customer_id in | ||||
|         <foreach item="id" collection="array" open="(" separator="," close=")"> | ||||
|             #{id} | ||||
|         </foreach> | ||||
|     </update> | ||||
|     <!-- 根据手机号查询体征 --> | ||||
|     <select id="selectSysCustomerAndSignByPhone" parameterType="String" resultMap="SysCustomerSignResult"> | ||||
|         <include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0 and sc.phone = #{phone} limit 1 | ||||
|     </select> | ||||
|  | ||||
| </mapper> | ||||
		Reference in New Issue
	
	Block a user