mirror of
https://gitee.com/best_handsome/mybatis-plus-join
synced 2025-07-11 00:02:22 +08:00
test
This commit is contained in:
parent
78941e52d9
commit
42131fe52d
@ -1,13 +0,0 @@
|
||||
package com.github.yulichang.test;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
package com.github.yulichang.test;
|
||||
|
||||
import com.github.yulichang.test.mapper.UserMapper;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ApplicationContextEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component
|
||||
@SuppressWarnings("unused")
|
||||
public class ListenerEvent implements ApplicationListener<ApplicationContextEvent> {
|
||||
@Resource
|
||||
private HikariDataSource hikariDataSource;
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
private SqlSessionFactory sqlSessionFactory;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
System.out.println("1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(@NotNull ApplicationContextEvent applicationContextEvent) {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.github.yulichang.test.join;
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
|
||||
@SpringBootApplication
|
||||
public class Application {
|
||||
|
||||
}
|
@ -1,13 +1,14 @@
|
||||
package com.github.yulichang.test;
|
||||
package com.github.yulichang.test.join;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.test.dto.AddressDTO;
|
||||
import com.github.yulichang.test.dto.UserDTO;
|
||||
import com.github.yulichang.test.entity.AddressDO;
|
||||
import com.github.yulichang.test.entity.AreaDO;
|
||||
import com.github.yulichang.test.entity.UserDO;
|
||||
import com.github.yulichang.test.mapper.UserMapper;
|
||||
import com.github.yulichang.test.join.dto.AddressDTO;
|
||||
import com.github.yulichang.test.join.dto.UserDTO;
|
||||
import com.github.yulichang.test.join.entity.AddressDO;
|
||||
import com.github.yulichang.test.join.entity.AreaDO;
|
||||
import com.github.yulichang.test.join.entity.UserDO;
|
||||
import com.github.yulichang.test.join.mapper.UserMapper;
|
||||
import com.github.yulichang.toolkit.MPJWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
@ -26,8 +27,8 @@ import java.util.Map;
|
||||
* <p>
|
||||
* 移除了mybatis-plus 逻辑删除支持,逻辑删除需要在连表查询时自己添加对应的条件
|
||||
*/
|
||||
@SpringBootTest
|
||||
@SuppressWarnings("unused")
|
||||
@SpringBootTest(properties = "spring.profiles.active=join")
|
||||
class LambdaWrapperTest {
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
@ -39,6 +40,8 @@ class LambdaWrapperTest {
|
||||
*/
|
||||
@Test
|
||||
void testJoin() {
|
||||
userMapper.selectListDeep(new QueryWrapper<>());
|
||||
|
||||
MPJLambdaWrapper<UserDO> wrapper = new MPJLambdaWrapper<UserDO>()
|
||||
.selectAll(UserDO.class)
|
||||
.selectCollection(AddressDO.class, UserDTO::getAddressList, addr -> addr
|
@ -1,11 +1,11 @@
|
||||
package com.github.yulichang.test;
|
||||
package com.github.yulichang.test.join;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.query.MPJQueryWrapper;
|
||||
import com.github.yulichang.test.dto.UserDTO;
|
||||
import com.github.yulichang.test.entity.UserDO;
|
||||
import com.github.yulichang.test.mapper.UserMapper;
|
||||
import com.github.yulichang.test.join.dto.UserDTO;
|
||||
import com.github.yulichang.test.join.entity.UserDO;
|
||||
import com.github.yulichang.test.join.mapper.UserMapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@ -13,7 +13,7 @@ import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@SpringBootTest
|
||||
@SpringBootTest(properties = "spring.profiles.active=join")
|
||||
class QueryWrapperTest {
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
@ -1,4 +1,4 @@
|
||||
package com.github.yulichang.test.config;
|
||||
package com.github.yulichang.test.join.config;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
@ -1,6 +1,6 @@
|
||||
package com.github.yulichang.test.dto;
|
||||
package com.github.yulichang.test.join.dto;
|
||||
|
||||
import com.github.yulichang.test.entity.AreaDO;
|
||||
import com.github.yulichang.test.join.entity.AreaDO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
@ -1,4 +1,4 @@
|
||||
package com.github.yulichang.test.dto;
|
||||
package com.github.yulichang.test.join.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
@ -1,6 +1,6 @@
|
||||
package com.github.yulichang.test.dto;
|
||||
package com.github.yulichang.test.join.dto;
|
||||
|
||||
import com.github.yulichang.test.enums.Sex;
|
||||
import com.github.yulichang.test.join.enums.Sex;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.github.yulichang.test.entity;
|
||||
package com.github.yulichang.test.join.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
@ -1,4 +1,4 @@
|
||||
package com.github.yulichang.test.entity;
|
||||
package com.github.yulichang.test.join.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
@ -1,11 +1,11 @@
|
||||
package com.github.yulichang.test.entity;
|
||||
package com.github.yulichang.test.join.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import com.github.yulichang.test.enums.Sex;
|
||||
import com.github.yulichang.test.join.enums.Sex;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
@ -1,4 +1,4 @@
|
||||
package com.github.yulichang.test.enums;
|
||||
package com.github.yulichang.test.join.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import lombok.Getter;
|
@ -1,7 +1,7 @@
|
||||
package com.github.yulichang.test.mapper;
|
||||
package com.github.yulichang.test.join.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.github.yulichang.test.entity.AddressDO;
|
||||
import com.github.yulichang.test.join.entity.AddressDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
@ -1,7 +1,7 @@
|
||||
package com.github.yulichang.test.mapper;
|
||||
package com.github.yulichang.test.join.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.github.yulichang.test.entity.AreaDO;
|
||||
import com.github.yulichang.test.join.entity.AreaDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
@ -1,7 +1,7 @@
|
||||
package com.github.yulichang.test.mapper;
|
||||
package com.github.yulichang.test.join.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.github.yulichang.test.entity.UserDO;
|
||||
import com.github.yulichang.test.join.entity.UserDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
@ -0,0 +1,8 @@
|
||||
package com.github.yulichang.test.mapping;
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class Application {
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.github.yulichang.test.mapping;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.test.mapping.entity.UserDO;
|
||||
import com.github.yulichang.test.mapping.mapper.UserMapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 注解一对一,一对多查询
|
||||
*/
|
||||
@SpringBootTest(properties = "spring.profiles.active=mapping")
|
||||
@SuppressWarnings("unused")
|
||||
class MappingTest {
|
||||
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
List<UserDO> dos = userMapper.selectListDeep(new QueryWrapper<>());
|
||||
System.out.println(1);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.github.yulichang.test.mapping.config;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* mybatis-plus配置
|
||||
*/
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
/**
|
||||
* 分页插件
|
||||
*/
|
||||
@Bean
|
||||
public MybatisPlusInterceptor paginationInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
PaginationInnerInterceptor page = new PaginationInnerInterceptor();
|
||||
page.setOptimizeJoin(false);
|
||||
interceptor.addInnerInterceptor(page);
|
||||
return interceptor;
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.github.yulichang.test.mapping.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode
|
||||
@TableName("address")
|
||||
public class AddressDO {
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private Integer areaId;
|
||||
|
||||
private String tel;
|
||||
|
||||
private String address;
|
||||
|
||||
@TableLogic
|
||||
private Boolean del;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.github.yulichang.test.mapping.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode
|
||||
@TableName("area")
|
||||
public class AreaDO {
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
private String province;
|
||||
|
||||
private String city;
|
||||
|
||||
private String area;
|
||||
|
||||
private String postcode;
|
||||
|
||||
@TableLogic
|
||||
private Boolean del;
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.github.yulichang.test.mapping.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import com.github.yulichang.annotation.EntityMapping;
|
||||
import com.github.yulichang.test.mapping.enums.Sex;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode
|
||||
@TableName(value = "`user`", autoResultMap = true)
|
||||
public class UserDO {
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
private Integer pid;
|
||||
|
||||
@TableField(value = "`name`", typeHandler = JacksonTypeHandler.class)
|
||||
private Map<String, String> name;
|
||||
|
||||
private Sex sex;
|
||||
|
||||
private String headImg;
|
||||
|
||||
private Integer addressId;
|
||||
|
||||
@TableLogic
|
||||
private Boolean del;
|
||||
|
||||
@TableField(exist = false)
|
||||
@EntityMapping(thisField = "pid", joinField = "id")
|
||||
private UserDO pUser;
|
||||
|
||||
@TableField(exist = false)
|
||||
@EntityMapping(thisField = "id", joinField = "pid")
|
||||
private List<UserDO> userList;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.github.yulichang.test.mapping.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
public enum Sex {
|
||||
|
||||
MAN(0, "男"),
|
||||
|
||||
WOMAN(1, "女");
|
||||
|
||||
@EnumValue
|
||||
private final int code;
|
||||
private final String des;
|
||||
|
||||
Sex(int code, String des) {
|
||||
this.code = code;
|
||||
this.des = des;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.github.yulichang.test.mapping.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.github.yulichang.test.mapping.entity.AddressDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
@SuppressWarnings("unused")
|
||||
public interface AddressMapper extends MPJBaseMapper<AddressDO> {
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.github.yulichang.test.mapping.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.github.yulichang.test.mapping.entity.AreaDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
@SuppressWarnings("unused")
|
||||
public interface AreaMapper extends MPJBaseMapper<AreaDO> {
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.github.yulichang.test.mapping.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.github.yulichang.test.mapping.entity.UserDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UserMapper extends MPJBaseMapper<UserDO> {
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
spring:
|
||||
sql:
|
||||
init:
|
||||
schema-locations: classpath:db/join/schema.sql
|
||||
data-locations: classpath:db/join/data.sql
|
@ -0,0 +1,5 @@
|
||||
spring:
|
||||
sql:
|
||||
init:
|
||||
schema-locations: classpath:db/mapping/schema.sql
|
||||
data-locations: classpath:db/mapping/data.sql
|
@ -4,11 +4,6 @@ spring:
|
||||
url: jdbc:h2:mem:test
|
||||
username: root
|
||||
password: test
|
||||
sql:
|
||||
init:
|
||||
schema-locations: classpath:db/schema.sql
|
||||
data-locations: classpath:db/data.sql
|
||||
|
||||
|
||||
mybatis-plus:
|
||||
global-config:
|
@ -0,0 +1,79 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
|
||||
DELETE FROM area;
|
||||
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10001, '北京市01', '北京01', '朝阳01', '80001', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10002, '北京市02', '北京02', '朝阳02', '80002', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10003, '北京市03', '北京03', '朝阳03', '80003', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10004, '北京市04', '北京04', '朝阳04', '80004', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10005, '北京市05', '北京05', '朝阳05', '80005', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10006, '北京市06', '北京06', '朝阳06', '80006', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10007, '北京市07', '北京07', '朝阳07', '80007', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10008, '北京市08', '北京08', '朝阳08', '80008', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10009, '北京市09', '北京09', '朝阳09', '80009', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10010, '北京市10', '北京10', '朝阳10', '80010', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10011, '北京市11', '北京11', '朝阳11', '80011', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10012, '北京市12', '北京12', '朝阳12', '80012', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10013, '北京市13', '北京13', '朝阳13', '80013', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10014, '北京市14', '北京14', '朝阳14', '80014', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10015, '北京市15', '北京15', '朝阳15', '80015', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10016, '北京市16', '北京16', '朝阳16', '80016', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10017, '北京市17', '北京17', '朝阳17', '80017', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10018, '北京市18', '北京18', '朝阳18', '80018', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10019, '北京市19', '北京19', '朝阳19', '80019', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10020, '北京市20', '北京20', '朝阳20', '80020', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10021, '北京市21', '北京21', '朝阳21', '80021', false);
|
||||
INSERT INTO area (id, province, city, area, postcode, del) VALUES (10022, '北京市22', '北京22', '朝阳22', '80022', false);
|
||||
|
||||
DELETE FROM `user`;
|
||||
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES ( 1, 1, '{"aa":"aaa","bb":"bbb"}', 1, 1, 'https://url-01', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES ( 2, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-02', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES ( 3, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-03', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES ( 4, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-04', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES ( 5, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-05', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES ( 6, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-06', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES ( 7, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-07', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES ( 8, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-08', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES ( 9, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-09', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES (10, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-10', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES (11, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-11', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES (12, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-12', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES (13, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-13', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES (14, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-14', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES (15, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-15', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES (16, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-16', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES (17, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-17', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES (18, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-18', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES (19, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-19', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES (20, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-20', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES (21, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-21', false);
|
||||
INSERT INTO `user` (id, pid, `name`, `address_id`, sex, head_img, del) VALUES (22, 1, '{"aa":"aaa","bb":"bbb"}', 1, 0, 'https://url-22', false);
|
||||
|
||||
|
||||
DELETE FROM address;
|
||||
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES ( 1, 1, 10001, '10000000001', '曹县01', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES ( 2, 1, 10002, '10000000002', '曹县02', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES ( 3, 1, 10003, '10000000003', '曹县03', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES ( 4, 1, 10004, '10000000004', '曹县04', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES ( 5, 1, 10005, '10000000005', '曹县05', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES ( 6, 1, 10006, '10000000006', '曹县06', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES ( 7, 1, 10007, '10000000007', '曹县07', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES ( 8, 1, 10008, '10000000008', '曹县08', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES ( 9, 1, 10009, '10000000009', '曹县09', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES (10,10, 10010, '10000000010', '曹县10', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES (11,11, 10011, '10000000011', '曹县11', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES (12,12, 10012, '10000000012', '曹县12', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES (13,13, 10013, '10000000013', '曹县13', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES (14,14, 10014, '10000000014', '曹县14', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES (15,15, 10015, '10000000015', '曹县15', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES (16,16, 10016, '10000000016', '曹县16', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES (17,17, 10017, '10000000017', '曹县17', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES (18,18, 10018, '10000000018', '曹县18', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES (19,19, 10019, '10000000019', '曹县19', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES (20,20, 10020, '10000000020', '曹县20', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES (21,21, 10021, '10000000021', '曹县21', false);
|
||||
INSERT INTO address (id, user_id, area_id, tel, address, del) VALUES (22,22, 10022, '10000000022', '曹县22', false);
|
@ -0,0 +1,43 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
|
||||
DROP TABLE IF EXISTS area;
|
||||
|
||||
create table area
|
||||
(
|
||||
id int auto_increment
|
||||
primary key,
|
||||
province varchar(255) null,
|
||||
city varchar(255) null,
|
||||
area varchar(255) null,
|
||||
postcode varchar(255) null,
|
||||
del bit
|
||||
);
|
||||
|
||||
DROP TABLE IF EXISTS `user`;
|
||||
|
||||
create table `user`
|
||||
(
|
||||
id int auto_increment
|
||||
primary key,
|
||||
pid int null,
|
||||
`name` varchar(255) not null,
|
||||
`address_id` int not null,
|
||||
sex tinyint not null,
|
||||
head_img varchar(255) not null,
|
||||
del bit
|
||||
);
|
||||
|
||||
DROP TABLE IF EXISTS address;
|
||||
|
||||
create table address
|
||||
(
|
||||
id int auto_increment
|
||||
primary key,
|
||||
user_id int null,
|
||||
area_id int null,
|
||||
tel varchar(255) null,
|
||||
address varchar(255) null,
|
||||
del bit
|
||||
);
|
Loading…
x
Reference in New Issue
Block a user