commit
a8198bcb90
@ -1,348 +0,0 @@
|
||||
package com.rymcu.vertical.core.service.props;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 动态配置文件,可以设置更新周期
|
||||
* 配置读取读取服务
|
||||
* @author ronger
|
||||
*/
|
||||
@Component
|
||||
public class DynProps4FilesService {
|
||||
private Logger _log = LoggerFactory.getLogger(DynProps4FilesService.class);
|
||||
/**
|
||||
* 属性文件
|
||||
*/
|
||||
private File[] fileArray;
|
||||
/**
|
||||
* 启动延时
|
||||
*/
|
||||
private long delay;
|
||||
/**
|
||||
* 更新周期
|
||||
*/
|
||||
private long period;
|
||||
/**
|
||||
* 属性对象
|
||||
*/
|
||||
private Properties property = new Properties();
|
||||
/**
|
||||
* 文件监控器
|
||||
*/
|
||||
private List<FileMonitor> monitors;
|
||||
|
||||
/**
|
||||
* @param files 属性文件
|
||||
* @param delay 从<code>DynProps</code>被创建到第一次动态监视的时间间隔. 约束范围delay > 0
|
||||
* @param period 动态监视的时间间隔. 约束范围period >= 0;等于0表示不执行动态监视,退化为静态配置文件.
|
||||
*/
|
||||
public DynProps4FilesService(File[] files, long delay, long period) throws IOException {
|
||||
this.fileArray = files;
|
||||
this.delay = delay;
|
||||
this.period = period;
|
||||
init();
|
||||
}
|
||||
|
||||
public DynProps4FilesService(List<String> fileNames, long delay, long period) throws IOException {
|
||||
this.delay = delay;
|
||||
this.period = period;
|
||||
fileArray = new File[fileNames.size()];
|
||||
int index = 0;
|
||||
for (String oriFileName : fileNames) {
|
||||
String fileName = oriFileName.trim();
|
||||
if (StringUtils.indexOfIgnoreCase(fileName, "classpath:") == 0) {
|
||||
fileArray[index++] = new File(
|
||||
this.getClass().getClassLoader().getResource("").getPath() + File.separator +
|
||||
fileName.substring("classpath:".length()));
|
||||
} else {
|
||||
fileArray[index++] = new File(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
public DynProps4FilesService(String fileNames, long delay, long period) throws IOException {
|
||||
this.delay = delay;
|
||||
this.period = period;
|
||||
boolean isClassPath = false;
|
||||
if (fileNames.startsWith("classpath")) {
|
||||
fileNames = fileNames.substring("classpath:".length());
|
||||
isClassPath = true;
|
||||
}
|
||||
String[] fileName = fileNames.split("[,|,|;|;]");
|
||||
fileArray = new File[fileName.length];
|
||||
if (isClassPath) {
|
||||
for (int i = 0; i < fileName.length; i++) {
|
||||
fileArray[i] = new File(this.getClass().getClassLoader().getResource("").getPath() + fileName[i]);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < fileName.length; i++) {
|
||||
fileArray[i] = new File(fileName[i]);
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public DynProps4FilesService(File[] files, long period) throws IOException {
|
||||
this(files, 0, period);
|
||||
}
|
||||
|
||||
public DynProps4FilesService(String fileNames, long period) throws IOException {
|
||||
this.period = period;
|
||||
this.delay = 0;
|
||||
String[] fileName = fileNames.split("[,|,|;|;]");
|
||||
|
||||
File[] files = new File[fileName.length];
|
||||
for (int i = 0; i < fileName.length; i++) {
|
||||
files[i] = new File(fileName[i]);
|
||||
}
|
||||
init();
|
||||
}
|
||||
|
||||
public DynProps4FilesService() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载属性文件,启动监控
|
||||
*
|
||||
* @throws IOException 加载文件时出现IO异常
|
||||
*/
|
||||
protected void load() throws IOException {
|
||||
update();
|
||||
if (monitors == null) {
|
||||
monitors = new ArrayList<FileMonitor>(fileArray.length);
|
||||
} else {
|
||||
for (FileMonitor monitor : monitors) {
|
||||
try {
|
||||
monitor.timer.cancel();
|
||||
} catch (Exception e) {
|
||||
_log.warn(String.format("Timer for file [%s] cancelling failed.", monitor.file.getAbsolutePath()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (File file : fileArray) {
|
||||
long lastModify = file.lastModified();
|
||||
FileMonitor monitor = new FileMonitor(file, lastModify);
|
||||
this.monitors.add(monitor);
|
||||
monitor.doTask();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果文件有更新调用此方法载入
|
||||
*
|
||||
* @throws IOException 没有找到文件或读文件错误时抛出
|
||||
*/
|
||||
protected void update() throws IOException {
|
||||
for (File file : fileArray) {
|
||||
InputStream in = null;
|
||||
try {
|
||||
in = new FileInputStream(file);
|
||||
this.property.load(in);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof IOException) {
|
||||
throw (IOException) e;
|
||||
}
|
||||
|
||||
throw new IOException(e);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(in);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key 需要获取属性值的KEY
|
||||
* @param def 默认值
|
||||
*
|
||||
* @return 属性值
|
||||
*/
|
||||
public String getProperty(String key, String def) {
|
||||
String val = this.property.getProperty(key);
|
||||
return val == null ? def : val.trim();
|
||||
}
|
||||
|
||||
public String getProperty(String key) {
|
||||
String val = this.property.getProperty(key);
|
||||
return val == null ? null : val.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置属性值
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
public void setProperty(String key, String value) {
|
||||
this.property.setProperty(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key 需要获取属性值的KEY
|
||||
* @param def 默认值
|
||||
*
|
||||
* @return 属性值
|
||||
*
|
||||
* @throws NumberFormatException 如果属性值不是整数形式
|
||||
*/
|
||||
public int getInt(String key, int def) throws NumberFormatException {
|
||||
String val = this.getProperty(key);
|
||||
return val == null ? def : Integer.parseInt(val);
|
||||
}
|
||||
|
||||
public int getInt(String key) throws NumberFormatException {
|
||||
return getInt(key, 0);
|
||||
}
|
||||
|
||||
public float getFloat(String key, float def) throws NumberFormatException {
|
||||
String val = this.getProperty(key);
|
||||
return val == null ? def : Float.parseFloat(val);
|
||||
}
|
||||
|
||||
public float getFloat(String key) throws NumberFormatException {
|
||||
return getFloat(key, 0.0f);
|
||||
}
|
||||
|
||||
public double getDouble(String key, double def) {
|
||||
String val = this.getProperty(key);
|
||||
return val == null ? def : Double.parseDouble(val);
|
||||
}
|
||||
public double getDouble(String key) throws NumberFormatException {
|
||||
return getDouble(key,0.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public long getLong(String key, long def) {
|
||||
String val = this.getProperty(key);
|
||||
return val == null ? def : Long.parseLong(val);
|
||||
}
|
||||
|
||||
public long getLong(String key) throws NumberFormatException {
|
||||
return getLong(key, 0L);
|
||||
}
|
||||
|
||||
private void init() throws IOException {
|
||||
for (File file : fileArray) {
|
||||
if (!file.exists() || file.length() == 0) {
|
||||
throw new IllegalArgumentException("动态配置文件 " + file.getAbsolutePath() + " 不存在,或是空文件!");
|
||||
}
|
||||
if (delay <= 0) {
|
||||
throw new IllegalArgumentException("定时器延时时间不能为负数!");
|
||||
}
|
||||
if (period <= 0) {
|
||||
throw new IllegalArgumentException("定时器更新周期不能为负数!");
|
||||
}
|
||||
this.property = new Properties();
|
||||
this.load();// 初始构造时,执行第一次加载.
|
||||
}
|
||||
//当进程终止时,取消定时任务
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownHook()));
|
||||
}
|
||||
|
||||
private class ShutdownHook implements Runnable {
|
||||
private DynProps4FilesService dynProps4FilesService;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println("Monitors cancelling start ...");
|
||||
if (monitors != null) {
|
||||
for (FileMonitor monitor : monitors) {
|
||||
try {
|
||||
monitor.timer.cancel();
|
||||
} catch (Exception e) {
|
||||
_log.warn(String.format("Timer for file [%s] cancelling failed.",
|
||||
monitor.file.getAbsolutePath()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:一个内部私有类,实时监控文件有没有更新,如果更新则自动载入
|
||||
*/
|
||||
private class FileMonitor {
|
||||
|
||||
private long lastModifiedTime;
|
||||
private File file;
|
||||
/**
|
||||
* 定时器,以守护线程方式启动
|
||||
*/
|
||||
private Timer timer = new Timer(true);
|
||||
|
||||
/**
|
||||
* @param lastMonitorTime 最后的更新时间
|
||||
*/
|
||||
private FileMonitor(File file, long lastMonitorTime) {
|
||||
this.file = file;
|
||||
this.lastModifiedTime = lastMonitorTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对文件进行实时监控,有更新则自动载入
|
||||
*/
|
||||
private void doTask() {
|
||||
if (delay < 0) {
|
||||
delay = 0L;
|
||||
}
|
||||
if (period <= 0) {
|
||||
return;// 如果更新周期非正数,则退化成静态配置文件.
|
||||
}
|
||||
timer.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
long t = file.lastModified();
|
||||
// 文件被删除
|
||||
// 如果动态更新过程中,配置文件被强制删除了,本次不执行任何更新.或者对配置文件进行恢复
|
||||
if (t == 0) {
|
||||
try {
|
||||
if (file.createNewFile()) {
|
||||
OutputStream fos = new FileOutputStream(file);
|
||||
property.store(fos, "文件被删除,自动恢复.");
|
||||
fos.close();
|
||||
}
|
||||
} catch (IOException ioe2) {
|
||||
// 这里基本上只有磁盘空间满才会发生,暂时不处理
|
||||
}
|
||||
return;
|
||||
}
|
||||
// 文件被更新
|
||||
if (t > lastModifiedTime) {
|
||||
lastModifiedTime = t;
|
||||
// 2秒后还在改变,则本次更新不做处理
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(2);
|
||||
} catch (InterruptedException e) {
|
||||
// do nothing
|
||||
}
|
||||
if (t != file.lastModified()) {
|
||||
_log.info("文件可能未更新完成,本次不更新!");
|
||||
} else {
|
||||
try {
|
||||
property.clear();
|
||||
update();
|
||||
_log.info("UPDATED " + file.getAbsolutePath());
|
||||
} catch (IOException ioe) {
|
||||
_log.error("UPDATING " + file.getAbsolutePath() + " failed", ioe);
|
||||
}
|
||||
}
|
||||
_log.debug("-----------------------:" + property.keySet());
|
||||
}
|
||||
}// end run()
|
||||
}, delay, period);
|
||||
}
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ import java.util.Set;
|
||||
|
||||
/**
|
||||
* Redis 服务接口
|
||||
* Jimersy Lee
|
||||
* @author Jimersy Lee
|
||||
* 2017-09-18 14:58:21
|
||||
*/
|
||||
public interface RedisService {
|
||||
|
@ -3,19 +3,16 @@ package com.rymcu.vertical.core.service.redis.impl;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JavaType;
|
||||
import com.rymcu.vertical.core.service.props.DynProps4FilesService;
|
||||
import com.rymcu.vertical.config.RedisProperties;
|
||||
import com.rymcu.vertical.core.service.redis.RedisResult;
|
||||
import com.rymcu.vertical.core.service.redis.RedisService;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
import redis.clients.jedis.JedisPoolConfig;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
@ -34,14 +31,10 @@ public class RedisServiceImpl implements RedisService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(RedisServiceImpl.class);
|
||||
|
||||
|
||||
private static JedisPool pool = null;
|
||||
|
||||
@Resource
|
||||
private DynProps4FilesService dynProps4Files;
|
||||
|
||||
@Resource
|
||||
private Environment env;
|
||||
private RedisProperties redisProperties;
|
||||
|
||||
|
||||
/**
|
||||
@ -53,25 +46,23 @@ public class RedisServiceImpl implements RedisService {
|
||||
if (pool != null) {
|
||||
return;
|
||||
}
|
||||
/*JedisPoolConfig config = new JedisPoolConfig();
|
||||
config.setMaxIdle(dynProps4Files.getInt("REDIS_MAX_IDLE", JedisPoolConfig.DEFAULT_MAX_IDLE));
|
||||
config.setMaxTotal(dynProps4Files.getInt("REDIS_MAX_TOTAL", JedisPoolConfig.DEFAULT_MAX_TOTAL));
|
||||
config.setMaxWaitMillis(dynProps4Files.getLong("REDIS_MAX_WAIT", JedisPoolConfig.DEFAULT_MAX_WAIT_MILLIS));
|
||||
config.setTestOnBorrow(true);
|
||||
pool = new JedisPool(config, dynProps4Files.getProperty("REDIS_HOST"),
|
||||
dynProps4Files.getInt("REDIS_PORT", 6379), dynProps4Files.getInt(
|
||||
"REDIS_MAX_WAIT", 1000), dynProps4Files.getProperty("REDIS_PASSWORD", null));*/
|
||||
|
||||
JedisPoolConfig config = new JedisPoolConfig();
|
||||
config.setMaxIdle(dynProps4Files.getInt("REDIS_MAX_IDLE", JedisPoolConfig.DEFAULT_MAX_IDLE));
|
||||
config.setMaxTotal(dynProps4Files.getInt("REDIS_MAX_TOTAL", JedisPoolConfig.DEFAULT_MAX_TOTAL));
|
||||
config.setMaxWaitMillis(dynProps4Files.getLong("REDIS_MAX_WAIT", JedisPoolConfig.DEFAULT_MAX_WAIT_MILLIS));
|
||||
config.setTestOnBorrow(true);
|
||||
pool = new JedisPool(config, env.getProperty("spring.redis.host"),
|
||||
dynProps4Files.getInt("REDIS_PORT", 6379), dynProps4Files.getInt(
|
||||
"REDIS_MAX_WAIT", 1000), dynProps4Files.getProperty("REDIS_PASSWORD", env.getProperty("spring.redis.password")));
|
||||
|
||||
pool = getJedisPool();
|
||||
}
|
||||
|
||||
private JedisPool getJedisPool() {
|
||||
if (pool == null) {
|
||||
synchronized (RedisServiceImpl.class) {
|
||||
if (pool == null) {
|
||||
pool = new JedisPool(redisProperties, redisProperties.getHost(),
|
||||
redisProperties.getPort(), redisProperties.getConnectionTimeout(),
|
||||
redisProperties.getSoTimeout(), redisProperties.getPassword(),
|
||||
redisProperties.getDatabase(), redisProperties.getClientName(),
|
||||
redisProperties.isSsl(), redisProperties.getSslSocketFactory(),
|
||||
redisProperties.getSslParameters(), redisProperties.getHostnameVerifier());
|
||||
}
|
||||
}
|
||||
}
|
||||
return pool;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -106,7 +97,7 @@ public class RedisServiceImpl implements RedisService {
|
||||
if (jedis == null) {
|
||||
return;
|
||||
}
|
||||
IOUtils.closeQuietly(jedis);
|
||||
jedis.close();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,4 +51,8 @@ public class ArticleDTO {
|
||||
private List<ArticleTagDTO> tags;
|
||||
|
||||
private List<CommentDTO> articleComments;
|
||||
|
||||
private List<PortfolioArticleDTO> portfolios;
|
||||
|
||||
private Integer sortNo;
|
||||
}
|
||||
|
@ -8,12 +8,12 @@ import lombok.Data;
|
||||
@Data
|
||||
public class Author {
|
||||
|
||||
private String idUser;
|
||||
private Integer idUser;
|
||||
|
||||
private String userNickname;
|
||||
|
||||
private String userAvatarURL;
|
||||
|
||||
private Integer userArticleCount;
|
||||
private String userArticleCount;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.rymcu.vertical.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
@Data
|
||||
public class PortfolioArticleDTO {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private Integer idPortfolio;
|
||||
|
||||
private Integer idArticle;
|
||||
|
||||
private String headImgUrl;
|
||||
|
||||
private String portfolioTitle;
|
||||
|
||||
private Integer sortNo;
|
||||
|
||||
}
|
35
src/main/java/com/rymcu/vertical/dto/PortfolioDTO.java
Normal file
35
src/main/java/com/rymcu/vertical/dto/PortfolioDTO.java
Normal file
@ -0,0 +1,35 @@
|
||||
package com.rymcu.vertical.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
@Data
|
||||
public class PortfolioDTO {
|
||||
|
||||
private Integer idPortfolio;
|
||||
/** 作品集头像 */
|
||||
private String headImgUrl;
|
||||
/** 作品集作者 */
|
||||
private Integer portfolioAuthorId;
|
||||
/** 作品集作者 */
|
||||
private String portfolioAuthorName;
|
||||
/** 作品集作者头像 */
|
||||
private String portfolioAuthorAvatarUrl;
|
||||
/** 作品集名称 */
|
||||
private String portfolioTitle;
|
||||
/** 作品集介绍 */
|
||||
private String portfolioDescription;
|
||||
/** 更新时间 */
|
||||
private Date updatedTime;
|
||||
/** 过去时长 */
|
||||
private String timeAgo;
|
||||
|
||||
private Author portfolioAuthor;
|
||||
|
||||
private Integer articleNumber;
|
||||
|
||||
}
|
37
src/main/java/com/rymcu/vertical/entity/Portfolio.java
Normal file
37
src/main/java/com/rymcu/vertical/entity/Portfolio.java
Normal file
@ -0,0 +1,37 @@
|
||||
package com.rymcu.vertical.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "vertical_portfolio")
|
||||
public class Portfolio {
|
||||
/** 主键 */
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
@Column(name = "id")
|
||||
private Integer idPortfolio;
|
||||
/** 作品集头像 */
|
||||
@Column(name = "portfolio_head_img_url")
|
||||
private String headImgUrl;
|
||||
/** 作品集名称 */
|
||||
private String portfolioTitle;
|
||||
/** 作品集作者 */
|
||||
private Integer portfolioAuthorId;
|
||||
/** 作品集介绍 */
|
||||
private String portfolioDescription;
|
||||
/** 作品集介绍 Html */
|
||||
private String portfolioDescriptionHtml;
|
||||
/** 创建时间 */
|
||||
private Date createdTime;
|
||||
/** 更新时间 */
|
||||
private Date updatedTime;
|
||||
}
|
44
src/main/java/com/rymcu/vertical/entity/SpecialDay.java
Normal file
44
src/main/java/com/rymcu/vertical/entity/SpecialDay.java
Normal file
@ -0,0 +1,44 @@
|
||||
package com.rymcu.vertical.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
@Data
|
||||
@Table(name="vertical_special_day")
|
||||
public class SpecialDay implements Serializable,Cloneable{
|
||||
/** */
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idSpecialDay;
|
||||
/** 名称 */
|
||||
private String specialDayName;
|
||||
/** 权重/优先级,小数优秀 */
|
||||
private Integer weights;
|
||||
/** 开始时间 */
|
||||
private Date startTime;
|
||||
/** 过期时间 */
|
||||
private Date expirationTime;
|
||||
/** 是否重复 */
|
||||
private Integer repeat;
|
||||
/** 重复周期 */
|
||||
private Integer repeatCycle;
|
||||
/** 0:天1:周2:月3:年 */
|
||||
private Integer repeatCycleUnit;
|
||||
/** 创建时间 */
|
||||
private Date createdTime;
|
||||
/** 图片路径 */
|
||||
private String imgUrl;
|
||||
/** 执行全局样式 */
|
||||
private String cssStyle;
|
||||
|
||||
}
|
49
src/main/java/com/rymcu/vertical/entity/WxUser.java
Normal file
49
src/main/java/com/rymcu/vertical/entity/WxUser.java
Normal file
@ -0,0 +1,49 @@
|
||||
package com.rymcu.vertical.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "vertical_wx_user")
|
||||
public class WxUser {
|
||||
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idWxUser;
|
||||
|
||||
private Boolean subscribe;
|
||||
|
||||
private String openId;
|
||||
|
||||
private String nickname;
|
||||
|
||||
private String sexDesc;
|
||||
|
||||
private Integer sex;
|
||||
|
||||
private String language;
|
||||
|
||||
private String city;
|
||||
|
||||
private String province;
|
||||
|
||||
private String country;
|
||||
|
||||
private String headImgUrl;
|
||||
|
||||
private Long subscribeTime;
|
||||
|
||||
private String unionId;
|
||||
|
||||
private String appId;
|
||||
|
||||
private String actToken;
|
||||
}
|
@ -3,7 +3,7 @@ package com.rymcu.vertical.mapper;
|
||||
import com.rymcu.vertical.core.mapper.Mapper;
|
||||
import com.rymcu.vertical.dto.ArticleDTO;
|
||||
import com.rymcu.vertical.dto.ArticleTagDTO;
|
||||
import com.rymcu.vertical.dto.Author;
|
||||
import com.rymcu.vertical.dto.PortfolioArticleDTO;
|
||||
import com.rymcu.vertical.entity.Article;
|
||||
import com.rymcu.vertical.entity.ArticleContent;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -23,13 +23,6 @@ public interface ArticleMapper extends Mapper<Article> {
|
||||
*/
|
||||
List<ArticleDTO> selectArticles(@Param("searchText") String searchText, @Param("tag") String tag);
|
||||
|
||||
/**
|
||||
* 根据用户 ID 获取作者信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Author selectAuthor(@Param("id") Integer id);
|
||||
|
||||
/**
|
||||
* 根据文章 ID 查询文章
|
||||
* @param id
|
||||
@ -119,4 +112,27 @@ public interface ArticleMapper extends Mapper<Article> {
|
||||
* @return
|
||||
*/
|
||||
Integer deleteUnusedArticleTag(@Param("idArticleTag") Integer idArticleTag);
|
||||
|
||||
/**
|
||||
* 查询作品集下文章
|
||||
* @param idPortfolio
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> selectArticlesByIdPortfolio(@Param("idPortfolio") Integer idPortfolio);
|
||||
|
||||
/**
|
||||
* 查询作品集未绑定文章
|
||||
* @param idPortfolio
|
||||
* @param searchText
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> selectUnbindArticlesByIdPortfolio(@Param("idPortfolio") Integer idPortfolio, @Param("searchText") String searchText, @Param("idUser") Integer idUser);
|
||||
|
||||
/**
|
||||
* 查询文章所属作品集列表
|
||||
* @param idArticle
|
||||
* @return
|
||||
*/
|
||||
List<PortfolioArticleDTO> selectPortfolioArticles(@Param("idArticle") Integer idArticle);
|
||||
}
|
||||
|
76
src/main/java/com/rymcu/vertical/mapper/PortfolioMapper.java
Normal file
76
src/main/java/com/rymcu/vertical/mapper/PortfolioMapper.java
Normal file
@ -0,0 +1,76 @@
|
||||
package com.rymcu.vertical.mapper;
|
||||
|
||||
import com.rymcu.vertical.core.mapper.Mapper;
|
||||
import com.rymcu.vertical.dto.PortfolioDTO;
|
||||
import com.rymcu.vertical.entity.Portfolio;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
public interface PortfolioMapper extends Mapper<Portfolio> {
|
||||
/**
|
||||
* 查询用户作品集
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
List<PortfolioDTO> selectUserPortfoliosByIdUser(@Param("idUser") Integer idUser);
|
||||
|
||||
/**
|
||||
* 查询作品集
|
||||
* @param id
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
PortfolioDTO selectPortfolioDTOById(@Param("id") Integer id, @Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* 统计作品集下文章数
|
||||
* @param idPortfolio
|
||||
* @return
|
||||
*/
|
||||
Integer selectCountArticleNumber(@Param("idPortfolio") Integer idPortfolio);
|
||||
|
||||
/**
|
||||
* 查询文章是否已绑定
|
||||
* @param idArticle
|
||||
* @param idPortfolio
|
||||
* @return
|
||||
*/
|
||||
Integer selectCountPortfolioArticle(@Param("idArticle") Integer idArticle, @Param("idPortfolio") Integer idPortfolio);
|
||||
|
||||
/**
|
||||
* 插入文章与作品集绑定数据
|
||||
* @param idArticle
|
||||
* @param idPortfolio
|
||||
* @param maxSortNo
|
||||
* @return
|
||||
*/
|
||||
Integer insertPortfolioArticle(@Param("idArticle") Integer idArticle, @Param("idPortfolio") Integer idPortfolio, @Param("maxSortNo") Integer maxSortNo);
|
||||
|
||||
/**
|
||||
* 查询作品集下最大排序号
|
||||
* @param idPortfolio
|
||||
* @return
|
||||
*/
|
||||
Integer selectMaxSortNo(@Param("idPortfolio") Integer idPortfolio);
|
||||
|
||||
/**
|
||||
* 更新文章排序号
|
||||
* @param idPortfolio
|
||||
* @param idArticle
|
||||
* @param sortNo
|
||||
* @return
|
||||
*/
|
||||
Integer updateArticleSortNo(@Param("idPortfolio") Integer idPortfolio, @Param("idArticle") Integer idArticle, @Param("sortNo") Integer sortNo);
|
||||
|
||||
/**
|
||||
* 取消绑定文章
|
||||
* @param idPortfolio
|
||||
* @param idArticle
|
||||
* @return
|
||||
*/
|
||||
Integer unbindArticle(@Param("idPortfolio") Integer idPortfolio, @Param("idArticle") Integer idArticle);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.rymcu.vertical.mapper;
|
||||
|
||||
import com.rymcu.vertical.core.mapper.Mapper;
|
||||
import com.rymcu.vertical.entity.SpecialDay;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
public interface SpecialDayMapper extends Mapper<SpecialDay> {
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package com.rymcu.vertical.mapper;
|
||||
|
||||
import com.rymcu.vertical.core.mapper.Mapper;
|
||||
import com.rymcu.vertical.dto.Author;
|
||||
import com.rymcu.vertical.dto.UserDTO;
|
||||
import com.rymcu.vertical.dto.UserInfoDTO;
|
||||
import com.rymcu.vertical.entity.User;
|
||||
@ -106,4 +107,10 @@ public interface UserMapper extends Mapper<User> {
|
||||
* @return
|
||||
*/
|
||||
Integer checkNicknameByIdUser(@Param("idUser") Integer idUser, @Param("nickname") String nickname);
|
||||
/**
|
||||
* 根据用户 ID 获取作者信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Author selectAuthor(@Param("id") Integer id);
|
||||
}
|
10
src/main/java/com/rymcu/vertical/mapper/WxUserMapper.java
Normal file
10
src/main/java/com/rymcu/vertical/mapper/WxUserMapper.java
Normal file
@ -0,0 +1,10 @@
|
||||
package com.rymcu.vertical.mapper;
|
||||
|
||||
import com.rymcu.vertical.core.mapper.Mapper;
|
||||
import com.rymcu.vertical.entity.WxUser;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
public interface WxUserMapper extends Mapper<WxUser> {
|
||||
}
|
@ -78,13 +78,31 @@ public interface ArticleService extends Service<Article> {
|
||||
/**
|
||||
* 获取分享链接数据
|
||||
* @param id
|
||||
* @throws BaseApiException
|
||||
* @return
|
||||
*/
|
||||
Map share(Integer id) throws BaseApiException;
|
||||
|
||||
/**
|
||||
* 查询草稿文章类别
|
||||
* @throws BaseApiException
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> findDrafts() throws BaseApiException;
|
||||
|
||||
/**
|
||||
* 查询作品集下文章
|
||||
* @param idPortfolio
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> findArticlesByIdPortfolio(Integer idPortfolio);
|
||||
|
||||
/**
|
||||
* 查询作品集下未绑定文章
|
||||
* @param idPortfolio
|
||||
* @param searchText
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> selectUnbindArticles(Integer idPortfolio, String searchText, Integer idUser);
|
||||
}
|
||||
|
@ -0,0 +1,80 @@
|
||||
package com.rymcu.vertical.service;
|
||||
|
||||
import com.rymcu.vertical.core.service.Service;
|
||||
import com.rymcu.vertical.dto.PortfolioArticleDTO;
|
||||
import com.rymcu.vertical.dto.PortfolioDTO;
|
||||
import com.rymcu.vertical.dto.UserDTO;
|
||||
import com.rymcu.vertical.entity.Portfolio;
|
||||
import com.rymcu.vertical.web.api.exception.BaseApiException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
public interface PortfolioService extends Service<Portfolio> {
|
||||
|
||||
/**
|
||||
* 查询用户作品集
|
||||
* @param userDTO
|
||||
* @return
|
||||
*/
|
||||
List<PortfolioDTO> findUserPortfoliosByUser(UserDTO userDTO);
|
||||
|
||||
/** 查询作品集
|
||||
* @param idPortfolio
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
PortfolioDTO findPortfolioDTOById(Integer idPortfolio, Integer type);
|
||||
|
||||
/**
|
||||
* 保持/更新作品集
|
||||
* @param portfolio
|
||||
* @throws BaseApiException
|
||||
* @return
|
||||
*/
|
||||
Portfolio postPortfolio(Portfolio portfolio) throws BaseApiException;
|
||||
|
||||
/**
|
||||
* 查询作品集下未绑定文章
|
||||
*
|
||||
* @param page
|
||||
* @param rows
|
||||
* @param searchText
|
||||
* @param idPortfolio
|
||||
* @throws BaseApiException
|
||||
* @return
|
||||
*/
|
||||
Map findUnbindArticles(Integer page, Integer rows, String searchText, Integer idPortfolio) throws BaseApiException;
|
||||
|
||||
/**
|
||||
* 绑定文章
|
||||
* @param portfolioArticle
|
||||
* @return
|
||||
*/
|
||||
Map bindArticle(PortfolioArticleDTO portfolioArticle);
|
||||
|
||||
/**
|
||||
* 更新文章排序号
|
||||
* @param portfolioArticle
|
||||
* @return
|
||||
*/
|
||||
Map updateArticleSortNo(PortfolioArticleDTO portfolioArticle);
|
||||
|
||||
/**
|
||||
* 取消绑定文章
|
||||
* @param idPortfolio
|
||||
* @param idArticle
|
||||
* @return
|
||||
*/
|
||||
Map unbindArticle(Integer idPortfolio, Integer idArticle);
|
||||
|
||||
/**
|
||||
* 删除作品集
|
||||
* @param idPortfolio
|
||||
* @return
|
||||
*/
|
||||
Map deletePortfolio(Integer idPortfolio);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.rymcu.vertical.service;
|
||||
|
||||
import com.rymcu.vertical.core.service.Service;
|
||||
import com.rymcu.vertical.entity.SpecialDay;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
public interface SpecialDayService extends Service<SpecialDay> {
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package com.rymcu.vertical.service;
|
||||
|
||||
import com.rymcu.vertical.core.service.Service;
|
||||
import com.rymcu.vertical.dto.Author;
|
||||
import com.rymcu.vertical.dto.UserDTO;
|
||||
import com.rymcu.vertical.dto.UserInfoDTO;
|
||||
import com.rymcu.vertical.entity.User;
|
||||
@ -100,4 +101,11 @@ public interface UserService extends Service<User> {
|
||||
* @return
|
||||
*/
|
||||
Integer findRoleWeightsByUser(Integer idUser);
|
||||
|
||||
/**
|
||||
* 查询作者信息
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
Author selectAuthor(Integer idUser);
|
||||
}
|
||||
|
14
src/main/java/com/rymcu/vertical/service/WxUserService.java
Normal file
14
src/main/java/com/rymcu/vertical/service/WxUserService.java
Normal file
@ -0,0 +1,14 @@
|
||||
package com.rymcu.vertical.service;
|
||||
|
||||
import com.rymcu.vertical.core.service.Service;
|
||||
import com.rymcu.vertical.entity.WxUser;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
public interface WxUserService extends Service<WxUser> {
|
||||
|
||||
WxUser saveUser(WxMpUser wxMpUser, String appId);
|
||||
|
||||
}
|
@ -3,10 +3,7 @@ package com.rymcu.vertical.service.impl;
|
||||
import com.rymcu.vertical.core.constant.NotificationConstant;
|
||||
import com.rymcu.vertical.core.constant.ProjectConstant;
|
||||
import com.rymcu.vertical.core.service.AbstractService;
|
||||
import com.rymcu.vertical.dto.ArticleDTO;
|
||||
import com.rymcu.vertical.dto.ArticleTagDTO;
|
||||
import com.rymcu.vertical.dto.Author;
|
||||
import com.rymcu.vertical.dto.CommentDTO;
|
||||
import com.rymcu.vertical.dto.*;
|
||||
import com.rymcu.vertical.entity.Article;
|
||||
import com.rymcu.vertical.entity.ArticleContent;
|
||||
import com.rymcu.vertical.entity.Tag;
|
||||
@ -149,14 +146,6 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
||||
}
|
||||
newArticle.setArticleTitle(articleTitle);
|
||||
newArticle.setArticleTags(articleTags);
|
||||
if(StringUtils.isNotBlank(articleContentHtml)){
|
||||
Integer length = articleContentHtml.length();
|
||||
if(length > MAX_PREVIEW){
|
||||
length = 200;
|
||||
}
|
||||
String articlePreviewContent = articleContentHtml.substring(0,length);
|
||||
newArticle.setArticlePreviewContent(Html2TextUtil.getContent(articlePreviewContent));
|
||||
}
|
||||
newArticle.setArticleStatus(article.getArticleStatus());
|
||||
newArticle.setUpdatedTime(new Date());
|
||||
articleMapper.updateArticleContent(newArticle.getIdArticle(),articleContent,articleContentHtml);
|
||||
@ -178,6 +167,15 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
||||
newArticle.setArticlePermalink(domain + "/draft/" + newArticle.getIdArticle());
|
||||
newArticle.setArticleLink("/draft/" + newArticle.getIdArticle());
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(articleContentHtml)){
|
||||
Integer length = articleContentHtml.length();
|
||||
if(length > MAX_PREVIEW){
|
||||
length = MAX_PREVIEW;
|
||||
}
|
||||
String articlePreviewContent = articleContentHtml.substring(0,length);
|
||||
newArticle.setArticlePreviewContent(Html2TextUtil.getContent(articlePreviewContent));
|
||||
}
|
||||
articleMapper.updateByPrimaryKeySelective(newArticle);
|
||||
|
||||
map.put("id", newArticle.getIdArticle());
|
||||
@ -263,29 +261,55 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArticleDTO> findArticlesByIdPortfolio(Integer idPortfolio) {
|
||||
List<ArticleDTO> list = articleMapper.selectArticlesByIdPortfolio(idPortfolio);
|
||||
list.forEach(article->{
|
||||
genArticle(article,0);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArticleDTO> selectUnbindArticles(Integer idPortfolio, String searchText, Integer idUser) {
|
||||
List<ArticleDTO> list = articleMapper.selectUnbindArticlesByIdPortfolio(idPortfolio,searchText,idUser);
|
||||
list.forEach(article->{
|
||||
genArticle(article,0);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
private ArticleDTO genArticle(ArticleDTO article, Integer type) {
|
||||
Author author = articleMapper.selectAuthor(article.getArticleAuthorId());
|
||||
Integer ARTICLE_LIST = 0;
|
||||
Integer ARTICLE_VIEW = 1;
|
||||
Integer ARTICLE_EDIT = 2;
|
||||
Author author = genAuthor(article);
|
||||
article.setArticleAuthor(author);
|
||||
article.setTimeAgo(Utils.getTimeAgo(article.getUpdatedTime()));
|
||||
List<ArticleTagDTO> tags = articleMapper.selectTags(article.getIdArticle());
|
||||
article.setTags(tags);
|
||||
if (!type.equals(ARTICLE_LIST)) {
|
||||
ArticleContent articleContent = articleMapper.selectArticleContent(article.getIdArticle());
|
||||
if (type == 1){
|
||||
if (type.equals(ARTICLE_VIEW)){
|
||||
article.setArticleContent(articleContent.getArticleContentHtml());
|
||||
} else if (type == 2) {
|
||||
article.setArticleContent(articleContent.getArticleContent());
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(article.getArticlePreviewContent())){
|
||||
Integer length = articleContent.getArticleContentHtml().length();
|
||||
if(length > MAX_PREVIEW){
|
||||
length = 200;
|
||||
}
|
||||
String articlePreviewContent = articleContent.getArticleContentHtml().substring(0,length);
|
||||
article.setArticlePreviewContent(Html2TextUtil.getContent(articlePreviewContent));
|
||||
}
|
||||
// 获取评论列表数据
|
||||
List<CommentDTO> commentDTOList = commentService.getArticleComments(article.getIdArticle());
|
||||
article.setArticleComments(commentDTOList);
|
||||
// 获取所属作品集列表数据
|
||||
List<PortfolioArticleDTO> portfolioArticleDTOList = articleMapper.selectPortfolioArticles(article.getIdArticle());
|
||||
article.setPortfolios(portfolioArticleDTOList);
|
||||
} else if (type.equals(ARTICLE_EDIT)) {
|
||||
article.setArticleContent(articleContent.getArticleContent());
|
||||
}
|
||||
}
|
||||
return article;
|
||||
}
|
||||
|
||||
private Author genAuthor(ArticleDTO article) {
|
||||
Author author = new Author();
|
||||
author.setUserNickname(article.getArticleAuthorName());
|
||||
author.setUserAvatarURL(article.getArticleAuthorAvatarUrl());
|
||||
author.setIdUser(article.getArticleAuthorId());
|
||||
return author;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,178 @@
|
||||
package com.rymcu.vertical.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rymcu.vertical.core.service.AbstractService;
|
||||
import com.rymcu.vertical.dto.*;
|
||||
import com.rymcu.vertical.entity.Portfolio;
|
||||
import com.rymcu.vertical.entity.User;
|
||||
import com.rymcu.vertical.mapper.PortfolioMapper;
|
||||
import com.rymcu.vertical.service.ArticleService;
|
||||
import com.rymcu.vertical.service.PortfolioService;
|
||||
import com.rymcu.vertical.service.UserService;
|
||||
import com.rymcu.vertical.util.UserUtils;
|
||||
import com.rymcu.vertical.util.Utils;
|
||||
import com.rymcu.vertical.web.api.exception.BaseApiException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
@Service
|
||||
public class PortfolioServiceImpl extends AbstractService<Portfolio> implements PortfolioService {
|
||||
|
||||
@Resource
|
||||
private PortfolioMapper portfolioMapper;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private ArticleService articleService;
|
||||
|
||||
@Override
|
||||
public List<PortfolioDTO> findUserPortfoliosByUser(UserDTO userDTO) {
|
||||
List<PortfolioDTO> list = portfolioMapper.selectUserPortfoliosByIdUser(userDTO.getIdUser());
|
||||
Author author = new Author();
|
||||
author.setIdUser(userDTO.getIdUser());
|
||||
author.setUserAvatarURL(userDTO.getAvatarUrl());
|
||||
author.setUserNickname(userDTO.getNickname());
|
||||
list.forEach(portfolioDTO -> {
|
||||
genPortfolioAuthor(portfolioDTO,author);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortfolioDTO findPortfolioDTOById(Integer idPortfolio, Integer type) {
|
||||
PortfolioDTO portfolio = portfolioMapper.selectPortfolioDTOById(idPortfolio,type);
|
||||
if (portfolio == null) {
|
||||
return new PortfolioDTO();
|
||||
}
|
||||
Author author = userService.selectAuthor(portfolio.getPortfolioAuthorId());
|
||||
genPortfolioAuthor(portfolio,author);
|
||||
Integer articleNumber = portfolioMapper.selectCountArticleNumber(portfolio.getIdPortfolio());
|
||||
portfolio.setArticleNumber(articleNumber);
|
||||
return portfolio;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Portfolio postPortfolio(Portfolio portfolio) throws BaseApiException {
|
||||
User user = UserUtils.getWxCurrentUser();
|
||||
if (portfolio.getIdPortfolio() == null || portfolio.getIdPortfolio() == 0) {
|
||||
portfolio.setPortfolioAuthorId(user.getIdUser());
|
||||
portfolio.setCreatedTime(new Date());
|
||||
portfolio.setUpdatedTime(portfolio.getCreatedTime());
|
||||
portfolioMapper.insertSelective(portfolio);
|
||||
} else {
|
||||
portfolio.setUpdatedTime(new Date());
|
||||
portfolioMapper.updateByPrimaryKeySelective(portfolio);
|
||||
}
|
||||
return portfolio;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map findUnbindArticles(Integer page, Integer rows, String searchText, Integer idPortfolio) throws BaseApiException {
|
||||
Map map = new HashMap(1);
|
||||
User user = UserUtils.getWxCurrentUser();
|
||||
Portfolio portfolio = portfolioMapper.selectByPrimaryKey(idPortfolio);
|
||||
if (portfolio == null) {
|
||||
map.put("message", "该作品集不存在或已被删除!");
|
||||
} else {
|
||||
if (!user.getIdUser().equals(portfolio.getPortfolioAuthorId())) {
|
||||
map.put("message", "非法操作!");
|
||||
} else {
|
||||
PageHelper.startPage(page, rows);
|
||||
List<ArticleDTO> articles = articleService.selectUnbindArticles(idPortfolio,searchText,user.getIdUser());
|
||||
PageInfo<ArticleDTO> pageInfo = new PageInfo(articles);
|
||||
map = Utils.getArticlesGlobalResult(pageInfo);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map bindArticle(PortfolioArticleDTO portfolioArticle) {
|
||||
Map map = new HashMap(1);
|
||||
Integer count = portfolioMapper.selectCountPortfolioArticle(portfolioArticle.getIdArticle(), portfolioArticle.getIdPortfolio());
|
||||
if (count.equals(0)) {
|
||||
Integer maxSortNo = portfolioMapper.selectMaxSortNo(portfolioArticle.getIdPortfolio());
|
||||
portfolioMapper.insertPortfolioArticle(portfolioArticle.getIdArticle(),portfolioArticle.getIdPortfolio(),maxSortNo);
|
||||
map.put("message", "绑定成功!");
|
||||
} else {
|
||||
map.put("message", "该文章已经在作品集下!!");
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map updateArticleSortNo(PortfolioArticleDTO portfolioArticle) {
|
||||
Map map = new HashMap(1);
|
||||
if (portfolioArticle.getIdPortfolio() == null || portfolioArticle.getIdPortfolio().equals(0)) {
|
||||
map.put("message", "作品集数据异常!");
|
||||
}
|
||||
if (portfolioArticle.getIdArticle() == null || portfolioArticle.getIdArticle().equals(0)) {
|
||||
map.put("message", "文章数据异常!");
|
||||
}
|
||||
if (portfolioArticle.getSortNo() == null) {
|
||||
map.put("message", "排序号不能为空!");
|
||||
}
|
||||
Integer result = portfolioMapper.updateArticleSortNo(portfolioArticle.getIdPortfolio(),portfolioArticle.getIdArticle(),portfolioArticle.getSortNo());
|
||||
if (result > 0) {
|
||||
map.put("message", "更新成功!");
|
||||
} else {
|
||||
map.put("message", "更新失败!");
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map unbindArticle(Integer idPortfolio, Integer idArticle) {
|
||||
Map map = new HashMap(1);
|
||||
if (idPortfolio == null || idPortfolio.equals(0)) {
|
||||
map.put("message", "作品集数据异常");
|
||||
}
|
||||
if (idArticle == null || idArticle.equals(0)) {
|
||||
map.put("message", "文章数据异常");
|
||||
}
|
||||
Integer result = portfolioMapper.unbindArticle(idPortfolio,idArticle);
|
||||
if (result > 0) {
|
||||
map.put("message", "操作成功!");
|
||||
} else {
|
||||
map.put("message", "操作失败!");
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map deletePortfolio(Integer idPortfolio) {
|
||||
Map map = new HashMap(1);
|
||||
if (idPortfolio == null || idPortfolio.equals(0)) {
|
||||
map.put("message", "作品集数据异常");
|
||||
}
|
||||
|
||||
Integer articleNumber = portfolioMapper.selectCountArticleNumber(idPortfolio);
|
||||
if (articleNumber > 0) {
|
||||
map.put("message", "该作品集已绑定文章不允许删除!");
|
||||
} else {
|
||||
Integer result = portfolioMapper.deleteByPrimaryKey(idPortfolio);
|
||||
if (result.equals(0)) {
|
||||
map.put("message", "操作失败!");
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private PortfolioDTO genPortfolioAuthor(PortfolioDTO portfolioDTO, Author author) {
|
||||
portfolioDTO.setPortfolioAuthorAvatarUrl(author.getUserAvatarURL());
|
||||
portfolioDTO.setPortfolioAuthorName(author.getUserNickname());
|
||||
portfolioDTO.setPortfolioAuthorId(author.getIdUser());
|
||||
portfolioDTO.setPortfolioAuthor(author);
|
||||
return portfolioDTO;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.rymcu.vertical.service.impl;
|
||||
|
||||
import com.rymcu.vertical.core.service.AbstractService;
|
||||
import com.rymcu.vertical.entity.SpecialDay;
|
||||
import com.rymcu.vertical.mapper.SpecialDayMapper;
|
||||
import com.rymcu.vertical.service.SpecialDayService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
@Service
|
||||
public class SpecialDayServiceImpl extends AbstractService<SpecialDay> implements SpecialDayService {
|
||||
|
||||
@Resource
|
||||
private SpecialDayMapper specialDayMapper;
|
||||
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package com.rymcu.vertical.service.impl;
|
||||
|
||||
import com.rymcu.vertical.core.service.AbstractService;
|
||||
import com.rymcu.vertical.core.service.redis.RedisService;
|
||||
import com.rymcu.vertical.dto.ArticleTagDTO;
|
||||
import com.rymcu.vertical.dto.LabelModel;
|
||||
import com.rymcu.vertical.entity.Article;
|
||||
@ -36,8 +35,6 @@ public class TagServiceImpl extends AbstractService<Tag> implements TagService {
|
||||
private TagMapper tagMapper;
|
||||
@Resource
|
||||
private ArticleMapper articleMapper;
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = { UnsupportedEncodingException.class,BaseApiException.class })
|
||||
@ -107,7 +104,7 @@ public class TagServiceImpl extends AbstractService<Tag> implements TagService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map saveTag(Tag tag) {
|
||||
Integer result = 0;
|
||||
Integer result;
|
||||
|
||||
Map map = new HashMap(1);
|
||||
if (tag.getIdTag() == null) {
|
||||
|
@ -2,6 +2,7 @@ package com.rymcu.vertical.service.impl;
|
||||
|
||||
import com.rymcu.vertical.core.service.AbstractService;
|
||||
import com.rymcu.vertical.core.service.redis.RedisService;
|
||||
import com.rymcu.vertical.dto.Author;
|
||||
import com.rymcu.vertical.dto.TokenUser;
|
||||
import com.rymcu.vertical.dto.UserDTO;
|
||||
import com.rymcu.vertical.dto.UserInfoDTO;
|
||||
@ -207,4 +208,9 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
|
||||
public Integer findRoleWeightsByUser(Integer idUser) {
|
||||
return userMapper.selectRoleWeightsByUser(idUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Author selectAuthor(Integer idUser) {
|
||||
return userMapper.selectAuthor(idUser);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,62 @@
|
||||
package com.rymcu.vertical.service.impl;
|
||||
|
||||
import com.rymcu.vertical.core.service.AbstractService;
|
||||
import com.rymcu.vertical.entity.WxUser;
|
||||
import com.rymcu.vertical.mapper.WxUserMapper;
|
||||
import com.rymcu.vertical.service.WxUserService;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
@Service
|
||||
public class WxUserServiceImpl extends AbstractService<WxUser> implements WxUserService {
|
||||
|
||||
@Resource
|
||||
private WxUserMapper wxUserMapper;
|
||||
|
||||
@Override
|
||||
public WxUser saveUser(WxMpUser wxMpUser, String appId) {
|
||||
WxUser searchWxUser = new WxUser();
|
||||
if (StringUtils.isBlank(wxMpUser.getUnionId())) {
|
||||
searchWxUser.setUnionId(wxMpUser.getUnionId());
|
||||
} else {
|
||||
searchWxUser.setAppId(appId);
|
||||
searchWxUser.setOpenId(searchWxUser.getOpenId());
|
||||
}
|
||||
List<WxUser> wxUsers = wxUserMapper.select(searchWxUser);
|
||||
WxUser wxUser;
|
||||
if (wxUsers.isEmpty()) {
|
||||
wxUser = new WxUser();
|
||||
wxUser.setAppId(appId);
|
||||
wxUser = copyWxUser(wxMpUser,wxUser);
|
||||
wxUserMapper.insertSelective(wxUser);
|
||||
} else {
|
||||
wxUser = wxUsers.get(0);
|
||||
wxUser = copyWxUser(wxMpUser,wxUser);
|
||||
wxUserMapper.updateByPrimaryKeySelective(wxUser);
|
||||
}
|
||||
return wxUser;
|
||||
}
|
||||
|
||||
private WxUser copyWxUser(WxMpUser wxMpUser, WxUser wxUser) {
|
||||
wxUser.setNickname(wxMpUser.getNickname());
|
||||
wxUser.setHeadImgUrl(wxMpUser.getHeadImgUrl());
|
||||
wxUser.setCountry(wxMpUser.getCountry());
|
||||
wxUser.setProvince(wxMpUser.getProvince());
|
||||
wxUser.setCity(wxMpUser.getCity());
|
||||
wxUser.setSex(wxMpUser.getSex());
|
||||
wxUser.setSubscribe(wxMpUser.getSubscribe());
|
||||
wxUser.setSubscribeTime(wxMpUser.getSubscribeTime());
|
||||
wxUser.setUnionId(wxMpUser.getUnionId());
|
||||
wxUser.setOpenId(wxMpUser.getOpenId());
|
||||
wxUser.setLanguage(wxMpUser.getLanguage());
|
||||
wxUser.setSexDesc(wxMpUser.getSexDesc());
|
||||
return wxUser;
|
||||
}
|
||||
}
|
@ -6,14 +6,8 @@ import com.rymcu.vertical.core.result.GlobalResult;
|
||||
import com.rymcu.vertical.core.result.GlobalResultGenerator;
|
||||
import com.rymcu.vertical.dto.admin.TopicTagDTO;
|
||||
import com.rymcu.vertical.dto.admin.UserRoleDTO;
|
||||
import com.rymcu.vertical.entity.Role;
|
||||
import com.rymcu.vertical.entity.Tag;
|
||||
import com.rymcu.vertical.entity.Topic;
|
||||
import com.rymcu.vertical.entity.User;
|
||||
import com.rymcu.vertical.service.RoleService;
|
||||
import com.rymcu.vertical.service.TagService;
|
||||
import com.rymcu.vertical.service.TopicService;
|
||||
import com.rymcu.vertical.service.UserService;
|
||||
import com.rymcu.vertical.entity.*;
|
||||
import com.rymcu.vertical.service.*;
|
||||
import com.rymcu.vertical.util.Utils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -39,6 +33,8 @@ public class AdminController {
|
||||
private TopicService topicService;
|
||||
@Resource
|
||||
private TagService tagService;
|
||||
@Resource
|
||||
private SpecialDayService specialDayService;
|
||||
|
||||
@GetMapping("/users")
|
||||
public GlobalResult<Map<String, Object>> users(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows){
|
||||
@ -47,10 +43,7 @@ public class AdminController {
|
||||
PageInfo<User> pageInfo = new PageInfo<>(list);
|
||||
Map<String, Object> map = new HashMap<String, Object>(2);
|
||||
map.put("users", pageInfo.getList());
|
||||
Map<String, Number> pagination = new HashMap<>(3);
|
||||
pagination.put("pageSize",pageInfo.getPageSize());
|
||||
pagination.put("total",pageInfo.getTotal());
|
||||
pagination.put("currentPage",pageInfo.getPageNum());
|
||||
Map pagination = Utils.getPagination(pageInfo);
|
||||
map.put("pagination", pagination);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
@ -204,4 +197,16 @@ public class AdminController {
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@GetMapping("/special-days")
|
||||
public GlobalResult<Map> specialDays(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows) {
|
||||
PageHelper.startPage(page, rows);
|
||||
List<SpecialDay> list = specialDayService.findAll();
|
||||
PageInfo<SpecialDay> pageInfo = new PageInfo<>(list);
|
||||
Map<String, Object> map = new HashMap<>(2);
|
||||
map.put("specialDays", pageInfo.getList());
|
||||
Map pagination = Utils.getPagination(pageInfo);
|
||||
map.put("pagination", pagination);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,13 +6,11 @@ import com.rymcu.vertical.core.result.GlobalResult;
|
||||
import com.rymcu.vertical.core.result.GlobalResultGenerator;
|
||||
import com.rymcu.vertical.core.result.GlobalResultMessage;
|
||||
import com.rymcu.vertical.core.service.log.annotation.VisitLogger;
|
||||
import com.rymcu.vertical.dto.ArticleDTO;
|
||||
import com.rymcu.vertical.dto.ForgetPasswordDTO;
|
||||
import com.rymcu.vertical.dto.TokenUser;
|
||||
import com.rymcu.vertical.dto.UserRegisterInfoDTO;
|
||||
import com.rymcu.vertical.dto.*;
|
||||
import com.rymcu.vertical.entity.User;
|
||||
import com.rymcu.vertical.service.ArticleService;
|
||||
import com.rymcu.vertical.service.JavaMailService;
|
||||
import com.rymcu.vertical.service.PortfolioService;
|
||||
import com.rymcu.vertical.service.UserService;
|
||||
import com.rymcu.vertical.util.UserUtils;
|
||||
import com.rymcu.vertical.util.Utils;
|
||||
@ -38,6 +36,8 @@ public class CommonApiController {
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private ArticleService articleService;
|
||||
@Resource
|
||||
private PortfolioService portfolioService;
|
||||
|
||||
@ApiOperation(value = "获取邮件验证码")
|
||||
@GetMapping("/get-email-code")
|
||||
@ -120,4 +120,22 @@ public class CommonApiController {
|
||||
Map map = userService.forgetPassword(forgetPassword.getCode(), forgetPassword.getPassword());
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@GetMapping("/portfolio/{id}")
|
||||
@VisitLogger
|
||||
public GlobalResult<Map<String, Object>> portfolio(@PathVariable Integer id){
|
||||
PortfolioDTO portfolioDTO = portfolioService.findPortfolioDTOById(id,1);
|
||||
Map<String, Object> map = new HashMap<>(1);
|
||||
map.put("portfolio", portfolioDTO);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@GetMapping("/portfolio/{id}/articles")
|
||||
public GlobalResult articles(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows, @PathVariable Integer id) {
|
||||
PageHelper.startPage(page, rows);
|
||||
List<ArticleDTO> list = articleService.findArticlesByIdPortfolio(id);
|
||||
PageInfo<ArticleDTO> pageInfo = new PageInfo(list);
|
||||
Map map = Utils.getArticlesGlobalResult(pageInfo);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,76 @@
|
||||
package com.rymcu.vertical.web.api.portfolio;
|
||||
|
||||
import com.rymcu.vertical.core.result.GlobalResult;
|
||||
import com.rymcu.vertical.core.result.GlobalResultGenerator;
|
||||
import com.rymcu.vertical.dto.PortfolioArticleDTO;
|
||||
import com.rymcu.vertical.dto.PortfolioDTO;
|
||||
import com.rymcu.vertical.entity.Portfolio;
|
||||
import com.rymcu.vertical.service.PortfolioService;
|
||||
import com.rymcu.vertical.web.api.exception.BaseApiException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/portfolio")
|
||||
public class PortfolioController {
|
||||
|
||||
@Resource
|
||||
private PortfolioService portfolioService;
|
||||
|
||||
@GetMapping("/detail/{id}")
|
||||
public GlobalResult detail(@PathVariable Integer id,@RequestParam(defaultValue = "0") Integer type) {
|
||||
PortfolioDTO portfolio = portfolioService.findPortfolioDTOById(id, type);
|
||||
Map map = new HashMap<>(1);
|
||||
map.put("portfolio", portfolio);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@PostMapping("/post")
|
||||
public GlobalResult add(@RequestBody Portfolio portfolio) throws BaseApiException {
|
||||
portfolio = portfolioService.postPortfolio(portfolio);
|
||||
return GlobalResultGenerator.genSuccessResult(portfolio);
|
||||
}
|
||||
|
||||
@PutMapping("/post")
|
||||
public GlobalResult update(@RequestBody Portfolio portfolio) throws BaseApiException {
|
||||
portfolio = portfolioService.postPortfolio(portfolio);
|
||||
return GlobalResultGenerator.genSuccessResult(portfolio);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}/unbind-articles")
|
||||
public GlobalResult unbindArticles(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows, @RequestParam(defaultValue = "") String searchText,@PathVariable Integer id) throws BaseApiException {
|
||||
Map map = portfolioService.findUnbindArticles(page, rows, searchText, id);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@PostMapping("/bind-article")
|
||||
public GlobalResult bindArticle(@RequestBody PortfolioArticleDTO portfolioArticle) {
|
||||
Map map = portfolioService.bindArticle(portfolioArticle);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@PutMapping("/update-article-sort-no")
|
||||
public GlobalResult updateArticleSortNo(@RequestBody PortfolioArticleDTO portfolioArticle) {
|
||||
Map map = portfolioService.updateArticleSortNo(portfolioArticle);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@DeleteMapping("/unbind-article")
|
||||
public GlobalResult unbindArticle(Integer idArticle,Integer idPortfolio) {
|
||||
Map map = portfolioService.unbindArticle(idPortfolio,idArticle);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
public GlobalResult delete(Integer idPortfolio){
|
||||
Map map = portfolioService.deletePortfolio(idPortfolio);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
}
|
@ -5,13 +5,16 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.rymcu.vertical.core.result.GlobalResult;
|
||||
import com.rymcu.vertical.core.result.GlobalResultGenerator;
|
||||
import com.rymcu.vertical.dto.ArticleDTO;
|
||||
import com.rymcu.vertical.dto.PortfolioDTO;
|
||||
import com.rymcu.vertical.dto.UserDTO;
|
||||
import com.rymcu.vertical.service.ArticleService;
|
||||
import com.rymcu.vertical.service.PortfolioService;
|
||||
import com.rymcu.vertical.service.UserService;
|
||||
import com.rymcu.vertical.util.Utils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -26,6 +29,8 @@ public class UserController {
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private ArticleService articleService;
|
||||
@Resource
|
||||
private PortfolioService portfolioService;
|
||||
|
||||
@GetMapping("/{nickname}")
|
||||
public GlobalResult detail(@PathVariable String nickname){
|
||||
@ -46,4 +51,20 @@ public class UserController {
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@GetMapping("/{nickname}/portfolios")
|
||||
public GlobalResult userPortfolios(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "12") Integer rows, @PathVariable String nickname){
|
||||
UserDTO userDTO = userService.findUserDTOByNickname(nickname);
|
||||
if (userDTO == null){
|
||||
return GlobalResultGenerator.genErrorResult("用户不存在!");
|
||||
}
|
||||
PageHelper.startPage(page, rows);
|
||||
List<PortfolioDTO> list = portfolioService.findUserPortfoliosByUser(userDTO);
|
||||
PageInfo<PortfolioDTO> pageInfo = new PageInfo(list);
|
||||
Map map = new HashMap(2);
|
||||
map.put("portfolios", list);
|
||||
Map pagination = Utils.getPagination(pageInfo);
|
||||
map.put("pagination", pagination);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,11 +37,7 @@
|
||||
<result column="article_link" property="articleLink"></result>
|
||||
<result column="article_status" property="articleStatus"></result>
|
||||
<result column="updated_time" property="updatedTime"></result>
|
||||
</resultMap>
|
||||
<resultMap id="AuthorResultMap" type="com.rymcu.vertical.dto.Author">
|
||||
<result column="id" property="idUser"/>
|
||||
<result column="nickname" property="userNickname"/>
|
||||
<result column="avatar_url" property="userAvatarURL"/>
|
||||
<result column="sort_no" property="sortNo"></result>
|
||||
</resultMap>
|
||||
<resultMap id="ArticleContentResultMap" type="com.rymcu.vertical.entity.ArticleContent">
|
||||
<result column="id_article" property="idArticle"/>
|
||||
@ -59,6 +55,12 @@
|
||||
<result column="tag_uri" property="tagUri"></result>
|
||||
<result column="tag_description" property="tagDescription"></result>
|
||||
</resultMap>
|
||||
<resultMap id="PortfolioArticleResultMap" type="com.rymcu.vertical.dto.PortfolioArticleDTO">
|
||||
<result column="id_vertical_portfolio" property="idPortfolio"></result>
|
||||
<result column="id_vertical_article" property="idArticle"></result>
|
||||
<result column="portfolio_title" property="portfolioTitle"></result>
|
||||
<result column="portfolio_head_img_url" property="headImgUrl"></result>
|
||||
</resultMap>
|
||||
<insert id="insertArticleContent">
|
||||
insert into vertical_article_content (id_article,article_content,article_content_html,created_time,updated_time)
|
||||
values (#{idArticle},#{articleContent},#{articleContentHtml},sysdate(),sysdate())
|
||||
@ -76,13 +78,10 @@
|
||||
delete from vertical_tag_article where id = #{idArticleTag}
|
||||
</delete>
|
||||
<select id="selectArticles" resultMap="DTOResultMap">
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art left join vertical_user su on art.article_author_id = su.id where article_status = '0' order by updated_time desc
|
||||
</select>
|
||||
<select id="selectAuthor" resultMap="AuthorResultMap">
|
||||
select * from vertical_user where id = #{id}
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art join vertical_user su on art.article_author_id = su.id where article_status = '0' order by updated_time desc
|
||||
</select>
|
||||
<select id="selectArticleDTOById" resultMap="DTOResultMap">
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art left join vertical_user su on art.article_author_id = su.id where art.id = #{id}
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art join vertical_user su on art.article_author_id = su.id where art.id = #{id}
|
||||
<if test="type == 1">
|
||||
and art.article_status = 0
|
||||
</if>
|
||||
@ -91,22 +90,33 @@
|
||||
select article_content,article_content_html from vertical_article_content where id_article = #{idArticle}
|
||||
</select>
|
||||
<select id="selectArticlesByTopicUri" resultMap="DTOResultMap">
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art left join vertical_user su on art.article_author_id = su.id
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art join vertical_user su on art.article_author_id = su.id
|
||||
where exists(select * from vertical_tag_article vta where vta.id_article = art.id and exists(select * from vertical_topic_tag vtt
|
||||
left join vertical_tag vt on vtt.id_tag = vt.id where vt.id = vta.id_tag and exists(select * from vertical_topic topic
|
||||
join vertical_tag vt on vtt.id_tag = vt.id where vt.id = vta.id_tag and exists(select * from vertical_topic topic
|
||||
where topic.id = vtt.id_topic and topic.topic_uri = #{topicName}))) order by updated_time desc
|
||||
</select>
|
||||
<select id="selectArticlesByTagName" resultMap="DTOResultMap">
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art left join vertical_user su on art.article_author_id = su.id order by updated_time desc
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art join vertical_user su on art.article_author_id = su.id order by updated_time desc
|
||||
</select>
|
||||
<select id="selectUserArticles" resultMap="DTOResultMap">
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art left join vertical_user su on su.id = #{idUser}
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art join vertical_user su on su.id = #{idUser}
|
||||
and art.article_author_id = su.id where article_author_id = #{idUser} and art.article_status = 0 order by updated_time desc
|
||||
</select>
|
||||
<select id="selectTags" resultMap="ArticleTagDTOResultMap">
|
||||
select vta.id, vta.id_tag, vta.id_article, vt.tag_title, vt.tag_icon_path, vt.tag_uri, vt.tag_description from vertical_tag vt left join vertical_tag_article vta on vt.id = vta.id_tag where vta.id_article = #{idArticle}
|
||||
select vta.id, vta.id_tag, vta.id_article, vt.tag_title, vt.tag_icon_path, vt.tag_uri, vt.tag_description from vertical_tag vt join vertical_tag_article vta on vt.id = vta.id_tag where vta.id_article = #{idArticle}
|
||||
</select>
|
||||
<select id="selectDrafts" resultMap="DTOResultMap">
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art left join vertical_user su on art.article_author_id = su.id where article_status = '1' and art.article_author_id = #{idUser} order by updated_time desc
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art join vertical_user su on art.article_author_id = su.id where article_status = '1' and art.article_author_id = #{idUser} order by updated_time desc
|
||||
</select>
|
||||
<select id="selectArticlesByIdPortfolio" resultMap="DTOResultMap">
|
||||
select art.*,su.nickname,su.avatar_url,vpa.sort_no from vertical_article art join vertical_portfolio_article vpa on vpa.id_vertical_article = art.id and vpa.id_vertical_portfolio = #{idPortfolio}
|
||||
join vertical_user su on art.article_author_id = su.id where art.article_status = 0 and vpa.id_vertical_portfolio = #{idPortfolio} order by sort_no
|
||||
</select>
|
||||
<select id="selectUnbindArticlesByIdPortfolio" resultMap="DTOResultMap">
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art join vertical_user su on su.id = #{idUser} and art.article_author_id = su.id where art.article_author_id = #{idUser} and art.article_status = 0
|
||||
and instr(art.article_title, #{searchText}) > 0 and art.id not in (select id_vertical_article from vertical_portfolio_article where id_vertical_portfolio = #{idPortfolio}) order by updated_time desc
|
||||
</select>
|
||||
<select id="selectPortfolioArticles" resultMap="PortfolioArticleResultMap">
|
||||
select vp.portfolio_title,vp.portfolio_head_img_url,vpa.id_vertical_portfolio,vpa.id_vertical_article from vertical_portfolio vp join vertical_portfolio_article vpa on vp.id = vpa.id_vertical_portfolio where vpa.id_vertical_article = #{idArticle}
|
||||
</select>
|
||||
</mapper>
|
54
src/main/java/mapper/PortfolioMapper.xml
Normal file
54
src/main/java/mapper/PortfolioMapper.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.rymcu.vertical.mapper.PortfolioMapper">
|
||||
<resultMap id="BaseResultMap" type="com.rymcu.vertical.entity.Portfolio">
|
||||
<id column="id" property="idPortfolio"></id>
|
||||
<result column="portfolio_head_img_url" property="headImgUrl"></result>
|
||||
<result column="portfolio_title" property="portfolioTitle"></result>
|
||||
<result column="portfolio_author_id" property="portfolioAuthorId"></result>
|
||||
<result column="portfolio_description" property="portfolioDescription"></result>
|
||||
<result column="created_time" property="createdTime"></result>
|
||||
<result column="updated_time" property="updatedTime"></result>
|
||||
</resultMap>
|
||||
<resultMap id="DTOResultMap" type="com.rymcu.vertical.dto.PortfolioDTO">
|
||||
<result column="id" property="idPortfolio"></result>
|
||||
<result column="portfolio_head_img_url" property="headImgUrl"></result>
|
||||
<result column="portfolio_title" property="portfolioTitle"></result>
|
||||
<result column="portfolio_author_id" property="portfolioAuthorId"></result>
|
||||
<result column="portfolio_description" property="portfolioDescription"></result>
|
||||
<result column="updated_time" property="updatedTime"></result>
|
||||
</resultMap>
|
||||
<insert id="insertPortfolioArticle">
|
||||
insert into vertical_portfolio_article (id_vertical_portfolio, id_vertical_article, sort_no) values (#{idPortfolio}, #{idArticle}, #{maxSortNo})
|
||||
</insert>
|
||||
<update id="updateArticleSortNo">
|
||||
update vertical_portfolio_article set sort_no = #{sortNo} where id_vertical_portfolio = #{idPortfolio} and id_vertical_article = #{idArticle}
|
||||
</update>
|
||||
<delete id="unbindArticle">
|
||||
delete from vertical_portfolio_article where id_vertical_portfolio = #{idPortfolio} and id_vertical_article = #{idArticle}
|
||||
</delete>
|
||||
<select id="selectUserPortfoliosByIdUser" resultMap="DTOResultMap">
|
||||
select id, portfolio_head_img_url, portfolio_title, portfolio_author_id, portfolio_description, updated_time from vertical_portfolio where portfolio_author_id = #{idUser}
|
||||
</select>
|
||||
<select id="selectPortfolioDTOById" resultMap="DTOResultMap">
|
||||
select id, portfolio_head_img_url, portfolio_title, portfolio_author_id,
|
||||
<choose>
|
||||
<when test="type == 1">
|
||||
portfolio_description_html as portfolio_description,
|
||||
</when>
|
||||
<otherwise>
|
||||
portfolio_description,
|
||||
</otherwise>
|
||||
</choose>
|
||||
updated_time from vertical_portfolio where id = #{id}
|
||||
</select>
|
||||
<select id="selectCountArticleNumber" resultType="java.lang.Integer">
|
||||
select count(*) from vertical_portfolio_article where id_vertical_portfolio = #{idPortfolio}
|
||||
</select>
|
||||
<select id="selectCountPortfolioArticle" resultType="java.lang.Integer">
|
||||
select count(*) from vertical_portfolio_article where id_vertical_portfolio = #{idPortfolio} and id_vertical_article = #{idArticle}
|
||||
</select>
|
||||
<select id="selectMaxSortNo" resultType="java.lang.Integer">
|
||||
select ifnull(max(sort_no),0) + 1 from vertical_portfolio_article where id_vertical_portfolio = #{idPortfolio}
|
||||
</select>
|
||||
</mapper>
|
17
src/main/java/mapper/SpecialDayMapper.xml
Normal file
17
src/main/java/mapper/SpecialDayMapper.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.rymcu.vertical.mapper.SpecialDayMapper">
|
||||
<resultMap id="BaseResultMap" type="com.rymcu.vertical.entity.SpecialDay">
|
||||
<id column="id" property="idSpecialDay"></id>
|
||||
<result column="special_day_name" property="specialDayName"></result>
|
||||
<result column="weights" property="weights"></result>
|
||||
<result column="start_time" property="startTime"></result>
|
||||
<result column="expiration_time" property="expirationTime"></result>
|
||||
<result column="repeat" property="repeat"></result>
|
||||
<result column="repeat_cycle" property="repeatCycle"></result>
|
||||
<result column="repeat_cycle_unit" property="repeatCycleUnit"></result>
|
||||
<result column="created_time" property="createdTime"></result>
|
||||
<result column="img_url" property="imgUrl"></result>
|
||||
<result column="css_style" property="cssStyle"></result>
|
||||
</resultMap>
|
||||
</mapper>
|
@ -41,6 +41,11 @@
|
||||
<result column="avatar_url" property="avatarUrl"/>
|
||||
<result column="signature" property="signature"/>
|
||||
</resultMap>
|
||||
<resultMap id="AuthorResultMap" type="com.rymcu.vertical.dto.Author">
|
||||
<result column="id" property="idUser"/>
|
||||
<result column="nickname" property="userNickname"/>
|
||||
<result column="avatar_url" property="userAvatarURL"/>
|
||||
</resultMap>
|
||||
<insert id="insertUserRole">
|
||||
insert into vertical_user_role (id_user,id_role,created_time) values (#{idUser},#{idRole},sysdate())
|
||||
</insert>
|
||||
@ -82,5 +87,8 @@
|
||||
<select id="checkNicknameByIdUser" resultType="java.lang.Integer">
|
||||
select count(*) from vertical_user where nickname = #{nickname} and id != #{idUser}
|
||||
</select>
|
||||
<select id="selectAuthor" resultMap="AuthorResultMap">
|
||||
select * from vertical_user where id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
21
src/main/java/mapper/WxUserMapper.xml
Normal file
21
src/main/java/mapper/WxUserMapper.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.rymcu.vertical.mapper.WxUserMapper">
|
||||
<resultMap id="BaseResultMap" type="com.rymcu.vertical.entity.WxUser">
|
||||
<id column="id" property="idWxUser"></id>
|
||||
<result column="nickname" property="nickname"></result>
|
||||
<result column="nickname" property="unionId"></result>
|
||||
<result column="nickname" property="appId"></result>
|
||||
<result column="nickname" property="openId"></result>
|
||||
<result column="nickname" property="sex"></result>
|
||||
<result column="nickname" property="sexDesc"></result>
|
||||
<result column="nickname" property="headImgUrl"></result>
|
||||
<result column="nickname" property="country"></result>
|
||||
<result column="nickname" property="province"></result>
|
||||
<result column="nickname" property="city"></result>
|
||||
<result column="nickname" property="actToken"></result>
|
||||
<result column="nickname" property="subscribe"></result>
|
||||
<result column="nickname" property="subscribeTime"></result>
|
||||
<result column="nickname" property="language"></result>
|
||||
</resultMap>
|
||||
</mapper>
|
@ -1,6 +1,6 @@
|
||||
spring:
|
||||
# profiles:
|
||||
# active: pord
|
||||
# active: dev
|
||||
thymeleaf:
|
||||
prefix: classpath:/templates/
|
||||
suffix: .html
|
||||
@ -12,7 +12,7 @@ spring:
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password: # redis 密码
|
||||
password: d9d2j9w2
|
||||
database: 1
|
||||
timeout: 3000
|
||||
jedis:
|
||||
@ -22,31 +22,86 @@ spring:
|
||||
max-idle: 500
|
||||
min-idle: 0
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/vertical?characterEncoding=UTF-8&autoReconnect=true&useSSL=false
|
||||
url: jdbc:mysql://101.132.182.12:3306/vertical?characterEncoding=UTF-8&autoReconnect=true&useSSL=false
|
||||
username: root
|
||||
password: # 数据库密码
|
||||
password: d9d2j9w2.RYMCU
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
max-wait: 60000
|
||||
min-idle: 20
|
||||
initial-size: 10
|
||||
max-active: 50
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
min-evictable-idle-time-millis: 30000
|
||||
validation-query: SELECT 1 FROM DUAL
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
log-slow-sql: true
|
||||
filters: config,stat,wall,log4j
|
||||
max-pool-prepared-statement-per-connection-size: 100
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
pool-prepared-statements: true
|
||||
resources:
|
||||
add-mappings: true
|
||||
mail:
|
||||
host: smtp.163.com
|
||||
host: smtp.ym.163.com
|
||||
port: 465
|
||||
username: # 邮箱
|
||||
password: # 密码
|
||||
env: dev
|
||||
username: service@rymcu.com
|
||||
password: Aa12345678
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 10MB
|
||||
max-request-size: 20MB
|
||||
wx:
|
||||
open:
|
||||
componentAppId: wx9c4a7dfb3238d5f6
|
||||
componentSecret: e32a6f75ab6b746ec3ae38a39a79ba22
|
||||
componentToken: rymcu
|
||||
componentAesKey: NWIwMDQyZjU0YWI2NGFlZThkOWZhZTg3NTg4NzQwN2E
|
||||
mp:
|
||||
configs:
|
||||
- appId: wxf085386aa07c0857
|
||||
secret: aabd075d2851764714fd14a0d0b1b8b4
|
||||
token: rymcu
|
||||
aesKey: NWIwMDQyZjU0YWI2NGFlZThkOWZhZTg3NTg4NzQwN2E
|
||||
- appId: wxa49093339a5a822b
|
||||
secret: 29e9390e6d58d57a2b2a2350dbee8754
|
||||
token: qwert
|
||||
aesKey:
|
||||
miniapp:
|
||||
configs:
|
||||
- appid: wxf57df4f171606a26
|
||||
secret: 574ff86cb48a42f3980b221e942c53b1
|
||||
token: #微信小程序消息服务器配置的token
|
||||
aesKey: #微信小程序消息服务器配置的EncodingAESKey
|
||||
msgDataFormat: JSON
|
||||
env: pord
|
||||
logging:
|
||||
file:
|
||||
path: /logs/vertical
|
||||
level:
|
||||
com:
|
||||
rymcu:
|
||||
vertical:
|
||||
wx: debug
|
||||
web: debug
|
||||
server:
|
||||
port: 8099
|
||||
servlet:
|
||||
context-path: /vertical
|
||||
compression:
|
||||
enabled: true
|
||||
mime-types: application/json,application/xml,text/html,text/xml,text/plain
|
||||
min-response-size: 1024
|
||||
max-http-header-size: 1024
|
||||
version: 1.0
|
||||
resource:
|
||||
file-path: https://abc.com/vertical
|
||||
domain: https://rymcu.com
|
||||
file-path: https://rymcu.com/vertical
|
||||
baidu:
|
||||
data:
|
||||
site: https://abc.com # 百度搜索资源配置网址
|
||||
token: xxxx # 百度搜索资源token
|
||||
reserved-words: \u7cfb\u7edf\u516c\u544a\u002c\u516c\u544a
|
||||
|
||||
site: https://www.rymcu.com
|
||||
token: 9cdKR6bVCJzxDEJS
|
@ -1592,6 +1592,504 @@
|
||||
}
|
||||
],
|
||||
"chnname": "浏览表"
|
||||
},
|
||||
{
|
||||
"title": "vertical_special_day-副本",
|
||||
"chnname": "特殊日",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "INT_10",
|
||||
"chnname": "",
|
||||
"remark": "",
|
||||
"pk": true,
|
||||
"notNull": true,
|
||||
"autoIncrement": true,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "special_day_name",
|
||||
"type": "VARCHAR_200",
|
||||
"chnname": "名称",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "weights",
|
||||
"type": "INT_10",
|
||||
"chnname": "权重/优先级,小数优秀",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "start_time",
|
||||
"type": "DATETIME",
|
||||
"chnname": "开始时间",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "expiration_time",
|
||||
"type": "DATETIME",
|
||||
"chnname": "过期时间",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "repeat",
|
||||
"type": "INT_10",
|
||||
"chnname": "是否重复",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "repeat_cycle",
|
||||
"type": "INT_10",
|
||||
"chnname": "重复周期",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "repeat_cycle_unit",
|
||||
"type": "INT_10",
|
||||
"chnname": "0:天1:周2:月3:年",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "created_time",
|
||||
"type": "DATETIME",
|
||||
"chnname": "创建时间",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "img_url",
|
||||
"type": "VARCHAR_500",
|
||||
"chnname": "图片路径",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "css_style",
|
||||
"type": "VARCHAR_2000",
|
||||
"chnname": "执行全局样式",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
}
|
||||
],
|
||||
"indexs": [],
|
||||
"headers": [
|
||||
{
|
||||
"fieldName": "chnname",
|
||||
"relationNoShow": false
|
||||
},
|
||||
{
|
||||
"fieldName": "name",
|
||||
"relationNoShow": false
|
||||
},
|
||||
{
|
||||
"fieldName": "type",
|
||||
"relationNoShow": false
|
||||
},
|
||||
{
|
||||
"fieldName": "dataType",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "remark",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "pk",
|
||||
"relationNoShow": false
|
||||
},
|
||||
{
|
||||
"fieldName": "notNull",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "autoIncrement",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "defaultValue",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "relationNoShow",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "uiHint",
|
||||
"relationNoShow": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "vertical_wx_user-副本",
|
||||
"chnname": "微信用户表",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "INT_10",
|
||||
"chnname": "微信用户表主键",
|
||||
"remark": "",
|
||||
"pk": true,
|
||||
"notNull": true,
|
||||
"autoIncrement": true,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "nickname",
|
||||
"type": "VARCHAR_50",
|
||||
"chnname": "",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "union_id",
|
||||
"type": "VARCHAR_32",
|
||||
"chnname": "微信全局 unionId",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "open_id",
|
||||
"type": "VARCHAR_32",
|
||||
"chnname": "openId",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "app_id",
|
||||
"type": "VARCHAR_32",
|
||||
"chnname": "AppId",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "sex",
|
||||
"type": "INT_10",
|
||||
"chnname": "性别字段",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "sex_desc",
|
||||
"type": "VARCHAR_32",
|
||||
"chnname": "性别文本",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "head_img_url",
|
||||
"type": "VARCHAR_200",
|
||||
"chnname": "头像图片路径",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "country",
|
||||
"type": "VARCHAR_32",
|
||||
"chnname": "所属国家",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "province",
|
||||
"type": "VARCHAR_32",
|
||||
"chnname": "所属省/州",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "city",
|
||||
"type": "VARCHAR_32",
|
||||
"chnname": "所属市/区",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "act_token",
|
||||
"type": "VARCHAR_64",
|
||||
"chnname": "活动 Token",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "subscribe",
|
||||
"type": "BIT_1",
|
||||
"chnname": "是否关注",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "subscribe_time",
|
||||
"type": "MEDIUMTEXT",
|
||||
"chnname": "关注时间戳",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "language",
|
||||
"type": "VARCHAR_10",
|
||||
"chnname": "语言",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "vertical_collection",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "BigInt",
|
||||
"remark": "",
|
||||
"chnname": "主键",
|
||||
"pk": true,
|
||||
"notNull": true,
|
||||
"autoIncrement": true
|
||||
},
|
||||
{
|
||||
"name": "head_img_url",
|
||||
"type": "VARCHAR_500",
|
||||
"remark": "",
|
||||
"chnname": "作品集头像"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "DefaultString",
|
||||
"remark": "",
|
||||
"chnname": "作品集名称"
|
||||
},
|
||||
{
|
||||
"name": "portfolio_author_id",
|
||||
"type": "BigInt",
|
||||
"remark": "",
|
||||
"chnname": "作品集作者"
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"type": "MiddleString",
|
||||
"remark": "",
|
||||
"chnname": "作品集介绍"
|
||||
},
|
||||
{
|
||||
"name": "created_time",
|
||||
"type": "DateTime",
|
||||
"remark": "",
|
||||
"chnname": "创建时间"
|
||||
},
|
||||
{
|
||||
"name": "updated_time",
|
||||
"type": "DateTime",
|
||||
"remark": "",
|
||||
"chnname": "更新时间"
|
||||
}
|
||||
],
|
||||
"indexs": [],
|
||||
"headers": [
|
||||
{
|
||||
"fieldName": "chnname",
|
||||
"relationNoShow": false
|
||||
},
|
||||
{
|
||||
"fieldName": "name",
|
||||
"relationNoShow": false
|
||||
},
|
||||
{
|
||||
"fieldName": "type",
|
||||
"relationNoShow": false
|
||||
},
|
||||
{
|
||||
"fieldName": "dataType",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "remark",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "pk",
|
||||
"relationNoShow": false
|
||||
},
|
||||
{
|
||||
"fieldName": "notNull",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "autoIncrement",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "defaultValue",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "relationNoShow",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "uiHint",
|
||||
"relationNoShow": true
|
||||
}
|
||||
],
|
||||
"chnname": "作品集",
|
||||
"remark": "作品集"
|
||||
},
|
||||
{
|
||||
"title": "vertical_collection_article",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "BigInt",
|
||||
"remark": "",
|
||||
"chnname": "主键",
|
||||
"pk": true,
|
||||
"notNull": true,
|
||||
"autoIncrement": true
|
||||
},
|
||||
{
|
||||
"name": "id_vertical_portfolio",
|
||||
"type": "BigInt",
|
||||
"remark": "",
|
||||
"chnname": "作品集表主键"
|
||||
},
|
||||
{
|
||||
"name": "id_vertical_article",
|
||||
"type": "BigInt",
|
||||
"remark": "",
|
||||
"chnname": "文章表主键"
|
||||
},
|
||||
{
|
||||
"name": "sort_no",
|
||||
"type": "Integer",
|
||||
"remark": "",
|
||||
"chnname": "排序号"
|
||||
}
|
||||
],
|
||||
"indexs": [],
|
||||
"headers": [
|
||||
{
|
||||
"fieldName": "chnname",
|
||||
"relationNoShow": false
|
||||
},
|
||||
{
|
||||
"fieldName": "name",
|
||||
"relationNoShow": false
|
||||
},
|
||||
{
|
||||
"fieldName": "type",
|
||||
"relationNoShow": false
|
||||
},
|
||||
{
|
||||
"fieldName": "dataType",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "remark",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "pk",
|
||||
"relationNoShow": false
|
||||
},
|
||||
{
|
||||
"fieldName": "notNull",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "autoIncrement",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "defaultValue",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "relationNoShow",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "uiHint",
|
||||
"relationNoShow": true
|
||||
}
|
||||
],
|
||||
"chnname": "作品集与文章关系表"
|
||||
}
|
||||
],
|
||||
"graphCanvas": {
|
||||
@ -1982,6 +2480,336 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "DB_REVERSE_MYSQL",
|
||||
"chnname": "逆向解析_MYSQL",
|
||||
"entities": [
|
||||
{
|
||||
"title": "vertical_special_day",
|
||||
"chnname": "特殊日",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "BigInt",
|
||||
"chnname": "",
|
||||
"remark": "",
|
||||
"pk": true,
|
||||
"notNull": true,
|
||||
"autoIncrement": true,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "special_day_name",
|
||||
"type": "VARCHAR_200",
|
||||
"chnname": "名称",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "weights",
|
||||
"type": "Integer",
|
||||
"chnname": "权重/优先级,小数优秀",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "start_time",
|
||||
"type": "DATETIME",
|
||||
"chnname": "开始时间",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "expiration_time",
|
||||
"type": "DATETIME",
|
||||
"chnname": "过期时间",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "repeat",
|
||||
"type": "Integer",
|
||||
"chnname": "是否重复",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "repeat_cycle",
|
||||
"type": "Integer",
|
||||
"chnname": "重复周期",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "repeat_cycle_unit",
|
||||
"type": "Integer",
|
||||
"chnname": "0:天1:周2:月3:年",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "created_time",
|
||||
"type": "DATETIME",
|
||||
"chnname": "创建时间",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "img_url",
|
||||
"type": "VARCHAR_500",
|
||||
"chnname": "图片路径",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "css_style",
|
||||
"type": "VARCHAR_2000",
|
||||
"chnname": "执行全局样式",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
}
|
||||
],
|
||||
"indexs": [],
|
||||
"headers": [
|
||||
{
|
||||
"fieldName": "chnname",
|
||||
"relationNoShow": false
|
||||
},
|
||||
{
|
||||
"fieldName": "name",
|
||||
"relationNoShow": false
|
||||
},
|
||||
{
|
||||
"fieldName": "type",
|
||||
"relationNoShow": false
|
||||
},
|
||||
{
|
||||
"fieldName": "dataType",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "remark",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "pk",
|
||||
"relationNoShow": false
|
||||
},
|
||||
{
|
||||
"fieldName": "notNull",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "autoIncrement",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "defaultValue",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "relationNoShow",
|
||||
"relationNoShow": true
|
||||
},
|
||||
{
|
||||
"fieldName": "uiHint",
|
||||
"relationNoShow": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "vertical_wx_user",
|
||||
"chnname": "微信用户表",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "INT_10",
|
||||
"chnname": "微信用户表主键",
|
||||
"remark": "",
|
||||
"pk": true,
|
||||
"notNull": true,
|
||||
"autoIncrement": true,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "nickname",
|
||||
"type": "VARCHAR_50",
|
||||
"chnname": "",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "union_id",
|
||||
"type": "VARCHAR_32",
|
||||
"chnname": "微信全局 unionId",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "open_id",
|
||||
"type": "VARCHAR_32",
|
||||
"chnname": "openId",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "app_id",
|
||||
"type": "VARCHAR_32",
|
||||
"chnname": "AppId",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "sex",
|
||||
"type": "INT_10",
|
||||
"chnname": "性别字段",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "sex_desc",
|
||||
"type": "VARCHAR_32",
|
||||
"chnname": "性别文本",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "head_img_url",
|
||||
"type": "VARCHAR_200",
|
||||
"chnname": "头像图片路径",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "country",
|
||||
"type": "VARCHAR_32",
|
||||
"chnname": "所属国家",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "province",
|
||||
"type": "VARCHAR_32",
|
||||
"chnname": "所属省/州",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "city",
|
||||
"type": "VARCHAR_32",
|
||||
"chnname": "所属市/区",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "act_token",
|
||||
"type": "VARCHAR_64",
|
||||
"chnname": "活动 Token",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "subscribe",
|
||||
"type": "BIT_1",
|
||||
"chnname": "是否关注",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "subscribe_time",
|
||||
"type": "MEDIUMTEXT",
|
||||
"chnname": "关注时间戳",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
},
|
||||
{
|
||||
"name": "language",
|
||||
"type": "VARCHAR_10",
|
||||
"chnname": "语言",
|
||||
"remark": "",
|
||||
"pk": false,
|
||||
"notNull": false,
|
||||
"autoIncrement": false,
|
||||
"defaultValue": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"graphCanvas": {
|
||||
"nodes": [],
|
||||
"edges": []
|
||||
},
|
||||
"associations": []
|
||||
}
|
||||
],
|
||||
"dataTypeDomains": {
|
||||
@ -2501,6 +3329,78 @@
|
||||
"type": "VARCHAR(64)"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "BIT_1",
|
||||
"code": "BIT_1",
|
||||
"apply": {
|
||||
"MYSQL": {
|
||||
"type": "BIT(1)"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "DATE",
|
||||
"code": "DATE",
|
||||
"apply": {
|
||||
"MYSQL": {
|
||||
"type": "DATE"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "MEDIUMTEXT",
|
||||
"code": "MEDIUMTEXT",
|
||||
"apply": {
|
||||
"MYSQL": {
|
||||
"type": "MEDIUMTEXT"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "VARCHAR_10",
|
||||
"code": "VARCHAR_10",
|
||||
"apply": {
|
||||
"MYSQL": {
|
||||
"type": "VARCHAR(10)"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "VARCHAR_200",
|
||||
"code": "VARCHAR_200",
|
||||
"apply": {
|
||||
"MYSQL": {
|
||||
"type": "VARCHAR(200)"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "VARCHAR_2000",
|
||||
"code": "VARCHAR_2000",
|
||||
"apply": {
|
||||
"MYSQL": {
|
||||
"type": "VARCHAR(2000)"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "VARCHAR_50",
|
||||
"code": "VARCHAR_50",
|
||||
"apply": {
|
||||
"MYSQL": {
|
||||
"type": "VARCHAR(50)"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "VARCHAR_500",
|
||||
"code": "VARCHAR_500",
|
||||
"apply": {
|
||||
"MYSQL": {
|
||||
"type": "VARCHAR(500)"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"database": [
|
||||
@ -2609,18 +3509,30 @@
|
||||
}
|
||||
],
|
||||
"defaultFieldsType": "1",
|
||||
"javaConfig": {},
|
||||
"javaConfig": {
|
||||
"JAVA_HOME": "C:\\Program Files\\Java\\jdk1.8.0_111"
|
||||
},
|
||||
"sqlConfig": "",
|
||||
"dbs": [
|
||||
{
|
||||
"name": "rymcu",
|
||||
"defaultDB": true,
|
||||
"defaultDB": false,
|
||||
"properties": {
|
||||
"driver_class_name": "com.mysql.jdbc.Driver",
|
||||
"url": "jdbc:mysql://101.132.182.12:3306/vertical?characterEncoding=UTF-8&useSSL=false&useUnicode=true&serverTimezone=UTC",
|
||||
"password": "d9d2j9w2.RYMCU",
|
||||
"username": "root"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "test_rymcu",
|
||||
"defaultDB": true,
|
||||
"properties": {
|
||||
"driver_class_name": "com.mysql.jdbc.Driver",
|
||||
"url": "jdbc:mysql://120.26.175.127:3306/vertical?characterEncoding=UTF-8&useSSL=false&useUnicode=true&serverTimezone=UTC",
|
||||
"password": "rymcu.Test4",
|
||||
"username": "root"
|
||||
}
|
||||
}
|
||||
],
|
||||
"wordTemplateConfig": ""
|
||||
|
Loading…
Reference in New Issue
Block a user