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

# Conflicts:
#	vetti-hotakes/src/main/java/com/vetti/hotake/domain/HotakeSysNoticeType.java
#	vetti-hotakes/src/main/java/com/vetti/hotake/domain/dto/HotakeSysNoticeTypeDto.java
#	vetti-hotakes/src/main/java/com/vetti/hotake/mapper/HotakeSysNoticeTypeMapper.java
#	vetti-hotakes/src/main/java/com/vetti/hotake/service/IHotakeSysNoticeTypeService.java
#	vetti-hotakes/src/main/java/com/vetti/hotake/service/impl/HotakeSysNoticeTypeServiceImpl.java
#	vetti-hotakes/src/main/resources/mapper/hotake/HotakeSysNoticeTypeMapper.xml
This commit is contained in:
2025-11-01 21:31:37 +08:00
7 changed files with 618 additions and 0 deletions

View File

@@ -0,0 +1,108 @@
package com.vetti.web.controller.hotake;
import java.util.List;
import com.vetti.hotake.domain.dto.HotakeSysNoticeTypeDto;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.vetti.common.annotation.Log;
import com.vetti.common.core.controller.BaseController;
import com.vetti.common.core.domain.AjaxResult;
import com.vetti.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.vetti.hotake.domain.HotakeSysNoticeType;
import com.vetti.hotake.service.IHotakeSysNoticeTypeService;
import com.vetti.common.utils.poi.ExcelUtil;
import com.vetti.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* 通知类型Controller
*
* @author ID
* @date 2025-11-01
*/
@Api(tags = "通知类型")
@RestController
@RequestMapping("/hotake/sysNoticeType")
public class HotakeSysNoticeTypeController extends BaseController {
@Autowired
private IHotakeSysNoticeTypeService hotakeSysNoticeTypeService;
/**
* 查询通知类型列表
*/
@ApiOperation("查询通知类型列表")
@PreAuthorize("@ss.hasPermi('hotake:sysNoticeType:list')")
@GetMapping("/list")
public TableDataInfo list(HotakeSysNoticeType hotakeSysNoticeType) {
startPage();
List<HotakeSysNoticeTypeDto> list = hotakeSysNoticeTypeService.selectHotakeSysNoticeTypeList(hotakeSysNoticeType);
return getDataTable(list);
}
@ApiOperation("查询通知类型列表")
@PreAuthorize("@ss.hasPermi('hotake:sysNoticeType:list')")
@GetMapping("/listall")
public AjaxResult listAll(HotakeSysNoticeType hotakeSysNoticeType) {
return AjaxResult.success(hotakeSysNoticeTypeService.selectHotakeSysNoticeTypeList(hotakeSysNoticeType));
}
/**
* 导出通知类型列表
*/
@ApiOperation("导出通知类型列表")
@PreAuthorize("@ss.hasPermi('hotake:sysNoticeType:export')")
@Log(title = "通知类型", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(HotakeSysNoticeType hotakeSysNoticeType) {
List<HotakeSysNoticeTypeDto> list = hotakeSysNoticeTypeService.selectHotakeSysNoticeTypeList(hotakeSysNoticeType);
ExcelUtil<HotakeSysNoticeTypeDto> util = new ExcelUtil<>(HotakeSysNoticeTypeDto.class);
return util.exportExcel(list, "通知类型数据");
}
/**
* 获取通知类型详细信息
*/
@ApiOperation("获取通知类型详细信息")
@PreAuthorize("@ss.hasPermi('hotake:sysNoticeType:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(hotakeSysNoticeTypeService.selectHotakeSysNoticeTypeById(id));
}
/**
* 新增通知类型
*/
@ApiOperation("新增通知类型")
@PreAuthorize("@ss.hasPermi('hotake:sysNoticeType:add')")
@Log(title = "通知类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestPart(value = "files", required = false) List<MultipartFile> files, HotakeSysNoticeType hotakeSysNoticeType) {
return toAjax(hotakeSysNoticeTypeService.insertHotakeSysNoticeType(files, hotakeSysNoticeType));
}
/**
* 修改通知类型
*/
@ApiOperation("修改通知类型(不修改图片不需要传files只要修改一个所有图片都需要传)")
@PreAuthorize("@ss.hasPermi('hotake:sysNoticeType:edit')")
@Log(title = "通知类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestPart(value = "files", required = false) List<MultipartFile> files, HotakeSysNoticeType hotakeSysNoticeType) {
return toAjax(hotakeSysNoticeTypeService.updateHotakeSysNoticeType(files, hotakeSysNoticeType));
}
/**
* 删除通知类型
*/
@ApiOperation("删除通知类型")
@PreAuthorize("@ss.hasPermi('hotake:sysNoticeType:remove')")
@Log(title = "通知类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(hotakeSysNoticeTypeService.deleteHotakeSysNoticeTypeByIds(ids));
}
}

View File

@@ -0,0 +1,42 @@
package com.vetti.hotake.domain;
import lombok.Data;
import lombok.experimental.Accessors;
import io.swagger.annotations.ApiModelProperty;
import com.vetti.common.annotation.Excel;
import com.vetti.common.core.domain.BaseEntity;
import java.util.List;
/**
* 通知类型对象 hotake_sys_notice_type
*
* @author ID
* @date 2025-11-01
*/
@Data
@Accessors(chain = true)
public class HotakeSysNoticeType extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
@ApiModelProperty("主键ID")
private Long id;
/** 类型名称 */
@ApiModelProperty("类型名称")
@Excel(name = "类型名称")
private String typeName;
/** 图片 */
@ApiModelProperty("图片")
@Excel(name = "图片")
private List<String> imagePath;
/** 删除状态0正常 1删除 */
@ApiModelProperty("删除状态0正常 1删除")
@Excel(name = "删除状态", readConverterExp = "0=正常,1=删除")
private String isDel;
}

