Parcourir la source

spec and type list

梁彦春 il y a 6 ans
Parent
révision
f777110421

+ 1
- 0
src/main/java/com.huiju.welcome/controller/SysUserController.java Voir le fichier

@@ -329,6 +329,7 @@ public class SysUserController extends BaseController {
329 329
         ResponseBean sysmenu= sysUserService.sysmenuAdd(menuId,menuName,code);
330 330
         return sysmenu;
331 331
     }
332
+
332 333
     @ApiOperation(value = "當前員工離職", notes = "當前員工離職")
333 334
     @RequestMapping(value = "/fireUser", method = RequestMethod.PUT)
334 335
     public ResponseBean fireUser(@RequestParam(value = "userId",required = false) Integer userId) {

+ 22
- 7
src/main/java/com.huiju.welcome/controller/TdGoodsTypeController.java Voir le fichier

@@ -1,20 +1,20 @@
1 1
 package com.huiju.welcome.controller;
2 2
 
3 3
 
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4 6
 import com.huiju.welcome.common.base.BaseController;
5 7
 import com.huiju.welcome.common.base.ResponseBean;
8
+import com.huiju.welcome.model.SysUserRole;
6 9
 import com.huiju.welcome.model.TdGoodsType;
7 10
 import com.huiju.welcome.service.ITdGoodsTypeService;
11
+import io.swagger.annotations.ApiImplicitParam;
12
+import io.swagger.annotations.ApiImplicitParams;
13
+import io.swagger.annotations.ApiOperation;
8 14
 import org.slf4j.Logger;
9 15
 import org.slf4j.LoggerFactory;
10 16
 import org.springframework.beans.factory.annotation.Autowired;
11
-import org.springframework.web.bind.annotation.PathVariable;
12
-import org.springframework.web.bind.annotation.RequestBody;
13
-import org.springframework.web.bind.annotation.RequestMapping;
14
-import org.springframework.web.bind.annotation.RequestMethod;
15
-import org.springframework.web.bind.annotation.ResponseBody;
16
-
17
-import org.springframework.web.bind.annotation.RestController;
17
+import org.springframework.web.bind.annotation.*;
18 18
 
19 19
 
20 20
 /**
@@ -113,4 +113,19 @@ public class TdGoodsTypeController extends BaseController {
113 113
         }
114 114
         return responseBean;
115 115
     }
116
+
117
+    @ApiOperation(value = "商品类型列表", notes = "商品类型列表")
118
+    @ApiImplicitParams({
119
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "typeName", value = "商品类型名称")
120
+    })
121
+    @RequestMapping(value = "/typeList", method = RequestMethod.GET)
122
+    public ResponseBean typeList(@RequestParam(defaultValue = "1") int pageNum,
123
+                                       @RequestParam(defaultValue = "10") int pageSize,
124
+                                       @RequestParam(value = "typeName",required = false) String typeName) {
125
+        IPage<TdGoodsType> pg = new Page<>(pageNum, pageSize);
126
+
127
+        ResponseBean userManagement= iTdGoodsTypeService.typeList(pg,typeName);
128
+
129
+        return userManagement;
130
+    }
116 131
 }

+ 21
- 6
src/main/java/com.huiju.welcome/controller/TdSpecController.java Voir le fichier

@@ -1,18 +1,18 @@
1 1
 package com.huiju.welcome.controller;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
3 5
 import com.huiju.welcome.common.base.BaseController;
4 6
 import com.huiju.welcome.common.base.ResponseBean;
5 7
 import com.huiju.welcome.model.TdSpec;
6 8
 import com.huiju.welcome.service.ITdSpecService;
9
+import io.swagger.annotations.ApiImplicitParam;
10
+import io.swagger.annotations.ApiImplicitParams;
11
+import io.swagger.annotations.ApiOperation;
7 12
 import org.slf4j.Logger;
8 13
 import org.slf4j.LoggerFactory;
9 14
 import org.springframework.beans.factory.annotation.Autowired;
10
-import org.springframework.web.bind.annotation.PathVariable;
11
-import org.springframework.web.bind.annotation.RequestBody;
12
-import org.springframework.web.bind.annotation.RequestMapping;
13
-import org.springframework.web.bind.annotation.RequestMethod;
14
-import org.springframework.web.bind.annotation.ResponseBody;
15
-import org.springframework.web.bind.annotation.RestController;
15
+import org.springframework.web.bind.annotation.*;
16 16
 
17 17
 
18 18
 /**
@@ -111,4 +111,19 @@ public class TdSpecController extends BaseController {
111 111
         }
112 112
         return responseBean;
113 113
     }
114
+
115
+    @ApiOperation(value = "商品规格列表", notes = "商品规格列表")
116
+    @ApiImplicitParams({
117
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "specName", value = "商品规格名称")
118
+    })
119
+    @RequestMapping(value = "/specList", method = RequestMethod.GET)
120
+    public ResponseBean specList(@RequestParam(defaultValue = "1") int pageNum,
121
+                                 @RequestParam(defaultValue = "10") int pageSize,
122
+                                 @RequestParam(value = "specName",required = false) String specName) {
123
+        IPage<TdSpec> pg = new Page<>(pageNum, pageSize);
124
+
125
+        ResponseBean userManagement= iTdSpecService.specList(pg,specName);
126
+
127
+        return userManagement;
128
+    }
114 129
 }

+ 9
- 0
src/main/java/com.huiju.welcome/mapper/TdGoodsTypeMapper.java Voir le fichier

@@ -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.TdGoodsType;
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,11 @@ import org.apache.ibatis.annotations.Mapper;
16 18
 @Mapper
17 19
 public interface TdGoodsTypeMapper extends BaseMapper<TdGoodsType> {
18 20
 
21
+    /**
22
+     *
23
+     * @param pg
24
+     * @param typeName
25
+     * @return
26
+     */
27
+    IPage<TdGoodsType> typeList(IPage<TdGoodsType> pg, @Param("typeName") String typeName);
19 28
 }

