/** * 保存(新增、更新)用户信息 * * @param user * @return */ public boolean saveUser(User user) { boolean saveFlag = false; String updSql = null; if (isExist(user.getUserName())) { // 更新用户信息 updSql = "UPDATE SYJK_CCS_USER SET PASSWORD = '******', MENUJSON = '" + user.getMenujson() + "' WHERE USERNAME= '******'"; } else { // 新增用户 String userId = String.valueOf(Integer.parseInt(es.getOneValue("select max(id) from syjk_ccs_user")) + 1); updSql = "INSERT INTO SYJK_CCS_USER (ID,USERNAME, PASSWORD, MENUJSON) VALUES ('" + userId + "','" + user.getUserName() + "','" + user.getPassWord() + "','" + user.getMenujson() + "') "; } if (null != updSql) { saveFlag = es.execUpdateSQL(updSql); } return saveFlag; }
public List<User> getUserList() { List<User> userList = new ArrayList(); SSRS ssrs = es.execSQL("SELECT ID, USERNAME, PASSWORD, MENUJSON FROM SYJK_CCS_USER "); if (ssrs.MaxRow > 0) { for (int i = 0; i < ssrs.MaxRow; i++) { User user = new User(); user.setId(Integer.parseInt(ssrs.GetText(i + 1, 1))); user.setUserName(ssrs.GetText(i + 1, 2)); user.setPassWord(ssrs.GetText(i + 1, 3)); user.setMenujson(ssrs.GetText(i + 1, 4)); userList.add(user); } } return userList; }
/** * 用户名是否存在 * * @param username * @return */ public boolean isExist(String username) { SSRS ssrs = es.execSQL("SELECT 1 FROM SYJK_CCS_USER WHERE USERNAME = '******'"); return ssrs.getMaxRow() > 0; }
public boolean destroyUser(String userid) { boolean delFlag = false; String delSql = "DELETE FROM SYJK_CCS_USER WHERE ID = '" + userid + "'"; delFlag = es.execUpdateSQL(delSql); return delFlag; }
// 保存纳税信息请求出参信息 public boolean savePayRes(SYJK_CCS_CCSNSXXCXCC ccsnsxxcxcc) { String resSql = taxPayQueryServiceSql.getTaxPayQueryResSql(ccsnsxxcxcc); boolean flag = exeSql.execUpdateSQL(resSql); return flag; }