DPersonLabelDao.java
1.93 KB
package com.viontech.keliu.dao;
import com.viontech.keliu.entity.PersonLabelContent;
import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
@Repository
public class DPersonLabelDao {
@Resource
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
private final static String INSERT_PERSON_LABEL_SQL = "INSERT INTO d_person_label (recognition_unid, account_id, mall_id, count_date, count_time, hair_style,hair_color,hat,hat_color,glasses,mask,earring,jacket_type, jacket_color, " +
"bottoms_type, bottoms_color,suit_type,suit_color,clothing_brand,necklace,watch,bracelet,phone,rucksack_type,rucksack_color,handbag_type,handbag_color,shopping_bag_type,shopping_bag_color,shoe_type,shoe_color) "
+ "VALUES (:recognitionUnid, :accountId, :mallId,:countDate,:countTime,:hairStyle,:hairColor,:hat,:hatColor,:glasses,:mask,:earring,:jacketType,:jacketColor,:bottomsType,:bottomsColor,:suitType,:suitColor,:clothingBrand,:necklace," +
":watch,:bracelet,:phone,:rucksackType,:rucksackColor,:handbagType,:handbagColor,:shoppingBagType,:shoppingBagColor,:shoeType,:shoeColor);";
public void insert(PersonLabelContent personLabel) {
SqlParameterSource parameterSource = new BeanPropertySqlParameterSource(personLabel);
namedParameterJdbcTemplate.update(INSERT_PERSON_LABEL_SQL, parameterSource);
}
public void batchInsert(List<PersonLabelContent> personLabels) {
SqlParameterSource[] batch = SqlParameterSourceUtils.createBatch(personLabels.toArray());
namedParameterJdbcTemplate.batchUpdate(INSERT_PERSON_LABEL_SQL, batch);
}
}