add:demo
This commit is contained in:
@@ -36,7 +36,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@EnableMethodCache(basePackages = "org.nl")
|
@EnableMethodCache(basePackages = "org.nl")
|
||||||
@EnableCreateCacheAnnotation
|
@EnableCreateCacheAnnotation
|
||||||
@MapperScan("org.nl.service.*.dao.mapper")
|
@MapperScan("org.nl.*.service.*.dao.mapper")
|
||||||
public class AppRun {
|
public class AppRun {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package org.nl.system.controller.user;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import org.nl.system.service.user.dao.SysUser;
|
||||||
|
import org.nl.system.service.user.dao.mapper.SysUserMapper;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-14
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sysUser")
|
||||||
|
public class SysUserController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
SysUserMapper sysUserMapper;
|
||||||
|
@RequestMapping("/demo")
|
||||||
|
public String do3(){
|
||||||
|
List<SysUser> sysUsers = sysUserMapper.selectLimit();
|
||||||
|
return JSON.toJSONString(sysUsers);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.nl.system.service.user;
|
||||||
|
|
||||||
|
import org.nl.system.service.user.dao.SysUser;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-14
|
||||||
|
*/
|
||||||
|
public interface SysUserService extends IService<SysUser> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
package org.nl.system.service.user.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-14
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("sys_user")
|
||||||
|
public class SysUser implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户标识
|
||||||
|
*/
|
||||||
|
@TableId(value = "user_id", type = IdType.AUTO)
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录账号
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 姓名
|
||||||
|
*/
|
||||||
|
private String personName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 性别
|
||||||
|
*/
|
||||||
|
private String gender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电话
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子邮箱
|
||||||
|
*/
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像地址
|
||||||
|
*/
|
||||||
|
private String avatarName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像真实路径
|
||||||
|
*/
|
||||||
|
private String avatarPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为admin账号
|
||||||
|
*/
|
||||||
|
private String isAdmin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
private String isUsed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码重置者
|
||||||
|
*/
|
||||||
|
private String pwdResetUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码重置时间
|
||||||
|
*/
|
||||||
|
private String pwdResetTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人标识
|
||||||
|
*/
|
||||||
|
private Long createId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人标识
|
||||||
|
*/
|
||||||
|
private Long updateOptid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
private String updateOptname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private String updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外部人员标识
|
||||||
|
*/
|
||||||
|
private String extpersonId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外部用户标识
|
||||||
|
*/
|
||||||
|
private String extuserId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package org.nl.system.service.user.dao.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.nl.system.service.user.dao.SysUser;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-14
|
||||||
|
*/
|
||||||
|
public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||||
|
|
||||||
|
List<SysUser> selectLimit();
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.nl.system.service.user.dao.mapper.SysUserMapper">
|
||||||
|
|
||||||
|
<select id="selectLimit" resultType="org.nl.system.service.user.dao.SysUser">
|
||||||
|
select * from sys_user limit 1
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package org.nl.system.service.user.impl;
|
||||||
|
|
||||||
|
import org.nl.system.service.user.dao.SysUser;
|
||||||
|
import org.nl.system.service.user.dao.mapper.SysUserMapper;
|
||||||
|
import org.nl.system.service.user.SysUserService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 用户表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2022-12-14
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package org.nl.sso;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.nl.AppRun;
|
||||||
|
import org.nl.system.service.user.SysUserService;
|
||||||
|
import org.nl.system.service.user.dao.SysUser;
|
||||||
|
import org.nl.system.service.user.dao.mapper.SysUserMapper;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @author ZZQ
|
||||||
|
* @Date 2022/12/14 4:59 下午
|
||||||
|
*/
|
||||||
|
//@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(classes = AppRun.class)
|
||||||
|
public class MybatisTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
SysUserService sysUserService;
|
||||||
|
@Test
|
||||||
|
public void mybatisTest(){
|
||||||
|
List<SysUser> list = sysUserService.list();
|
||||||
|
System.out.println(JSON.toJSONString(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user