View File

@@ -0,0 +1,26 @@
package com.vetti.hotake.domain.dto;
import com.vetti.common.utils.bean.BeanUtils;
import com.vetti.hotake.domain.HotakeSysNoticeType;
import lombok.Data;
import java.util.List;
/**
* @author ID
* @date 2025/11/1 11:54
*/
@Data
public class HotakeSysNoticeTypeDto extends HotakeSysNoticeType {
private List<String> imgs;
public static HotakeSysNoticeTypeDto build(List<String> urls, HotakeSysNoticeType data) {
HotakeSysNoticeTypeDto dto = new HotakeSysNoticeTypeDto();
BeanUtils.copyBeanProp(dto, data);
dto.setImgs(urls);
return dto;
}
}

View File

@@ -0,0 +1,69 @@
package com.vetti.hotake.mapper;
import java.util.List;
import com.vetti.hotake.domain.HotakeSysNoticeType;
/**
* 通知类型Mapper接口
*
* @author ID
* @date 2025-11-01
*/
public interface HotakeSysNoticeTypeMapper
{
/**
* 查询通知类型
*
* @param id 通知类型主键
* @return 通知类型
*/
public HotakeSysNoticeType selectHotakeSysNoticeTypeById(Long id);
/**
* 查询通知类型列表
*
* @param hotakeSysNoticeType 通知类型
* @return 通知类型集合
*/
public List<HotakeSysNoticeType> selectHotakeSysNoticeTypeList(HotakeSysNoticeType hotakeSysNoticeType);
/**
* 新增通知类型
*
* @param hotakeSysNoticeType 通知类型
* @return 结果
*/
public int insertHotakeSysNoticeType(HotakeSysNoticeType hotakeSysNoticeType);
/**
* 修改通知类型
*
* @param hotakeSysNoticeType 通知类型
* @return 结果
*/
public int updateHotakeSysNoticeType(HotakeSysNoticeType hotakeSysNoticeType);
/**
* 删除通知类型
*
* @param id 通知类型主键
* @return 结果
*/
public int deleteHotakeSysNoticeTypeById(Long id);
/**
* 批量删除通知类型
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteHotakeSysNoticeTypeByIds(Long[] ids);
/**
* 批量新增通知类型
*
* @param hotakeSysNoticeTypeList 通知类型列表
* @return 结果
*/
public int batchInsertHotakeSysNoticeType(List<HotakeSysNoticeType> hotakeSysNoticeTypeList);
}

