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

百度搜索电话网站做好后怎么做seo

百度搜索电话,网站做好后怎么做seo,福州模板做网站,成都网站建设方案推广文章目录 一、实战目标二、步骤概览1. 创建部门映射器接口2. 创建映射器配置文件3. 配置全局映射器4. 测试映射器接口 三、详细步骤1、创建部门映射器接口2、创建映射器配置文件3、配置全局映射器4、测试映射器接口 四、结语 一、实战目标 在本实战课程中#xff0c;我们将学… 文章目录 一、实战目标二、步骤概览1. 创建部门映射器接口2. 创建映射器配置文件3. 配置全局映射器4. 测试映射器接口 三、详细步骤1、创建部门映射器接口2、创建映射器配置文件3、配置全局映射器4、测试映射器接口 四、结语 一、实战目标 在本实战课程中我们将学习如何在Spring Boot项目中使用配置方式整合MyBatis框架并实现部门管理功能。 二、步骤概览 创建部门映射器接口创建映射器配置文件配置全局映射器测试映射器接口 1. 创建部门映射器接口 在net.huawei.hrsys_ssm.mapper包下创建DepartmentMapper接口使用Mapper注解标记。 2. 创建映射器配置文件 在resources/mapper目录下创建DepartmentMapper.xml定义SQL映射。 3. 配置全局映射器 在MyBatis配置文件中指定映射器配置文件位置和别名路径。 4. 测试映射器接口 创建TestDepartmentMapper类使用SpringBootTest注解进行测试。 三、详细步骤 1、创建部门映射器接口 Mapper public interface DepartmentMapper {int insert(Department department);int deleteById(int id);int update(Department department);Department findById(int id);ListDepartment findAll(); }2、创建映射器配置文件 DepartmentMapper.xml ?xml version1.0 encodingUTF-8 ? !DOCTYPE mapperPUBLIC -//mybatis.org//DTD Mapper 3.0//ENhttp://mybatis.org/dtd/mybatis-3-mapper.dtdmapper namespacenet.huawei.hrsys_ssm.mapper.DepartmentMapper!-- 插入部门记录 --insert idinsert parameterTypeDepartmentuseGeneratedKeystrue keyPropertyidinsert into department (name, number) values (#{name}, #{number});/insert!-- 删除部门记录 --delete iddeleteById parameterTypeintdelete from department where id #{id};/delete!-- 更新部门记录 --update idupdate parameterTypeDepartmentupdate department set name #{name}, number #{number} where id #{id};/update!-- 查询全部部门 --select idfindAll resultTypeDepartmentselect * from department;/select!-- 创建结果映射一个部门对应多个员工构成的集合 --resultMap idDepartmentWithEmployees typeDepartmentid propertyid columnid/result propertyname columnname/result propertynumber columnnumber/collection propertyemployees javaTypelist ofTypeEmployeeid propertyid columne_id/result propertyage columnage/result propertygender columngender/result propertyname columne_name/result propertynumber columne_number/result propertydepId columndep_id//collection/resultMap!-- 按标识符查询部门记录 --select idfindById resultMapDepartmentWithEmployeesselect d.*, e.id e_id, e.age, e.gender, e.name e_name, e.number e_number, e.dep_idfrom department d left outer join employee e on d.id e.dep_idwhere d.id #{id};/select /mapper3、配置全局映射器 mapper-locations: classpath:mapper/*.xml type-aliases-package: net.huawei.hrsys_ssm.bean4、测试映射器接口 package net.huawei.hrsys_ssm;import net.huawei.hrsys_ssm.bean.Department; import net.huawei.hrsys_ssm.mapper.DepartmentMapper; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest;import java.util.List;/*** 功能测试部门映射器接口* 作者华卫* 日期2024年09月25日*/ SpringBootTest public class TestDepartmentMapper {Autowired // 自动装配部门映射器private DepartmentMapper departmentMapper;Test // 测试查询全部部门public void testFindAll() {// 调用部门映射器的查询全部部门方法ListDepartment departments departmentMapper.findAll();// 利用Lambda表达式遍历部门列表departments.forEach(department - System.out.println(department));}Test // 测试按标识符查询部门public void testFindById() {// 定义标识符int id 1;// 调用部门映射器的按标识符查询部门方法Department department departmentMapper.findById(id);// 判断部门是否查询成功if (department ! null) {System.out.println(department);} else {System.out.println(标识符为[ id ]的部门不存在~);}}Test // 测试插入部门public void testInsert() {// 创建部门对象Department department new Department();// 设置部门对象属性department.setName(后勤部);department.setNumber(5);// 调用部门映射器的插入方法int count departmentMapper.insert(department);// 判断部门是否插入成功if (count 0) {System.out.println(恭喜部门记录插入成功~);System.out.println(插入的记录 departmentMapper.findById(5));} else {System.out.println(遗憾部门记录插入失败~);}}Test // 测试更新部门public void testUpdate() {// 查询id为5的部门Department department departmentMapper.findById(5);// 输出更新前记录System.out.println(记录更新前 department);// 设置部门对象属性department.setName(保卫部);department.setNumber(555);// 调用部门映射器的更新部门方法int count departmentMapper.update(department);// 判断部门是否更新成功if (count 0) {System.out.println(恭喜部门记录更新成功~);// 输出更新后记录System.out.println(记录更新后 departmentMapper.findById(5));} else {System.out.println(遗憾部门记录更新失败~);}}Test // 测试按标识符删除员工public void testDeleteById() {// 输出待删除记录System.out.println(待删除记录 departmentMapper.findById(5));// 调用部门映射器的按标识符删除部门方法int count departmentMapper.deleteById(5);// 判断部门是否删除成功if (count 0) {System.out.println(恭喜部门记录删除成功~);} else {System.out.println(遗憾部门记录删除失败~);}} }四、结语 通过本课程你将掌握Spring Boot与MyBatis的整合并能够实现部门管理的CRUD操作。
http://www.hkea.cn/news/14489095/

相关文章:

  • 有经验的宁波网站建设seo主要是指优化
  • 做网站可以干嘛760关键词排名查询
  • 交友免费的网站建设毕设网站建设
  • 网站广告的图片怎么做工信部网站备案要求
  • php网站做ios城市建设杂志社官方网站
  • 网站怎么建设及推广天津手机网站建设
  • 织梦网站首页标签wordpress访问量插件
  • 模板网站怎么建设网站建设规划书怎么写
  • 商务网站建设评估的指标网站怎样制作
  • 做会计公司网站的目录2网站建设公司
  • 淘宝客网站的模板万州做网站
  • 珠江摩尔网站建设网站系统建站
  • 深圳网站建设方维网络广州建设
  • 娱乐网站建设方案商城网站免费建设
  • 怎么给喜欢的人做网站嘉兴海盐县城乡建设局网站
  • 什么网站专门做软件的网络推广协议合同范本
  • 双鸭山网站建设公司一级造价工程师吧
  • 佛山网站建设的首选公司cms是哪家公司
  • 对于协会的新年祝贺语网站模板wordpress免费相册
  • 如何做游戏试玩网站网站的关键词在哪设置
  • 如何申请建设网站首页360免费wifi下载安装
  • 金华网站设计公司长沙公共资源交易中心官网
  • 网站辅导运营与托管公司海南住房与建设厅网站
  • 服务器搭建网站方案500字施工企业信用评价
  • 企业网站优化暴肃湖南岚鸿很好怎样自做网站
  • 服务机构电子商务网站有哪些云匠网骗设计师入驻费
  • 苏州网站建设n苏州网站建设公司福田欧曼自卸车
  • 深圳网站开发专业团队提高wordpress响应速度慢
  • 网站建设怎么分析市场wordpress 用户权限管理
  • tp5企业网站开发实例免费crm系统手机版