Commit 9fc4640570c87440257893101b0184490226db4d
1 parent
23509daa2c
Exists in
master
and in
1 other branch
2
Showing 5 changed files with 272 additions and 0 deletions
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsNutrition.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsNutritionMapper.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsNutritionService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsNutritionServiceImpl.java
- talkonlineweb/src/main/resources/mapper/LymsNutritionMapper.xml
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsNutrition.java
View file @
9fc4640
1 | +package com.lyms.talkonlineweb.domain; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.annotation.IdType; | |
4 | +import com.baomidou.mybatisplus.annotation.TableField; | |
5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
7 | +import java.io.Serializable; | |
8 | +import java.util.Date; | |
9 | + | |
10 | +/** | |
11 | + * 营养管理 | |
12 | + * @TableName lyms_nutrition | |
13 | + */ | |
14 | +@TableName(value ="lyms_nutrition") | |
15 | +public class LymsNutrition implements Serializable { | |
16 | + /** | |
17 | + * 身份证号 | |
18 | + */ | |
19 | + @TableId | |
20 | + private String idno; | |
21 | + | |
22 | + /** | |
23 | + * 电话 | |
24 | + */ | |
25 | + private String phone; | |
26 | + | |
27 | + /** | |
28 | + * 详细信息 | |
29 | + */ | |
30 | + private Object info; | |
31 | + | |
32 | + /** | |
33 | + * 类型 | |
34 | + */ | |
35 | + private Integer type; | |
36 | + | |
37 | + /** | |
38 | + * 创建时间 | |
39 | + */ | |
40 | + private Date createTime; | |
41 | + | |
42 | + /** | |
43 | + * 修改时间 | |
44 | + */ | |
45 | + private Date updateTime; | |
46 | + | |
47 | + @TableField(exist = false) | |
48 | + private static final long serialVersionUID = 1L; | |
49 | + | |
50 | + /** | |
51 | + * 身份证号 | |
52 | + */ | |
53 | + public String getIdno() { | |
54 | + return idno; | |
55 | + } | |
56 | + | |
57 | + /** | |
58 | + * 身份证号 | |
59 | + */ | |
60 | + public void setIdno(String idno) { | |
61 | + this.idno = idno; | |
62 | + } | |
63 | + | |
64 | + /** | |
65 | + * 电话 | |
66 | + */ | |
67 | + public String getPhone() { | |
68 | + return phone; | |
69 | + } | |
70 | + | |
71 | + /** | |
72 | + * 电话 | |
73 | + */ | |
74 | + public void setPhone(String phone) { | |
75 | + this.phone = phone; | |
76 | + } | |
77 | + | |
78 | + /** | |
79 | + * 详细信息 | |
80 | + */ | |
81 | + public Object getInfo() { | |
82 | + return info; | |
83 | + } | |
84 | + | |
85 | + /** | |
86 | + * 详细信息 | |
87 | + */ | |
88 | + public void setInfo(Object info) { | |
89 | + this.info = info; | |
90 | + } | |
91 | + | |
92 | + /** | |
93 | + * 类型 | |
94 | + */ | |
95 | + public Integer getType() { | |
96 | + return type; | |
97 | + } | |
98 | + | |
99 | + /** | |
100 | + * 类型 | |
101 | + */ | |
102 | + public void setType(Integer type) { | |
103 | + this.type = type; | |
104 | + } | |
105 | + | |
106 | + /** | |
107 | + * 创建时间 | |
108 | + */ | |
109 | + public Date getCreateTime() { | |
110 | + return createTime; | |
111 | + } | |
112 | + | |
113 | + /** | |
114 | + * 创建时间 | |
115 | + */ | |
116 | + public void setCreateTime(Date createTime) { | |
117 | + this.createTime = createTime; | |
118 | + } | |
119 | + | |
120 | + /** | |
121 | + * 修改时间 | |
122 | + */ | |
123 | + public Date getUpdateTime() { | |
124 | + return updateTime; | |
125 | + } | |
126 | + | |
127 | + /** | |
128 | + * 修改时间 | |
129 | + */ | |
130 | + public void setUpdateTime(Date updateTime) { | |
131 | + this.updateTime = updateTime; | |
132 | + } | |
133 | + | |
134 | + @Override | |
135 | + public boolean equals(Object that) { | |
136 | + if (this == that) { | |
137 | + return true; | |
138 | + } | |
139 | + if (that == null) { | |
140 | + return false; | |
141 | + } | |
142 | + if (getClass() != that.getClass()) { | |
143 | + return false; | |
144 | + } | |
145 | + LymsNutrition other = (LymsNutrition) that; | |
146 | + return (this.getIdno() == null ? other.getIdno() == null : this.getIdno().equals(other.getIdno())) | |
147 | + && (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone())) | |
148 | + && (this.getInfo() == null ? other.getInfo() == null : this.getInfo().equals(other.getInfo())) | |
149 | + && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType())) | |
150 | + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) | |
151 | + && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())); | |
152 | + } | |
153 | + | |
154 | + @Override | |
155 | + public int hashCode() { | |
156 | + final int prime = 31; | |
157 | + int result = 1; | |
158 | + result = prime * result + ((getIdno() == null) ? 0 : getIdno().hashCode()); | |
159 | + result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode()); | |
160 | + result = prime * result + ((getInfo() == null) ? 0 : getInfo().hashCode()); | |
161 | + result = prime * result + ((getType() == null) ? 0 : getType().hashCode()); | |
162 | + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); | |
163 | + result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); | |
164 | + return result; | |
165 | + } | |
166 | + | |
167 | + @Override | |
168 | + public String toString() { | |
169 | + StringBuilder sb = new StringBuilder(); | |
170 | + sb.append(getClass().getSimpleName()); | |
171 | + sb.append(" ["); | |
172 | + sb.append("Hash = ").append(hashCode()); | |
173 | + sb.append(", idno=").append(idno); | |
174 | + sb.append(", phone=").append(phone); | |
175 | + sb.append(", info=").append(info); | |
176 | + sb.append(", type=").append(type); | |
177 | + sb.append(", createTime=").append(createTime); | |
178 | + sb.append(", updateTime=").append(updateTime); | |
179 | + sb.append(", serialVersionUID=").append(serialVersionUID); | |
180 | + sb.append("]"); | |
181 | + return sb.toString(); | |
182 | + } | |
183 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsNutritionMapper.java
View file @
9fc4640
1 | +package com.lyms.talkonlineweb.mapper; | |
2 | + | |
3 | +import com.lyms.talkonlineweb.domain.LymsNutrition; | |
4 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
5 | + | |
6 | +/** | |
7 | +* @author ldd | |
8 | +* @description 针对表【lyms_nutrition(营养管理)】的数据库操作Mapper | |
9 | +* @createDate 2023-04-02 16:30:32 | |
10 | +* @Entity com.lyms.talkonlineweb.domain.LymsNutrition | |
11 | +*/ | |
12 | +public interface LymsNutritionMapper extends BaseMapper<LymsNutrition> { | |
13 | + | |
14 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsNutritionService.java
View file @
9fc4640
1 | +package com.lyms.talkonlineweb.service; | |
2 | + | |
3 | +import com.lyms.talkonlineweb.domain.LymsNutrition; | |
4 | +import com.baomidou.mybatisplus.extension.service.IService; | |
5 | + | |
6 | +/** | |
7 | +* @author ldd | |
8 | +* @description 针对表【lyms_nutrition(营养管理)】的数据库操作Service | |
9 | +* @createDate 2023-04-02 16:30:32 | |
10 | +*/ | |
11 | +public interface LymsNutritionService extends IService<LymsNutrition> { | |
12 | + | |
13 | + String upNutritionInfo(LymsNutrition lymsNutrition); | |
14 | + | |
15 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsNutritionServiceImpl.java
View file @
9fc4640
1 | +package com.lyms.talkonlineweb.service.impl; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
4 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
5 | +import com.lyms.talkonlineweb.domain.LymsNutrition; | |
6 | +import com.lyms.talkonlineweb.service.LymsNutritionService; | |
7 | +import com.lyms.talkonlineweb.mapper.LymsNutritionMapper; | |
8 | +import org.springframework.stereotype.Service; | |
9 | + | |
10 | +/** | |
11 | +* @author ldd | |
12 | +* @description 针对表【lyms_nutrition(营养管理)】的数据库操作Service实现 | |
13 | +* @createDate 2023-04-02 16:30:32 | |
14 | +*/ | |
15 | +@Service | |
16 | +public class LymsNutritionServiceImpl extends ServiceImpl<LymsNutritionMapper, LymsNutrition> | |
17 | + implements LymsNutritionService{ | |
18 | + | |
19 | + @Override | |
20 | + public String upNutritionInfo(LymsNutrition lymsNutrition) { | |
21 | + //查询是否存在 | |
22 | + LymsNutrition lymsNutrition1 = new LymsNutrition(); | |
23 | + lymsNutrition1.setInfo(lymsNutrition.getIdno()); | |
24 | + LymsNutrition nutrition = getOne(Wrappers.query(lymsNutrition1)); | |
25 | + if (nutrition != null){ | |
26 | + updateById(lymsNutrition); | |
27 | + } else { | |
28 | + save(lymsNutrition); | |
29 | + } | |
30 | + return null; | |
31 | + } | |
32 | +} |
talkonlineweb/src/main/resources/mapper/LymsNutritionMapper.xml
View file @
9fc4640
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper | |
3 | + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
4 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
5 | +<mapper namespace="com.lyms.talkonlineweb.mapper.LymsNutritionMapper"> | |
6 | + | |
7 | + <resultMap id="BaseResultMap" type="com.lyms.talkonlineweb.domain.LymsNutrition"> | |
8 | + <id property="idno" column="idno" jdbcType="VARCHAR"/> | |
9 | + <result property="phone" column="phone" jdbcType="VARCHAR"/> | |
10 | + <result property="info" column="info" jdbcType="OTHER"/> | |
11 | + <result property="type" column="type" jdbcType="INTEGER"/> | |
12 | + <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> | |
13 | + <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> | |
14 | + </resultMap> | |
15 | + | |
16 | + <sql id="Base_Column_List"> | |
17 | + idno,phone,info, | |
18 | + type,create_time,update_time | |
19 | + </sql> | |
20 | +</mapper> |