package mjkf.xinke.main.controller; import cn.hutool.core.collection.ListUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.jgy.xxs.core.http.resp.HttpResponse; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import mjkf.xinke.main.common.http.FuHttpResponse; import mjkf.xinke.main.dao.LocalMaterialCityAggrMapper; import mjkf.xinke.main.model.db.LocalMaterial; import mjkf.xinke.main.model.vo.LocalMaterialCityAggr; import mjkf.xinke.main.model.vo.LocalMaterialSummary; import mjkf.xinke.main.service.LocalMaterialService; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** *
* 地材 前端控制器 *
* * @author han0 * @since 2023-12-14 */ @RestController @RequestMapping("/local-material") public class LocalMaterialController { @Resource LocalMaterialService localMaterialService; @Resource LocalMaterialCityAggrMapper localMaterialCityAggrMapper; @ApiOperation("获取地材列表") @GetMapping("/") public HttpResponse list ( @ApiParam(value = "年") @RequestParam(value="year") Integer year, @ApiParam(value = "月") @RequestParam(value="month") Integer month, @ApiParam(value = "地市") @RequestParam(value="city", required=false) String city, @ApiParam(value = "区县") @RequestParam(value="county", required=false) String county, @ApiParam(value = "规格") @RequestParam(value="spec", required=false) String spec, @ApiParam(value = "名称") @RequestParam(value="name", required=false) String name ) { var query = localMaterialService.getQuery(year, month, city, county, spec, name); query.orderByDesc(LocalMaterial::getName); List