Compare commits

..

5 Commits

Author SHA1 Message Date
李永杰 82e08f3010 Merge remote-tracking branch 'origin/master' 2023-11-26 14:10:35 +08:00
李永杰 add4f9d5e6 迭代 2023-11-26 14:10:13 +08:00
李永杰 95f140bff0 简化客户会员 2023-11-21 09:17:34 +08:00
李永杰 518934871d 简化客户会员 2023-11-21 09:13:48 +08:00
李永杰 e6fcc7a462 简化客户会员 2023-11-21 09:06:25 +08:00
39 changed files with 1603 additions and 14 deletions

View File

@ -147,12 +147,25 @@ create table tb_import(
list_id int(11) comment '表单编号' primary key auto_increment,
merch_id int(11) comment '商品编号',
merch_name varchar(20) comment '商品名称',
merch_type varchar(10) comment '商品类型',
type_ids varchar(10) comment '商品类型',
merch_price decimal(4,2) comment '价格',
plan_num int(4) comment '计划进货数',
import_date date comment '进货日期',
provide_id varchar(10) comment '供货商编号'
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='进货表';
insert into tb_import (merch_id, merch_name, type_ids, merch_price, plan_num, import_date, provide_id) values ('1','青芒',1,20,400,'2023-11-20 9:00',1);
select list_id,merch_id, merch_name, type_ids, merch_price, plan_num, import_date, provide_id from tb_import;
-- 供货商表
drop table if exists tb_provide;
create table tb_provide(
provide_id int(11) comment '供货商编号' primary key auto_increment,
provide_name varchar(55) comment '供货商名称'
)ENGINE=InnoDB DEFAULT CHARSET = utf8 COLLATE=utf8_general_ci COMMENT='供货商表';
insert into tb_provide (provide_name) values ('供货商1');
insert into tb_provide (provide_name) values ('供货商2');
insert into tb_provide (provide_name) values ('供货商3');
select provide_id, provide_name from tb_provide;
-- 销售表
drop table if exists tb_sale_list;

View File

@ -0,0 +1,53 @@
package com.bwie.common.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.common.domain
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/20
* @Version 1.0
*/
@Data
public class Customer {
/**
*
*/
private Integer customerId;
/**
*
*/
private String customerName;
/**
*
*/
private Integer customerAge;
/**
* :1- 2-
*/
private Integer customerGender;
/**
*
*/
private String customerAddress;
/**
*
*/
private String customerTel;
/**
*
*/
private Integer vipGrade;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date regDate;
}

View File

@ -0,0 +1,52 @@
package com.bwie.common.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.common.domain
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/24
* @Version 1.0
*/
@Data
public class Import {
/**
*
*/
private Integer listId;
/**
*
*/
private Integer merchId;
/**
*
*/
private String merchName;
/**
*
*/
private String typeIds;
/**
*
*/
private BigDecimal merchPrice;
/**
*
*/
private Integer planNum;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date importDate;
/**
*
*/
private String provideId;
}

View File

@ -0,0 +1,72 @@
package com.bwie.common.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.common.domain
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/19
* @Version 1.0
*/
@Data
@Getter
@Setter
public class Merch implements Serializable {
/**
*
*/
private Integer merchId;
/**
*
*/
private String merchName;
/**
*
*/
private String typeIds;
/**
*
*/
private BigDecimal merchPrice;
/**
*
*/
private String barCode;
/**
*
*/
private BigDecimal salesProPrice;
/**
*
*/
private String factoryId;
/**
*
*/
private String provideId;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date merchDeadTime;
/**
*
*/
private Integer merchNum;
/**
* :1- 2- 3-
*/
private Integer merchSta;
}

View File

@ -0,0 +1,52 @@
package com.bwie.common.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.common.domain
* @Description TODO 退
* @Author LiYonJie
* @Date 2023/11/24
* @Version 1.0
*/
@Data
public class Returns {
/**
*
*/
private Integer listId;
/**
*
*/
private Integer merchId;
/**
*
*/
private String merchName;
/**
*
*/
private String typeIds;
/**
*
*/
private BigDecimal merchPrice;
/**
* 退
*/
private Integer planNum;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date returnsDate;
/**
*
*/
private String provideId;
}

View File

@ -0,0 +1,39 @@
package com.bwie.common.domain;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.common.domain
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/20
* @Version 1.0
*/
@Data
public class Type implements Serializable {
/**
* Id
*/
@JsonAlias(value = "id")
private Integer typeId;
/**
*
*/
@JsonAlias(value = "label")
private String typeName;
/**
* Id
*/
private Integer categoryId;
/**
*
*/
private List<Type> children;
}

View File

@ -0,0 +1,34 @@
package com.bwie.common.domain.request;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.common.domain
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/20
* @Version 1.0
*/
@Data
public class CustomerRequest {
/**
*
*/
private Integer customerId;
/**
*
*/
private String customerName;
/**
*
*/
private Integer vipGrade;
private Integer pageNum = 1;
private Integer pageSize = 5;
}

View File

@ -0,0 +1,17 @@
package com.bwie.common.domain.request;
import lombok.Data;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.common.domain.request
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/24
* @Version 1.0
*/
@Data
public class ImportRequest {
private Integer pageNum = 1;
private Integer pageSize = 5;
}

View File

@ -0,0 +1,46 @@
package com.bwie.common.domain.request;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.common.domain.request
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/19
* @Version 1.0
*/
@Data
@Getter
@Setter
public class MerchRequest {
/**
*
*/
private Integer merchId;
/**
*
*/
private String merchName;
/**
*
*/
private String typeIds;
/**
*
*/
private Integer startNum;
/**
*
*/
private Integer endNum;
private Integer pageNum = 1;
private Integer pageSize = 5;
}

View File

@ -0,0 +1,17 @@
package com.bwie.common.domain.request;
import lombok.Data;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.common.domain.request
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/24
* @Version 1.0
*/
@Data
public class ReturnsRequest {
private Integer pageNum = 1;
private Integer pageSize = 5;
}

View File

@ -0,0 +1,16 @@
package com.bwie.common.domain.response;
import com.bwie.common.domain.Customer;
import lombok.Data;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.common.domain.response
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/20
* @Version 1.0
*/
@Data
public class CustomerResponse extends Customer {
}

View File

@ -0,0 +1,17 @@
package com.bwie.common.domain.response;
import com.bwie.common.domain.Import;
import lombok.Data;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.common.domain.response
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/24
* @Version 1.0
*/
@Data
public class ImportResponse extends Import {
}

View File

@ -0,0 +1,20 @@
package com.bwie.common.domain.response;
import com.bwie.common.domain.Merch;
import lombok.Data;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.common.domain.response
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/19
* @Version 1.0
*/
@Data
public class MerchResponse extends Merch {
/**
*
*/
private String typeName;
}

View File

@ -0,0 +1,16 @@
package com.bwie.common.domain.response;
import com.bwie.common.domain.Returns;
import lombok.Data;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.common.domain.response
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/26
* @Version 1.0
*/
@Data
public class ReturnsResponse extends Returns {
}

View File

@ -0,0 +1,66 @@
package com.bwie.manage.controller;
import com.bwie.common.domain.Customer;
import com.bwie.common.domain.request.CustomerRequest;
import com.bwie.common.domain.response.CustomerResponse;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.manage.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.manage.controller
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/20
* @Version 1.0
*/
@RestController
@RequestMapping("/customer")
public class CustomerController {
@Autowired
private CustomerService customerService;
@PostMapping("/listCustomer")
public Result<PageResult<CustomerResponse>> listCustomer(@RequestBody CustomerRequest customerRequest){
return customerService.listCustomer(customerRequest);
}
@PostMapping("/listVip")
public Result<PageResult<CustomerResponse>> listVip(@RequestBody CustomerRequest customerRequest){
return customerService.listVip(customerRequest);
}
@PostMapping("/addClient")
public Result add(@RequestBody Customer customer){
customerService.add(customer);
return Result.success();
}
@GetMapping("/findByClientId/{customerId}")
public Result findById(@PathVariable("customerId") Integer customerId){
CustomerResponse customer = customerService.findById(customerId);
return Result.success(customer);
}
@PutMapping("/updateClient")
public Result update(@RequestBody Customer customer){
customerService.update(customer);
return Result.success();
}
@DeleteMapping("/delClient/{customerId}")
public Result del(@PathVariable("customerId") Integer customerId){
customerService.del(customerId);
return Result.success();
}
@DeleteMapping("/batchDelClient/{customerIds}")
public Result batchDel(@PathVariable("customerIds") Integer[] customerIds){
customerService.batchDel(customerIds);
return Result.success();
}
}

View File

@ -0,0 +1,40 @@
package com.bwie.manage.controller;
import com.bwie.common.domain.Import;
import com.bwie.common.domain.request.ImportRequest;
import com.bwie.common.domain.response.ImportResponse;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.manage.service.ImportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.manage.controller
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/24
* @Version 1.0
*/
@RestController
@RequestMapping("/import")
public class ImportController {
@Autowired
private ImportService importService;
@PostMapping("/listImport")
public Result<PageResult<ImportResponse>> list(@RequestBody ImportRequest importRequest){
return importService.list(importRequest);
}
@PostMapping("/addImport")
public Result add(@RequestBody Import imports){
importService.add(imports);
return Result.success();
}
}

View File

@ -24,8 +24,13 @@ public class ManageController {
private ManagerService managerService;
@PostMapping("/listManager")
public Result<PageResult<EmpResponse>> list(@RequestBody EmpRequest empRequest){
return managerService.list(empRequest);
public Result<PageResult<EmpResponse>> listManager(@RequestBody EmpRequest empRequest){
return managerService.listManager(empRequest);
}
@PostMapping("/listEmp")
public Result<PageResult<EmpResponse>> listEmp(@RequestBody EmpRequest empRequest){
return managerService.listEmp(empRequest);
}
@PostMapping("/add")
@ -57,4 +62,6 @@ public class ManageController {
managerService.batchDel(empIds);
return Result.success();
}
// @PostMapping("/")
}

View File

@ -0,0 +1,72 @@
package com.bwie.manage.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bwie.common.domain.Merch;
import com.bwie.common.domain.Type;
import com.bwie.common.domain.request.MerchRequest;
import com.bwie.common.domain.response.MerchResponse;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.manage.service.MerchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.manage.controller
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/19
* @Version 1.0
*/
@RestController
@RequestMapping("/merch")
public class MerchController {
@Autowired
private MerchService merchService;
@PostMapping("/listMerch")
public Result<PageResult<MerchResponse>> list(@RequestBody MerchRequest merchRequest){
return merchService.list(merchRequest);
}
@PostMapping("/addMerch")
public Result add(@RequestBody Merch merch){
merchService.add(merch);
return Result.success();
}
@GetMapping("/findByMerchId/{merchId}")
public Result findById(@PathVariable("merchId") Integer merchId){
Merch merch = merchService.findById(merchId);
return Result.success(merch);
}
@PutMapping("/updateMerch")
public Result update(@RequestBody Merch merch){
merchService.update(merch);
return Result.success();
}
@DeleteMapping("/delMerch/{merchId}")
public Result del(@PathVariable("merchId") Integer merchId){
merchService.del(merchId);
return Result.success();
}
@DeleteMapping("/batchDelMerch/{merchIds}")
public Result batchDel(@PathVariable("merchIds") Integer[] merchIds){
merchService.batchDel(merchIds);
return Result.success();
}
@GetMapping("/findTypes")
public Result<List<Type>> findTypes(){
List<Type> types = merchService.findTypes();
return Result.success(types);
}
}

View File

@ -0,0 +1,40 @@
package com.bwie.manage.controller;
import com.bwie.common.domain.Returns;
import com.bwie.common.domain.request.ReturnsRequest;
import com.bwie.common.domain.response.ReturnsResponse;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.manage.service.ReturnsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.manage.controller
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/24
* @Version 1.0
*/
@RestController
@RequestMapping("/returns")
public class ReturnsController {
@Autowired
private ReturnsService returnsService;
@PostMapping("/listReturns")
public Result<PageResult<ReturnsResponse>> list(@RequestBody ReturnsRequest returnsRequest){
return returnsService.list(returnsRequest);
}
@PostMapping("/addReturns")
public Result add(@RequestBody Returns returns){
returnsService.add(returns);
return Result.success();
}
}

View File

@ -0,0 +1,66 @@
package com.bwie.manage.mapper;
import com.bwie.common.domain.Customer;
import com.bwie.common.domain.request.CustomerRequest;
import com.bwie.common.domain.response.CustomerResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.manage.mapper
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/20
* @Version 1.0
*/
@Mapper
public interface CustomerMapper {
/**
*
* @param customerRequest
* @return
*/
List<CustomerResponse> listClient(CustomerRequest customerRequest);
/**
*
* @param customerRequest
* @return
*/
List<CustomerResponse> listVip(CustomerRequest customerRequest);
/**
*
* @param customer
*/
void add(Customer customer);
/**
*
* @param customerId
* @return
*/
CustomerResponse findById(@Param("customerId") Integer customerId);
/**
*
* @param customer
*/
void update(Customer customer);
/**
*
* @param customerId
*/
void del(@Param("customerId") Integer customerId);
/**
*
* @param customerIds
*/
void batchDel(@Param("customerIds") Integer[] customerIds);
}

View File

@ -0,0 +1,32 @@
package com.bwie.manage.mapper;
import com.bwie.common.domain.Import;
import com.bwie.common.domain.request.ImportRequest;
import com.bwie.common.domain.response.ImportResponse;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.manage.mapper
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/24
* @Version 1.0
*/
@Mapper
public interface ImportMapper {
/**
*
* @param importRequest
* @return
*/
List<ImportResponse> list(ImportRequest importRequest);
/**
*
* @param imports
*/
void add(Import imports);
}

View File

@ -23,35 +23,43 @@ public interface ManagerMapper {
* @param empRequest
* @return
*/
List<EmpResponse> list(EmpRequest empRequest);
List<EmpResponse> listManager(EmpRequest empRequest);
/**
*
*
* @param empRequest
* @return
*/
List<EmpResponse> listEmp(EmpRequest empRequest);
/**
* /
* @param emp
*/
void add(Emp emp);
/**
*
* /
* @param empId
* @return
*/
EmpResponse findById(@Param("empId") Integer empId);
/**
*
* /
* @param emp
*/
void update(Emp emp);
/**
*
* /
* @param empId
*/
void del(@Param("empId") Integer empId);
/**
*
* /
* @param empIds
*/
void batchDel(@Param("empIds") Integer[] empIds);

View File

@ -0,0 +1,65 @@
package com.bwie.manage.mapper;
import com.bwie.common.domain.Merch;
import com.bwie.common.domain.Type;
import com.bwie.common.domain.request.MerchRequest;
import com.bwie.common.domain.response.MerchResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.manage.mapper
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/20
* @Version 1.0
*/
@Mapper
public interface MerchMapper {
/**
*
* @param merchRequest
* @return
*/
List<MerchResponse> list(MerchRequest merchRequest);
/**
*
* @param merch
*/
void add(Merch merch);
/**
*
* @param merchId
* @return
*/
Merch findById(@Param("merchId") Integer merchId);
/**
*
* @param merch
*/
void update(Merch merch);
/**
*
* @param merchId
*/
void del(@Param("merchId") Integer merchId);
/**
*
* @param merchIds
*/
void batchDel(@Param("merchIds") Integer[] merchIds);
/**
*
* @return
*/
List<Type> findTypes();
}

View File

@ -0,0 +1,32 @@
package com.bwie.manage.mapper;
import com.bwie.common.domain.Returns;
import com.bwie.common.domain.request.ReturnsRequest;
import com.bwie.common.domain.response.ReturnsResponse;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.manage.mapper
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/26
* @Version 1.0
*/
@Mapper
public interface ReturnsMapper {
/**
* 退
* @param returnsRequest
* @return
*/
List<ReturnsResponse> list(ReturnsRequest returnsRequest);
/**
* 退
* @param returns
*/
void add(Returns returns);
}

View File

@ -0,0 +1,62 @@
package com.bwie.manage.service;
import com.bwie.common.domain.Customer;
import com.bwie.common.domain.request.CustomerRequest;
import com.bwie.common.domain.response.CustomerResponse;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.manage.service
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/20
* @Version 1.0
*/
public interface CustomerService {
/**
*
* @param customerRequest
* @return
*/
Result<PageResult<CustomerResponse>> listCustomer(CustomerRequest customerRequest);
/**
*
* @param customerRequest
* @return
*/
Result<PageResult<CustomerResponse>> listVip(CustomerRequest customerRequest);
/**
*
* @param customer
*/
void add(Customer customer);
/**
*
* @param customerId
* @return
*/
CustomerResponse findById(Integer customerId);
/**
*
* @param customer
*/
void update(Customer customer);
/**
*
* @param customerId
*/
void del(Integer customerId);
/**
*
* @param customerIds
*/
void batchDel(Integer[] customerIds);
}

View File

@ -0,0 +1,30 @@
package com.bwie.manage.service;
import com.bwie.common.domain.Import;
import com.bwie.common.domain.request.ImportRequest;
import com.bwie.common.domain.response.ImportResponse;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.manage.service
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/24
* @Version 1.0
*/
public interface ImportService {
/**
*
* @param importRequest
* @return
*/
Result<PageResult<ImportResponse>> list(ImportRequest importRequest);
/**
*
* @param imports
*/
void add(Import imports);
}

View File

@ -15,11 +15,18 @@ import com.bwie.common.result.Result;
*/
public interface ManagerService {
/**
*
*
* @param empRequest
* @return
*/
Result<PageResult<EmpResponse>> list(EmpRequest empRequest);
Result<PageResult<EmpResponse>> listManager(EmpRequest empRequest);
/**
*
* @param empRequest
* @return
*/
Result<PageResult<EmpResponse>> listEmp(EmpRequest empRequest);
/**
*

View File

@ -0,0 +1,64 @@
package com.bwie.manage.service;
import com.bwie.common.domain.Merch;
import com.bwie.common.domain.Type;
import com.bwie.common.domain.request.MerchRequest;
import com.bwie.common.domain.response.MerchResponse;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import java.util.List;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.manage.service
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/19
* @Version 1.0
*/
public interface MerchService {
/**
*
* @param merchRequest
* @return
*/
Result<PageResult<MerchResponse>> list(MerchRequest merchRequest);
/**
*
* @param merch
*/
void add(Merch merch);
/**
*
* @param merchId
* @return
*/
Merch findById(Integer merchId);
/**
*
* @param merch
*/
void update(Merch merch);
/**
*
* @param merchId
*/
void del(Integer merchId);
/**
*
* @param merchIds
*/
void batchDel(Integer[] merchIds);
/**
*
* @return
*/
List<Type> findTypes();
}

View File

@ -0,0 +1,30 @@
package com.bwie.manage.service;
import com.bwie.common.domain.Returns;
import com.bwie.common.domain.request.ReturnsRequest;
import com.bwie.common.domain.response.ReturnsResponse;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.manage.service
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/26
* @Version 1.0
*/
public interface ReturnsService {
/**
* 退
* @param returnsRequest
* @return
*/
Result<PageResult<ReturnsResponse>> list(ReturnsRequest returnsRequest);
/**
* 退
* @param returns
*/
void add(Returns returns);
}

View File

@ -0,0 +1,72 @@
package com.bwie.manage.service.impl;
import com.bwie.common.domain.Customer;
import com.bwie.common.domain.request.CustomerRequest;
import com.bwie.common.domain.response.CustomerResponse;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.manage.mapper.CustomerMapper;
import com.bwie.manage.service.CustomerService;
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;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.manage.service.impl
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/20
* @Version 1.0
*/
@Service
public class CustomerServiceImpl implements CustomerService {
@Autowired
private
CustomerMapper customerMapper;
@Override
public Result<PageResult<CustomerResponse>> listCustomer(CustomerRequest customerRequest) {
PageHelper.startPage(customerRequest.getPageNum(), customerRequest.getPageSize());
List<CustomerResponse> clients = customerMapper.listClient(customerRequest);
PageInfo<CustomerResponse> info = new PageInfo<>(clients);
return PageResult.toResult(info.getTotal(), clients);
}
@Override
public Result<PageResult<CustomerResponse>> listVip(CustomerRequest customerRequest) {
PageHelper.startPage(customerRequest.getPageNum(), customerRequest.getPageSize());
List<CustomerResponse> clients = customerMapper.listVip(customerRequest);
PageInfo<CustomerResponse> info = new PageInfo<>(clients);
return PageResult.toResult(info.getTotal(), clients);
}
@Override
public void add(Customer customer) {
customerMapper.add(customer);
}
@Override
public CustomerResponse findById(Integer customerId) {
return customerMapper.findById(customerId);
}
@Override
public void update(Customer customer) {
customerMapper.update(customer);
}
@Override
public void del(Integer customerId) {
customerMapper.del(customerId);
}
@Override
public void batchDel(Integer[] customerIds) {
customerMapper.batchDel(customerIds);
}
}

View File

@ -0,0 +1,45 @@
package com.bwie.manage.service.impl;
import com.bwie.common.domain.Import;
import com.bwie.common.domain.request.ImportRequest;
import com.bwie.common.domain.response.ImportResponse;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.manage.mapper.ImportMapper;
import com.bwie.manage.service.ImportService;
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.Date;
import java.util.List;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.manage.service.impl
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/24
* @Version 1.0
*/
@Service
public class ImportServiceImpl implements ImportService {
@Autowired
private ImportMapper importMapper;
@Override
public Result<PageResult<ImportResponse>> list(ImportRequest importRequest) {
PageHelper.startPage(importRequest.getPageNum(), importRequest.getPageSize());
List<ImportResponse> list = importMapper.list(importRequest);
PageInfo<ImportResponse> info = new PageInfo<>(list);
return PageResult.toResult(info.getTotal(), list);
}
@Override
public void add(Import imports) {
imports.setImportDate(new Date());
importMapper.add(imports);
}
}

View File

@ -34,9 +34,17 @@ public class ManagerServiceImpl implements ManagerService {
private RoleService roleService;
@Override
public Result<PageResult<EmpResponse>> list(EmpRequest empRequest) {
public Result<PageResult<EmpResponse>> listManager(EmpRequest empRequest) {
PageHelper.startPage(empRequest.getPageNum(),empRequest.getPageSize());
List<EmpResponse> list = managerMapper.list(empRequest);
List<EmpResponse> list = managerMapper.listManager(empRequest);
PageInfo<EmpResponse> info = new PageInfo<>(list);
return PageResult.toResult(info.getTotal(), list);
}
@Override
public Result<PageResult<EmpResponse>> listEmp(EmpRequest empRequest) {
PageHelper.startPage(empRequest.getPageNum(),empRequest.getPageSize());
List<EmpResponse> list = managerMapper.listEmp(empRequest);
PageInfo<EmpResponse> info = new PageInfo<>(list);
return PageResult.toResult(info.getTotal(), list);
}

View File

@ -0,0 +1,111 @@
package com.bwie.manage.service.impl;
import cn.hutool.core.util.NumberUtil;
import com.bwie.common.domain.Merch;
import com.bwie.common.domain.Type;
import com.bwie.common.domain.request.MerchRequest;
import com.bwie.common.domain.response.MerchResponse;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.manage.mapper.MerchMapper;
import com.bwie.manage.service.MerchService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.tomcat.util.net.NioChannel;
import org.apache.tomcat.util.net.NioEndpoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.manage.service.impl
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/19
* @Version 1.0
*/
@Service
public class MerchServiceImpl implements MerchService {
@Autowired
private MerchMapper merchMapper;
@Override
public Result<PageResult<MerchResponse>> list(MerchRequest merchRequest) {
PageHelper.startPage(merchRequest.getPageNum(), merchRequest.getPageSize());
List<MerchResponse> list = merchMapper.list(merchRequest);
PageInfo<MerchResponse> info = new PageInfo<>(list);
return PageResult.toResult(info.getTotal(), list);
}
@Override
public void add(Merch merch) {
merchMapper.add(merch);
}
@Override
public Merch findById(Integer merchId) {
return merchMapper.findById(merchId);
}
@Override
public void update(Merch merch) {
merchMapper.update(merch);
}
@Override
public void del(Integer merchId) {
merchMapper.del(merchId);
}
@Override
public void batchDel(Integer[] merchIds) {
merchMapper.batchDel(merchIds);
}
@Override
public List<Type> findTypes() {
// 获取所有分类
List<Type> types = merchMapper.findTypes();
// 使用stream流筛选和转化
return types.stream()
.filter(type -> type.getCategoryId().equals(NumberUtils.INTEGER_ZERO)) // 获取分类中第一级分类
// 将每个一级分类的子级放入children集合中
.map(first -> {
// 判断一级分类是否为空,不为空返回对象,为空返回空对象
first.setChildren(getChildren(first.getTypeId(), types).isEmpty() ? null : getChildren(first.getTypeId(), types));
return first;
})
// 转换类型为List
.collect(Collectors.toList());
}
// 递归调用,获取指定父分类的子分类
private List<Type> getChildren(Integer parentId, List<Type> types) {
// 过滤出categoryId等于parentId的子分类
List<Type> collect = types.stream()
.filter(type -> parentId.equals(type.getCategoryId()))
// 递归调用,获取子分类的子分类(二级分类)
.map(second -> {
// 判断二级分类是否为空,不为空返回对象,为空返回空对象
second.setChildren(getChildren(second.getTypeId(), types).isEmpty() ? null : getChildren(second.getTypeId(), types));
return second;
})
.collect(Collectors.toList());
return collect;
}
public static void main(String[] args) throws IOException {
int available = System.in.available();
System.out.printf("a" + available);
}
}

View File

@ -0,0 +1,45 @@
package com.bwie.manage.service.impl;
import com.bwie.common.domain.Returns;
import com.bwie.common.domain.request.ReturnsRequest;
import com.bwie.common.domain.response.ReturnsResponse;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.manage.mapper.ReturnsMapper;
import com.bwie.manage.service.ReturnsService;
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.Date;
import java.util.List;
/**
* @ProjectName: GG-market
* @PackageName: com.bwie.manage.service.impl
* @Description TODO
* @Author LiYonJie
* @Date 2023/11/24
* @Version 1.0
*/
@Service
public class ReturnsServiceImpl implements ReturnsService {
@Autowired
private ReturnsMapper returnsMapper;
@Override
public Result<PageResult<ReturnsResponse>> list(ReturnsRequest returnsRequest) {
PageHelper.startPage(returnsRequest.getPageNum(), returnsRequest.getPageSize());
List<ReturnsResponse> list = returnsMapper.list(returnsRequest);
PageInfo<ReturnsResponse> info = new PageInfo<>(list);
return PageResult.toResult(info.getTotal(), list);
}
@Override
public void add(Returns returns) {
returns.setReturnsDate(new Date());
returnsMapper.add(returns);
}
}

View File

@ -0,0 +1,85 @@
<?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">
<!-- mybatis数据层 namespace命名空间-->
<mapper namespace="com.bwie.manage.mapper.CustomerMapper">
<sql id="selectCustomerVo">
select customer_id, customer_name, customer_age, customer_gender, customer_address, customer_tel,vip_grade,reg_date from tb_customer
</sql>
<select id="listClient" resultType="com.bwie.common.domain.response.CustomerResponse">
<include refid="selectCustomerVo"/>
<where>
vip_grade = 0
<if test="null != customerId">
and customer_id = #{customerId}
</if>
<if test="null != customerName and '' !=customerName">
and customer_name like concat('%',#{customerName},'%')
</if>
</where>
</select>
<select id="listVip" resultType="com.bwie.common.domain.response.CustomerResponse">
<include refid="selectCustomerVo"/>
<where>
vip_grade != 0
<if test="null != customerId">
and customer_id = #{customerId}
</if>
<if test="null != customerName and '' !=customerName">
and customer_name like concat('%',#{customerName},'%')
</if>
</where>
</select>
<insert id="add">
insert into tb_customer
<trim prefix="(" suffix=")" >
<if test="null != customerName and '' != customerName">customer_name,</if>
<if test="null != customerAge">customer_age,</if>
<if test="null != customerGender">customer_gender,</if>
<if test="null != customerAddress and '' != customerAddress">customer_address,</if>
<if test="null != customerTel and '' != customerTel">customer_tel</if>
</trim>
values
<trim prefix="(" suffix=")">
<if test="null != customerName and '' != customerName">#{customerName},</if>
<if test="null != customerAge">#{customerAge},</if>
<if test="null != customerGender">#{customerGender},</if>
<if test="null != customerAddress and '' != customerAddress">#{customerAddress},</if>
<if test="null != customerTel and '' != customerTel">#{customerTel}</if>
</trim>
</insert>
<select id="findById" resultType="com.bwie.common.domain.response.CustomerResponse">
<include refid="selectCustomerVo"/> where customer_id = #{customerId}
</select>
<update id="update">
update tb_customer
<set>
<if test="null != customerName and '' != customerName">customer_name = #{customerName},</if>
<if test="null != customerAge">customer_age = #{customerAge},</if>
<if test="null != customerGender">customer_gender = #{customerGender},</if>
<if test="null != customerAddress and '' != customerAddress">customer_address = #{customerAddress},</if>
<if test="null != customerTel and '' != customerTel">customer_tel = #{customerTel},</if>
<if test="null != vipGrade">vip_grade = #{vipGrade},</if>
<if test="null != regDate">reg_date = #{regDate}</if>
</set>
where customer_id = #{customerId}
</update>
<delete id="del">
delete from tb_customer where customer_id = #{customerId}
</delete>
<delete id="batchDel">
delete from tb_customer where customer_id in
<foreach collection="customerIds" item="customerId" open="(" close=")" separator=",">
#{customerId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,16 @@
<?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">
<!-- mybatis数据层 namespace命名空间-->
<mapper namespace="com.bwie.manage.mapper.ImportMapper">
<select id="list" resultType="com.bwie.common.domain.response.ImportResponse">
select list_id,merch_id, merch_name, type_ids, merch_price, plan_num, import_date, provide_id from tb_import
</select>
<insert id="add">
insert into tb_import (merch_id, merch_name, type_ids, merch_price, plan_num, import_date, provide_id)
values (#{merchId},#{merchName},#{typeIds},#{merchPrice},#{planNum},#{importDate},#{provideId})
</insert>
</mapper>

View File

@ -32,7 +32,7 @@
values (#{empName},#{username},#{password},#{empTel},#{empIdCard},#{empAge},#{empGender},#{empAddress},#{empSal})
</sql>
<select id="list" resultType="com.bwie.common.domain.response.EmpResponse">
<select id="listManager" resultType="com.bwie.common.domain.response.EmpResponse">
<include refid="selectEmpVo"/>
<where>
er.role_id in (2, 3)
@ -42,6 +42,17 @@
</where>
</select>
<select id="listEmp" resultType="com.bwie.common.domain.response.EmpResponse">
<include refid="selectEmpVo"></include>
<where>
er.role_id = 4
<if test="null != empId">
and e.emp_id = #{empId}
</if>
</where>
</select>
<insert id="add" useGeneratedKeys="true" keyProperty="empId">
<include refid="insertEmp"></include>
</insert>

View File

@ -0,0 +1,95 @@
<?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">
<!-- mybatis数据层 namespace命名空间-->
<mapper namespace="com.bwie.manage.mapper.MerchMapper">
<resultMap type="com.bwie.common.domain.Merch" id="MerchResult">
<id property="merchId" column="merch_id" />
<result property="merchName" column="merch_name" />
<result property="typeIds" column="type_ids" />
<result property="merchPrice" column="merch_price" />
<result property="barCode" column="bar_code" />
<result property="salesProPrice" column="sales_pro_price" />
<result property="factoryId" column="factory_id" />
<result property="provideId" column="provide_id" />
<result property="merchDeadTime" column="merch_dead_time" />
<result property="merchNum" column="merch_num" />
<result property="merchSta" column="merch_sta" />
</resultMap>
<sql id="selectMerchVo">
select
m.merch_id, m.merch_name,m.type_ids,
t.type_name, m.merch_price,
m.bar_code, m.sales_pro_price,
m.factory_id, m.provide_id,
m.merch_dead_time, m.merch_num,
m.merch_sta
from tb_merch m
left join tb_type t on SUBSTRING_INDEX(m.type_ids, ',', -1) = t.type_id
</sql>
<select id="list" resultType="com.bwie.common.domain.response.MerchResponse" resultMap="MerchResult">
<include refid="selectMerchVo"/>
<where>
<if test="null != merchId">
and m.merch_id = #{merchId}
</if>
<if test="null != typeIds and '' != typeIds">
and t.type_id = #{typeIds}
</if>
<if test="null != merchName and '' != merchName">
and m.merch_name like concat('%',#{merchName},'%')
</if>
<if test="null != startNum">
and <![CDATA[ m.merch_num >= #{startNum} ]]>
</if>
<if test="null != endNum">
and <![CDATA[ m.merch_num <= #{endNum} ]]>
</if>
</where>
</select>
<insert id="add" useGeneratedKeys="true" keyProperty="merchId">
insert into tb_merch (merch_name, type_ids, merch_price, bar_code, sales_pro_price, factory_id, provide_id, merch_dead_time, merch_num, merch_sta)
values (#{merchName},#{typeIds},#{merchPrice},#{barCode},#{salesProPrice},#{factoryId},#{provideId},#{merchDeadTime},#{merchNum},#{merchSta})
</insert>
<select id="findById" resultType="com.bwie.common.domain.Merch" resultMap="MerchResult">
<include refid="selectMerchVo"/> where m.merch_id = #{merchId}
</select>
<update id="update">
update tb_merch
<set>
merch_name = #{merchName},
type_ids = #{typeIds},
merch_price = #{merchPrice},
bar_code = #{barCode},
sales_pro_price = #{salesProPrice},
factory_id = #{factoryId},
provide_id = #{provideId},
merch_dead_time = #{merchDeadTime},
merch_num = #{merchNum},
merch_sta = #{merchSta}
</set>
where merch_id = #{merchId}
</update>
<delete id="del">
delete from tb_merch where merch_id = #{merchId}
</delete>
<delete id="batchDel">
delete from tb_merch where merch_id in
<foreach collection="merchIds" item="merchId" open="(" close=")" separator=",">
#{merchId}
</foreach>
</delete>
<select id="findTypes" resultType="com.bwie.common.domain.Type">
select type_id, type_name, category_id from tb_type
</select>
</mapper>

View File

@ -0,0 +1,16 @@
<?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">
<!-- mybatis数据层 namespace命名空间-->
<mapper namespace="com.bwie.manage.mapper.ReturnsMapper">
<select id="list" resultType="com.bwie.common.domain.response.ReturnsResponse">
select list_id,merch_id, merch_name, type_ids, merch_price, plan_num, returns_date, provide_id from tb_returns
</select>
<insert id="add">
insert into tb_returns (merch_id, merch_name, type_ids, merch_price, plan_num, returns_date, provide_id)
values (#{merchId},#{merchName},#{typeIds},#{merchPrice},#{planNum},#{returnsDate},#{provideId})
</insert>
</mapper>