[test] 新增查询根据手机号查询用户信息的测试用例

pull/445/head
hsdllcw 1 year ago
parent 9c94e2cd0f
commit 8c3e52a0c5

@ -240,6 +240,11 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
@ -247,7 +252,7 @@
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<artifactId>kotlin-test-junit</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>

@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u
@ -148,7 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="findByPhoneNumberStartingWith" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.phonenumber = CONCAT(#{phoneNumber},"%") and u.del_flag = '0'
where u.phonenumber like CONCAT(#{phoneNumber},"%") and u.del_flag = '0'
</select>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">

@ -0,0 +1,21 @@
package com.ruoyi.system.service
import com.alibaba.fastjson.JSONObject
import com.ruoyi.system.RuoYiSystemApplication
import org.junit.runner.RunWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
import kotlin.test.Test
@RunWith(SpringJUnit4ClassRunner::class)
@SpringBootTest(classes = [RuoYiSystemApplication::class], webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class ISysUserServiceTest {
@Autowired
lateinit var iSysUserService: ISysUserService
@Test
fun findByPhoneNumberStartingWithTest() {
println(JSONObject.toJSONString(iSysUserService.findByPhoneNumberStartingWith("1")))
}
}
Loading…
Cancel
Save