mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 06:27:21 +00:00
(feature) (common) add sys parameter setting (#377)
Co-authored-by: jolunoluo
This commit is contained in:
@@ -59,16 +59,7 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>${mybatis-spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
@@ -78,24 +69,6 @@
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis-spring</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter-test</artifactId>
|
||||
<version>${mybatis.test.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>${pagehelper.spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.tencent.supersonic.chat.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.tencent.supersonic.common.pojo.SysParameter;
|
||||
import com.tencent.supersonic.common.persistence.dataobject.SysParameterDO;
|
||||
import com.tencent.supersonic.common.persistence.mapper.SysParameterMapper;
|
||||
import com.tencent.supersonic.common.service.SysParameterService;
|
||||
import com.tencent.supersonic.common.util.BeanMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SysParameterServiceImpl
|
||||
extends ServiceImpl<SysParameterMapper, SysParameterDO> implements SysParameterService {
|
||||
|
||||
@Override
|
||||
public SysParameter getSysParameter() {
|
||||
List<SysParameterDO> list = list();
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return new SysParameter();
|
||||
}
|
||||
return convert(list.iterator().next());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(SysParameter sysParameter) {
|
||||
SysParameterDO chatParameterDO = convert(sysParameter);
|
||||
saveOrUpdate(chatParameterDO);
|
||||
}
|
||||
|
||||
private SysParameter convert(SysParameterDO sysParameterDO) {
|
||||
SysParameter chatParameter = new SysParameter();
|
||||
BeanMapper.mapper(sysParameterDO, chatParameter);
|
||||
chatParameter.setParameters(JSONObject.parseObject(sysParameterDO.getParameters(), List.class));
|
||||
chatParameter.setAdmin(sysParameterDO.getAdmin());
|
||||
return chatParameter;
|
||||
}
|
||||
|
||||
private SysParameterDO convert(SysParameter sysParameter) {
|
||||
SysParameterDO sysParameterDO = new SysParameterDO();
|
||||
BeanMapper.mapper(sysParameter, sysParameterDO);
|
||||
sysParameterDO.setParameters(JSONObject.toJSONString(sysParameter.getParameters()));
|
||||
sysParameterDO.setAdmin(sysParameter.getAdmin());
|
||||
return sysParameterDO;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,11 +20,6 @@
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.hankcs</groupId>
|
||||
<artifactId>hanlp</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user