⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 searchactionservice.java

📁 一个管理系统 用java作的
💻 JAVA
字号:
/*
 *  僔僗僥儉丂丂丗 嶳廏HR僔僗僥儉奐敪
 *  僒僽僔僗僥儉丗 WEB僔僗僥儉
 *
 *   VER    丂曄峏擔     丂晹壽      扴摉幰  丂曄峏撪梕
 *  -----------------------------------------------------------------
 *  V1.00 丂丂${date} (ShanXiu丂Soft)  Tuwenjie   弶斉
 *
 *       (C) Copyright SHANXIU CORPORATION 2006
 *                     All Rights Reserved.
 *
 */

package net.shanxiu.HR.service;

import net.shanxiu.HR.dao.SearchDao;
import net.shanxiu.HR.vo.ResultVo;
import net.shanxiu.HR.entity.CommonMethod;
import net.shanxiu.HR.actionform.SearchActionForm;

/**
 * SearchActionService
 */
public class SearchActionService {
    
    public ResultVo search(String strSql) throws Exception{
        
        SearchDao searchDao = new SearchDao();
        ResultVo resultVo   = searchDao.search(strSql);
        
        return resultVo;
    }
    
    //search proper SQL language's condition
    public String logic(SearchActionForm searchActionForm) {
        
        String strSql = new String("WHERE ");
        
        String str_id = searchActionForm.getId();
        if (str_id != null && !str_id.equals(""))
            strSql = strSql + "id LIKE'" + str_id + "%' AND " ;
        String str_name = searchActionForm.getName();
        if (str_name != null && !str_name.equals("")) {
            
            str_name = CommonMethod.ChangeChar(str_name);
            strSql   = strSql + "name LIKE'" + str_name + "%' AND ";
        }
        if (searchActionForm.getDep_name() != null && !searchActionForm.getDep_name().equals(""))
            strSql = strSql + "dep_ID = " +"'" + searchActionForm.getDep_name() +"'" + " AND ";
        if (searchActionForm.getB_year() != null && !searchActionForm.getB_year().equals(""))
            strSql = strSql + "in_time BETWEEN "
            	   +"'"
                   + searchActionForm.getB_year()
                   +"-"
                   + searchActionForm.getB_month()
                   +"-"
                   + searchActionForm.getB_day() 
                   +"'"
                   + " AND "
                   +"'"
                   + searchActionForm.getE_year()
                   +"-"
                   + searchActionForm.getE_month()
                   +"-"
                   + searchActionForm.getE_day()
        		   +"'";
        
        else if (!strSql.equals("WHERE "))
            
            	  strSql = strSql.substring(0,strSql.length()-4);
        	  else
        	    
        	      strSql = new String("");
        
        strSql = strSql + " ORDER BY id";
        
	return strSql;
	
    }
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -