Merge branch 'test' into restruct

This commit is contained in:
walker-sheng 2021-01-04 18:23:51 +08:00
commit fa376fdfa3
13 changed files with 108 additions and 963 deletions

View File

@ -8,7 +8,6 @@ import club.joylink.rtss.services.student.IClassStudentUserService;
import club.joylink.rtss.vo.UserQueryVO; import club.joylink.rtss.vo.UserQueryVO;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.UserConfigVO;
import club.joylink.rtss.vo.client.student.ExportStudentInfo; import club.joylink.rtss.vo.client.student.ExportStudentInfo;
import club.joylink.rtss.vo.client.student.ImportStudentInfo; import club.joylink.rtss.vo.client.student.ImportStudentInfo;
import club.joylink.rtss.vo.client.student.StudentClassVO; import club.joylink.rtss.vo.client.student.StudentClassVO;
@ -39,18 +38,6 @@ public class UserController {
@Autowired @Autowired
private IClassStudentUserService iClassStudentUserService; private IClassStudentUserService iClassStudentUserService;
@ApiOperation(value = "更新用户配置")
@PostMapping(path = "/config")
public void saveUserConfig(@RequestBody @Validated List<UserConfigVO> userConfigVOList, @RequestAttribute @ApiIgnore UserVO user) {
this.iSysUserService.saveUserConfig(user.getId(), userConfigVOList);
}
@ApiOperation(value = "获取用户配置")
@GetMapping(path = "/config")
public List<UserConfigVO> getUserConfig(@RequestAttribute @ApiIgnore UserVO user) {
return this.iSysUserService.getUserConfig(user.getId());
}
@Role({RoleEnum.SuperAdmin}) @Role({RoleEnum.SuperAdmin})
@ApiOperation(value = "生成线下环境用户") @ApiOperation(value = "生成线下环境用户")
@PostMapping(path = "/generate/offline") @PostMapping(path = "/generate/offline")

View File

@ -1,33 +0,0 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.UserConfig;
import club.joylink.rtss.entity.UserConfigExample;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface UserConfigMapper {
long countByExample(UserConfigExample example);
int deleteByExample(UserConfigExample example);
int deleteByPrimaryKey(Long id);
int insert(UserConfig record);
int insertSelective(UserConfig record);
List<UserConfig> selectByExample(UserConfigExample example);
UserConfig selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") UserConfig record, @Param("example") UserConfigExample example);
int updateByExample(@Param("record") UserConfig record, @Param("example") UserConfigExample example);
int updateByPrimaryKeySelective(UserConfig record);
int updateByPrimaryKey(UserConfig record);
}

View File

@ -1,125 +0,0 @@
package club.joylink.rtss.entity;
import club.joylink.rtss.vo.client.UserConfigVO;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* user_config
* @author
*/
public class UserConfig implements Serializable {
private Long id;
/**
* 用户ID
*/
private Long userId;
/**
* 配置项编号:数据字典值
*/
private String code;
/**
* 配置项值
*/
private String val;
private static final long serialVersionUID = 1L;
public UserConfig() {}
public UserConfig(UserConfigVO userConfigVO) {
this.code = userConfigVO.getCode();
this.val = userConfigVO.getVal();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getVal() {
return val;
}
public void setVal(String val) {
this.val = val;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
UserConfig other = (UserConfig) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
&& (this.getVal() == null ? other.getVal() == null : this.getVal().equals(other.getVal()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode());
result = prime * result + ((getVal() == null) ? 0 : getVal().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", userId=").append(userId);
sb.append(", code=").append(code);
sb.append(", param=").append(val);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
public static List<UserConfigVO> convertToVOList(List<UserConfig> userConfigList) {
List<UserConfigVO> userConfigVOList = new ArrayList<>();
userConfigList.forEach(userConfig -> {
UserConfigVO userConfigVO = new UserConfigVO(userConfig);
userConfigVOList.add(userConfigVO);
});
return userConfigVOList;
}
}

View File

@ -1,482 +0,0 @@
package club.joylink.rtss.entity;
import java.util.ArrayList;
import java.util.List;
public class UserConfigExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Integer offset;
public UserConfigExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public Integer getLimit() {
return limit;
}
public void setOffset(Integer offset) {
this.offset = offset;
}
public Integer getOffset() {
return offset;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(Long value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(Long value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(Long value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(Long value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(Long value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<Long> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Long> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(Long value1, Long value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(Long value1, Long value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andCodeIsNull() {
addCriterion("code is null");
return (Criteria) this;
}
public Criteria andCodeIsNotNull() {
addCriterion("code is not null");
return (Criteria) this;
}
public Criteria andCodeEqualTo(String value) {
addCriterion("code =", value, "code");
return (Criteria) this;
}
public Criteria andCodeNotEqualTo(String value) {
addCriterion("code <>", value, "code");
return (Criteria) this;
}
public Criteria andCodeGreaterThan(String value) {
addCriterion("code >", value, "code");
return (Criteria) this;
}
public Criteria andCodeGreaterThanOrEqualTo(String value) {
addCriterion("code >=", value, "code");
return (Criteria) this;
}
public Criteria andCodeLessThan(String value) {
addCriterion("code <", value, "code");
return (Criteria) this;
}
public Criteria andCodeLessThanOrEqualTo(String value) {
addCriterion("code <=", value, "code");
return (Criteria) this;
}
public Criteria andCodeLike(String value) {
addCriterion("code like", value, "code");
return (Criteria) this;
}
public Criteria andCodeNotLike(String value) {
addCriterion("code not like", value, "code");
return (Criteria) this;
}
public Criteria andCodeIn(List<String> values) {
addCriterion("code in", values, "code");
return (Criteria) this;
}
public Criteria andCodeNotIn(List<String> values) {
addCriterion("code not in", values, "code");
return (Criteria) this;
}
public Criteria andCodeBetween(String value1, String value2) {
addCriterion("code between", value1, value2, "code");
return (Criteria) this;
}
public Criteria andCodeNotBetween(String value1, String value2) {
addCriterion("code not between", value1, value2, "code");
return (Criteria) this;
}
public Criteria andValIsNull() {
addCriterion("param is null");
return (Criteria) this;
}
public Criteria andValIsNotNull() {
addCriterion("param is not null");
return (Criteria) this;
}
public Criteria andValEqualTo(String value) {
addCriterion("param =", value, "param");
return (Criteria) this;
}
public Criteria andValNotEqualTo(String value) {
addCriterion("param <>", value, "param");
return (Criteria) this;
}
public Criteria andValGreaterThan(String value) {
addCriterion("param >", value, "param");
return (Criteria) this;
}
public Criteria andValGreaterThanOrEqualTo(String value) {
addCriterion("param >=", value, "param");
return (Criteria) this;
}
public Criteria andValLessThan(String value) {
addCriterion("param <", value, "param");
return (Criteria) this;
}
public Criteria andValLessThanOrEqualTo(String value) {
addCriterion("param <=", value, "param");
return (Criteria) this;
}
public Criteria andValLike(String value) {
addCriterion("param like", value, "param");
return (Criteria) this;
}
public Criteria andValNotLike(String value) {
addCriterion("param not like", value, "param");
return (Criteria) this;
}
public Criteria andValIn(List<String> values) {
addCriterion("param in", values, "param");
return (Criteria) this;
}
public Criteria andValNotIn(List<String> values) {
addCriterion("param not in", values, "param");
return (Criteria) this;
}
public Criteria andValBetween(String value1, String value2) {
addCriterion("param between", value1, value2, "param");
return (Criteria) this;
}
public Criteria andValNotBetween(String value1, String value2) {
addCriterion("param not between", value1, value2, "param");
return (Criteria) this;
}
}
/**
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -4,7 +4,6 @@ import club.joylink.rtss.entity.SysUser;
import club.joylink.rtss.vo.UserQueryVO; import club.joylink.rtss.vo.UserQueryVO;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.UserConfigVO;
import club.joylink.rtss.vo.client.user.*; import club.joylink.rtss.vo.client.user.*;
import club.joylink.rtss.vo.wx.WmUserSession; import club.joylink.rtss.vo.wx.WmUserSession;
@ -46,20 +45,6 @@ public interface ISysUserService {
*/ */
void modify(Long id, UserVO userInfo, String vdcode); void modify(Long id, UserVO userInfo, String vdcode);
/**
* 保存用户配置
* @param userId
* @param userConfigVOList
*/
void saveUserConfig(Long userId, List<UserConfigVO> userConfigVOList);
/**
* 获取用户配置
* @param userId
* @return
*/
List<UserConfigVO> getUserConfig(Long userId);
/** /**
* 分页获取用户数据 * 分页获取用户数据
*/ */

View File

@ -3,8 +3,13 @@ package club.joylink.rtss.services;
import club.joylink.rtss.configuration.configProp.WeChatConfig; import club.joylink.rtss.configuration.configProp.WeChatConfig;
import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.constants.EmailSubject; import club.joylink.rtss.constants.EmailSubject;
import club.joylink.rtss.dao.*; import club.joylink.rtss.dao.CompanyDAO;
import club.joylink.rtss.entity.*; import club.joylink.rtss.dao.SysUserDAO;
import club.joylink.rtss.dao.UserSubscribeMapper;
import club.joylink.rtss.entity.SysUser;
import club.joylink.rtss.entity.SysUserExample;
import club.joylink.rtss.entity.UserSubscribe;
import club.joylink.rtss.entity.UserSubscribeExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.cache.ICacheService; import club.joylink.rtss.services.cache.ICacheService;
import club.joylink.rtss.util.EncryptUtil; import club.joylink.rtss.util.EncryptUtil;
@ -14,7 +19,6 @@ import club.joylink.rtss.vo.UserQueryVO;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.VdCode; import club.joylink.rtss.vo.VdCode;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.UserConfigVO;
import club.joylink.rtss.vo.client.map.MapVO; import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.user.*; import club.joylink.rtss.vo.client.user.*;
import club.joylink.rtss.vo.wx.WmUserSession; import club.joylink.rtss.vo.wx.WmUserSession;
@ -43,8 +47,6 @@ public class SysUserService implements ISysUserService {
*/ */
private static final String NATION_CODE = "86"; private static final String NATION_CODE = "86";
private static final String USER_CONFIG_TYPE = "user_config_type";
private static final Map<Long, WeChatBindStatusVO> userBindStatusMap = new ConcurrentHashMap<>(); private static final Map<Long, WeChatBindStatusVO> userBindStatusMap = new ConcurrentHashMap<>();
@Autowired @Autowired
@ -59,15 +61,6 @@ public class SysUserService implements ISysUserService {
@Autowired @Autowired
private IEmailService iEmailService; private IEmailService iEmailService;
@Autowired
private UserConfigMapper userConfigMapper;
@Autowired
private SysDictionaryMapper sysDictionaryMapper;
@Autowired
private SysDictionaryDetailMapper sysDictionaryDetailMapper;
@Autowired @Autowired
private UserSubscribeMapper userSubscribeMapper; private UserSubscribeMapper userSubscribeMapper;
@ -168,52 +161,6 @@ public class SysUserService implements ISysUserService {
this.sysUserDAO.updateByPrimaryKeySelective(sysUser); this.sysUserDAO.updateByPrimaryKeySelective(sysUser);
} }
@Override
@Transactional
public void saveUserConfig(Long userId, List<UserConfigVO> userConfigVOList) {
// 查询字典
SysDictionaryExample dictionaryExample = new SysDictionaryExample();
dictionaryExample.createCriteria().andCodeEqualTo(USER_CONFIG_TYPE);
List<SysDictionary> sysDictionaries = this.sysDictionaryMapper.selectByExample(dictionaryExample);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(sysDictionaries);
// 查询字典详情
SysDictionaryDetailExample dictionaryDetailExample = new SysDictionaryDetailExample();
dictionaryDetailExample.createCriteria().andDicIdEqualTo(sysDictionaries.get(0).getId());
List<SysDictionaryDetail> sysDictionaryDetails = this.sysDictionaryDetailMapper.selectByExample(dictionaryDetailExample);
// 判断code是否在字典中
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(sysDictionaryDetails);
List<String> dictDetailCodes = sysDictionaryDetails.stream().map(SysDictionaryDetail::getCode).collect(Collectors.toList());
List<String> userConfigCodes = userConfigVOList.stream().map(UserConfigVO::getCode).collect(Collectors.toList());
// 保存数据
userConfigVOList.forEach(userConfigVO -> {
UserConfigExample example = new UserConfigExample();
example.createCriteria().andUserIdEqualTo(userId)
.andCodeEqualTo(userConfigVO.getCode());
List<UserConfig> userConfigs = this.userConfigMapper.selectByExample(example);
// 判断是否存在
if(userConfigs == null || userConfigs.isEmpty()) {
UserConfig userConfig = new UserConfig(userConfigVO);
userConfig.setUserId(userId);
this.userConfigMapper.insert(userConfig);
}else {
UserConfig userConfig = userConfigs.get(0);
userConfig.setVal(userConfigVO.getVal());
this.userConfigMapper.updateByPrimaryKey(userConfig);
}
});
}
@Override
public List<UserConfigVO> getUserConfig(Long userId) {
UserConfigExample example = new UserConfigExample();
example.createCriteria().andUserIdEqualTo(userId);
List<UserConfig> userConfigs = this.userConfigMapper.selectByExample(example);
if(userConfigs == null || userConfigs.isEmpty()) {
return null;
}
return UserConfig.convertToVOList(userConfigs);
}
@Override @Override
public PageVO<UserVO> queryPagedUser(UserQueryVO queryVO) { public PageVO<UserVO> queryPagedUser(UserQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize()); PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());

View File

@ -0,0 +1,28 @@
package club.joylink.rtss.simulation;
import org.springframework.core.MethodParameter;
import org.springframework.util.Assert;
import java.lang.reflect.Method;
public class HandlerMethod {
private final Object bean;
private final Method method;
private final MethodParameter[] parameters;
private final String description;
/**
* Create an instance from a bean instance and a method.
*/
public HandlerMethod(Object bean, Method method) {
Assert.notNull(bean, "Bean is required");
Assert.notNull(method, "Method is required");
this.bean = bean;
this.method = method;
this.parameters = null;
this.description = null;
}
}

View File

@ -0,0 +1,15 @@
package club.joylink.rtss.simulation;
import org.springframework.stereotype.Component;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Component
public @interface SimulationOperationController {
String value() default "";
}

View File

@ -0,0 +1,9 @@
package club.joylink.rtss.simulation;
import org.springframework.stereotype.Component;
@Component
public class SimulationOperationDispatcher {
}

View File

@ -0,0 +1,34 @@
package club.joylink.rtss.simulation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Slf4j
@Component
public class SimulationOperationHandlerManager implements ApplicationContextAware {
public static final Map<String, Object> handlerMap = new ConcurrentHashMap<>();
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
Map<String, Object> handlerMap = applicationContext.getBeansWithAnnotation(SimulationOperationController.class);
for (Object handler : handlerMap.values()) {
Method[] methods = handler.getClass().getDeclaredMethods();
for (Method method : methods) {
SimulationOperationMapping operationMapping = method.getAnnotation(SimulationOperationMapping.class);
if (operationMapping == null) {
continue;
}
String name = operationMapping.name();
log.info(String.format("成功加载仿真操作{name: %s, method: %s::%s}", name, handler.getClass().getName(), method.getName()));
}
}
}
}

View File

@ -0,0 +1,15 @@
package club.joylink.rtss.simulation;
import org.springframework.stereotype.Component;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Component
public @interface SimulationOperationMapping {
String name();
}

View File

@ -1,31 +0,0 @@
package club.joylink.rtss.vo.client;
import club.joylink.rtss.entity.UserConfig;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
@Getter
@Setter
@NoArgsConstructor
public class UserConfigVO {
/**
* 配置项编号:数据字典值
*/
@NotBlank(message = "配置项编号不能为空")
private String code;
/**
* 配置项值
*/
@NotBlank(message = "配置项值不能为空")
private String val;
public UserConfigVO(UserConfig userConfig) {
this.code = userConfig.getCode();
this.val = userConfig.getVal();
}
}

View File

@ -1,204 +0,0 @@
<?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="club.joylink.rtss.dao.UserConfigMapper">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.UserConfig">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="val" jdbcType="VARCHAR" property="val" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, user_id, code, val
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.UserConfigExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from user_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from user_config
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from user_config
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.UserConfigExample">
delete from user_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.UserConfig">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into user_config (user_id, code, val
)
values (#{userId,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{val,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.UserConfig">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into user_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="code != null">
code,
</if>
<if test="val != null">
val,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="val != null">
#{val,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.UserConfigExample" resultType="java.lang.Long">
select count(*) from user_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update user_config
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.code != null">
code = #{record.code,jdbcType=VARCHAR},
</if>
<if test="record.val != null">
val = #{record.val,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update user_config
set id = #{record.id,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
code = #{record.code,jdbcType=VARCHAR},
val = #{record.val,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.UserConfig">
update user_config
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="val != null">
val = #{val,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.UserConfig">
update user_config
set user_id = #{userId,jdbcType=BIGINT},
code = #{code,jdbcType=VARCHAR},
val = #{val,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>