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

网站开发的项目开发wap浏览器手机版下载

网站开发的项目开发,wap浏览器手机版下载,做网站图标按钮素材,保定网站建设13.1 静态资源下载 https://download.csdn.net/download/no996yes885/88151513 13.2 静态资源位置 css样式文件放在static的css目录下#xff1b;static的img下放图片#xff1b;template目录下放其余的html文件。 13.3 创建两个实体类 导入依赖#xff1a;lombok !…13.1 静态资源下载 https://download.csdn.net/download/no996yes885/88151513 13.2 静态资源位置 css样式文件放在static的css目录下static的img下放图片template目录下放其余的html文件。  13.3 创建两个实体类 导入依赖lombok !--lombok-- dependencygroupIdorg.projectlombok/groupIdartifactIdlombok/artifactId /dependency 加入Data注解自动创建set、get等方法 加入AllArgsConstructor注解自动创建有参构造方法 加入NoArgsConstructor注解自动创建无参构造方法 Department package jiang.com.springbootstudy.pojo; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor;Data AllArgsConstructor NoArgsConstructor public class Department {private Integer id;private String departmentName; }Employee package jiang.com.springbootstudy.pojo; import lombok.Data; import lombok.NoArgsConstructor;import java.util.Date;Data NoArgsConstructor public class Employee {private Integer id;private String lastName;private String email;private Integer gender; // 0 女 1 男private Department department;private Date birth;public Employee(Integer id, String lastName, String email, Integer gender, Department department) {this.id id;this.lastName lastName;this.email email;this.gender gender;this.department department;this.birth new Date(); // 一创建对象调用有参的话自动生成了日期属性} }13.4 创建实体类对应的dao类 DepartmentDao 注意这里类中的加载顺序静态的属性和代码要先加载然后再加载其他的。使用静态代码块结合Map来模拟数据库数据库的删查使用的是remove、values、get方法。 package jiang.com.springbootstudy.dao;import jiang.com.springbootstudy.pojo.Department; import lombok.Data; import org.springframework.stereotype.Repository;import java.util.Collection; import java.util.HashMap; import java.util.Map; Data Repository public class DepartmentDao {/*模拟数据库中的数据*/private static MapInteger, Department departments null;static {departments new HashMapInteger, Department();//创建一个部门表departments.put(101,new Department(101,教学部));departments.put(102,new Department(102,市场部));departments.put(103,new Department(103,教研部));departments.put(104,new Department(104,运营部));departments.put(105,new Department(105,后勤部));}// 获得所有部门信息public CollectionDepartment getDepartments(){return departments.values();}// 通过id得到部门public Department getDepartmentById(Integer id){return departments.get(id);} }EmployeeDao: package jiang.com.springbootstudy.dao;import jiang.com.springbootstudy.pojo.Department; import jiang.com.springbootstudy.pojo.Employee; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository;import java.util.Collection; import java.util.HashMap; import java.util.Map;Repository //自动注入需要的注解 public class EmployeeDao {private static MapInteger, Employee employees null;// 员工所属的部门// 放数据先加载静态的东西比如说静态的遍历或者静态的代码Autowired //自动注入private DepartmentDao departmentDao;static {employees new HashMapInteger, Employee();//前面只是定义了成员变量的类型并没有赋值null无法调用put方法所以要创建对象。employees.put(1001,new Employee(1001,AA,A24736743qq.com,0,new Department(101,教学部)));employees.put(1002,new Employee(1002,AA,B24736743qq.com,1,new Department(101,市场部)));employees.put(1003,new Employee(1003,AA,C24736743qq.com,0,new Department(101,教研部)));employees.put(1004,new Employee(1004,AA,D24736743qq.com,1,new Department(101,运营部)));employees.put(1005,new Employee(1005,AA,E24736743qq.com,0,new Department(101,后勤部)));}// 主键自增private static Integer initId 1006; // static和没有有什么区别// 增加员工public void save(Employee employee){if (employee.getId()null){employee.setId(initId);//自增变量的值也会改变}employee.setDepartment(departmentDao.getDepartmentById(employee.getDepartment().getId())); //这句话可以忽略原理是调用了接口的getDepartmentById方法传入从员工的部门属性获取的部门id得到一个部门然后把部门属性赋值给了员工employees.put(employee.getId(),employee);}// 查询全部员工信息public CollectionEmployee getAll(){ //集合需要掌握一下return employees.values();}// 通过id查询员工public Employee getEmployeeById(Integer id){return employees.get(id);}// 删除员工public void delete(Integer id){employees.remove(id);}}
http://www.pierceye.com/news/943246/

相关文章:

  • 温州红酒网站建设长沙移动网站建设
  • 如何制作网站?企业网站制作步骤
  • 桓台县旅游网站建设购物网站建设技术难点
  • 单页网站推广网站qq链接怎么做
  • wordpress仿站步骤平乡网站建设
  • 青岛高端网站建设公司新网站seo技术
  • 手机网站后台甘肃网络推广技巧
  • 做co网站阿里云建站方案
  • 如何做网站首页优化怎么查网站点击量
  • 北京网站制作百度推广潜江资讯网二手房出售
  • 北京建网站软件深圳企业网站
  • 网站关键词互点备案网站简介怎么写
  • 网站建设报告书范文哈尔滨网站公司哪家好
  • 景观毕业设计作品网站公司网站销售平台建设费分录
  • 品牌网站建设还来大蝌蚪华为手机WordPress
  • 东莞制作企业网站公司网站营销活动页面制作
  • 有中文网站 怎么做英文网站企业网站建设 价格
  • 网络游戏网站开发建设工程施工合同样本
  • 陕西网站制作公司泸州中泸集团建设有限公司网站
  • 营销型网站建设的概念电子商务公司最低注册资本
  • 计划书网站推广的目录怎么做太原便宜做网站的公司哪家好
  • wordpress 直播插件麒麟seo外推软件
  • 网站检测报告哪里做寰宇seo
  • 徐州微信网站建设网站建设员课程
  • 做现货需要关注的网站wordpress+游戏网站
  • 佛山北京网站建设网络营销推广有哪些方法
  • 免费注册网站网址合肥网站建设第一品牌
  • 青州建网站网站建设seo虾哥网络
  • 网站框架怎么设计wordpress新闻页面模板下载
  • 国外网站平台做微信公众号的是哪个网站