Compare commits
No commits in common. "0363ab8b2130e95a48532c8013345257d2b5d348" and "6d5be665a013098c6e7738a5cac8b95d3a690433" have entirely different histories.
0363ab8b21
...
6d5be665a0
|
@ -8,10 +8,8 @@ import net.srt.framework.common.page.PageResult;
|
|||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.query.StandardManagementQuery;
|
||||
import net.srt.service.DatastandardService;
|
||||
import net.srt.vo.MetamodelPropertyVO;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
@ -62,23 +60,6 @@ public class DatastandardController {
|
|||
return Result.ok();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改")
|
||||
public Result<String> update(@RequestBody @Valid DatastandardEntity datastandardEntity){
|
||||
datastandardService.update1(datastandardEntity);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public Result<String> delete(@RequestBody List<Long> idList) {
|
||||
datastandardService.delete(idList);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,15 +2,16 @@ package net.srt.controller;
|
|||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import net.srt.entity.DatastandardEntity;
|
||||
import net.srt.entity.StandardEntity;
|
||||
import net.srt.framework.common.utils.BeanUtil;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.framework.common.utils.TreeNodeVo;
|
||||
import net.srt.service.StandardService;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -43,24 +44,5 @@ public class StandardController {
|
|||
return Result.ok(nodeVo);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "保存")
|
||||
public Result<String > save(@RequestBody StandardEntity standardEntity){
|
||||
standardService.save1(standardEntity);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改")
|
||||
public Result<String > update(@RequestBody StandardEntity standardEntity){
|
||||
standardService.update1(standardEntity);
|
||||
return Result.ok();
|
||||
}
|
||||
@DeleteMapping("/id")
|
||||
@Operation(summary = "删除")
|
||||
public Result<String > del(@PathVariable Long id){
|
||||
standardService.del(id);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,4 @@ public interface DatastandardService extends BaseService<DatastandardEntity> {
|
|||
|
||||
List<DatastandardEntity> getTableCode();
|
||||
|
||||
void update1(DatastandardEntity datastandardEntity);
|
||||
|
||||
void delete(List<Long> idList);
|
||||
}
|
||||
|
|
|
@ -15,11 +15,4 @@ import java.util.List;
|
|||
public interface StandardService extends BaseService<StandardEntity> {
|
||||
|
||||
List<TreeNodeVo> listTree();
|
||||
|
||||
void save1(StandardEntity standardEntity);
|
||||
|
||||
void update1(StandardEntity standardEntity);
|
||||
|
||||
void del(Long id);
|
||||
|
||||
}
|
||||
|
|
|
@ -5,10 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.convert.DatastandardConvert;
|
||||
import net.srt.convert.MetamodelConvert;
|
||||
import net.srt.dao.DatastandardDao;
|
||||
import net.srt.entity.DatastandardEntity;
|
||||
import net.srt.entity.MetamodelEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.query.StandardManagementQuery;
|
||||
|
@ -41,24 +39,7 @@ public class DatastandardServiceImpl extends BaseServiceImpl<DatastandardDao, Da
|
|||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update1(DatastandardEntity datastandardEntity) {
|
||||
StandardManagementVo standardManagementVo=DatastandardConvert.INSTANCE.convert(datastandardEntity);
|
||||
standardManagementVo.setProjectId(getProjectId());
|
||||
updateById(datastandardEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(List<Long> idList) {
|
||||
removeByIds(idList);
|
||||
//删除
|
||||
for (Long id : idList) {
|
||||
LambdaQueryWrapper<DatastandardEntity> wrapper=Wrappers.lambdaQuery();
|
||||
wrapper.eq(DatastandardEntity::getCategoryId,id);
|
||||
datastandardDao.delete(wrapper);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private LambdaQueryWrapper<DatastandardEntity> getWrapper(StandardManagementQuery query) {
|
||||
|
|
|
@ -13,8 +13,6 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import static net.srt.framework.security.user.SecurityUser.getUserId;
|
||||
|
||||
/**
|
||||
* @ClassName : StandardServiceImpl
|
||||
* @Description :
|
||||
|
@ -42,45 +40,5 @@ public class StandardServiceImpl extends BaseServiceImpl<StandardDao, StandardEn
|
|||
return BuildTreeUtils.buildTree(treeNodeVos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save1(StandardEntity standardEntity) {
|
||||
if (standardEntity.getId() == null) {
|
||||
standardEntity.setCreateTime(new java.util.Date());
|
||||
standardEntity.setUpdateTime(new java.util.Date());
|
||||
standardEntity.setDeleted(0);
|
||||
standardEntity.setVersion(0);
|
||||
standardEntity.setCreator(getUserId());
|
||||
standardEntity.setUpdater(getUserId());
|
||||
baseMapper.insert(standardEntity);
|
||||
} else {
|
||||
standardEntity.setUpdateTime(new java.util.Date());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update1(StandardEntity standardEntity) {
|
||||
if (standardEntity.getId()!= null) {
|
||||
standardEntity.setUpdateTime(new java.util.Date());
|
||||
standardEntity.setUpdater(getUserId());
|
||||
baseMapper.updateById(standardEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void del(Long id) {
|
||||
//判断是否有子节点
|
||||
LambdaQueryWrapper<StandardEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(StandardEntity::getParentId,id).last("limit 1");
|
||||
if(baseMapper.selectCount(wrapper)!=null){
|
||||
throw new RuntimeException("请先删除子节点");
|
||||
}
|
||||
removeById(id);
|
||||
//删除属性
|
||||
LambdaQueryWrapper<StandardEntity> wrapper1 = new LambdaQueryWrapper<>();
|
||||
wrapper1.eq(StandardEntity::getParentId,id);
|
||||
baseMapper.delete(wrapper1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class StandardManagementVo implements Serializable {
|
|||
private Integer standardCodeId;
|
||||
private Integer type;
|
||||
private String note;
|
||||
private Long projectId;
|
||||
private Integer projectId;
|
||||
private Integer status;
|
||||
private Integer version;
|
||||
private Integer deleted;
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
package net.srt;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* @ClassName : ${NAME}
|
||||
* @Description : ${description}
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-22 20:44
|
||||
*/
|
||||
@EnableFeignClients
|
||||
@EnableDiscoveryClient
|
||||
@SpringBootApplication
|
||||
public class ServiceApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ServiceApplication.class, args);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue