首页>代码>mac下spring boot基础增删改查项目实例>/springBootMybatis/src/main/java/com/test/demo/controller/UserController.java
package com.test.demo.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.test.demo.dao.UserDao;
import com.test.demo.entity.UserEntity;

@RestController
@RequestMapping(value="/user")
public class UserController {
	
	@Autowired
	UserDao dao;
	
	
	@RequestMapping(value="/findlist",method=RequestMethod.GET)
	public UserEntity findList(String id) {
		UserEntity entity = dao.userFindById(Integer.parseInt(id));
		return entity;
	}
	
	@RequestMapping(value={"/selectUserByName"}, method=RequestMethod.GET)
    public List<UserEntity> selectUserByName(String userName){
        return dao.selectUserByName(userName);
    }

    @RequestMapping(value={"/addUser"}, method=RequestMethod.POST)
    public void addUser(UserEntity user){
        dao.addUser(user);
    }

    @RequestMapping(value={"/updateUser"}, method=RequestMethod.POST)
    public void updateUser(UserEntity user){
        dao.updateUser(user);
    }

    @RequestMapping(value={"/deleteUser"}, method=RequestMethod.POST)
    public void deleteUser(String id){
        dao.deleteUser(Integer.parseInt(id));
    }

	
	

}
最近下载更多
212600  LV7 2021年11月22日
木杉123456  LV6 2020年11月12日
t19611321  LV10 2020年9月21日
XKNangBoWan  LV4 2020年2月26日
段朝洪  LV15 2020年1月11日
863240840  LV2 2019年11月2日
ht23333  LV3 2019年10月31日
deepbass  LV3 2019年9月1日
Delimar  LV10 2019年4月13日
orioncny  LV6 2019年4月9日
最近浏览更多
2994754858 3月21日
暂无贡献等级
skook7  LV2 2023年12月14日
wnnmmb  LV2 2023年11月12日
张真狗  LV9 2023年5月22日
hbsoft2008  LV16 2023年3月20日
HANCW  LV8 2022年12月11日
piepiepie 2022年6月13日
暂无贡献等级
swl731372388  LV3 2022年5月26日
sunyikun0909  LV1 2022年5月10日
lijianxin321  LV1 2022年4月25日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友