增加了Staff类作为服务层及DAO层示例

master
ArgonarioD 2022-06-28 17:38:22 +08:00
parent dfc7c1ff8f
commit 59c56b886f
5 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,19 @@
package cn.edu.hfut.rmdjzz.projectmanagement.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
* @author
* @since 2022/6/28 17:25
*/
@Data
public class Staff {
@TableId(type = IdType.AUTO)
private Integer staffId;
private String staffUsername;
private String staffPassword;
private String staffNickname;
private String staffGender;
}

View File

@ -0,0 +1,11 @@
package cn.edu.hfut.rmdjzz.projectmanagement.mapper;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Staff;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author
* @since 2022/6/28 17:25
*/
public interface StaffMapper extends BaseMapper<Staff> {
}

View File

@ -0,0 +1,11 @@
package cn.edu.hfut.rmdjzz.projectmanagement.service;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Staff;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author
* @since 2022/6/28 17:28
*/
public interface IStaffService extends IService<Staff> {
}

View File

@ -0,0 +1,15 @@
package cn.edu.hfut.rmdjzz.projectmanagement.service.impl;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Staff;
import cn.edu.hfut.rmdjzz.projectmanagement.mapper.StaffMapper;
import cn.edu.hfut.rmdjzz.projectmanagement.service.IStaffService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author
* @since 2022/6/28 17:29
*/
@Service
public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements IStaffService {
}

View File

@ -0,0 +1,28 @@
package cn.edu.hfut.rmdjzz.projectmanagement;
import cn.edu.hfut.rmdjzz.projectmanagement.service.impl.StaffServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.SneakyThrows;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import javax.annotation.Resource;
/**
* @author
* @since 2022/6/28 17:31
*/
@SpringBootTest
public class MybatisPlusTests {
@Resource
StaffServiceImpl staffService;
@Resource
private ObjectMapper objectMapper;
@SneakyThrows
@Test
public void test() {
System.out.println(objectMapper.writeValueAsString(staffService.list()));
}
}