-
Notifications
You must be signed in to change notification settings - Fork 822
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
695 additions
and
3 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
springboot-demo/src/main/java/com/pancm/controller/TSysUserController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
87
springboot-demo/src/main/java/com/pancm/dao/TSysUserDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
springboot-demo/src/main/java/com/pancm/model/TSysUser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
springboot-demo/src/main/java/com/pancm/service/ITSysUserService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
||
} |
Oops, something went wrong.