futian.liu
2023-12-05 ceecebe477faf5a45b19f3b258f7add8f93b4583
consum-base/src/main/java/com/consum/base/service/LWhGoodsRecordDetailsService.java
@@ -3,18 +3,19 @@
import com.walker.jdbc.service.BaseServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.jdbc.core.simple.SimpleJdbcCall;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.List;
import java.util.Map;
/**
 * @ClassName LWhGoodsRecordDetailsService
 * @Author cy
 * @Date 2023/10/31
 * @Description
 * @Version 1.0
@@ -24,15 +25,25 @@
    private final JdbcTemplate jdbcTemplate;
    private SimpleJdbcCall simpleJdbcCall;
    @Value("${spring.datasource.dataBaseName}")
    private String dataBaseName;
    @PostConstruct
    public void init() {
        this.simpleJdbcCall = new SimpleJdbcCall(jdbcTemplate)
                .withCatalogName(dataBaseName)
                .withProcedureName("insert_WH_GOODS_RECORD_DETAILS");
    }
    @Autowired
    public LWhGoodsRecordDetailsService(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
        this.simpleJdbcCall = new SimpleJdbcCall(jdbcTemplate).withProcedureName("insert_WH_GOODS_RECORD_DETAILS");
    }
    public void sameGoodsInsertMore(List<Long> outGoodsId, long whGoodsRecordId, short thisType) {
        SqlParameterSource in = new MapSqlParameterSource()
                .addValue("WHGOODSIDList", StringUtils.join(outGoodsId))
                .addValue("WHGOODSIDList", StringUtils.join(outGoodsId, ","))
                .addValue("WH_GOODS_RECORD_ID", whGoodsRecordId)
                .addValue("THIS_TYPE", thisType);
        Map<String, Object> out = simpleJdbcCall.execute(in);