| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang.time.DateUtils; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.apache.poi.ss.usermodel.Cell; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | |
| | | @ResponseBody |
| | | public Object driverAdd(@RequestBody TDriver driver) { |
| | | try { |
| | | List<TDriver> tDrivers = driverService.selectList(new EntityWrapper<TDriver>().eq("account", driver.getAccount())); |
| | | if(tDrivers.size()>0){ |
| | | return new ErrorTip(500, "Account already exists"); |
| | | } |
| | | driver.setPassword(SecureUtil.md5(driver.getPassword())); |
| | | driver.setCreateTime(new Date()); |
| | | driverService.insert(driver); |
| | | return new SuccessTip(); |
| | |
| | | @ResponseBody |
| | | public Object driverUpdate(@RequestBody TDriver driver) { |
| | | try { |
| | | List<TDriver> tDrivers = driverService.selectList(new EntityWrapper<TDriver>().eq("account", driver.getAccount()).ne("id",driver.getId())); |
| | | if(tDrivers.size()>0){ |
| | | return new ErrorTip(500, "Account already exists"); |
| | | } |
| | | if(driver.getPassword()!=null){ |
| | | driver.setPassword(SecureUtil.md5(driver.getPassword())); |
| | | } |
| | | driverService.updateById(driver); |
| | | return new SuccessTip(); |
| | | } catch (Exception e) { |