思途实训-day01

欢迎访问我的个人博客:苦酒

思途实训-day01

上午

  1. 开班动员大会,没啥好说的
  2. 分班,分到杜老师的班级,讲解了JAVA未来的方向及一些编译器和环境的配置和安装思途工具提取码:7x5f

下午

老师讲解使用JAVA spring来操作数据库,以下为代码(尚未完成)

  1. DepartmentMapper.java
package com.situ.company.department.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;//主函数
import org.apache.ibatis.annotations.Select;//mysql的选择函数
import org.apache.ibatis.annotations.Update;//mysql的更新函数
import org.apache.ibatis.annotations.Insert;//mysql的添加函数
import org.apache.ibatis.annotations.Delete;//mysql的删除函数

import com.situ.company.department.model.DepartmentModel;

@Mapper
public interface DepartmentMapper 
{
	//department 公司
	//数据的添加
	@Insert("insert into department(code, name, tel) values(#{code}, #{name}, #{tel})")
	int insert(DepartmentModel model);
	
	//数据的删除
	@Delete("delete from department where code = #{code}")
	int Delete(DepartmentModel model);
	
	//数据的更新
	@Update("updata department set name = #{name}, tel = #{tel} where code = #{code}")
	int updata(DepartmentModel model);
	
	//根据编号获取数据
	@Select("select code, name, tel, (SELECT count(1) FROM st_company.employee where dept_code = department.code count FROM department where code=#{code})")
	DepartmentModel selectModel(DepartmentModel model);
}

  1. DepartmentModel
package com.situ.company.department.model;//全包名

public class DepartmentModel
{
	private Integer id;
	private String code;
	private String name;
	private String tel;
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	} 
}

晚上

巩固mysql的语法并写出其他三张表的Mapper和Model

你可能感兴趣的:(思途实训)