liujie
2023-10-15 1707d15796d7dc78812f19b9c34868c8cb38a714
src/main/java/com/stylefeng/guns/modular/system/controller/DriverController.java
@@ -18,6 +18,7 @@
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;
@@ -97,6 +98,11 @@
    @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();
@@ -152,6 +158,13 @@
    @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) {