peng
2025-10-27 2a7b0a64b14b22ec45f8a0f6e4764bc3cd16919c
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?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.GoodsCustomizeTemplateMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.GoodsCustomizeTemplateVO">
        <id column="id" property="id"/>
        <result column="template_name" property="templateName" />
        <result column="status" property="status" />
    </resultMap>
 
    <select id="getById" resultMap="BaseResultMap">
        SELECT
            LGCT.template_name,
            LGCT.status,
            LGCT.id
        FROM
            lmk_goods_customize_template LGCT
        WHERE
            LGCT.id = #{id} AND LGCT.delete_flag = 0
    </select>
 
 
    <select id="getPage" resultMap="BaseResultMap">
        SELECT
            LGCT.template_name,
            LGCT.status,
            LGCT.id
        FROM
            lmk_goods_customize_template LGCT
        WHERE
            LGCT.delete_flag = 0
        <if test="query.templateName != null and query.templateName !=''">
            AND LGCT.template_name LIKE CONCAT('%',#{query.templateName},'%')
        </if>
        <if test="query.status != null and query.status !=''">
            AND LGCT.status = #{query.status}
        </if>
    </select>
    <resultMap id="getCustomizeTemplateMap" type="cn.lili.modules.lmk.domain.vo.CustomizeTemplateVO">
        <id property="id" column="id"/>
        <result property="name" column="template_name"/>
        <collection property="templateImgs" ofType="cn.lili.modules.lmk.domain.entity.TemplateImgs">
            <id property="id" column="imgId"/>
            <result property="imgUrl" column="img_url"/>
        </collection>
        <collection property="templateConstomizeTitles" ofType="cn.lili.modules.lmk.domain.entity.TemplateConstomizeTitle">
            <id property="id" column="titleId"/>
            <result property="contentType" column="content_type"/>
            <result property="templateTitle" column="template_title"/>
        </collection>
    </resultMap>
    <select id="getCustomizeTemplate" resultMap="getCustomizeTemplateMap">
        SELECT
            lgct.id,
            lgct.template_name,
            lti.id imgId,
            lti.img_url,
            ltct.id titleId,
            ltct.template_title,
            ltct.content_type
        FROM
            lmk_goods_customize_template lgct
                JOIN lmk_template_imgs lti ON lti.template_id = lgct.id
                JOIN lmk_template_constomize_title ltct ON ltct.template_id = lgct.id
        WHERE
          lgct.id = #{id}
          AND lgct.delete_flag = 0
          AND lti.delete_flag = 0
          AND ltct.delete_flag = 0
    </select>
 
</mapper>