增加了app 版本更新接口, 店铺分类接口

This commit is contained in:
Jack 2025-03-18 10:20:24 +08:00
parent 3eb03e3485
commit f7241da8ed
8 changed files with 376 additions and 0 deletions

View File

@ -0,0 +1,71 @@
package com.suisung.mall.common.modules.store;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* <p>
* 店铺营业分类表用于存储超市商品的分类信息支持二级分类会影响分成比例
* </p>
*
* @author Xinze
* @since 2021-07-02
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("shop_store_biz_category")
@ApiModel(value = "ShopStoreBizCategory对象", description = "店铺营业分类表")
public class ShopStoreBizCategory implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "自增ID")
@TableId(value = "id", type = IdType.INPUT)
private Long id;
@ApiModelProperty(value = "分类编号")
private String category_code;
@ApiModelProperty(value = "分类名称,记录分类的名称")
private String category_name;
@ApiModelProperty(value = "父分类编号用于关联上级分类0表示顶级分类")
private String parent_category_code;
@ApiModelProperty(value = "分类描述,对分类的详细说明")
private String description;
@ApiModelProperty(value = "分成比例范围是1.00-100.00")
private BigDecimal split_ratio;
@ApiModelProperty(value = "排序,用于确定分类的显示顺序")
private Integer seq;
@ApiModelProperty(value = "状态,如 1-有效2-无效;")
private Integer status;
@ApiModelProperty(value = "创建用户")
private String created_by;
@ApiModelProperty(value = "最后修改用户")
private String updated_by;
@ApiModelProperty(value = "创建时间")
private Date created_at;
@ApiModelProperty(value = "更新时间")
private Date updated_at;
}

View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
* Vestibulum commodo. Ut rhoncus gravida arcu.
*/
package com.suisung.mall.common.modules.store.dto;
import com.suisung.mall.common.modules.store.ShopStoreBizCategory;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "ShopStoreBizCategoryDTO对象", description = "店铺营业分类表")
public class ShopStoreBizCategoryDTO extends ShopStoreBizCategory implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "子类集合")
private List<ShopStoreBizCategory> children;
}

View File

@ -0,0 +1,54 @@
/*
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
* Vestibulum commodo. Ut rhoncus gravida arcu.
*/
package com.suisung.mall.shop.store.controller.admin;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.suisung.mall.common.api.CommonResult;
import com.suisung.mall.common.service.impl.BaseControllerImpl;
import com.suisung.mall.shop.store.service.ShopStoreBizCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@Api(tags = "店铺分类(类目),此类决定商家分成比例")
@RestController
@RequestMapping("/admin/shop/store/biz-category")
public class ShopStoreBizCategoryController extends BaseControllerImpl {
@Resource
private ShopStoreBizCategoryService shopStoreBizCategoryService;
@ApiOperation(value = "搜索店铺分类(类目)", notes = "搜索店铺分类(类目)")
@RequestMapping(value = "/search", method = RequestMethod.POST)
public CommonResult shopStoreBizCategorySearchList(@RequestBody(required = false) JSONObject params) {
String keyword = "";
if (params != null && StrUtil.isNotBlank(params.getStr("keyword"))) {
keyword = params.getStr("keyword");
}
return CommonResult.success(shopStoreBizCategoryService.selectParentListWithChildren(keyword));
}
@ApiOperation(value = "新增店铺分类(类目)", notes = "新增店铺分类(类目)")
@RequestMapping(value = "/add/new", method = RequestMethod.POST)
public CommonResult shopStoreBusinessCategoryList(@RequestBody(required = false) JSONObject params) {
String keyword = "";
if (params != null && StrUtil.isNotBlank(params.getStr("keyword"))) {
keyword = params.getStr("keyword");
}
return CommonResult.success(shopStoreBizCategoryService.selectParentListWithChildren(keyword));
}
}

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
* Vestibulum commodo. Ut rhoncus gravida arcu.
*/
package com.suisung.mall.shop.store.controller.mobile;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.suisung.mall.common.api.CommonResult;
import com.suisung.mall.common.service.impl.BaseControllerImpl;
import com.suisung.mall.shop.store.service.ShopStoreBizCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@Api(tags = "店铺分类(类目),此类决定商家分成比例")
@RestController
@RequestMapping("/mobile/shop/store/biz-category")
public class ShopStoreBizCategoryController extends BaseControllerImpl {
@Resource
private ShopStoreBizCategoryService shopStoreBizCategoryService;
@ApiOperation(value = "店铺分类(类目)", notes = "店铺分类(类目)")
@RequestMapping(value = "/list", method = RequestMethod.POST)
public CommonResult shopStoreBusinessCategoryList(@RequestBody(required = false) JSONObject params) {
String keyword = "";
if (params != null && StrUtil.isNotBlank(params.getStr("keyword"))) {
keyword = params.getStr("keyword");
}
return CommonResult.success(shopStoreBizCategoryService.selectParentListWithChildren(keyword));
}
}

View File

@ -0,0 +1,29 @@
package com.suisung.mall.shop.store.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.suisung.mall.common.modules.store.ShopStoreBizCategory;
import com.suisung.mall.common.modules.store.dto.ShopStoreBizCategoryDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 店铺营业分类表用于存储超市商品的分类信息支持二级分类 Mapper 接口
* </p>
*
* @author panjunjie
* @since 2025-03-17
*/
@Repository
public interface ShopStoreBizCategoryMapper extends BaseMapper<ShopStoreBizCategory> {
/**
* 根据关键字查询店铺一级营业分类信息
*
* @param keyword
* @return
*/
List<ShopStoreBizCategoryDTO> selectParentListWithChildren(@Param("keyword") String keyword);
}

