Commit 1bdf468e authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/develop' into develop

parents 1d20db5e af7b4caf
...@@ -48,7 +48,7 @@ public class ${className}Controller { ...@@ -48,7 +48,7 @@ public class ${className}Controller {
private final ${className}Service ${classname}Service; private final ${className}Service ${classname}Service;
/** #*/**
* 分页查询 * 分页查询
* @param page 分页对象 * @param page 分页对象
* @param ${classname} ${comments} * @param ${classname} ${comments}
...@@ -59,6 +59,17 @@ public class ${className}Controller { ...@@ -59,6 +59,17 @@ public class ${className}Controller {
//@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" ) //@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" )
public R<IPage<${className}>> get${className}Page(Page page, ${className} ${classname}) { public R<IPage<${className}>> get${className}Page(Page page, ${className} ${classname}) {
return R.ok(${classname}Service.page(page, Wrappers.query(${classname}))); return R.ok(${classname}Service.page(page, Wrappers.query(${classname})));
}*#
/**
* 简单分页查询
* @param page 分页对象
* @param ${classname} ${comments}
* @return
*/
@ApiOperation(value = "简单分页查询")
@GetMapping("/page")
public R<IPage<${className}>> get${className}Page(Page<${className}> page, ${className} ${classname}) {
return new R<>(${classname}Service.get${className}Page(page,${classname}));
} }
/** /**
* 不分页查询 * 不分页查询
......
...@@ -29,5 +29,10 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -29,5 +29,10 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface ${className}Mapper extends BaseMapper<${className}> { public interface ${className}Mapper extends BaseMapper<${className}> {
/**
* ${comments}简单分页查询
* @param ${classname} ${comments}
* @return
*/
IPage<${className}> get${className}Page(Page<${className}> page, @Param("${classname}") ${className} ${classname});
} }
...@@ -32,4 +32,42 @@ ...@@ -32,4 +32,42 @@
#end #end
#end #end
</resultMap> </resultMap>
<sql id="Base_Column_List">
#foreach($column in $columns)
#if($foreach.count==$!{columns.size()})
a.${column.columnName}
#else
a.${column.columnName},
#end
#end
</sql>
<sql id="${classname}_where">
<if test="${classname} != null">
#foreach($column in $columns)
#if($column.attrType=='String')
<if test="${classname}.$column.lowerAttrName != null and ${classname}.${column.lowerAttrName}.trim() != ''">
AND a.${column.columnName} = #{${classname}.$column.lowerAttrName}
</if>
#elseif($column.attrType=='char')
<if test="${classname}.$column.lowerAttrName != null and ${classname}.${column.lowerAttrName} != ''">
AND a.${column.columnName} = #{${classname}.$column.lowerAttrName}
</if>
#else
<if test="${classname}.$column.lowerAttrName != null">
AND a.${column.columnName} = #{${classname}.$column.lowerAttrName}
</if>
#end
#end
</if>
</sql>
<!--${classname}简单分页查询-->
<select id="get${className}Page" resultMap="${classname}Map">
SELECT
<include refid="Base_Column_List"/>
FROM ${tableName} a
<where>
1=1
<include refid="${classname}_where"/>
</where>
</select>
</mapper> </mapper>
...@@ -27,5 +27,10 @@ import ${package}.${moduleName}.entity.${className}; ...@@ -27,5 +27,10 @@ import ${package}.${moduleName}.entity.${className};
* @date ${datetime} * @date ${datetime}
*/ */
public interface ${className}Service extends IService<${className}> { public interface ${className}Service extends IService<${className}> {
/**
* ${comments}简单分页查询
* @param ${classname} ${comments}
* @return
*/
IPage<${className}> get${className}Page(Page<${className}> page, ${className} ${classname});
} }
...@@ -30,5 +30,13 @@ import org.springframework.stereotype.Service; ...@@ -30,5 +30,13 @@ import org.springframework.stereotype.Service;
*/ */
@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 {
/**
* ${comments}简单分页查询
* @param ${classname} ${comments}
* @return
*/
@Override
public IPage<${className}> get${className}Page(Page<${className}> page, ${className} ${classname}){
return baseMapper.get${className}Page(page,${classname});
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment