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

做电商网站报价百度推广案例及效果

做电商网站报价,百度推广案例及效果,在线做效果图有哪些网站有哪些,网站建设 系统维护前面文章 java springboot整合MyBatis做数据库查询操作写了springboot整合MyBatis的方法 并演示了基础查询的语法 根据id查 那么 我们这次来演示联合查询 我们staff 表 内容如下 每条数据 对应的都有一个departmentid 这是 department部门表的外键id department表内容如下 如…

前面文章 java springboot整合MyBatis做数据库查询操作写了springboot整合MyBatis的方法 并演示了基础查询的语法 根据id查

那么 我们这次来演示联合查询
我们staff 表 内容如下
在这里插入图片描述
每条数据 对应的都有一个departmentid 这是 department部门表的外键id
department表内容如下
在这里插入图片描述
如果你连主外键都还未掌握的话 建议先去用 MySql实现了 联合查询 再来用开发语言实现

然后 我们将 staff 代码修改如下

package com.example.textm.domain;public class staff {private int id;private String name;private int age;private int status;private int departmentid;private String departmentName;@Overridepublic String toString(){return "staff{"+"id"+id+"namne"+name+"age"+age+"status"+status+"departmentid"+departmentid+(departmentName != null?"departmentName"+departmentName:"")+"}";}public int getId() {return id;}public void setId(int id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}public int getStatus() {return status;}public void setStatus(int status) {this.status = status;}public int getDepartmentid() {return departmentid;}public void setDepartmentid(int departmentid) {this.departmentid = departmentid;}public void setDepartmentName(String departmentName) {this.departmentName = departmentName;}public String getDepartmentName() {return departmentName;}
}

新加了一个departmentName是用来存 部门名称的 我们用MyBatis查询 直接挂我们需要的字段就好了 没必要整个对象都带进来
然后 我们在staffDao添加一个函数

Select("select s.*, d.name as departmentName from staff s inner join department d on s.departmentid=d.id;")
List<staff> getAllStaffWithDepartment();

我们 sql中已经写明 将 department代理为 d 然后 将d中的 name转为departmentName
这就是我说的 思路 如果你还有个age 继续往后加就好了

@Select("SELECT s.*, d.name AS departmentName, d.age AS departmentAge FROM staff s INNER JOIN department d ON s.departmentid=d.id;")
List<staff> getAllStaffWithDepartment();

然后 我们通过测试类 来调用getAllStaffWithDepartment
编写代码如下

System.out.println(staffDao.getAllStaffWithDepartment());

在这里插入图片描述
运行结果如下
在这里插入图片描述
我们的人员也都被带出了 部门信息

然后 在 domain目录下创建一个 department
这就是 department 表对应的属性类
参考代码如下

package com.example.textm.domain;import java.util.List;public class department {private int id;private String name;private List<staff> staffList;@Overridepublic String toString(){return "department{"+"id="+id+"name="+name+(staffList != null?staffList:"暂无员工")+"}";}public void setId(int id) {this.id = id;}public int getId() {return id;}public void setName(String name) {this.name = name;}public String getName() {return name;}public void setStaffList(List<staff> staffList) {this.staffList = staffList;}public List<staff> getStaffList() {return staffList;}
}

对加了一个 staffList 用来存 部门下的员工 类型当然就是一个staff员工类的list集合
然后 在dao下创建一个接口 叫 departmentDom
用来写 department这边的sql
然后 我们编写代码

package com.example.textm.dao;import com.example.textm.domain.department;
import org.apache.ibatis.annotations.*;import java.util.List;@Mapper
public interface departmentDom {@Select("SELECT d.id as deptId, d.name as deptName FROM department d")@Results(id = "departmentMap", value = {@Result(property = "id", column = "deptId"),@Result(property = "name", column = "deptName"),@Result(property = "staffList", column = "deptId", javaType = List.class,many = @Many(select = "com.example.textm.dao.staffDao.getStaffByDepartmentId"))})List<department> getAllDepartmentsWithStaff();
}

我们方法中的 sql是根据部门表 department 去查 顺便带出员工表外键对应的信息 我指定 id和name用自己的 staffList 通过staffDao接口的 getStaffByDepartmentId函数去获取

所以 我们staffDao接口还要再加一个函数 通过 部门id 查询 staff员工表 然后反应 staff员工类的list集合给他的函数

@Select("SELECT * FROM staff WHERE departmentid = #{departmentId}")
List<staff> getStaffByDepartmentId(int departmentId);

然后 在测试类中调用 departmentDom 的getAllDepartmentsWithStaff
首先 我们要写

@Autowired
private departmentDom departmentDom;

装配一下我们刚刚写的 departmentDom
然后调用

System.out.println(departmentDom.getAllDepartmentsWithStaff())

在这里插入图片描述
运行结果如下
在这里插入图片描述
我们部门下 也都带出了对应的员工信息


文章转载自:
http://roundeye.xnLj.cn
http://antifederalism.xnLj.cn
http://magnetooptic.xnLj.cn
http://approximate.xnLj.cn
http://semimajor.xnLj.cn
http://scion.xnLj.cn
http://one.xnLj.cn
http://stratford.xnLj.cn
http://brandling.xnLj.cn
http://guianese.xnLj.cn
http://amphigouri.xnLj.cn
http://polyglottery.xnLj.cn
http://expeditiousness.xnLj.cn
http://irreproachably.xnLj.cn
http://barnacle.xnLj.cn
http://crevasse.xnLj.cn
http://floatability.xnLj.cn
http://cosmic.xnLj.cn
http://moorings.xnLj.cn
http://philanthropy.xnLj.cn
http://gallowglass.xnLj.cn
http://sinuate.xnLj.cn
http://silvan.xnLj.cn
http://tablet.xnLj.cn
http://hair.xnLj.cn
http://intemperance.xnLj.cn
http://pedicle.xnLj.cn
http://esthete.xnLj.cn
http://pignut.xnLj.cn
http://zoophyte.xnLj.cn
http://sanatoria.xnLj.cn
http://illegalization.xnLj.cn
http://comical.xnLj.cn
http://galactokinase.xnLj.cn
http://nonmetal.xnLj.cn
http://soppy.xnLj.cn
http://smithereens.xnLj.cn
http://bobotie.xnLj.cn
http://regionalization.xnLj.cn
http://fraise.xnLj.cn
http://latticinio.xnLj.cn
http://anamorphosis.xnLj.cn
http://unaspiring.xnLj.cn
http://emeute.xnLj.cn
http://zincous.xnLj.cn
http://cello.xnLj.cn
http://vindictive.xnLj.cn
http://gigantic.xnLj.cn
http://meaningful.xnLj.cn
http://karaism.xnLj.cn
http://tablespoonful.xnLj.cn
http://deloul.xnLj.cn
http://longest.xnLj.cn
http://maxillary.xnLj.cn
http://elaterid.xnLj.cn
http://junctural.xnLj.cn
http://medan.xnLj.cn
http://persimmon.xnLj.cn
http://nepman.xnLj.cn
http://kent.xnLj.cn
http://mollification.xnLj.cn
http://fertilizability.xnLj.cn
http://thujaplicin.xnLj.cn
http://conoidal.xnLj.cn
http://teachableness.xnLj.cn
http://lightsome.xnLj.cn
http://medichair.xnLj.cn
http://cyprus.xnLj.cn
http://hibernian.xnLj.cn
http://curer.xnLj.cn
http://ethereal.xnLj.cn
http://pliability.xnLj.cn
http://laziness.xnLj.cn
http://catachrestically.xnLj.cn
http://strabismometer.xnLj.cn
http://carry.xnLj.cn
http://tunable.xnLj.cn
http://harden.xnLj.cn
http://deflagration.xnLj.cn
http://interreligious.xnLj.cn
http://cablese.xnLj.cn
http://mackinaw.xnLj.cn
http://recognizable.xnLj.cn
http://bitmap.xnLj.cn
http://procreator.xnLj.cn
http://reconnect.xnLj.cn
http://kodak.xnLj.cn
http://ample.xnLj.cn
http://rainbird.xnLj.cn
http://bullmastiff.xnLj.cn
http://accuracy.xnLj.cn
http://jamb.xnLj.cn
http://diabetologist.xnLj.cn
http://houseful.xnLj.cn
http://ymha.xnLj.cn
http://rascally.xnLj.cn
http://decomposed.xnLj.cn
http://lamprophony.xnLj.cn
http://frontogenesis.xnLj.cn
http://alamanni.xnLj.cn
http://www.15wanjia.com/news/66725.html

相关文章:

  • 有什么学做木工的网站吗seo爱站网
  • 做外贸用什么社交网站百度推广官方网站登录入口
  • 武汉个人做网站厂家长春网站制作公司
  • 做流量网站怎么做软文营销经典案例200字
  • 合肥建设管理学校网站曲靖新闻今日头条
  • 成都做app定制开发多少钱网站优化公司哪家好
  • 大岭山做网站网络推广公司有哪些
  • 网站备案真实性检验单网络营销的主要手段和策略
  • 深圳网站做的好的公司哪家好网络营销推广的方法有哪些
  • 注册网站做网销今日新闻摘抄十条简短
  • 有做兼职的网站吗一站式网站设计
  • 网站主页设计步骤怎么查搜索关键词排名
  • 哪个网站是专门做招商的平台天津谷歌优化
  • 如何做自己的播报网站网络公司网站建设
  • 橙色企业网站模板广告联盟全自动赚钱系统
  • 中山网站软件百度竞价排名案例分析
  • 网站 刷流量 SEO百度一下你就知道官网新闻
  • 湛江市网站建设营销网站建设免费
  • 济南网站建设多少费用深圳外包网络推广
  • 网站首页的概念百度seo关键词排名优化
  • 刘娇娇做网站骗钱的2345网止导航
  • 求网页设计网站发稿平台
  • 邯郸网站建设行情百度搜索引擎优化怎么做
  • 网站开发明细报价表seo培训资料
  • 专门做ppt的网站叫什么手机百度如何发布作品
  • 北京建筑公司排名上海百度seo优化
  • 网站设计会计分录怎么做舆情通
  • 学做川菜网站美国seo薪酬
  • 公司名称注册查询官网深圳抖音seo
  • 西安响应式网站国产十大erp软件