+ 9
- 0
src/main/java/com.huiju.welcome/mapper/TdSpecMapper.java Voir le fichier

@@ -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.TdSpec;
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,11 @@ import org.apache.ibatis.annotations.Mapper;
16 18
 @Mapper
17 19
 public interface TdSpecMapper extends BaseMapper<TdSpec> {
18 20
 
21
+    /**
22
+     *
23
+     * @param pg
24
+     * @param specName
25
+     * @return
26
+     */
27
+    IPage<TdSpec> specList(IPage<TdSpec> pg, @Param("specName") String specName);
19 28
 }

+ 10
- 0
src/main/java/com.huiju.welcome/service/ITdGoodsTypeService.java Voir le fichier

@@ -1,7 +1,9 @@
1 1
 package com.huiju.welcome.service;
2 2
 
3 3
 
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.baomidou.mybatisplus.extension.service.IService;
6
+import com.huiju.welcome.common.base.ResponseBean;
5 7
 import com.huiju.welcome.model.TdGoodsType;
6 8
 
7 9
 /**
@@ -14,4 +16,12 @@ import com.huiju.welcome.model.TdGoodsType;
14 16
  */
15 17
 public interface ITdGoodsTypeService extends IService<TdGoodsType> {
16 18
 
19
+    /**
20
+     * 商品类型列表
21
+     * @param pg
22
+     * @param typeName
23
+     * @return
24
+     */
25
+    ResponseBean typeList(IPage<TdGoodsType> pg, String typeName);
26
+
17 27
 }

+ 9
- 0
src/main/java/com.huiju.welcome/service/ITdSpecService.java Voir le fichier

@@ -1,7 +1,9 @@
1 1
 package com.huiju.welcome.service;
2 2
 
3 3
 
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.baomidou.mybatisplus.extension.service.IService;
6
+import com.huiju.welcome.common.base.ResponseBean;
5 7
 import com.huiju.welcome.model.TdSpec;
6 8
 
7 9
 /**
@@ -14,4 +16,11 @@ import com.huiju.welcome.model.TdSpec;
14 16
  */
15 17
 public interface ITdSpecService extends IService<TdSpec> {
16 18
 
19
+    /**
20
+     * 商品类型列表
21
+     * @param pg
22
+     * @param specName
23
+     * @return
24
+     */
25
+    ResponseBean specList(IPage<TdSpec> pg, String specName);
17 26
 }

