删除排序
parent
62090df86f
commit
3a1fb34123
|
@ -55,8 +55,8 @@ public class Company {
|
|||
/**
|
||||
*注册日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "注册日期",defaultValue = "2024-8-9 10:47:57",type = "Date")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Schema(description = "注册日期",defaultValue = "2024-8-9",type = "String")
|
||||
private Date registrantDate;
|
||||
/**
|
||||
*社会统一信用代码
|
||||
|
|
|
@ -61,8 +61,8 @@ public class ProductAddReq {
|
|||
/**
|
||||
*产品上架日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "产品上架日期",defaultValue = "2024-8-9 10:47:57",type = "Date")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Schema(description = "产品上架日期",defaultValue = "2024-8-9",type = "String")
|
||||
private Date productShelvesdate;
|
||||
/**
|
||||
* 接口来源
|
||||
|
|
|
@ -60,8 +60,8 @@ public class ProductUpdReq {
|
|||
/**
|
||||
*产品上架日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "产品上架日期",defaultValue = "2024-8-9 10:47:57",type = "Date")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Schema(description = "注册日期",defaultValue = "2024-8-9",type = "String")
|
||||
private Date productShelvesdate;
|
||||
/**
|
||||
* 接口来源
|
||||
|
|
|
@ -15,6 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.cloud.background.controller
|
||||
|
@ -50,6 +54,12 @@ public class ApiManageController {
|
|||
@PostMapping("/add")
|
||||
@Operation(summary = "接口信息添加", description = "添加接口信息,添加成功才可以使用")
|
||||
public Result<String> save(@Validated @RequestBody ProductAddReq productAddReq){
|
||||
productAddReq.setProductSales(0);
|
||||
// 使用java.time.LocalDate获取当前日期,并将其转换为java.util.Date
|
||||
LocalDate today = LocalDate.now();
|
||||
java.util.Date registrantDate = Date.from(today.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
productAddReq.setProductShelvesdate(registrantDate);
|
||||
productAddReq.setProductState(0);
|
||||
apiManageService.save(Product.addProductList(productAddReq));
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
@ -85,6 +95,16 @@ public class ApiManageController {
|
|||
return Result.success(null, "操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品状态查询
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(path = "/productState")
|
||||
@Operation(summary = "产品状态",description = "查询全部产品状态")
|
||||
public Result productTypeList(){
|
||||
return Result.success(apiManageService.selectproductState());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,9 @@ package com.muyu.cloud.background.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.cloud.background.domin.Product;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
|
@ -13,4 +16,12 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
*/
|
||||
@Mapper
|
||||
public interface ApiManageMapper extends BaseMapper<Product> {
|
||||
|
||||
|
||||
/**
|
||||
* 产品状态查询
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT product_state from product GROUP BY product_state")
|
||||
List<Integer> selectproductState();
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.muyu.cloud.background.domin.req.ProductListReq;
|
|||
import com.muyu.cloud.background.domin.resp.ProductTotalListResp;
|
||||
import com.muyu.cloud.background.mapper.ApiManageMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.cloud.background.service
|
||||
|
@ -22,4 +24,10 @@ public interface ApiManageService extends IService<Product> {
|
|||
* @return
|
||||
*/
|
||||
ProductTotalListResp selectList(ProductListReq productListReq);
|
||||
|
||||
/**
|
||||
* 产品状态查询
|
||||
* @return
|
||||
*/
|
||||
List<Integer> selectproductState();
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.muyu.cloud.background.domin.resp.ProductTotalListResp;
|
|||
import com.muyu.cloud.background.mapper.ApiManageMapper;
|
||||
import com.muyu.cloud.background.service.ApiManageService;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -23,6 +24,9 @@ import java.util.List;
|
|||
@Service
|
||||
public class ApiManageServiceImpl extends ServiceImpl<ApiManageMapper, Product> implements ApiManageService {
|
||||
|
||||
@Autowired
|
||||
private ApiManageMapper apiManageMapper;
|
||||
|
||||
/**
|
||||
* 查询全部商品接口
|
||||
* @param productListReq
|
||||
|
@ -48,4 +52,13 @@ public class ApiManageServiceImpl extends ServiceImpl<ApiManageMapper, Product>
|
|||
return ProductTotalListResp.of(productListResps, count);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品状态查询
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Integer> selectproductState() {
|
||||
return apiManageMapper.selectproductState();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue