| | |
| | | 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; |
| | |
| | | EntityWrapper<TDriver> wrapper = new EntityWrapper<>(); |
| | | Page<TDriver> tDriverPage = new Page<>(pageNumber, pageSize); |
| | | wrapper.eq("remove", 0); |
| | | wrapper.eq("is_carriers",1); |
| | | wrapper.eq("company_id",id); |
| | | if (ToolUtil.isNotEmpty(name)) { |
| | | wrapper.like("driver_name", name).or().like("account", name); |
| | |
| | | @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) { |