博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Mybatis,模糊查询语句,以及传参数的正确写法
阅读量:6955 次
发布时间:2019-06-27

本文共 1196 字,大约阅读时间需要 3 分钟。

不多说直接上代码!

 

 

 

 

接口:

 
public interface CommodityMapper {
int deleteByPrimaryKey(Integer productId); int insert(Commodity record); Commodity selectByPrimaryKey(Integer productId); List
selectAll(); List
getType(int id); int updateByPrimaryKey(Commodity record); int getCount(); List
SearchCommodity(@Param("productName") String productName);//注意传参的名字必须要和Mapper文件一致 }
 

 

 

Constroller层:

//搜索    @RequestMapping(path = "/search", method = RequestMethod.GET)    public ResponseEntity Search(String productName) {        if (commodityService.SearchCommodity(productName).size() != 0) {            return ResponseEntity.ok(commodityService.SearchCommodity(productName));        } else {            return ResponseEntity.ok("error");        }    }

 

 

 

Mapper文件

 

转载于:https://www.cnblogs.com/nongzihong/p/10275271.html

你可能感兴趣的文章
编译器GCC的Windows版本 : MinGW-w64安装教程
查看>>
JSTL详解1
查看>>
Java高质量20问
查看>>
自动化环境配置
查看>>
Invalid maximum heap size: -Xmx
查看>>
java email 正则 验证
查看>>
Java HttpClient
查看>>
微信公众号教程(8)用微信开发模式做欢迎词
查看>>
Thinkpad X200 开启 intel virtualization technology (VT-x)
查看>>
添加地图图例 Arcengine+C#
查看>>
2016下半年计划
查看>>
python 学习
查看>>
全局变量反汇编与重定位
查看>>
2017-2018-1 20155229 《信息安全系统设计基础》第八周学习总结
查看>>
oracle查看所有表及字段
查看>>
Goland的下载与安装
查看>>
PhpMyAdmin的配置
查看>>
oracle 查询月份
查看>>
mysql参数详解
查看>>
hdu1753 java大实数加法
查看>>