台桌区域部分修改

This commit is contained in:
liuyingfang
2024-02-02 09:50:44 +08:00
parent 80f9cc7ea6
commit 858af93c20
5 changed files with 16 additions and 13 deletions

View File

@@ -61,7 +61,7 @@ public class TbShopTable implements Serializable {
@Column(name = "`area_id`")
@ApiModelProperty(value = "区域Id")
private String areaId;
private Integer areaId;
@Column(name = "`is_predate`")
@ApiModelProperty(value = "是否接受网络预定")

View File

@@ -55,11 +55,12 @@ public interface TbShopTableService {
TbShopTableDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbShopTableDto
*/
TbShopTableDto create(TbShopTable resources);
* 创建
*
* @param resources /
* @return TbShopTableDto
*/
TbShopTable create(TbShopTable resources);
/**
* 编辑

View File

@@ -42,7 +42,7 @@ public class TbShopTableDto implements Serializable {
private Integer sort;
/** 区域Id */
private String areaId;
private Integer areaId;
/** 是否接受网络预定 */
private Integer isPredate;

View File

@@ -36,5 +36,5 @@ public class TbShopTableQueryCriteria{
private Integer shopId;
@Query
private String areaId;
private Integer areaId;
}

View File

@@ -28,7 +28,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp;
import java.time.Instant;
@@ -51,11 +50,14 @@ public class TbShopTableServiceImpl implements TbShopTableService {
@Override
public Map<String,Object> queryAll(TbShopTableQueryCriteria criteria, Pageable pageable){
if (Objects.equals(criteria.getAreaId(), "0")){
if (criteria.getAreaId() == 0){
criteria.setAreaId(null);
}
Page<TbShopTable> page = tbShopTableRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbShopTableMapper::toDto));
HashMap<String, Object> map = new HashMap<>();
map.put("content",page.getContent());
map.put("totalElements",page.getTotalElements());
return map;
}
@Override
@@ -73,10 +75,10 @@ public class TbShopTableServiceImpl implements TbShopTableService {
@Override
@Transactional(rollbackFor = Exception.class)
public TbShopTableDto create(TbShopTable resources) {
public TbShopTable create(TbShopTable resources) {
resources.setCreatedAt(Instant.now().toEpochMilli());
resources.setUpdatedAt(Instant.now().toEpochMilli());
return tbShopTableMapper.toDto(tbShopTableRepository.save(resources));
return tbShopTableRepository.save(resources);
}
@Override