View File

@@ -0,0 +1,72 @@
package com.vetti.hotake.service;
import java.util.List;
import com.vetti.hotake.domain.HotakeSysNoticeType;
import com.vetti.hotake.domain.dto.HotakeSysNoticeTypeDto;
import org.springframework.web.multipart.MultipartFile;
/**
* 通知类型Service接口
*
* @author ID
* @date 2025-11-01
*/
public interface IHotakeSysNoticeTypeService {
/**
* 查询通知类型
*
* @param id 通知类型主键
* @return 通知类型
*/
public HotakeSysNoticeTypeDto selectHotakeSysNoticeTypeById(Long id);
/**
* 查询通知类型列表
*
* @param hotakeSysNoticeType 通知类型
* @return 通知类型集合
*/
public List<HotakeSysNoticeTypeDto> selectHotakeSysNoticeTypeList(HotakeSysNoticeType hotakeSysNoticeType);
/**
* 新增通知类型
*
* @param hotakeSysNoticeType 通知类型
* @return 结果
*/
public int insertHotakeSysNoticeType(List<MultipartFile> files, HotakeSysNoticeType hotakeSysNoticeType);
/**
* 修改通知类型
*
* @param hotakeSysNoticeType 通知类型
* @return 结果
*/
public int updateHotakeSysNoticeType(List<MultipartFile> files,HotakeSysNoticeType hotakeSysNoticeType);
/**
* 批量删除通知类型
*
* @param ids 需要删除的通知类型主键集合
* @return 结果
*/
public int deleteHotakeSysNoticeTypeByIds(Long[] ids);
/**
* 删除通知类型信息
*
* @param id 通知类型主键
* @return 结果
*/
public int deleteHotakeSysNoticeTypeById(Long id);
/**
* 批量新增通知类型
*
* @param hotakeSysNoticeTypeList 通知类型列表
* @return 结果
*/
public int batchInsertHotakeSysNoticeType(List<HotakeSysNoticeType> hotakeSysNoticeTypeList);
}

View File

@@ -0,0 +1,192 @@
package com.vetti.hotake.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import cn.hutool.core.collection.CollectionUtil;
import com.vetti.common.constant.SysDictDataConstants;
import com.vetti.common.core.service.BaseServiceImpl;
import com.vetti.common.enums.FillTypeEnum;
import com.vetti.common.utils.DateUtils;
import com.vetti.hotake.domain.HotakeSysFile;
import com.vetti.hotake.domain.dto.HotakeSysNoticeTypeDto;
import com.vetti.hotake.service.IHotakeSysFileService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.vetti.hotake.mapper.HotakeSysNoticeTypeMapper;
import com.vetti.hotake.domain.HotakeSysNoticeType;
import com.vetti.hotake.service.IHotakeSysNoticeTypeService;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
/**
* 通知类型Service业务层处理
*
* @author ID
* @date 2025-11-01
*/
@SuppressWarnings("all")
@Service
public class HotakeSysNoticeTypeServiceImpl extends BaseServiceImpl implements IHotakeSysNoticeTypeService {
@Autowired
private HotakeSysNoticeTypeMapper hotakeSysNoticeTypeMapper;
@Autowired
IHotakeSysFileService hotakeSysFileService;
private final String MINIO_BUCKET_NAME = "noticetype-fs";
/**
* 查询通知类型
*
* @param id 通知类型主键
* @return 通知类型
*/
@Transactional(readOnly = true)
@Override
public HotakeSysNoticeTypeDto selectHotakeSysNoticeTypeById(Long id) {
HotakeSysNoticeType data = hotakeSysNoticeTypeMapper.selectHotakeSysNoticeTypeById(id);
List<String> urls = new ArrayList<>();
if (data != null) {
if (CollectionUtil.isNotEmpty(data.getImagePath())) {
Map<Long, String> m = hotakeSysFileService.url(
data.getImagePath().stream().map(s -> Long.parseLong(s)).toArray(Long[]::new)
);
if (CollectionUtil.isNotEmpty(m)) {
m.forEach((k, v) -> urls.add(v));
}
}
}
return HotakeSysNoticeTypeDto.build(urls, data);
}
/**
* 查询通知类型列表
*
* @param hotakeSysNoticeType 通知类型
* @return 通知类型
*/
@Transactional(readOnly = true)
@Override
public List<HotakeSysNoticeTypeDto> selectHotakeSysNoticeTypeList(HotakeSysNoticeType hotakeSysNoticeType) {
List<HotakeSysNoticeTypeDto> reList = new ArrayList<>();
hotakeSysNoticeType.setIsDel("0");
List<HotakeSysNoticeType> list = hotakeSysNoticeTypeMapper.selectHotakeSysNoticeTypeList(hotakeSysNoticeType);
if (CollectionUtil.isNotEmpty(list)) {
list.forEach(e -> {
List<String> urls = new ArrayList<>();
if (CollectionUtil.isNotEmpty(e.getImagePath())) {
Map<Long, String> m = hotakeSysFileService.url(
e.getImagePath().stream().map(s -> Long.parseLong(s)).toArray(Long[]::new)
);
if (CollectionUtil.isNotEmpty(m)) {
m.forEach((k, v) -> urls.add(v));
}
}
reList.add(HotakeSysNoticeTypeDto.build(urls, e));
});
}
return reList;
}
/**
* 新增通知类型
*
* @param hotakeSysNoticeType 通知类型
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int insertHotakeSysNoticeType(List<MultipartFile> files, HotakeSysNoticeType hotakeSysNoticeType) {
fill(FillTypeEnum.INSERT.getCode(), hotakeSysNoticeType);
if (CollectionUtil.isNotEmpty(files)) {
List<String> l = new ArrayList();
for (MultipartFile file : files) {
HotakeSysFile sf = uploadFile(file);
l.add(sf.getId() + "");
}
hotakeSysNoticeType.setImagePath(l);
}
return hotakeSysNoticeTypeMapper.insertHotakeSysNoticeType(hotakeSysNoticeType);
}
private HotakeSysFile uploadFile(MultipartFile file) {
HotakeSysFile commandSysFile = new HotakeSysFile();
commandSysFile.setCode(System.currentTimeMillis() + "");
commandSysFile.setMinioBucketName(MINIO_BUCKET_NAME);
return hotakeSysFileService.insertHotakeSysFile(file, commandSysFile);
}
/**
* 修改通知类型
*
* @param hotakeSysNoticeType 通知类型
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int updateHotakeSysNoticeType(List<MultipartFile> files, HotakeSysNoticeType hotakeSysNoticeType) {
fill(FillTypeEnum.UPDATE.getCode(), hotakeSysNoticeType);
if (CollectionUtils.isNotEmpty(files)) {
List<String> l = new ArrayList();
for (MultipartFile file : files) {
HotakeSysFile sf = uploadFile(file);
l.add(sf.getId() + "");
}
hotakeSysNoticeType.setImagePath(l);
}
return hotakeSysNoticeTypeMapper.updateHotakeSysNoticeType(hotakeSysNoticeType);
}
/**
* 批量删除通知类型
*
* @param ids 需要删除的通知类型主键
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int deleteHotakeSysNoticeTypeByIds(Long[] ids) {
if (ids != null && ids.length > 0) {
for (Long id : ids) {
HotakeSysNoticeType hotakeSysNoticeType = selectHotakeSysNoticeTypeById(id);
hotakeSysNoticeType.setIsDel("1");
fill(FillTypeEnum.UPDATE.getCode(), hotakeSysNoticeType);
hotakeSysNoticeTypeMapper.updateHotakeSysNoticeType(hotakeSysNoticeType);
}
}
return 1;
}
/**
* 删除通知类型信息
*
* @param id 通知类型主键
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int deleteHotakeSysNoticeTypeById(Long id) {
HotakeSysNoticeType hotakeSysNoticeType = selectHotakeSysNoticeTypeById(id);
hotakeSysNoticeType.setIsDel("1");
fill(FillTypeEnum.UPDATE.getCode(), hotakeSysNoticeType);
return hotakeSysNoticeTypeMapper.updateHotakeSysNoticeType(hotakeSysNoticeType);
}
/**
* 批量新增通知类型
*
* @param hotakeSysNoticeTypeList 通知类型列表
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int batchInsertHotakeSysNoticeType(List<HotakeSysNoticeType> hotakeSysNoticeTypeList) {
return hotakeSysNoticeTypeMapper.batchInsertHotakeSysNoticeType(hotakeSysNoticeTypeList);
}
}

View File

@@ -0,0 +1,109 @@
<?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.vetti.hotake.mapper.HotakeSysNoticeTypeMapper">
<resultMap type="HotakeSysNoticeType" id="HotakeSysNoticeTypeResult">
<result property="id" column="id"/>
<result property="typeName" column="type_name"/>
<result property="imagePath" column="image_path" typeHandler="com.vetti.common.handle.JsonTypeHandler"/>
<result property="isDel" column="is_del"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectHotakeSysNoticeTypeVo">
select id,
type_name,
image_path,
is_del,
create_by,
create_time,
update_by,
update_time,
remark
from hotake_sys_notice_type
</sql>
<select id="selectHotakeSysNoticeTypeList" parameterType="HotakeSysNoticeType"
resultMap="HotakeSysNoticeTypeResult">
<include refid="selectHotakeSysNoticeTypeVo"/>
<where>
<if test="typeName != null and typeName != ''">and type_name like concat('%', #{typeName}, '%')</if>
<if test="imagePath != null and imagePath != ''">and image_path = #{imagePath}</if>
<if test="isDel != null and isDel != ''">and is_del = #{isDel}</if>
</where>
</select>
<select id="selectHotakeSysNoticeTypeById" parameterType="Long" resultMap="HotakeSysNoticeTypeResult">
<include refid="selectHotakeSysNoticeTypeVo"/>
where id = #{id}
</select>
<insert id="insertHotakeSysNoticeType" parameterType="HotakeSysNoticeType" useGeneratedKeys="true" keyProperty="id">
insert into hotake_sys_notice_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeName != null">type_name,</if>
<if test="imagePath != null">image_path,</if>
<if test="isDel != null">is_del,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeName != null">#{typeName},</if>
<if test="imagePath != null">#{imagePath, typeHandler=com.vetti.common.handle.JsonTypeHandler},</if>
<if test="isDel != null">#{isDel},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateHotakeSysNoticeType" parameterType="HotakeSysNoticeType">
update hotake_sys_notice_type
<trim prefix="SET" suffixOverrides=",">
<if test="typeName != null">type_name = #{typeName},</if>
<if test="imagePath != null">image_path =
#{imagePath, typeHandler=com.vetti.common.handle.JsonTypeHandler},
</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteHotakeSysNoticeTypeById" parameterType="Long">
delete
from hotake_sys_notice_type
where id = #{id}
</delete>
<delete id="deleteHotakeSysNoticeTypeByIds" parameterType="String">
delete from hotake_sys_notice_type where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="batchInsertHotakeSysNoticeType">
insert into hotake_sys_notice_type( id, type_name, image_path, is_del, create_by, create_time, update_by,
update_time, remark,) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.typeName}, #{item.imagePath, typeHandler=com.vetti.common.handle.JsonTypeHandler},
#{item.isDel}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark},)
</foreach>
</insert>
</mapper>