Files
sweet-hut-service/home-service/src/main/resources/mapper/PasswordMapper.xml
2025-10-30 15:00:00 +08:00

32 lines
1.0 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cxx.home.dao.PasswordDao">
<select id="query" resultType="com.cxx.home.dto.password.PasswordDto">
SELECT
id AS id,
title AS title,
website AS website,
username AS username,
password AS password,
category AS category,
owner AS owner,
remark AS remark
FROM
password
<where>
<if test="query.category != null and query.category != ''">
category = #{query.category}
</if>
<if test="query.owner != null and query.owner != ''">
AND owner = #{query.owner}
</if>
</where>
</select>
<select id="queryCategory" resultType="string">
SELECT DISTINCT category
FROM password
WHERE category IS NOT NULL AND category != '';
</select>
</mapper>