* 修改绑定列名逻辑
This commit is contained in:
parent
743f459c18
commit
8d90b658da
|
@ -160,15 +160,22 @@ public class QueryBuilder {
|
|||
|
||||
/**
|
||||
* 获取数据表的列名(驼峰转下划线蛇形命名)
|
||||
* <br>
|
||||
* 列名取值优先级: @BindQuery.field > @TableField.value > field.name
|
||||
*
|
||||
* @param field
|
||||
* @return
|
||||
*/
|
||||
private static String getColumnName(Field field){
|
||||
BindQuery annotation = field.getAnnotation(BindQuery.class);
|
||||
if (annotation != null && V.notEmpty(annotation.field())){
|
||||
return annotation.field();
|
||||
String columnName = "";
|
||||
if (field.isAnnotationPresent(BindQuery.class)) {
|
||||
columnName = field.getAnnotation(BindQuery.class).field();
|
||||
}
|
||||
return S.toSnakeCase(field.getName());
|
||||
if (field.isAnnotationPresent(TableField.class)) {
|
||||
columnName = field.getAnnotation(TableField.class).value();
|
||||
}
|
||||
return V.notEmpty(columnName) ? columnName : S.toSnakeCase(field.getName());
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
apply plugin: 'org.springframework.boot'
|
||||
|
||||
dependencies {
|
||||
|
||||
// compile("com.diboot:diboot-shiro:2.0.1")
|
||||
compile project(":diboot-shiro-wx-mp")
|
||||
compile project(":diboot-shiro-wx-cp")
|
||||
compile project(":diboot-components-msg")
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.diboot.example.config;
|
|||
|
||||
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
|
||||
import com.baomidou.mybatisplus.core.injector.ISqlInjector;
|
||||
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
|
||||
//import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
|
|
@ -24,6 +24,11 @@ import org.springframework.web.bind.annotation.*;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据字典类
|
||||
*
|
||||
* @author wee
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dictionary")
|
||||
@AuthorizationPrefix(name = "数据字典", code = "dictionary", prefix = "dictionary")
|
||||
|
@ -38,9 +43,15 @@ public class DictionaryController extends BaseCrudRestController {
|
|||
return dictionaryService;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* 获取列表页数据
|
||||
* */
|
||||
*
|
||||
* @param dictionary
|
||||
* @param pagination
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@AuthorizationWrapper(value = @RequiresPermissions("list"), name = "列表")
|
||||
public JsonResult list(Dictionary dictionary, Pagination pagination, HttpServletRequest request) throws Exception {
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.List;
|
|||
* @version v2.0
|
||||
* @date 2019/7/8
|
||||
*/
|
||||
@Service("dictionaryService")
|
||||
@Service("exampleDictionaryService")
|
||||
@Slf4j
|
||||
public class DictionaryServiceImpl extends BaseServiceImpl<DictionaryMapper, Dictionary> implements DictionaryService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(DictionaryServiceImpl.class);
|
||||
|
|
Loading…
Reference in New Issue