删除排序

master
WeiRan 2024-08-31 19:50:06 +08:00
parent 62090df86f
commit 3a1fb34123
7 changed files with 58 additions and 6 deletions

View File

@ -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;
/**
*

View File

@ -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;
/**
*

View File

@ -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;
/**
*

View File

@ -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;
/**
* @Authorweiran
* @Packagecom.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());
}
}

View File

@ -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;
/**
* @Authorweiran
@ -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();
}

View File

@ -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;
/**
* @Authorweiran
* @Packagecom.muyu.cloud.background.service
@ -22,4 +24,10 @@ public interface ApiManageService extends IService<Product> {
* @return
*/
ProductTotalListResp selectList(ProductListReq productListReq);
/**
*
* @return
*/
List<Integer> selectproductState();
}

View File

@ -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();
}
}