xin
2025-05-30 b394df082b875856884d6d02cce2a43c49ad6704
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
<?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.oying.modules.pc.product.mapper.ProductMapper">
    <resultMap id="BaseResultMap" type="com.oying.modules.pc.product.domain.Product">
        <id column="product_id" property="productId"/>
        <result column="store_id" property="storeId"/>
        <result column="code" property="code"/>
        <result column="barcode" property="barcode"/>
        <result column="name" property="name"/>
        <result column="title" property="title"/>
        <result column="category_id" property="categoryId"/>
        <result column="second_category_id" property="secondCategoryId"/>
        <result column="status" property="status"/>
        <result column="main_image" property="mainImage"/>
        <result column="detail_image" property="detailImage"/>
        <result column="description" property="description"/>
        <result column="price" property="price"/>
        <result column="stock_quantity" property="stockQuantity"/>
        <result column="min_purchase_quantity" property="minPurchaseQuantity"/>
        <result column="warn_stock" property="warnStock"/>
        <result column="weight" property="weight"/>
        <result column="width" property="width"/>
        <result column="length" property="length"/>
        <result column="height" property="height"/>
        <result column="deleted_flag" property="deletedFlag"/>
        <result column="version" property="version"/>
    </resultMap>
 
    <sql id="Base_Column_List">
        product_id, store_id, code, barcode, name, title, category_id, second_category_id, status, main_image, detail_image, description, price, stock_quantity, min_purchase_quantity, warn_stock, weight, width, length, height, deleted_flag, create_by, create_time, update_by, update_time, version
    </sql>
 
    <select id="findAll" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from pc_product
        <where>
            <if test="criteria.storeId != null">
                and store_id = #{criteria.storeId}
            </if>
            <if test="criteria.categoryId != null">
                and category_id = #{criteria.categoryId}
            </if>
            <if test="criteria.secondCategoryId != null">
                and second_category_id = #{criteria.secondCategoryId}
            </if>
            <if test="criteria.blurry != null and criteria.blurry != ''">
                and (name like concat('%',#{criteria.blurry},'%') or title like concat('%',#{criteria.blurry},'%'))
            </if>
            <if test="criteria.status != null">
                and status = #{criteria.status}
            </if>
            <if test="criteria.active != null">
                and active = #{criteria.active}
            </if>
        </where>
        order by product_id desc
    </select>
 
</mapper>