mirror of
https://gitee.com/best_handsome/mybatis-plus-join
synced 2025-07-11 00:02:22 +08:00
add repository test
This commit is contained in:
parent
effdc96299
commit
5b61dfedd8
@ -0,0 +1,11 @@
|
|||||||
|
package com.github.yulichang.test.join.repository;
|
||||||
|
|
||||||
|
import com.github.yulichang.repository.JoinCrudRepository;
|
||||||
|
import com.github.yulichang.test.join.entity.UserDO;
|
||||||
|
import com.github.yulichang.test.join.mapper.UserMapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class UserCrudRepository extends JoinCrudRepository<UserMapper, UserDO> {
|
||||||
|
|
||||||
|
}
|
@ -3,7 +3,7 @@ package com.github.yulichang.test.join.unit;
|
|||||||
import com.github.yulichang.test.join.dto.UserDTO;
|
import com.github.yulichang.test.join.dto.UserDTO;
|
||||||
import com.github.yulichang.test.join.entity.AddressDO;
|
import com.github.yulichang.test.join.entity.AddressDO;
|
||||||
import com.github.yulichang.test.join.entity.UserDO;
|
import com.github.yulichang.test.join.entity.UserDO;
|
||||||
import com.github.yulichang.test.join.mapper.UserMapper;
|
import com.github.yulichang.test.join.repository.UserCrudRepository;
|
||||||
import com.github.yulichang.test.util.Reset;
|
import com.github.yulichang.test.util.Reset;
|
||||||
import com.github.yulichang.test.util.ThreadLocalUtils;
|
import com.github.yulichang.test.util.ThreadLocalUtils;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
@ -19,7 +19,7 @@ import java.util.List;
|
|||||||
public class StringColumTest {
|
public class StringColumTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserMapper userMapper;
|
private UserCrudRepository userCrudRepository;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setUp() {
|
void setUp() {
|
||||||
@ -33,7 +33,7 @@ public class StringColumTest {
|
|||||||
ThreadLocalUtils.set("SELECT (SELECT id FROM `user` u WHERE u.id = t.id) id, t.`name` AS PName, t.`name` PName, t.`name`," +
|
ThreadLocalUtils.set("SELECT (SELECT id FROM `user` u WHERE u.id = t.id) id, t.`name` AS PName, t.`name` PName, t.`name`," +
|
||||||
" (SELECT id FROM `user` u WHERE u.id = t.id), t1.id AS joina_id, t1.user_id, t1.area_id, t1.tel, " +
|
" (SELECT id FROM `user` u WHERE u.id = t.id), t1.id AS joina_id, t1.user_id, t1.area_id, t1.tel, " +
|
||||||
"t1.address, t1.del FROM `user` t LEFT JOIN address t1 ON (t1.user_id = t.id) WHERE t.del = false AND t1.del = false");
|
"t1.address, t1.del FROM `user` t LEFT JOIN address t1 ON (t1.user_id = t.id) WHERE t.del = false AND t1.del = false");
|
||||||
List<UserDTO> l3 = userMapper.selectJoinList(UserDTO.class, new MPJLambdaWrapper<UserDO>()
|
List<UserDTO> l3 = userCrudRepository.selectJoinList(UserDTO.class, new MPJLambdaWrapper<UserDO>()
|
||||||
.select("(select id from `user` u where u.id = t.id) id")
|
.select("(select id from `user` u where u.id = t.id) id")
|
||||||
.select("t.`name` as PName")
|
.select("t.`name` as PName")
|
||||||
.select("t.`name` PName")
|
.select("t.`name` PName")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user