liujie
2023-08-15 434088b7d4ee12c1206cfb194da2b600f4815f94
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) {