关联查询
This commit is contained in:
parent
1b7b607e29
commit
29bfe5f1ed
|
|
@ -1,12 +1,21 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
|
||||
// 查询关联查询父列表
|
||||
export function listFather(query) {
|
||||
console.log(query)
|
||||
export function listFather(data) {
|
||||
return request({
|
||||
url: '/test/father/list',
|
||||
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'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出关联查询父
|
||||
export function exportFather(query) {
|
||||
return request({
|
||||
url: '/test/father/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@
|
|||
</template>
|
||||
</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" class-name="small-padding fixed-width">
|
||||
|
|
@ -139,8 +140,8 @@
|
|||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
:page.sync="queryParams.params.pageNum"
|
||||
:limit.sync="queryParams.params.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
|
|
@ -194,7 +195,6 @@ export default {
|
|||
open: false,
|
||||
// 创建时间时间范围
|
||||
daterangeCreateTime: [],
|
||||
assCreateTime: [],
|
||||
// 主键字典
|
||||
idOptions: [],
|
||||
// 父id字典
|
||||
|
|
@ -234,6 +234,7 @@ export default {
|
|||
methods: {
|
||||
/** 查询关联查询父列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
|
||||
this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
|
||||
this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ public @interface Excel
|
|||
/**
|
||||
* 导出时在excel中排序
|
||||
*/
|
||||
public int sort() default Integer.MAX_VALUE;
|
||||
// public int sort() default Integer.MAX_VALUE;
|
||||
|
||||
public int sort() default 1;
|
||||
|
||||
/**
|
||||
* 导出到Excel中的名字.
|
||||
|
|
@ -105,6 +107,7 @@ public @interface Excel
|
|||
*/
|
||||
public boolean isStatistics() default false;
|
||||
|
||||
|
||||
/**
|
||||
* 字段类型(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.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.hchyun.common.annotation.Excel;
|
||||
|
||||
/**
|
||||
* 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")
|
||||
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")
|
||||
private Date updateTime;
|
||||
|
||||
|
|
|
|||
|
|
@ -736,7 +736,7 @@ public class ExcelUtil<T> {
|
|||
return o;
|
||||
}
|
||||
|
||||
/**
|
||||
/** todo
|
||||
* 得到所有定义字段
|
||||
*/
|
||||
private void createExcelField() {
|
||||
|
|
|
|||
|
|
@ -57,21 +57,17 @@ public class ${ClassName}Controller extends HcyBaseController {
|
|||
*/
|
||||
@ApiOperation("查询${functionName}列表")
|
||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
|
||||
#if($table.crud || $table.sub || $table.tplCategory.equals("ass"))
|
||||
#if($table.tplCategory.equals("ass"))
|
||||
@PutMapping("/list")
|
||||
public Serializable list(@Validated @RequestBody ${ClassName} ${className}) {
|
||||
try {
|
||||
startPage(assFather.getParams());
|
||||
#else
|
||||
@GetMapping("/list")
|
||||
public Serializable list(${ClassName} ${className}) {
|
||||
try {
|
||||
startPage();
|
||||
#end
|
||||
startPage(${className}.getParams());
|
||||
ServerResult<List<${ClassName}>> serverResult = ${className}Service.select${ClassName}List(${className});
|
||||
if (serverResult.isStart()) {
|
||||
#if($table.crud || $table.sub || $table.tplCategory.equals("ass"))
|
||||
return getDataTable(serverResult.getData());
|
||||
#elseif($table.tree)
|
||||
return AjaxResult.success(serverResult.getData());
|
||||
#end
|
||||
} else {
|
||||
return AjaxResult.info(serverResult.getMsg());
|
||||
}
|
||||
|
|
@ -80,13 +76,6 @@ public class ${ClassName}Controller extends HcyBaseController {
|
|||
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}列表
|
||||
|
|
@ -94,8 +83,8 @@ public class ${ClassName}Controller extends HcyBaseController {
|
|||
@ApiOperation("导出${functionName}列表")
|
||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(${ClassName} ${className}) {
|
||||
@PutMapping("/export")
|
||||
public AjaxResult export(@Validated @RequestBody ${ClassName} ${className}) {
|
||||
try {
|
||||
ServerResult<List<${ClassName}>> serverResult = ${className}Service.select${ClassName}List(${className});
|
||||
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}. class);
|
||||
|
|
@ -242,19 +231,4 @@ public class ${ClassName}Controller extends HcyBaseController {
|
|||
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
|
||||
#if($table.tplCategory.equals("ass"))
|
||||
#set($Entity="BaseEntity")
|
||||
import com.hchyun.common.annotation.Excels;
|
||||
import ${packageName}.entity.${assClassName};
|
||||
#elseif($table.tplCategory.equals("sub"))
|
||||
import ${packageName}.entity.${subClassName};
|
||||
|
|
@ -58,18 +59,42 @@ public class ${ClassName} extends ${Entity}
|
|||
#end
|
||||
@ApiModelProperty("${column.columnComment}")
|
||||
private $column.javaType $column.javaField;
|
||||
#end
|
||||
#end
|
||||
|
||||
#end
|
||||
#end
|
||||
#if($table.sub)
|
||||
/** $table.subTable.functionName信息 */
|
||||
@ApiModelProperty("${table.subTable.functionName}信息")
|
||||
private List<${subClassName}> ${subclassName}List;
|
||||
|
||||
#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
|
||||
#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)
|
||||
#if(!$table.isSuperColumn($column.javaField))
|
||||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
||||
|
|
|
|||
|
|
@ -2,23 +2,22 @@ import request from '@/utils/request'
|
|||
|
||||
|
||||
// 查询${functionName}列表
|
||||
#if($table.tplCategory.equals("ass"))
|
||||
export function list${BusinessName}(data) {
|
||||
return request({
|
||||
url: '/${moduleName}/${businessName}/list',
|
||||
method: 'put',
|
||||
params: data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
#else
|
||||
export function list${BusinessName}(query) {
|
||||
|
||||
// 导出${functionName}
|
||||
export function export${BusinessName}(data) {
|
||||
return request({
|
||||
url: '/${moduleName}/${businessName}/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
url: '/${moduleName}/${businessName}/export',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
#end
|
||||
|
||||
// 查询${functionName}详细
|
||||
export function get${BusinessName}(${pkColumn.javaField}) {
|
||||
|
|
@ -52,13 +51,4 @@ export function del${BusinessName}(${pkColumn.javaField}) {
|
|||
url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField},
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出${functionName}
|
||||
export function export${BusinessName}(query) {
|
||||
return request({
|
||||
url: '/${moduleName}/${businessName}/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
|
@ -248,8 +248,8 @@
|
|||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
:page.sync="queryParams.params.pageNum"
|
||||
:limit.sync="queryParams.params.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
|
|
@ -498,8 +498,10 @@ export default {
|
|||
#end
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
params:{
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
#foreach ($column in $columns)
|
||||
#if($column.query && $column.htmlType != "datetime" && $column.queryType != "BETWEEN")
|
||||
$column.javaField: null#if($velocityCount != $columns.size()),#end
|
||||
|
|
@ -555,22 +557,6 @@ export default {
|
|||
/** 查询${functionName}列表 */
|
||||
getList() {
|
||||
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)
|
||||
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||
#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"))
|
||||
<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,
|
||||
#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}
|
||||
${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}}
|
||||
#elseif($table.tplCategory.equals("ass"))
|
||||
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}
|
||||
${table.assQueryType} join ${table.assTableName} ${assMapping} on ${assMapping}.${table.assTableFkColumn} = ${tableMapping}.${table.assTableColumn}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,13 @@
|
|||
package com.hchyun.test.controller;
|
||||
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.Introspector;
|
||||
import java.beans.PropertyDescriptor;
|
||||
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.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.hchyun.common.constant.ReturnConstants;
|
||||
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.StringUtils;
|
||||
import com.hchyun.common.utils.sql.SqlUtil;
|
||||
import com.hchyun.test.test.Maptest;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -44,16 +31,14 @@ import com.hchyun.test.service.AssFatherService;
|
|||
import com.hchyun.common.utils.poi.ExcelUtil;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 关联查询父Controller
|
||||
*
|
||||
*
|
||||
* @author hchyun
|
||||
* @date 2021-02-09
|
||||
* @date 2021-02-10
|
||||
*/
|
||||
|
||||
@Api(value = "关联查询父管理", tags = "关联查询父管理")
|
||||
@Api(value = "关联查询父管理",tags = "关联查询父管理")
|
||||
@RestController
|
||||
@RequestMapping("/test/father")
|
||||
public class AssFatherController extends HcyBaseController {
|
||||
|
|
@ -89,11 +74,11 @@ public class AssFatherController extends HcyBaseController {
|
|||
@ApiOperation("导出关联查询父列表")
|
||||
@PreAuthorize("@ss.hasPermi('test:father:export')")
|
||||
@Log(title = "关联查询父", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(AssFather assFather) {
|
||||
@PutMapping("/export")
|
||||
public AjaxResult export(@Validated @RequestBody AssFather assFather) {
|
||||
try {
|
||||
ServerResult<List<AssFather>> serverResult = assFatherService.selectAssFatherList(assFather);
|
||||
ExcelUtil<AssFather> util = new ExcelUtil<AssFather>(AssFather.class);
|
||||
ExcelUtil<AssFather> util = new ExcelUtil<AssFather>(AssFather. class);
|
||||
if (serverResult.isStart()) {
|
||||
return util.exportExcel(serverResult.getData(), "father");
|
||||
} else {
|
||||
|
|
@ -109,7 +94,7 @@ public class AssFatherController extends HcyBaseController {
|
|||
* 获取关联查询父详细信息
|
||||
*/
|
||||
@ApiOperation("获取关联查询父详细信息")
|
||||
@ApiImplicitParam(name = "id", value = "关联查询父id", required = true, dataType = "Long", paramType = "path")
|
||||
@ApiImplicitParam(name = "id" , value = "关联查询父id" , required = true, dataType = "Long" , paramType = "path")
|
||||
@PreAuthorize("@ss.hasPermi('test:father:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
|
|
@ -130,7 +115,7 @@ public class AssFatherController extends HcyBaseController {
|
|||
* 新增关联查询父
|
||||
*/
|
||||
@ApiOperation("新增关联查询父")
|
||||
@ApiImplicitParam(name = "assFather", value = "新增关联查询父信息", dataType = "AssFather")
|
||||
@ApiImplicitParam(name = "assFather" , value = "新增关联查询父信息" , dataType = "AssFather")
|
||||
@PreAuthorize("@ss.hasPermi('test:father:add')")
|
||||
@Log(title = "关联查询父", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
|
|
@ -158,7 +143,7 @@ public class AssFatherController extends HcyBaseController {
|
|||
* 修改关联查询父
|
||||
*/
|
||||
@ApiOperation("修改关联查询父")
|
||||
@ApiImplicitParam(name = "assFather", value = "修改关联查询父信息", dataType = "AssFather")
|
||||
@ApiImplicitParam(name = "assFather" , value = "修改关联查询父信息" , dataType = "AssFather")
|
||||
@PreAuthorize("@ss.hasPermi('test:father:edit')")
|
||||
@Log(title = "关联查询父", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
|
|
@ -187,13 +172,13 @@ public class AssFatherController extends HcyBaseController {
|
|||
* 删除关联查询父
|
||||
*/
|
||||
@ApiOperation("删除关联查询父")
|
||||
@ApiImplicitParam(name = "ids", value = "关联查询父ids", required = true, dataType = "Long", paramType = "path")
|
||||
@ApiImplicitParam(name = "ids" , value = "关联查询父ids" , required = true, dataType = "Long" , paramType = "path")
|
||||
@PreAuthorize("@ss.hasPermi('test:father:remove')")
|
||||
@Log(title = "关联查询父", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
try {
|
||||
if (ids.length < 0) {
|
||||
if (ids.length<0){
|
||||
return AjaxResult.error("id不能为空!");
|
||||
}
|
||||
ServerResult<Integer> serverResult = assFatherService.deleteAssFatherByIds(ids);
|
||||
|
|
@ -202,21 +187,9 @@ public class AssFatherController extends HcyBaseController {
|
|||
} else {
|
||||
return AjaxResult.error(serverResult.getMsg());
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
}catch (RuntimeException e){
|
||||
logger.error(e.getMessage());
|
||||
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接口
|
||||
*
|
||||
* @author hchyun
|
||||
* @date 2021-02-09
|
||||
* @date 2021-02-10
|
||||
*/
|
||||
public interface AssFatherDao {
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.hchyun.test.entity;
|
||||
|
||||
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 io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
@ -12,7 +12,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
* 关联查询父对象 test_ass_father
|
||||
*
|
||||
* @author hchyun
|
||||
* @date 2021-02-09
|
||||
* @date 2021-02-10
|
||||
*/
|
||||
@ApiModel("关联查询父")
|
||||
public class AssFather extends BaseEntity
|
||||
|
|
@ -33,6 +33,7 @@ public class AssFather extends BaseEntity
|
|||
@ApiModelProperty("信息")
|
||||
private String info;
|
||||
|
||||
@Excels({@Excel(name = "子表名称",targetAttr = "sname"),@Excel(name = "父id",targetAttr = "fId")})
|
||||
private AssSun assSun;
|
||||
|
||||
public void setId(Long id){
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import com.hchyun.common.core.entity.BaseEntity;
|
|||
/**
|
||||
*
|
||||
* @author hchyun
|
||||
* @date 2021-02-09
|
||||
* @date 2021-02-10
|
||||
*/
|
||||
|
||||
public class AssSun extends BaseEntity{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import com.hchyun.test.entity.AssFather;
|
|||
* 关联查询父Service接口
|
||||
*
|
||||
* @author hchyun
|
||||
* @date 2021-02-09
|
||||
* @date 2021-02-10
|
||||
*/
|
||||
public interface AssFatherService
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import com.hchyun.test.service.AssFatherService;
|
|||
* 关联查询父Service业务层处理
|
||||
*
|
||||
* @author hchyun
|
||||
* @date 2021-02-09
|
||||
* @date 2021-02-10
|
||||
*/
|
||||
@Service
|
||||
public class AssFatherServiceImpl implements AssFatherService {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</sql>
|
||||
<select id="selectAssFatherList" parameterType="AssFather" resultMap="AssFatherAssSunResult">
|
||||
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
|
||||
left join test_ass_sun tas on tas.f_id = taf.id
|
||||
<where>
|
||||
|
|
@ -36,10 +36,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="params.assbeginCreateTime != null and params.assbeginCreateTime != '' and params.assendCreateTime != null and params.assendCreateTime != ''"> and tas.create_time between #{params.assbeginCreateTime} and #{params.assendCreateTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectAssFatherById" parameterType="Long" resultMap="AssFatherResult">
|
||||
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
|
||||
left join test_ass_sun tas on tas.f_id = taf.id
|
||||
where taf.id = #{id}
|
||||
|
|
|
|||
Loading…
Reference in New Issue