This commit is contained in:
PQZ 2025-04-01 10:22:04 +08:00
parent 4eeab0fa44
commit 3c63b2b487
6 changed files with 237 additions and 0 deletions

View File

@ -0,0 +1,106 @@
package com.ruoyi.busi.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.busi.domain.BusiSubscribe;
import com.ruoyi.busi.service.IBusiSubscribeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 订阅Controller
*
* @author pqz
* @date 2025-04-01
*/
@RestController
@RequestMapping("/busi/subscribe")
public class BusiSubscribeController extends BaseController
{
@Autowired
private IBusiSubscribeService busiSubscribeService;
/**
* 查询订阅列表
*/
@GetMapping("/list")
public AjaxResult list(BusiSubscribe busiSubscribe,
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize)
{
Page<BusiSubscribe> page = new Page<>(pageNum, pageSize);
IPage<BusiSubscribe> list = busiSubscribeService.queryListPage(busiSubscribe,page);
return success(list);
}
/**
* 导出订阅列表
*/
@Log(title = "订阅", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BusiSubscribe busiSubscribe)
{
List<BusiSubscribe> list = busiSubscribeService.list();
ExcelUtil<BusiSubscribe> util = new ExcelUtil<BusiSubscribe>(BusiSubscribe.class);
util.exportExcel(response, list, "订阅数据");
}
/**
* 获取订阅详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(busiSubscribeService.getById(id));
}
/**
* 新增订阅
*/
@Log(title = "订阅", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BusiSubscribe busiSubscribe)
{
return toAjax(busiSubscribeService.save(busiSubscribe));
}
/**
* 修改订阅
*/
@Log(title = "订阅", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BusiSubscribe busiSubscribe)
{
return toAjax(busiSubscribeService.updateById(busiSubscribe));
}
/**
* 删除订阅
*/
@Log(title = "订阅", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
List<String> list = new ArrayList<>(Arrays.asList(ids));
return toAjax(busiSubscribeService.removeByIds(list));
}
}

View File

@ -0,0 +1,35 @@
package com.ruoyi.busi.domain;
import com.ruoyi.common.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import com.ruoyi.common.core.domain.DlBaseEntity;
/**
* 请填写功能名称对象 dl_busi_subscribe
*
* @author pqz
* @date 2025-04-01
*/
@TableName("dl_busi_subscribe")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BusiSubscribe extends DlBaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String jsonObj;
}

View File

@ -0,0 +1,21 @@
package com.ruoyi.busi.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.busi.domain.BusiSubscribe;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 订阅Mapper接口
*
* @author pqz
* @date 2025-04-01
*/
@Mapper
public interface BusiSubscribeMapper extends BaseMapper<BusiSubscribe>
{
IPage<BusiSubscribe> queryListPage(@Param("entity") BusiSubscribe entity, Page<BusiSubscribe> page);
}

View File

@ -0,0 +1,18 @@
package com.ruoyi.busi.service;
import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.busi.domain.BusiSubscribe;
/**
* 订阅Service接口
*
* @author pqz
* @date 2025-04-01
*/
public interface IBusiSubscribeService extends IService<BusiSubscribe>
{
IPage<BusiSubscribe> queryListPage(BusiSubscribe pageReqVO, Page<BusiSubscribe> page);
}

View File

@ -0,0 +1,30 @@
package com.ruoyi.busi.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.busi.mapper.BusiSubscribeMapper;
import com.ruoyi.busi.domain.BusiSubscribe;
import com.ruoyi.busi.service.IBusiSubscribeService;
/**
* 订阅Service业务层处理
*
* @author pqz
* @date 2025-04-01
*/
@Service
public class BusiSubscribeServiceImpl extends ServiceImpl<BusiSubscribeMapper,BusiSubscribe> implements IBusiSubscribeService
{
@Autowired
private BusiSubscribeMapper busiSubscribeMapper;
@Override
public IPage<BusiSubscribe> queryListPage(BusiSubscribe pageReqVO, Page<BusiSubscribe> page) {
return busiSubscribeMapper.queryListPage(pageReqVO, page);
}
}

View File

@ -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="com.ruoyi.busi.mapper.BusiSubscribeMapper">
<resultMap type="BusiSubscribe" id="BusiSubscribeResult">
<result property="id" column="id" />
<result property="jsonObj" column="json_obj" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="creator" column="creator" />
<result property="updater" column="updater" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectBusiSubscribeVo">
select id, json_obj, create_time, update_time, creator, updater, del_flag from dl_busi_subscribe
</sql>
<select id="queryListPage" parameterType="BusiSubscribe" resultMap="BusiSubscribeResult">
<include refid="selectBusiSubscribeVo"/>
<where>
<if test="entity.jsonObj != null and entity.jsonObj != ''"> and json_obj = #{entity.jsonObj}</if>
</where>
</select>
</mapper>