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);
        
        
    }
  • 相关阅读:
    关于微信最新推出的应用号的看法
    HTML常见标签
    重读《从菜鸟到测试架构师》-- 模拟客户的访问行为(上)
    重读《从菜鸟到测试架构师》-- 大促带来的灾难
    重读《从菜鸟到测试架构师》-- 功能测试之百种变身
    重读《从菜鸟到测试架构师》-- 对黑盒子的全方位照明
    重读《从菜鸟到测试架构师》-- 如何把黑盒子分块
    重读《从菜鸟到测试架构师》-- 黑色的盒子里有什么(下)
    重读《从菜鸟到测试架构师》--黑色的盒子里有什么(中)
    重读《从菜鸟到测试架构师》-- 黑色的盒子里面有什么(上)
  • 原文地址:https://www.cnblogs.com/cuijinlong/p/9605595.html
Copyright © 2011-2022 走看看