Commit 3e193bb6 by zhiwj

品牌库接口

parent 211bc290
......@@ -5,6 +5,8 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.dto.PlatformBrandDTO;
import com.gic.enterprise.dto.PlatformBrandRefDTO;
import java.util.List;
/**
* 平台品牌
* @ClassName: PlatformBrandApiService
......@@ -80,7 +82,18 @@ public interface PlatformBrandApiService {
* @throws
*/
ServiceResponse<Integer> delRef(Integer enterpriseId, Integer enterpriseBrandId);
/**
* 删除一个关联关系
* @Title: delRef
* @Description: 删除一个关联关系
* @author zhiwj
* @param enterpriseBrandId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse<Integer> delRef(Integer enterpriseId, List<Integer> enterpriseBrandIds);
/**
* 更新一个关联关系
* @Title: updateRef
......
......@@ -62,6 +62,8 @@ public interface TabPlatformBrandRefMapper {
Integer delRef(@Param("enterpriseId") Integer enterpriseId, @Param("enterpriseBrandId") Integer enterpriseBrandId);
Integer delRefs(@Param("enterpriseId") Integer enterpriseId, @Param("ids") List<Integer> enterpriseBrandIds);
Page<TabPlatformBrandRef> listByPlatformBrandRef(TabPlatformBrandRef brandRef);
Integer updateRef(@Param("fromBrandId") Integer fromBrandId,@Param("toBrandId") Integer toBrandId);
......
......@@ -16,6 +16,8 @@ public interface PlatformBrandRefService {
Integer delRef(Integer enterpriseId, Integer enterpriseBrandId);
Integer delRef(Integer enterpriseId, List<Integer> enterpriseBrandIds);
Page<TabPlatformBrandRef> listByPlatformBrandRef(String brandName);
Integer updateRef(Integer fromBrandId, Integer toBrandId);
......
......@@ -58,6 +58,11 @@ public class PlatformBrandRefServiceImpl implements PlatformBrandRefService {
}
@Override
public Integer delRef(Integer enterpriseId, List<Integer> enterpriseBrandIds) {
return tabPlatformBrandRefMapper.delRefs(enterpriseId, enterpriseBrandIds);
}
@Override
public Page<TabPlatformBrandRef> listByPlatformBrandRef(String brandName) {
TabPlatformBrandRef brandRef = new TabPlatformBrandRef();
brandRef.setEnterpriseBrandName(brandName);
......
......@@ -136,6 +136,12 @@ public class PlatformBrandApiServiceImpl implements PlatformBrandApiService {
}
@Override
public ServiceResponse<Integer> delRef(Integer enterpriseId, List<Integer> enterpriseBrandIds) {
Integer line = platformBrandRefService.delRef(enterpriseId, enterpriseBrandIds);
return ServiceResponse.success(line);
}
@Override
public ServiceResponse<Integer> updateRef(Integer enterpriseId, Integer enterpriseBrandId, String enterpriseBrandName, String enterpriseBrandCode, Integer categoryId) {
// 先删除原来的
platformBrandRefService.delRef(enterpriseId, enterpriseBrandId);
......
......@@ -155,9 +155,9 @@
</foreach>
</if>
</select>
<select id="delRef" resultType="java.lang.Integer">
<update id="delRef">
update tab_platform_brand_ref set status = 0 where enterprise_id = #{enterpriseId} and enterprise_brand_id = #{enterpriseBrandId}
</select>
</update>
<select id="listByPlatformBrandRef" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
......@@ -170,7 +170,16 @@
and brand_name = #{brandName}
</if>
</select>
<select id="updateRef" resultType="java.lang.Integer">
<update id="delRefs">
update tab_platform_brand_ref set status = 0 where enterprise_id = #{enterpriseId} and status = 1
<if test="null != ids">
and enterprise_brand_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</update>
<update id="updateRef">
update tab_platform_brand_ref set platform_brand_id = #{toBrandId} where status = 1 and platform_brand_id = #{fromBrandId}
</select>
</update>
</mapper>
......@@ -6,9 +6,11 @@ import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.dto.PlatformBrandDTO;
import com.gic.enterprise.dto.PlatformBrandRefDTO;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.service.PlatformBrandApiService;
import com.gic.operation.web.qo.PageQO;
import com.gic.operation.web.qo.PlatformBrandQO;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -66,5 +68,18 @@ public class PlatformBrandController {
}
}
@RequestMapping("/brand-merge")
public RestResponse mergeBrand(Integer fromBrandId, String toBrandName) {
if (fromBrandId == null || StringUtils.isBlank(toBrandName)) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), ErrorCode.PARAMETER_ERROR.getMsg());
}
ServiceResponse<Integer> serviceResponse = platformBrandApiService.mergeBrandRef(fromBrandId, toBrandName);
if (serviceResponse.isSuccess()) {
return RestResponse.success(serviceResponse.getResult());
} else {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
}
}
......@@ -43,5 +43,6 @@
<dubbo:reference interface="com.gic.enterprise.service.EnterpriseInitApiService" id="enterpriseInitApiService" timeout="60000" />
<!--转账审批-->
<dubbo:reference interface="com.gic.enterprise.service.TransferAccountsApprovalApiService" id="transferAccountsApprovalApiService" timeout="60000" />
<!-- 平台品牌库 -->
<dubbo:reference interface="com.gic.enterprise.service.PlatformBrandApiService" id="platformBrandApiService" 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