parent
4c0d44d179
commit
35baafdfb2
|
|
@ -225,22 +225,22 @@ public class BasicDataController {
|
|||
}
|
||||
|
||||
|
||||
@Post(path ="/stcd/stch/insert", summary = "测站采集项新增")
|
||||
@Post(path ="/stch/manage/insert", summary = "测站采集项新增")
|
||||
public R<Boolean> insertStch(@RequestBody @Validated StStchB stStchB) {
|
||||
return R.ok(stStchBService.insert(stStchB));
|
||||
}
|
||||
|
||||
@Get(path ="/stcd/stch/del/{id}", summary = "测站采集项删除")
|
||||
@Get(path ="/stch/manage/del/{id}", summary = "测站采集项删除")
|
||||
public R<Boolean> delStch(@Schema(description="测站采集项id") @PathVariable("id") Integer id) {
|
||||
return R.ok(stStchBService.removeById(id));
|
||||
}
|
||||
|
||||
@Post(path ="/stcd/stch/update", summary = "测站采集项修改")
|
||||
public R<Boolean> updateStch(@RequestBody @Validated StStchB bean) {
|
||||
@Post(path ="/stch/manage/update", summary = "测站采集项修改")
|
||||
public R<Boolean> updateStch(@RequestBody @Validated(Update.class) StStchB bean) {
|
||||
return R.ok(stStchBService.update(bean));
|
||||
}
|
||||
|
||||
@Post(path = "/stcd/stch/page", summary = "测站采集项分页查询")
|
||||
@Post(path = "/stch/manage/page", summary = "测站采集项分页查询")
|
||||
public R<IPage<StStchB>> PageStch(@RequestBody StStchBSo findDto) {
|
||||
return R.ok(stStchBService.page(findDto));
|
||||
}
|
||||
|
|
@ -264,6 +264,12 @@ public class BasicDataController {
|
|||
return R.ok(true);
|
||||
}
|
||||
|
||||
@Get(path = "/monct/manage/delete/{crId}", summary = "删除监测断面接口")
|
||||
public R<Boolean> deleteMonCr(@Validated @RequestBody Long crId) {
|
||||
stMoncrService.delete(crId);
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
@Post(path = "/monct/search/query", summary = "查询监测断面列表接口")
|
||||
public R<Page<StMoncrB>> queryMonCrList(@Validated @RequestBody GeneralSearch search) {
|
||||
return R.ok(stMoncrService.queryBySearch(search));
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.gunshi.project.xyt.model;
|
|||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
|
@ -35,6 +36,7 @@ public class StStchB implements Serializable {
|
|||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
@Schema(description = "主键id")
|
||||
@ExcelProperty("编号")
|
||||
@NotNull(message = "断面ID不能为空", groups = {Update.class})
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
|
|
@ -136,7 +138,7 @@ public class StStchB implements Serializable {
|
|||
* 删除标记 0:未删除, 1: 删除
|
||||
*/
|
||||
@TableField(value = "DEL")
|
||||
@Schema(description = "删除标记 0:未删除, 1: 删除")
|
||||
@Schema(description = "删除标记 1:启用 0:禁用")
|
||||
private Integer del;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.project.xyt.entity.basedata.CheckStringSearch;
|
||||
import com.gunshi.project.xyt.entity.basedata.GeneralSearch;
|
||||
|
|
@ -13,6 +15,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Sun Lejun
|
||||
|
|
@ -60,6 +63,25 @@ public class StMoncrService {
|
|||
stMoncrBMapper.updateById(stMoncrB);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除监测断面
|
||||
* @param crId 监测断面id
|
||||
*/
|
||||
public void delete(Long crId) {
|
||||
LambdaQueryWrapper<StMoncrB> query = Wrappers.lambdaQuery();
|
||||
query.eq(StMoncrB::getStatus, 1);
|
||||
query.eq(StMoncrB::getCrId, crId);
|
||||
|
||||
StMoncrB obj = stMoncrBMapper.selectOne(query, false);
|
||||
if (Objects.isNull(obj)) {
|
||||
throw new IllegalArgumentException("未找到相关记录");
|
||||
}
|
||||
|
||||
obj.setStatus(0);
|
||||
stMoncrBMapper.updateById(obj);
|
||||
}
|
||||
|
||||
public int getMaxSortOn(){
|
||||
QueryWrapper<StMoncrB> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StMoncrB.COL_STATUS, 1);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import com.gunshi.project.xyt.so.StStchBSo;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
|
|
@ -41,7 +40,7 @@ public class StStchBService extends BaseOrderDao<StStchBMapper, StStchB> {
|
|||
*/
|
||||
@Transactional
|
||||
public boolean update(StStchB bean) {
|
||||
if (Objects.isNull(baseMapper.selectById(bean.getId()))) {
|
||||
if (Objects.isNull(this.selectById(bean.getId()))) {
|
||||
throw new IllegalArgumentException("未找到相关记录");
|
||||
}
|
||||
|
||||
|
|
@ -55,14 +54,15 @@ public class StStchBService extends BaseOrderDao<StStchBMapper, StStchB> {
|
|||
* @return 执行状态
|
||||
*/
|
||||
@Transactional
|
||||
public boolean removeById(Serializable id) {
|
||||
public boolean removeById(Integer id) {
|
||||
|
||||
StStchB obj = this.selectById(id);
|
||||
|
||||
StStchB obj = baseMapper.selectById(id);
|
||||
if (Objects.isNull(obj)) {
|
||||
throw new IllegalArgumentException("未找到相关记录");
|
||||
}
|
||||
|
||||
obj.setDel(1);
|
||||
obj.setDel(0);
|
||||
return update(obj);
|
||||
}
|
||||
|
||||
|
|
@ -81,9 +81,21 @@ public class StStchBService extends BaseOrderDao<StStchBMapper, StStchB> {
|
|||
query.eq(StStchB::getStcd, stcd);
|
||||
}
|
||||
|
||||
query.eq(StStchB::getDel, 0);
|
||||
query.eq(StStchB::getDel, 1);
|
||||
|
||||
return super.page(so.getPageSo().toPage(), query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据站点编码查询单个采集项信息
|
||||
* @param id 查询对象id
|
||||
* @return 采集项
|
||||
*/
|
||||
private StStchB selectById(Integer id){
|
||||
LambdaQueryWrapper<StStchB> query = Wrappers.lambdaQuery();
|
||||
query.eq(StStchB::getDel, 1);
|
||||
query.eq(StStchB::getId, id);
|
||||
return super.getOne(query);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue