增加了Staff类作为服务层及DAO层示例
parent
dfc7c1ff8f
commit
59c56b886f
|
@ -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;
|
||||
}
|
|
@ -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> {
|
||||
}
|
|
@ -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> {
|
||||
}
|
|
@ -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 {
|
||||
}
|
|
@ -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()));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue