zoukankan      html  css  js  c++  java
  • 静态方法

    package cn.com.chinautrust.idm.repo.mybatis.provider;
    
    import org.springframework.util.StringUtils;
    
    import cn.com.chinautrust.idm.bo.user.AdminVO;
    
    public class AdminVOProvider {
        
        public static String findListBySql(final String sql, final String contextSql){
            return new IbatisSQL(){{
                SELECT("id, adminName, adminLoginName, adminRole, deptName, pwd, lastTime, deptCodeLimit, deptCodeSkip");
                FROM("ADMIN_INFO");
                if(StringUtils.hasText(sql)){
                    WHERE(sql);
                }
            }}.toString(contextSql);
        }
        
        public static String update(final AdminVO bean){
            return new IbatisSQL(){{
                UPDATE("ADMIN_INFO");
                if(StringUtils.hasText(bean.getAdminName())){
                    SET("adminName = #{adminName}");
                }
                if(StringUtils.hasText(bean.getAdminLoginName())){
                    SET("adminLoginName = #{adminLoginName}");
                }
                if(StringUtils.hasText(bean.getAdminRole())){
                    SET("adminRole = #{adminRole}");
                }
                if(StringUtils.hasText(bean.getDeptName())){
                    SET("deptName = #{deptName}");
                }
                if(StringUtils.hasText(bean.getPwd())){
                    SET("pwd = #{pwd}");
                }
                if(StringUtils.hasText(bean.getLastTime())){
                    SET("lastTime = #{lastTime}");
                }
                if(bean.getDeptCodeLimit() != null){
                    SET("deptCodeLimit = #{deptCodeLimit}");
                }
                if(bean.getDeptCodeSkip() != null){
                    SET("deptCodeSkip = #{deptCodeSkip}");
                }
                WHERE("ID = #{id}");
              }}.toString();
        }
        
        public static String findListByBean(final AdminVO bean){
            return new IbatisSQL(){{
                SELECT("id, adminName, adminLoginName, adminRole, deptName, pwd, lastTime, deptCodeLimit, deptCodeSkip");
                FROM("ADMIN_INFO");
                if(bean.getId() > 0){
                    WHERE("id = #{id}");
                }
                if(StringUtils.hasText(bean.getAdminName())){
                    WHERE("adminName = #{adminName}");
                }
                if(StringUtils.hasText(bean.getAdminLoginName())){
                    WHERE("adminLoginName = #{adminLoginName}");
                }
                if(StringUtils.hasText(bean.getAdminRole())){
                    WHERE("adminRole = #{adminRole}");
                }
                if(StringUtils.hasText(bean.getDeptName())){
                    WHERE("deptName = #{deptName}");
                }
                if(StringUtils.hasText(bean.getPwd())){
                    WHERE("pwd = #{pwd}");
                }
                if(StringUtils.hasText(bean.getLastTime())){
                    WHERE("lastTime = #{lastTime}");
                }
                if(bean.getDeptCodeLimit() != null){
                    WHERE("deptCodeLimit = #{deptCodeLimit}");
                }
                if(bean.getDeptCodeSkip() != null){
                    WHERE("deptCodeSkip = #{deptCodeSkip}");
                }
            }}.toString();
        }
    }
  • 相关阅读:
    gym-102307 D. Do Not Try This Problem
    AtCoder Beginner Contest 161 E
    Codeforces 1270E 构造+数学
    2019牛客暑期多校训练营(第七场)E 线段树+离散化区间
    codeforces 1272F dp+记录路径
    Focus相关点滴
    Command模式
    接口隔离原则(ISP)
    依赖倒置原则(DIP)
    Liskov替换原则(LSP)
  • 原文地址:https://www.cnblogs.com/cuijinlong/p/9605600.html
Copyright © 2011-2022 走看看