You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.2 KiB

3 months ago
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.web.mapper.LoginMapper">
<resultMap id="LoginResultMap" type="com.example.web.entity.Login">
<id property="id" column="id"/>
<result property="projectName" column="projectName"/>
<result property="userName" column="userName"/>
<result property="password" column="password"/>
</resultMap>
<select id="findByProjectNameAndUserName" resultMap="LoginResultMap">
SELECT id, projectName, userName, password
FROM login
WHERE projectName = #{projectName} AND userName = #{userName}
</select>
<select id="findByConditions" resultMap="LoginResultMap">
SELECT id, projectName, userName, password
FROM login
<where>
<if test="projectName != null">
AND projectName = #{projectName}
</if>
<if test="userName != null">
AND userName = #{userName}
</if>
</where>
ORDER BY id DESC
</select>
</mapper>