mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 02:08:43 +08:00 
			
		
		
		
	运费模板 review 修改. 运费模块可以选择多个区域
This commit is contained in:
		| @@ -113,10 +113,20 @@ public interface BaseMapperX<T> extends MPJBaseMapper<T> { | ||||
|         Db.saveBatch(entities, size); | ||||
|     } | ||||
|  | ||||
|     // @芋艿 是不是叫  updateByDo 或者  updateByEntity 更合适 | ||||
|     default void updateBatch(T update) { | ||||
|         update(update, new QueryWrapper<>()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 根据ID 批量更新,适合大量数据更新 | ||||
|      * | ||||
|      * @param entities 实体们 | ||||
|      */ | ||||
|     default void updateBatch(Collection<T> entities) { | ||||
|         Db.updateBatchById(entities); | ||||
|     } | ||||
|  | ||||
|     default void updateBatch(Collection<T> entities, int size) { | ||||
|         Db.updateBatchById(entities, size); | ||||
|     } | ||||
|   | ||||
| @@ -0,0 +1,56 @@ | ||||
| package cn.iocoder.yudao.framework.mybatis.core.type; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.iocoder.yudao.framework.common.util.string.StrUtils; | ||||
| import org.apache.ibatis.type.JdbcType; | ||||
| import org.apache.ibatis.type.MappedJdbcTypes; | ||||
| import org.apache.ibatis.type.MappedTypes; | ||||
| import org.apache.ibatis.type.TypeHandler; | ||||
|  | ||||
| import java.sql.CallableStatement; | ||||
| import java.sql.PreparedStatement; | ||||
| import java.sql.ResultSet; | ||||
| import java.sql.SQLException; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * List<Integer> 的类型转换器实现类,对应数据库的 varchar 类型 | ||||
|  * | ||||
|  * @author jason | ||||
|  */ | ||||
| @MappedJdbcTypes(JdbcType.VARCHAR) | ||||
| @MappedTypes(List.class) | ||||
| public class IntegerListTypeHandler implements TypeHandler<List<Integer>> { | ||||
|  | ||||
|     private static final String COMMA = ","; | ||||
|  | ||||
|     @Override | ||||
|     public void setParameter(PreparedStatement ps, int i, List<Integer> strings, JdbcType jdbcType) throws SQLException { | ||||
|         ps.setString(i, CollUtil.join(strings, COMMA)); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<Integer> getResult(ResultSet rs, String columnName) throws SQLException { | ||||
|         String value = rs.getString(columnName); | ||||
|         return getResult(value); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<Integer> getResult(ResultSet rs, int columnIndex) throws SQLException { | ||||
|         String value = rs.getString(columnIndex); | ||||
|         return getResult(value); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<Integer> getResult(CallableStatement cs, int columnIndex) throws SQLException { | ||||
|         String value = cs.getString(columnIndex); | ||||
|         return getResult(value); | ||||
|     } | ||||
|  | ||||
|     private List<Integer> getResult(String value) { | ||||
|         if (value == null) { | ||||
|             return null; | ||||
|         } | ||||
|         return StrUtils.splitToInteger(value, COMMA); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 jason
					jason