cy
2023-11-02 396ebb5642636d6667212939fa6ef195eeebc05e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.consum.base.service;
 
import com.walker.jdbc.service.BaseServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.List;
import java.util.Map;
 
/**
 * @ClassName LWhGoodsRecordDetailsService
 * @Author cy
 * @Date 2023/10/31
 * @Description
 * @Version 1.0
 **/
@Service
public class LWhGoodsRecordDetailsService extends BaseServiceImpl {
    private final JdbcTemplate jdbcTemplate;
    private SimpleJdbcCall simpleJdbcCall;
 
    @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("WH_GOODS_RECORD_ID", whGoodsRecordId)
                .addValue("THIS_TYPE", thisType);
        Map<String, Object> out = simpleJdbcCall.execute(in);
        System.out.println("Procedure result: " + out);
    }
 
}