View File

@ -0,0 +1,27 @@
package com.suisung.mall.shop.store.service;
import com.suisung.mall.common.modules.store.ShopStoreBizCategory;
import com.suisung.mall.common.modules.store.dto.ShopStoreBizCategoryDTO;
import com.suisung.mall.core.web.service.IBaseService;
import java.util.List;
/**
* <p>
* 店铺营业分类表用于存储超市商品的分类信息支持二级分类会影响分成比例 服务类
* </p>
*
* @author panjunjie
* @since 2025-03-17
*/
public interface ShopStoreBizCategoryService extends IBaseService<ShopStoreBizCategory> {
/**
* 根据关键字查询店铺一级营业分类信息
*
* @param keyword
* @return
*/
List<ShopStoreBizCategoryDTO> selectParentListWithChildren(String keyword);
}

View File

@ -0,0 +1,38 @@
package com.suisung.mall.shop.store.service.impl;
import com.suisung.mall.common.modules.store.ShopStoreBizCategory;
import com.suisung.mall.common.modules.store.dto.ShopStoreBizCategoryDTO;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import com.suisung.mall.shop.store.mapper.ShopStoreBizCategoryMapper;
import com.suisung.mall.shop.store.service.ShopStoreBizCategoryService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>
* 店铺营业分类表用于存储超市商品的分类信息支持二级分类会影响分成比例 服务实现类
* </p>
*
* @author panjunjie
* @since 2025-03-17
*/
@Service
public class ShopStoreBizCategoryServiceImpl extends BaseServiceImpl<ShopStoreBizCategoryMapper, ShopStoreBizCategory> implements ShopStoreBizCategoryService {
@Resource
private ShopStoreBizCategoryMapper shopStoreBizCategoryMapper;
/**
* 根据关键字查询店铺一级营业分类信息
*
* @param keyword
* @return
*/
@Override
public List<ShopStoreBizCategoryDTO> selectParentListWithChildren(String keyword) {
return shopStoreBizCategoryMapper.selectParentListWithChildren(keyword);
}
}

View File

@ -0,0 +1,79 @@
<?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.suisung.mall.shop.store.mapper.ShopStoreBizCategoryMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Parent_Column_List">
id
, category_code, category_name, parent_category_code, description,split_ratio,seq,status,created_by,updated_by,created_at,updated_at
</sql>
<resultMap id="CategoryResultMap" type="com.suisung.mall.common.modules.store.dto.ShopStoreBizCategoryDTO">
<id property="id" column="id"/>
<result property="category_code" column="category_code"/>
<result property="category_name" column="category_name"/>
<result property="description" column="description"/>
<result property="split_ratio" column="split_ratio"/>
<result property="seq" column="seq"/>
<result property="status" column="status"/>
<result property="created_by" column="created_by"/>
<result property="updated_by" column="updated_by"/>
<result property="created_at" column="created_at"/>
<result property="updated_at" column="updated_at"/>
<result property="parent_category_code" column="parent_category_code"/>
<collection property="children" ofType="com.suisung.mall.common.modules.store.ShopStoreBizCategory">
<id property="id" column="child_id"/>
<result property="category_code" column="child_category_code"/>
<result property="category_name" column="child_category_name"/>
<result property="parent_category_code" column="child_parent_category_code"/>
<result property="description" column="child_description"/>
<result property="split_ratio" column="child_split_ratio"/>
<result property="seq" column="child_seq"/>
<result property="status" column="child_status"/>
<result property="created_by" column="child_created_by"/>
<result property="updated_by" column="child_updated_by"/>
<result property="created_at" column="child_created_at"/>
<result property="updated_at" column="child_updated_at"/>
</collection>
</resultMap>
<select id="selectParentListWithChildren" resultMap="CategoryResultMap">
SELECT p.id,
p.category_code,
p.category_name,
p.parent_category_code,
p.description,
p.split_ratio,
p.seq,
p.status,
p.created_by,
p.updated_by,
p.created_at,
p.updated_at,
c.id AS child_id,
c.category_code AS child_category_code,
c.category_name AS child_category_name,
c.parent_category_code AS child_parent_category_code,
c.description AS child_description,
c.split_ratio AS child_split_ratio,
c.seq AS child_seq,
c.status AS child_status,
c.created_by AS child_created_by,
c.updated_by AS child_updated_by,
c.created_at AS child_created_at,
c.updated_at AS child_updated_at
FROM shop_store_biz_category p
LEFT JOIN
shop_store_biz_category c ON p.category_code = c.parent_category_code
WHERE p.parent_category_code = 0
<if test="keyword != null and keyword != ''">
AND (p.category_code LIKE CONCAT('%', #{keyword}, '%')
OR p.category_name LIKE CONCAT('%', #{keyword}, '%')
OR p.description LIKE CONCAT('%', #{keyword}, '%')
OR c.category_code LIKE CONCAT('%', #{keyword}, '%')
OR c.category_name LIKE CONCAT('%', #{keyword}, '%')
OR c.description LIKE CONCAT('%', #{keyword}, '%'))
</if>
ORDER BY p.seq asc, c.seq asc
</select>
</mapper>