新增接口 分类列表(包括子分类)
This commit is contained in:
parent
08625bd03e
commit
762a902950
|
|
@ -65,6 +65,16 @@ public class ProductController {
|
|||
return productService.queryCategory(shopId,page,pageSize);
|
||||
}
|
||||
|
||||
@GetMapping(value = "queryAllCategory")
|
||||
public Result queryAllCategory(
|
||||
@RequestParam("shopId") String shopId,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1")int page,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10")int pageSize
|
||||
){
|
||||
|
||||
return productService.queryAllCategory(shopId,page,pageSize);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("queryProductSku")
|
||||
public Result queryProductSku(@RequestHeader("token") String token,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopCategory;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ShopCategoryVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
|
@ -22,4 +23,5 @@ public interface TbShopCategoryMapper {
|
|||
int updateByPrimaryKey(TbShopCategory record);
|
||||
|
||||
List<TbShopCategory> selectByAll(String shopId);
|
||||
List<ShopCategoryVo> queryAllCategory(String shopId);
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ShopCategoryVo {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
private List<ShopCategoryVo> childs;
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.chaozhanggui.system.cashierservice.service;
|
|||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ShopCategoryVo;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||
|
|
@ -44,6 +45,13 @@ public class ProductService {
|
|||
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
||||
}
|
||||
|
||||
public Result queryAllCategory(String shopId,Integer page,Integer pageSize){
|
||||
PageHelper.startPage(page, pageSize);
|
||||
List<ShopCategoryVo> list=tbShopCategoryMapper.queryAllCategory(shopId);
|
||||
PageInfo pageInfo=new PageInfo(list);
|
||||
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
||||
}
|
||||
|
||||
|
||||
public Result queryCommodityInfo(String shopId, String categoryId, String commdityName, Integer page, Integer pageSize, String masterId){
|
||||
List<TbProductWithBLOBs> tbProductWithBLOBs=null;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,18 @@
|
|||
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
|
||||
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 定义结果映射 -->
|
||||
<resultMap id="queryAllResultMap" type="com.chaozhanggui.system.cashierservice.entity.vo.ShopCategoryVo">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<collection property="childs" ofType="com.chaozhanggui.system.cashierservice.entity.vo.ShopCategoryVo">
|
||||
<id property="id" column="childId"/>
|
||||
<result property="name" column="childName"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, name, short_name, tree, pid, pic, merchant_id, shop_id, style, is_show, detail,
|
||||
sort, key_word, created_at, updated_at
|
||||
|
|
@ -220,4 +232,15 @@
|
|||
ORDER BY
|
||||
`sort` asc
|
||||
</select>
|
||||
<select id="queryAllCategory" resultMap="queryAllResultMap">
|
||||
SELECT a.id AS id, a.name AS name, b.id AS childId, b.name AS childName
|
||||
FROM tb_shop_category a
|
||||
LEFT JOIN tb_shop_category b ON a.id = b.pid
|
||||
WHERE a.shop_id = #{shopId}
|
||||
AND a.is_show = 1
|
||||
AND a.tree IS NULL
|
||||
ORDER BY a.sort ASC
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue