关联查询
This commit is contained in:
parent
1b7b607e29
commit
29bfe5f1ed
|
|
@ -1,12 +1,21 @@
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
|
||||||
// 查询关联查询父列表
|
// 查询关联查询父列表
|
||||||
export function listFather(query) {
|
export function listFather(data) {
|
||||||
console.log(query)
|
|
||||||
return request({
|
return request({
|
||||||
url: '/test/father/list',
|
url: '/test/father/list',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: query
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出关联查询父
|
||||||
|
export function exportFather(data) {
|
||||||
|
return request({
|
||||||
|
url: '/test/father/export',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,12 +52,3 @@ export function delFather(id) {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出关联查询父
|
|
||||||
export function exportFather(query) {
|
|
||||||
return request({
|
|
||||||
url: '/test/father/export',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,7 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="父id" align="center" prop="assSun.fId" :formatter="fIdFormat" />
|
||||||
<el-table-column label="名称" align="center" prop="assSun.sname" :formatter="snameFormat" />
|
<el-table-column label="名称" align="center" prop="assSun.sname" :formatter="snameFormat" />
|
||||||
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
|
@ -139,8 +140,8 @@
|
||||||
<pagination
|
<pagination
|
||||||
v-show="total>0"
|
v-show="total>0"
|
||||||
:total="total"
|
:total="total"
|
||||||
:page.sync="queryParams.pageNum"
|
:page.sync="queryParams.params.pageNum"
|
||||||
:limit.sync="queryParams.pageSize"
|
:limit.sync="queryParams.params.pageSize"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
@ -194,7 +195,6 @@ export default {
|
||||||
open: false,
|
open: false,
|
||||||
// 创建时间时间范围
|
// 创建时间时间范围
|
||||||
daterangeCreateTime: [],
|
daterangeCreateTime: [],
|
||||||
assCreateTime: [],
|
|
||||||
// 主键字典
|
// 主键字典
|
||||||
idOptions: [],
|
idOptions: [],
|
||||||
// 父id字典
|
// 父id字典
|
||||||
|
|
@ -234,6 +234,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询关联查询父列表 */
|
/** 查询关联查询父列表 */
|
||||||
getList() {
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
|
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
|
||||||
this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
|
this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
|
||||||
this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
|
this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,9 @@ public @interface Excel
|
||||||
/**
|
/**
|
||||||
* 导出时在excel中排序
|
* 导出时在excel中排序
|
||||||
*/
|
*/
|
||||||
public int sort() default Integer.MAX_VALUE;
|
// public int sort() default Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
public int sort() default 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出到Excel中的名字.
|
* 导出到Excel中的名字.
|
||||||
|
|
@ -105,6 +107,7 @@ public @interface Excel
|
||||||
*/
|
*/
|
||||||
public boolean isStatistics() default false;
|
public boolean isStatistics() default false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,18 @@ public class HcyBaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置请求分页数据
|
||||||
|
*/
|
||||||
|
public void startPage(Map<String,Object> map) {
|
||||||
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
|
Integer pageNum = (Integer) map.get("pageNum");
|
||||||
|
Integer pageSize = (Integer) map.get("pageSize");
|
||||||
|
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
|
||||||
|
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
||||||
|
PageHelper.startPage(pageNum, pageSize, orderBy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 响应请求分页数据
|
* 响应请求分页数据
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import java.util.Map;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.hchyun.common.annotation.Excel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entity基类
|
* Entity基类
|
||||||
|
|
@ -30,6 +31,7 @@ public class BaseEntity implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
@Excel(name = "创建时间",dateFormat = "yyyy-MM-dd HH:mm:ss",sort = Integer.MAX_VALUE-1)
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
|
@ -41,6 +43,7 @@ public class BaseEntity implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
|
@Excel(name = "更新时间",dateFormat = "yyyy-MM-dd HH:mm:ss",sort = Integer.MAX_VALUE)
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -736,7 +736,7 @@ public class ExcelUtil<T> {
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** todo
|
||||||
* 得到所有定义字段
|
* 得到所有定义字段
|
||||||
*/
|
*/
|
||||||
private void createExcelField() {
|
private void createExcelField() {
|
||||||
|
|
|
||||||
|
|
@ -57,21 +57,17 @@ public class ${ClassName}Controller extends HcyBaseController {
|
||||||
*/
|
*/
|
||||||
@ApiOperation("查询${functionName}列表")
|
@ApiOperation("查询${functionName}列表")
|
||||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
|
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
|
||||||
#if($table.crud || $table.sub || $table.tplCategory.equals("ass"))
|
|
||||||
#if($table.tplCategory.equals("ass"))
|
|
||||||
@PutMapping("/list")
|
@PutMapping("/list")
|
||||||
public Serializable list(@Validated @RequestBody ${ClassName} ${className}) {
|
public Serializable list(@Validated @RequestBody ${ClassName} ${className}) {
|
||||||
try {
|
try {
|
||||||
startPage(assFather.getParams());
|
startPage(${className}.getParams());
|
||||||
#else
|
|
||||||
@GetMapping("/list")
|
|
||||||
public Serializable list(${ClassName} ${className}) {
|
|
||||||
try {
|
|
||||||
startPage();
|
|
||||||
#end
|
|
||||||
ServerResult<List<${ClassName}>> serverResult = ${className}Service.select${ClassName}List(${className});
|
ServerResult<List<${ClassName}>> serverResult = ${className}Service.select${ClassName}List(${className});
|
||||||
if (serverResult.isStart()) {
|
if (serverResult.isStart()) {
|
||||||
|
#if($table.crud || $table.sub || $table.tplCategory.equals("ass"))
|
||||||
return getDataTable(serverResult.getData());
|
return getDataTable(serverResult.getData());
|
||||||
|
#elseif($table.tree)
|
||||||
|
return AjaxResult.success(serverResult.getData());
|
||||||
|
#end
|
||||||
} else {
|
} else {
|
||||||
return AjaxResult.info(serverResult.getMsg());
|
return AjaxResult.info(serverResult.getMsg());
|
||||||
}
|
}
|
||||||
|
|
@ -80,13 +76,6 @@ public class ${ClassName}Controller extends HcyBaseController {
|
||||||
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elseif($table.tree)
|
|
||||||
@GetMapping("/list")
|
|
||||||
public AjaxResult list(${ClassName} ${className}) {
|
|
||||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
|
||||||
return AjaxResult.success(list);
|
|
||||||
}
|
|
||||||
#end
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出${functionName}列表
|
* 导出${functionName}列表
|
||||||
|
|
@ -94,8 +83,8 @@ public class ${ClassName}Controller extends HcyBaseController {
|
||||||
@ApiOperation("导出${functionName}列表")
|
@ApiOperation("导出${functionName}列表")
|
||||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
|
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export")
|
@PutMapping("/export")
|
||||||
public AjaxResult export(${ClassName} ${className}) {
|
public AjaxResult export(@Validated @RequestBody ${ClassName} ${className}) {
|
||||||
try {
|
try {
|
||||||
ServerResult<List<${ClassName}>> serverResult = ${className}Service.select${ClassName}List(${className});
|
ServerResult<List<${ClassName}>> serverResult = ${className}Service.select${ClassName}List(${className});
|
||||||
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}. class);
|
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}. class);
|
||||||
|
|
@ -242,19 +231,4 @@ public class ${ClassName}Controller extends HcyBaseController {
|
||||||
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if($table.tplCategory.equals("ass"))
|
|
||||||
/**
|
|
||||||
* 设置请求分页数据
|
|
||||||
*/
|
|
||||||
public void startPage(Map<String,Object> map) {
|
|
||||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
||||||
Integer pageNum = (Integer) map.get("pageNum");
|
|
||||||
Integer pageSize = (Integer) map.get("pageSize");
|
|
||||||
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
|
|
||||||
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
|
||||||
PageHelper.startPage(pageNum, pageSize, orderBy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#end
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import com.hchyun.common.annotation.Excel;
|
||||||
#end
|
#end
|
||||||
#if($table.tplCategory.equals("ass"))
|
#if($table.tplCategory.equals("ass"))
|
||||||
#set($Entity="BaseEntity")
|
#set($Entity="BaseEntity")
|
||||||
|
import com.hchyun.common.annotation.Excels;
|
||||||
import ${packageName}.entity.${assClassName};
|
import ${packageName}.entity.${assClassName};
|
||||||
#elseif($table.tplCategory.equals("sub"))
|
#elseif($table.tplCategory.equals("sub"))
|
||||||
import ${packageName}.entity.${subClassName};
|
import ${packageName}.entity.${subClassName};
|
||||||
|
|
@ -58,18 +59,42 @@ public class ${ClassName} extends ${Entity}
|
||||||
#end
|
#end
|
||||||
@ApiModelProperty("${column.columnComment}")
|
@ApiModelProperty("${column.columnComment}")
|
||||||
private $column.javaType $column.javaField;
|
private $column.javaType $column.javaField;
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
/** $table.subTable.functionName信息 */
|
/** $table.subTable.functionName信息 */
|
||||||
@ApiModelProperty("${table.subTable.functionName}信息")
|
@ApiModelProperty("${table.subTable.functionName}信息")
|
||||||
private List<${subClassName}> ${subclassName}List;
|
private List<${subClassName}> ${subclassName}List;
|
||||||
|
|
||||||
#elseif($table.tplCategory.equals("ass"))
|
#elseif($table.tplCategory.equals("ass"))
|
||||||
private ${assClassName} ${assclassName};
|
#set($count = 0)
|
||||||
|
#foreach($column in $table.assColumns)
|
||||||
|
#if($column.isList == "1")
|
||||||
|
#set($count = $count + 1)
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
|
#set($targetName = "")
|
||||||
|
#set($indexs = 0)
|
||||||
|
#foreach($column in $table.assColumns)
|
||||||
|
#if($column.isList == "1")
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#set($indexs = $indexs + 1)
|
||||||
|
#set($targetName = $targetName + '@Excel(name = "'+$comment+'",targetAttr = "'+$column.javaField+'")')
|
||||||
|
#if($indexs != $count)
|
||||||
|
#set($targetName = $targetName + ",")
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
@Excels({${targetName}}))
|
||||||
|
private ${assClassName} ${assclassName};
|
||||||
|
#end
|
||||||
|
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if(!$table.isSuperColumn($column.javaField))
|
#if(!$table.isSuperColumn($column.javaField))
|
||||||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,22 @@ import request from '@/utils/request'
|
||||||
|
|
||||||
|
|
||||||
// 查询${functionName}列表
|
// 查询${functionName}列表
|
||||||
#if($table.tplCategory.equals("ass"))
|
|
||||||
export function list${BusinessName}(data) {
|
export function list${BusinessName}(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/${moduleName}/${businessName}/list',
|
url: '/${moduleName}/${businessName}/list',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
params: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
export function list${BusinessName}(query) {
|
// 导出${functionName}
|
||||||
|
export function export${BusinessName}(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/${moduleName}/${businessName}/list',
|
url: '/${moduleName}/${businessName}/export',
|
||||||
method: 'get',
|
method: 'put',
|
||||||
params: query
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
#end
|
|
||||||
|
|
||||||
// 查询${functionName}详细
|
// 查询${functionName}详细
|
||||||
export function get${BusinessName}(${pkColumn.javaField}) {
|
export function get${BusinessName}(${pkColumn.javaField}) {
|
||||||
|
|
@ -53,12 +52,3 @@ export function del${BusinessName}(${pkColumn.javaField}) {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出${functionName}
|
|
||||||
export function export${BusinessName}(query) {
|
|
||||||
return request({
|
|
||||||
url: '/${moduleName}/${businessName}/export',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
@ -248,8 +248,8 @@
|
||||||
<pagination
|
<pagination
|
||||||
v-show="total>0"
|
v-show="total>0"
|
||||||
:total="total"
|
:total="total"
|
||||||
:page.sync="queryParams.pageNum"
|
:page.sync="queryParams.params.pageNum"
|
||||||
:limit.sync="queryParams.pageSize"
|
:limit.sync="queryParams.params.pageSize"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
@ -498,8 +498,10 @@ export default {
|
||||||
#end
|
#end
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
|
params:{
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
},
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.query && $column.htmlType != "datetime" && $column.queryType != "BETWEEN")
|
#if($column.query && $column.htmlType != "datetime" && $column.queryType != "BETWEEN")
|
||||||
$column.javaField: null#if($velocityCount != $columns.size()),#end
|
$column.javaField: null#if($velocityCount != $columns.size()),#end
|
||||||
|
|
@ -555,22 +557,6 @@ export default {
|
||||||
/** 查询${functionName}列表 */
|
/** 查询${functionName}列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
#set($variable = 0)
|
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
|
||||||
#set($variable = 1)
|
|
||||||
#break
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
#foreach ($column in $table.assColumns)
|
|
||||||
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
|
||||||
#set($variable = 1)
|
|
||||||
#break
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
#if($variable == 1)
|
|
||||||
this.queryParams.params = {};
|
|
||||||
#end
|
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#if($table.tplCategory.equals("ass"))
|
#if($table.tplCategory.equals("ass"))
|
||||||
<select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}${assClassName}Result">
|
<select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}${assClassName}Result">
|
||||||
select#foreach($column in $columns) ${tableMapping}.$column.columnName#if($velocityCount != $columns.size()),#end#end,
|
select#foreach($column in $columns) ${tableMapping}.$column.columnName#if($velocityCount != $columns.size()),#end#end,
|
||||||
#foreach($column in $table.assColumns) ${assMapping}.$column.columnName#if($velocityCount != $table.assColumns.size()),#end#end
|
#set($count = 0)
|
||||||
|
#foreach($column in $table.assColumns)
|
||||||
|
#if($column.isList == "1")
|
||||||
|
#set($count = $count + 1)
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#set($targetName = "")
|
||||||
|
#set($indexs = 0)
|
||||||
|
#foreach($column in $table.assColumns)#if($column.isList == "1")#set($indexs = $indexs + 1)${assMapping}.$column.columnName#if($indexs != $count), #end#end
|
||||||
|
#end
|
||||||
|
|
||||||
from ${tableName} ${tableMapping}
|
from ${tableName} ${tableMapping}
|
||||||
${table.assQueryType} join ${table.assTableName} ${assMapping} on ${assMapping}.${table.assTableFkColumn} = ${tableMapping}.${table.assTableColumn}
|
${table.assQueryType} join ${table.assTableName} ${assMapping} on ${assMapping}.${table.assTableFkColumn} = ${tableMapping}.${table.assTableColumn}
|
||||||
|
|
@ -142,7 +151,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where ${tableMapping}.${pkColumn.columnName} = #{${pkColumn.javaField}}
|
where ${tableMapping}.${pkColumn.columnName} = #{${pkColumn.javaField}}
|
||||||
#elseif($table.tplCategory.equals("ass"))
|
#elseif($table.tplCategory.equals("ass"))
|
||||||
select#foreach($column in $columns) ${tableMapping}.$column.columnName#if($velocityCount != $columns.size()),#end#end,
|
select#foreach($column in $columns) ${tableMapping}.$column.columnName#if($velocityCount != $columns.size()),#end#end,
|
||||||
#foreach($column in $table.assColumns) ${assMapping}.$column.columnName#if($velocityCount != $table.assColumns.size()),#end#end
|
#set($count = 0)
|
||||||
|
#foreach($column in $table.assColumns)
|
||||||
|
#if($column.isList == "1")
|
||||||
|
#set($count = $count + 1)
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#set($targetName = "")
|
||||||
|
#set($indexs = 0)
|
||||||
|
#foreach($column in $table.assColumns)#if($column.isList == "1")#set($indexs = $indexs + 1)${assMapping}.$column.columnName#if($indexs != $count), #end#end
|
||||||
|
#end
|
||||||
|
|
||||||
from ${tableName} ${tableMapping}
|
from ${tableName} ${tableMapping}
|
||||||
${table.assQueryType} join ${table.assTableName} ${assMapping} on ${assMapping}.${table.assTableFkColumn} = ${tableMapping}.${table.assTableColumn}
|
${table.assQueryType} join ${table.assTableName} ${assMapping} on ${assMapping}.${table.assTableFkColumn} = ${tableMapping}.${table.assTableColumn}
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,13 @@
|
||||||
package com.hchyun.test.controller;
|
package com.hchyun.test.controller;
|
||||||
|
|
||||||
import java.beans.BeanInfo;
|
|
||||||
import java.beans.Introspector;
|
|
||||||
import java.beans.PropertyDescriptor;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
||||||
import com.github.pagehelper.PageHelper;
|
|
||||||
import com.hchyun.common.constant.ReturnConstants;
|
import com.hchyun.common.constant.ReturnConstants;
|
||||||
import com.hchyun.common.core.controller.HcyBaseController;
|
import com.hchyun.common.core.controller.HcyBaseController;
|
||||||
import com.hchyun.common.core.page.PageDomain;
|
|
||||||
import com.hchyun.common.core.page.TableSupport;
|
|
||||||
import com.hchyun.common.utils.ServerResult;
|
import com.hchyun.common.utils.ServerResult;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
|
||||||
import com.hchyun.common.utils.sql.SqlUtil;
|
|
||||||
import com.hchyun.test.test.Maptest;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
@ -44,13 +31,11 @@ import com.hchyun.test.service.AssFatherService;
|
||||||
import com.hchyun.common.utils.poi.ExcelUtil;
|
import com.hchyun.common.utils.poi.ExcelUtil;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关联查询父Controller
|
* 关联查询父Controller
|
||||||
*
|
*
|
||||||
* @author hchyun
|
* @author hchyun
|
||||||
* @date 2021-02-09
|
* @date 2021-02-10
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Api(value = "关联查询父管理",tags = "关联查询父管理")
|
@Api(value = "关联查询父管理",tags = "关联查询父管理")
|
||||||
|
|
@ -89,8 +74,8 @@ public class AssFatherController extends HcyBaseController {
|
||||||
@ApiOperation("导出关联查询父列表")
|
@ApiOperation("导出关联查询父列表")
|
||||||
@PreAuthorize("@ss.hasPermi('test:father:export')")
|
@PreAuthorize("@ss.hasPermi('test:father:export')")
|
||||||
@Log(title = "关联查询父", businessType = BusinessType.EXPORT)
|
@Log(title = "关联查询父", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export")
|
@PutMapping("/export")
|
||||||
public AjaxResult export(AssFather assFather) {
|
public AjaxResult export(@Validated @RequestBody AssFather assFather) {
|
||||||
try {
|
try {
|
||||||
ServerResult<List<AssFather>> serverResult = assFatherService.selectAssFatherList(assFather);
|
ServerResult<List<AssFather>> serverResult = assFatherService.selectAssFatherList(assFather);
|
||||||
ExcelUtil<AssFather> util = new ExcelUtil<AssFather>(AssFather. class);
|
ExcelUtil<AssFather> util = new ExcelUtil<AssFather>(AssFather. class);
|
||||||
|
|
@ -207,16 +192,4 @@ public class AssFatherController extends HcyBaseController {
|
||||||
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 设置请求分页数据
|
|
||||||
*/
|
|
||||||
public void startPage(Map<String,Object> map) {
|
|
||||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
||||||
Integer pageNum = (Integer) map.get("pageNum");
|
|
||||||
Integer pageSize = (Integer) map.get("pageSize");
|
|
||||||
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
|
|
||||||
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
|
||||||
PageHelper.startPage(pageNum, pageSize, orderBy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import com.hchyun.test.entity.AssFather;
|
||||||
* 关联查询父Mapper接口
|
* 关联查询父Mapper接口
|
||||||
*
|
*
|
||||||
* @author hchyun
|
* @author hchyun
|
||||||
* @date 2021-02-09
|
* @date 2021-02-10
|
||||||
*/
|
*/
|
||||||
public interface AssFatherDao {
|
public interface AssFatherDao {
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.hchyun.test.entity;
|
package com.hchyun.test.entity;
|
||||||
|
|
||||||
import com.hchyun.common.annotation.Excel;
|
import com.hchyun.common.annotation.Excel;
|
||||||
import com.hchyun.test.entity.AssSun;
|
import com.hchyun.common.annotation.Excels;
|
||||||
import com.hchyun.common.core.entity.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
@ -12,7 +12,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
* 关联查询父对象 test_ass_father
|
* 关联查询父对象 test_ass_father
|
||||||
*
|
*
|
||||||
* @author hchyun
|
* @author hchyun
|
||||||
* @date 2021-02-09
|
* @date 2021-02-10
|
||||||
*/
|
*/
|
||||||
@ApiModel("关联查询父")
|
@ApiModel("关联查询父")
|
||||||
public class AssFather extends BaseEntity
|
public class AssFather extends BaseEntity
|
||||||
|
|
@ -33,6 +33,7 @@ public class AssFather extends BaseEntity
|
||||||
@ApiModelProperty("信息")
|
@ApiModelProperty("信息")
|
||||||
private String info;
|
private String info;
|
||||||
|
|
||||||
|
@Excels({@Excel(name = "子表名称",targetAttr = "sname"),@Excel(name = "父id",targetAttr = "fId")})
|
||||||
private AssSun assSun;
|
private AssSun assSun;
|
||||||
|
|
||||||
public void setId(Long id){
|
public void setId(Long id){
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import com.hchyun.common.core.entity.BaseEntity;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author hchyun
|
* @author hchyun
|
||||||
* @date 2021-02-09
|
* @date 2021-02-10
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class AssSun extends BaseEntity{
|
public class AssSun extends BaseEntity{
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import com.hchyun.test.entity.AssFather;
|
||||||
* 关联查询父Service接口
|
* 关联查询父Service接口
|
||||||
*
|
*
|
||||||
* @author hchyun
|
* @author hchyun
|
||||||
* @date 2021-02-09
|
* @date 2021-02-10
|
||||||
*/
|
*/
|
||||||
public interface AssFatherService
|
public interface AssFatherService
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import com.hchyun.test.service.AssFatherService;
|
||||||
* 关联查询父Service业务层处理
|
* 关联查询父Service业务层处理
|
||||||
*
|
*
|
||||||
* @author hchyun
|
* @author hchyun
|
||||||
* @date 2021-02-09
|
* @date 2021-02-10
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class AssFatherServiceImpl implements AssFatherService {
|
public class AssFatherServiceImpl implements AssFatherService {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectAssFatherList" parameterType="AssFather" resultMap="AssFatherAssSunResult">
|
<select id="selectAssFatherList" parameterType="AssFather" resultMap="AssFatherAssSunResult">
|
||||||
select taf.id, taf.name, taf.info, taf.create_time,
|
select taf.id, taf.name, taf.info, taf.create_time,
|
||||||
tas.id, tas.f_id, tas.sname, tas.create_time
|
tas.f_id, tas.sname
|
||||||
from test_ass_father taf
|
from test_ass_father taf
|
||||||
left join test_ass_sun tas on tas.f_id = taf.id
|
left join test_ass_sun tas on tas.f_id = taf.id
|
||||||
<where>
|
<where>
|
||||||
|
|
@ -39,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="selectAssFatherById" parameterType="Long" resultMap="AssFatherResult">
|
<select id="selectAssFatherById" parameterType="Long" resultMap="AssFatherResult">
|
||||||
select taf.id, taf.name, taf.info, taf.create_time,
|
select taf.id, taf.name, taf.info, taf.create_time,
|
||||||
tas.id, tas.f_id, tas.sname, tas.create_time
|
tas.f_id, tas.sname
|
||||||
from test_ass_father taf
|
from test_ass_father taf
|
||||||
left join test_ass_sun tas on tas.f_id = taf.id
|
left join test_ass_sun tas on tas.f_id = taf.id
|
||||||
where taf.id = #{id}
|
where taf.id = #{id}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue