当前位置: 首页 > news >正文

网站建设对我有什么好处做二手家具回收哪个网站好

网站建设对我有什么好处,做二手家具回收哪个网站好,北京网站建设公司升上去,工作流软件问题描述 最近做项目时使用了mybatisplus#xff0c;分页插件也使用的是mybatisplus自带的分页插件#xff0c;业务需求是查询客户列表#xff0c;每个客户列表中有一个子列表#xff0c;在通过分页插件查询后#xff0c;会出现数量总数为子列表总数、客户列表与子列表不…问题描述 最近做项目时使用了mybatisplus分页插件也使用的是mybatisplus自带的分页插件业务需求是查询客户列表每个客户列表中有一个子列表在通过分页插件查询后会出现数量总数为子列表总数、客户列表与子列表不对等。 1、配置mybatis-plus插件 Configuration MapperScan(com.guigu.mapper) //可以将启动类中的注解移到此处 public class MybatisPlusConfig {/**** 1 怎么来配置mybatis-plus中的插件* 这里所需要的类型是MybatisPlusInterceptor这是mybatis-plus的一个拦截器用于配置mybatis-plus中的插件。* 2 为什么要使用拦截器MybatisPlusInterceptor呢* 这里边的原理和mybatis分页插件的功能是一样的工作流程如下 * 1第一步执行查询功能。* 2第二步拦截器对查询功能进行拦截。* 3第三步拦截器对查询功能的基础上做了额外的处理达到分页的效果功能。* 3 对比配置mybatis中的插件* 用的也是拦截器的方式。** return MybatisPlusInterceptor*/Beanpublic MybatisPlusInterceptor mybatisPlusInterceptor() {MybatisPlusInterceptor interceptor new MybatisPlusInterceptor();//添加分页插件//参数new PaginationInnerInterceptor(DbType.MYSQL)是专门为mysql定制实现的内部的分页插件interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));return interceptor;}2、mapper语句 需求根据年龄查询用户列表分页显示** 第一步xml自定义分页Mapper接口方法* 第1步如果想要mybatis-plus的分布插件来作用于我们自定义的sql语句的话* 第一个参数必须得是一个分页对象Param(page) PageUser page。* 第二步因为Mapper接口方法有2个参数的话* 方案1使用mybatis提供的访问方式* 方案2也可以使用param来设置命名参数来规定参数的访问规则PageCustomerEntity queryCustomerList(Param(page) PageCustomerEntity customerPage,Param(customerName) String customerName,Param(deptIds) ListLong deptIds,Param(userIds) ListLong userIds,Param(delFlag) Integer logicNotDeleteValue)resultMap idcustomerList typecustomerEntityid propertycustomerId columncustomer_id/result propertycustomerName columncustomer_name/collection propertychildren selectqueryList columncustomer_id ofTypecustomerInfoEntity/collectioncollection propertychildren ofTypecustomerInfoEntityid propertycustomerInfoId columncustomer_info_id/result propertycustomerId columncustomer_id/result propertydeptId columndept_id/result propertyindustry columnindustry/result propertylevel columnlevel/result propertysource columnsource/result propertyhighSeas columnhigh_seas/result propertyremark columnremark/result propertycrtTime columncrt_time/result propertycrtName columncrt_name/result propertycrtUserId columncrt_user_id//collection/resultMapselect idqueryCustomerList resultMapcustomerListSELECTc.customer_id,c.customer_name,ci.customer_info_id,ci.customer_id,ci.dept_id,ci.industry,ci.level,ci.source,ci.high_seas,ci.remark,ci.crt_time,ci.crt_name,ci.crt_user_idFROM customer cJOIN customer_info ci on c.customer_id ci.customer_idwhere ci.high_seas 0and ci.del_flag #{delFlag}and c.del_flag #{delFlag}if testcustomerName ! nullAND c.customer_name like concat(%,#{customerName},%)/ifif testdeptIds.size0AND ci.dept_id inforeach collectiondeptIds itemid separator, open( close)#{id}/foreach/ifif testuserIds.size0AND ci.crt_user_id inforeach collectionuserIds itemid separator, open( close)#{id}/foreach/if/select上述语句查询的结果数是表customer_info的数量而不是表customer的数量客户列表下有多个子列表时会分成多个相同的客户。 解决办法 那我们怎么才能查到正确得一对多的分页结果呢mybatis提供另一种方式使用mybatis的子查询映射。 resultMap idcustomerList typecustomerEntityid propertycustomerId columncustomer_id/result propertycustomerName columncustomer_name/collection propertychildren selectqueryList columncustomer_id ofTypecustomerInfoEntity/collection/resultMapselect idqueryList resultTypecustomerInfoEntityselect ci.customer_info_id,ci.customer_id,ci.dept_id,ci.industry,ci.level,ci.source,ci.high_seas,ci.remark,ci.crt_time,ci.crt_name,ci.crt_user_idfrom customer_info ciwhere ci.customer_id #{customer_id};/select!-- 查询未加入公海池的客户列表--select idqueryCustomerList resultMapcustomerListSELECTc.customer_id,c.customer_name,ci.customer_info_id,ci.customer_id,ci.dept_id,ci.industry,ci.level,ci.source,ci.high_seas,ci.remark,ci.crt_time,ci.crt_name,ci.crt_user_idFROM customer cJOIN customer_info ci on c.customer_id ci.customer_idwhere ci.high_seas 0and ci.del_flag #{delFlag}and c.del_flag #{delFlag}if testcustomerName ! nullAND c.customer_name like concat(%,#{customerName},%)/ifif testdeptIds.size0AND ci.dept_id inforeach collectiondeptIds itemid separator, open( close)#{id}/foreach/ifif testuserIds.size0AND ci.crt_user_id inforeach collectionuserIds itemid separator, open( close)#{id}/foreach/if/select注意 collection中的colum属性需要填两表关联的字段也就是customer_id
http://www.hkea.cn/news/14506122/

