package com.dy.pipIrrDemo.user; import com.dy.common.mybatis.envm.Deleted; import com.dy.common.mybatis.envm.Disabled; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import com.dy.pipIrrGlobal.pojoDemo.DemoUser; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @Slf4j @RestController @RequestMapping(path="user") @SuppressWarnings("unchecked") public class UserCtrl { UserSv userSv; @Autowired public void setUserSv(UserSv userSv){ this.userSv = userSv; } @GetMapping("selectById1") public BaseResponse selectById1(){ try { DemoUser po = userSv.selectById1(1L) ; return BaseResponseUtils.buildSuccess(po); } catch (Exception e) { log.error("selectById1", e); return BaseResponseUtils.buildException(e.getMessage()) ; } } @GetMapping("selectById2") public BaseResponse selectById2(){ try { DemoUser po = userSv.selectById2(1L) ; return BaseResponseUtils.buildSuccess(po); } catch (Exception e) { log.error("selectById2", e); return BaseResponseUtils.buildException(e.getMessage()) ; } } @GetMapping("selectById3") public BaseResponse selectById3(){ try { DemoUser po = userSv.selectById3(1L) ; return BaseResponseUtils.buildSuccess(po); } catch (Exception e) { log.error("selectById3", e); return BaseResponseUtils.buildException(e.getMessage()) ; } } @GetMapping("selectById4") public BaseResponse selectById4(){ try { DemoUser po = userSv.selectById4(1L) ; return BaseResponseUtils.buildSuccess(po); } catch (Exception e) { log.error("selectById4", e); return BaseResponseUtils.buildException(e.getMessage()) ; } } @GetMapping("selectById5") public BaseResponse selectById5(){ try { DemoUser po = userSv.selectById5(1L) ; return BaseResponseUtils.buildSuccess(po); } catch (Exception e) { log.error("selectById5", e); return BaseResponseUtils.buildException(e.getMessage()) ; } } @GetMapping("insert") public BaseResponse insert(){ try { DemoUser po = new DemoUser(); po.name = "王五" ; po.password = "123456" ; po.disabled = Disabled.NO ; po.deleted = Deleted.NO ; po.roleId = 1L ; this.userSv.insert(po) ; return BaseResponseUtils.buildSuccess(po); } catch (Exception e) { log.error("insert", e); return BaseResponseUtils.buildException(e.getMessage()) ; } } }