监测站点管理新增,修改和删除接口调整
parent
c6067e5e40
commit
abc51e4709
|
|
@ -35,14 +35,12 @@ import com.gunshi.project.xyt.service.SysDictService;
|
||||||
import com.gunshi.project.xyt.validate.markers.Update;
|
import com.gunshi.project.xyt.validate.markers.Update;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
@ -232,14 +230,17 @@ public class BasicDataController {
|
||||||
|
|
||||||
@Post(path = "/stcd/manage/insert", summary = "新增测站接口")
|
@Post(path = "/stcd/manage/insert", summary = "新增测站接口")
|
||||||
public R<Boolean> insertStcd(@Validated @RequestBody StStbprpB obj) {
|
public R<Boolean> insertStcd(@Validated @RequestBody StStbprpB obj) {
|
||||||
stStbprpService.insert(obj);
|
return stStbprpService.insert(obj);
|
||||||
return R.ok(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post(path = "/stcd/manage/update", summary = "更新测站接口")
|
@Post(path = "/stcd/manage/update", summary = "更新测站接口")
|
||||||
public R<Boolean> updateStcd(@Validated @RequestBody StStbprpB obj) {
|
public R<Boolean> updateStcd(@Validated @RequestBody StStbprpB obj) {
|
||||||
stStbprpService.update(obj);
|
return stStbprpService.update(obj);
|
||||||
return R.ok(true);
|
}
|
||||||
|
|
||||||
|
@Get(path = "/stcd/manage/delete/{stcd}", summary = "删除测站接口")
|
||||||
|
public R<Boolean> deleteStcd(@Schema(description="测站编码") @PathVariable("stcd") String stcd) {
|
||||||
|
return stStbprpService.delete(stcd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post(path = "/monct/manage/insert", summary = "新增监测断面接口")
|
@Post(path = "/monct/manage/insert", summary = "新增监测断面接口")
|
||||||
|
|
|
||||||
|
|
@ -309,6 +309,13 @@ public class StStbprpB implements Serializable {
|
||||||
@Schema(description = "北斗卡号")
|
@Schema(description = "北斗卡号")
|
||||||
private String bdnum;
|
private String bdnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除标记 0:未删除, 1: 删除
|
||||||
|
*/
|
||||||
|
@TableField(value = "DEL")
|
||||||
|
@Schema(description = "删除标记 0:未删除, 1: 删除")
|
||||||
|
private String del;
|
||||||
|
|
||||||
public static final String COL_STCD = "STCD";
|
public static final String COL_STCD = "STCD";
|
||||||
|
|
||||||
public static final String COL_STNM = "STNM";
|
public static final String COL_STNM = "STNM";
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package com.gunshi.project.xyt.service;
|
package com.gunshi.project.xyt.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.gunshi.core.result.R;
|
||||||
import com.gunshi.project.xyt.entity.basedata.CheckStringSearch;
|
import com.gunshi.project.xyt.entity.basedata.CheckStringSearch;
|
||||||
import com.gunshi.project.xyt.entity.basedata.StStbprpVo;
|
import com.gunshi.project.xyt.entity.basedata.StStbprpVo;
|
||||||
import com.gunshi.project.xyt.entity.basedata.StcdSearch;
|
import com.gunshi.project.xyt.entity.basedata.StcdSearch;
|
||||||
|
|
@ -13,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Sun Lejun
|
* @author Sun Lejun
|
||||||
|
|
@ -33,7 +37,15 @@ public class StStbprpService {
|
||||||
* @return 站点信息
|
* @return 站点信息
|
||||||
*/
|
*/
|
||||||
public StStbprpB queryByStcd(String stcd) {
|
public StStbprpB queryByStcd(String stcd) {
|
||||||
return stStbprpBMapper.selectById(stcd);
|
LambdaQueryWrapper<StStbprpB> query = Wrappers.lambdaQuery();
|
||||||
|
|
||||||
|
|
||||||
|
query.eq(StStbprpB::getStcd,stcd)
|
||||||
|
|
||||||
|
.eq(StStbprpB::getDel,0);
|
||||||
|
return stStbprpBMapper.selectOne(query);
|
||||||
|
|
||||||
|
// return stStbprpBMapper.selectById(stcd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -55,14 +67,37 @@ public class StStbprpService {
|
||||||
return stStbprpBMapper.queryBySearch(search);
|
return stStbprpBMapper.queryBySearch(search);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insert(StStbprpB stStbprpB) {
|
public R<Boolean> insert(StStbprpB stStbprpB) {
|
||||||
|
StStbprpB stStbprpBDb = stStbprpBMapper.selectById(stStbprpB.getStcd());
|
||||||
|
if (Objects.nonNull(stStbprpBDb)){
|
||||||
|
return R.error(200,"站点已存在",false);
|
||||||
|
}
|
||||||
stStbprpB.setModitime(new Date());
|
stStbprpB.setModitime(new Date());
|
||||||
stStbprpBMapper.insert(stStbprpB);
|
stStbprpBMapper.insert(stStbprpB);
|
||||||
|
return R.ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(StStbprpB stStbprpB) {
|
public R<Boolean> update(StStbprpB stStbprpB) {
|
||||||
|
StStbprpB stStbprpBDb = stStbprpBMapper.selectById(stStbprpB.getStcd());
|
||||||
|
if (Objects.isNull(stStbprpBDb)){
|
||||||
|
return R.error(200,"站点不存在",false);
|
||||||
|
}
|
||||||
stStbprpB.setModitime(new Date());
|
stStbprpB.setModitime(new Date());
|
||||||
stStbprpBMapper.updateById(stStbprpB);
|
stStbprpBMapper.updateById(stStbprpB);
|
||||||
|
return R.ok(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public R<Boolean> delete(String stcd) {
|
||||||
|
|
||||||
|
StStbprpB stStbprpB = stStbprpBMapper.selectById(stcd);
|
||||||
|
if (Objects.isNull(stStbprpB)){
|
||||||
|
return R.error(200,"站点不存在",false);
|
||||||
|
}
|
||||||
|
stStbprpB.setModitime(new Date());
|
||||||
|
stStbprpB.setDel("1"); // 逻辑删除该标识
|
||||||
|
stStbprpBMapper.updateById(stStbprpB);
|
||||||
|
return R.ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkExist(CheckStringSearch search) {
|
public void checkExist(CheckStringSearch search) {
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@
|
||||||
BDNUM,
|
BDNUM,
|
||||||
t2.DICT_NM as PROTOCOL_NAME
|
t2.DICT_NM as PROTOCOL_NAME
|
||||||
from ST_STBPRP_B t1
|
from ST_STBPRP_B t1
|
||||||
left join SYS_DICT_B t2 on t1.PROTOCOLS = t2.ID
|
left join SYS_DICT_B t2 on t1.PROTOCOLS = t2.ID and t1.DEL = 0
|
||||||
<where>
|
<where>
|
||||||
<if test="obj.keyword != null and obj.keyword != ''">
|
<if test="obj.keyword != null and obj.keyword != ''">
|
||||||
and (t1.STCD like concat('%', #{obj.keyword}, '%') or t1.STNM like concat('%', #{obj.keyword}, '%'))
|
and (t1.STCD like concat('%', #{obj.keyword}, '%') or t1.STNM like concat('%', #{obj.keyword}, '%'))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue