重构系统架构

v1.4.1
Parker 5 years ago
parent e20c9316f1
commit 1a331c7c27

@ -3,9 +3,10 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>opsli-boot-parent</artifactId> <artifactId>opsli-base-support</artifactId>
<groupId>org.opsliframework.boot</groupId> <groupId>org.opsliframework.boot</groupId>
<version>1.0.0</version> <version>1.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -8,7 +8,7 @@ import java.lang.annotation.*;
/** /**
* controller使 * controller使
* @author C西 * @author Parker
*/ */
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)

@ -1,7 +1,5 @@
package org.opsli.common.annotation; package org.opsli.common.annotation;
import org.opsli.common.constants.CacheConstants;
import java.lang.annotation.*; import java.lang.annotation.*;
/** /**
@ -22,6 +20,8 @@ import java.lang.annotation.*;
* *
* - * -
* *
* 使
*
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE) @Target(ElementType.TYPE)

@ -18,6 +18,8 @@ import java.lang.annotation.*;
* *
* 访 * 访
* *
* 使
*
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD) @Target(ElementType.METHOD)

@ -18,6 +18,8 @@ import java.lang.annotation.*;
* *
* 访 * 访
* *
* 使
*
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD) @Target(ElementType.METHOD)

@ -0,0 +1,38 @@
package org.opsli.common.constants;
import cn.hutool.setting.dialect.Props;
/**
* @BelongsProject: opsli-boot
* @BelongsPackage: org.opsli.common.constants
* @Author: Parker
* @CreateTime: 2020-09-18 18:46
* @Description: MyBatis
*/
public final class MyBatisConstants {
private static final Props prop = Props.getProp("application.yaml");
/** 逻辑删除值 */
public static final char LOGIC_DELETE_VALUE =
prop.getChar("mybatis-plus.global-config.db-config.logic-delete-value",'1');
/** 逻辑不删除值 */
public static final char LOGIC_NOT_DELETE_VALUE =
prop.getChar("mybatis-plus.global-config.db-config.logic-not-delete-value",'0');
/** 创建人 */
public static final String FIELD_CREATE_BY = "createBy";
/** 更新时间 */
public static final String FIELD_CREATE_TIME = "createTime";
/** 更新人 */
public static final String FIELD_UPDATE_BY = "updateBy";
/** 更新时间 */
public static final String FIELD_UPDATE_TIME = "updateTime";
/** 逻辑删除 */
public static final String FIELD_DELETE_LOGIC = "deleted";
/** 乐观锁 */
public static final String FIELD_OPTIMISTIC_LOCK = "version";
private MyBatisConstants(){}
}

