Commit 823fc2cc by guojuxing

Merge remote-tracking branch 'origin/developer' into developer

parents 9227463d d01bcaba
package com.gic.enterprise.constant;
public enum BrandCreateTypeEnum {
PLATFORM(1, "运维平台"),
GIC(2, "商户后台");
private Integer code;
private String msg;
BrandCreateTypeEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
......@@ -27,6 +27,8 @@ public class PlatformBrandDTO implements Serializable {
*/
private Integer createType;
private Integer enterprisebrandCount;
public Integer getPlatformBrandId() {
return platformBrandId;
}
......@@ -66,4 +68,12 @@ public class PlatformBrandDTO implements Serializable {
public void setCreateType(Integer createType) {
this.createType = createType;
}
public Integer getEnterprisebrandCount() {
return enterprisebrandCount;
}
public void setEnterprisebrandCount(Integer enterprisebrandCount) {
this.enterprisebrandCount = enterprisebrandCount;
}
}
......@@ -7,12 +7,12 @@ import com.gic.enterprise.dto.PlatformBrandRefDTO;
/**
* 平台品牌
* @ClassName: PlatfromBrandApiService
* @ClassName: PlatformBrandApiService
* @Description: 平台品牌
* @author zhiwj
* @date 2019/8/5 16:26
*/
public interface PlatfromBrandApiService {
public interface PlatformBrandApiService {
/**
* gic添加一个平台级品牌
......@@ -30,12 +30,11 @@ public interface PlatfromBrandApiService {
* @Title: addBrandFromOperation
* @Description:
* @author zhiwj
* @param categoryId
* @param platformBrandName
* @param platformBrandDTO
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer> id
* @throws
*/
ServiceResponse<Integer> saveOrUpdateBrandFromOperation(Integer categoryId, String platformBrandName);
ServiceResponse<Integer> saveOrUpdateBrandFromOperation(PlatformBrandDTO platformBrandDTO);
/**
* 根据id删除
......@@ -49,7 +48,7 @@ public interface PlatfromBrandApiService {
ServiceResponse<Integer> delBrandById(Integer platformBrandId);
/**
* 查询品牌list, 条件为:名称:platformBrandCategoryId 类目:platformBrandName 来源:createType
* 查询品牌list, 条件为:名称:platformBrandName 类目:platformBrandCategoryId 来源:createType
* @Title: listPlatformBrand
* @Description:
* @author zhiwj
......@@ -69,19 +68,18 @@ public interface PlatfromBrandApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer> 影响行数
* @throws
*/
ServiceResponse<Integer> addRef(String enterpriseBrandName, String enterpriseBrandCode);
ServiceResponse<Integer> addRef(Integer enterpriseId, Integer enterpriseBrandId, String enterpriseBrandName, String enterpriseBrandCode, Integer categoryId);
/**
* 删除一个关联关系
* @Title: delRef
* @Description: 删除一个关联关系
* @author zhiwj
* @param enterpriseBrandName
* @param enterpriseBrandCode
* @param enterpriseBrandId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse<Integer> delRef(String enterpriseBrandName, String enterpriseBrandCode);
ServiceResponse<Integer> delRef(Integer enterpriseId, Integer enterpriseBrandId);
/**
* 更新一个关联关系
......@@ -93,7 +91,7 @@ public interface PlatfromBrandApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse<Integer> updateRef(String enterpriseBrandName, String enterpriseBrandCode);
ServiceResponse<Integer> updateRef(Integer enterpriseId, Integer enterpriseBrandId, String enterpriseBrandName, String enterpriseBrandCode, Integer categoryId);
/**
* 按品牌名去查询详情
......
package com.gic.enterprise.dao.mapper;
import com.gic.enterprise.dto.PlatformBrandDTO;
import com.gic.enterprise.entity.TabPlatformBrand;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
public interface TabPlatformBrandMapper {
/**
......@@ -50,4 +53,8 @@ public interface TabPlatformBrandMapper {
* @return 更新条目数
*/
int updateByPrimaryKey(TabPlatformBrand record);
TabPlatformBrand getByBrandName(@Param("platformBrandName") String platformBrandName);
Page<TabPlatformBrand> listPlatformBrand(PlatformBrandDTO platformBrandDTO);
}
\ No newline at end of file
package com.gic.enterprise.dao.mapper;
import com.gic.enterprise.entity.TabPlatformBrandRef;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface TabPlatformBrandRefMapper {
/**
......@@ -50,4 +55,12 @@ public interface TabPlatformBrandRefMapper {
* @return 更新条目数
*/
int updateByPrimaryKey(TabPlatformBrandRef record);
Integer countByPlatformBrandId(@Param("platformBrandId") Integer platformBrandId);
List<Map<String,Integer>> countByPlatformBrandIds(@Param("ids") List<Integer> platformBrandIdList);
Integer delRef(@Param("enterpriseId") Integer enterpriseId, @Param("enterpriseBrandId") Integer enterpriseBrandId);
Page<TabPlatformBrandRef> listByPlatformBrandRef(@Param("brandName") String brandName);
}
\ No newline at end of file
package com.gic.enterprise.service;
import com.gic.enterprise.dto.PlatformBrandRefDTO;
import com.gic.enterprise.entity.TabPlatformBrandRef;
import com.github.pagehelper.Page;
import java.util.List;
import java.util.Map;
public interface PlatformBrandRefService {
Integer countByPlatformBrandId(Integer platformBrandId);
Map<Integer,Integer> countByPlatformBrandIds(List<Integer> platformBrandIdList);
Integer save(PlatformBrandRefDTO platformBrandRefDTO);
Integer delRef(Integer enterpriseId, Integer enterpriseBrandId);
Page<TabPlatformBrandRef> listByPlatformBrandRef(String brandName);
}
package com.gic.enterprise.service;
import com.gic.enterprise.dto.PlatformBrandDTO;
import com.gic.enterprise.entity.TabPlatformBrand;
import com.github.pagehelper.Page;
public interface PlatformBrandService {
TabPlatformBrand getByBrandName(String platformBrandName);
Integer save(PlatformBrandDTO platformBrandDTO);
Integer update(PlatformBrandDTO platformBrandDTO);
Integer delBrandById(Integer platformBrandId);
Page<TabPlatformBrand> listPlatformBrand(PlatformBrandDTO platformBrandDTO, Integer pageNum, Integer pageSize);
}
package com.gic.enterprise.service.impl;
import com.gic.commons.util.GlobalInfo;
import com.gic.enterprise.dao.mapper.TabPlatformBrandRefMapper;
import com.gic.enterprise.dto.PlatformBrandRefDTO;
import com.gic.enterprise.entity.TabPlatformBrandRef;
import com.gic.enterprise.service.PlatformBrandRefService;
import com.github.pagehelper.Page;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
public class PlatformBrandRefServiceImpl implements PlatformBrandRefService {
@Autowired
private TabPlatformBrandRefMapper tabPlatformBrandRefMapper;
@Override
public Integer countByPlatformBrandId(Integer platformBrandId) {
return tabPlatformBrandRefMapper.countByPlatformBrandId(platformBrandId);
}
@Override
public Map<Integer, Integer> countByPlatformBrandIds(List<Integer> platformBrandIdList) {
if (CollectionUtils.isNotEmpty(platformBrandIdList)) {
//
Map<Integer, Integer> map = new HashMap<>();
List<Map<String, Integer>> list = tabPlatformBrandRefMapper.countByPlatformBrandIds(platformBrandIdList);
for (Map<String, Integer> integerIntegerMap : list) {
map.put(integerIntegerMap.get("platformBrandId"), integerIntegerMap.get("brandCount"));
}
return map;
} else {
return Collections.emptyMap();
}
}
@Override
public Integer save(PlatformBrandRefDTO platformBrandRefDTO) {
TabPlatformBrandRef platformBrandRef = new TabPlatformBrandRef();
platformBrandRef.setPlatformBrandId(platformBrandRefDTO.getPlatformBrandId());
platformBrandRef.setEnterpriseId(platformBrandRefDTO.getEnterpriseId());
platformBrandRef.setEnterpriseBrandId(platformBrandRefDTO.getEnterpriseBrandId());
platformBrandRef.setEnterpriseBrandName(platformBrandRefDTO.getEnterpriseBrandName());
platformBrandRef.setEnterpriseBrandCode(platformBrandRefDTO.getEnterpriseBrandCode());
platformBrandRef.setCreateTime(new Date());
platformBrandRef.setStatus(GlobalInfo.DATA_STATUS_NORMAL);
tabPlatformBrandRefMapper.insertSelective(platformBrandRef);
return platformBrandRef.getPlatformBrandId();
}
@Override
public Integer delRef(Integer enterpriseId, Integer enterpriseBrandId) {
return tabPlatformBrandRefMapper.delRef(enterpriseId, enterpriseBrandId);
}
@Override
public Page<TabPlatformBrandRef> listByPlatformBrandRef(String brandName) {
return tabPlatformBrandRefMapper.listByPlatformBrandRef(brandName);
}
}
package com.gic.enterprise.service.impl;
import com.gic.commons.util.GlobalInfo;
import com.gic.enterprise.dao.mapper.TabPlatformBrandMapper;
import com.gic.enterprise.dto.PlatformBrandDTO;
import com.gic.enterprise.entity.TabPlatformBrand;
import com.gic.enterprise.service.PlatformBrandService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
public class PlatformBrandServiceImpl implements PlatformBrandService {
@Autowired
private TabPlatformBrandMapper tabPlatformBrandMapper;
@Override
public TabPlatformBrand getByBrandName(String platformBrandName) {
return tabPlatformBrandMapper.getByBrandName(platformBrandName);
}
@Override
public Integer save(PlatformBrandDTO platformBrandDTO) {
TabPlatformBrand tabPlatformBrand = new TabPlatformBrand();
tabPlatformBrand.setPlatformBrandCategoryId(platformBrandDTO.getPlatformBrandCategoryId());
tabPlatformBrand.setPlatformBrandCategoryName(platformBrandDTO.getPlatformBrandCategoryName());
tabPlatformBrand.setPlatformBrandName(platformBrandDTO.getPlatformBrandName());
tabPlatformBrand.setCreateType(platformBrandDTO.getCreateType());
tabPlatformBrand.setCreateTime(new Date());
tabPlatformBrand.setStatus(GlobalInfo.DATA_STATUS_NORMAL);
tabPlatformBrandMapper.insertSelective(tabPlatformBrand);
return tabPlatformBrand.getPlatformBrandId();
}
@Override
public Integer update(PlatformBrandDTO platformBrandDTO) {
TabPlatformBrand tabPlatformBrand = new TabPlatformBrand();
tabPlatformBrand.setPlatformBrandCategoryId(platformBrandDTO.getPlatformBrandCategoryId());
tabPlatformBrand.setPlatformBrandCategoryName(platformBrandDTO.getPlatformBrandCategoryName());
tabPlatformBrand.setPlatformBrandName(platformBrandDTO.getPlatformBrandName());
return tabPlatformBrandMapper.updateByPrimaryKeySelective(tabPlatformBrand);
}
@Override
public Integer delBrandById(Integer platformBrandId) {
TabPlatformBrand tabPlatformBrand = new TabPlatformBrand();
tabPlatformBrand.setPlatformBrandId(platformBrandId);
tabPlatformBrand.setStatus(GlobalInfo.DATA_STATUS_DELETE);
return tabPlatformBrandMapper.updateByPrimaryKeySelective(tabPlatformBrand);
}
@Override
public Page<TabPlatformBrand> listPlatformBrand(PlatformBrandDTO platformBrandDTO, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize);
return tabPlatformBrandMapper.listPlatformBrand(platformBrandDTO);
}
}
package com.gic.enterprise.service.outer;
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.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.PlatformBrandApiService;
import com.gic.enterprise.service.PlatformBrandRefService;
import com.gic.enterprise.service.PlatformBrandService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service("platformBrandApiService")
public class PlatformBrandApiServiceImpl implements PlatformBrandApiService {
@Autowired
private PlatformBrandService platformBrandService;
@Autowired
private PlatformBrandRefService platformBrandRefService;
@Override
public ServiceResponse<Integer> saveBrandFromGic(Integer categoryId, String platformBrandName) {
if (StringUtils.isBlank(platformBrandName) || categoryId == null) {
return ServiceResponse.failure(ErrorCode.MISS_PARAMETER.getCode(), ErrorCode.MISS_PARAMETER.getMsg());
}
TabPlatformBrand platformBrand = platformBrandService.getByBrandName(platformBrandName);
// 如果平台品牌已存在, 直接返回; 这里先判断后执行,可能会出现并发问题,出问题了再加锁
if (platformBrand != null) {
return ServiceResponse.success(platformBrand.getPlatformBrandId());
}
PlatformBrandDTO platformBrandDTO = new PlatformBrandDTO();
platformBrandDTO.setPlatformBrandCategoryId(categoryId);
// todo
// platformBrandDTO.setPlatformBrandCategoryName();
platformBrandDTO.setCreateType(BrandCreateTypeEnum.GIC.getCode());
platformBrandDTO.setPlatformBrandName(platformBrandName);
Integer id = platformBrandService.save(platformBrandDTO);
return ServiceResponse.success(id);
}
@Override
public ServiceResponse<Integer> saveOrUpdateBrandFromOperation(PlatformBrandDTO platformBrandDTO) {
if (StringUtils.isBlank(platformBrandDTO.getPlatformBrandName()) || platformBrandDTO.getPlatformBrandCategoryId() == null) {
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());
}
// todo
// platformBrandDTO.setPlatformBrandCategoryName();
if (platformBrandDTO.getPlatformBrandId() == null) {
// 新增
Integer id = platformBrandService.save(platformBrandDTO);
platformBrandDTO.setCreateType(BrandCreateTypeEnum.PLATFORM.getCode());
platformBrandDTO.setPlatformBrandId(id);
} else {
// 编辑
platformBrandService.update(platformBrandDTO);
}
return ServiceResponse.success(platformBrandDTO.getPlatformBrandId());
}
@Override
public ServiceResponse<Integer> delBrandById(Integer platformBrandId) {
Integer count = platformBrandRefService.countByPlatformBrandId(platformBrandId);
if (count > 0) {
return ServiceResponse.failure(ErrorCode.OPERATION_FAILED.getCode(), "该品牌下有关联的商户品牌,当前不允许删除!");
}
Integer line = platformBrandService.delBrandById(platformBrandId);
if (line > 0) {
return ServiceResponse.success(line);
} else {
return ServiceResponse.failure(ErrorCode.NOTEXISTS.getCode(), ErrorCode.NOTEXISTS.getMsg());
}
}
@Override
public ServiceResponse<Page<PlatformBrandDTO>> listPlatformBrand(PlatformBrandDTO platformBrandDTO, Integer pageNum, Integer pageSize) {
com.github.pagehelper.Page<TabPlatformBrand> storeBrandList = platformBrandService.listPlatformBrand(platformBrandDTO, pageNum, pageSize);
Page<PlatformBrandDTO> page = PageHelperUtils.changePageHelperToCurrentPage(storeBrandList, PlatformBrandDTO.class);
if (CollectionUtils.isNotEmpty(storeBrandList)) {
List<PlatformBrandDTO> platformBrandDTOList = page.getResult();
List<Integer> platformBrandIdList = platformBrandDTOList.stream().map(PlatformBrandDTO::getPlatformBrandId).collect(Collectors.toList());
Map<Integer, Integer> map = platformBrandRefService.countByPlatformBrandIds(platformBrandIdList);
for (PlatformBrandDTO brandDTO : platformBrandDTOList) {
brandDTO.setEnterprisebrandCount(map.get(brandDTO.getPlatformBrandId()));
}
}
return ServiceResponse.success(page);
}
@Override
public ServiceResponse<Integer> addRef(Integer enterpriseId, Integer enterpriseBrandId, String enterpriseBrandName, String enterpriseBrandCode, Integer categoryId) {
// 先判断后执行 可能并发
TabPlatformBrand platformBrand = platformBrandService.getByBrandName(enterpriseBrandName);
Integer platformBrandId;
if (platformBrand == null) {
ServiceResponse<Integer> serviceResponse = this.saveBrandFromGic(categoryId, enterpriseBrandName);
if (serviceResponse.isSuccess()) {
platformBrandId = serviceResponse.getResult();
} else {
return serviceResponse;
}
} else {
platformBrandId = platformBrand.getPlatformBrandId();
}
PlatformBrandRefDTO platformBrandRefDTO = new PlatformBrandRefDTO();
platformBrandRefDTO.setPlatformBrandId(platformBrandId);
platformBrandRefDTO.setEnterpriseId(enterpriseId);
platformBrandRefDTO.setEnterpriseBrandId(enterpriseBrandId);
platformBrandRefDTO.setEnterpriseBrandName(enterpriseBrandName);
platformBrandRefDTO.setEnterpriseBrandCode(enterpriseBrandCode);
Integer platformBrandRefId = platformBrandRefService.save(platformBrandRefDTO);
return ServiceResponse.success(platformBrandRefId);
}
@Override
public ServiceResponse<Integer> delRef(Integer enterpriseId, Integer enterpriseBrandId) {
Integer line = platformBrandRefService.delRef(enterpriseId, enterpriseBrandId);
return ServiceResponse.success(line);
}
@Override
public ServiceResponse<Integer> updateRef(Integer enterpriseId, Integer enterpriseBrandId, String enterpriseBrandName, String enterpriseBrandCode, Integer categoryId) {
// 先删除原来的
platformBrandRefService.delRef(enterpriseId, enterpriseBrandId);
return this.addRef(enterpriseId, enterpriseBrandId, enterpriseBrandName, enterpriseBrandCode, categoryId);
}
@Override
public ServiceResponse<PlatformBrandDTO> getByBrandName(String enterpriseBrandName) {
TabPlatformBrand platformBrand = this.platformBrandService.getByBrandName(enterpriseBrandName);
return ServiceResponse.success(EntityUtil.changeEntityByOrika(PlatformBrandDTO.class, platformBrand));
}
@Override
public ServiceResponse<Page<PlatformBrandRefDTO>> listByPlatformBrandRef(String brandName) {
com.github.pagehelper.Page<TabPlatformBrandRef> brandRefPage = this.platformBrandRefService.listByPlatformBrandRef(brandName);
Page<PlatformBrandRefDTO> page = PageHelperUtils.changePageHelperToCurrentPage(brandRefPage, PlatformBrandRefDTO.class);
return ServiceResponse.success(page);
}
@Override
public ServiceResponse<Integer> mergeBrandRef(Integer fromBrandId, Integer toBrandId) {
return null;
}
}
......@@ -24,4 +24,6 @@
<dubbo:reference interface="com.gic.log.api.service.LogApiService" id="logApiService" timeout="60000" />
<!--用户-->
<dubbo:reference interface="com.gic.auth.service.UserApiService" id="userApiService" timeout="60000" />
<!--品牌库-->
<dubbo:service interface="com.gic.enterprise.service.PlatformBrandApiService" ref="platformBrandApiService" timeout="60000" />
</beans>
......@@ -36,6 +36,9 @@
#{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">
......@@ -128,131 +131,27 @@
status = #{status,jdbcType=INTEGER}
where platform_brand_id = #{platformBrandId,jdbcType=INTEGER}
</update>
<resultMap id="BaseResultMap" type="com.gic.store.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_name" jdbcType="VARCHAR" property="platformBrandCategoryName" />
<result column="platform_brand_name" jdbcType="VARCHAR" property="platformBrandName" />
<result column="create_type" jdbcType="INTEGER" property="createType" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<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,
create_type, create_time, update_time, status
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<select id="getByBrandName" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_platform_brand
where platform_brand_id = #{platformBrandId,jdbcType=INTEGER}
where platform_brand_name = #{platformBrandName}
and status = 1
</select>
<select id="listPlatformBrand" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_platform_brand
where status = 1
<if test="createType != null ">
and create_type = #{createType}
</if>
<if test="platformBrandName != null and platformBrandName != '' ">
and platform_brand_name = #{platformBrandName}
</if>
<if test="platformBrandCategoryId != null ">
and platform_brand_category_id = #{platformBrandCategoryId}
</if>
order by update_time desc
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_platform_brand
where platform_brand_id = #{platformBrandId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.store.entity.TabPlatformBrand">
insert into tab_platform_brand (platform_brand_id, platform_brand_category_id,
platform_brand_category_name, platform_brand_name,
create_type, create_time, update_time,
status)
values (#{platformBrandId,jdbcType=INTEGER}, #{platformBrandCategoryId,jdbcType=INTEGER},
#{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.store.entity.TabPlatformBrand">
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>
<if test="platformBrandCategoryName != null">
platform_brand_category_name,
</if>
<if test="platformBrandName != null">
platform_brand_name,
</if>
<if test="createType != null">
create_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="status != null">
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="platformBrandId != null">
#{platformBrandId,jdbcType=INTEGER},
</if>
<if test="platformBrandCategoryId != null">
#{platformBrandCategoryId,jdbcType=INTEGER},
</if>
<if test="platformBrandCategoryName != null">
#{platformBrandCategoryName,jdbcType=VARCHAR},
</if>
<if test="platformBrandName != null">
#{platformBrandName,jdbcType=VARCHAR},
</if>
<if test="createType != null">
#{createType,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.store.entity.TabPlatformBrand">
update tab_platform_brand
<set>
<if test="platformBrandCategoryId != null">
platform_brand_category_id = #{platformBrandCategoryId,jdbcType=INTEGER},
</if>
<if test="platformBrandCategoryName != null">
platform_brand_category_name = #{platformBrandCategoryName,jdbcType=VARCHAR},
</if>
<if test="platformBrandName != null">
platform_brand_name = #{platformBrandName,jdbcType=VARCHAR},
</if>
<if test="createType != null">
create_type = #{createType,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
</set>
where platform_brand_id = #{platformBrandId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.store.entity.TabPlatformBrand">
update tab_platform_brand
set platform_brand_category_id = #{platformBrandCategoryId,jdbcType=INTEGER},
platform_brand_category_name = #{platformBrandCategoryName,jdbcType=VARCHAR},
platform_brand_name = #{platformBrandName,jdbcType=VARCHAR},
create_type = #{createType,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER}
where platform_brand_id = #{platformBrandId,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
......@@ -37,6 +37,9 @@
#{status,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabPlatformBrandRef">
<selectKey keyProperty="platformBrandRefId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into tab_platform_brand_ref
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="platformBrandRefId != null">
......@@ -139,142 +142,29 @@
status = #{status,jdbcType=INTEGER}
where platform_brand_ref_id = #{platformBrandRefId,jdbcType=INTEGER}
</update>
<resultMap id="BaseResultMap" type="com.gic.store.entity.TabPlatformBrandRef">
<id column="platform_brand_ref_id" jdbcType="INTEGER" property="platformBrandRefId" />
<result column="platform_brand_id" jdbcType="INTEGER" property="platformBrandId" />
<result column="enterprise_id" jdbcType="INTEGER" property="enterpriseId" />
<result column="enterprise_brand_id" jdbcType="INTEGER" property="enterpriseBrandId" />
<result column="enterprise_brand_name" jdbcType="VARCHAR" property="enterpriseBrandName" />
<result column="enterprise_brand_code" jdbcType="VARCHAR" property="enterpriseBrandCode" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="status" jdbcType="INTEGER" property="status" />
</resultMap>
<sql id="Base_Column_List">
platform_brand_ref_id, platform_brand_id, enterprise_id, enterprise_brand_id, enterprise_brand_name,
enterprise_brand_code, create_time, update_time, status
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<select id="countByPlatformBrandId" resultType="java.lang.Integer">
select count(1) from tab_platform_brand_ref where platform_brand_id = #{platformBrandId} and status = 1
</select>
<select id="countByPlatformBrandIds" resultType="java.util.HashMap">
select platform_brand_id platformBrandId , count(1) brandCount from tab_platform_brand_ref where
status = 1
<if test="null != ids">
and platform_brand_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="delRef" resultType="java.lang.Integer">
update tab_platform_brand_ref set status = 0 where enterprise_id = #{enterpriseId} and enterprise_brand_id = #{enterpriseBrandId}
</select>
<select id="listByPlatformBrandRef" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_platform_brand_ref
where platform_brand_ref_id = #{platformBrandRefId,jdbcType=INTEGER}
where status = 1
<if test="brandName != null and brandName != '' ">
and brand_name = #{brandName}
</if>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_platform_brand_ref
where platform_brand_ref_id = #{platformBrandRefId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.store.entity.TabPlatformBrandRef">
insert into tab_platform_brand_ref (platform_brand_ref_id, platform_brand_id,
enterprise_id, enterprise_brand_id, enterprise_brand_name,
enterprise_brand_code, create_time, update_time,
status)
values (#{platformBrandRefId,jdbcType=INTEGER}, #{platformBrandId,jdbcType=INTEGER},
#{enterpriseId,jdbcType=INTEGER}, #{enterpriseBrandId,jdbcType=INTEGER}, #{enterpriseBrandName,jdbcType=VARCHAR},
#{enterpriseBrandCode,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{status,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.store.entity.TabPlatformBrandRef">
insert into tab_platform_brand_ref
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="platformBrandRefId != null">
platform_brand_ref_id,
</if>
<if test="platformBrandId != null">
platform_brand_id,
</if>
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="enterpriseBrandId != null">
enterprise_brand_id,
</if>
<if test="enterpriseBrandName != null">
enterprise_brand_name,
</if>
<if test="enterpriseBrandCode != null">
enterprise_brand_code,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="status != null">
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="platformBrandRefId != null">
#{platformBrandRefId,jdbcType=INTEGER},
</if>
<if test="platformBrandId != null">
#{platformBrandId,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=INTEGER},
</if>
<if test="enterpriseBrandId != null">
#{enterpriseBrandId,jdbcType=INTEGER},
</if>
<if test="enterpriseBrandName != null">
#{enterpriseBrandName,jdbcType=VARCHAR},
</if>
<if test="enterpriseBrandCode != null">
#{enterpriseBrandCode,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.store.entity.TabPlatformBrandRef">
update tab_platform_brand_ref
<set>
<if test="platformBrandId != null">
platform_brand_id = #{platformBrandId,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
<if test="enterpriseBrandId != null">
enterprise_brand_id = #{enterpriseBrandId,jdbcType=INTEGER},
</if>
<if test="enterpriseBrandName != null">
enterprise_brand_name = #{enterpriseBrandName,jdbcType=VARCHAR},
</if>
<if test="enterpriseBrandCode != null">
enterprise_brand_code = #{enterpriseBrandCode,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
</set>
where platform_brand_ref_id = #{platformBrandRefId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.store.entity.TabPlatformBrandRef">
update tab_platform_brand_ref
set platform_brand_id = #{platformBrandId,jdbcType=INTEGER},
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
enterprise_brand_id = #{enterpriseBrandId,jdbcType=INTEGER},
enterprise_brand_name = #{enterpriseBrandName,jdbcType=VARCHAR},
enterprise_brand_code = #{enterpriseBrandCode,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER}
where platform_brand_ref_id = #{platformBrandRefId,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
</mapper>
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