1.修改会员信息时修改查询逻辑
Showing
1 changed file
with
13 additions
and
4 deletions
| ... | @@ -10,6 +10,7 @@ import com.topdraw.common.ResultInfo; | ... | @@ -10,6 +10,7 @@ import com.topdraw.common.ResultInfo; |
| 10 | import com.topdraw.util.Base64Util; | 10 | import com.topdraw.util.Base64Util; |
| 11 | import io.swagger.annotations.Api; | 11 | import io.swagger.annotations.Api; |
| 12 | import io.swagger.annotations.ApiOperation; | 12 | import io.swagger.annotations.ApiOperation; |
| 13 | import lombok.extern.slf4j.Slf4j; | ||
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | import org.springframework.util.Assert; | 15 | import org.springframework.util.Assert; |
| 15 | import org.springframework.util.StringUtils; | 16 | import org.springframework.util.StringUtils; |
| ... | @@ -27,6 +28,7 @@ import java.util.Objects; | ... | @@ -27,6 +28,7 @@ import java.util.Objects; |
| 27 | @RestController | 28 | @RestController |
| 28 | @RequestMapping("/ucEngine/api/member") | 29 | @RequestMapping("/ucEngine/api/member") |
| 29 | @CrossOrigin | 30 | @CrossOrigin |
| 31 | @Slf4j | ||
| 30 | public class MemberController { | 32 | public class MemberController { |
| 31 | 33 | ||
| 32 | @Autowired | 34 | @Autowired |
| ... | @@ -70,15 +72,22 @@ public class MemberController { | ... | @@ -70,15 +72,22 @@ public class MemberController { |
| 70 | @ApiOperation("修改Member") | 72 | @ApiOperation("修改Member") |
| 71 | @AnonymousAccess | 73 | @AnonymousAccess |
| 72 | public ResultInfo update(@Validated @RequestBody Member resources) { | 74 | public ResultInfo update(@Validated @RequestBody Member resources) { |
| 75 | |||
| 76 | log.info("member ==>> update =>> [{}]",resources); | ||
| 77 | |||
| 73 | Long memberId = resources.getId(); | 78 | Long memberId = resources.getId(); |
| 74 | Assert.notNull(memberId,"memberId can't be null"); | 79 | String code1 = resources.getCode(); |
| 75 | MemberDTO memberDTO = this.memberService.findById(memberId); | 80 | |
| 76 | if (Objects.nonNull(memberDTO)) { | 81 | MemberDTO memberDTO = this.memberService.getByCode(code1); |
| 82 | if (Objects.isNull(memberDTO.getCode())) { | ||
| 83 | memberDTO = this.memberService.findById(memberId); | ||
| 84 | } | ||
| 85 | |||
| 77 | String code = memberDTO.getCode(); | 86 | String code = memberDTO.getCode(); |
| 87 | log.info("member ==>> memberDTO =>> [{}]",memberDTO); | ||
| 78 | Assert.notNull(code, "code can't be null"); | 88 | Assert.notNull(code, "code can't be null"); |
| 79 | resources.setCode(code); | 89 | resources.setCode(code); |
| 80 | memberService.update(resources); | 90 | memberService.update(resources); |
| 81 | } | ||
| 82 | return ResultInfo.success(); | 91 | return ResultInfo.success(); |
| 83 | } | 92 | } |
| 84 | 93 | ... | ... |
-
Please register or sign in to post a comment