@ -7,6 +7,9 @@ package org.opsli.common.constants;
*/ */
public interface OrderConstants { public interface OrderConstants {
/** SQL 切面执行顺序 */
int SQL_ORDER = 190;
/** 热点数据加载顺序 */ /** 热点数据加载顺序 */
int HOT_DATA_ORDER = 180; int HOT_DATA_ORDER = 180;

@ -0,0 +1,105 @@
package org.opsli.common.utils;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReflectUtil;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import java.util.Map;
/**
* @BelongsProject: opsli-boot
* @BelongsPackage: org.opsli.common.utils
* @Author: Parker
* @CreateTime: 2020-09-19 00:08
* @Description:
*
* Wrapper Wrapper
*
*/
@Slf4j
public final class WrapperUtil {
/** 私有化构造函数 */
private WrapperUtil(){}
/**
*
* @param from
* @param toClass
* @param <M>
* @return
*/
public static <T,M> M transformInstance(T from, Class<M> toClass){
M m = null;
try {
Object toObj = ReflectUtil.newInstance(toClass);
Map<String, Object> stringBeanMap = BeanUtil.beanToMap(from);
if(stringBeanMap != null){
Object toInstance = BeanUtil.fillBeanWithMapIgnoreCase(stringBeanMap, toObj, true);
if(toInstance != null){
m = (M) toInstance;
}
}
}catch (Exception e){
log.error(e.getMessage(),e);
}
return m;
}
/**
*
* @param froms
* @param toClass
* @param <M>
* @return
*/
public static <T,M> List<M> transformInstance(List<T> froms, Class<M> toClass){
List<M> toInstanceList = Lists.newArrayListWithCapacity(froms.size());
try {
for (Object from : froms) {
Object toObj = ReflectUtil.newInstance(toClass);
Map<String, Object> stringBeanMap = BeanUtil.beanToMap(from);
if(stringBeanMap != null){
Object toInstance = BeanUtil.fillBeanWithMapIgnoreCase(stringBeanMap, toObj, true);
if(toInstance != null){
toInstanceList.add((M) toInstance);
}
}
}
}catch (Exception e){
log.error(e.getMessage(),e);
}
return toInstanceList;
}
/**
*
* @param from
* @param toClass
* @param <M>
* @return
*/
public static <T,M> M cloneTransformInstance(T from, Class<M> toClass){
T fromByClone = ObjectUtil.cloneByStream(from);
return transformInstance(fromByClone,toClass);
}
/**
*
* @param froms
* @param toClass
* @param <M>
* @return
*/
public static <T,M> List<M> cloneTransformInstance(List<T> froms, Class<M> toClass){
List<T> ts = ObjectUtil.cloneByStream(froms);
return transformInstance(ts,toClass);
}
}

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>opsli-boot-parent</artifactId>
<groupId>org.opsliframework.boot</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>opsli-base-support</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<modules>
<module>opsli-common</module>
<module>opsli-core</module>
</modules>
</project>

@ -1,122 +0,0 @@
package org.opsli.core.base.service.impl;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.opsli.core.base.entity.BaseEntity;
import org.opsli.core.base.service.base.BaseService;
import org.opsli.core.base.service.interfaces.CrudServiceInterface;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
/**
* @BelongsProject: opsli-boot
* @BelongsPackage: org.opsli.common.base.service.impl
* @Author: Parker
* @CreateTime: 2020-09-14 17:31
* @Description: CurdServiceImpl -
*
*
*
*
*
* save
*
*/
@Slf4j
public abstract class CrudServiceImpl<M extends BaseMapper<T>, T extends BaseEntity>
extends BaseService<M, T> implements CrudServiceInterface<T> {
/** entity Class 类 */
protected Class<T> entityClazz;
@Override
public T get(String id) {
return baseMapper.selectById(id);
}
@Override
public T get(T entity) {
if(entity == null) return null;
return baseMapper.selectById(entity.getId());
}
@Override
public List<T> findList(T entity) {
//baseMapper.selectList()
return null;
}
@Override
public T insert(T entity) {
if(entity == null) return null;
int count = baseMapper.insert(entity);
if(count > 0){
return entity;
}
return null;
}
@Override
public T update(T entity) {
if(entity == null) return null;
int count = baseMapper.updateById(entity);
if(count > 0){
return entity;
}
return null;
}
@Override
public int delete(String id) {
return baseMapper.deleteById(id);
}
@Override
public int delete(T entity) {
if(entity == null) return 0;
return baseMapper.deleteById(entity.getId());
}
@Override
public int deleteAll(String[] ids) {
if(ids == null) return 0;
List<String> idList = Arrays.asList(ids);
return baseMapper.deleteBatchIds(idList);
}
@Override
public int deleteAll(Collection<T> entitys) {
if(entitys == null || entitys.isEmpty()) return 0;
List<String> idList = Lists.newArrayListWithCapacity(entitys.size());
for (T entity : entitys) {
idList.add(entity.getId());
}
return baseMapper.deleteBatchIds(idList);
}
@Override
public int deleteByLogic(String id) {
return 0;
}
@Override
public int deleteByLogic(T entity) {
return 0;
}
@Override
public int deleteAllByLogic(String[] ids) {
return 0;
}
@Override
public int deleteAllByLogic(Collection<T> entities) {
return 0;
}
}

@ -1,136 +0,0 @@
package org.opsli.core.base.service.interfaces;
import java.util.Collection;
import java.util.List;
public interface CrudServiceInterface<T> extends BaseServiceInterface<T> {
/**
*
*
* @param id
* @return
*/
T get(String id);
/**
*
*
* @param entity
* @return
*/
T get(T entity);
/**
*
*
* @param entity
* @return
*/
List<T> findList(T entity);
/**
*
*
* @param entity
* @return
*/
T insert(T entity);
/**
*
*
* @param entity
* @return
*/
T update(T entity);
/**
*
*
* @param id
* @return
* @see int delete(T entity)
*/
int delete(String id);
/**
*
*
* @param entity
* @return
*/
int delete(T entity);
/**
*
* @param ids
* @return
*/
int deleteAll(String[] ids);
/**
*
* @param entitys
* @return
*/
int deleteAll(Collection<T> entitys);
/**
* del_flag1,del_flag
*
* @param id
* @return
* @see int delete(T entity)
*/
int deleteByLogic(String id);
/**
* del_flag1,del_flag
*
* @param entity
* @return
* @see int delete(T entity)
*/
int deleteByLogic(T entity);
/**
*
* @param ids
* @return
*/
int deleteAllByLogic(String[] ids);
/**
*
* @param entitys
* @return
*/
int deleteAllByLogic(Collection<T> entitys);
/**
*
*
* @return
* @see List<T> findAllList(T entity)
*/
//Page findPage(Page page, T t);
}

@ -1,27 +0,0 @@
package org.opsli.core.conf;
import org.opsli.common.annotation.ApiRestController;
import org.opsli.core.prop.ApiPathProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import javax.annotation.Resource;
/**
* 访
* @author C西
*/
@Configuration
public class SpringWebMvcConfig implements WebMvcConfigurer {
@Resource
private ApiPathProperties apiPathProperties;
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
configurer
.addPathPrefix(apiPathProperties.getGlobalPrefix(),c -> c.isAnnotationPresent(ApiRestController.class));
}
}

@ -9,7 +9,7 @@ import org.opsli.modulars.test.entity.TestEntity;
* @BelongsPackage: org.opsli.modulars.test.mapper * @BelongsPackage: org.opsli.modulars.test.mapper
* @Author: Parker * @Author: Parker
* @CreateTime: 2020-09-17 13:01 * @CreateTime: 2020-09-17 13:01
* @Description: TODO * @Description: Mapper
*/ */
@Mapper @Mapper
public interface TestMapper extends BaseMapper<TestEntity> { public interface TestMapper extends BaseMapper<TestEntity> {

@ -1,5 +1,6 @@
package org.opsli.modulars.test.service; package org.opsli.modulars.test.service;
import org.opsli.api.wrapper.test.TestModel;
import org.opsli.core.base.service.interfaces.CrudServiceInterface; import org.opsli.core.base.service.interfaces.CrudServiceInterface;
import org.opsli.modulars.test.entity.TestEntity; import org.opsli.modulars.test.entity.TestEntity;
@ -10,13 +11,13 @@ import org.opsli.modulars.test.entity.TestEntity;
* @CreateTime: 2020-09-17 13:07 * @CreateTime: 2020-09-17 13:07
* @Description: * @Description:
*/ */
public interface ITestService extends CrudServiceInterface<TestEntity> { public interface ITestService extends CrudServiceInterface<TestModel,TestEntity> {
/** /**
* *
* @param testEntity * @param model
* @return * @return
*/ */
TestEntity getByName(TestEntity testEntity); TestModel getByName(TestModel model);
} }

@ -1,5 +1,6 @@
package org.opsli.modulars.test.service.impl; package org.opsli.modulars.test.service.impl;
import org.opsli.api.wrapper.test.TestModel;
import org.opsli.common.annotation.EnableHotData; import org.opsli.common.annotation.EnableHotData;
import org.opsli.common.annotation.HotDataDel; import org.opsli.common.annotation.HotDataDel;
import org.opsli.common.annotation.HotDataPut; import org.opsli.common.annotation.HotDataPut;
@ -25,32 +26,35 @@ import java.util.Collection;
* *
* -- @HotDataPut @HotDataDel * -- @HotDataPut @HotDataDel
* *
*
*/ */
@Service @Service
// 开启热数据标示 不加不生效 // 开启热数据标示 不加不生效
@EnableHotData @EnableHotData
public class TestServiceImpl extends CrudServiceImpl<TestMapper,TestEntity> implements ITestService { public class TestServiceImpl extends CrudServiceImpl<TestMapper, TestModel, TestEntity> implements ITestService {
@Autowired(required = false) @Autowired(required = false)
private TestMapper mapper; private TestMapper mapper;
@Override @Override
public TestEntity getByName(TestEntity testEntity) { public TestModel getByName(TestModel model) {
return mapper.getByName(testEntity); TestEntity entity = super.transformM2T(model);
return super.transformT2M(
mapper.getByName(entity));
} }
// ============== 重写 父类方法 实现热数据操作 ============== // ============== 重写 父类方法 实现热数据操作 ==============
@Override @Override
@HotDataPut @HotDataPut
public TestEntity insert(TestEntity entity) { public TestModel insert(TestModel model) {
return super.insert(entity); return super.insert(model);
} }
@Override @Override
@HotDataPut @HotDataPut
public TestEntity update(TestEntity entity) { public TestModel update(TestModel model) {
return super.update(entity); return super.update(model);
} }
@Override @Override
@ -61,20 +65,8 @@ public class TestServiceImpl extends CrudServiceImpl<TestMapper,TestEntity> impl
@Override @Override
@HotDataDel @HotDataDel
public int delete(TestEntity entity) { public int delete(TestModel model) {
return super.delete(entity); return super.delete(model);
}
@Override
@HotDataDel
public int deleteByLogic(String id) {
return super.deleteByLogic(id);
}
@Override
@HotDataDel
public int deleteByLogic(TestEntity entity) {
return super.deleteByLogic(entity);
} }
@Override @Override
@ -85,21 +77,10 @@ public class TestServiceImpl extends CrudServiceImpl<TestMapper,TestEntity> impl
@Override @Override
@HotDataDel @HotDataDel
public int deleteAll(Collection<TestEntity> entitys) { public int deleteAll(Collection<TestModel> models) {
return super.deleteAll(entitys); return super.deleteAll(models);
}
@Override
@HotDataDel
public int deleteAllByLogic(String[] ids) {
return super.deleteAllByLogic(ids);
} }
@Override
@HotDataDel
public int deleteAllByLogic(Collection<TestEntity> entities) {
return super.deleteAllByLogic(entities);
}
} }

@ -1,9 +1,12 @@
package org.opsli.modulars.test.web; package org.opsli.modulars.test.web;
import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.thread.ThreadUtil;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.opsli.api.base.result.ResultVo;
import org.opsli.api.wrapper.test.TestModel;
import org.opsli.api.web.test.ITestApi;
import org.opsli.common.annotation.ApiRestController; import org.opsli.common.annotation.ApiRestController;
import org.opsli.common.api.ResultVo;
import org.opsli.core.base.concroller.BaseRestController; import org.opsli.core.base.concroller.BaseRestController;
import org.opsli.core.cache.pushsub.enums.CacheType; import org.opsli.core.cache.pushsub.enums.CacheType;
import org.opsli.core.cache.pushsub.msgs.DictMsgFactory; import org.opsli.core.cache.pushsub.msgs.DictMsgFactory;
@ -16,7 +19,6 @@ import org.opsli.plugins.redis.RedisPlugin;
import org.opsli.plugins.redis.lock.RedisLock; import org.opsli.plugins.redis.lock.RedisLock;
import org.opsli.plugins.redis.pushsub.entity.BaseSubMessage; import org.opsli.plugins.redis.pushsub.entity.BaseSubMessage;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -32,7 +34,8 @@ import java.util.concurrent.TimeUnit;
* @Description: * @Description:
*/ */
@ApiRestController("/test") @ApiRestController("/test")
public class TestRestRestController extends BaseRestController<TestEntity, ITestService> { public class TestRestRestController extends BaseRestController<TestModel, TestEntity, ITestService>
implements ITestApi {
private Random random = new Random(); private Random random = new Random();
@ -46,8 +49,8 @@ public class TestRestRestController extends BaseRestController<TestEntity, ITest
@Autowired @Autowired
private RedisLockPlugins redisLockPlugins; private RedisLockPlugins redisLockPlugins;
@ApiOperation(value = "发送邮件", notes = "发送邮件")
@GetMapping("/sendMail") @Override
public ResultVo sendMail(){ public ResultVo sendMail(){
MailModel mailModel = new MailModel(); MailModel mailModel = new MailModel();
mailModel.setTo("meet.carina@foxmail.com"); mailModel.setTo("meet.carina@foxmail.com");
@ -62,7 +65,8 @@ public class TestRestRestController extends BaseRestController<TestEntity, ITest
* Redis * Redis
* @return * @return
*/ */
@GetMapping("/sendMsg") @ApiOperation(value = "发送 Redis 订阅消息", notes = "发送 Redis 订阅消息")
@Override
public ResultVo sendMsg(){ public ResultVo sendMsg(){
BaseSubMessage msg = DictMsgFactory.createMsg("test", "aaa", 123213, CacheType.UPDATE); BaseSubMessage msg = DictMsgFactory.createMsg("test", "aaa", 123213, CacheType.UPDATE);
@ -76,10 +80,11 @@ public class TestRestRestController extends BaseRestController<TestEntity, ITest
/** /**
* Redis * Redis
* @return * @return
*/ */
@GetMapping("/redisTest") @ApiOperation(value = "发送 Redis 测试", notes = "发送 Redis 测试")
@Override
public ResultVo redisTest(){ public ResultVo redisTest(){
boolean ret = redisPlugin.put("opsli:test", "12315"); boolean ret = redisPlugin.put("opsli:test", "12315");
if(ret){ if(ret){
@ -96,7 +101,8 @@ public class TestRestRestController extends BaseRestController<TestEntity, ITest
* Redis * Redis
* @return * @return
*/ */
@GetMapping("/testLock") @ApiOperation(value = "发起 Redis 分布式锁", notes = "发起 Redis 分布式锁")
@Override
public ResultVo testLock(){ public ResultVo testLock(){
// 锁凭证 redisLock 贯穿全程 // 锁凭证 redisLock 贯穿全程
@ -126,52 +132,47 @@ public class TestRestRestController extends BaseRestController<TestEntity, ITest
* *
* @return * @return
*/ */
@GetMapping("/insert") @ApiOperation(value = "新增数据", notes = "新增数据")
public ResultVo insert(TestEntity entity){ @Override
public ResultVo insert(TestModel model){
// 转化对象 处理 ApiModel 与 本地对象
entity.setId(null); model.setName("测试名称"+random.nextInt());
entity.setName("测试名称"+random.nextInt()); model.setRemark("测试备注"+random.nextInt());
entity.setRemark("测试备注"+random.nextInt());
TestEntity saveObj = IService.insert(entity);
if(saveObj == null){
ResultVo success = ResultVo.error("新增对象失败!");
success.put("object",entity);
return success;
}
ResultVo success = ResultVo.success("新增对象成功!"); // 调用新增方法
success.put("object",saveObj); TestModel insert = IService.insert(model);
return success; ResultVo resultVo = new ResultVo();
resultVo.setMsg("新增成功");
resultVo.put("data",insert);
return resultVo;
} }
/** /**
* *
* @return * @return
*/ */
@GetMapping("/update") @ApiOperation(value = "修改数据", notes = "修改数据")
public ResultVo update(TestEntity entity){ @Override
public ResultVo update(TestModel model){
// 转化对象 处理 ApiModel 与 本地对象
if(StringUtils.isEmpty(entity.getId())){ if(StringUtils.isEmpty(model.getId())){
entity.setId(String.valueOf(random.nextLong())); model.setId(String.valueOf(random.nextLong()));
} }
entity.setName("修改名称"+random.nextInt()); model.setName("修改名称"+random.nextInt());
entity.setRemark("修改备注"+random.nextInt()); model.setRemark("修改备注"+random.nextInt());
TestEntity saveObj = IService.update(entity); // 不需要做 锁状态处理,需要判断是否成功 能往下走的只能是成功
if(saveObj == null){ TestModel update = IService.update(model);
ResultVo success = ResultVo.error("修改对象失败!");
success.put("object",entity);
return success;
}
ResultVo success = ResultVo.success("修改对象成功!");
success.put("object",saveObj);
return success; ResultVo resultVo = new ResultVo();
resultVo.setMsg("修改成功");
resultVo.put("data",update);
return resultVo;
} }
@ -179,13 +180,13 @@ public class TestRestRestController extends BaseRestController<TestEntity, ITest
* *
* @return * @return
*/ */
@GetMapping("/get") @ApiOperation(value = "查看对象", notes = "查看对象")
public ResultVo get(TestEntity entity){ @Override
ResultVo success = ResultVo.success("操作成功!"); public ResultVo get(TestModel model){
TestEntity byName = IService.getByName(entity); // 转化对象 处理 ApiModel 与 本地对象
success.put("object",entity); ResultVo resultVo = new ResultVo();
success.put("byName",byName); resultVo.put("data",model);
return success; return resultVo;
} }
@ -193,7 +194,8 @@ public class TestRestRestController extends BaseRestController<TestEntity, ITest
* *
* @return * @return
*/ */
@GetMapping("/del") @ApiOperation(value = "删除对象", notes = "删除对象")
@Override
public ResultVo del(String id){ public ResultVo del(String id){
TestEntity testEntity1 = new TestEntity(); TestEntity testEntity1 = new TestEntity();
@ -202,9 +204,36 @@ public class TestRestRestController extends BaseRestController<TestEntity, ITest
List<TestEntity> idList = new ArrayList<>(); List<TestEntity> idList = new ArrayList<>();
idList.add(testEntity1); idList.add(testEntity1);
//count = IService.delete(id);
//count = IService.delete(testEntity1);
//count = IService.deleteAll(idList);
IService.deleteAll(ids);
ResultVo resultVo = new ResultVo();
resultVo.put("data",id);
resultVo.setMsg("删除对象成功");
return resultVo;
}
/**
*
* @return
*/
@ApiOperation(value = "删除全部对象", notes = "删除全部对象")
@Override
public ResultVo delAll(){
//IService.
int count = 0; int count = 0;
count = IService.delete(id); //count = IService.delete(id);
//count = IService.delete(testEntity1); //count = IService.delete(testEntity1);
@ -213,18 +242,12 @@ public class TestRestRestController extends BaseRestController<TestEntity, ITest
//count = IService.deleteAll(idList); //count = IService.deleteAll(idList);
if(count == 0){
ResultVo success = ResultVo.error("删除对象失败!");
success.put("object",id);
return success;
}
ResultVo success = ResultVo.success("删除对象成功!");
success.put("object",id);
return success; ResultVo resultVo = new ResultVo();
resultVo.setMsg("删除对象成功");
return resultVo;
} }
} }

@ -40,13 +40,6 @@
<!-- 插件版本 ${plugins.version} --> <!-- 插件版本 ${plugins.version} -->
<!-- 模块版本 ${modulars.version}--> <!-- 模块版本 ${modulars.version}-->
<!-- 引入公共模块 -->
<dependency>
<groupId>org.opsliframework.boot</groupId>
<artifactId>opsli-common</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- 引入核心模块 --> <!-- 引入核心模块 -->
<dependency> <dependency>
<groupId>org.opsliframework.boot</groupId> <groupId>org.opsliframework.boot</groupId>

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>opsli-web</artifactId> <artifactId>opsli-starter</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>

@ -7,7 +7,6 @@ import org.springframework.context.ConfigurableApplicationContext;
import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
@SpringBootApplication() @SpringBootApplication()
public class OpsliApplication { public class OpsliApplication {

@ -47,11 +47,13 @@
<!-- 引入 modules --> <!-- 引入 modules -->
<modules> <modules>
<module>opsli-web</module> <module>opsli-api</module>
<module>opsli-core</module> <module>opsli-base-support</module>
<module>opsli-common</module> <!-- <module>opsli-common</module>-->
<!-- <module>opsli-core</module>-->
<module>opsli-plugins</module> <module>opsli-plugins</module>
<module>opsli-modulars</module> <module>opsli-modulars</module>
<module>opsli-starter</module>
</modules> </modules>
<!-- 全局版本 --> <!-- 全局版本 -->
@ -188,41 +190,6 @@
</dependency> </dependency>
<!-- ———————————————————— 集成数据库相关配置 - 结束 ———————————————————— --> <!-- ———————————————————— 集成数据库相关配置 - 结束 ———————————————————— -->
<!-- ———————————————————— 集成SwaggerApi - 开始 ———————————————————— -->
<!-- Swagger API文档 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>1.9.3</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-bean-validators</artifactId>
<version>2.9.2</version>
</dependency>
<!-- # 增加两个配置解决 NumberFormatException -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.22</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.22</version>
</dependency>
<!-- ———————————————————— 集成SwaggerApi - 结束 ———————————————————— -->
<!-- ———————————————————— 集成工具 - 开始 ———————————————————— --> <!-- ———————————————————— 集成工具 - 开始 ———————————————————— -->
<!-- commons --> <!-- commons -->
<dependency> <dependency>
@ -248,6 +215,9 @@
<version>${guava.version}</version> <version>${guava.version}</version>
</dependency> </dependency>
<!-- Lombok --> <!-- Lombok -->
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>

Loading…
Cancel
Save