+ 12
- 0
src/main/java/com.huiju.welcome/service/impl/TdGoodsTypeServiceImpl.java Voir le fichier

@@ -1,10 +1,13 @@
1 1
 package com.huiju.welcome.service.impl;
2 2
 
3 3
 
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6
+import com.huiju.welcome.common.base.ResponseBean;
5 7
 import com.huiju.welcome.mapper.TdGoodsTypeMapper;
6 8
 import com.huiju.welcome.model.TdGoodsType;
7 9
 import com.huiju.welcome.service.ITdGoodsTypeService;
10
+import org.springframework.beans.factory.annotation.Autowired;
8 11
 import org.springframework.stereotype.Service;
9 12
 
10 13
 /**
@@ -17,5 +20,14 @@ import org.springframework.stereotype.Service;
17 20
  */
18 21
 @Service
19 22
 public class TdGoodsTypeServiceImpl extends ServiceImpl<TdGoodsTypeMapper, TdGoodsType> implements ITdGoodsTypeService {
23
+    @Autowired
24
+    private TdGoodsTypeMapper tdGoodsTypeMapper;
25
+    @Override
26
+    public ResponseBean typeList(IPage<TdGoodsType> pg,String typeName) {
27
+        ResponseBean responseBean= new ResponseBean();
28
+        IPage<TdGoodsType> list= tdGoodsTypeMapper.typeList(pg,typeName);
29
+        responseBean.addSuccess(list);
30
+        return responseBean;
31
+    }
20 32
 
21 33
 }

+ 13
- 0
src/main/java/com.huiju.welcome/service/impl/TdSpecServiceImpl.java Voir le fichier

@@ -1,10 +1,13 @@
1 1
 package com.huiju.welcome.service.impl;
2 2
 
3 3
 
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6
+import com.huiju.welcome.common.base.ResponseBean;
5 7
 import com.huiju.welcome.mapper.TdSpecMapper;
6 8
 import com.huiju.welcome.model.TdSpec;
7 9
 import com.huiju.welcome.service.ITdSpecService;
10
+import org.springframework.beans.factory.annotation.Autowired;
8 11
 import org.springframework.stereotype.Service;
9 12
 
10 13
 /**
@@ -18,4 +21,14 @@ import org.springframework.stereotype.Service;
18 21
 @Service
19 22
 public class TdSpecServiceImpl extends ServiceImpl<TdSpecMapper, TdSpec> implements ITdSpecService {
20 23
 
24
+    @Autowired
25
+    private TdSpecMapper tdSpecMapper;
26
+
27
+    @Override
28
+    public ResponseBean specList(IPage<TdSpec> pg, String specName) {
29
+        ResponseBean responseBean= new ResponseBean();
30
+        IPage<TdSpec> list= tdSpecMapper.specList(pg,specName);
31
+        responseBean.addSuccess(list);
32
+        return responseBean;
33
+    }
21 34
 }

+ 15
- 0
src/main/resources/mapper/TdGoodsTypeMapper.xml Voir le fichier

@@ -0,0 +1,15 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.huiju.welcome.mapper.TdGoodsTypeMapper">
4
+    <select id="typeList" resultType="com.huiju.welcome.model.TdGoodsType">
5
+        select
6
+        *
7
+        from td_goods_type
8
+        <where>
9
+            <if test="typeName !=null and typeName !=''">
10
+                typeName LIKE CONCAT('%',#{typeName},'%')
11
+            </if>
12
+        </where>
13
+    </select>
14
+
15
+</mapper>

+ 15
- 0
src/main/resources/mapper/TdSpecMapper.xml Voir le fichier

@@ -0,0 +1,15 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.huiju.welcome.mapper.TdSpecMapper">
4
+    <select id="specList" resultType="com.huiju.welcome.model.TdSpec">
5
+        select
6
+        *
7
+        from td_spec
8
+        <where>
9
+            <if test="specName !=null and typeName !=''">
10
+                specName LIKE CONCAT('%',#{specName},'%')
11
+            </if>
12
+        </where>
13
+    </select>
14
+
15
+</mapper>