Browse Source

spec and type list

梁彦春 6 years ago
parent
commit
181c300296

+ 10
- 0
src/main/java/com.huiju.welcome/mapper/TaGoodsMapper.java View File

2
 
2
 
3
 
3
 
4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.huiju.welcome.model.TaGoods;
6
 import com.huiju.welcome.model.TaGoods;
6
 import org.apache.ibatis.annotations.Mapper;
7
 import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
7
 
9
 
8
 /**
10
 /**
9
  * <p>
11
  * <p>
16
 @Mapper
18
 @Mapper
17
 public interface TaGoodsMapper extends BaseMapper<TaGoods> {
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 View File

5
 import java.io.Serializable;
5
 import java.io.Serializable;
6
 
6
 
7
 import com.baomidou.mybatisplus.annotation.IdType;
7
 import com.baomidou.mybatisplus.annotation.IdType;
8
+import com.baomidou.mybatisplus.annotation.TableField;
8
 import com.baomidou.mybatisplus.annotation.TableId;
9
 import com.baomidou.mybatisplus.annotation.TableId;
9
 import lombok.Data;
10
 import lombok.Data;
10
 import lombok.EqualsAndHashCode;
11
 import lombok.EqualsAndHashCode;
44
 
45
 
45
     private String createUser;
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 View File

3
 <mapper namespace="com.huiju.welcome.mapper.TaGoodsMapper">
3
 <mapper namespace="com.huiju.welcome.mapper.TaGoodsMapper">
4
     <select id="goodsList" resultType="com.huiju.welcome.model.TaGoods">
4
     <select id="goodsList" resultType="com.huiju.welcome.model.TaGoods">
5
         select
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
         <where>
10
         <where>
9
             <if test="goodsName !=null and goodsName !=''">
11
             <if test="goodsName !=null and goodsName !=''">
10
-                goodsName LIKE CONCAT('%',#{goodsName},'%')
12
+                g.goods_name LIKE CONCAT('%',#{goodsName},'%')
11
             </if>
13
             </if>
12
             <if test="typeId !=null and typeId !=''">
14
             <if test="typeId !=null and typeId !=''">
13
-                typeId = CONCAT('%',#{typeId},'%')
15
+                g.type_id = CONCAT('%',#{typeId},'%')
14
             </if>
16
             </if>
15
         </where>
17
         </where>
16
     </select>
18
     </select>

+ 1
- 1
src/main/resources/mapper/TdGoodsTypeMapper.xml View File

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

+ 1
- 1
src/main/resources/mapper/TdSpecMapper.xml View File

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