You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.2 KiB
Java

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package com.weaver.seconddev.tjzs.controller.banquethall;
import cn.hutool.core.collection.CollectionUtil;
import com.weaver.common.authority.annotation.WeaPermission;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.seconddev.tjzs.tb.config.EbDbDataSourceConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @use根据人数获取符合条件的宴会厅id列表
* @author liuhao
* @return String,id用逗号隔开
*/
@RestController
@RequestMapping("/papi/secondev/tjzs")
@Slf4j
public class BanquetHallCheckController {
@Autowired
private JdbcTemplate jdbcTemplate = new JdbcTemplate(EbDbDataSourceConfig.dbDataSource());
@WeaPermission(publicPermission = true)
@PostMapping("/checkBanquetHallByPeople")
public WeaResult<String> check(
@RequestParam("peoplenums") int peoplenums
){
log.error("peoplenums:{}",peoplenums);
String ids = "";
Map<String,String> rs = new HashMap<>();
//根据人数判断符合条件数据 表单uf_ballroom_informat_registrat【宴会厅信息登记】
String sql = "select id from uf_ballroom_informat_registrat where max_num >= "+peoplenums+" and min_num <= "+peoplenums+" and IS_DELETE = '0'";
List<Map<String, Object>> infolist = jdbcTemplate.queryForList(sql);
if(CollectionUtil.isNotEmpty(infolist)) {
List<String>idslist = new ArrayList<>();
for(Map<String,Object> rs1 : infolist) {
String id = String.valueOf(rs1.get("id"));
idslist.add(id);
}
ids = idslist.stream().map(String::valueOf).collect(Collectors.joining(","));
}
return WeaResult.success(ids);
}
}