diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsNutrition.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsNutrition.java new file mode 100644 index 0000000..1e0f6ea --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsNutrition.java @@ -0,0 +1,183 @@ +package com.lyms.talkonlineweb.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.util.Date; + +/** + * 营养管理 + * @TableName lyms_nutrition + */ +@TableName(value ="lyms_nutrition") +public class LymsNutrition implements Serializable { + /** + * 身份证号 + */ + @TableId + private String idno; + + /** + * 电话 + */ + private String phone; + + /** + * 详细信息 + */ + private Object info; + + /** + * 类型 + */ + private Integer type; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 修改时间 + */ + private Date updateTime; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + /** + * 身份证号 + */ + public String getIdno() { + return idno; + } + + /** + * 身份证号 + */ + public void setIdno(String idno) { + this.idno = idno; + } + + /** + * 电话 + */ + public String getPhone() { + return phone; + } + + /** + * 电话 + */ + public void setPhone(String phone) { + this.phone = phone; + } + + /** + * 详细信息 + */ + public Object getInfo() { + return info; + } + + /** + * 详细信息 + */ + public void setInfo(Object info) { + this.info = info; + } + + /** + * 类型 + */ + public Integer getType() { + return type; + } + + /** + * 类型 + */ + public void setType(Integer type) { + this.type = type; + } + + /** + * 创建时间 + */ + public Date getCreateTime() { + return createTime; + } + + /** + * 创建时间 + */ + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + /** + * 修改时间 + */ + public Date getUpdateTime() { + return updateTime; + } + + /** + * 修改时间 + */ + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + LymsNutrition other = (LymsNutrition) that; + return (this.getIdno() == null ? other.getIdno() == null : this.getIdno().equals(other.getIdno())) + && (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone())) + && (this.getInfo() == null ? other.getInfo() == null : this.getInfo().equals(other.getInfo())) + && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) + && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getIdno() == null) ? 0 : getIdno().hashCode()); + result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode()); + result = prime * result + ((getInfo() == null) ? 0 : getInfo().hashCode()); + result = prime * result + ((getType() == null) ? 0 : getType().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", idno=").append(idno); + sb.append(", phone=").append(phone); + sb.append(", info=").append(info); + sb.append(", type=").append(type); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsNutritionMapper.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsNutritionMapper.java new file mode 100644 index 0000000..34dc348 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsNutritionMapper.java @@ -0,0 +1,18 @@ +package com.lyms.talkonlineweb.mapper; + +import com.lyms.talkonlineweb.domain.LymsNutrition; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author ldd +* @description 针对表【lyms_nutrition(营养管理)】的数据库操作Mapper +* @createDate 2023-04-02 16:30:32 +* @Entity com.lyms.talkonlineweb.domain.LymsNutrition +*/ +public interface LymsNutritionMapper extends BaseMapper { + +} + + + + diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsNutritionService.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsNutritionService.java new file mode 100644 index 0000000..8452f31 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsNutritionService.java @@ -0,0 +1,15 @@ +package com.lyms.talkonlineweb.service; + +import com.lyms.talkonlineweb.domain.LymsNutrition; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author ldd +* @description 针对表【lyms_nutrition(营养管理)】的数据库操作Service +* @createDate 2023-04-02 16:30:32 +*/ +public interface LymsNutritionService extends IService { + + String upNutritionInfo(LymsNutrition lymsNutrition); + +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsNutritionServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsNutritionServiceImpl.java new file mode 100644 index 0000000..311047a --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsNutritionServiceImpl.java @@ -0,0 +1,36 @@ +package com.lyms.talkonlineweb.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lyms.talkonlineweb.domain.LymsNutrition; +import com.lyms.talkonlineweb.service.LymsNutritionService; +import com.lyms.talkonlineweb.mapper.LymsNutritionMapper; +import org.springframework.stereotype.Service; + +/** +* @author ldd +* @description 针对表【lyms_nutrition(营养管理)】的数据库操作Service实现 +* @createDate 2023-04-02 16:30:32 +*/ +@Service +public class LymsNutritionServiceImpl extends ServiceImpl + implements LymsNutritionService{ + + @Override + public String upNutritionInfo(LymsNutrition lymsNutrition) { + //查询是否存在 + LymsNutrition lymsNutrition1 = new LymsNutrition(); + lymsNutrition1.setInfo(lymsNutrition.getIdno()); + LymsNutrition nutrition = getOne(Wrappers.query(lymsNutrition1)); + if (nutrition != null){ + updateById(lymsNutrition); + } else { + save(lymsNutrition); + } + return null; + } +} + + + + diff --git a/talkonlineweb/src/main/resources/mapper/LymsNutritionMapper.xml b/talkonlineweb/src/main/resources/mapper/LymsNutritionMapper.xml new file mode 100644 index 0000000..19f5615 --- /dev/null +++ b/talkonlineweb/src/main/resources/mapper/LymsNutritionMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + idno,phone,info, + type,create_time,update_time + +