Commit 171642dc by zhiwj

品牌库

parent 3223a155
package com.gic.store.constant;
package com.gic.enterprise.constant;
/**
* @author zhiwj
* @date 2019/7/4
*/
public interface Constants {
String STORE_BATCH_IMPORT_MQ_KEY = "storeBulkImport";
// String STORE_BATCH_IMPORT_MQ_KEY = "tmpStoreBatchImportTaskMq4.0";
Integer STORE_BATCH_IMPORT_TASK_TYPE = 6;
String dateformat = "YYYY-MM-dd HH:mm:ss";
String BUSINESS_CATEGORY = "businessCategory";
}
package com.gic.enterprise.dto;
import java.io.Serializable;
/**
* tab_store_dict
*/
public class DictDTO implements Serializable {
private String value;
private String key;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ public class PlatformBrandDTO implements Serializable {
/**
* 经营类目
*/
private Integer platformBrandCategoryId;
private String platformBrandCategoryCode;
/**
* 经营类目名
......@@ -37,12 +37,12 @@ public class PlatformBrandDTO implements Serializable {
this.platformBrandId = platformBrandId;
}
public Integer getPlatformBrandCategoryId() {
return platformBrandCategoryId;
public String getPlatformBrandCategoryCode() {
return platformBrandCategoryCode;
}
public void setPlatformBrandCategoryId(Integer platformBrandCategoryId) {
this.platformBrandCategoryId = platformBrandCategoryId;
public void setPlatformBrandCategoryCode(String platformBrandCategoryCode) {
this.platformBrandCategoryCode = platformBrandCategoryCode;
}
public String getPlatformBrandCategoryName() {
......
package com.gic.enterprise.service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.dto.DictDTO;
import java.util.List;
public interface DictApiService {
ServiceResponse<List<DictDTO>> listBusinessCategory();
ServiceResponse<DictDTO> getDict(String categoryCode, String code);
}
......@@ -21,12 +21,12 @@ public interface PlatformBrandApiService {
* @Title: addBrandFromGic
* @Description:
* @author zhiwj
* @param categoryId
* @param categoryCode
* @param platformBrandName
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer> id
* @throws
*/
ServiceResponse<Integer> saveBrandFromGic(Integer categoryId, String platformBrandName);
ServiceResponse<Integer> saveBrandFromGic(String categoryCode, String platformBrandName);
/**
* 运维平台添加一个平台级品牌
* @Title: addBrandFromOperation
......@@ -70,7 +70,7 @@ public interface PlatformBrandApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer> 影响行数
* @throws
*/
ServiceResponse<Integer> addRef(Integer enterpriseId, Integer enterpriseBrandId, String enterpriseBrandName, String enterpriseBrandCode, Integer categoryId);
ServiceResponse<Integer> addRef(Integer enterpriseId, Integer enterpriseBrandId, String enterpriseBrandName, String enterpriseBrandCode, String categoryCode);
/**
* 删除一个关联关系
......@@ -88,7 +88,6 @@ public interface PlatformBrandApiService {
* @Title: delRef
* @Description: 删除一个关联关系
* @author zhiwj
* @param enterpriseBrandId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
......@@ -104,18 +103,18 @@ public interface PlatformBrandApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse<Integer> updateRef(Integer enterpriseId, Integer enterpriseBrandId, String enterpriseBrandName, String enterpriseBrandCode, Integer categoryId);
ServiceResponse<Integer> updateRef(Integer enterpriseId, Integer enterpriseBrandId, String enterpriseBrandName, String enterpriseBrandCode, String categoryCode);
/**
* 按品牌名去查询详情
* @Title: getByBrandName
* @Description:
* @author zhiwj
* @param enterpriseBrandName
* @param brandName
* @return com.gic.api.base.commons.ServiceResponse<com.gic.enterprise.dto.PlatformBrandDTO>
* @throws
*/
ServiceResponse<PlatformBrandDTO> getByBrandName(String enterpriseBrandName);
ServiceResponse<PlatformBrandDTO> getByBrandName(String brandName);
/**
* 查询平台品牌对应的商品品牌
......
......@@ -23,6 +23,7 @@
<gic-store-api>4.0-SNAPSHOT</gic-store-api>
<gic-redis-data>4.0-SNAPSHOT</gic-redis-data>
<gic-bizdict-api>4.0.0-SNAPSHOT</gic-bizdict-api>
<gic-bizdict-sdk>4.0.0-SNAPSHOT</gic-bizdict-sdk>
<gic-platform-enterprise-api>4.0-SNAPSHOT</gic-platform-enterprise-api>
</properties>
......@@ -104,6 +105,11 @@
<version>${gic-bizdict-api}</version>
</dependency>
<dependency>
<groupId>com.gic.bizdict</groupId>
<artifactId>gic-bizdict-sdk</artifactId>
<version>${gic-bizdict-sdk}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-enterprise-base-api</artifactId>
<version>${gic-enterprise-base-api}</version>
......
package com.gic.enterprise.config;
import com.gic.bizdict.sdk.service.anno.EnableRedisCacheBizdictService;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableRedisCacheBizdictService
public class RedisCacheBizdictServiceConfig {
}
......@@ -12,9 +12,9 @@ public class TabPlatformBrand {
private Integer platformBrandId;
/**
* 经营类目
* 经营类目code
*/
private Integer platformBrandCategoryId;
private String platformBrandCategoryCode;
/**
* 经营类目名
......@@ -54,12 +54,12 @@ public class TabPlatformBrand {
this.platformBrandId = platformBrandId;
}
public Integer getPlatformBrandCategoryId() {
return platformBrandCategoryId;
public String getPlatformBrandCategoryCode() {
return platformBrandCategoryCode;
}
public void setPlatformBrandCategoryId(Integer platformBrandCategoryId) {
this.platformBrandCategoryId = platformBrandCategoryId;
public void setPlatformBrandCategoryCode(String platformBrandCategoryCode) {
this.platformBrandCategoryCode = platformBrandCategoryCode;
}
public String getPlatformBrandCategoryName() {
......
......@@ -18,7 +18,7 @@ public interface PlatformBrandRefService {
Integer delRef(Integer enterpriseId, List<Integer> enterpriseBrandIds);
Page<TabPlatformBrandRef> listByPlatformBrandRef(String brandName);
Page<TabPlatformBrandRef> listByPlatformBrandRef(Integer platformBrandId);
Integer updateRef(Integer fromBrandId, Integer toBrandId);
}
......@@ -63,9 +63,9 @@ public class PlatformBrandRefServiceImpl implements PlatformBrandRefService {
}
@Override
public Page<TabPlatformBrandRef> listByPlatformBrandRef(String brandName) {
public Page<TabPlatformBrandRef> listByPlatformBrandRef(Integer platformBrandId) {
TabPlatformBrandRef brandRef = new TabPlatformBrandRef();
brandRef.setEnterpriseBrandName(brandName);
brandRef.setPlatformBrandId(platformBrandId);
return tabPlatformBrandRefMapper.listByPlatformBrandRef(brandRef);
}
......
......@@ -26,7 +26,7 @@ public class PlatformBrandServiceImpl implements PlatformBrandService {
@Override
public Integer save(PlatformBrandDTO platformBrandDTO) {
TabPlatformBrand tabPlatformBrand = new TabPlatformBrand();
tabPlatformBrand.setPlatformBrandCategoryId(platformBrandDTO.getPlatformBrandCategoryId());
tabPlatformBrand.setPlatformBrandCategoryCode(platformBrandDTO.getPlatformBrandCategoryCode());
tabPlatformBrand.setPlatformBrandCategoryName(platformBrandDTO.getPlatformBrandCategoryName());
tabPlatformBrand.setPlatformBrandName(platformBrandDTO.getPlatformBrandName());
tabPlatformBrand.setCreateType(platformBrandDTO.getCreateType());
......@@ -39,7 +39,7 @@ public class PlatformBrandServiceImpl implements PlatformBrandService {
@Override
public Integer update(PlatformBrandDTO platformBrandDTO) {
TabPlatformBrand tabPlatformBrand = new TabPlatformBrand();
tabPlatformBrand.setPlatformBrandCategoryId(platformBrandDTO.getPlatformBrandCategoryId());
tabPlatformBrand.setPlatformBrandCategoryCode(platformBrandDTO.getPlatformBrandCategoryCode());
tabPlatformBrand.setPlatformBrandCategoryName(platformBrandDTO.getPlatformBrandCategoryName());
tabPlatformBrand.setPlatformBrandName(platformBrandDTO.getPlatformBrandName());
return tabPlatformBrandMapper.updateByPrimaryKeySelective(tabPlatformBrand);
......
package com.gic.enterprise.service.outer;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.bizdict.api.dto.BizdictDTO;
import com.gic.bizdict.sdk.service.impl.RedisCacheBizdictService;
import com.gic.enterprise.constant.Constants;
import com.gic.enterprise.dto.DictDTO;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.service.DictApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
@Service("dictApiService")
public class DictApiServiceImpl implements DictApiService {
@Autowired
private RedisCacheBizdictService bizdictService;
@Override
public ServiceResponse<List<DictDTO>> listBusinessCategory() {
List<BizdictDTO> bizDictList = bizdictService.treeByCategoryCode(Constants.BUSINESS_CATEGORY);
List<DictDTO> list = bizDictList.stream().map(e -> {
DictDTO dictDTO = new DictDTO();
dictDTO.setKey(e.getName());
dictDTO.setValue(e.getCode());
return dictDTO;
}).collect(Collectors.toList());
return ServiceResponse.success(list);
}
@Override
public ServiceResponse<DictDTO> getDict(String categoryCode, String code) {
BizdictDTO bizdictDTO = bizdictService.getByCode(categoryCode, code);
if (bizdictDTO != null) {
DictDTO dictDTO = new DictDTO();
dictDTO.setKey(bizdictDTO.getName());
dictDTO.setValue(bizdictDTO.getCode());
return ServiceResponse.success(dictDTO);
} else {
return ServiceResponse.failure(ErrorCode.NOTEXISTS.getCode(), ErrorCode.NOTEXISTS.getMsg());
}
}
}
package com.gic.enterprise.service.outer;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.enterprise.constant.BrandCreateTypeEnum;
import com.gic.enterprise.constant.Constants;
import com.gic.enterprise.dto.DictDTO;
import com.gic.enterprise.dto.PlatformBrandDTO;
import com.gic.enterprise.dto.PlatformBrandRefDTO;
import com.gic.enterprise.entity.TabPlatformBrand;
import com.gic.enterprise.entity.TabPlatformBrandRef;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.service.DictApiService;
import com.gic.enterprise.service.PlatformBrandApiService;
import com.gic.enterprise.service.PlatformBrandRefService;
import com.gic.enterprise.service.PlatformBrandService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -26,14 +32,18 @@ import java.util.stream.Collectors;
@Service("platformBrandApiService")
public class PlatformBrandApiServiceImpl implements PlatformBrandApiService {
Logger logger = LogManager.getLogger(PlatformBrandApiServiceImpl.class);
@Autowired
private PlatformBrandService platformBrandService;
@Autowired
private PlatformBrandRefService platformBrandRefService;
@Autowired
private DictApiService dictApiService;
@Override
public ServiceResponse<Integer> saveBrandFromGic(Integer categoryId, String platformBrandName) {
if (StringUtils.isBlank(platformBrandName) || categoryId == null) {
public ServiceResponse<Integer> saveBrandFromGic(String categoryCode, String platformBrandName) {
if (StringUtils.isBlank(platformBrandName) || StringUtils.isBlank(categoryCode)) {
return ServiceResponse.failure(ErrorCode.MISS_PARAMETER.getCode(), ErrorCode.MISS_PARAMETER.getMsg());
}
TabPlatformBrand platformBrand = platformBrandService.getByBrandName(platformBrandName);
......@@ -42,9 +52,12 @@ public class PlatformBrandApiServiceImpl implements PlatformBrandApiService {
return ServiceResponse.success(platformBrand.getPlatformBrandId());
}
PlatformBrandDTO platformBrandDTO = new PlatformBrandDTO();
platformBrandDTO.setPlatformBrandCategoryId(categoryId);
// todo
// platformBrandDTO.setPlatformBrandCategoryName();
platformBrandDTO.setPlatformBrandCategoryCode(categoryCode);
ServiceResponse<DictDTO> dictService = dictApiService.getDict(Constants.BUSINESS_CATEGORY, platformBrandDTO.getPlatformBrandCategoryCode());
if (!dictService.isSuccess()) {
return ServiceResponse.failure(dictService.getCode(), dictService.getMessage());
}
platformBrandDTO.setPlatformBrandCategoryName(dictService.getResult().getKey());
platformBrandDTO.setCreateType(BrandCreateTypeEnum.GIC.getCode());
platformBrandDTO.setPlatformBrandName(platformBrandName);
Integer id = platformBrandService.save(platformBrandDTO);
......@@ -53,20 +66,23 @@ public class PlatformBrandApiServiceImpl implements PlatformBrandApiService {
@Override
public ServiceResponse<Integer> saveOrUpdateBrandFromOperation(PlatformBrandDTO platformBrandDTO) {
if (StringUtils.isBlank(platformBrandDTO.getPlatformBrandName()) || platformBrandDTO.getPlatformBrandCategoryId() == null) {
if (StringUtils.isBlank(platformBrandDTO.getPlatformBrandName()) || StringUtils.isBlank(platformBrandDTO.getPlatformBrandCategoryCode())) {
return ServiceResponse.failure(ErrorCode.MISS_PARAMETER.getCode(), ErrorCode.MISS_PARAMETER.getMsg());
}
TabPlatformBrand platformBrand = platformBrandService.getByBrandName(platformBrandDTO.getPlatformBrandName());
// 如果平台品牌已存在, 直接返回; 这里先判断后执行,可能会出现并发问题,出问题了再加锁
if (platformBrand != null) {
return ServiceResponse.success(platformBrand.getPlatformBrandId());
return ServiceResponse.failure(ErrorCode.DATA_EXISTS.getCode(), platformBrand.getPlatformBrandId().toString());
}
// todo
// platformBrandDTO.setPlatformBrandCategoryName();
ServiceResponse<DictDTO> dictService = dictApiService.getDict(Constants.BUSINESS_CATEGORY, platformBrandDTO.getPlatformBrandCategoryCode());
if (!dictService.isSuccess()) {
return ServiceResponse.failure(dictService.getCode(), dictService.getMessage());
}
platformBrandDTO.setPlatformBrandCategoryName(dictService.getResult().getKey());
if (platformBrandDTO.getPlatformBrandId() == null) {
// 新增
Integer id = platformBrandService.save(platformBrandDTO);
platformBrandDTO.setCreateType(BrandCreateTypeEnum.PLATFORM.getCode());
Integer id = platformBrandService.save(platformBrandDTO);
platformBrandDTO.setPlatformBrandId(id);
} else {
// 编辑
......@@ -105,12 +121,12 @@ public class PlatformBrandApiServiceImpl implements PlatformBrandApiService {
}
@Override
public ServiceResponse<Integer> addRef(Integer enterpriseId, Integer enterpriseBrandId, String enterpriseBrandName, String enterpriseBrandCode, Integer categoryId) {
public ServiceResponse<Integer> addRef(Integer enterpriseId, Integer enterpriseBrandId, String enterpriseBrandName, String enterpriseBrandCode, String categoryCode) {
// 先判断后执行 可能并发
TabPlatformBrand platformBrand = platformBrandService.getByBrandName(enterpriseBrandName);
Integer platformBrandId;
if (platformBrand == null) {
ServiceResponse<Integer> serviceResponse = this.saveBrandFromGic(categoryId, enterpriseBrandName);
ServiceResponse<Integer> serviceResponse = this.saveBrandFromGic(categoryCode, enterpriseBrandName);
if (serviceResponse.isSuccess()) {
platformBrandId = serviceResponse.getResult();
} else {
......@@ -126,38 +142,42 @@ public class PlatformBrandApiServiceImpl implements PlatformBrandApiService {
platformBrandRefDTO.setEnterpriseBrandName(enterpriseBrandName);
platformBrandRefDTO.setEnterpriseBrandCode(enterpriseBrandCode);
Integer platformBrandRefId = platformBrandRefService.save(platformBrandRefDTO);
logger.info("添加关联:{}", JSON.toJSONString(platformBrandRefDTO));
return ServiceResponse.success(platformBrandRefId);
}
@Override
public ServiceResponse<Integer> delRef(Integer enterpriseId, Integer enterpriseBrandId) {
Integer line = platformBrandRefService.delRef(enterpriseId, enterpriseBrandId);
logger.info("删除关联:[enterpriseId:{}, enterpriseBrandId:{}]", enterpriseId, enterpriseBrandId);
return ServiceResponse.success(line);
}
@Override
public ServiceResponse<Integer> delRef(Integer enterpriseId, List<Integer> enterpriseBrandIds) {
Integer line = platformBrandRefService.delRef(enterpriseId, enterpriseBrandIds);
logger.info("删除关联:[enterpriseId:{}, enterpriseBrandId:{}]", enterpriseId, enterpriseBrandIds);
return ServiceResponse.success(line);
}
@Override
public ServiceResponse<Integer> updateRef(Integer enterpriseId, Integer enterpriseBrandId, String enterpriseBrandName, String enterpriseBrandCode, Integer categoryId) {
public ServiceResponse<Integer> updateRef(Integer enterpriseId, Integer enterpriseBrandId, String enterpriseBrandName, String enterpriseBrandCode, String categoryCode) {
// 先删除原来的
platformBrandRefService.delRef(enterpriseId, enterpriseBrandId);
return this.addRef(enterpriseId, enterpriseBrandId, enterpriseBrandName, enterpriseBrandCode, categoryId);
return this.addRef(enterpriseId, enterpriseBrandId, enterpriseBrandName, enterpriseBrandCode, categoryCode);
}
@Override
public ServiceResponse<PlatformBrandDTO> getByBrandName(String enterpriseBrandName) {
TabPlatformBrand platformBrand = this.platformBrandService.getByBrandName(enterpriseBrandName);
public ServiceResponse<PlatformBrandDTO> getByBrandName(String brandName) {
TabPlatformBrand platformBrand = this.platformBrandService.getByBrandName(brandName);
return ServiceResponse.success(EntityUtil.changeEntityByOrika(PlatformBrandDTO.class, platformBrand));
}
@Override
public ServiceResponse<Page<PlatformBrandRefDTO>> listByPlatformBrandRef(String brandName, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize);
com.github.pagehelper.Page<TabPlatformBrandRef> brandRefPage = this.platformBrandRefService.listByPlatformBrandRef(brandName);
TabPlatformBrand brand = this.platformBrandService.getByBrandName(brandName);
com.github.pagehelper.Page<TabPlatformBrandRef> brandRefPage = this.platformBrandRefService.listByPlatformBrandRef(brand == null ? null : brand.getPlatformBrandId());
Page<PlatformBrandRefDTO> page = PageHelperUtils.changePageHelperToCurrentPage(brandRefPage, PlatformBrandRefDTO.class);
return ServiceResponse.success(page);
}
......
......@@ -26,4 +26,7 @@
<dubbo:reference interface="com.gic.auth.service.UserApiService" id="userApiService" timeout="60000" />
<!--品牌库-->
<dubbo:service interface="com.gic.enterprise.service.PlatformBrandApiService" ref="platformBrandApiService" timeout="60000" />
<!-- 字典 -->
<dubbo:reference interface="com.gic.bizdict.api.service.BizdictService" id="bizdictService" timeout="60000" />
<dubbo:service interface="com.gic.enterprise.service.DictApiService" ref="dictApiService" timeout="60000" />
</beans>
......@@ -3,7 +3,7 @@
<mapper namespace="com.gic.enterprise.dao.mapper.TabPlatformBrandMapper">
<resultMap id="BaseResultMap" type="com.gic.enterprise.entity.TabPlatformBrand">
<id column="platform_brand_id" jdbcType="INTEGER" property="platformBrandId" />
<result column="platform_brand_category_id" jdbcType="INTEGER" property="platformBrandCategoryId" />
<result column="platform_brand_category_code" jdbcType="VARCHAR" property="platformBrandCategoryCode" />
<result column="platform_brand_category_name" jdbcType="VARCHAR" property="platformBrandCategoryName" />
<result column="platform_brand_name" jdbcType="VARCHAR" property="platformBrandName" />
<result column="create_type" jdbcType="INTEGER" property="createType" />
......@@ -12,7 +12,7 @@
<result column="status" jdbcType="INTEGER" property="status" />
</resultMap>
<sql id="Base_Column_List">
platform_brand_id, platform_brand_category_id, platform_brand_category_name, platform_brand_name,
platform_brand_id, platform_brand_category_code, platform_brand_category_name, platform_brand_name,
create_type, create_time, update_time, status
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
......@@ -26,26 +26,23 @@
where platform_brand_id = #{platformBrandId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.enterprise.entity.TabPlatformBrand">
insert into tab_platform_brand (platform_brand_id, platform_brand_category_id,
insert into tab_platform_brand (platform_brand_id, platform_brand_category_code,
platform_brand_category_name, platform_brand_name,
create_type, create_time, update_time,
status)
values (#{platformBrandId,jdbcType=INTEGER}, #{platformBrandCategoryId,jdbcType=INTEGER},
values (#{platformBrandId,jdbcType=INTEGER}, #{platformBrandCategoryCode,jdbcType=VARCHAR},
#{platformBrandCategoryName,jdbcType=VARCHAR}, #{platformBrandName,jdbcType=VARCHAR},
#{createType,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{status,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabPlatformBrand">
<selectKey keyProperty="platformBrandId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into tab_platform_brand
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="platformBrandId != null">
platform_brand_id,
</if>
<if test="platformBrandCategoryId != null">
platform_brand_category_id,
<if test="platformBrandCategoryCode != null">
platform_brand_category_code,
</if>
<if test="platformBrandCategoryName != null">
platform_brand_category_name,
......@@ -70,8 +67,8 @@
<if test="platformBrandId != null">
#{platformBrandId,jdbcType=INTEGER},
</if>
<if test="platformBrandCategoryId != null">
#{platformBrandCategoryId,jdbcType=INTEGER},
<if test="platformBrandCategoryCode != null">
#{platformBrandCategoryCode,jdbcType=VARCHAR},
</if>
<if test="platformBrandCategoryName != null">
#{platformBrandCategoryName,jdbcType=VARCHAR},
......@@ -96,8 +93,8 @@
<update id="updateByPrimaryKeySelective" parameterType="com.gic.enterprise.entity.TabPlatformBrand">
update tab_platform_brand
<set>
<if test="platformBrandCategoryId != null">
platform_brand_category_id = #{platformBrandCategoryId,jdbcType=INTEGER},
<if test="platformBrandCategoryCode != null">
platform_brand_category_code = #{platformBrandCategoryCode,jdbcType=VARCHAR},
</if>
<if test="platformBrandCategoryName != null">
platform_brand_category_name = #{platformBrandCategoryName,jdbcType=VARCHAR},
......@@ -122,7 +119,7 @@
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.enterprise.entity.TabPlatformBrand">
update tab_platform_brand
set platform_brand_category_id = #{platformBrandCategoryId,jdbcType=INTEGER},
set platform_brand_category_code = #{platformBrandCategoryCode,jdbcType=VARCHAR},
platform_brand_category_name = #{platformBrandCategoryName,jdbcType=VARCHAR},
platform_brand_name = #{platformBrandName,jdbcType=VARCHAR},
create_type = #{createType,jdbcType=INTEGER},
......@@ -147,10 +144,10 @@
and create_type = #{createType}
</if>
<if test="platformBrandName != null and platformBrandName != '' ">
and platform_brand_name = #{platformBrandName}
and platform_brand_name like concat('%', #{platformBrandName} ,'%')
</if>
<if test="platformBrandCategoryId != null ">
and platform_brand_category_id = #{platformBrandCategoryId}
<if test="platformBrandCategoryCode != null ">
and platform_brand_category_code = #{platformBrandCategoryCode}
</if>
order by update_time desc
</select>
......
......@@ -166,9 +166,6 @@
<if test="platformBrandId != null ">
and platform_brand_id = #{platformBrandId}
</if>
<if test="brandName != null and brandName != '' ">
and brand_name = #{brandName}
</if>
</select>
<update id="delRefs">
update tab_platform_brand_ref set status = 0 where enterprise_id = #{enterpriseId} and status = 1
......
package com.gic.operation.web.controller;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.dto.DictDTO;
import com.gic.enterprise.service.DictApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class DictController {
@Autowired
private DictApiService dictApiService;
@RequestMapping("/list-all-businesscategory")
public RestResponse listAllBusinessCategory() {
ServiceResponse<List<DictDTO>> serviceResponse = dictApiService.listBusinessCategory();
if (serviceResponse.isSuccess()) {
return RestResponse.success(serviceResponse.getResult());
} else {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
}
}
......@@ -30,7 +30,7 @@ public class PlatformBrandController {
public RestResponse saveBrand(@Validated({ PlatformBrandQO.SavePlatformBrandValid.class }) PlatformBrandQO platformBrandQO) {
PlatformBrandDTO platformBrandDTO = new PlatformBrandDTO();
platformBrandDTO.setPlatformBrandName(platformBrandQO.getPlatformBrandName());
platformBrandDTO.setPlatformBrandCategoryId(platformBrandQO.getPlatformBrandCategoryId());
platformBrandDTO.setPlatformBrandCategoryCode(platformBrandQO.getPlatformBrandCategoryCode());
ServiceResponse<Integer> serviceResponse = platformBrandApiService.saveOrUpdateBrandFromOperation(platformBrandDTO);
if (serviceResponse.isSuccess()) {
return RestResponse.success(serviceResponse.getResult());
......@@ -40,7 +40,7 @@ public class PlatformBrandController {
}
@RequestMapping("/brand-del")
public RestResponse delBrand(@Validated({ PlatformBrandQO.SavePlatformBrandValid.class }) PlatformBrandQO platformBrandQO) {
public RestResponse delBrand(@Validated({ PlatformBrandQO.DelPlatformBrandValid.class }) PlatformBrandQO platformBrandQO) {
ServiceResponse<Integer> serviceResponse = platformBrandApiService.delBrandById(platformBrandQO.getPlatformBrandId());
if (serviceResponse.isSuccess()) {
return RestResponse.success(serviceResponse.getResult());
......
......@@ -15,7 +15,7 @@ public class PlatformBrandQO implements Serializable {
@NotNull(message = "品牌名不能为空", groups = {SavePlatformBrandValid.class})
private String platformBrandName;
@NotNull(message = "经营类目不能为空", groups = {SavePlatformBrandValid.class})
private Integer platformBrandCategoryId;
private String platformBrandCategoryCode;
private Integer createType;
......@@ -35,12 +35,12 @@ public class PlatformBrandQO implements Serializable {
this.platformBrandName = platformBrandName;
}
public Integer getPlatformBrandCategoryId() {
return platformBrandCategoryId;
public String getPlatformBrandCategoryCode() {
return platformBrandCategoryCode;
}
public void setPlatformBrandCategoryId(Integer platformBrandCategoryId) {
this.platformBrandCategoryId = platformBrandCategoryId;
public void setPlatformBrandCategoryCode(String platformBrandCategoryCode) {
this.platformBrandCategoryCode = platformBrandCategoryCode;
}
public Integer getCreateType() {
......
......@@ -45,4 +45,6 @@
<dubbo:reference interface="com.gic.enterprise.service.TransferAccountsApprovalApiService" id="transferAccountsApprovalApiService" timeout="60000" />
<!-- 平台品牌库 -->
<dubbo:reference interface="com.gic.enterprise.service.PlatformBrandApiService" id="platformBrandApiService" timeout="60000" />
<!--字典 -->
<dubbo:reference interface="com.gic.enterprise.service.DictApiService" id="dictApiService" timeout="60000" />
</beans>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment