refactor(vo): 重构VO对象结构,统一字段命名和接口实现
重构所有VO对象,统一字段命名规范,移除冗余字段,优化接口实现 新增Voable接口用于VO对象转换 调整BaseViewModel和ProjectBasedViewModel接口定义 更新相关服务和控制器以适应VO对象变更
This commit is contained in:
@@ -1,30 +1,29 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.model.ContractType;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.cache.annotation.Caching;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.model.ContractKind;
|
||||
import com.ecep.contract.vm.ContractKindViewModel;
|
||||
|
||||
import java.util.List;
|
||||
import com.ecep.contract.vo.ContractKindVo;
|
||||
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract-kind")
|
||||
public class ContractKindService extends QueryService<ContractKind, ContractKindViewModel> {
|
||||
public class ContractKindService extends QueryService<ContractKindVo, ContractKindViewModel> {
|
||||
@Cacheable(key = "#p0")
|
||||
@Override
|
||||
public ContractKind findById(Integer id) {
|
||||
public ContractKindVo findById(Integer id) {
|
||||
return super.findById(id);
|
||||
}
|
||||
|
||||
public ContractKind findByName(String name) {
|
||||
public ContractKindVo findByName(String name) {
|
||||
try {
|
||||
return async("findByName", name, String.class).handle((response, ex) -> {
|
||||
ContractKind newEntity = createNewEntity();
|
||||
ContractKindVo newEntity = createNewEntity();
|
||||
return updateValue(newEntity, response);
|
||||
}).get();
|
||||
} catch (Exception e) {
|
||||
@@ -33,13 +32,13 @@ public class ContractKindService extends QueryService<ContractKind, ContractKind
|
||||
|
||||
}
|
||||
|
||||
public ContractKind findByCode(String code) {
|
||||
public ContractKindVo findByCode(String code) {
|
||||
try {
|
||||
return async("findByCode", code, String.class).handle((response, ex) -> {
|
||||
if (ex != null) {
|
||||
throw new RuntimeException("远程方法+findByCode+调用失败", ex);
|
||||
}
|
||||
ContractKind newEntity = createNewEntity();
|
||||
ContractKindVo newEntity = createNewEntity();
|
||||
return updateValue(newEntity, response);
|
||||
}).get();
|
||||
} catch (Exception e) {
|
||||
@@ -49,7 +48,7 @@ public class ContractKindService extends QueryService<ContractKind, ContractKind
|
||||
|
||||
@Cacheable(key = "'kinds'")
|
||||
@Override
|
||||
public List<ContractKind> findAll() {
|
||||
public List<ContractKindVo> findAll() {
|
||||
return super.findAll();
|
||||
}
|
||||
|
||||
@@ -57,7 +56,7 @@ public class ContractKindService extends QueryService<ContractKind, ContractKind
|
||||
@CacheEvict(key = "#p0.id"), @CacheEvict(key = "'kinds'"),
|
||||
})
|
||||
@Override
|
||||
public ContractKind save(ContractKind entity) {
|
||||
public ContractKindVo save(ContractKindVo entity) {
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@@ -65,9 +64,8 @@ public class ContractKindService extends QueryService<ContractKind, ContractKind
|
||||
@CacheEvict(key = "#p0.id"), @CacheEvict(key = "'kinds'"),
|
||||
})
|
||||
@Override
|
||||
public void delete(ContractKind entity) {
|
||||
public void delete(ContractKindVo entity) {
|
||||
super.delete(entity);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user