33 changed files with 998 additions and 74 deletions
@ -0,0 +1,90 @@ |
|||||
|
package cc.hiver.mall.lable.controller; |
||||
|
|
||||
|
import cc.hiver.core.common.utils.ResultUtil; |
||||
|
import cc.hiver.core.common.vo.Result; |
||||
|
import cc.hiver.mall.lable.entity.Lable; |
||||
|
import cc.hiver.mall.lable.service.LableService; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMethod; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 标签控制层 |
||||
|
* |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@RestController |
||||
|
@Api(tags = "标签控制层") |
||||
|
@RequestMapping("/hiver/app/lable/") |
||||
|
public class LableController { |
||||
|
|
||||
|
@Autowired |
||||
|
private LableService lableService; |
||||
|
|
||||
|
/** |
||||
|
* 新增/编辑标签 |
||||
|
* |
||||
|
* @param lable |
||||
|
* @return Result |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
*/ |
||||
|
@RequestMapping(value = "/saveOrEditLable", method = RequestMethod.POST) |
||||
|
public Result saveLable(@RequestBody(required = false) Lable lable) { |
||||
|
|
||||
|
try { |
||||
|
lable = lableService.saveLable(lable); |
||||
|
} catch (Exception e) { |
||||
|
log.error("新增标签失败", e); |
||||
|
return ResultUtil.error("新增标签失败!"); |
||||
|
} |
||||
|
return new ResultUtil<>().setData(lable); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除标签(真删除) |
||||
|
* |
||||
|
* @param id |
||||
|
* @return Result |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
*/ |
||||
|
@RequestMapping(value = "/deleteLable", method = RequestMethod.POST) |
||||
|
public Result deleteLable(String id) { |
||||
|
|
||||
|
try { |
||||
|
lableService.removeById(id); |
||||
|
} catch (Exception e) { |
||||
|
log.error("删除标签失败", e); |
||||
|
return ResultUtil.error("删除标签失败!"); |
||||
|
} |
||||
|
return ResultUtil.success("删除标签成功!"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询店铺下所有标签 |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
* @param shopId |
||||
|
* @return Result |
||||
|
*/ |
||||
|
@RequestMapping(value = "/getLableListByShopId", method = RequestMethod.POST) |
||||
|
public Result getLableListByShopId(String shopId) { |
||||
|
|
||||
|
try { |
||||
|
List<Lable> lableList = lableService.getLableListByShopId(shopId); |
||||
|
return new ResultUtil<>().setData(lableList); |
||||
|
} catch (Exception e) { |
||||
|
log.error("查询店铺下所有标签失败", e); |
||||
|
return ResultUtil.error("查询店铺下所有标签失败!"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,114 @@ |
|||||
|
package cc.hiver.mall.lable.controller; |
||||
|
|
||||
|
import cc.hiver.core.common.utils.ResultUtil; |
||||
|
import cc.hiver.core.common.vo.Result; |
||||
|
import cc.hiver.mall.lable.entity.SaleLable; |
||||
|
import cc.hiver.mall.lable.service.SaleLableService; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMethod; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import javax.transaction.Transactional; |
||||
|
|
||||
|
/** |
||||
|
* 订单-标签关联表控制层 |
||||
|
* |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@RestController |
||||
|
@Api(tags = "订单-标签关联表控制层") |
||||
|
@RequestMapping("/hiver/app/saleLable/") |
||||
|
public class SaleLableController { |
||||
|
|
||||
|
@Autowired |
||||
|
private SaleLableService saleLableService; |
||||
|
|
||||
|
/** |
||||
|
* 新增/编辑订单-标签关联 |
||||
|
* |
||||
|
* @param saleLable |
||||
|
* @return Result |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
*/ |
||||
|
@RequestMapping(value = "/saveOrEditSaleLable", method = RequestMethod.POST) |
||||
|
public Result saveOrEditSaleLable(@RequestBody(required = false) SaleLable saleLable) { |
||||
|
|
||||
|
try { |
||||
|
saleLable = saleLableService.saveOrEditSaleLable(saleLable); |
||||
|
} catch (Exception e) { |
||||
|
log.error("新增订单-标签关联失败", e); |
||||
|
return ResultUtil.error("新增订单-标签关联失败!"); |
||||
|
} |
||||
|
return new ResultUtil<>().setData(saleLable); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除订单-标签关联(真删除) |
||||
|
* |
||||
|
* @param id |
||||
|
* @return Result |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
*/ |
||||
|
@RequestMapping(value = "/deleteSaleLable", method = RequestMethod.POST) |
||||
|
public Result deleteLable(String id) { |
||||
|
|
||||
|
try { |
||||
|
saleLableService.removeById(id); |
||||
|
} catch (Exception e) { |
||||
|
log.error("删除订单-标签关联失败", e); |
||||
|
return ResultUtil.error("删除订单-标签关联失败!"); |
||||
|
} |
||||
|
return ResultUtil.success("删除订单-标签关联成功!"); |
||||
|
} |
||||
|
|
||||
|
@RequestMapping(value = "/deleteBySaleId", method = RequestMethod.POST) |
||||
|
public Result deleteBySaleId(String saleId) { |
||||
|
if(StringUtils.isEmpty(saleId)){ |
||||
|
return ResultUtil.error("订单id不能为空!"); |
||||
|
} |
||||
|
try { |
||||
|
saleLableService.deleteBySaleId(saleId); |
||||
|
} catch (Exception e) { |
||||
|
log.error("删除订单-标签关联失败", e); |
||||
|
return ResultUtil.error("删除订单-标签关联失败!"); |
||||
|
} |
||||
|
return ResultUtil.success("删除订单-标签关联成功!"); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 订单关联标签 |
||||
|
* |
||||
|
* @param saleId |
||||
|
* @param lableIds |
||||
|
* @return |
||||
|
*/ |
||||
|
@Transactional |
||||
|
@RequestMapping(value = "/batchSaveSaleLable", method = RequestMethod.POST) |
||||
|
public Result batchSaveSaleLable(String saleId, String lableIds) { |
||||
|
if(StringUtils.isEmpty(saleId)){ |
||||
|
return ResultUtil.error("订单id不能为空!"); |
||||
|
} |
||||
|
if(StringUtils.isEmpty(lableIds)){ |
||||
|
return ResultUtil.error("标签id不能为空!"); |
||||
|
} |
||||
|
try { |
||||
|
// 先删,后增
|
||||
|
saleLableService.deleteBySaleId(saleId); |
||||
|
saleLableService.batchSaveSaleLable(saleId, lableIds); |
||||
|
} catch (Exception e) { |
||||
|
log.error("关联失败", e); |
||||
|
return ResultUtil.error("关联失败!"); |
||||
|
} |
||||
|
return ResultUtil.success("关联成功!"); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
package cc.hiver.mall.lable.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.persistence.Id; |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel(value = "标签表") |
||||
|
@TableName(value = "t_lable", autoResultMap = true) |
||||
|
public class Lable { |
||||
|
|
||||
|
@Id |
||||
|
@TableId |
||||
|
@ApiModelProperty(value = "唯一标识") |
||||
|
private String id; |
||||
|
|
||||
|
@ApiModelProperty(value = "店铺id") |
||||
|
private String shopId; |
||||
|
|
||||
|
@ApiModelProperty(value = "店铺名称") |
||||
|
private String shopName; |
||||
|
|
||||
|
@ApiModelProperty(value = "标签内容") |
||||
|
private String lableContent; |
||||
|
|
||||
|
@ApiModelProperty(value = "标签颜色") |
||||
|
private String lableColor; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package cc.hiver.mall.lable.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.persistence.Id; |
||||
|
|
||||
|
@Data |
||||
|
public class SaleLable { |
||||
|
|
||||
|
@Id |
||||
|
@TableId |
||||
|
@ApiModelProperty(value = "唯一标识") |
||||
|
private String id; |
||||
|
|
||||
|
@ApiModelProperty(value = "订单id") |
||||
|
private String saleId; |
||||
|
|
||||
|
@ApiModelProperty(value = "标签id") |
||||
|
private String lableId; |
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
package cc.hiver.mall.lable.mapper; |
||||
|
|
||||
|
import cc.hiver.mall.lable.entity.Lable; |
||||
|
import cc.hiver.mall.lable.vo.SaleLableVo; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.springframework.stereotype.Repository; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Repository |
||||
|
public interface LableMapper extends BaseMapper<Lable> { |
||||
|
|
||||
|
/** |
||||
|
* 根据saleId获取标签信息 |
||||
|
* |
||||
|
* @param saleIdList |
||||
|
* @return List<SaleLableVo> |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
*/ |
||||
|
List<SaleLableVo> getLableListBySaleIdList(@Param("saleIdList") List<String> saleIdList); |
||||
|
|
||||
|
/** |
||||
|
* 查询店铺下所有标签 |
||||
|
* |
||||
|
* @param shopId |
||||
|
* @return List<Lable> |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
*/ |
||||
|
List<Lable> getLableListByShopId(@Param("shopId") String shopId); |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
package cc.hiver.mall.lable.mapper; |
||||
|
|
||||
|
import cc.hiver.mall.lable.entity.SaleLable; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.springframework.stereotype.Repository; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Repository |
||||
|
public interface SaleLableMapper extends BaseMapper<SaleLable> { |
||||
|
|
||||
|
/** |
||||
|
* 根据订单id删除订单-标签关联 |
||||
|
* |
||||
|
* @param saleId |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/28 |
||||
|
*/ |
||||
|
void deleteBySaleId(@Param("saleId") String saleId); |
||||
|
|
||||
|
/** |
||||
|
* 批量新增关联关系 |
||||
|
* |
||||
|
* @param saleLables |
||||
|
* @return boolean |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/28 |
||||
|
*/ |
||||
|
boolean batchSaveSaleLable(@Param("saleLables") List<SaleLable> saleLables); |
||||
|
} |
||||
@ -0,0 +1,44 @@ |
|||||
|
package cc.hiver.mall.lable.service; |
||||
|
|
||||
|
import cc.hiver.mall.lable.entity.Lable; |
||||
|
import cc.hiver.mall.lable.vo.SaleLableVo; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface LableService { |
||||
|
|
||||
|
/** |
||||
|
* 新增/编辑标签 |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
* @param lable |
||||
|
* @return Lable |
||||
|
*/ |
||||
|
Lable saveLable(Lable lable); |
||||
|
|
||||
|
/** |
||||
|
* 删除标签(真删除) |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
* @param id |
||||
|
*/ |
||||
|
void removeById(String id); |
||||
|
|
||||
|
/** |
||||
|
* 根据saleId获取标签信息 |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
* @param saleIdList |
||||
|
* @return List<SaleLableVo> |
||||
|
*/ |
||||
|
List<SaleLableVo> getLableListBySaleIdList(List<String> saleIdList); |
||||
|
|
||||
|
/** |
||||
|
* 查询店铺下所有标签 |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
* @param shopId |
||||
|
* @return List<Lable> |
||||
|
*/ |
||||
|
List<Lable> getLableListByShopId(String shopId); |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
package cc.hiver.mall.lable.service; |
||||
|
|
||||
|
import cc.hiver.mall.lable.entity.SaleLable; |
||||
|
|
||||
|
public interface SaleLableService { |
||||
|
|
||||
|
SaleLable saveOrEditSaleLable(SaleLable saleLable); |
||||
|
|
||||
|
void removeById(String id); |
||||
|
|
||||
|
void deleteBySaleId(String saleId); |
||||
|
|
||||
|
// 批量新增关联
|
||||
|
boolean batchSaveSaleLable(String saleId, String lableIds); |
||||
|
} |
||||
@ -0,0 +1,81 @@ |
|||||
|
package cc.hiver.mall.lable.service.impl; |
||||
|
|
||||
|
import cc.hiver.mall.lable.entity.Lable; |
||||
|
import cc.hiver.mall.lable.mapper.LableMapper; |
||||
|
import cc.hiver.mall.lable.service.LableService; |
||||
|
import cc.hiver.mall.lable.vo.SaleLableVo; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
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.UUID; |
||||
|
|
||||
|
@Service |
||||
|
public class LableServiceImpl extends ServiceImpl<LableMapper, Lable> implements LableService { |
||||
|
|
||||
|
@Autowired |
||||
|
private LableMapper lableMapper; |
||||
|
|
||||
|
/** |
||||
|
* 新增/编辑标签 |
||||
|
* |
||||
|
* @param lable |
||||
|
* @return Lable |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
*/ |
||||
|
@Override |
||||
|
public Lable saveLable(Lable lable) { |
||||
|
final String id = lable.getId(); |
||||
|
if (StringUtils.isEmpty(id)) { |
||||
|
// 新增
|
||||
|
final String uuid = UUID.randomUUID().toString(); |
||||
|
lable.setId(uuid); |
||||
|
lableMapper.insert(lable); |
||||
|
} else { |
||||
|
// 修改
|
||||
|
lableMapper.updateById(lable); |
||||
|
} |
||||
|
return lable; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除标签(真删除) |
||||
|
* |
||||
|
* @param id |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
*/ |
||||
|
@Override |
||||
|
public void removeById(String id) { |
||||
|
lableMapper.deleteById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据saleId获取标签信息 |
||||
|
* |
||||
|
* @param saleIdList |
||||
|
* @return List<SaleLableVo> |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<SaleLableVo> getLableListBySaleIdList(List<String> saleIdList) { |
||||
|
return lableMapper.getLableListBySaleIdList(saleIdList); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询店铺下所有标签 |
||||
|
* |
||||
|
* @param shopId |
||||
|
* @return List<Lable> |
||||
|
* @author 王富康 |
||||
|
* @date 2025/2/26 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<Lable> getLableListByShopId(String shopId) { |
||||
|
return lableMapper.getLableListByShopId(shopId); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,65 @@ |
|||||
|
package cc.hiver.mall.lable.service.impl; |
||||
|
|
||||
|
import cc.hiver.core.common.utils.SnowFlakeUtil; |
||||
|
import cc.hiver.mall.lable.entity.SaleLable; |
||||
|
import cc.hiver.mall.lable.mapper.SaleLableMapper; |
||||
|
import cc.hiver.mall.lable.service.SaleLableService; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Collections; |
||||
|
import java.util.List; |
||||
|
import java.util.UUID; |
||||
|
|
||||
|
@Service |
||||
|
public class SaleLableServiceImpl extends ServiceImpl<SaleLableMapper, SaleLable> implements SaleLableService { |
||||
|
|
||||
|
@Autowired |
||||
|
private SaleLableMapper saleLableMapper; |
||||
|
|
||||
|
@Override |
||||
|
public SaleLable saveOrEditSaleLable(SaleLable saleLable) { |
||||
|
final String id = saleLable.getId(); |
||||
|
if (StringUtils.isEmpty(id)) { |
||||
|
// 新增
|
||||
|
final String uuid = UUID.randomUUID().toString(); |
||||
|
saleLable.setId(uuid); |
||||
|
saleLableMapper.insert(saleLable); |
||||
|
} else { |
||||
|
// 修改
|
||||
|
saleLableMapper.updateById(saleLable); |
||||
|
} |
||||
|
return saleLable; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void removeById(String id) { |
||||
|
saleLableMapper.deleteById(id); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void deleteBySaleId(String saleId) { |
||||
|
saleLableMapper.deleteBySaleId(saleId); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public boolean batchSaveSaleLable(String saleId, String lableIds) { |
||||
|
// lableIds根据逗号分隔,然后组成List
|
||||
|
final String[] split = lableIds.split(","); |
||||
|
final List<String> lableList = new ArrayList<>(); |
||||
|
Collections.addAll(lableList, split); |
||||
|
final List<SaleLable> saleLables = new ArrayList<>(); |
||||
|
for (String s : split) { |
||||
|
final SaleLable saleLable = new SaleLable(); |
||||
|
saleLable.setId(String.valueOf(SnowFlakeUtil.nextId())); |
||||
|
saleLable.setSaleId(saleId); |
||||
|
saleLable.setLableId(s); |
||||
|
saleLables.add(saleLable); |
||||
|
} |
||||
|
return saleLableMapper.batchSaveSaleLable(saleLables); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
package cc.hiver.mall.lable.vo; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class SaleLableVo { |
||||
|
|
||||
|
@ApiModelProperty(value = "唯一标识") |
||||
|
private String id; |
||||
|
|
||||
|
@ApiModelProperty(value = "销售单id") |
||||
|
private String saleId; |
||||
|
|
||||
|
@ApiModelProperty(value = "店铺id") |
||||
|
private String shopId; |
||||
|
|
||||
|
@ApiModelProperty(value = "店铺名称") |
||||
|
private String shopName; |
||||
|
|
||||
|
@ApiModelProperty(value = "标签内容") |
||||
|
private String lableContent; |
||||
|
|
||||
|
@ApiModelProperty(value = "标签颜色") |
||||
|
private String lableColor; |
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="cc.hiver.mall.lable.mapper.LableMapper"> |
||||
|
<resultMap id="BaseResultMap" type="cc.hiver.mall.lable.entity.Lable"> |
||||
|
<id column="id" jdbcType="VARCHAR" property="id" /> |
||||
|
<result column="shop_id" jdbcType="VARCHAR" property="shopId" /> |
||||
|
<result column="shop_name" jdbcType="VARCHAR" property="shopName" /> |
||||
|
<result column="lable_content" jdbcType="VARCHAR" property="lableContent" /> |
||||
|
<result column="lable_color" jdbcType="VARCHAR" property="lableColor" /> |
||||
|
</resultMap> |
||||
|
<sql id="Base_Column_List"> |
||||
|
id, shop_id, shop_name, lable_content, lable_color |
||||
|
</sql> |
||||
|
|
||||
|
<select id="getLableListBySaleIdList" resultType="cc.hiver.mall.lable.vo.SaleLableVo"> |
||||
|
select |
||||
|
tl.id, tl.shop_id, tl.shop_name, tl.lable_content, tl.lable_color,tsl.sale_id |
||||
|
from t_lable tl |
||||
|
left join t_sale_lable tsl |
||||
|
on tl.id = tsl.lable_id |
||||
|
where tsl.sale_id in |
||||
|
<foreach close=")" collection="saleIdList" item="listItem" open="(" separator=","> |
||||
|
#{listItem} |
||||
|
</foreach> |
||||
|
</select> |
||||
|
|
||||
|
<select id="getLableListByShopId" resultMap="BaseResultMap"> |
||||
|
select |
||||
|
<include refid="Base_Column_List" /> |
||||
|
from t_lable |
||||
|
where shop_id = #{shopId,jdbcType=VARCHAR} |
||||
|
</select> |
||||
|
</mapper> |
||||
@ -0,0 +1,27 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="cc.hiver.mall.lable.mapper.SaleLableMapper"> |
||||
|
<resultMap id="BaseResultMap" type="cc.hiver.mall.lable.entity.SaleLable"> |
||||
|
<id column="id" jdbcType="VARCHAR" property="id" /> |
||||
|
<result column="sale_id" jdbcType="VARCHAR" property="saleId" /> |
||||
|
<result column="lable_id" jdbcType="VARCHAR" property="lableId" /> |
||||
|
</resultMap> |
||||
|
<sql id="Base_Column_List"> |
||||
|
id, sale_id, lable_id |
||||
|
</sql> |
||||
|
|
||||
|
<delete id="deleteBySaleId" parameterType="java.lang.String"> |
||||
|
delete |
||||
|
from t_sale_lable |
||||
|
where sale_id = #{saleId,jdbcType=VARCHAR} |
||||
|
</delete> |
||||
|
|
||||
|
<insert id="batchSaveSaleLable" parameterType="java.util.List"> |
||||
|
insert into t_sale_lable (id, sale_id, lable_id) values |
||||
|
<foreach item="saleLable" collection="saleLables" index="index" separator=","> |
||||
|
(#{saleLable.id,jdbcType=VARCHAR},#{saleLable.saleId,jdbcType=VARCHAR}, |
||||
|
#{saleLable.lableId,jdbcType=VARCHAR}) |
||||
|
</foreach> |
||||
|
|
||||
|
</insert> |
||||
|
</mapper> |
||||
Loading…
Reference in new issue