zxl
2025-06-24 88bd75d93f86d3cf4f12e652d459da8bae71e545
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?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="cn.lili.modules.lmk.mapper.NewsMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.NewsVO">
        <result column="title" property="title" />
        <result column="content" property="content"/>
        <result column="publish" property="publish" />
        <result column="publishDate" property="publish_date" />
 
    </resultMap>
 
    <select id="getById" resultMap="BaseResultMap">
        SELECT
            LN.id,
            LN.publish,
            LN.publish_date,
            LN.content,
            LN.title
        FROM
            lmk_news LN
        WHERE
            LN.id = #{id} AND LN.delete_flag = 0
    </select>
 
 
    <select id="getPage" resultMap="BaseResultMap">
        SELECT
        LN.id,
        LN.publish,
        LN.publish_date,
        LN.content,
        LN.title
        FROM
            lmk_news LN
        WHERE
            LN.delete_flag = 0
            <if test="query.title != null and query.title != ''">AND LN.title LIKE CONCAT('%', #{query.title}, '%')</if>
            <if test="query.publish != null and query.publish != ''">AND LN.publish = #{query.publish}</if>
    </select>
 
 
</mapper>