@@ -0,0 +1,108 @@ | |||
package com.iformall.controller; | |||
import com.github.pagehelper.PageInfo; | |||
import com.iformall.common.ErrorCode; | |||
import com.iformall.common.ResultData; | |||
import com.iformall.domain.po.base.BaseEntity; | |||
import com.iformall.domain.po.sm.MaterialMould; | |||
import com.iformall.domain.po.sm.MouldPatch; | |||
import com.iformall.domain.po.sm.UserMouldVideo; | |||
import com.iformall.enums.EnumLanguages; | |||
import com.iformall.enums.EnumMouldPatchType; | |||
import com.iformall.enums.EnumMouldSendType; | |||
import com.iformall.enums.EnumaMouldPatchStatus; | |||
import com.iformall.language.LanguageDetect; | |||
import com.iformall.service.sm.MaterialMouldService; | |||
import com.iformall.service.sm.MouldPatchService; | |||
import com.iformall.service.sm.MouldPatchSignService; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiImplicitParam; | |||
import io.swagger.annotations.ApiImplicitParams; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
@RestController | |||
@RequestMapping("/api/materialMould") | |||
@Api(description = "模板接口") | |||
public class MaterialMouldController extends BaseController { | |||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
@Autowired | |||
private MaterialMouldService materialMouldService; | |||
@Autowired | |||
private MouldPatchSignService mouldPatchSignService; | |||
@ApiOperation("分页列表接口") | |||
@GetMapping("list") | |||
@ApiImplicitParams({ | |||
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
public ResultData list(@ModelAttribute MaterialMould record, Integer pageNum, Integer pageSize) { | |||
logger.debug("[" + getIpAddr() + "] MaterialMouldController::list"); | |||
if (record == null) record = new MaterialMould(); | |||
if(record.getType() == null){ | |||
record.setType(EnumMouldPatchType.background_mould.getCode()); | |||
} | |||
record.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | |||
record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
final PageInfo<MaterialMould> page = materialMouldService.cListAsPage(record, pageNum, pageSize); | |||
return new ResultData(page); | |||
} | |||
@ApiOperation("分页列表接口") | |||
@GetMapping("userList") | |||
@ApiImplicitParams({ | |||
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
public ResultData userList(@ModelAttribute MaterialMould record, Integer pageNum, Integer pageSize) { | |||
logger.debug("[" + getIpAddr() + "] MaterialMouldController::userList"); | |||
if (record == null) record = new MaterialMould(); | |||
if(record.getType() == null){ | |||
record.setType(EnumMouldPatchType.background_mould.getCode()); | |||
} | |||
record.setUserId(getMemberId()); | |||
record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
final PageInfo<MaterialMould> page = materialMouldService.cListAsPage(record, pageNum, pageSize); | |||
return new ResultData(page); | |||
} | |||
@ApiOperation("新增接口") | |||
@PostMapping("save") | |||
public ResultData save(@RequestBody MaterialMould record) { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::save"); | |||
if(record == null)record = new MaterialMould(); | |||
record.setSendType(EnumMouldSendType.build.getCode()); | |||
record.setUserId(getMemberId()); | |||
if(record.getType() == null){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"类型为空"); | |||
} | |||
if(StringUtils.isBlank(record.getMaterial())){ | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"图片为空"); | |||
} | |||
if(record.getTitle() == null){ | |||
record.setTitle("用户自建"); | |||
} | |||
record.setPrice(0); | |||
record.setSalePrice(0); | |||
materialMouldService.saveOrUpdate(record); | |||
return new ResultData(); | |||
} | |||
@ApiOperation("根据id查询接口") | |||
@GetMapping("/findById") | |||
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
public ResultData findById(Long id) { | |||
logger.debug("[" + getIpAddr() + "] MaterialMouldController::findById"); | |||
MaterialMould materialMould = materialMouldService.getDetailById(id); | |||
return new ResultData(materialMould); | |||
} | |||
} |
@@ -46,7 +46,7 @@ public class PersonMouldController extends BaseController { | |||
public ResultData list(@ModelAttribute PersonMould record, Integer pageNum, Integer pageSize) { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::list"); | |||
if (record == null) record = new PersonMould(); | |||
record.setSendType(EnumMouldSendType.auto.getCode()); | |||
// record.setSendType(EnumMouldSendType.auto.getCode()); | |||
record.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | |||
record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
final PageInfo<PersonMould> page = personMouldService.cListAsPage(record, pageNum, pageSize); | |||
@@ -53,7 +53,7 @@ public class VoiceMouldController extends BaseController { | |||
public ResultData list(@ModelAttribute VoiceMould record, Integer pageNum, Integer pageSize) { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::list"); | |||
if (record == null) record = new VoiceMould(); | |||
record.setSendType(EnumMouldSendType.auto.getCode()); | |||
// record.setSendType(EnumMouldSendType.auto.getCode()); | |||
record.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | |||
record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
final PageInfo<VoiceMould> page = voiceMouldService.cListAsPage(record, pageNum, pageSize); | |||
@@ -66,7 +66,8 @@ public class VoiceMouldController extends BaseController { | |||
public ResultData findById(Long id) { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::findById"); | |||
VoiceMould voiceMould = voiceMouldService.getDetailById(id); | |||
if(voiceMould.getParentId() == 0l && voiceMould.getCountSub() > 0){ | |||
if(voiceMould != null | |||
&& voiceMould.getParentId() == 0l && voiceMould.getCountSub() > 0){ | |||
VoiceMould voiceQ = new VoiceMould(); | |||
voiceQ.setParentId(voiceMould.getId()); | |||
voiceQ.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | |||
@@ -0,0 +1,120 @@ | |||
package com.iformall.domain.po.sm; | |||
import cn.afterturn.easypoi.excel.annotation.Excel; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.iformall.common.SortColumn; | |||
import com.iformall.domain.po.base.TenantEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.ToString; | |||
import org.apache.commons.lang3.StringUtils; | |||
import java.math.BigDecimal; | |||
import java.util.Date; | |||
import java.util.List; | |||
@TableName(value = "material_mould") | |||
@Data | |||
@ToString(callSuper = true) | |||
@EqualsAndHashCode(callSuper = true) | |||
public class MaterialMould extends TenantEntity { | |||
protected Long id; | |||
@TableField(exist = false) | |||
@SortColumn(column = "sale_price") | |||
private String salePriceStr; | |||
@TableField(exist = false) | |||
@SortColumn(column = "price") | |||
private String priceStr; | |||
@TableField(exist = false) | |||
@io.swagger.annotations.ApiModelProperty(value="查询-起始时间",name="startDate") | |||
private Date startDate; | |||
@TableField(exist = false) | |||
@io.swagger.annotations.ApiModelProperty(value="查询-结束时间",name="endDate") | |||
private Date endDate; | |||
@io.swagger.annotations.ApiModelProperty(value="EnumMouldPatchType",name="type") | |||
private Integer type; | |||
@io.swagger.annotations.ApiModelProperty(value="名称",name="title") | |||
@Excel(name="名称",width = 20,orderNum = "1") | |||
private String title; | |||
@io.swagger.annotations.ApiModelProperty(value="副标题",name="subTitle") | |||
private String subTitle; | |||
@io.swagger.annotations.ApiModelProperty(value="标签",name="sceneSign") | |||
private String sceneSign; | |||
@TableField(exist = false) | |||
private List<Long> sceneSignList; | |||
public List<Long> getSceneSignList(){ | |||
if(StringUtils.isNotBlank(this.getSceneSign())){ | |||
try{ | |||
List<Long> longs = JSONObject.parseArray(this.getSceneSign(), Long.class); | |||
if(longs != null && longs.size() > 0){ | |||
return longs; | |||
} | |||
}catch(Exception e){ | |||
} | |||
} | |||
return null; | |||
} | |||
@TableField(exist = false) | |||
private List<MouldPatchSign> mouldPatchSign; | |||
@io.swagger.annotations.ApiModelProperty(value="售价",name="salePrice") | |||
@Excel(name="售价(分)",width = 20,orderNum = "3") | |||
private Integer salePrice; | |||
@io.swagger.annotations.ApiModelProperty(value="须知",name="detail") | |||
private String detail; | |||
@io.swagger.annotations.ApiModelProperty(value="原价",name="price") | |||
@Excel(name="原价(分)",width = 20,orderNum = "2") | |||
private Integer price; | |||
@io.swagger.annotations.ApiModelProperty(value="EnumMouldSendType ",name="sendType") | |||
private Integer sendType; | |||
@io.swagger.annotations.ApiModelProperty(value="购买须知",name="remark") | |||
private String remark; | |||
@io.swagger.annotations.ApiModelProperty(value="素材地址",name="material") | |||
private String material; | |||
@io.swagger.annotations.ApiModelProperty(value="用户id",name="userId") | |||
private Long userId; | |||
@io.swagger.annotations.ApiModelProperty(value="EnumaMouldPatchStatus 状态",name="status") | |||
private Integer status; | |||
@io.swagger.annotations.ApiModelProperty(value="上架时间",name="putonDate") | |||
private Date putonDate; | |||
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
private Date createDate; | |||
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
private Date updateDate; | |||
public String getSalePriceStr() { | |||
if(salePrice!=null) { | |||
salePriceStr = new BigDecimal(salePrice).divide(new BigDecimal(100)).toString(); | |||
} | |||
return salePriceStr; | |||
} | |||
public String getPriceStr() { | |||
if(price!=null) { | |||
priceStr = new BigDecimal(price).divide(new BigDecimal(100)).toString(); | |||
} | |||
return priceStr; | |||
} | |||
private List<Integer> sendTypes; | |||
} |
@@ -1,13 +1,16 @@ | |||
package com.iformall.enums; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
* | |||
*/ | |||
public enum EnumMouldSendType { | |||
auto(1,"系统模板"), | |||
buy(2, "收费模板"), | |||
build(3, "自建模板"), | |||
auto(1,"系统免费"), | |||
buy(2, "系统收费"), | |||
build(3, "用户自建"), | |||
; | |||
public static EnumMouldSendType getEnum(Integer code) { | |||
@@ -34,4 +37,11 @@ public enum EnumMouldSendType { | |||
public String getMessage() { | |||
return message; | |||
} | |||
public static List<Integer> getSysSendTypes(){ | |||
List<Integer> sendTypes = new ArrayList<>(); | |||
sendTypes.add(EnumMouldSendType.auto.getCode()); | |||
sendTypes.add(EnumMouldSendType.buy.getCode()); | |||
return sendTypes; | |||
} | |||
} |
@@ -6,7 +6,7 @@ package com.iformall.enums; | |||
public enum EnumaMouldPatchStatus { | |||
// | |||
draft(0, "草稿"), | |||
draft(0, "已保存"), | |||
put_on(1, "已上架"), | |||
put_off(2, "已下架"), | |||
; | |||
@@ -0,0 +1,23 @@ | |||
package com.iformall.mapper; | |||
import com.iformall.common.CommonMapper; | |||
import com.iformall.domain.po.sm.MaterialMould; | |||
import com.iformall.domain.po.sm.MouldPatch; | |||
import org.apache.ibatis.annotations.Param; | |||
import java.util.List; | |||
public interface MaterialMouldMapper extends CommonMapper<MaterialMould, Long> { | |||
List<MaterialMould> findList(MaterialMould record); | |||
int deleteById(@Param("id")Long id); | |||
/** | |||
* c端列表查询,尽量减少字段 | |||
* @param record | |||
* @return | |||
*/ | |||
List<MaterialMould> findCList(MaterialMould record); | |||
} |
@@ -0,0 +1,46 @@ | |||
package com.iformall.service.sm; | |||
import com.github.pagehelper.PageInfo; | |||
import com.iformall.common.ResultData; | |||
import com.iformall.domain.po.sm.MaterialMould; | |||
import com.iformall.domain.po.sm.MouldPatch; | |||
public interface MaterialMouldService { | |||
/** | |||
* 根据实体查询分页列表 | |||
* | |||
* @param record | |||
* @param pageIndex | |||
* @param pageSize | |||
* @return | |||
*/ | |||
PageInfo<MaterialMould> listAsPage(MaterialMould record, Integer pageIndex, Integer pageSize); | |||
PageInfo<MaterialMould> cListAsPage(MaterialMould record, Integer pageIndex, Integer pageSize); | |||
/** | |||
* 根据Id获得实体 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
MaterialMould getById(Long id); | |||
MaterialMould getDetailById(Long id); | |||
/** | |||
* 保存或更新实体 | |||
* | |||
* @param record | |||
*/ | |||
ResultData saveOrUpdate(MaterialMould record); | |||
/** | |||
* 根据Id删除实体 | |||
* | |||
* @param id | |||
*/ | |||
void deleteById(Long id); | |||
void updateOnline(MaterialMould record); | |||
} |
@@ -0,0 +1,127 @@ | |||
package com.iformall.service.sm.impl; | |||
import com.github.pagehelper.PageHelper; | |||
import com.github.pagehelper.PageInfo; | |||
import com.iformall.common.IdWorker; | |||
import com.iformall.common.ResultData; | |||
import com.iformall.domain.po.sm.MaterialMould; | |||
import com.iformall.domain.po.sm.MouldPatch; | |||
import com.iformall.domain.po.sm.MouldPatchSign; | |||
import com.iformall.enums.EnumColour; | |||
import com.iformall.enums.EnumMouldSendType; | |||
import com.iformall.enums.EnumaMouldPatchStatus; | |||
import com.iformall.mapper.MaterialMouldMapper; | |||
import com.iformall.mapper.MouldPatchMapper; | |||
import com.iformall.service.sm.MaterialMouldService; | |||
import com.iformall.service.sm.MouldPatchService; | |||
import com.iformall.service.sm.MouldPatchSignService; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.math.BigDecimal; | |||
import java.util.Date; | |||
import java.util.List; | |||
@Service | |||
public class MaterialMouldServiceImpl implements MaterialMouldService { | |||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
@Autowired | |||
MaterialMouldMapper materialMouldMapper; | |||
@Autowired | |||
MouldPatchSignService mouldPatchSignService; | |||
private void handleSendType(MaterialMould record){ | |||
// | |||
if(record.getUserId() != null){ | |||
record.setSendType(EnumMouldSendType.build.getCode()); | |||
}else if(record.getSendType() == null){ | |||
record.setSendTypes(EnumMouldSendType.getSysSendTypes()); | |||
} | |||
} | |||
@Override | |||
public PageInfo<MaterialMould> listAsPage(MaterialMould record, Integer pageIndex, Integer pageSize) { | |||
handleSendType(record); | |||
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> materialMouldMapper.findList(record)); | |||
} | |||
@Override | |||
public PageInfo<MaterialMould> cListAsPage(MaterialMould record, Integer pageIndex, Integer pageSize) { | |||
handleSendType(record); | |||
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> materialMouldMapper.findCList(record)); | |||
} | |||
@Override | |||
public MaterialMould getById(Long id) { | |||
return materialMouldMapper.selectById(id); | |||
} | |||
@Override | |||
public MaterialMould getDetailById(Long id) { | |||
MaterialMould materialMould = getById(id); | |||
if(materialMould == null){ | |||
return null; | |||
} | |||
if(materialMould.getSceneSignList() != null && !materialMould.getSceneSignList().isEmpty()){ | |||
MouldPatchSign signQ = new MouldPatchSign(); | |||
signQ.setIds(materialMould.getSceneSignList()); | |||
List<MouldPatchSign> signList = mouldPatchSignService.getList(signQ); | |||
materialMould.setMouldPatchSign(signList); | |||
} | |||
return materialMould; | |||
} | |||
@Override | |||
public ResultData saveOrUpdate(MaterialMould record) { | |||
//金额处理 | |||
if (StringUtils.isNotEmpty(record.getSalePriceStr())) { | |||
record.setSalePrice(new BigDecimal(record.getSalePriceStr()).multiply(new BigDecimal(100)).intValue()); | |||
} | |||
if (StringUtils.isNotEmpty(record.getPriceStr())) { | |||
record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).intValue()); | |||
} | |||
Date now = new Date(); | |||
if (record.getId() == null) { | |||
//record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
final IdWorker idWorker = IdWorker.get(); | |||
record.setId(idWorker.nextId()); | |||
if(record.getStatus() == null){ | |||
record.setStatus(EnumaMouldPatchStatus.draft.getCode()); | |||
} | |||
record.setCreateDate(now); | |||
record.setUpdateDate(now); | |||
materialMouldMapper.insert(record); | |||
} else { | |||
record.setUpdateDate(now); | |||
materialMouldMapper.updateById(record); | |||
} | |||
return new ResultData(); | |||
} | |||
@Override | |||
public void deleteById(Long id) { | |||
materialMouldMapper.deleteById(id); | |||
} | |||
@Override | |||
public void updateOnline(MaterialMould record) { | |||
Date now = new Date(); | |||
MaterialMould materialMouldUpd = new MaterialMould(); | |||
materialMouldUpd.setId(record.getId()); | |||
materialMouldUpd.setStatus(record.getStatus()); | |||
if(EnumaMouldPatchStatus.put_on.getCode().equals(materialMouldUpd.getStatus())){ | |||
materialMouldUpd.setPutonDate(now); | |||
} | |||
materialMouldUpd.setUpdateDate(now); | |||
materialMouldMapper.updateById(materialMouldUpd); | |||
} | |||
} |
@@ -54,6 +54,9 @@ public class MouldPatchServiceImpl implements MouldPatchService { | |||
@Override | |||
public MouldPatch getDetailById(Long id) { | |||
MouldPatch mouldPatch = getById(id); | |||
if(mouldPatch == null){ | |||
return null; | |||
} | |||
if(mouldPatch.getSceneSignList() != null && !mouldPatch.getSceneSignList().isEmpty()){ | |||
MouldPatchSign signQ = new MouldPatchSign(); | |||
signQ.setIds(mouldPatch.getSceneSignList()); | |||
@@ -72,11 +75,6 @@ public class MouldPatchServiceImpl implements MouldPatchService { | |||
if (StringUtils.isNotEmpty(record.getSalePriceStr())) { | |||
record.setSalePrice(new BigDecimal(record.getSalePriceStr()).multiply(new BigDecimal(100)).intValue()); | |||
} | |||
if(record.getSalePrice() > 0){ | |||
record.setSendType(EnumMouldSendType.buy.getCode()); | |||
}else{ | |||
record.setSendType(EnumMouldSendType.auto.getCode()); | |||
} | |||
if (StringUtils.isNotEmpty(record.getPriceStr())) { | |||
record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).intValue()); | |||
} | |||
@@ -55,6 +55,9 @@ public class PersonMouldServiceImpl implements PersonMouldService { | |||
@Override | |||
public PersonMould getDetailById(Long id) { | |||
PersonMould personMould = getById(id); | |||
if(personMould == null){ | |||
return null; | |||
} | |||
if(personMould.getSceneSignList() != null && !personMould.getSceneSignList().isEmpty()){ | |||
MouldPatchSign signQ = new MouldPatchSign(); | |||
signQ.setIds(personMould.getSceneSignList()); | |||
@@ -73,11 +76,6 @@ public class PersonMouldServiceImpl implements PersonMouldService { | |||
if (StringUtils.isNotEmpty(record.getSalePriceStr())) { | |||
record.setSalePrice(new BigDecimal(record.getSalePriceStr()).multiply(new BigDecimal(100)).intValue()); | |||
} | |||
if(record.getSalePrice() > 0){ | |||
record.setSendType(EnumMouldSendType.buy.getCode()); | |||
}else{ | |||
record.setSendType(EnumMouldSendType.auto.getCode()); | |||
} | |||
if (StringUtils.isNotEmpty(record.getPriceStr())) { | |||
record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).intValue()); | |||
} | |||
@@ -60,6 +60,9 @@ public class VoiceMouldServiceImpl implements VoiceMouldService { | |||
@Override | |||
public VoiceMould getDetailById(Long id) { | |||
VoiceMould voiceMould = getById(id); | |||
if(voiceMould == null){ | |||
return null; | |||
} | |||
if(voiceMould.getSceneSignList() != null && !voiceMould.getSceneSignList().isEmpty()){ | |||
MouldPatchSign signQ = new MouldPatchSign(); | |||
signQ.setIds(voiceMould.getSceneSignList()); | |||
@@ -75,11 +78,6 @@ public class VoiceMouldServiceImpl implements VoiceMouldService { | |||
if (StringUtils.isNotEmpty(record.getSalePriceStr())) { | |||
record.setSalePrice(new BigDecimal(record.getSalePriceStr()).multiply(new BigDecimal(100)).intValue()); | |||
} | |||
if(record.getSalePrice() > 0){ | |||
record.setSendType(EnumMouldSendType.buy.getCode()); | |||
}else{ | |||
record.setSendType(EnumMouldSendType.auto.getCode()); | |||
} | |||
if (StringUtils.isNotEmpty(record.getPriceStr())) { | |||
record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).intValue()); | |||
} | |||
@@ -0,0 +1,125 @@ | |||
<?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="com.iformall.mapper.MaterialMouldMapper"> | |||
<resultMap id="BaseResultMap" type="com.iformall.domain.po.sm.MaterialMould"> | |||
<id column="id" jdbcType="BIGINT" property="id"/> | |||
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
<result column="type" jdbcType="INTEGER" property="type"/> | |||
<result column="title" jdbcType="VARCHAR" property="title"/> | |||
<result column="sub_title" jdbcType="VARCHAR" property="subTitle"/> | |||
<result column="scene_sign" jdbcType="VARCHAR" property="sceneSign"/> | |||
<result column="sale_price" jdbcType="INTEGER" property="salePrice"/> | |||
<result column="price" jdbcType="INTEGER" property="price"/> | |||
<result column="send_type" jdbcType="INTEGER" property="sendType"/> | |||
<result column="detail" jdbcType="VARCHAR" property="detail"/> | |||
<result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
<result column="material" jdbcType="VARCHAR" property="material"/> | |||
<result column="user_id" jdbcType="BIGINT" property="userId"/> | |||
<result column="status" jdbcType="INTEGER" property="status"/> | |||
<result column="puton_date" jdbcType="TIMESTAMP" property="putonDate"/> | |||
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
</resultMap> | |||
<sql id="allColumns"> | |||
`id`, `tenant_id`, `parent_tenant_id`, `type`, | |||
`title`, `sub_title`, `scene_sign`, `sale_price`, `price`, | |||
`send_type`, `detail`, `remark`, `material`, `user_id`, `status`, `puton_date`, `create_date`, `update_date` | |||
</sql> | |||
<sql id="dynamicWhereConditions"> | |||
where `is_del` = 0 | |||
<if test=" null != id "> | |||
and `id` = #{id} | |||
</if> | |||
<if test=" null != tenantId and '' != tenantId"> | |||
and `tenant_id` = #{tenantId} | |||
</if> | |||
<if test=" null != parentTenantId and '' != parentTenantId"> | |||
and `parent_tenant_id` = #{parentTenantId} | |||
</if> | |||
<if test=" null != type "> | |||
and `type` = #{type} | |||
</if> | |||
<if test=" null != title and ''!=title"> | |||
and `title` like concat('%', #{title},'%') | |||
</if> | |||
<if test=" null != subTitle "> | |||
and `sub_title` like concat('%', #{subTitle},'%') | |||
</if> | |||
<if test=" null != sceneSign and '' != sceneSign"> | |||
and JSON_CONTAINS(scene_sign,json_array(#{sceneSign})) | |||
</if> | |||
<if test=" null != salePrice "> | |||
and `sale_price` = #{salePrice} | |||
</if> | |||
<if test=" null != sendType "> | |||
and `send_type` = #{sendType} | |||
</if> | |||
<if test=" null != price "> | |||
and `price` = #{price} | |||
</if> | |||
<if test=" null != status"> | |||
and `status` = #{status} | |||
</if> | |||
<if test=" null != userId"> | |||
and `user_id` = #{userId} | |||
</if> | |||
<if test=" null != startDate "> | |||
and create_date >= #{startDate} | |||
</if> | |||
<if test=" null != endDate"> | |||
and create_date < #{endDate} | |||
</if> | |||
<if test=" null != sendTypes "> | |||
and send_type in | |||
<foreach collection="sendTypes" index="index" item="sendTypeItem" open="(" separator="," close=")"> | |||
#{sendTypeItem} | |||
</foreach> | |||
</if> | |||
<if test=" null != ids "> | |||
and id in | |||
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
#{idItem} | |||
</foreach> | |||
</if> | |||
<if test=" null != sortColumns">order by ${sortColumns}</if> | |||
</sql> | |||
<select id="findList" parameterType="com.iformall.domain.po.sm.MaterialMould" resultMap="BaseResultMap"> | |||
select | |||
<include refid="allColumns"/> | |||
from material_mould | |||
<include refid="dynamicWhereConditions"/> | |||
</select> | |||
<delete id="deleteById" parameterType="java.util.HashMap"> | |||
update material_mould set is_del = 1,update_date = now() where id = #{id} | |||
</delete> | |||
<select id="findCList" parameterType="com.iformall.domain.po.sm.MaterialMould" resultMap="BaseResultMap"> | |||
select | |||
`id`, `type`, | |||
`title`, `sub_title`, `scene_sign`, `sale_price`, `price`, | |||
`send_type`, `material`, `status`, `create_date`, `update_date` | |||
from material_mould | |||
<include refid="dynamicWhereConditions"/> | |||
</select> | |||
</mapper> |