Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
7d37e58206
|
|
@ -1,10 +1,5 @@
|
||||||
package cn.ysk.cashier.controller.shop;
|
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.entity.TbShopExtend;
|
||||||
import cn.ysk.cashier.mybatis.service.TbShopExtendService;
|
import cn.ysk.cashier.mybatis.service.TbShopExtendService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
@ -35,29 +30,26 @@ public class TbShopExtendController {
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@ApiOperation("分页查询")
|
@ApiOperation("分页查询")
|
||||||
@AnonymousGetMapping
|
|
||||||
public ResponseEntity<Object> selectAll(TbShopExtendQueryCriteria criteria) {
|
public ResponseEntity<Object> selectAll(TbShopExtendQueryCriteria criteria) {
|
||||||
return new ResponseEntity<>(tbShopExtendService.queryAll(criteria), HttpStatus.OK);
|
return new ResponseEntity<>(tbShopExtendService.queryAll(criteria), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
@ApiOperation("通过Id查询详情")
|
@ApiOperation("通过Id查询详情")
|
||||||
@AnonymousGetMapping
|
|
||||||
public TbShopExtend selectOne(@PathVariable Serializable id) {
|
public TbShopExtend selectOne(@PathVariable Serializable id) {
|
||||||
return tbShopExtendService.getById(id);
|
return tbShopExtendService.getById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ApiOperation("新增")
|
@ApiOperation("新增")
|
||||||
@AnonymousPostMapping
|
|
||||||
public ResponseEntity<Object> insert(@RequestBody TbShopExtend tbShopExtend) {
|
public ResponseEntity<Object> insert(@RequestBody TbShopExtend tbShopExtend) {
|
||||||
tbShopExtend.setCreateTime(new Date());
|
tbShopExtend.setCreateTime(new Date());
|
||||||
return new ResponseEntity<>(tbShopExtendService.save(tbShopExtend), HttpStatus.CREATED);
|
tbShopExtendService.saveInfo(tbShopExtend);
|
||||||
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@ApiOperation("通过id修改")
|
@ApiOperation("通过id修改")
|
||||||
@AnonymousPutMapping
|
|
||||||
public ResponseEntity<Object> update(@RequestBody TbShopExtend tbShopExtend) {
|
public ResponseEntity<Object> update(@RequestBody TbShopExtend tbShopExtend) {
|
||||||
tbShopExtend.setUpdateTime(new Date());
|
tbShopExtend.setUpdateTime(new Date());
|
||||||
tbShopExtendService.updateById(tbShopExtend);
|
tbShopExtendService.updateById(tbShopExtend);
|
||||||
|
|
@ -66,7 +58,6 @@ public class TbShopExtendController {
|
||||||
|
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@ApiOperation("删除")
|
@ApiOperation("删除")
|
||||||
@AnonymousDeleteMapping
|
|
||||||
public ResponseEntity<Object> delete(@RequestParam("idList") List<Long> idList) {
|
public ResponseEntity<Object> delete(@RequestParam("idList") List<Long> idList) {
|
||||||
tbShopExtendService.removeByIds(idList);
|
tbShopExtendService.removeByIds(idList);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ public class TbShopExtend extends Model<TbShopExtend> {
|
||||||
//商户Id
|
//商户Id
|
||||||
private Integer shopId;
|
private Integer shopId;
|
||||||
//img:图片;text:文本;
|
//img:图片;text:文本;
|
||||||
|
private String name;
|
||||||
private String type;
|
private String type;
|
||||||
//自定义key
|
//自定义key
|
||||||
private String autokey;
|
private String autokey;
|
||||||
|
|
@ -53,6 +54,14 @@ public class TbShopExtend extends Model<TbShopExtend> {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAutokey() {
|
public String getAutokey() {
|
||||||
return autokey;
|
return autokey;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,5 +16,7 @@ public interface TbShopExtendService extends IService<TbShopExtend> {
|
||||||
|
|
||||||
Map<String, Object> queryAll(TbShopExtendQueryCriteria criteria);
|
Map<String, Object> queryAll(TbShopExtendQueryCriteria criteria);
|
||||||
|
|
||||||
|
void saveInfo(TbShopExtend tbShopExtend);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package cn.ysk.cashier.mybatis.service.impl;
|
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.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import cn.ysk.cashier.mybatis.mapper.TbShopExtendMapper;
|
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);
|
Page<TbShopExtend> ipage = tbShopExtendmapper.selectPage(page, wrapper);
|
||||||
return PageUtil.toPage(ipage.getRecords(), ipage.getTotal());
|
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