测试限制功能
parent
5a9df58a31
commit
12b87ec426
|
@ -1,4 +1,5 @@
|
|||
package com.muyu.cloud.market.controller;
|
||||
import com.muyu.cloud.market.domin.Product;
|
||||
import com.muyu.cloud.market.domin.User;
|
||||
import com.muyu.cloud.market.domin.req.CompanyListReq;
|
||||
import com.muyu.cloud.market.service.CompanyService;
|
||||
|
@ -81,4 +82,7 @@ public class CompanyController {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -138,4 +138,28 @@ public class ProductApiController {
|
|||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试次数-1
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/reducetestcount")
|
||||
@Operation(summary = "测试次数-1",description = "测试次数-1")
|
||||
public void reducetestcount(@Validated @RequestBody Product product){
|
||||
Integer reducetestcount = productApiService.reducetestcount(product);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断测试次数
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/iftest")
|
||||
@Operation(summary = "判断测试次数是否<=0",description = "判断测试次数是否<=0")
|
||||
public Result iftest(@Validated @RequestBody Product product){
|
||||
Integer iftest = productApiService.iftest(product);
|
||||
return Result.success(iftest);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.cloud.market.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.cloud.market.domin.Company;
|
||||
import com.muyu.cloud.market.domin.Product;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
|
@ -13,4 +14,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
*/
|
||||
@Mapper
|
||||
public interface CompanyMapper extends BaseMapper<Company> {
|
||||
|
||||
}
|
||||
|
|
|
@ -34,4 +34,13 @@ public interface ProductApiMapper extends BaseMapper<Product> {
|
|||
* @return
|
||||
*/
|
||||
String selectremark(Product product);
|
||||
|
||||
/**
|
||||
* 测试次数-1
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
Integer reducetestcount(Product product);
|
||||
|
||||
Integer iftest(Product product);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.cloud.market.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.market.domin.Company;
|
||||
import com.muyu.cloud.market.domin.Product;
|
||||
import com.muyu.cloud.market.domin.User;
|
||||
import com.muyu.cloud.market.domin.req.CompanyListReq;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
@ -28,4 +29,10 @@ public interface CompanyService extends IService<Company> {
|
|||
*/
|
||||
User ifcompanyauthentication();
|
||||
|
||||
/**
|
||||
* 测试次数-1
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -52,4 +52,16 @@ public interface ProductApiService extends IService<Product> {
|
|||
* @return
|
||||
*/
|
||||
String selectremark(Product product);
|
||||
|
||||
/**
|
||||
* 测试次数-1
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
Integer reducetestcount(Product product);
|
||||
|
||||
/*
|
||||
判断测试次数
|
||||
*/
|
||||
Integer iftest(Product product);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.cloud.market.service.impl;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.market.domin.Company;
|
||||
import com.muyu.cloud.market.domin.Product;
|
||||
import com.muyu.cloud.market.domin.User;
|
||||
import com.muyu.cloud.market.domin.req.CompanyListReq;
|
||||
import com.muyu.cloud.market.mapper.CompanyMapper;
|
||||
|
@ -91,4 +92,5 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|||
User user = userService.getById(userid);
|
||||
return user;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -110,5 +110,26 @@ public class ProductApiServiceImpl extends ServiceImpl<ProductApiMapper, Product
|
|||
return productApiMapper.selectremark(product);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试次数-1
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Integer reducetestcount(Product product) {
|
||||
Integer reducetestcount = productApiMapper.reducetestcount(product);
|
||||
return reducetestcount;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
判断测试次数
|
||||
*/
|
||||
@Override
|
||||
public Integer iftest(Product product) {
|
||||
Integer iftest = productApiMapper.iftest(product);
|
||||
return iftest;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
<mapper namespace="com.muyu.cloud.market.mapper.ProductApiMapper">
|
||||
|
||||
|
||||
<select id="selectspecification" resultType="com.muyu.cloud.market.domin.resp.ChosehowpayResp">
|
||||
select
|
||||
product.product_id,
|
||||
|
@ -20,4 +21,11 @@
|
|||
<select id="selectremark" resultType="java.lang.String">
|
||||
SELECT remark from product where product_id=#{productId}
|
||||
</select>
|
||||
<select id="iftest" resultType="java.lang.Integer">
|
||||
SELECT product.user_count from product where product_id =#{productId}
|
||||
</select>
|
||||
|
||||
<update id="reducetestcount">
|
||||
update product set user_count=user_count-1 where product_id=#{productId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue