Browse Source

构造物管理接口

tags/v1.0.0^2
chengwang 2 years ago
parent
commit
b98a380965
2 changed files with 48 additions and 10 deletions
  1. +19
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/StructureController.java
  2. +29
    -7
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/StructureServiceImpl.java

+ 19
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/StructureController.java View File

* @param entity * @param entity
* @return * @return
*/ */
@PostMapping("add")
@PostMapping("/add")
public JsonResult add(@RequestBody Structure entity){ public JsonResult add(@RequestBody Structure entity){
return structureService.editInfo(entity); return structureService.editInfo(entity);
} }


/**
* 编辑构造物
* @param entity
* @return
*/
@PutMapping("/edit")
public JsonResult update(@RequestBody Structure entity){
return structureService.editInfo(entity);
}




/**
* 删除构造物
* @param ids
* @return
*/
@DeleteMapping("/delete/{ids}")
public JsonResult delete(@PathVariable String[] ids){
return structureService.deleteByIds(ids);
}


} }

+ 29
- 7
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/StructureServiceImpl.java View File

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
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.tuoheng.admin.config.CommonConfig; import com.tuoheng.admin.config.CommonConfig;
import com.tuoheng.admin.entity.Structure; import com.tuoheng.admin.entity.Structure;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.mapper.RoadInformationMapper; import com.tuoheng.admin.mapper.RoadInformationMapper;
import com.tuoheng.admin.mapper.SectionMapper; import com.tuoheng.admin.mapper.SectionMapper;
import com.tuoheng.admin.mapper.StructureMapper; import com.tuoheng.admin.mapper.StructureMapper;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.query.StructureQuery; import com.tuoheng.admin.query.StructureQuery;
import com.tuoheng.admin.service.IStructureService; import com.tuoheng.admin.service.IStructureService;
import com.tuoheng.admin.vo.StructureInfoVo; import com.tuoheng.admin.vo.StructureInfoVo;
import com.tuoheng.common.core.common.BaseServiceImpl; import com.tuoheng.common.core.common.BaseServiceImpl;
import com.tuoheng.common.core.enums.ServiceExceptionEnum; import com.tuoheng.common.core.enums.ServiceExceptionEnum;
import com.tuoheng.common.core.exception.ServiceException; import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.CommonUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import com.tuoheng.common.core.utils.*;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Autowired @Autowired
private RoadInformationMapper roadInformationMapper; private RoadInformationMapper roadInformationMapper;


@Autowired
private UserMapper userMapper;



@Override @Override
public JsonResult queryPage(StructureQuery query) { public JsonResult queryPage(StructureQuery query) {


@Override @Override
public JsonResult editInfo(Structure entity) { public JsonResult editInfo(Structure entity) {
// User user = (User) ThreadLocalUtil.get();
// if (StringUtils.isNull(user)) {
// return JsonResult.error("获取不到用户信息");
// }
//获取登录信息
// String username = SecurityUserUtils.username();
//校验
if(StringUtils.isEmpty(entity.getRoadId()) && StringUtils.isEmpty(entity.getSectionId())){
return JsonResult.error("公路和路段为空");
}
//查询用户信息
if(StringUtils.isEmpty(entity.getId())){
//新增
entity.setCreateTime(DateUtils.now());
entity.setCreateUser("ca");
}else {
//更新
entity.setUpdateTime(DateUtils.now());
entity.setUpdateUser("ca");
}
super.edit(entity);





return null;
return JsonResult.success();
} }





Loading…
Cancel
Save