瀏覽代碼

spec and type list

梁彦春 6 年之前
父節點
當前提交
181c300296

+ 10
- 0
src/main/java/com.huiju.welcome/mapper/TaGoodsMapper.java 查看文件

@@ -2,8 +2,10 @@ package com.huiju.welcome.mapper;
2 2
 
3 3
 
4 4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import com.baomidou.mybatisplus.core.metadata.IPage;
5 6
 import com.huiju.welcome.model.TaGoods;
6 7
 import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
7 9
 
8 10
 /**
9 11
  * <p>
@@ -16,4 +18,12 @@ import org.apache.ibatis.annotations.Mapper;
16 18
 @Mapper
17 19
 public interface TaGoodsMapper extends BaseMapper<TaGoods> {
18 20
 
21
+    /**
22
+     *
23
+     * @param pg
24
+     * @param goodsName
25
+     * @param typeId
26
+     * @return
27
+     */
28
+    IPage<TaGoods> goodsList(IPage<TaGoods> pg, @Param("goodsName") String goodsName, @Param("typeId") Integer typeId);
19 29
 }

+ 4
- 0
src/main/java/com.huiju.welcome/model/TaGoods.java 查看文件

@@ -5,6 +5,7 @@ import java.time.LocalDateTime;
5 5
 import java.io.Serializable;
6 6
 
7 7
 import com.baomidou.mybatisplus.annotation.IdType;
8
+import com.baomidou.mybatisplus.annotation.TableField;
8 9
 import com.baomidou.mybatisplus.annotation.TableId;
9 10
 import lombok.Data;
10 11
 import lombok.EqualsAndHashCode;
@@ -44,5 +45,8 @@ public class TaGoods implements Serializable {
44 45
 
45 46
     private String createUser;
46 47
 
48
+    @TableField(exist = false)
49
+    private String imgUrl;
50
+
47 51
 
48 52
 }

+ 6
- 4
src/main/resources/mapper/TaGoodsMapper.xml 查看文件

@@ -3,14 +3,16 @@
3 3
 <mapper namespace="com.huiju.welcome.mapper.TaGoodsMapper">
4 4
     <select id="goodsList" resultType="com.huiju.welcome.model.TaGoods">
5 5
         select
6
-        *
7
-        from ta_goods
6
+        a.*
7
+        i.img_url as imgUrl
8
+        from ta_goods g
9
+        left join ta_goods_img i on g.goods_id = i.goods_id
8 10
         <where>
9 11
             <if test="goodsName !=null and goodsName !=''">
10
-                goodsName LIKE CONCAT('%',#{goodsName},'%')
12
+                g.goods_name LIKE CONCAT('%',#{goodsName},'%')
11 13
             </if>
12 14
             <if test="typeId !=null and typeId !=''">
13
-                typeId = CONCAT('%',#{typeId},'%')
15
+                g.type_id = CONCAT('%',#{typeId},'%')
14 16
             </if>
15 17
         </where>
16 18
     </select>

+ 1
- 1
src/main/resources/mapper/TdGoodsTypeMapper.xml 查看文件

@@ -7,7 +7,7 @@
7 7
         from td_goods_type
8 8
         <where>
9 9
             <if test="typeName !=null and typeName !=''">
10
-                typeName LIKE CONCAT('%',#{typeName},'%')
10
+                type_name LIKE CONCAT('%',#{typeName},'%')
11 11
             </if>
12 12
         </where>
13 13
     </select>

+ 1
- 1
src/main/resources/mapper/TdSpecMapper.xml 查看文件

@@ -7,7 +7,7 @@
7 7
         from td_spec
8 8
         <where>
9 9
             <if test="specName !=null and specName !=''">
10
-                specName LIKE CONCAT('%',#{specName},'%')
10
+                spec_name LIKE CONCAT('%',#{specName},'%')
11 11
             </if>
12 12
         </where>
13 13
     </select>