1.Controller 中:
@ApiOperation("zzh查询")
@GetMapping("/query")
public ApiResult<List<EmerResourceVO>> queryVo(EmerResourceParam param) {
PageParam<EmerResourceVO, EmerResourceParam> page = new PageParam<>(param);
// page.setDefaultOrder("p.sorts asc");
// 使用关联查询
return success(emerResourceService.selectListVO(param));
}
2.Service中:
List<EmerResourceVO> selectListVO(EmerResourceParam param);
3.Sercicelmpl中:
@Override
public List<EmerResourceVO> selectListVO(EmerResourceParam param) {
return baseMapper.selectListVO(param);
}
4.Mapper中:
List<EmerResourceVO> selectListVO(@Param("param") EmerResourceParam param);
5.Mapper.xml中:
<select id="selectListVO" resultType="com.egao.community.vo.EmerResourceVO">
SELECT a.*,
b.dict_data_name as dictDataName
FROM (<include refid="selectSql"></include>) a
LEFT JOIN sys_dictionary_data b ON a.resource_type = b.dict_data_id
<where>
<if test="param.emerResourceId != null">
AND a.emer_resource_id = #{param.emerResourceId}
</if>
<if test="param.emerResourceCode != null">
AND a.emer_resource_code LIKE CONCAT('%', #{param.emerResourceCode}, '%')
</if>
<if test="param.emerResourceName != null">
AND a.emer_resource_name LIKE CONCAT('%', #{param.emerResourceName}, '%')
</if>
<if test="param.emerResourceQuantity != null">
AND a.emer_resource_quantity = #{param.emerResourceQuantity}
</if>
<if test="param.usable != null">
AND a.usable = #{param.usable}
</if>
</where>
</select>