-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yulongsun007
committed
Dec 25, 2016
1 parent
bc24e36
commit 03ec869
Showing
9 changed files
with
190 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/java/win/yulongsun/talents/controller/UserPlanRController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package win.yulongsun.talents.controller; | ||
|
||
import win.yulongsun.talents.common.BaseController; | ||
import win.yulongsun.talents.common.Response; | ||
import win.yulongsun.talents.model.UserPlanR; | ||
import win.yulongsun.talents.util.ValidateUtils; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by sunyulong on 2016/12/25. | ||
*/ | ||
public class UserPlanRController extends BaseController { | ||
public void add() { | ||
Integer user_id = getParaToInt("user_id"); | ||
Integer plan_id = getParaToInt("plan_id"); | ||
Integer apply_status = getParaToInt("apply_status"); | ||
boolean isNull = ValidateUtils.validatePara(user_id, plan_id, apply_status); | ||
if (isNull) { | ||
renderError(Response.MSG.REQ_IS_NULL); | ||
} | ||
List<UserPlanR> learnedPlanList = UserPlanR.dao.find("select * from t_user_plan_r where user_id = ? and plan_id = ?", user_id, plan_id); | ||
if (learnedPlanList.size() > 0) { | ||
renderError("您已添加了此培养计划,无需重复添加"); | ||
return; | ||
} | ||
UserPlanR planR = new UserPlanR(); | ||
planR.setUserId(user_id); | ||
planR.setPlanId(plan_id); | ||
planR.setApplyStatus(apply_status); | ||
boolean save = planR.save(); | ||
if (save) { | ||
renderSuccess(); | ||
} else { | ||
renderError(Response.MSG.ADD_ERROR); | ||
} | ||
|
||
} | ||
|
||
public void list() { | ||
|
||
} | ||
|
||
public void update() { | ||
|
||
} | ||
|
||
public void delete() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package win.yulongsun.talents.util; | ||
|
||
import java.net.InetAddress; | ||
import java.net.UnknownHostException; | ||
|
||
/** | ||
* Created by sunyulong on 2016/12/25. | ||
*/ | ||
public class IPUtils { | ||
|
||
public static String getIp() { | ||
try { | ||
return String.valueOf(InetAddress.getLocalHost().getHostAddress()); | ||
} catch (UnknownHostException e) { | ||
e.printStackTrace(); | ||
} | ||
return null; | ||
} | ||
|
||
public static String getUploadPath() { | ||
return "http://" + getIp() + ":8081/talents/upload/"; | ||
} | ||
|
||
public static void main(String agrs[]) { | ||
System.out.printf(getIp()); | ||
} | ||
} |