zoukankan      html  css  js  c++  java
  • springmvc Mapper注解写法

    package cn.com.chinautrust.idm.repo.mybatis.mapper;
    
    import java.util.List;
    
    import org.apache.ibatis.annotations.Delete;
    import org.apache.ibatis.annotations.Insert;
    import org.apache.ibatis.annotations.Options;
    import org.apache.ibatis.annotations.Param;
    import org.apache.ibatis.annotations.ResultType;
    import org.apache.ibatis.annotations.Select;
    import org.apache.ibatis.annotations.SelectProvider;
    import org.apache.ibatis.annotations.Update;
    import org.apache.ibatis.annotations.UpdateProvider;
    
    import cn.com.chinautrust.idm.bo.user.AdminVO;
    import cn.com.chinautrust.idm.repo.mybatis.base.IBaseMapper;
    import cn.com.chinautrust.idm.repo.mybatis.provider.AdminVOProvider;
    
    public interface IAdminMapper extends IBaseMapper<AdminVO>{
    
        @Options(useGeneratedKeys=true)
        @Insert("INSERT INTO ADMIN_INFO(adminName, adminLoginName, adminRole, deptName, pwd, lastTime, deptCodeLimit, deptCodeSkip) VALUES(#{adminName}, #{adminLoginName}, #{adminRole}, #{deptName}, #{pwd}, #{lastTime}, #{deptCodeLimit}, #{deptCodeSkip})")
        public int insert(AdminVO bean);
        
        @UpdateProvider(type = AdminVOProvider.class, method="update")
        public void update(AdminVO bean);
        
        @Delete("DELETE FROM ADMIN_INFO WHERE id = #{value}")
        public void delById(Integer id);
        
        @ResultType(AdminVO.class)
        @Select("SELECT id, adminName,adminLoginName,adminRole,deptName,pwd,lastTime,deptCodeLimit,deptCodeSkip  FROM ADMIN_INFO where id=#{value}")
        public AdminVO findOneById(Integer id);
        
        @ResultType(AdminVO.class)
        @SelectProvider(type = AdminVOProvider.class, method="findListByBean")
        public List<AdminVO> findListByBean(AdminVO bean);
        
        @Select("SELECT COUNT(*)  FROM ADMIN_INFO where ${value}")
        public long countBySql(String sql);
        
        @ResultType(AdminVO.class)
        @SelectProvider(type = AdminVOProvider.class, method="findListBySql")
        public List<AdminVO> findListBySql(String sql, String contextSql);
        
        @ResultType(AdminVO.class)
        @Select("SELECT id, adminName,adminLoginName,adminRole,deptName,pwd,lastTime,deptCodeLimit,deptCodeSkip  FROM ADMIN_INFO where deptName=#{value} ORDER BY lastTime DESC")
        List<AdminVO> getAllAdminDeptId(String deptName);
        
        @Delete("DELETE FROM ADMIN_INFO WHERE adminLoginName=#{value}")
        void delAdminByLoginName(String loginName);
        
        @Delete("DELETE FROM ADMIN_INFO WHERE deptName like #{value}")
        void delAdminByDeptDn(String deptDn);
        
        @ResultType(AdminVO.class)
        @Select("SELECT id, adminName,adminLoginName,adminRole,deptName,pwd,lastTime,deptCodeLimit,deptCodeSkip  FROM ADMIN_INFO where ${value}")
        List<AdminVO> find(String queryString);
        
        @Update("UPDATE ADMIN_INFO set PWD=#{pwd}, ADMINNAME=#{adminName}, ADMINROLE=#{adminRole}, LASTTIME=#{lastTime} where adminLoginName=#{adminLoginName}")
        void updateAdminByLoginName(AdminVO adminVo);
        
        @ResultType(AdminVO.class)
        @Select("SELECT id, adminName,adminLoginName,adminRole,deptName,pwd,lastTime,deptCodeLimit,deptCodeSkip  FROM ADMIN_INFO where adminLoginName=#{0} and pwd=#{1}")
        List<AdminVO> getAdminByLoginNameAndPwd(String loginName, String pwd);
        
        @ResultType(AdminVO.class)
        @Select("SELECT id, adminName,adminLoginName,adminRole,deptName,pwd,lastTime,deptCodeLimit,deptCodeSkip  FROM ADMIN_INFO where adminLoginName=#{value}")
        List<AdminVO> getAdminByLoginName(String loginName);
        
        @Update("UPDATE ADMIN_INFO set pwd=#{newpassword} where adminLoginName=#{loginName} and pwd=#{oldpassword}")
        int updatePersonPwd(@Param("loginName") String loginName, @Param("oldpassword") String oldpassword, @Param("newpassword") String newpassword);
        
        
    }
  • 相关阅读:
    HAProxy、Keepalived 在 Ocatvia 的应用实现与分析
    Octavia 的 HTTPS 与自建、签发 CA 证书
    Octavia 创建 loadbalancer 的实现与分析
    OpenStack Rally 质量评估与自动化测试利器
    自建 CA 中心并签发 CA 证书
    Failed building wheel for netifaces
    通过 vSphere WS API 获取 vCenter Datastore Provisioned Space 置备空间
    OpenStack Placement Project
    我们建了一个 Golang 硬核技术交流群(内含视频福利)
    没有图形界面的软件有什么用?
  • 原文地址:https://www.cnblogs.com/cuijinlong/p/9605595.html
Copyright © 2011-2022 走看看