无关风月
2024-12-31 bf765893039bc7968b8160a70bda778526dca98c
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
74
75
76
77
78
<?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.jilongda.manage.mapper.TGoodsMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.jilongda.common.model.TGoods">
        <id column="id" property="id" />
        <result column="goodsName" property="goodsName" />
        <result column="goodsPicture" property="goodsPicture" />
        <result column="goodsNo" property="goodsNo" />
        <result column="goodsBrand" property="goodsBrand" />
        <result column="goodsNature" property="goodsNature" />
        <result column="goodsType" property="goodsType" />
        <result column="goodsRemark" property="goodsRemark" />
        <result column="createTime" property="createTime" />
        <result column="updateTime" property="updateTime" />
        <result column="createBy" property="createBy" />
        <result column="updateBy" property="updateBy" />
        <result column="isDelete" property="isDelete" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, goodsName, goodsPicture, goodsNo, goodsBrand, goodsNature, goodsType, goodsRemark, createTime, updateTime, createBy, updateBy, isDelete
    </sql>
    <select id="pageList" resultType="com.jilongda.manage.vo.TGoodsVO">
        select
        <include refid="Base_Column_List"/>
        from t_goods
        <where>
            <if test="query.goodsName != null and query.goodsName != ''">
                and goodsName like concat('%',#{query.goodsName},'%')
            </if>
            <if test="query.goodsBrand != null and query.goodsBrand != ''">
                and goodsBrand like concat('%',#{query.goodsBrand},'%')
            </if>
            <if test="query.goodsType != null and query.goodsType != ''">
                and goodsType like concat('%',#{query.goodsType},'%')
            </if>
            AND isDelete = ${@com.jilongda.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY createTime,id DESC
    </select>
    <select id="pageListExport" resultType="com.jilongda.manage.excel.TGoodsExportExcels">
        select
        tg.id, tg.goodsName, tg.goodsPicture, tg.goodsNo, tg.goodsBrand, tg.goodsNature, tg.goodsType, tg.goodsRemark, tg.createTime, tg.updateTime, tg.createBy, tg.updateBy, tg.isDelete,
        tgs.goodsContent, tgs.salesDirector, tgs.accountManager, tgs.goodsDosage, tgs.goodsSpecifications, tgs.warehouse, tgs.generalManagerPrice,
        (SELECT
        IFNULL( GROUP_CONCAT( phone ), '' ) userPhones
        FROM
        sec_user
        WHERE
        FIND_IN_SET(
        id,(tgs.userIds))
        ) AS userPhones,
        tgs.id as goodsSpecificationsId
        from t_goods tg
        left join t_goods_specifications tgs on tg.id = tgs.goodsId
        <where>
            <if test="query.goodsName != null and query.goodsName != ''">
                and tg.goodsName like concat('%',#{query.goodsName},'%')
            </if>
            <if test="query.goodsBrand != null and query.goodsBrand != ''">
                and tg.goodsBrand like concat('%',#{query.goodsBrand},'%')
            </if>
            <if test="query.goodsType != null and query.goodsType != ''">
                and tg.goodsType like concat('%',#{query.goodsType},'%')
            </if>
            AND tg.isDelete = ${@com.jilongda.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY tg.createTime DESC
    </select>
    <select id="queryList" resultType="com.jilongda.common.model.TGoods">
        select <include refid="Base_Column_List"></include>
        from t_goods
    </select>
 
</mapper>