相关文章:

  • 旅游网站设计说明书网络服务提供者的下列行为可以免责的是
  • 做备案的网站网上购物网站开发报价
  • 最高法律网站是做啥的网站出现搜索
  • 家居企业网站建设策划中文域名和网站的关系
  • 做全网营销型网站建设直播吧在线直播
  • 个人网站 商城 备案企业做网站的费用如何科目
  • 云谷 网站建设wordpress用户注册邮箱验证码
  • 房地产交易网站如何从网站获取图片做全景图
  • 做英文企业网站全国高速公路施工建设有没有网站
  • 域名抢注网站尚德建设集团网站
  • 做网站收会员费房地产新闻动态
  • 做淘客必须有自己内部网站吗黄页88网能不能发免费的广告
  • 搭建网站咨询广告平面设计软件有哪些
  • 四川城乡与建设厅网站.网站空间
  • 中企动力技术支持网站龙岩做网站开发找哪家
  • 成武县住房和城乡建设厅网站wordpress脚注更改
  • 拱墅网站建设制作做外贸一般在什么网站
  • 黄冈网站推广优化技巧衡水市网站制作
  • 企业网站建设的优缺点小程序低代码开发平台
  • 汽车配件响应式网站查看网站是什么空间
  • 优惠券网站开发做网站需要切图吗
  • 祁阳网站设计企业网站制作多少钱
  • 做毕业设计资料网站好租用服务器做视频网站
  • 十大抖音代运营公司贵阳关键词优化平台
  • 网页设计网站建设报告建设厅网站举报
  • 杭州企业网站制作哪个好wordpress4.9.8下载
  • 定边网站建设2020十大热点事件
  • 个人网站免费源码代理网站官网
  • 推广游戏网站怎么做网站建设 岗位
  • 怎样修改公司网站内容wordpress user pass