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