商品管理查询分页
This commit is contained in:
parent
4ed2a8c62e
commit
71508d5050
|
@ -1,8 +0,0 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="db_spzx@60.204.230.80" uuid="40831a68-66d1-4772-9353-7a8f6b941ef5">
|
||||
<data-source source="LOCAL" name="db_spzx@60.204.230.80" uuid="3eae447a-3ae1-4be3-aa70-1183cffb0765">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
|
|
|
@ -3,23 +3,11 @@
|
|||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/spzx-common/common-service/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-common/common-util/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-common/common-util/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-common/common-util/src/main/resources-filtered" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-common/spzx-service/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-common/spzx-service/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-common/spzx-service/src/main/resources-filtered" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-common/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-common/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-common/src/main/resources-filtered" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-manager/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-manager/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-manager/src/main/resources-filtered" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-model/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-model/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-model/src/main/resources-filtered" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources-filtered" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/test/src/main/java" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,12 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,com.github.pagehelper.page.PageMethod,startPage" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="RawUseOfParameterizedType" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SqlWithoutWhereInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ThrowablePrintStackTrace" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UNCHECKED_WARNING" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
</profile>
|
||||
</component>
|
|
@ -5,17 +5,8 @@
|
|||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/test/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="ignoredFiles">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$/spzx-common/spzx-service/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/test/pom.xml" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="corretto-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="corretto-17" project-jdk-type="JavaSDK" />
|
||||
</project>
|
|
@ -1,124 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
|
@ -12,8 +12,8 @@
|
|||
<artifactId>common-util</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<scope>provided </scope>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -2,6 +2,7 @@ package cn.bunny.controller;
|
|||
|
||||
|
||||
import cn.bunny.common.spzx.model.dto.product.CategoryBrandDto;
|
||||
import cn.bunny.common.spzx.model.entity.product.Brand;
|
||||
import cn.bunny.common.spzx.model.entity.product.CategoryBrand;
|
||||
import cn.bunny.common.spzx.model.vo.common.Result;
|
||||
import cn.bunny.common.spzx.model.vo.common.ResultCodeEnum;
|
||||
|
@ -12,6 +13,8 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "分类品牌列表接口")
|
||||
@RestController
|
||||
@RequestMapping("/admin/product/categoryBrand")
|
||||
|
@ -19,6 +22,13 @@ public class CategoryBrandController {
|
|||
@Autowired
|
||||
private CategoryBrandService categoryBrandService;
|
||||
|
||||
@Operation(summary = "根据id查询对应商品数据",description = "根据id查询对应商品数据")
|
||||
@GetMapping("/findBrandByCategoryId/{categoryId}")
|
||||
public Result findBrandByCategoryId(@PathVariable Long categoryId) {
|
||||
List<Brand> brandList = categoryBrandService.findBrandByCategoryId(categoryId);
|
||||
return Result.build(brandList, ResultCodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "删除分类品牌", description = "删除分类品牌")
|
||||
@DeleteMapping("/deleteById/{id}")
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package cn.bunny.controller;
|
||||
|
||||
import cn.bunny.common.spzx.model.dto.product.ProductDto;
|
||||
import cn.bunny.common.spzx.model.entity.product.Product;
|
||||
import cn.bunny.common.spzx.model.vo.common.Result;
|
||||
import cn.bunny.common.spzx.model.vo.common.ResultCodeEnum;
|
||||
import cn.bunny.service.ProductService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "商品管理接口")
|
||||
@RestController
|
||||
@RequestMapping("/admin/product/product")
|
||||
public class ProductController {
|
||||
@Autowired
|
||||
private ProductService productService;
|
||||
|
||||
@Operation(summary = "商品管理查询分页", description = "商品管理查询分页")
|
||||
@GetMapping("/{page}/{limit}")
|
||||
public Result findByPage(@PathVariable("page") Integer page,
|
||||
@PathVariable("limit") Integer limit,
|
||||
ProductDto productDto) {
|
||||
PageInfo<Product> productList = productService.findByPage(page, limit, productDto);
|
||||
return Result.build(productList, ResultCodeEnum.SUCCESS);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package cn.bunny.interceptor;
|
||||
|
||||
|
||||
import cn.bunny.common.AuthContextUtil;
|
||||
import cn.bunny.common.spzx.model.entity.system.SysUser;
|
||||
import cn.bunny.common.spzx.model.vo.common.Result;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cn.bunny.mapper;
|
||||
|
||||
import cn.bunny.common.spzx.model.dto.product.CategoryBrandDto;
|
||||
import cn.bunny.common.spzx.model.entity.product.Brand;
|
||||
import cn.bunny.common.spzx.model.entity.product.CategoryBrand;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
@ -19,4 +20,7 @@ public interface CategoryBrandMapper {
|
|||
|
||||
// 删除分类品牌
|
||||
void deleteById(Long id);
|
||||
|
||||
// 根据id查询对应商品数据
|
||||
List<Brand> findBrandByCategoryId(Long categoryId);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package cn.bunny.mapper;
|
||||
|
||||
import cn.bunny.common.spzx.model.dto.product.ProductDto;
|
||||
import cn.bunny.common.spzx.model.entity.product.Product;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ProductMapper {
|
||||
// 查询分页
|
||||
public List<Product> findByPage(ProductDto productDto);
|
||||
}
|
|
@ -1,9 +1,12 @@
|
|||
package cn.bunny.service;
|
||||
|
||||
import cn.bunny.common.spzx.model.dto.product.CategoryBrandDto;
|
||||
import cn.bunny.common.spzx.model.entity.product.Brand;
|
||||
import cn.bunny.common.spzx.model.entity.product.CategoryBrand;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CategoryBrandService {
|
||||
// 分类品牌条件分页查询
|
||||
PageInfo<CategoryBrand> findByPage(Integer page, Integer limit, CategoryBrandDto categoryBrandDto);
|
||||
|
@ -16,4 +19,7 @@ public interface CategoryBrandService {
|
|||
|
||||
// 删除分类品牌
|
||||
void deleteById(Long id);
|
||||
|
||||
// 根据id查询对应商品数据
|
||||
List<Brand> findBrandByCategoryId(Long categoryId);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package cn.bunny.service;
|
||||
|
||||
import cn.bunny.common.spzx.model.dto.product.ProductDto;
|
||||
import cn.bunny.common.spzx.model.entity.product.Product;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ProductService {
|
||||
// 查询分页
|
||||
PageInfo<Product> findByPage(Integer page, Integer limit, ProductDto productDto);
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package cn.bunny.service.impl;
|
||||
|
||||
import cn.bunny.common.spzx.model.dto.product.CategoryBrandDto;
|
||||
import cn.bunny.common.spzx.model.entity.product.Brand;
|
||||
import cn.bunny.common.spzx.model.entity.product.CategoryBrand;
|
||||
import cn.bunny.mapper.CategoryBrandMapper;
|
||||
import cn.bunny.service.CategoryBrandService;
|
||||
|
@ -44,4 +45,10 @@ public class CategoryBrandServiceImpl implements CategoryBrandService {
|
|||
public void deleteById(Long id) {
|
||||
categoryBrandMapper.deleteById(id);
|
||||
}
|
||||
|
||||
// 根据id查询对应商品数据
|
||||
@Override
|
||||
public List<Brand> findBrandByCategoryId(Long categoryId) {
|
||||
return categoryBrandMapper.findBrandByCategoryId(categoryId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package cn.bunny.service.impl;
|
||||
|
||||
import cn.bunny.common.spzx.model.dto.product.ProductDto;
|
||||
import cn.bunny.common.spzx.model.entity.product.Product;
|
||||
import cn.bunny.mapper.ProductMapper;
|
||||
import cn.bunny.service.ProductService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ProductServiceImpl implements ProductService {
|
||||
@Autowired
|
||||
private ProductMapper productMapper;
|
||||
|
||||
// 查询分页
|
||||
@Override
|
||||
public PageInfo<Product> findByPage(Integer page, Integer limit, ProductDto productDto) {
|
||||
PageHelper.startPage(page, limit);
|
||||
List<Product> productList = productMapper.findByPage(productDto);
|
||||
return new PageInfo<>(productList);
|
||||
}
|
||||
}
|
|
@ -16,8 +16,11 @@ spring:
|
|||
spzx:
|
||||
auth:
|
||||
noAuthUrls:
|
||||
- /doc.*/**
|
||||
- /doc.*/**/**
|
||||
- /admin/system/index/login
|
||||
- /admin/system/index/generateValidateCode
|
||||
|
||||
minio:
|
||||
endpointUrl: "http://129.211.31.58:9000"
|
||||
accessKey: "bunny"
|
||||
|
|
|
@ -50,4 +50,14 @@
|
|||
order by cb.id desc
|
||||
</select>
|
||||
|
||||
<!-- 根据id查询对应商品数据 -->
|
||||
<select id="findBrandByCategoryId" resultType="cn.bunny.common.spzx.model.entity.product.Brand">
|
||||
select b.*
|
||||
from category_brand cb
|
||||
inner join brand b on b.id = cb.brand_id
|
||||
where cb.category_id + #{categoryId}
|
||||
and cb.is_deleted = 0
|
||||
order by cb.id desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
<?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="cn.bunny.mapper.ProductMapper">
|
||||
|
||||
<resultMap id="productMap" type="cn.bunny.common.spzx.model.entity.product.Product" autoMapping="true"/>
|
||||
|
||||
<!-- 用于select查询公用抽取的列 -->
|
||||
<sql id="columns">
|
||||
id,name,brand_id,category1_id,category2_id,category3_id,unit_name,slider_urls,spec_value,status,audit_status,audit_message,create_time,update_time,is_deleted
|
||||
</sql>
|
||||
|
||||
<sql id="findPageWhere">
|
||||
<where>
|
||||
<if test="brandId != null and brandId != ''">
|
||||
and p.brand_id = #{brandId}
|
||||
</if>
|
||||
<if test="category1Id != null and category1Id != ''">
|
||||
and p.category1_id = #{category1Id}
|
||||
</if>
|
||||
<if test="category2Id != null and category2Id != ''">
|
||||
and p.category2_id = #{category2Id}
|
||||
</if>
|
||||
<if test="category3Id != null and category3Id != ''">
|
||||
and p.category3_id = #{category3Id}
|
||||
</if>
|
||||
and p.is_deleted = 0
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 查询分页 -->
|
||||
<select id="findByPage" resultType="cn.bunny.common.spzx.model.entity.product.Product">
|
||||
select
|
||||
p.id, p.name , p.brand_id , p.category1_id , p.category2_id , p.category3_id, p.unit_name,
|
||||
p.slider_urls , p.spec_value , p.status , p.audit_status , p.audit_message , p.create_time , p.update_time , p.is_deleted ,
|
||||
b.name brandName , c1.name category1Name , c2.name category2Name , c3.name category3Name
|
||||
from product p
|
||||
LEFT JOIN brand b on b.id = p.brand_id
|
||||
LEFT JOIN category c1 on c1.id = p.category1_id
|
||||
LEFT JOIN category c2 on c2.id = p.category2_id
|
||||
LEFT JOIN category c3 on c3.id = p.category3_id
|
||||
<include refid="findPageWhere"/>
|
||||
order by id desc
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue