Merge branch 'ww' into test
This commit is contained in:
commit
7f78921eda
|
|
@ -1,10 +1,5 @@
|
|||
package cn.ysk.cashier.controller.shop;
|
||||
|
||||
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousDeleteMapping;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousPutMapping;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopExtend;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopExtendService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -35,29 +30,26 @@ public class TbShopExtendController {
|
|||
|
||||
@GetMapping
|
||||
@ApiOperation("分页查询")
|
||||
@AnonymousGetMapping
|
||||
public ResponseEntity<Object> selectAll(TbShopExtendQueryCriteria criteria) {
|
||||
return new ResponseEntity<>(tbShopExtendService.queryAll(criteria), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@ApiOperation("通过Id查询详情")
|
||||
@AnonymousGetMapping
|
||||
public TbShopExtend selectOne(@PathVariable Serializable id) {
|
||||
return tbShopExtendService.getById(id);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增")
|
||||
@AnonymousPostMapping
|
||||
public ResponseEntity<Object> insert(@RequestBody TbShopExtend tbShopExtend) {
|
||||
tbShopExtend.setCreateTime(new Date());
|
||||
return new ResponseEntity<>(tbShopExtendService.save(tbShopExtend), HttpStatus.CREATED);
|
||||
tbShopExtendService.saveInfo(tbShopExtend);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("通过id修改")
|
||||
@AnonymousPutMapping
|
||||
public ResponseEntity<Object> update(@RequestBody TbShopExtend tbShopExtend) {
|
||||
tbShopExtend.setUpdateTime(new Date());
|
||||
tbShopExtendService.updateById(tbShopExtend);
|
||||
|
|
@ -66,7 +58,6 @@ public class TbShopExtendController {
|
|||
|
||||
@DeleteMapping
|
||||
@ApiOperation("删除")
|
||||
@AnonymousDeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestParam("idList") List<Long> idList) {
|
||||
tbShopExtendService.removeByIds(idList);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
|
|
|||
|
|
@ -16,5 +16,7 @@ public interface TbShopExtendService extends IService<TbShopExtend> {
|
|||
|
||||
Map<String, Object> queryAll(TbShopExtendQueryCriteria criteria);
|
||||
|
||||
void saveInfo(TbShopExtend tbShopExtend);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package cn.ysk.cashier.mybatis.service.impl;
|
||||
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbShopExtendMapper;
|
||||
|
|
@ -41,5 +42,16 @@ public class TbShopExtendServiceImpl extends ServiceImpl<TbShopExtendMapper, TbS
|
|||
Page<TbShopExtend> ipage = tbShopExtendmapper.selectPage(page, wrapper);
|
||||
return PageUtil.toPage(ipage.getRecords(), ipage.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveInfo(TbShopExtend tbShopExtend) {
|
||||
QueryWrapper<TbShopExtend> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("shop_id", tbShopExtend.getShopId());
|
||||
wrapper.like("autokey",tbShopExtend.getAutokey());
|
||||
if(tbShopExtendmapper.exists(wrapper)){
|
||||
throw new BadRequestException("该自定义key已存在");
|
||||
}
|
||||
tbShopExtendmapper.insert(tbShopExtend);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue