yx
2 years ago
9 changed files with 271 additions and 6 deletions
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
package com.ruoyi.api.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.ruoyi.api.dto.MarketAuthDto; |
||||
import com.ruoyi.api.dto.StationData; |
||||
import com.ruoyi.api.params.StationDataParams; |
||||
import com.ruoyi.api.params.WaterDataParams; |
||||
import com.ruoyi.code.sctaationinfo.domain.ScStationInfo; |
||||
import com.ruoyi.code.sctaationinfo.service.IScStationInfoService; |
||||
import com.ruoyi.code.scwaterdata.domain.ScWaterData; |
||||
import com.ruoyi.code.scwaterdata.service.IScWaterDataService; |
||||
import com.ruoyi.common.core.page.R; |
||||
import com.ruoyi.common.utils.ClassReflection; |
||||
import com.ruoyi.common.utils.DateUtils; |
||||
import com.ruoyi.common.utils.StringUtils; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.text.DateFormat; |
||||
import java.util.ArrayList; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
@Service |
||||
public class WaterDataApiService { |
||||
|
||||
@Resource |
||||
private IScWaterDataService scWaterDataService; |
||||
|
||||
public R query(WaterDataParams params, MarketAuthDto marketAuthDto) { |
||||
Long stnmId = params.getStnmId(); |
||||
String startTime = params.getStartTime(); |
||||
String endTime = params.getEndTime(); |
||||
|
||||
List<ScWaterData> list = scWaterDataService.list( |
||||
new QueryWrapper<ScWaterData>() |
||||
.in("stnm_id", marketAuthDto.getQueryList()) |
||||
.eq("stnm_id", stnmId) |
||||
.between("tm",startTime,endTime) |
||||
); |
||||
|
||||
|
||||
return R.ok().put("data", list); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,102 @@
@@ -0,0 +1,102 @@
|
||||
package com.ruoyi.code.scwaterdata.controller; |
||||
|
||||
import java.util.List; |
||||
import java.util.Arrays; |
||||
import java.util.Map; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import javax.annotation.Resource; |
||||
import com.ruoyi.common.core.page.R; |
||||
import org.springframework.security.access.prepost.PreAuthorize; |
||||
import org.springframework.web.bind.annotation.PostMapping; |
||||
import org.springframework.web.bind.annotation.PathVariable; |
||||
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
import com.ruoyi.common.annotation.Log; |
||||
import com.ruoyi.common.core.controller.BaseController; |
||||
import com.ruoyi.common.enums.BusinessType; |
||||
import com.ruoyi.code.scwaterdata.domain.ScWaterData; |
||||
import com.ruoyi.code.scwaterdata.service.IScWaterDataService; |
||||
import com.ruoyi.common.utils.poi.ExcelUtil; |
||||
/** |
||||
* 水尺-水位数据Controller |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-07-01 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/system/data") |
||||
public class ScWaterDataController extends BaseController |
||||
{ |
||||
@Resource |
||||
private IScWaterDataService scWaterDataService; |
||||
|
||||
/** |
||||
* 查询列表 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:data:list')") |
||||
@RequestMapping("/list") |
||||
public R list(@RequestParam Map<String, Object> params){ |
||||
return scWaterDataService.queryPage(params); |
||||
} |
||||
|
||||
/** |
||||
* 获取详细信息 |
||||
*/ |
||||
@RequestMapping("/info/{id}") |
||||
@PreAuthorize("@ss.hasPermi('system:data:query')") |
||||
public R info(@PathVariable("id") Long id){ |
||||
ScWaterData scWaterData = scWaterDataService.getById(id); |
||||
|
||||
return R.ok().put("data", scWaterData); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 导出列表 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:data:export')") |
||||
@Log(title = "列表", businessType = BusinessType.EXPORT) |
||||
@PostMapping("/export") |
||||
public void export(HttpServletResponse response, ScWaterData scWaterData) |
||||
{ |
||||
List<ScWaterData> list = scWaterDataService.list(); |
||||
ExcelUtil<ScWaterData> util = new ExcelUtil<ScWaterData>(ScWaterData.class); |
||||
util.exportExcel(response, list, "列表数据"); |
||||
} |
||||
|
||||
/** |
||||
* 新增 |
||||
*/ |
||||
@RequestMapping("/add") |
||||
@Log(title = "ScWaterData", businessType = BusinessType.INSERT) |
||||
@PreAuthorize("@ss.hasPermi('system:data:add')") |
||||
public R add(@RequestBody ScWaterData scWaterData){ |
||||
scWaterDataService.save(scWaterData); |
||||
return R.ok(); |
||||
} |
||||
|
||||
/** |
||||
* 修改 |
||||
*/ |
||||
@RequestMapping("/edit") |
||||
@PreAuthorize("@ss.hasPermi('system:data:edit')") |
||||
@Log(title = "ScWaterData", businessType = BusinessType.UPDATE) |
||||
public R edit(@RequestBody ScWaterData scWaterData){ |
||||
scWaterDataService.updateById(scWaterData); |
||||
return R.ok(); |
||||
} |
||||
|
||||
/** |
||||
* 删除 |
||||
*/ |
||||
@RequestMapping("/delete/{ids}") |
||||
@PreAuthorize("@ss.hasPermi('system:data:remove')") |
||||
@Log(title = "ScWaterData", businessType = BusinessType.DELETE) |
||||
public R delete(@PathVariable Long[] ids){ |
||||
scWaterDataService.removeByIds(Arrays.asList(ids)); |
||||
return R.ok(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
package com.ruoyi.code.scwaterdata.domain; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
||||
import java.io.Serializable; |
||||
import lombok.Data; |
||||
|
||||
|
||||
/** |
||||
* 水尺-水位数据对象 sc_water_data |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-07-01 |
||||
*/ |
||||
@Data |
||||
@TableName("sc_water_data") |
||||
public class ScWaterData implements Serializable |
||||
{ |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** 主键自增 */ |
||||
@TableId(type = IdType.INPUT) |
||||
private Long id; |
||||
|
||||
/** 测站ID */ |
||||
private Long stnmId; |
||||
|
||||
/** 时间 */ |
||||
private Date tm; |
||||
|
||||
/** 水位值 */ |
||||
private BigDecimal value; |
||||
|
||||
/** 图片名称 */ |
||||
private String imgName; |
||||
|
||||
|
||||
} |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.code.scwaterdata.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import com.ruoyi.code.scwaterdata.domain.ScWaterData; |
||||
|
||||
/** |
||||
* Mapper接口 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-07-01 |
||||
*/ |
||||
@Mapper |
||||
public interface ScWaterDataMapper extends BaseMapper<ScWaterData> |
||||
{ |
||||
|
||||
} |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
package com.ruoyi.code.scwaterdata.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.ruoyi.common.core.page.R; |
||||
import java.util.Map; |
||||
import com.ruoyi.code.scwaterdata.domain.ScWaterData; |
||||
|
||||
/** |
||||
* Service接口 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-07-01 |
||||
*/ |
||||
public interface IScWaterDataService extends IService<ScWaterData> |
||||
{ |
||||
/** |
||||
* 查询 |
||||
*/ |
||||
R queryPage(Map<String, Object> params); |
||||
|
||||
} |
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
package com.ruoyi.code.scwaterdata.service.impl; |
||||
|
||||
import java.util.Map; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.ruoyi.common.core.page.R; |
||||
import com.ruoyi.common.utils.Query; |
||||
import org.springframework.stereotype.Service; |
||||
import com.ruoyi.code.scwaterdata.mapper.ScWaterDataMapper; |
||||
import com.ruoyi.code.scwaterdata.domain.ScWaterData; |
||||
import com.ruoyi.code.scwaterdata.service.IScWaterDataService; |
||||
|
||||
/** |
||||
* Service业务层处理 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-07-01 |
||||
*/ |
||||
@Service("scWaterDataService") |
||||
public class ScWaterDataServiceImpl extends ServiceImpl<ScWaterDataMapper, ScWaterData> implements IScWaterDataService |
||||
{ |
||||
@Override |
||||
public R queryPage(Map<String, Object> params) { |
||||
IPage<ScWaterData> page = this.page( |
||||
new Query<ScWaterData>().getPage(params), |
||||
new QueryWrapper<ScWaterData>() |
||||
); |
||||
|
||||
return R.ok().put("count", page.getTotal()).put("data", page.getRecords()); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue