Commit d6dd85576063177ed99c50f26e77987b751212ca
1 parent
3fc8b6e908
Exists in
master
修改接口
Showing 2 changed files with 12 additions and 4 deletions
mainData/src/main/resources/mainOrm/MedKids.xml
View file @
d6dd855
... | ... | @@ -67,8 +67,8 @@ |
67 | 67 | <if test="buildTime != null and buildTime != ''"> |
68 | 68 | and ki_buildtime = #{buildTime,jdbcType=VARCHAR} |
69 | 69 | </if> |
70 | - <if test="isdelete != null and isdelete != ''"> | |
71 | - and isdelete = #{isdelete,jdbcType=VARCHAR} | |
70 | + <if test="isDelete != null and isDelete != ''"> | |
71 | + and isdelete = #{isDelete,jdbcType=VARCHAR} | |
72 | 72 | </if> |
73 | 73 | </where> |
74 | 74 | </sql> |
webApi/src/main/java/com/lyms/yimiao/web/controller/v1/KidsController.java
View file @
d6dd855
... | ... | @@ -11,6 +11,7 @@ |
11 | 11 | import com.lymsh.yimiao.main.data.model.*; |
12 | 12 | import com.lymsh.yimiao.main.data.service.*; |
13 | 13 | import com.lymsh.yimiao.main.data.util.JsonUtil; |
14 | +import com.lymsh.yimiao.main.data.util.LoginContext; | |
14 | 15 | import org.apache.commons.collections.CollectionUtils; |
15 | 16 | import org.springframework.beans.factory.annotation.Autowired; |
16 | 17 | import org.springframework.beans.factory.annotation.Value; |
... | ... | @@ -20,6 +21,7 @@ |
20 | 21 | import org.springframework.web.bind.annotation.RequestMethod; |
21 | 22 | import org.springframework.web.bind.annotation.RequestParam; |
22 | 23 | |
24 | +import javax.servlet.http.HttpServletRequest; | |
23 | 25 | import javax.servlet.http.HttpServletResponse; |
24 | 26 | import java.util.*; |
25 | 27 | |
26 | 28 | |
27 | 29 | |
... | ... | @@ -164,11 +166,17 @@ |
164 | 166 | @RequestMapping(value = "/babys", method = RequestMethod.POST) |
165 | 167 | @TokenRequired |
166 | 168 | public void UserRelateKids(HttpServletResponse response, |
169 | + HttpServletRequest request, | |
167 | 170 | @RequestParam("id")String id){ |
168 | 171 | |
172 | + MedKids kids = medKidsService.getMedKids(id); | |
173 | + if (kids == null) { | |
174 | + ResultUtils.buildParameterErrorResultAndWrite(response, "宝宝id不存在"); | |
175 | + return; | |
176 | + } | |
169 | 177 | //取到当前登陆用户的id |
170 | - MommyBobyContext mommyBobyContext= ContextHolder.getContext(); | |
171 | - YmUsers users = usersService.getYmUsers(mommyBobyContext.getUserId()); | |
178 | + LoginContext loginContext = (LoginContext) request.getAttribute("loginContext"); | |
179 | + YmUsers users = usersService.getYmUsers(loginContext.getId()); | |
172 | 180 | //把查询到的宝宝id与登陆用户关联 |
173 | 181 | YmUserKidMapsQuery query = new YmUserKidMapsQuery(); |
174 | 182 | query.setUserId(users.getId()); |