mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 17:18:24 +08:00
test: 枚举属性测试。
This commit is contained in:
parent
4d2778e836
commit
41524440c9
@ -28,23 +28,31 @@ public class Account extends BaseEntity<String, Long> {
|
|||||||
private Integer age;
|
private Integer age;
|
||||||
private Date birthday;
|
private Date birthday;
|
||||||
|
|
||||||
|
private Gender gender;
|
||||||
|
|
||||||
|
public Gender getGender() {
|
||||||
|
return gender;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public void setGender(Gender gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public String getUserName() {
|
/*public String getUserName() {
|
||||||
return userName;
|
return userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserName(String userName) {
|
public void setUserName(String userName) {
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public Integer getAge() {
|
public Integer getAge() {
|
||||||
return age;
|
return age;
|
||||||
|
|||||||
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||||
|
* <p>
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* <p>
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* <p>
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.mybatisflex.test.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 王帅
|
||||||
|
* @since 2023-06-14
|
||||||
|
*/
|
||||||
|
public enum Gender {
|
||||||
|
|
||||||
|
MALE, FEMALE;
|
||||||
|
/*MALE(1), FEMALE(0);
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EnumValue
|
||||||
|
private final int code;
|
||||||
|
|
||||||
|
Gender(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
@ -35,8 +35,6 @@ class FieldTest {
|
|||||||
void test() {
|
void test() {
|
||||||
String genericString = BaseEntity.class.toGenericString();
|
String genericString = BaseEntity.class.toGenericString();
|
||||||
System.out.println(genericString);
|
System.out.println(genericString);
|
||||||
// List<String> genericParameters = StringUtil.getGenericParameters(genericString);
|
|
||||||
// System.out.println(genericParameters);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@ -18,6 +18,7 @@ package com.mybatisflex.test.mapper;
|
|||||||
|
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import com.mybatisflex.test.model.Account;
|
import com.mybatisflex.test.model.Account;
|
||||||
|
import com.mybatisflex.test.model.Gender;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
@ -62,4 +63,12 @@ class AccountMapperTest {
|
|||||||
accountMapper.selectListByQuery(QueryWrapper.create()).forEach(System.err::println);
|
accountMapper.selectListByQuery(QueryWrapper.create()).forEach(System.err::println);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testEnum() {
|
||||||
|
Account account = new Account();
|
||||||
|
account.setId(1L);
|
||||||
|
account.setGender(Gender.MALE);
|
||||||
|
accountMapper.update(account);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user