kotlin中 data class 的可选参数

data class SendCmdBaseDto (
    val vin: String,
    val remoteType: String,
    val commandType: String,
    val type: Int,
    val seqNo: String,
    val securityPassword: String?,
    val temp:String? = null, //可以在调用的时候不给改变量赋值
    val openAngle: String? = null,
    val runtime: String? = null
):BaseDto()

使用

  windowControlModel.sendRemoteCmdCommon(
            SendCmdBaseDto(
                vin = vin,
                remoteType ="0",
                seqNo = seqNo,
                commandType = RemoteTypeCode,
                type = 1,
                openAngle = "2",
                securityPassword = scyPwd
            )
        )

你可能感兴趣的:(Kotlin)