添加活动
This commit is contained in:
parent
7701f0423f
commit
0e35116e9d
|
|
@ -11,10 +11,10 @@ import java.math.BigDecimal;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("tb_user_storage")
|
@TableName("tb_activate")
|
||||||
public class Activate extends Model<Activate> {
|
public class Activate extends Model<Activate> {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@TableId(type = IdType.ASSIGN_UUID)
|
@TableId(type = IdType.AUTO)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Integer shopId;
|
private Integer shopId;
|
||||||
private Integer minNum;
|
private Integer minNum;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package cn.ysk.cashier.mybatis.rest;
|
package cn.ysk.cashier.mybatis.rest;
|
||||||
|
|
||||||
|
import cn.ysk.cashier.mybatis.entity.Activate;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import cn.ysk.cashier.annotation.Log;
|
import cn.ysk.cashier.annotation.Log;
|
||||||
|
|
@ -15,7 +16,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Api(tags = "/shop/storage")
|
@Api(tags = "/shop/storage")
|
||||||
@RequestMapping("/api/storage")
|
@RequestMapping("/shop/storage")
|
||||||
public class StorageController {
|
public class StorageController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ShopService shopService;
|
private ShopService shopService;
|
||||||
|
|
@ -37,4 +38,15 @@ public class StorageController {
|
||||||
shopService.inStorage(storageVo,userName);
|
shopService.inStorage(storageVo,userName);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
@GetMapping("/findActivate")
|
||||||
|
public ResponseEntity<Object> findActivate(@RequestParam String shopId){
|
||||||
|
String userName = SecurityUtils.getCurrentUsername();
|
||||||
|
return new ResponseEntity<>(shopService.findActivate(shopId), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
@PostMapping("/modityActivate")
|
||||||
|
public ResponseEntity<Object> modityActivate(@RequestBody Activate activate){
|
||||||
|
String userName = SecurityUtils.getCurrentUsername();
|
||||||
|
shopService.modityActivate(activate);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package cn.ysk.cashier.mybatis.service;
|
package cn.ysk.cashier.mybatis.service;
|
||||||
|
|
||||||
|
import cn.ysk.cashier.mybatis.entity.Activate;
|
||||||
import cn.ysk.cashier.mybatis.entity.StorageVo;
|
import cn.ysk.cashier.mybatis.entity.StorageVo;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
|
@ -31,4 +32,8 @@ public interface ShopService {
|
||||||
|
|
||||||
|
|
||||||
void inStorage(StorageVo storageVo, String userName);
|
void inStorage(StorageVo storageVo, String userName);
|
||||||
|
|
||||||
|
Object findActivate(String shopId);
|
||||||
|
|
||||||
|
void modityActivate(Activate activate);
|
||||||
}
|
}
|
||||||
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package cn.ysk.cashier.mybatis.service.impl;
|
package cn.ysk.cashier.mybatis.service.impl;
|
||||||
|
|
||||||
|
import cn.ysk.cashier.mybatis.entity.Activate;
|
||||||
|
import cn.ysk.cashier.mybatis.mapper.*;
|
||||||
import cn.ysk.cashier.pojo.shop.TbMerchantAccount;
|
import cn.ysk.cashier.pojo.shop.TbMerchantAccount;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
|
@ -22,10 +24,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import cn.ysk.cashier.exception.NewBadRequestException;
|
import cn.ysk.cashier.exception.NewBadRequestException;
|
||||||
import cn.ysk.cashier.mybatis.entity.StorageVo;
|
import cn.ysk.cashier.mybatis.entity.StorageVo;
|
||||||
import cn.ysk.cashier.mybatis.entity.TbUserStorage;
|
import cn.ysk.cashier.mybatis.entity.TbUserStorage;
|
||||||
import cn.ysk.cashier.mybatis.mapper.TbMerchantAccountMapper;
|
|
||||||
import cn.ysk.cashier.mybatis.mapper.TbProducSkutMapper;
|
|
||||||
import cn.ysk.cashier.mybatis.mapper.TbProductMapper;
|
|
||||||
import cn.ysk.cashier.mybatis.mapper.TbUserStorageMapper;
|
|
||||||
import cn.ysk.cashier.mybatis.service.ShopService;
|
import cn.ysk.cashier.mybatis.service.ShopService;
|
||||||
import cn.ysk.cashier.utils.*;
|
import cn.ysk.cashier.utils.*;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
@ -51,7 +49,7 @@ public class ShopServiceImpl implements ShopService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private TbProducSkutMapper producSkutMapper;
|
private TbProducSkutMapper producSkutMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TbProductMapper productMapper;
|
private ActivateMapper activateMapper;
|
||||||
@Override
|
@Override
|
||||||
public Object findStorage(Integer shopId, String account, Pageable pageable) {
|
public Object findStorage(Integer shopId, String account, Pageable pageable) {
|
||||||
QueryWrapper<TbUserStorage> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<TbUserStorage> queryWrapper = new QueryWrapper<>();
|
||||||
|
|
@ -119,4 +117,22 @@ public class ShopServiceImpl implements ShopService {
|
||||||
userStorageMapper.insert(userStorage);
|
userStorageMapper.insert(userStorage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object findActivate(String shopId) {
|
||||||
|
QueryWrapper<Activate> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("shop_id",shopId);
|
||||||
|
queryWrapper.orderByDesc("id");
|
||||||
|
List<Activate> list = activateMapper.selectList(queryWrapper);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void modityActivate(Activate activate) {
|
||||||
|
if (Objects.nonNull(activate.getId()) && activate.getId() > 0){
|
||||||
|
activateMapper.updateById(activate);
|
||||||
|
}else {
|
||||||
|
activateMapper.insert(activate);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue