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.

48 lines
1.7 KiB

<?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.example.demo.mapper.cash.MessageMapper">
<update id="update">
update message
set flag=1
where id=#{id}
</update>
<select id="getMessage" resultType="com.example.demo.domain.vo.coin.Messages">
SELECT
m.id,
m.jwcode,
m.name, <!-- ✅ message.name -->
m.title,
m.`desc`,
m.status,
m.market,
m.type,
m.type_id,
m.flag,
m.cz_time,
m.query_id, <!-- 🔍 添加 queryId 字段 -->
m.executor, <!-- 👤 添加 executor 字段 -->
mk.name AS market_name <!-- ✅ market.name -->
FROM message m
LEFT JOIN market mk ON m.market = mk.id
<where>
m.flag = 0
<if test="status != null and status.size() > 0">
AND m.status IN
<foreach item="item" collection="status" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="markets != null and markets.size() > 0">
AND m.market IN
<foreach item="item" collection="markets" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<!-- 只有当 executor 不为 null 时才添加过滤条件 -->
<if test="executor != null">
AND (m.executor = #{executor} OR m.executor IS NULL)
</if>
</where>
ORDER BY m.cz_time DESC
</select>
</mapper>