File was renamed from consum-base/src/main/java/com/consum/base/service/LWhWarningConfigServiceImpl.java |
| | |
| | | package com.consum.base.service; |
| | | package com.consum.base.service.impl; |
| | | |
| | | import com.consum.base.service.LWhWarningConfigService; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.pojo.query.WhWarningConfigQry; |
| | |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @ClassName LWhWarningConfigServiceImpl |
| | |
| | | * @Version 1.0 |
| | | **/ |
| | | @Service |
| | | public class LWhWarningConfigServiceImpl extends BaseServiceImpl { |
| | | private static String GET_CONFIG_LIST_WITH_PAGE = "SELECT wareConf.*,ware.AGENCY_NAME,ware.WAREHOUSE_NAME,goodsTemp.CATEGORY_NAME,CONCAT(cate.CLASSIFICATION,'类') cost_Type,goodsTemp.GOODS_NAME,baseModel.MODEL_NAME FROM WH_WARNING_CONFIG wareConf LEFT JOIN BASE_GOODS_MODELS baseModel ON baseModel.ID=wareConf.BASE_GOODS_MODELS_ID LEFT JOIN BASE_GOODS_TEMPLATE goodsTemp ON wareConf.BASE_GOODS_TEMPLATE_ID=goodsTemp.id LEFT JOIN BASE_CATEGORY cate ON cate.id=goodsTemp.CATEGORY_ID LEFT JOIN BASE_WAREHOUSE ware ON ware.id=wareConf.BASE_WAREHOUSE_ID WHERE 1=1 "; |
| | | public class LWhWarningConfigServiceImpl extends BaseServiceImpl implements LWhWarningConfigService { |
| | | private static String GET_CONFIG_LIST_WITH_PAGE = |
| | | "SELECT wareConf.*,ware.AGENCY_NAME,ware.WAREHOUSE_NAME,goodsTemp.CATEGORY_NAME,CONCAT(cate.CLASSIFICATION,'类') cost_Type,goodsTemp.GOODS_NAME,baseModel.MODEL_NAME FROM WH_WARNING_CONFIG wareConf LEFT JOIN BASE_GOODS_MODELS baseModel ON baseModel.ID=wareConf.BASE_GOODS_MODELS_ID LEFT JOIN BASE_GOODS_TEMPLATE goodsTemp ON wareConf.BASE_GOODS_TEMPLATE_ID=goodsTemp.id LEFT JOIN BASE_CATEGORY cate ON cate.id=goodsTemp.CATEGORY_ID LEFT JOIN BASE_WAREHOUSE ware ON ware.id=wareConf.BASE_WAREHOUSE_ID WHERE 1=1 "; |
| | | |
| | | @Override |
| | | public GenericPager<Map<String, Object>> getConfigListWithPage(WhWarningConfigQry param) { |
| | | Map<String, Object> configListQueryMap = getConfigListQueryMap(param); |
| | | StringBuilder sql = (StringBuilder) configListQueryMap.get("sql"); |
| | | HashMap<String, Object> paramts = (HashMap<String, Object>) configListQueryMap.get("paramts"); |
| | | StringBuilder sql = (StringBuilder)configListQueryMap.get("sql"); |
| | | HashMap<String, Object> paramts = (HashMap<String, Object>)configListQueryMap.get("paramts"); |
| | | return selectSplit(sql.toString(), paramts, param.getPageNum(), param.getPageSize(), new MapperUtil()); |
| | | } |
| | | |
| | | |
| | | private Map<String, Object> getConfigListQueryMap(WhWarningConfigQry param) { |
| | | @Override |
| | | public Map<String, Object> getConfigListQueryMap(WhWarningConfigQry param) { |
| | | Map<String, Object> configListQueryMap = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder(GET_CONFIG_LIST_WITH_PAGE); |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | //机构 |
| | | // 机构 |
| | | if (param.getAgencyId() != null) { |
| | | // sql.append(" and left(ware.AGENCY_ID, length(:lengthAgencyId)) = :agencyId"); |
| | | // sql.append(" and left(ware.AGENCY_ID, length(:lengthAgencyId)) = :agencyId"); |
| | | sql.append(" and ware.AGENCY_ID = :agencyId"); |
| | | // paramts.put("lengthAgencyId", param.getAgencyId()); |
| | | // paramts.put("lengthAgencyId", param.getAgencyId()); |
| | | paramts.put("agencyId", param.getAgencyId()); |
| | | } |
| | | //仓库类型 |
| | | // 仓库类型 |
| | | if (param.getWarehouseType() != null) { |
| | | sql.append(" AND wareConf.WAREHOUSE_TYPE = :warehouseType"); |
| | | paramts.put("warehouseType", param.getWarehouseType()); |
| | |
| | | sql.append(" AND wareConf.BASE_WAREHOUSE_ID = :warehouseId"); |
| | | paramts.put("warehouseId", param.getBaseWarehouseId()); |
| | | } |
| | | //物品名称 |
| | | // 物品名称 |
| | | if (StringUtils.isNotEmpty(param.getGoodsTemplateName())) { |
| | | sql.append(" AND goodsTemp.GOODS_NAME like :goodsTemplateName"); |
| | | paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | paramts.put("goodsTemplateName", |
| | | StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | if (param.getBaseGoodsTemplateId() != null) { |
| | | sql.append(" AND wareConf.BASE_GOODS_TEMPLATE_ID=:baseGoodsTemplateId"); |
| | | paramts.put("baseGoodsTemplateId", param.getBaseGoodsTemplateId()); |
| | | } |
| | | //分类 |
| | | // 分类 |
| | | if (param.getCategoryId() != null) { |
| | | sql.append(" AND cate.id=:categoryId"); |
| | | paramts.put("categoryId", param.getCategoryId()); |
| | | } |
| | | //价值类型 |
| | | // 价值类型 |
| | | if (param.getCostType() != null) { |
| | | // 将数字转换为对应的字符 |
| | | char costType = (char) ('A' + param.getCostType() - 1); |
| | | char costType = (char)('A' + param.getCostType() - 1); |
| | | sql.append(" AND cate.CLASSIFICATION=:costType"); |
| | | paramts.put("costType", costType); |
| | | } |
| | |
| | | return configListQueryMap; |
| | | } |
| | | |
| | | private String QUERY_MODEL_IS_EXIST = ""; |
| | | |
| | | public List<Map<String, Object>> queryModelIsExist(Integer warehouseType, Long baseWarehouseId, List<Long> modelIds) { |
| | | StringBuilder sql = new StringBuilder("select WAREHOUSE_TYPE, BASE_WAREHOUSE_ID, BASE_GOODS_MODELS_ID from WH_WARNING_CONFIG where 1=1"); |
| | | @Override |
| | | public List<Map<String, Object>> queryModelIsExist(Integer warehouseType, Long baseWarehouseId, |
| | | List<Long> modelIds) { |
| | | StringBuilder sql = new StringBuilder( |
| | | "select WAREHOUSE_TYPE, BASE_WAREHOUSE_ID, BASE_GOODS_MODELS_ID from WH_WARNING_CONFIG where 1=1"); |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | |
| | | //仓库类型 |
| | | // 仓库类型 |
| | | if (warehouseType != null) { |
| | | sql.append(" AND WAREHOUSE_TYPE = :warehouseType"); |
| | | paramts.put("warehouseType", warehouseType); |
| | |
| | | } |
| | | return select(sql.toString(), paramts, new MapperUtil()); |
| | | } |
| | | |
| | | |
| | | } |