更新list查询结构
parent
a4904014bc
commit
5577a54684
|
@ -44,12 +44,12 @@ public class ${ClassName}Controller extends BaseController {
|
||||||
#if($table.crud || $table.sub)
|
#if($table.crud || $table.sub)
|
||||||
public Result<TableDataInfo> list(${ClassName} ${className}) {
|
public Result<TableDataInfo> list(${ClassName} ${className}) {
|
||||||
startPage();
|
startPage();
|
||||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
List<${ClassName}> list = ${className}Service.list(${className});
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
#elseif($table.tree)
|
#elseif($table.tree)
|
||||||
public Result list(${ClassName} ${className}) {
|
public Result list(${ClassName} ${className}) {
|
||||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
List<${ClassName}> list = ${className}Service.list(${className});
|
||||||
return success(list);
|
return success(list);
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
|
@ -3,9 +3,11 @@ package ${packageName}.domain;
|
||||||
#foreach ($import in $importList)
|
#foreach ($import in $importList)
|
||||||
import ${import};
|
import ${import};
|
||||||
#end
|
#end
|
||||||
import lombok.AllArgsConstructor;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
@ -31,6 +33,8 @@ import com.ruoyi.common.core.domain.TreeEntity;
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("${tableName}")
|
||||||
public class ${ClassName} extends ${Entity} {
|
public class ${ClassName} extends ${Entity} {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,4 @@ import ${packageName}.domain.${subClassName};
|
||||||
*/
|
*/
|
||||||
public interface ${ClassName}Mapper extends BaseMapper<${ClassName}> {
|
public interface ${ClassName}Mapper extends BaseMapper<${ClassName}> {
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询${functionName}列表
|
|
||||||
*
|
|
||||||
* @param ${className} ${functionName}
|
|
||||||
* @return ${functionName}集合
|
|
||||||
*/
|
|
||||||
public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,6 @@ public interface ${ClassName}Service extends IService<${ClassName}> {
|
||||||
* @param ${className} ${functionName}
|
* @param ${className} ${functionName}
|
||||||
* @return ${functionName}集合
|
* @return ${functionName}集合
|
||||||
*/
|
*/
|
||||||
public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
|
public List<${ClassName}> list(${ClassName} ${className});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package ${packageName}.service.impl;
|
package ${packageName}.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ${packageName}.mapper.${ClassName}Mapper;
|
import ${packageName}.mapper.${ClassName}Mapper;
|
||||||
import ${packageName}.domain.${ClassName};
|
import ${packageName}.domain.${ClassName};
|
||||||
import ${packageName}.service.${ClassName}Service;
|
import ${packageName}.service.${ClassName}Service;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${functionName}Service业务层处理
|
* ${functionName}Service业务层处理
|
||||||
|
@ -16,8 +16,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements ${ClassName}Service {
|
public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements ${ClassName}Service {
|
||||||
@Autowired
|
|
||||||
private ${ClassName}Mapper ${className}Mapper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询${functionName}列表
|
* 查询${functionName}列表
|
||||||
|
@ -26,7 +24,8 @@ public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${C
|
||||||
* @return ${functionName}
|
* @return ${functionName}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<${ClassName}> select${ClassName}List(${ClassName} ${className}) {
|
public List<${ClassName}> list(${ClassName} ${className}) {
|
||||||
return ${className}Mapper.select${ClassName}List(${className});
|
LambdaQueryWrapper<${ClassName}> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
return list(queryWrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,36 +13,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<sql id="select${ClassName}Vo">
|
<sql id="select${ClassName}Vo">
|
||||||
select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName}
|
select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName}
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="select${ClassName}List" parameterType="${packageName}.domain.${ClassName}" resultMap="${ClassName}Result">
|
|
||||||
<include refid="select${ClassName}Vo"/>
|
|
||||||
<where>
|
|
||||||
#foreach($column in $columns)
|
|
||||||
#set($queryType=$column.queryType)
|
|
||||||
#set($javaField=$column.javaField)
|
|
||||||
#set($javaType=$column.javaType)
|
|
||||||
#set($columnName=$column.columnName)
|
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
|
||||||
#if($column.query)
|
|
||||||
#if($column.queryType == "EQ")
|
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName = #{$javaField}</if>
|
|
||||||
#elseif($queryType == "NE")
|
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName != #{$javaField}</if>
|
|
||||||
#elseif($queryType == "GT")
|
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName > #{$javaField}</if>
|
|
||||||
#elseif($queryType == "GTE")
|
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName >= #{$javaField}</if>
|
|
||||||
#elseif($queryType == "LT")
|
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName < #{$javaField}</if>
|
|
||||||
#elseif($queryType == "LTE")
|
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName <= #{$javaField}</if>
|
|
||||||
#elseif($queryType == "LIKE")
|
|
||||||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if>
|
|
||||||
#elseif($queryType == "BETWEEN")
|
|
||||||
<if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if>
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class BookInfoController extends BaseController {
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result<TableDataInfo> list(BookInfo bookInfo) {
|
public Result<TableDataInfo> list(BookInfo bookInfo) {
|
||||||
startPage();
|
startPage();
|
||||||
List<BookInfo> list = bookInfoService.selectBookInfoList(bookInfo);
|
List<BookInfo> list = bookInfoService.list(bookInfo);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class BookInfoController extends BaseController {
|
||||||
@Log(title = "书籍信息", businessType = BusinessType.EXPORT)
|
@Log(title = "书籍信息", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, BookInfo bookInfo) {
|
public void export(HttpServletResponse response, BookInfo bookInfo) {
|
||||||
List<BookInfo> list = bookInfoService.selectBookInfoList(bookInfo);
|
List<BookInfo> list = bookInfoService.list(bookInfo);
|
||||||
ExcelUtil<BookInfo> util = new ExcelUtil<BookInfo>(BookInfo.class);
|
ExcelUtil<BookInfo> util = new ExcelUtil<BookInfo>(BookInfo.class);
|
||||||
util.exportExcel(response, list, "书籍信息数据");
|
util.exportExcel(response, list, "书籍信息数据");
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
@ -25,6 +26,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@TableName("book_info")
|
@TableName("book_info")
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class BookInfo extends BaseEntity {
|
public class BookInfo extends BaseEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,6 @@ public interface BookInfoService extends IService<BookInfo> {
|
||||||
* @param bookInfo 书籍信息
|
* @param bookInfo 书籍信息
|
||||||
* @return 书籍信息集合
|
* @return 书籍信息集合
|
||||||
*/
|
*/
|
||||||
public List<BookInfo> selectBookInfoList(BookInfo bookInfo);
|
public List<BookInfo> list(BookInfo bookInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package com.ruoyi.book.service.impl;
|
package com.ruoyi.book.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.book.mapper.BookInfoMapper;
|
import com.ruoyi.book.mapper.BookInfoMapper;
|
||||||
import com.ruoyi.book.domain.BookInfo;
|
import com.ruoyi.book.domain.BookInfo;
|
||||||
|
@ -16,8 +17,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class BookInfoServiceImpl extends ServiceImpl<BookInfoMapper, BookInfo> implements BookInfoService {
|
public class BookInfoServiceImpl extends ServiceImpl<BookInfoMapper, BookInfo> implements BookInfoService {
|
||||||
@Autowired
|
|
||||||
private BookInfoMapper bookInfoMapper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询书籍信息列表
|
* 查询书籍信息列表
|
||||||
|
@ -26,7 +25,8 @@ public class BookInfoServiceImpl extends ServiceImpl<BookInfoMapper, BookInfo>
|
||||||
* @return 书籍信息
|
* @return 书籍信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<BookInfo> selectBookInfoList(BookInfo bookInfo) {
|
public List<BookInfo> list(BookInfo bookInfo) {
|
||||||
return bookInfoMapper.selectBookInfoList(bookInfo);
|
LambdaQueryWrapper<BookInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
return list(queryWrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,11 +16,4 @@
|
||||||
select id, name, price, create_by, create_time from book_info
|
select id, name, price, create_by, create_time from book_info
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectBookInfoList" parameterType="com.ruoyi.book.domain.BookInfo" resultMap="BookInfoResult">
|
|
||||||
<include refid="selectBookInfoVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
||||||
<if test="params.beginPrice != null and params.beginPrice != '' and params.endPrice != null and params.endPrice != ''"> and price between #{params.beginPrice} and #{params.endPrice}</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue