From af8762599559a13eec6c5dd9dc6ec431b0ba389c Mon Sep 17 00:00:00 2001 From: x_z Date: Wed, 11 Jan 2023 17:30:27 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=A1=A5=E5=85=85=E8=A1=A5=E5=8D=95=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../glxp/api/dao/basic/BasicBusTypePreDao.java | 10 ++++++++++ .../basic/impl/BasicBusTypePreServiceImpl.java | 18 +++++++++++++----- .../mapper/basic/BasicBusTypePreDao.xml | 12 +++++++++--- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/glxp/api/dao/basic/BasicBusTypePreDao.java b/src/main/java/com/glxp/api/dao/basic/BasicBusTypePreDao.java index 527b6f18..c2be79fa 100644 --- a/src/main/java/com/glxp/api/dao/basic/BasicBusTypePreDao.java +++ b/src/main/java/com/glxp/api/dao/basic/BasicBusTypePreDao.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.glxp.api.entity.basic.BasicBusTypePreEntity; import com.glxp.api.req.basic.FilterBusTypeChangeRequest; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -14,4 +15,13 @@ import java.util.List; public interface BasicBusTypePreDao extends BaseMapper { List selectList(FilterBusTypeChangeRequest busTypeChangeFilterRequest); + + /** + * 根据单据类型删除 + * + * @param action + * @return + */ + boolean deleteByAction(@Param("action") String action); + } \ No newline at end of file diff --git a/src/main/java/com/glxp/api/service/basic/impl/BasicBusTypePreServiceImpl.java b/src/main/java/com/glxp/api/service/basic/impl/BasicBusTypePreServiceImpl.java index 4867a06c..d2f3f5bd 100644 --- a/src/main/java/com/glxp/api/service/basic/impl/BasicBusTypePreServiceImpl.java +++ b/src/main/java/com/glxp/api/service/basic/impl/BasicBusTypePreServiceImpl.java @@ -34,22 +34,24 @@ public class BasicBusTypePreServiceImpl implements IBasicBusTypePreService { @Override public boolean deleteById(String id) { - return false; + return basicBusTypePreDao.deleteById(id) != 0; } @Override public boolean deleteByAction(String action) { - return false; + return basicBusTypePreDao.deleteByAction(action); } @Override public boolean updateBusChangeType(BasicBusTypePreEntity basicBusTypePreEntity) { - return false; + setUpdateInfo(basicBusTypePreEntity); + return basicBusTypePreDao.updateById(basicBusTypePreEntity) != 0; } @Override public boolean insertBusChangeType(BasicBusTypePreEntity basicBusTypePreEntity) { - return false; + setUpdateInfo(basicBusTypePreEntity); + return basicBusTypePreDao.insert(basicBusTypePreEntity) != 0; } /** @@ -59,6 +61,12 @@ public class BasicBusTypePreServiceImpl implements IBasicBusTypePreService { */ private void setUpdateInfo(BasicBusTypePreEntity basicBusTypePreEntity) { Date now = new Date(); - + String userId = customerService.getUserIdStr(); + if (null == basicBusTypePreEntity.getId()) { + basicBusTypePreEntity.setCreateUser(userId); + basicBusTypePreEntity.setCreateTime(now); + } + basicBusTypePreEntity.setUpdateUser(userId); + basicBusTypePreEntity.setUpdateTime(now); } } diff --git a/src/main/resources/mybatis/mapper/basic/BasicBusTypePreDao.xml b/src/main/resources/mybatis/mapper/basic/BasicBusTypePreDao.xml index a58a8356..98ccfce0 100644 --- a/src/main/resources/mybatis/mapper/basic/BasicBusTypePreDao.xml +++ b/src/main/resources/mybatis/mapper/basic/BasicBusTypePreDao.xml @@ -1,8 +1,14 @@ - - + select * + from basic_bustype_pre + + + delete + from basic_bustype_pre + where action = #{action} + \ No newline at end of file