Commit 1d7cee14 by xmh

添加code服务

1 parent 7a3ba34f
Showing 49 changed files with 3246 additions and 48 deletions
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.viontech</groupId>
<artifactId>fanxing3</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>fanxing-code</artifactId>
<version>3.0.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.viontech</groupId>
<artifactId>fanxing-commons</artifactId>
<version>${parent.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-config</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
<exclusions>
<exclusion>
<artifactId>mybatis</artifactId>
<groupId>org.mybatis</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.3</version>
<exclusions>
<exclusion>
<artifactId>mybatis-spring-boot-starter</artifactId>
<groupId>org.mybatis.spring.boot</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*</include>
</includes>
</resource>
</resources>
</build>
</project>
\ No newline at end of file
package com.viontech.fanxing.code;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* .
*
* @author 谢明辉
* @date 2021/7/8
*/
@EnableDiscoveryClient
@EnableScheduling
@SpringBootApplication(scanBasePackages = "com.viontech.fanxing")
@EnableFeignClients
@MapperScan(basePackages = "com.viontech.fanxing.code.mapper")
@Slf4j
public class CodeApp {
public static void main(String[] args) {
try {
SpringApplication.run(CodeApp.class, args);
} catch (Exception e) {
log.error("Code app start error", e);
}
}
}
package com.viontech.fanxing.code.base;
import com.github.pagehelper.PageInfo;
import com.viontech.keliu.util.FileUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import static com.viontech.keliu.util.JsonMessageUtil.getErrorJsonMsg;
import static com.viontech.keliu.util.JsonMessageUtil.getSuccessJsonMsg;
/**
* Controller基类<br>
* 所有Controller都需要继承自该类
*
* @param <T>
*
* @author suman 2016年8月15日 下午1:59:19
*/
public abstract class BaseController<O extends BaseModel, T extends VoInterface<O>> {
/**
* 通用message
*/
public static final String MESSAGE_ADD_SUCCESS = "addSuccess";
public static final String MESSAGE_ADD_ERROR = "addError";
public static final String MESSAGE_UPDATE_SUCCESS = "updateSuccess";
public static final String MESSAGE_UPDATE_ERROR = "updateError";
public static final String MESSAGE_DELETE_SUCCESS = "delSuccess";
public static final String MESSAGE_DELETE_ERROR = "delError";
public static final String MESSAGE_COUNT_SUCCESS = "countSuccess";
public static final String MESSAGE_COUNT_ERROR = "countError";
public static final String MESSAGE_SELECT_SUCCESS = "selSuccess";
public static final String MESSAGE_SELECT_ERROR = "selError";
public static final String MESSAGE_LIST_SUCCESS = "listSuccess";
public static final String MESSAGE_LIST_ERROR = "listError";
public static final String MESSAGE_PAGE_SUCCESS = "pageSuccess";
public static final String MESSAGE_PAGE_ERROR = "pageError";
public static final String MESSAGE_WEBROOT_NOTFOUND_ERROR = "webRootNotFoundError";
public static final String MESSAGE_FILE_UPLOAD_SUCCESS = "fileUploadSuccess";
public static final String MESSAGE_FILE_UPLOAD_ERROR = "fileUploadError";
public static final String MESSAGE_FILE_DOWNLOAD_ERROR = "fileDownloadError";
public static final String MESSAGE_FILE_NOTFOUND_ERROR = "fileNotFoundError";
public static final String MESSAGE_ID_NOT_EMPTY = "idNotEmpty";
public static final String MESSAGE_MODE_NOT_EXISTENCE = "modleNotExistence";
public static final int EXAMPLE_TYPE_SIMPLE = 0;
public static final int EXAMPLE_TYPE_NORMAL = 1;
public static final int EXAMPLE_TYPE_COUNT = 3;
public static final int EXAMPLE_TYPE_PAGE = 4;
/**
* slf4j 日志对象 用来记录log
*/
protected final Logger logger = LoggerFactory.getLogger(getClass());
/*@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(Date.class, new CustomDateEditor(true,
"yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd", "yyyy-MM", "HH:mm:ss"));
}*/
public static boolean isNotNull(Object object) {
if (object == null) {
return false;
}
if (object.toString().trim().isEmpty()) {
return false;
}
return true;
}
/**
* 通用添加方法
*
* @param t 需要插入数据库的对象
*
* @return
*/
@RequestMapping(value = "", method = RequestMethod.POST)
@ResponseBody
public Object add(@RequestBody T t) {
getService().insertSelective(t.getModel());
return getSuccessJsonMsg(MESSAGE_ADD_SUCCESS, t);
}
/**
* 通用数量方法
*
* @param t 需要插入数据库的对象的条件
*
* @return
*/
@RequestMapping(value = "/count", method = RequestMethod.GET)
@ResponseBody
public Object count(T t) {
int result = getService().countByExample(getExample(t, EXAMPLE_TYPE_COUNT));
return getSuccessJsonMsg(MESSAGE_COUNT_SUCCESS, result);
}
/**
* 通用更新方法
*
* @param t 需要更新的对象及内容
*
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable(value = "id") Long id, @RequestBody T t) {
t.getModel().setId(id);
getService().updateByPrimaryKeySelective(t.getModel());
return getSuccessJsonMsg(MESSAGE_UPDATE_SUCCESS, t);
}
/**
* 通用删除方法
*
* @param id 需要删除的数据id
*
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseBody
public Object del(@PathVariable(value = "id") Long id) {
if (id == null) {
return getErrorJsonMsg(MESSAGE_ID_NOT_EMPTY);
}
int result = getService().deleteByPrimaryKey(id);
if (result == 0) {
return getErrorJsonMsg(MESSAGE_MODE_NOT_EXISTENCE);
}
return getSuccessJsonMsg(MESSAGE_DELETE_SUCCESS, null);
}
/**
* 通用列表查询方法,将数据从数据库中全部查出
* saveFile
*
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public Object selOne(@PathVariable(value = "id") Long id) {
BaseModel t = getService().selectByPrimaryKey(id);
return getSuccessJsonMsg(MESSAGE_LIST_SUCCESS, t);
}
/**
* 通用分页查询方法,从数据库中查出一页数据
*
* @return
*/
@RequestMapping(value = "", method = RequestMethod.GET)
@ResponseBody
public Object page(T t, @RequestParam(value = "page", defaultValue = "-1") int page, @RequestParam(value = "pageSize", defaultValue = "100") int pageSize, String sortName, String sortOrder) {
BaseExample baseExample = getExample(t, EXAMPLE_TYPE_PAGE);
if (isNotNull(sortOrder) && isNotNull(sortName)) {
baseExample.setOrderByClause(baseExample.getTableAlias() + "." + sortName + " " + sortOrder);
} else if (isNotNull(sortName) && !isNotNull(sortOrder)) {
baseExample.setOrderByClause(sortName);
}
if (page <= 0) {
List result = getService().selectByExample(baseExample);
return getSuccessJsonMsg(MESSAGE_SELECT_SUCCESS, result);
} else {
PageInfo pageInfo = getService().pagedQuery(baseExample, page, pageSize);
return getSuccessJsonMsg(MESSAGE_PAGE_SUCCESS, pageInfo);
}
}
/**
* 根据参数获取图片,对前后获取图片的不同参数方式进行兼容
*/
@RequestMapping(value = "/img/{location}/{picture:.+}")
public void getIMG(@PathVariable("picture") String picture, @PathVariable("location") String location, HttpServletResponse response) {
if (picture.contains("svg")) {
response.setContentType("image/svg+xml;charset=UTF-8");
response.addHeader("Accept-Ranges", "bytes");
} else {
response.setContentType("image/jpeg");
}
FileInputStream fis = null;
OutputStream out = null;
try {
String basePath = FileUtil.getBasePath();
File file = new File(basePath + "/" + location, picture);
if (!file.exists()) {
System.out.println(file.getAbsolutePath());
return;
}
out = response.getOutputStream();
fis = new FileInputStream(file);
byte[] b = new byte[fis.available()];
response.setContentLength(b.length);
fis.read(b);
out.write(b);
out.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (fis != null) {
fis.close();
}
} catch (Exception e) {
e.printStackTrace();
}
try {
if (out != null) {
out.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* 获取到执行各项操作需要的service
*
* @return
*/
protected abstract BaseService<O> getService();
/**
* 得到执行查询操作需要的查询条件
*
* @param t 查询条件存储对象
*
* @return 查询条件对象
*/
protected abstract BaseExample getExample(T t, int type);
}
package com.viontech.fanxing.code.base;
import java.util.*;
/**
* 所有Example都需要继承自该类<br>
* 该类自动生成不需要修改
* @author suman
* 2016年8月15日 下午1:58:40
*/
public abstract class BaseExample {
protected String orderByClause;
protected String groupByClause;
protected boolean distinct;
protected boolean ignoreCase;
protected String tableName;
protected String tableAlias;
protected List<GeneratedCriteria> oredCriteria;
protected Map<String, ColumnContainerBase> columnContainerMap;
protected Set<String> leftJoinTableSet;
public BaseExample() {
oredCriteria = new ArrayList<GeneratedCriteria>();
columnContainerMap = new HashMap<String,ColumnContainerBase>();
leftJoinTableSet = new HashSet<String>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
if(orderByClause == null){
return getTableAlias()+".id";
}
return orderByClause;
}
public void setGroupByClause(String groupByClause) {
this.groupByClause = groupByClause;
}
public String getGroupByClause() {
return groupByClause;
}
public String getTableName() {
return tableName;
}
public String getTableAlias() {
return "`"+tableAlias+"`";
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public boolean isIgnoreCase() {
return ignoreCase;
}
public void setIgnoreCase(boolean ignoreCase) {
this.ignoreCase = ignoreCase;
oredCriteria.forEach(item ->{
item.setIgnoreCase(this.ignoreCase);
});
}
public List<GeneratedCriteria> getOredCriteria() {
return oredCriteria;
}
public Set<ColumnContainerBase> getColumnContainerSet() {
if(columnContainerMap.size()==0){
columnContainerMap.put(getTableName(), createColumns());
}
return new HashSet(columnContainerMap.values());
}
public Set<String> getLeftJoinTableSet() {
return leftJoinTableSet;
}
public void or(GeneratedCriteria criteria) {
oredCriteria.add(criteria);
if(!criteria.getTableName().equals(getTableName())){
leftJoinTableSet.add(criteria.getTableName());
}
}
public GeneratedCriteria and(GeneratedCriteria criteria) {
GeneratedCriteria oldCriteria = criteria;
if(oredCriteria.size()<=0){
oredCriteria.add(criteria);
}else{
oldCriteria = oredCriteria.get(oredCriteria.size()-1);
oldCriteria.getCriteria().addAll(criteria.getCriteria());
}
if(!criteria.getTableName().equals(getTableName())){
leftJoinTableSet.add(criteria.getTableName());
}
return oldCriteria;
}
public abstract GeneratedCriteria createCriteria();
protected abstract GeneratedCriteria createCriteriaInternal();
protected abstract ColumnContainerBase createColumns();
public void clear() {
oredCriteria.clear();
columnContainerMap.clear();
leftJoinTableSet.clear();
orderByClause = null;
groupByClause = null;
distinct = false;
ignoreCase = false;
}
public abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected boolean ignoreCase = false;
private String tableName;
public boolean isIgnoreCase() {
return ignoreCase;
}
public void setIgnoreCase(boolean ignoreCase) {
this.ignoreCase = ignoreCase;
this.criteria.forEach(item->{
item.setIgnoreCase(ignoreCase);
});
}
protected GeneratedCriteria(String tableName) {
super();
this.criteria = new ArrayList<Criterion>();
this.tableName = tableName;
}
protected GeneratedCriteria(String tableName,boolean ignoreCase) {
this(tableName);
this.ignoreCase = ignoreCase;
}
public List<Criterion> getCriteria() {
return criteria;
}
public void setCriteria(List<Criterion> criteria){
this.criteria = criteria;
}
public String getTableName() {
return tableName;
}
}
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;
private boolean ignoreCase;
public String getCondition() {
return condition;
}
public void setCondition(String condition){
this.condition = condition;
}
public Object getValue() {
return value;
}
public void setValue(Object value){
this.value = value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public void setNoValue(boolean noValue) {
this.noValue = noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public void setSingleValue(boolean singleValue){
this.singleValue = singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public void setListValue(boolean listValue){
this.listValue = listValue;
}
public String getTypeHandler() {
return typeHandler;
}
public boolean isIgnoreCase() {
return ignoreCase;
}
public void setIgnoreCase(boolean ignoreCase) {
this.ignoreCase = ignoreCase;
if(ignoreCase && value instanceof String){
String[] conditions = condition.split(" ");
this.condition = "`upper`("+conditions[0]+") " + conditions[1];
this.value = String.valueOf(value).toUpperCase();
}
}
public Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
public Criterion(String condition, Object value, String typeHandler) {
this(condition,value,typeHandler,false);
}
public Criterion(String condition, Object value, String typeHandler,boolean ignoreCase) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
if(ignoreCase && value instanceof String){
String[] conditions = condition.split(" ");
this.condition = "`upper`("+conditions[0]+") " + conditions[1];
this.value = String.valueOf(value).toUpperCase();
}
}
public Criterion(String condition, Object value) {
this(condition,value,false);
}
public Criterion(String condition, Object value,boolean ignoreCase) {
this(condition, value, null,ignoreCase);
}
public 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;
}
public Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
protected static class ColumnContainerBase {
private StringBuffer columnContainerStr;
private String tableName;
protected ColumnContainerBase(String tableName) {
super();
columnContainerStr = new StringBuffer();
this.tableName = tableName;
}
public boolean isValid() {
return columnContainerStr.length() > 0;
}
public StringBuffer getAllColumn() {
return columnContainerStr;
}
public StringBuffer getColumnContainerStr() {
return columnContainerStr;
}
public void addColumnStr(String column) {
if(columnContainerStr.toString().indexOf(column)!=-1){
return;
}
if (columnContainerStr.length() > 0) {
columnContainerStr.append(",");
}
columnContainerStr.append(column);
}
public String getTableName() {
return tableName;
}
}
}
\ No newline at end of file
package com.viontech.fanxing.code.base;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
* @author suman
* 2016年8月15日 下午1:52:06
* @param <T>
*/
public interface BaseMapper<T extends BaseModel> {
/**
* 通过查询条件获取满足条件的数据数量
* @param example 查询条件
* @return 满足条件的数据数量
*/
public int countByExample(BaseExample example);
/**
* 通过条件删除数据
* @param example 条件
* @return 删除数量
*/
public int deleteByExample(BaseExample example);
/**
* 通过主键删除数据
* @param key 主键
* @return 删除数量
*/
public int deleteByPrimaryKey(Object id);
/**
* 将数据插入数据库<br>
* 所有字段都插入数据库不管是不是null
* @param record 需要插入数据库的对象
* @return
*/
public int insert(T record);
/**
* 将数据插入数据库<br>
* 将所有非null字段都插入数据库
* @param record
* @return
*/
public int insertSelective(T record);
/**
* 通过查询条件查询数据
* @param example 查询条件
* @return 数据对象列表
*/
public List<T> selectByExample(BaseExample example);
/**
* 通过主键查询数据
* @param key 主键
* @return 数据对象
*/
public T selectByPrimaryKey(Object id);
/**
* 通过条件更新数据<br>
* 更新所有字段
* @param record 需要更新的内容
* @param example 更新的条件
* @return 更新的数据数量
*/
public int updateByExampleSelective(@Param("record") T record, @Param("example") BaseExample example);
/**
* 通过条件更新数据<br>
* 更新所有字段
* @param record 需要更新的内容
* @param example 更新的条件
* @return 更新的数据数量
*/
public int updateByExample(@Param("record") T record, @Param("example") BaseExample example);
/**
* 通过主键更新对象<br>
* 只更新非null字段
* @param record 需要更新的内容及主键 主键不可为空
* @return 更新的数量
*/
public int updateByPrimaryKeySelective(T record);
/**
* 通过主键更新对象<br>
* 更新所有字段
* @param record 需要更新的内容及主键 主键不可为空
* @return 更新的数量
*/
public int updateByPrimaryKey(T record);
}
package com.viontech.fanxing.code.base;
import java.io.Serializable;
/**
*
* @author suman
* model类的基类 所有的model都要继承自该类
*/
public abstract class BaseModel implements Serializable{
private Long count;
private Long id;
public BaseModel() {
super();
}
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
package com.viontech.fanxing.code.base;
import com.github.pagehelper.PageInfo;
import java.util.List;
/**
* Service接口的基本接口,所有Service接口必须继承
* @author suman
*
* @param <T> 操作对应的model
*/
public interface BaseService<T extends BaseModel>{
/**
* 获取service对应的Mapper来进行操作
* @return
*/
public abstract com.viontech.fanxing.code.base.BaseMapper<T> getMapper();
/**
* 通过查询条件获取满足条件的数据数量
* @param example 查询条件
* @return 满足条件的数据数量
*/
int countByExample(BaseExample example);
/**
* 通过条件删除数据
* @param example 条件
* @return 删除数量
*/
int deleteByExample(BaseExample example);
/**
* 通过主键删除数据
* @param key 主键
* @return 删除数量
*/
int deleteByPrimaryKey(Object key);
/**
* 将数据插入数据库<br>
* 所有字段都插入数据库不管是不是null
* @param record 需要插入数据库的对象
* @return
*/
T insert(T record);
/**
* 将数据插入数据库<br>
* 将所有非null字段都插入数据库
* @param record
* @return
*/
T insertSelective(T record);
/**
* 通过查询条件查询数据
* @param example 查询条件
* @return 数据对象列表
*/
List<T> selectByExample(BaseExample example);
/**
* 通过主键查询数据
* @param key 主键
* @return 数据对象
*/
T selectByPrimaryKey(Object key);
/**
* 通过条件更新数据<br>
* 只更新非null字段
* @param record 需要更新的内容
* @param example 更新的条件
* @return 更新的数据数量
*/
int updateByExampleSelective(T record, BaseExample example);
/**
* 通过条件更新数据<br>
* 更新所有字段
* @param record 需要更新的内容
* @param example 更新的条件
* @return 更新的数据数量
*/
int updateByExample(T record,BaseExample example);
/**
* 通过主键更新对象<br>
* 只更新非null字段
* @param record 需要更新的内容及主键 主键不可为空
* @return 更新的数量
*/
int updateByPrimaryKeySelective(T record);
/**
* 通过主键更新对象<br>
* 更新所有字段
* @param record 需要更新的内容及主键 主键不可为空
* @return 更新的数量
*/
int updateByPrimaryKey(T record);
/**
* 通过查询条件和分页条件查询出一页数据
* @param example 查询条件
* @param page 页数
* @param limit 每页数据数量
* @return 一页数据
*/
PageInfo pagedQuery(BaseExample example, int page, int pageSize);
Object getPKByModel(BaseModel baseModel);
List getIdsByByExample(BaseExample example);
/**
* 根据实体属性名称获取对应表字段名称
* @param property
* @return
*/
String getColumnNameByProperty(String property);
}
package com.viontech.fanxing.code.base;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.mapping.ResultMap;
import org.apache.ibatis.mapping.ResultMapping;
import org.apache.ibatis.session.SqlSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Field;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public abstract class BaseServiceImpl <T extends BaseModel> implements BaseService<T> {
/**
* slf4j 日志对象 用来记录log
*/
protected Logger logger = LoggerFactory.getLogger(getClass());
private Map<String,String> columnNamePropertyMap = null;
public T selectByPrimaryKey(Object id) {
return getMapper().selectByPrimaryKey(id);
}
public T insert(T record) {
getMapper().insert(record);
return record;
}
@Override
public T insertSelective(T record) {
getMapper().insertSelective(record);
return record;
}
@Override
public int deleteByPrimaryKey(Object b) {
return getMapper().deleteByPrimaryKey(b);
}
@Override
public int updateByPrimaryKey(T record) {
return getMapper().updateByPrimaryKey(record);
}
@Override
public int updateByPrimaryKeySelective(T record) {
return getMapper().updateByPrimaryKeySelective(record);
}
@Override
public PageInfo<T> pagedQuery(BaseExample example, int pageNum, int pageSize) {
if(pageSize>0){
PageHelper.startPage(pageNum, pageSize);
Page<T> result = (Page<T>) getMapper().selectByExample(example);
PageInfo<T> pageInfo = new PageInfo<T>(result);
return pageInfo;
}else{
List<T> result = (List<T>) getMapper().selectByExample(example);
Page<T> p = new Page<T>();
p.addAll(result);
PageInfo<T> pageInfo = new PageInfo<T>(p);
return pageInfo;
}
}
@Override
public int countByExample(BaseExample example) {
return getMapper().countByExample(example);
}
@Override
public int deleteByExample(BaseExample example) {
return getMapper().deleteByExample(example);
}
@Override
public List<T> selectByExample(BaseExample example) {
return getMapper().selectByExample(example);
}
@Override
public int updateByExampleSelective(T record, BaseExample example) {
return getMapper().updateByExampleSelective(record, example);
}
@Override
public int updateByExample(T record, BaseExample example) {
return getMapper().updateByExample(record, example);
}
@Override
public List<Object> getIdsByByExample(BaseExample example) {
List<T> list= selectByExample(example);
List<Object> result = new ArrayList<Object>();
for(T t : list){
Object pk = getPKByModel(t);
if(pk!=null){
result.add(pk);
}
}
return result;
}
@Override
public Object getPKByModel(BaseModel baseModel) {
throw new UnsupportedOperationException();
}
public String getColumnNameByProperty(String property){
if(columnNamePropertyMap == null){
columnNamePropertyMap = getColumnNamePropertyMap();
}
return columnNamePropertyMap.get(property);
}
public Map getColumnNamePropertyMap(){
Map<String, String> result = new HashMap<String, String>();
try {
SqlSession sqlSession = getSqlSessionByMapper(getMapper());
ResultMap resultMap = sqlSession.getConfiguration().getResultMap(getMapperClassByMapper(getMapper()).getName()+".BaseResultMapRoot");
List<ResultMapping> propertyResultMappings = resultMap.getPropertyResultMappings();
for (ResultMapping resultMapping : propertyResultMappings) {
result.put(resultMapping.getProperty(), resultMapping.getColumn());
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
private SqlSession getSqlSessionByMapper(BaseMapper mapper) throws Exception {
Object mapperProxy = ((Proxy) mapper).getInvocationHandler(mapper);
Field sqlSession = mapperProxy.getClass().getDeclaredField("sqlSession");
sqlSession.setAccessible(true);
return (SqlSession) sqlSession.get(mapperProxy);
}
private Class getMapperClassByMapper(BaseMapper mapper) throws Exception {
Object mapperProxy = ((Proxy) mapper).getInvocationHandler(mapper);
Field mapperInterface = mapperProxy.getClass().getDeclaredField("mapperInterface");
mapperInterface.setAccessible(true);
return (Class) mapperInterface.get(mapperProxy);
}
}
package com.viontech.fanxing.code.base;
public interface VoInterface<T> {
public T getModel();
public void setModel(T t);
}
package com.viontech.fanxing.code.controller.base;
import com.viontech.fanxing.code.base.BaseController;
import com.viontech.fanxing.code.base.BaseExample;
import com.viontech.fanxing.code.base.BaseMapper;
import com.viontech.fanxing.code.base.BaseService;
import com.viontech.fanxing.code.mapper.DictCateMapper;
import com.viontech.fanxing.code.model.DictCate;
import com.viontech.fanxing.code.model.DictCateExample;
import com.viontech.fanxing.code.service.adapter.DictCateService;
import com.viontech.fanxing.code.vo.DictCateVo;
import javax.annotation.Resource;
public abstract class DictCateBaseController extends BaseController<DictCate, DictCateVo> {
@Resource
protected DictCateService dictCateService;
@Override
protected BaseExample getExample(DictCateVo dictCateVo, int type) {
DictCateExample dictCateExample = new DictCateExample();
DictCateExample.Criteria criteria = dictCateExample.createCriteria();
if(dictCateVo.getId() != null) {
criteria.andIdEqualTo(dictCateVo.getId());
}
if(dictCateVo.getId_arr() != null) {
criteria.andIdIn(dictCateVo.getId_arr());
}
if(dictCateVo.getId_gt() != null) {
criteria.andIdGreaterThan(dictCateVo.getId_gt());
}
if(dictCateVo.getId_lt() != null) {
criteria.andIdLessThan(dictCateVo.getId_lt());
}
if(dictCateVo.getId_gte() != null) {
criteria.andIdGreaterThanOrEqualTo(dictCateVo.getId_gte());
}
if(dictCateVo.getId_lte() != null) {
criteria.andIdLessThanOrEqualTo(dictCateVo.getId_lte());
}
if(dictCateVo.getUnid() != null) {
criteria.andUnidEqualTo(dictCateVo.getUnid());
}
if(dictCateVo.getUnid_arr() != null) {
criteria.andUnidIn(dictCateVo.getUnid_arr());
}
if(dictCateVo.getUnid_like() != null) {
criteria.andUnidLike(dictCateVo.getUnid_like());
}
if(dictCateVo.getCode() != null) {
criteria.andCodeEqualTo(dictCateVo.getCode());
}
if(dictCateVo.getCode_null() != null) {
if(dictCateVo.getCode_null().booleanValue()) {
criteria.andCodeIsNull();
} else {
criteria.andCodeIsNotNull();
}
}
if(dictCateVo.getCode_arr() != null) {
criteria.andCodeIn(dictCateVo.getCode_arr());
}
if(dictCateVo.getCode_like() != null) {
criteria.andCodeLike(dictCateVo.getCode_like());
}
if(dictCateVo.getName() != null) {
criteria.andNameEqualTo(dictCateVo.getName());
}
if(dictCateVo.getName_arr() != null) {
criteria.andNameIn(dictCateVo.getName_arr());
}
if(dictCateVo.getName_like() != null) {
criteria.andNameLike(dictCateVo.getName_like());
}
if(dictCateVo.getNote() != null) {
criteria.andNoteEqualTo(dictCateVo.getNote());
}
if(dictCateVo.getNote_null() != null) {
if(dictCateVo.getNote_null().booleanValue()) {
criteria.andNoteIsNull();
} else {
criteria.andNoteIsNotNull();
}
}
if(dictCateVo.getNote_arr() != null) {
criteria.andNoteIn(dictCateVo.getNote_arr());
}
if(dictCateVo.getNote_like() != null) {
criteria.andNoteLike(dictCateVo.getNote_like());
}
if(dictCateVo.getType() != null) {
criteria.andTypeEqualTo(dictCateVo.getType());
}
if(dictCateVo.getType_null() != null) {
if(dictCateVo.getType_null().booleanValue()) {
criteria.andTypeIsNull();
} else {
criteria.andTypeIsNotNull();
}
}
if(dictCateVo.getType_arr() != null) {
criteria.andTypeIn(dictCateVo.getType_arr());
}
if(dictCateVo.getType_like() != null) {
criteria.andTypeLike(dictCateVo.getType_like());
}
return dictCateExample;
}
@Override
protected BaseService<DictCate> getService() {
return dictCateService;
}
}
\ No newline at end of file
package com.viontech.fanxing.code.controller.base;
import com.viontech.fanxing.code.mapper.DictCodeMapper;
import com.viontech.fanxing.code.model.DictCode;
import com.viontech.fanxing.code.model.DictCodeExample;
import com.viontech.fanxing.code.service.adapter.DictCodeService;
import com.viontech.fanxing.code.vo.DictCodeVo;
import com.viontech.fanxing.code.base.BaseController;
import com.viontech.fanxing.code.base.BaseExample;
import com.viontech.fanxing.code.base.BaseMapper;
import com.viontech.fanxing.code.base.BaseService;
import javax.annotation.Resource;
public abstract class DictCodeBaseController extends BaseController<DictCode, DictCodeVo> {
@Resource
protected DictCodeService dictCodeService;
@Override
protected BaseExample getExample(DictCodeVo dictCodeVo, int type) {
DictCodeExample dictCodeExample = new DictCodeExample();
DictCodeExample.Criteria criteria = dictCodeExample.createCriteria();
if(dictCodeVo.getId() != null) {
criteria.andIdEqualTo(dictCodeVo.getId());
}
if(dictCodeVo.getId_arr() != null) {
criteria.andIdIn(dictCodeVo.getId_arr());
}
if(dictCodeVo.getId_gt() != null) {
criteria.andIdGreaterThan(dictCodeVo.getId_gt());
}
if(dictCodeVo.getId_lt() != null) {
criteria.andIdLessThan(dictCodeVo.getId_lt());
}
if(dictCodeVo.getId_gte() != null) {
criteria.andIdGreaterThanOrEqualTo(dictCodeVo.getId_gte());
}
if(dictCodeVo.getId_lte() != null) {
criteria.andIdLessThanOrEqualTo(dictCodeVo.getId_lte());
}
if(dictCodeVo.getUnid() != null) {
criteria.andUnidEqualTo(dictCodeVo.getUnid());
}
if(dictCodeVo.getUnid_arr() != null) {
criteria.andUnidIn(dictCodeVo.getUnid_arr());
}
if(dictCodeVo.getUnid_like() != null) {
criteria.andUnidLike(dictCodeVo.getUnid_like());
}
if(dictCodeVo.getCateId() != null) {
criteria.andCateIdEqualTo(dictCodeVo.getCateId());
}
if(dictCodeVo.getCateId_arr() != null) {
criteria.andCateIdIn(dictCodeVo.getCateId_arr());
}
if(dictCodeVo.getCateId_gt() != null) {
criteria.andCateIdGreaterThan(dictCodeVo.getCateId_gt());
}
if(dictCodeVo.getCateId_lt() != null) {
criteria.andCateIdLessThan(dictCodeVo.getCateId_lt());
}
if(dictCodeVo.getCateId_gte() != null) {
criteria.andCateIdGreaterThanOrEqualTo(dictCodeVo.getCateId_gte());
}
if(dictCodeVo.getCateId_lte() != null) {
criteria.andCateIdLessThanOrEqualTo(dictCodeVo.getCateId_lte());
}
if(dictCodeVo.getParentId() != null) {
criteria.andParentIdEqualTo(dictCodeVo.getParentId());
}
if(dictCodeVo.getParentId_null() != null) {
if(dictCodeVo.getParentId_null().booleanValue()) {
criteria.andParentIdIsNull();
} else {
criteria.andParentIdIsNotNull();
}
}
if(dictCodeVo.getParentId_arr() != null) {
criteria.andParentIdIn(dictCodeVo.getParentId_arr());
}
if(dictCodeVo.getParentId_gt() != null) {
criteria.andParentIdGreaterThan(dictCodeVo.getParentId_gt());
}
if(dictCodeVo.getParentId_lt() != null) {
criteria.andParentIdLessThan(dictCodeVo.getParentId_lt());
}
if(dictCodeVo.getParentId_gte() != null) {
criteria.andParentIdGreaterThanOrEqualTo(dictCodeVo.getParentId_gte());
}
if(dictCodeVo.getParentId_lte() != null) {
criteria.andParentIdLessThanOrEqualTo(dictCodeVo.getParentId_lte());
}
if(dictCodeVo.getCode() != null) {
criteria.andCodeEqualTo(dictCodeVo.getCode());
}
if(dictCodeVo.getCode_null() != null) {
if(dictCodeVo.getCode_null().booleanValue()) {
criteria.andCodeIsNull();
} else {
criteria.andCodeIsNotNull();
}
}
if(dictCodeVo.getCode_arr() != null) {
criteria.andCodeIn(dictCodeVo.getCode_arr());
}
if(dictCodeVo.getCode_like() != null) {
criteria.andCodeLike(dictCodeVo.getCode_like());
}
if(dictCodeVo.getName() != null) {
criteria.andNameEqualTo(dictCodeVo.getName());
}
if(dictCodeVo.getName_arr() != null) {
criteria.andNameIn(dictCodeVo.getName_arr());
}
if(dictCodeVo.getName_like() != null) {
criteria.andNameLike(dictCodeVo.getName_like());
}
if(dictCodeVo.getNote() != null) {
criteria.andNoteEqualTo(dictCodeVo.getNote());
}
if(dictCodeVo.getNote_null() != null) {
if(dictCodeVo.getNote_null().booleanValue()) {
criteria.andNoteIsNull();
} else {
criteria.andNoteIsNotNull();
}
}
if(dictCodeVo.getNote_arr() != null) {
criteria.andNoteIn(dictCodeVo.getNote_arr());
}
if(dictCodeVo.getNote_like() != null) {
criteria.andNoteLike(dictCodeVo.getNote_like());
}
return dictCodeExample;
}
@Override
protected BaseService<DictCode> getService() {
return dictCodeService;
}
}
\ No newline at end of file
package com.viontech.fanxing.code.controller.web;
import com.viontech.fanxing.code.base.BaseExample;
import com.viontech.fanxing.code.model.DictCateExample;
import com.viontech.fanxing.code.vo.DictCateVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.viontech.fanxing.code.controller.base.DictCateBaseController;
@Controller
@RequestMapping("/dictCates")
public class DictCateController extends DictCateBaseController {
@Override
protected BaseExample getExample(DictCateVo dictCateVo, int type) {
DictCateExample dictCateExample = (DictCateExample)super.getExample(dictCateVo,type);
return dictCateExample;
}
}
\ No newline at end of file
package com.viontech.fanxing.code.controller.web;
import com.viontech.fanxing.code.controller.base.DictCodeBaseController;
import com.viontech.fanxing.code.model.DictCode;
import com.viontech.fanxing.code.model.DictCodeExample;
import com.viontech.fanxing.code.vo.DictCodeVo;
import com.viontech.fanxing.code.base.BaseExample;
import com.viontech.fanxing.code.base.BaseMapper;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/dictCodes")
public class DictCodeController extends DictCodeBaseController {
@Override
protected BaseExample getExample(DictCodeVo dictCodeVo, int type) {
DictCodeExample dictCodeExample = (DictCodeExample)super.getExample(dictCodeVo,type);
return dictCodeExample;
}
}
\ No newline at end of file
package com.viontech.fanxing.code.mapper;
import com.viontech.fanxing.code.base.BaseMapper;
import com.viontech.fanxing.code.model.DictCate;
import com.viontech.fanxing.code.model.DictCateExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface DictCateMapper extends BaseMapper {
int countByExample(DictCateExample example);
int deleteByExample(DictCateExample example);
int deleteByPrimaryKey(Long id);
int insert(DictCate record);
int insertSelective(DictCate record);
List<DictCate> selectByExample(DictCateExample example);
DictCate selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") DictCate record, @Param("example") DictCateExample example);
int updateByExample(@Param("record") DictCate record, @Param("example") DictCateExample example);
int updateByPrimaryKeySelective(DictCate record);
int updateByPrimaryKey(DictCate record);
}
\ No newline at end of file
package com.viontech.fanxing.code.mapper;
import com.viontech.fanxing.code.base.BaseMapper;
import com.viontech.fanxing.code.model.DictCode;
import com.viontech.fanxing.code.model.DictCodeExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface DictCodeMapper extends BaseMapper {
int countByExample(DictCodeExample example);
int deleteByExample(DictCodeExample example);
int deleteByPrimaryKey(Long id);
int insert(DictCode record);
int insertSelective(DictCode record);
List<DictCode> selectByExample(DictCodeExample example);
DictCode selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") DictCode record, @Param("example") DictCodeExample example);
int updateByExample(@Param("record") DictCode record, @Param("example") DictCodeExample example);
int updateByPrimaryKeySelective(DictCode record);
int updateByPrimaryKey(DictCode record);
}
\ No newline at end of file
<?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.viontech.fanxing.code.mapper.DictCateMapper" >
<resultMap id="BaseResultMapRoot" type="com.viontech.fanxing.code.model.DictCate" >
<id column="dictCate_id" property="id" />
<result column="dictCate_unid" property="unid" />
<result column="dictCate_code" property="code" />
<result column="dictCate_name" property="name" />
<result column="dictCate_note" property="note" />
<result column="dictCate_type" property="type" />
</resultMap>
<resultMap id="BaseResultMap" type="com.viontech.fanxing.code.model.DictCate" extends="BaseResultMapRoot" />
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<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 collection="criterion.value" item="listItem" open="(" close=")" 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="(" suffix=")" prefixOverrides="and" >
<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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List_Root" >
`dictCate`.id as dictCate_id, `dictCate`.unid as dictCate_unid, `dictCate`.code as dictCate_code,
`dictCate`.`name` as `dictCate_name`, `dictCate`.note as dictCate_note, `dictCate`.`type` as `dictCate_type`
</sql>
<sql id="Base_Column_List" >
<if test="!(_parameter.getClass().getSimpleName() == 'DictCateExample')" >
<include refid="com.viontech.fanxing.code.mapper.DictCateMapper.Base_Column_List_Root" />
</if>
<if test="_parameter.getClass().getSimpleName() == 'DictCateExample'" >
<foreach collection="columnContainerSet" item="columns" separator="," >
<choose >
<when test="columns.tableName == 's_dict_cate'.toString()" >
<if test="columns.valid" >
${columns.columnContainerStr}
</if>
<if test="!columns.valid" >
<include refid="com.viontech.fanxing.code.mapper.DictCateMapper.Base_Column_List_Root" />
</if>
</when>
</choose>
</foreach>
</if>
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.viontech.fanxing.code.model.DictCateExample" >
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from `s_dict_cate` `dictCate`
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="groupByClause != null" >
group by ${groupByClause}
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from `s_dict_cate` `dictCate`
where `dictCate`.id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from `s_dict_cate` `dictCate`
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.viontech.fanxing.code.model.DictCateExample" >
delete from `s_dict_cate` `dictCate`
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.viontech.fanxing.code.model.DictCate" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into `s_dict_cate` (unid, code, `name`,
note, `type`)
values (#{unid,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{note,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.viontech.fanxing.code.model.DictCate" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into `s_dict_cate`
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="unid != null" >
unid,
</if>
<if test="code != null" >
code,
</if>
<if test="name != null" >
`name`,
</if>
<if test="note != null" >
note,
</if>
<if test="type != null" >
`type`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="unid != null" >
#{unid,jdbcType=VARCHAR},
</if>
<if test="code != null" >
#{code,jdbcType=VARCHAR},
</if>
<if test="name != null" >
#{name,jdbcType=VARCHAR},
</if>
<if test="note != null" >
#{note,jdbcType=VARCHAR},
</if>
<if test="type != null" >
#{type,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.viontech.fanxing.code.model.DictCateExample" resultType="java.lang.Integer" >
select count(*) from `s_dict_cate` `dictCate`
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update `s_dict_cate` `dictCate`
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.unid != null" >
unid = #{record.unid,jdbcType=VARCHAR},
</if>
<if test="record.code != null" >
code = #{record.code,jdbcType=VARCHAR},
</if>
<if test="record.name != null" >
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.note != null" >
note = #{record.note,jdbcType=VARCHAR},
</if>
<if test="record.type != null" >
`type` = #{record.type,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
update `s_dict_cate` `dictCate`
set id = #{record.id,jdbcType=BIGINT},
unid = #{record.unid,jdbcType=VARCHAR},
code = #{record.code,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
note = #{record.note,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.viontech.fanxing.code.model.DictCate" >
update `s_dict_cate`
<set >
<if test="unid != null" >
unid = #{unid,jdbcType=VARCHAR},
</if>
<if test="code != null" >
code = #{code,jdbcType=VARCHAR},
</if>
<if test="name != null" >
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="note != null" >
note = #{note,jdbcType=VARCHAR},
</if>
<if test="type != null" >
`type` = #{type,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.viontech.fanxing.code.model.DictCate" >
update `s_dict_cate`
set unid = #{unid,jdbcType=VARCHAR},
code = #{code,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
note = #{note,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
<?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.viontech.fanxing.code.mapper.DictCodeMapper" >
<resultMap id="BaseResultMapRoot" type="com.viontech.fanxing.code.model.DictCode" >
<id column="dictCode_id" property="id" />
<result column="dictCode_unid" property="unid" />
<result column="dictCode_cate_id" property="cateId" />
<result column="dictCode_parent_id" property="parentId" />
<result column="dictCode_code" property="code" />
<result column="dictCode_name" property="name" />
<result column="dictCode_note" property="note" />
</resultMap>
<resultMap id="BaseResultMap" type="com.viontech.fanxing.code.model.DictCode" extends="BaseResultMapRoot" />
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<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 collection="criterion.value" item="listItem" open="(" close=")" 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="(" suffix=")" prefixOverrides="and" >
<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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List_Root" >
`dictCode`.id as dictCode_id, `dictCode`.unid as dictCode_unid, `dictCode`.cate_id as dictCode_cate_id,
`dictCode`.parent_id as dictCode_parent_id, `dictCode`.code as dictCode_code, `dictCode`.`name` as `dictCode_name`,
`dictCode`.note as dictCode_note
</sql>
<sql id="Base_Column_List" >
<if test="!(_parameter.getClass().getSimpleName() == 'DictCodeExample')" >
<include refid="com.viontech.fanxing.code.mapper.DictCodeMapper.Base_Column_List_Root" />
</if>
<if test="_parameter.getClass().getSimpleName() == 'DictCodeExample'" >
<foreach collection="columnContainerSet" item="columns" separator="," >
<choose >
<when test="columns.tableName == 's_dict_code'.toString()" >
<if test="columns.valid" >
${columns.columnContainerStr}
</if>
<if test="!columns.valid" >
<include refid="com.viontech.fanxing.code.mapper.DictCodeMapper.Base_Column_List_Root" />
</if>
</when>
</choose>
</foreach>
</if>
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.viontech.fanxing.code.model.DictCodeExample" >
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from `s_dict_code` `dictCode`
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="groupByClause != null" >
group by ${groupByClause}
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from `s_dict_code` `dictCode`
where `dictCode`.id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from `s_dict_code` `dictCode`
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.viontech.fanxing.code.model.DictCodeExample" >
delete from `s_dict_code` `dictCode`
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.viontech.fanxing.code.model.DictCode" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into `s_dict_code` (unid, cate_id, parent_id,
code, `name`, note)
values (#{unid,jdbcType=VARCHAR}, #{cateId,jdbcType=BIGINT}, #{parentId,jdbcType=BIGINT},
#{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{note,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.viontech.fanxing.code.model.DictCode" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into `s_dict_code`
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="unid != null" >
unid,
</if>
<if test="cateId != null" >
cate_id,
</if>
<if test="parentId != null" >
parent_id,
</if>
<if test="code != null" >
code,
</if>
<if test="name != null" >
`name`,
</if>
<if test="note != null" >
note,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="unid != null" >
#{unid,jdbcType=VARCHAR},
</if>
<if test="cateId != null" >
#{cateId,jdbcType=BIGINT},
</if>
<if test="parentId != null" >
#{parentId,jdbcType=BIGINT},
</if>
<if test="code != null" >
#{code,jdbcType=VARCHAR},
</if>
<if test="name != null" >
#{name,jdbcType=VARCHAR},
</if>
<if test="note != null" >
#{note,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.viontech.fanxing.code.model.DictCodeExample" resultType="java.lang.Integer" >
select count(*) from `s_dict_code` `dictCode`
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update `s_dict_code` `dictCode`
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.unid != null" >
unid = #{record.unid,jdbcType=VARCHAR},
</if>
<if test="record.cateId != null" >
cate_id = #{record.cateId,jdbcType=BIGINT},
</if>
<if test="record.parentId != null" >
parent_id = #{record.parentId,jdbcType=BIGINT},
</if>
<if test="record.code != null" >
code = #{record.code,jdbcType=VARCHAR},
</if>
<if test="record.name != null" >
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.note != null" >
note = #{record.note,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
update `s_dict_code` `dictCode`
set id = #{record.id,jdbcType=BIGINT},
unid = #{record.unid,jdbcType=VARCHAR},
cate_id = #{record.cateId,jdbcType=BIGINT},
parent_id = #{record.parentId,jdbcType=BIGINT},
code = #{record.code,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
note = #{record.note,jdbcType=VARCHAR}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.viontech.fanxing.code.model.DictCode" >
update `s_dict_code`
<set >
<if test="unid != null" >
unid = #{unid,jdbcType=VARCHAR},
</if>
<if test="cateId != null" >
cate_id = #{cateId,jdbcType=BIGINT},
</if>
<if test="parentId != null" >
parent_id = #{parentId,jdbcType=BIGINT},
</if>
<if test="code != null" >
code = #{code,jdbcType=VARCHAR},
</if>
<if test="name != null" >
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="note != null" >
note = #{note,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.viontech.fanxing.code.model.DictCode" >
update `s_dict_code`
set unid = #{unid,jdbcType=VARCHAR},
cate_id = #{cateId,jdbcType=BIGINT},
parent_id = #{parentId,jdbcType=BIGINT},
code = #{code,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
note = #{note,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
package com.viontech.fanxing.code.model;
import com.viontech.fanxing.code.base.BaseModel;
public class DictCate extends BaseModel {
private Long id;
private String unid;
private String code;
private String name;
private String note;
private String type;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUnid() {
return unid;
}
public void setUnid(String unid) {
this.unid = unid == null ? null : unid.trim();
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code == null ? null : code.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note == null ? null : note.trim();
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
}
\ No newline at end of file
package com.viontech.fanxing.code.model;
import com.viontech.fanxing.code.base.BaseModel;
public class DictCode extends BaseModel {
private Long id;
private String unid;
private Long cateId;
private Long parentId;
private String code;
private String name;
private String note;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUnid() {
return unid;
}
public void setUnid(String unid) {
this.unid = unid == null ? null : unid.trim();
}
public Long getCateId() {
return cateId;
}
public void setCateId(Long cateId) {
this.cateId = cateId;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code == null ? null : code.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note == null ? null : note.trim();
}
}
\ No newline at end of file
package com.viontech.fanxing.code.service.adapter;
import com.viontech.fanxing.code.model.DictCate;
import com.viontech.fanxing.code.base.BaseService;
public interface DictCateService extends BaseService<DictCate> {
}
\ No newline at end of file
package com.viontech.fanxing.code.service.adapter;
import com.viontech.fanxing.code.model.DictCode;
import com.viontech.fanxing.code.base.BaseService;
public interface DictCodeService extends BaseService<DictCode> {
}
\ No newline at end of file
package com.viontech.fanxing.code.service.impl;
import com.viontech.fanxing.code.mapper.DictCateMapper;
import com.viontech.fanxing.code.model.DictCate;
import com.viontech.fanxing.code.service.adapter.DictCateService;
import com.viontech.fanxing.code.base.BaseMapper;
import com.viontech.fanxing.code.base.BaseServiceImpl;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
@Service
public class DictCateServiceImpl extends BaseServiceImpl<DictCate> implements DictCateService {
@Resource
private DictCateMapper dictCateMapper;
@Override
public BaseMapper<DictCate> getMapper() {
return dictCateMapper;
}
}
\ No newline at end of file
package com.viontech.fanxing.code.service.impl;
import com.viontech.fanxing.code.mapper.DictCodeMapper;
import com.viontech.fanxing.code.model.DictCode;
import com.viontech.fanxing.code.service.adapter.DictCodeService;
import com.viontech.fanxing.code.base.BaseMapper;
import com.viontech.fanxing.code.base.BaseServiceImpl;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
@Service
public class DictCodeServiceImpl extends BaseServiceImpl<DictCode> implements DictCodeService {
@Resource
private DictCodeMapper dictCodeMapper;
@Override
public BaseMapper<DictCode> getMapper() {
return dictCodeMapper;
}
}
\ No newline at end of file
package com.viontech.fanxing.code.vo;
import com.viontech.fanxing.code.model.DictCate;
import com.viontech.fanxing.code.vobase.DictCateVoBase;
public class DictCateVo extends DictCateVoBase {
public DictCateVo() {
super();
}
public DictCateVo(DictCate dictCate) {
super(dictCate);
}
}
\ No newline at end of file
package com.viontech.fanxing.code.vo;
import com.viontech.fanxing.code.model.DictCode;
import com.viontech.fanxing.code.vobase.DictCodeVoBase;
public class DictCodeVo extends DictCodeVoBase {
public DictCodeVo() {
super();
}
public DictCodeVo(DictCode dictCode) {
super(dictCode);
}
}
\ No newline at end of file
package com.viontech.fanxing.code.vobase;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.viontech.fanxing.code.base.VoInterface;
import com.viontech.fanxing.code.model.DictCate;
import java.util.ArrayList;
public class DictCateVoBase extends DictCate implements VoInterface<DictCate> {
private DictCate dictCate;
@JsonIgnore
private ArrayList<Long> id_arr;
@JsonIgnore
private Long id_gt;
@JsonIgnore
private Long id_lt;
@JsonIgnore
private Long id_gte;
@JsonIgnore
private Long id_lte;
@JsonIgnore
private ArrayList<String> unid_arr;
@JsonIgnore
private String unid_like;
@JsonIgnore
private Boolean code_null;
@JsonIgnore
private ArrayList<String> code_arr;
@JsonIgnore
private String code_like;
@JsonIgnore
private ArrayList<String> name_arr;
@JsonIgnore
private String name_like;
@JsonIgnore
private Boolean note_null;
@JsonIgnore
private ArrayList<String> note_arr;
@JsonIgnore
private String note_like;
@JsonIgnore
private Boolean type_null;
@JsonIgnore
private ArrayList<String> type_arr;
@JsonIgnore
private String type_like;
public DictCateVoBase() {
this(null);
}
public DictCateVoBase(DictCate dictCate) {
if(dictCate == null) {
dictCate = new DictCate();
}
this.dictCate = dictCate;
}
@JsonIgnore
public DictCate getModel() {
return dictCate;
}
public void setModel(DictCate dictCate) {
this.dictCate = dictCate;
}
public ArrayList<Long> getId_arr() {
return id_arr;
}
public void setId_arr(ArrayList<Long> id_arr) {
this.id_arr = id_arr;
}
public Long getId_gt() {
return id_gt;
}
public void setId_gt(Long id_gt) {
this.id_gt = id_gt;
}
public Long getId_lt() {
return id_lt;
}
public void setId_lt(Long id_lt) {
this.id_lt = id_lt;
}
public Long getId_gte() {
return id_gte;
}
public void setId_gte(Long id_gte) {
this.id_gte = id_gte;
}
public Long getId_lte() {
return id_lte;
}
public void setId_lte(Long id_lte) {
this.id_lte = id_lte;
}
public Long getId() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getId();
}
public void setId(Long id) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setId(id);
}
public ArrayList<String> getUnid_arr() {
return unid_arr;
}
public void setUnid_arr(ArrayList<String> unid_arr) {
this.unid_arr = unid_arr;
}
public String getUnid_like() {
return unid_like;
}
public void setUnid_like(String unid_like) {
this.unid_like = unid_like;
}
public String getUnid() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getUnid();
}
public void setUnid(String unid) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setUnid(unid);
}
public Boolean getCode_null() {
return code_null;
}
public void setCode_null(Boolean code_null) {
this.code_null = code_null;
}
public ArrayList<String> getCode_arr() {
return code_arr;
}
public void setCode_arr(ArrayList<String> code_arr) {
this.code_arr = code_arr;
}
public String getCode_like() {
return code_like;
}
public void setCode_like(String code_like) {
this.code_like = code_like;
}
public String getCode() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getCode();
}
public void setCode(String code) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setCode(code);
}
public ArrayList<String> getName_arr() {
return name_arr;
}
public void setName_arr(ArrayList<String> name_arr) {
this.name_arr = name_arr;
}
public String getName_like() {
return name_like;
}
public void setName_like(String name_like) {
this.name_like = name_like;
}
public String getName() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getName();
}
public void setName(String name) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setName(name);
}
public Boolean getNote_null() {
return note_null;
}
public void setNote_null(Boolean note_null) {
this.note_null = note_null;
}
public ArrayList<String> getNote_arr() {
return note_arr;
}
public void setNote_arr(ArrayList<String> note_arr) {
this.note_arr = note_arr;
}
public String getNote_like() {
return note_like;
}
public void setNote_like(String note_like) {
this.note_like = note_like;
}
public String getNote() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getNote();
}
public void setNote(String note) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setNote(note);
}
public Boolean getType_null() {
return type_null;
}
public void setType_null(Boolean type_null) {
this.type_null = type_null;
}
public ArrayList<String> getType_arr() {
return type_arr;
}
public void setType_arr(ArrayList<String> type_arr) {
this.type_arr = type_arr;
}
public String getType_like() {
return type_like;
}
public void setType_like(String type_like) {
this.type_like = type_like;
}
public String getType() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getType();
}
public void setType(String type) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setType(type);
}
}
\ No newline at end of file
package com.viontech.fanxing.code.vobase;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.viontech.fanxing.code.base.VoInterface;
import com.viontech.fanxing.code.model.DictCode;
import java.util.ArrayList;
public class DictCodeVoBase extends DictCode implements VoInterface<DictCode> {
private DictCode dictCode;
@JsonIgnore
private ArrayList<Long> id_arr;
@JsonIgnore
private Long id_gt;
@JsonIgnore
private Long id_lt;
@JsonIgnore
private Long id_gte;
@JsonIgnore
private Long id_lte;
@JsonIgnore
private ArrayList<String> unid_arr;
@JsonIgnore
private String unid_like;
@JsonIgnore
private ArrayList<Long> cateId_arr;
@JsonIgnore
private Long cateId_gt;
@JsonIgnore
private Long cateId_lt;
@JsonIgnore
private Long cateId_gte;
@JsonIgnore
private Long cateId_lte;
@JsonIgnore
private Boolean parentId_null;
@JsonIgnore
private ArrayList<Long> parentId_arr;
@JsonIgnore
private Long parentId_gt;
@JsonIgnore
private Long parentId_lt;
@JsonIgnore
private Long parentId_gte;
@JsonIgnore
private Long parentId_lte;
@JsonIgnore
private Boolean code_null;
@JsonIgnore
private ArrayList<String> code_arr;
@JsonIgnore
private String code_like;
@JsonIgnore
private ArrayList<String> name_arr;
@JsonIgnore
private String name_like;
@JsonIgnore
private Boolean note_null;
@JsonIgnore
private ArrayList<String> note_arr;
@JsonIgnore
private String note_like;
public DictCodeVoBase() {
this(null);
}
public DictCodeVoBase(DictCode dictCode) {
if(dictCode == null) {
dictCode = new DictCode();
}
this.dictCode = dictCode;
}
@JsonIgnore
public DictCode getModel() {
return dictCode;
}
public void setModel(DictCode dictCode) {
this.dictCode = dictCode;
}
public ArrayList<Long> getId_arr() {
return id_arr;
}
public void setId_arr(ArrayList<Long> id_arr) {
this.id_arr = id_arr;
}
public Long getId_gt() {
return id_gt;
}
public void setId_gt(Long id_gt) {
this.id_gt = id_gt;
}
public Long getId_lt() {
return id_lt;
}
public void setId_lt(Long id_lt) {
this.id_lt = id_lt;
}
public Long getId_gte() {
return id_gte;
}
public void setId_gte(Long id_gte) {
this.id_gte = id_gte;
}
public Long getId_lte() {
return id_lte;
}
public void setId_lte(Long id_lte) {
this.id_lte = id_lte;
}
public Long getId() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getId();
}
public void setId(Long id) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setId(id);
}
public ArrayList<String> getUnid_arr() {
return unid_arr;
}
public void setUnid_arr(ArrayList<String> unid_arr) {
this.unid_arr = unid_arr;
}
public String getUnid_like() {
return unid_like;
}
public void setUnid_like(String unid_like) {
this.unid_like = unid_like;
}
public String getUnid() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getUnid();
}
public void setUnid(String unid) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setUnid(unid);
}
public ArrayList<Long> getCateId_arr() {
return cateId_arr;
}
public void setCateId_arr(ArrayList<Long> cateId_arr) {
this.cateId_arr = cateId_arr;
}
public Long getCateId_gt() {
return cateId_gt;
}
public void setCateId_gt(Long cateId_gt) {
this.cateId_gt = cateId_gt;
}
public Long getCateId_lt() {
return cateId_lt;
}
public void setCateId_lt(Long cateId_lt) {
this.cateId_lt = cateId_lt;
}
public Long getCateId_gte() {
return cateId_gte;
}
public void setCateId_gte(Long cateId_gte) {
this.cateId_gte = cateId_gte;
}
public Long getCateId_lte() {
return cateId_lte;
}
public void setCateId_lte(Long cateId_lte) {
this.cateId_lte = cateId_lte;
}
public Long getCateId() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getCateId();
}
public void setCateId(Long cateId) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setCateId(cateId);
}
public Boolean getParentId_null() {
return parentId_null;
}
public void setParentId_null(Boolean parentId_null) {
this.parentId_null = parentId_null;
}
public ArrayList<Long> getParentId_arr() {
return parentId_arr;
}
public void setParentId_arr(ArrayList<Long> parentId_arr) {
this.parentId_arr = parentId_arr;
}
public Long getParentId_gt() {
return parentId_gt;
}
public void setParentId_gt(Long parentId_gt) {
this.parentId_gt = parentId_gt;
}
public Long getParentId_lt() {
return parentId_lt;
}
public void setParentId_lt(Long parentId_lt) {
this.parentId_lt = parentId_lt;
}
public Long getParentId_gte() {
return parentId_gte;
}
public void setParentId_gte(Long parentId_gte) {
this.parentId_gte = parentId_gte;
}
public Long getParentId_lte() {
return parentId_lte;
}
public void setParentId_lte(Long parentId_lte) {
this.parentId_lte = parentId_lte;
}
public Long getParentId() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getParentId();
}
public void setParentId(Long parentId) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setParentId(parentId);
}
public Boolean getCode_null() {
return code_null;
}
public void setCode_null(Boolean code_null) {
this.code_null = code_null;
}
public ArrayList<String> getCode_arr() {
return code_arr;
}
public void setCode_arr(ArrayList<String> code_arr) {
this.code_arr = code_arr;
}
public String getCode_like() {
return code_like;
}
public void setCode_like(String code_like) {
this.code_like = code_like;
}
public String getCode() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getCode();
}
public void setCode(String code) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setCode(code);
}
public ArrayList<String> getName_arr() {
return name_arr;
}
public void setName_arr(ArrayList<String> name_arr) {
this.name_arr = name_arr;
}
public String getName_like() {
return name_like;
}
public void setName_like(String name_like) {
this.name_like = name_like;
}
public String getName() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getName();
}
public void setName(String name) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setName(name);
}
public Boolean getNote_null() {
return note_null;
}
public void setNote_null(Boolean note_null) {
this.note_null = note_null;
}
public ArrayList<String> getNote_arr() {
return note_arr;
}
public void setNote_arr(ArrayList<String> note_arr) {
this.note_arr = note_arr;
}
public String getNote_like() {
return note_like;
}
public void setNote_like(String note_like) {
this.note_like = note_like;
}
public String getNote() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getNote();
}
public void setNote(String note) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setNote(note);
}
}
\ No newline at end of file
spring:
cloud:
consul:
# 服务发现配置
discovery:
# 启用服务发现
enabled: true
# 启用服务注册
register: true
# 服务停止时取消注册
deregister: true
# 表示注册时使用IP而不是hostname
prefer-ip-address: true
# 执行监控检查的频率
health-check-interval: 10s
# 设置健康检查失败多长时间后,取消注册
health-check-critical-timeout: 30s
# 健康检查的路径
health-check-path: /actuator/info
# 服务注册标识,格式为:应用名称:服务器IP:端口
instance-id: ${spring.application.name}:${spring.cloud.consul.discovery.ip-address}:${server.port}
ip-address: 192.168.9.146
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.9.233:3306/fanxing3
username: root
password: 123456
redis:
host: localhost
port: 6379
password: vionredis
database: 2
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
default-property-inclusion: non_null
logging:
config: classpath:logback-${spring.profiles.active}.xml
mybatis:
type-aliases-package: com.viontech.lable.model
mapper-locations: classpath:com/viontech/fanxing/code/mapping/*.xml
pagehelper:
helper-dialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countByExample
server:
port: 30006
spring:
profiles:
active:
${PROFILE}
application:
name: fanxing-code
cloud:
consul:
host: 192.168.9.233
port: 8500
discovery:
service-name: ${spring.application.name}
# config 在 consul > key/value 中命名规则: prefix/default-context,profiles.active/data-key
config:
enabled: true
format: YAML
prefix: fanxing
default-context: ${spring.application.name}
data-key: config
watch:
enabled: true
delay: 10000
wait-time: 30
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="10 seconds">
<contextName>logback</contextName>
<property name="log.path" value="logs"/>
<property name="pattern" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%thread] %logger{50} - %msg%n"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>info</level>
</filter>
<encoder>
<Pattern>${pattern}</Pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="CONSOLE"/>
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 -->
<!-- scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true -->
<!-- scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 -->
<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
<configuration scan="true" scanPeriod="10 seconds">
<!--<include resource="org/springframework/boot/logging/logback/base.xml" />-->
<contextName>logback</contextName>
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 -->
<property name="log.path" value="logs"/>
<property name="pattern" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%thread] %logger{50} - %msg%n"/>
<!--输出到控制台-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>info</level>
</filter>
<encoder>
<Pattern>${pattern}</Pattern>
<!-- 设置字符集 -->
</encoder>
</appender>
<!--输出到文件-->
<!-- 时间滚动输出 level为 DEBUG 日志 -->
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_debug.log</file>
<!--日志文件输出格式-->
<encoder>
<Pattern>${pattern}</Pattern>
<charset>UTF-8</charset> <!-- 设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志归档 -->
<fileNamePattern>${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录debug级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 INFO 日志 -->
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_info.log</file>
<!--日志文件输出格式-->
<encoder>
<Pattern>${pattern}</Pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 每天日志归档路径以及格式 -->
<fileNamePattern>${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录info级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>NEUTRAL</onMismatch>
</filter>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 WARN 日志 -->
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_warn.log</file>
<!--日志文件输出格式-->
<encoder>
<Pattern>${pattern}</Pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>5</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录warn级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 ERROR 日志 -->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_error.log</file>
<!--日志文件输出格式-->
<encoder>
<Pattern>${pattern}</Pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录ERROR级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<logger name="com.viontech" level="debug">
<appender-ref ref="DEBUG_FILE"/>
</logger>
<root level="info">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/>
</root>
</configuration>
\ No newline at end of file
......@@ -55,5 +55,16 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>com.viontech.keliu</groupId>
<artifactId>keliu-util</artifactId>
<version>6.0.10-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -15,7 +15,7 @@ singleServerConfig:
subscriptionConnectionPoolSize: 50
connectionMinimumIdleSize: 32
connectionPoolSize: 64
database: 0
database: 2
dnsMonitoringInterval: 5000
# 集群配置
#clusterServersConfig:
......
......@@ -13,7 +13,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
* @author 谢明辉
* @date 2021/6/11
*/
@SpringBootApplication
@SpringBootApplication(scanBasePackages = "com.viontech.fanxing")
@EnableDiscoveryClient
@EnableScheduling
@EnableFeignClients
......
......@@ -12,7 +12,7 @@ spring:
# 表示注册时使用IP而不是hostname
prefer-ip-address: true
# 执行监控检查的频率
health-check-interval: 30s
health-check-interval: 10s
# 设置健康检查失败多长时间后,取消注册
health-check-critical-timeout: 30s
# 健康检查的路径
......@@ -30,5 +30,9 @@ spring:
port: 6379
password: vionredis
database: 2
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
default-property-inclusion: non_null
logging:
config: classpath:logback-${spring.profiles.active}.xml
\ No newline at end of file
......@@ -13,7 +13,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
* @author 谢明辉
* @date 2021/6/11
*/
@SpringBootApplication
@SpringBootApplication(scanBasePackages = "com.viontech.fanxing")
@EnableDiscoveryClient
@EnableScheduling
@EnableFeignClients
......
......@@ -23,7 +23,7 @@ spring:
# 表示注册时使用IP而不是hostname
prefer-ip-address: true
# 执行监控检查的频率
health-check-interval: 30s
health-check-interval: 10s
# 设置健康检查失败多长时间后,取消注册
health-check-critical-timeout: 30s
# 健康检查的路径
......@@ -41,5 +41,9 @@ spring:
port: 6379
password: vionredis
database: 2
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
default-property-inclusion: non_null
logging:
config: classpath:logback-${spring.profiles.active}.xml
\ No newline at end of file
......@@ -15,7 +15,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
*/
@EnableDiscoveryClient
@EnableScheduling
@SpringBootApplication
@SpringBootApplication(scanBasePackages = "com.viontech.fanxing")
@EnableFeignClients
@Slf4j
public class OpsApp {
......
......@@ -12,7 +12,7 @@ spring:
# 表示注册时使用IP而不是hostname
prefer-ip-address: true
# 执行监控检查的频率
health-check-interval: 30s
health-check-interval: 10s
# 设置健康检查失败多长时间后,取消注册
health-check-critical-timeout: 30s
# 健康检查的路径
......@@ -30,5 +30,9 @@ spring:
port: 6379
password: vionredis
database: 2
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
default-property-inclusion: non_null
logging:
config: classpath:logback-${spring.profiles.active}.xml
......@@ -15,7 +15,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
*/
@EnableDiscoveryClient
@EnableScheduling
@SpringBootApplication
@SpringBootApplication(scanBasePackages = "com.viontech.fanxing")
@EnableFeignClients
@Slf4j
public class QueryApp {
......
......@@ -12,7 +12,7 @@ spring:
# 表示注册时使用IP而不是hostname
prefer-ip-address: true
# 执行监控检查的频率
health-check-interval: 30s
health-check-interval: 10s
# 设置健康检查失败多长时间后,取消注册
health-check-critical-timeout: 30s
# 健康检查的路径
......@@ -30,5 +30,9 @@ spring:
port: 6379
password: vionredis
database: 2
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
default-property-inclusion: non_null
logging:
config: classpath:logback-${spring.profiles.active}.xml
......@@ -15,7 +15,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
*/
@EnableDiscoveryClient
@EnableScheduling
@SpringBootApplication
@SpringBootApplication(scanBasePackages = "com.viontech.fanxing")
@EnableFeignClients
@Slf4j
public class TaskManagerApp {
......
......@@ -12,7 +12,7 @@ spring:
# 表示注册时使用IP而不是hostname
prefer-ip-address: true
# 执行监控检查的频率
health-check-interval: 30s
health-check-interval: 10s
# 设置健康检查失败多长时间后,取消注册
health-check-critical-timeout: 30s
# 健康检查的路径
......@@ -30,5 +30,9 @@ spring:
port: 6379
password: vionredis
database: 2
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
default-property-inclusion: non_null
logging:
config: classpath:logback-${spring.profiles.active}.xml
......@@ -15,7 +15,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
*/
@EnableDiscoveryClient
@EnableScheduling
@SpringBootApplication
@SpringBootApplication(scanBasePackages = "com.viontech.fanxing")
@EnableFeignClients
@Slf4j
public class TaskSchedulingApp {
......
package com.viontech.fanxing.task.scheduling.config;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.spring.data.connection.RedissonConnectionFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import java.io.IOException;
/**
* .
*
* @author 谢明辉
* @date 2021/7/5
*/
@Configuration
public class RedissonConfig {
@Bean
public RedissonConnectionFactory redissonConnectionFactory(RedissonClient redisson) {
return new RedissonConnectionFactory(redisson);
}
@Bean(destroyMethod = "shutdown")
public RedissonClient redisson(@Value("classpath:/redisson.yml") Resource configFile) throws IOException {
Config config = Config.fromYAML(configFile.getInputStream());
return Redisson.create(config);
}
}
......@@ -12,7 +12,7 @@ spring:
# 表示注册时使用IP而不是hostname
prefer-ip-address: true
# 执行监控检查的频率
health-check-interval: 30s
health-check-interval: 10s
# 设置健康检查失败多长时间后,取消注册
health-check-critical-timeout: 30s
# 健康检查的路径
......@@ -25,6 +25,10 @@ spring:
port: 6379
password: vionredis
database: 2
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
default-property-inclusion: non_null
autoconfigure:
exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
logging:
......
......@@ -21,6 +21,7 @@
<module>fanxing-forward</module>
<module>fanxing-ops</module>
<module>fanxing-query</module>
<module>fanxing-code</module>
</modules>
<dependencyManagement>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!