Skip to content

Commit

Permalink
update EasyCode
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwujing committed Apr 1, 2024
1 parent 4451a9e commit c537f9d
Show file tree
Hide file tree
Showing 10 changed files with 695 additions and 3 deletions.
90 changes: 88 additions & 2 deletions springboot-demo/easycode/EasyCodeConfig.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions springboot-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@
<artifactId>mapper-spring-boot-starter</artifactId>
<version>${tk.mybatis.boot.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.0.5</version>
</dependency>
<!-- mybatis-generator-core 反向生成java代码,解决dtd 标红的问题-->
<dependency>
<groupId>org.mybatis.generator</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package com.pancm.controller;

import com.pancm.vo.TSysUserVO;
import com.pancm.service.ITSysUserService;
import org.springframework.web.bind.annotation.*;


import com.pancm.vo.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;



/**
* @Title: 用户表(TSysUser)表控制层
* @Description:
* @Version:1.0.0
* @Since:jdk1.8
* @author pancm
* @date 2024-04-01 09:30:51
*/
@Api(tags = "用户表(TSysUser)")
@RestController
@RequestMapping("tSysUser")
public class TSysUserController {
/**
* 服务对象
*/
@Autowired
private ITSysUserService tSysUserService;


/**
* 新增一条数据
*
* @param tSysUserVO 实体类
* @return Response对象
*/
@ApiOperation(value = "用户表新增",notes = "用户表新增")
@RequestMapping(value = "save", method = RequestMethod.POST)
public ApiResult insert(@RequestBody TSysUserVO tSysUserVO, HttpServletRequest httpRequest) {
int result = tSysUserService.insert(tSysUserVO);
if (result > 0) {
return ApiResult.success();
}
return ApiResult.error("新增失败");
}

/**
* 修改一条数据
*
* @param tSysUserVO 实体类
* @return Response对象
*/
@ApiOperation(value = "用户表修改",notes = "用户表修改")
@RequestMapping(value = "edit", method = RequestMethod.POST)
public ApiResult update(@RequestBody TSysUserVO tSysUserVO, HttpServletRequest httpRequest) {
tSysUserService.update(tSysUserVO);
return ApiResult.success();
}

/**
* 删除一条数据
*
* @param tSysUserVO 参数对象
* @return Response对象
*/
@ApiOperation(value = "用户表删除",notes = "用户表删除")
@RequestMapping(value = "del", method = RequestMethod.POST)
public ApiResult delete(@RequestBody TSysUserVO tSysUserVO, HttpServletRequest httpRequest) {
tSysUserService.deleteById(tSysUserVO.getId());
return ApiResult.success();
}



/**
* 分页查询
*
*/
@ApiOperation(value = "用户表查询",notes = "用户表查询")
@RequestMapping(value = "list", method = RequestMethod.POST)
public ApiResult list(@RequestBody TSysUserVO tSysUserVO) {
return tSysUserService.list(tSysUserVO);
}

/**
* 详情查询
*
*/
@ApiOperation(value = "用户表详情",notes = "用户表详情")
@RequestMapping(value = "view", method = RequestMethod.GET)
public ApiResult view( @RequestParam("id") String id) {
return ApiResult.success(tSysUserService.queryById(id));
}
}
87 changes: 87 additions & 0 deletions springboot-demo/src/main/java/com/pancm/dao/TSysUserDao.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package com.pancm.dao;

import com.pancm.model.TSysUser;
import com.pancm.vo.TSysUserVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* @Title: 用户表(TSysUser)表数据库访问层
* @Description:
* @Version:1.0.0
* @Since:jdk1.8
* @author pancm
* @date 2024-04-01 09:30:54
*/
@Mapper
public interface TSysUserDao extends BaseMapper<TSysUser> {

/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
TSysUserVO queryById(String id);


/**
* 通过实体查询一条数据
*
* @param tSysUserVO 实例对象
* @return 对象列表
*/
TSysUserVO findOne(TSysUserVO tSysUserVO);

/**
* 通过实体作为筛选条件查询
*
* @param tSysUserVO 实例对象
* @return 对象列表
*/
List<TSysUserVO> queryAll(TSysUserVO tSysUserVO);

/**
* 新增数据
*
* @param tSysUser 实例对象
* @return 影响行数
*/
int insert(TSysUser tSysUser);

/**
* 批量新增数据(MyBatis原生foreach方法)
*
* @param entities List<TSysUser> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<TSysUser> entities);

/**
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
*
* @param entities List<TSysUser> 实例对象列表
* @return 影响行数
*/
int insertOrUpdateBatch(@Param("entities") List<TSysUser> entities);

/**
* 修改数据
*
* @param tSysUser 实例对象
* @return 影响行数
*/
int update(TSysUser tSysUser);

/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(String id);

}

4 changes: 3 additions & 1 deletion springboot-demo/src/main/java/com/pancm/dao/UserDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.pancm.vo.UserVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Mapper;
import tk.mybatis.mapper.common.BaseMapper;

import java.util.List;

/**
Expand All @@ -15,7 +17,7 @@
* @date 2024-01-15 15:27:04
*/
@Mapper
public interface UserDao {
public interface UserDao {

/**
* 通过ID查询单条数据
Expand Down
61 changes: 61 additions & 0 deletions springboot-demo/src/main/java/com/pancm/model/TSysUser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.pancm.model;


import com.alibaba.fastjson.JSONObject;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Table;
import java.io.Serializable;
import java.sql.Date;

/**
* @Title: 用户表(TSysUser)实体类
* @Description:
* @Version:1.0.0
* @Since:jdk1.8
* @author pancm
* @date 2024-04-01 09:30:55
*/
@Data
@Table(name = "t_sys_user")
public class TSysUser implements Serializable {
private static final long serialVersionUID = -56958960669065369L;
/**
* 主键
*/
@Column(name = "id")
private String id;
/**
* 用户账号
*/
@Column(name = "username")
private String username;
/**
* 用户密码
*/
@Column(name = "password")
private String password;
/**
* 昵称
*/
@Column(name = "nickname")
private String nickname;
/**
* 部门id
*/
@Column(name = "dep_id")
private Integer depId;
/**
* 岗位id
*/
@Column(name = "pos_id")
private String posId;


@Override
public String toString(){
return JSONObject.toJSONString(this);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.pancm.service;

import com.pancm.vo.TSysUserVO;
import com.pancm.model.TSysUser;
import com.pancm.vo.ApiResult;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;


/**
* @Title: 用户表(TSysUser)表服务接口
* @Description:
* @Version:1.0.0
* @Since:jdk1.8
* @author pancm
* @date 2024-04-01 09:30:53
*/
public interface ITSysUserService extends IService<TSysUser>{

/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
TSysUserVO queryById(String id);


/**
* 通过实体作为筛选条件查询
*
* @param tSysUserVO 实例对象
* @return 对象列表
*/
ApiResult list(TSysUserVO tSysUserVO);


/**
* 新增数据
*
* @param tSysUserVO 实例对象
* @return 实例对象
*/
int insert(TSysUserVO tSysUserVO);

/**
* 修改数据
*
* @param tSysUserVO 实例对象
* @return 实例对象
*/
int update(TSysUserVO tSysUserVO);

/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(String id);

}
Loading

0 comments on commit c537f9d

Please sign in to comment.