台桌区域部分修改

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`") @Column(name = "`area_id`")
@ApiModelProperty(value = "区域Id") @ApiModelProperty(value = "区域Id")
private String areaId; private Integer areaId;
@Column(name = "`is_predate`") @Column(name = "`is_predate`")
@ApiModelProperty(value = "是否接受网络预定") @ApiModelProperty(value = "是否接受网络预定")

View File

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

View File

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

View File

@@ -36,5 +36,5 @@ public class TbShopTableQueryCriteria{
private Integer shopId; private Integer shopId;
@Query @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.transaction.annotation.Transactional;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp; import me.zhengjie.utils.QueryHelp;
import java.time.Instant; import java.time.Instant;
@@ -51,11 +50,14 @@ public class TbShopTableServiceImpl implements TbShopTableService {
@Override @Override
public Map<String,Object> queryAll(TbShopTableQueryCriteria criteria, Pageable pageable){ public Map<String,Object> queryAll(TbShopTableQueryCriteria criteria, Pageable pageable){
if (Objects.equals(criteria.getAreaId(), "0")){ if (criteria.getAreaId() == 0){
criteria.setAreaId(null); criteria.setAreaId(null);
} }
Page<TbShopTable> page = tbShopTableRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); 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 @Override
@@ -73,10 +75,10 @@ public class TbShopTableServiceImpl implements TbShopTableService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public TbShopTableDto create(TbShopTable resources) { public TbShopTable create(TbShopTable resources) {
resources.setCreatedAt(Instant.now().toEpochMilli()); resources.setCreatedAt(Instant.now().toEpochMilli());
resources.setUpdatedAt(Instant.now().toEpochMilli()); resources.setUpdatedAt(Instant.now().toEpochMilli());
return tbShopTableMapper.toDto(tbShopTableRepository.save(resources)); return tbShopTableRepository.save(resources);
} }
@Override @Override