我对两个单独的控制器使用相同的模型。在一个控制器中,我想隐藏id,在另一个控制器中,我想显示它。 这是我要隐藏PaymentCardDto的ID的地方:
@RequestMapping(method = arrayOf(RequestMethod.POST), path = arrayOf("/api/card/add"))
@ResponseBody
fun addCustomerCard(@RequestBody paymentCardDto: PaymentCardDto,
@RequestParam(required = false, name = "set_current") setAsCurrent: String? = null,
@Autowired request: HttpServletRequest): CardVerificationResponseDto
在这里我想在PaymentCardDto中显示ID:
@RequestMapping(
method = arrayOf(RequestMethod.POST),
path = arrayOf("/api/card/edit/{payment_card_id}")
)
@ResponseBody
fun editCardCompanyInfo(@PathVariable("payment_card_id") paymentCardId: Long,
@RequestBody newCardInfo: PaymentCardDto,
@Autowired request: HttpServletRequest): PaymentCardDto
这是我的PaymentCardDto:
data class PaymentCardDto(
@ApiModelProperty(value = "id of payment card in customer context", example = "1651564")
var id: Long?,
...)