Browse Source

河道删除

master
牧羊人 4 years ago
parent
commit
557d53808b
3 changed files with 11 additions and 5 deletions
  1. +2
    -1
      src/main/java/com/taauav/admin/controller/TauvDriverController.java
  2. +2
    -1
      src/main/java/com/taauav/admin/service/ITauvDriverService.java
  3. +7
    -3
      src/main/java/com/taauav/admin/service/impl/TauvDriverServiceImpl.java

+ 2
- 1
src/main/java/com/taauav/admin/controller/TauvDriverController.java View File

@@ -13,6 +13,7 @@ import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.math.BigInteger;
import java.util.Map;

/**
@@ -101,7 +102,7 @@ public class TauvDriverController {
*/
@PostMapping("/drop")
@RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION)
public Response drop(@RequestBody Integer id) {
public Response drop(@RequestBody BigInteger id) {
return iTauvDriverService.drop(id);
}


+ 2
- 1
src/main/java/com/taauav/admin/service/ITauvDriverService.java View File

@@ -5,6 +5,7 @@ import com.taauav.common.bean.Response;
import com.taauav.admin.entity.TauvDriver;
import com.taauav.common.service.IBaseService;

import java.math.BigInteger;
import java.util.Map;

/**
@@ -46,7 +47,7 @@ public interface ITauvDriverService extends IBaseService<TauvDriver> {
* @param id 河道ID
* @return
*/
Response drop(Integer id);
Response drop(BigInteger id);

/**
* 根据河道编号获取数据

+ 7
- 3
src/main/java/com/taauav/admin/service/impl/TauvDriverServiceImpl.java View File

@@ -18,6 +18,7 @@ import com.taauav.admin.service.ISysAdminService;
import com.taauav.admin.service.ITauvDriverService;
import com.taauav.common.service.impl.BaseServiceImpl;
import com.taauav.common.util.DateUtil;
import com.taauav.common.util.ShiroUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -167,15 +168,18 @@ public class TauvDriverServiceImpl extends BaseServiceImpl<TauvDriverMapper, Tau
* @return
*/
@Override
public Response drop(Integer id) {
if (id == null || id <= 0) {
public Response drop(BigInteger id) {
if (id == null) {
return response.failure("河道ID不存在");
}
TauvDriver entity = driverMapper.selectById(id);
if (entity == null) {
return response.failure("河道信息不存在");
}
boolean result = this.deleteById(id, entity);
entity.setCreateTime(DateUtil.now());
entity.setCreateUser(ShiroUtils.getAdminId());
entity.setMark(0);
boolean result = updateById(entity);
if (!result) {
return response.failure("删除失败");
}

Loading…
Cancel
Save