27 changed files with 733 additions and 48 deletions
@ -0,0 +1,105 @@ |
|||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* @author yan Lu |
||||
|
* @description 描述 |
||||
|
* @create 2023/5/29 17:06 |
||||
|
*/ |
||||
|
public class IcPlaceAttachmentDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 事件Id |
||||
|
*/ |
||||
|
private String icEventId; |
||||
|
|
||||
|
/** |
||||
|
* 附件名 |
||||
|
*/ |
||||
|
private String attachmentName; |
||||
|
|
||||
|
/** |
||||
|
* 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) |
||||
|
*/ |
||||
|
private String attachmentFormat; |
||||
|
|
||||
|
/** |
||||
|
* 附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) |
||||
|
*/ |
||||
|
private String attachmentType; |
||||
|
|
||||
|
/** |
||||
|
* 附件地址 |
||||
|
*/ |
||||
|
private String attachmentUrl; |
||||
|
|
||||
|
/** |
||||
|
* 排序字段 |
||||
|
*/ |
||||
|
private Integer sort; |
||||
|
|
||||
|
/** |
||||
|
* 附件状态(审核中:auditing; |
||||
|
* auto_passed: 自动通过; |
||||
|
* review:结果不确定,需要人工审核; |
||||
|
* block: 结果违规; |
||||
|
* rejected:人工审核驳回; |
||||
|
* approved:人工审核通过) |
||||
|
* 现在图片是同步审核的,所以图片只有auto_passed一种状态 |
||||
|
*/ |
||||
|
private String status; |
||||
|
|
||||
|
/** |
||||
|
* 失败原因 |
||||
|
*/ |
||||
|
private String reason; |
||||
|
|
||||
|
/** |
||||
|
* 语音或视频时长,秒 |
||||
|
*/ |
||||
|
private Integer duration; |
||||
|
|
||||
|
/** |
||||
|
* 删除标记 0:未删除,1:已删除 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.dto.IcPlaceAttachmentDTO; |
||||
|
import com.epmet.entity.IcPlaceAttachmentEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author yan Lu |
||||
|
* @description 描述 |
||||
|
* @create 2023/5/29 17:09 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface IcPlaceAttachmentDao extends BaseDao<IcPlaceAttachmentEntity> { |
||||
|
List<IcPlaceAttachmentDTO> selectByIcPlaceId(@Param("icPlaceId") String icEventId); |
||||
|
} |
@ -0,0 +1,75 @@ |
|||||
|
package com.epmet.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* @author yan Lu |
||||
|
* @description 描述 |
||||
|
* @create 2023/5/29 16:57 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@TableName("ic_place_org_attachment") |
||||
|
public class IcPlaceAttachmentEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 事件Id |
||||
|
*/ |
||||
|
private String icEventId; |
||||
|
|
||||
|
/** |
||||
|
* 附件名 |
||||
|
*/ |
||||
|
private String attachmentName; |
||||
|
|
||||
|
/** |
||||
|
* 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) |
||||
|
*/ |
||||
|
private String attachmentFormat; |
||||
|
|
||||
|
/** |
||||
|
* 附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) |
||||
|
*/ |
||||
|
private String attachmentType; |
||||
|
|
||||
|
/** |
||||
|
* 附件地址 |
||||
|
*/ |
||||
|
private String attachmentUrl; |
||||
|
|
||||
|
/** |
||||
|
* 排序字段 |
||||
|
*/ |
||||
|
private Integer sort; |
||||
|
|
||||
|
/** |
||||
|
* 附件状态(审核中:auditing; |
||||
|
* auto_passed: 自动通过; |
||||
|
* review:结果不确定,需要人工审核; |
||||
|
* block: 结果违规; |
||||
|
* rejected:人工审核驳回; |
||||
|
* approved:人工审核通过) |
||||
|
* 现在图片是同步审核的,所以图片只有auto_passed一种状态 |
||||
|
*/ |
||||
|
private String status; |
||||
|
|
||||
|
/** |
||||
|
* 失败原因 |
||||
|
*/ |
||||
|
private String reason; |
||||
|
|
||||
|
/** |
||||
|
* 语音或视频时长,秒 |
||||
|
*/ |
||||
|
private Integer duration; |
||||
|
} |
@ -0,0 +1,77 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.dto.IcPlaceAttachmentDTO; |
||||
|
import com.epmet.entity.IcPlaceAttachmentEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author yan Lu |
||||
|
* @description 描述 |
||||
|
* @create 2023/5/29 17:03 |
||||
|
*/ |
||||
|
public interface IcPlaceAttachmentService extends BaseService<IcPlaceAttachmentEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<IcEventAttachmentDTO> |
||||
|
* @author generator |
||||
|
* @date 2022-05-17 |
||||
|
*/ |
||||
|
PageData<IcPlaceAttachmentDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<IcEventAttachmentDTO> |
||||
|
* @author generator |
||||
|
* @date 2022-05-17 |
||||
|
*/ |
||||
|
List<IcPlaceAttachmentDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return IcEventAttachmentDTO |
||||
|
* @author generator |
||||
|
* @date 2022-05-17 |
||||
|
*/ |
||||
|
IcPlaceAttachmentDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-05-17 |
||||
|
*/ |
||||
|
void save(IcPlaceAttachmentDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-05-17 |
||||
|
*/ |
||||
|
void update(IcPlaceAttachmentDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-05-17 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
} |
@ -0,0 +1,80 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.constant.FieldConstant; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.dao.IcPlaceAttachmentDao; |
||||
|
import com.epmet.dto.IcPlaceAttachmentDTO; |
||||
|
import com.epmet.entity.IcPlaceAttachmentEntity; |
||||
|
import com.epmet.service.IcPlaceAttachmentService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author yan Lu |
||||
|
* @description 描述 |
||||
|
* @create 2023/5/29 17:07 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class IcPlaceAttachmentServiceImpl extends BaseServiceImpl<IcPlaceAttachmentDao, IcPlaceAttachmentEntity> implements IcPlaceAttachmentService { |
||||
|
|
||||
|
@Override |
||||
|
public PageData<IcPlaceAttachmentDTO> page(Map<String, Object> params) { |
||||
|
IPage<IcPlaceAttachmentEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, IcPlaceAttachmentDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<IcPlaceAttachmentDTO> list(Map<String, Object> params) { |
||||
|
List<IcPlaceAttachmentEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, IcPlaceAttachmentDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<IcPlaceAttachmentEntity> getWrapper(Map<String, Object> params) { |
||||
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<IcPlaceAttachmentEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public IcPlaceAttachmentDTO get(String id) { |
||||
|
IcPlaceAttachmentEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, IcPlaceAttachmentDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(IcPlaceAttachmentDTO dto) { |
||||
|
IcPlaceAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, IcPlaceAttachmentEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(IcPlaceAttachmentDTO dto) { |
||||
|
IcPlaceAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, IcPlaceAttachmentEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
<?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.epmet.dao.IcPlaceAttachmentDao"> |
||||
|
|
||||
|
<select id="selectByIcPlaceId" parameterType="map" resultType="com.epmet.dto.IcPlaceAttachmentDTO"> |
||||
|
SELECT |
||||
|
rea.attachment_url, |
||||
|
rea.attachment_type, |
||||
|
rea.duration |
||||
|
from ic_place_org_attachment rea |
||||
|
where rea.del_flag = '0' |
||||
|
and rea.ic_place_id = #{icPlaceId} |
||||
|
order by rea.attachment_type asc, rea.sort asc |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue