Commit b41f3e97 authored by liwei's avatar liwei

生成了意见反馈代码

parent 942bd075
package org.rcisoft.business.memFeedBack.controller;
/*固定导入*/
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.Operation;
import org.rcisoft.business.memFeedBack.entity.MemFeedback;
import org.rcisoft.business.memFeedBack.service.MemFeedbackService;
import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
import org.rcisoft.core.util.CyEpExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.exception.CyServiceException;
import jakarta.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;
/**
* Created by cy on 2025年2月24日 下午5:16:32.
*/
@RestController
@RequestMapping("/memfeedback")
public class MemFeedbackController extends CyPaginationController<MemFeedback> {
@Autowired
private MemFeedbackService memFeedbackServiceImpl;
@PreAuthorize("@cyPerm.hasPerm('mem:feedback:add')")
@CyOpeLogAnno(title = "system-意见反馈管理-新增意见反馈", businessType = CyLogTypeEnum.INSERT)
@Operation(summary="添加意见反馈", description="添加意见反馈")
@PostMapping(value = "/add")
public CyResult add(@Valid MemFeedback memFeedback, BindingResult bindingResult) {
CyPersistModel data = memFeedbackServiceImpl.persist(memFeedback);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
memFeedback);
}
@PreAuthorize("@cyPerm.hasPerm('mem:feedback:delete')")
@CyOpeLogAnno(title = "system-意见反馈管理-删除意见反馈", businessType = CyLogTypeEnum.DELETE)
@Operation(summary="逻辑删除意见反馈", description="逻辑删除意见反馈")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = true, schema = @Schema(type = "string"))})
@DeleteMapping("/deleteLogical/{businessId:\\w+}")
public CyResult deleteLogical(@PathVariable int businessId,MemFeedback memFeedback) {
memFeedback.setBusinessId(businessId);
CyPersistModel data = memFeedbackServiceImpl.removeLogical(memFeedback);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
@PreAuthorize("@cyPerm.hasPerm('mem:feedback:delete')")
@CyOpeLogAnno(title = "system-意见反馈管理-删除意见反馈", businessType = CyLogTypeEnum.DELETE)
@Operation(summary="删除意见反馈", description="删除意见反馈")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = true, schema = @Schema(type = "string"))})
@DeleteMapping("/delete/{businessId:\\w+}")
public CyResult delete(@PathVariable int businessId,MemFeedback memFeedback) {
memFeedback.setBusinessId(businessId);
CyPersistModel data = memFeedbackServiceImpl.remove(memFeedback);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
@PreAuthorize("@cyPerm.hasPerm('mem:feedback:update')")
@CyOpeLogAnno(title = "system-意见反馈管理-修改意见反馈", businessType = CyLogTypeEnum.UPDATE)
@Operation(summary="修改意见反馈", description="修改意见反馈")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = false, schema = @Schema(type = "string"))})
@PutMapping("/update/{businessId:\\w+}")
public CyResult update(@PathVariable int businessId, @Valid MemFeedback memFeedback, BindingResult bindingResult) {
memFeedback.setBusinessId(businessId);
CyPersistModel data = memFeedbackServiceImpl.merge(memFeedback);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
memFeedback);
}
@PreAuthorize("@cyPerm.hasPerm('mem:feedback:detail')")
@CyOpeLogAnno(title = "system-意见反馈管理-查询意见反馈", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="查询单一意见反馈", description="查询单一意见反馈")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = true, schema = @Schema(type = "string"))})
@GetMapping("/detail/{businessId:\\w+}")
public CyResult detail(@PathVariable int businessId) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
memFeedbackServiceImpl.findById(businessId));
}
@PreAuthorize("@cyPerm.hasPerm('mem:feedback:list')")
@CyOpeLogAnno(title = "system-意见反馈管理-查询意见反馈", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="查询意见反馈集合", description="查询意见反馈集合")
@GetMapping(value = "/listAll")
public CyResult listAll(MemFeedback memFeedback) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
memFeedbackServiceImpl.findAll(memFeedback));
}
@PreAuthorize("@cyPerm.hasPerm('mem:feedback:list')")
@CyOpeLogAnno(title = "system-意见反馈管理-查询意见反馈", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="分页查询意见反馈集合", description="分页查询意见反馈集合")
@GetMapping(value = "/list")
public CyGridModel listByPagination(MemFeedback memFeedback) {
memFeedbackServiceImpl.findAllByPagination(getPaginationUtility(), memFeedback);
return getGridModelResponse();
}
@CyOpeLogAnno(title = "system-意见反馈管理-查询意见反馈", businessType = CyLogTypeEnum.EXPORT)
@Operation(summary = "导出意见反馈信息", description = "导出意见反馈信息")
@GetMapping(value = "/export")
public void outMemFeedback(HttpServletResponse response,MemFeedback memFeedback,@PathVariable @RequestParam(defaultValue = "0") String excelId) {
String excelName="";
switch(excelId){
case "0": excelName="意见反馈信息.xls";break;
case "1": excelName="意见反馈信息.xlsx";break;
case "2": excelName="意见反馈信息.csv";break;
}
List<MemFeedback> memFeedbackList = memFeedbackServiceImpl.export(memFeedback);
CyEpExcelUtil.exportExcel(memFeedbackList, "意见反馈信息", "意见反馈信息", MemFeedback.class, excelName, response);
}
}
package org.rcisoft.business.memFeedBack.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.rcisoft.business.memFeedBack.entity.MemFeedback;
import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.core.model.CyPageInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Created with cy on 2025年2月24日 下午5:16:32.
*/
public interface MemFeedbackRepository extends CyBaseMapper<MemFeedback> {
List<MemFeedback> queryMemFeedbacks(@Param("entity") MemFeedback memFeedback);
/**
* 分页查询 memFeedback
*
*/
IPage<MemFeedback> queryMemFeedbacksPaged(CyPageInfo cyPageInfo, @Param("entity") MemFeedback memFeedback);
}
package org.rcisoft.business.memFeedBack.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import org.rcisoft.core.entity.CyIdIncreEntity;
/**
* Created with cy on 2025年2月24日 下午5:16:32.
*/
@Data
@TableName("mem_feedback")
public class MemFeedback extends CyIdIncreEntity<MemFeedback> {
/**
* @desc 反馈类型
* @column feedback_type
* @default
*/
@Excel(name = "反馈类型", orderNum = "0", width = 20)
private String feedbackType;
/**
* @desc 标题
* @column title
* @default
*/
@Excel(name = "标题", orderNum = "1", width = 20)
private String title;
/**
* @desc 内容
* @column content
* @default
*/
@Excel(name = "内容", orderNum = "2", width = 20)
private String content;
}
package org.rcisoft.business.memFeedBack.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.rcisoft.business.memFeedBack.entity.MemFeedback;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPageInfo;
import java.util.List;
/**
* Created by cy on 2025年2月24日 下午5:16:32.
*/
public interface MemFeedbackService {
/**
* 保存 意见反馈
* @param memFeedback
* @return
*/
CyPersistModel persist(MemFeedback memFeedback);
/**
* 删除 意见反馈
* @param memFeedback
* @return
*/
CyPersistModel remove(MemFeedback memFeedback);
/**
* 逻辑删除 意见反馈
* @param memFeedback
* @return
*/
CyPersistModel removeLogical(MemFeedback memFeedback);
/**
* 修改 意见反馈
* @param memFeedback
* @return
*/
CyPersistModel merge(MemFeedback memFeedback);
/**
* 根据id查询 意见反馈
* @param id
* @return
*/
MemFeedback findById(int id);
/**
* 分页查询 意见反馈
* @param memFeedback
* @return
*/
IPage<MemFeedback> findAllByPagination(CyPageInfo<MemFeedback> paginationUtility,
MemFeedback memFeedback);
/**
* 查询list 意见反馈
* @param memFeedback
* @return
*/
List<MemFeedback> findAll(MemFeedback memFeedback);
/**
* 导出意见反馈
* @return
*/
List<MemFeedback> export(MemFeedback memFeedback);
}
package org.rcisoft.business.memFeedBack.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.memFeedBack.dao.MemFeedbackRepository;
import org.rcisoft.business.memFeedBack.entity.MemFeedback;
import org.rcisoft.business.memFeedBack.service.MemFeedbackService;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.util.CyUserUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* Created by cy on 2025年2月24日 下午5:16:32.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class MemFeedbackServiceImpl extends ServiceImpl<MemFeedbackRepository, MemFeedback> implements MemFeedbackService {
/**
* 保存 意见反馈
* @param memFeedback
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel persist(MemFeedback memFeedback){
//增加操作
int line = baseMapper.insert(memFeedback);
log.debug(CyUserUtil.getAuthenUsername()+"新增了ID为"+
memFeedback.getBusinessId()+"的意见反馈信息");
return new CyPersistModel(line);
}
/**
* 删除 意见反馈
* @param memFeedback
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel remove(MemFeedback memFeedback){
int line = baseMapper.realDelete(memFeedback);
log.debug(CyUserUtil.getAuthenUsername()+"删除了ID为"+
memFeedback.getBusinessId()+"的意见反馈信息");
return new CyPersistModel(line);
}
/**
* 逻辑删除 意见反馈
* @param memFeedback
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel removeLogical(MemFeedback memFeedback){
memFeedback.setDeleted();
int line = baseMapper.deleteById(memFeedback);
log.debug(CyUserUtil.getAuthenUsername()+"逻辑删除了ID为"+
memFeedback.getBusinessId()+"的意见反馈信息");
return new CyPersistModel(line);
}
/**
* 修改 意见反馈
* @param memFeedback
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel merge(MemFeedback memFeedback){
int line = baseMapper.updateById(memFeedback);
log.debug(CyUserUtil.getAuthenUsername()+"修改了ID为"+ memFeedback.getBusinessId()+"的意见反馈信息");
return new CyPersistModel(line);
}
/**
* 根据id查询 意见反馈
* @param id
* @return
*/
@Override
public MemFeedback findById(int id){
return baseMapper.selectById(id);
}
/**
* 分页查询 意见反馈
* @param memFeedback
* @return
*/
@Override
public IPage<MemFeedback> findAllByPagination(CyPageInfo<MemFeedback> paginationUtility,
MemFeedback memFeedback){
return baseMapper.queryMemFeedbacksPaged(paginationUtility,memFeedback);
}
/**
* 查询list 意见反馈
* @param memFeedback
* @return
*/
@Override
public List<MemFeedback> findAll(MemFeedback memFeedback){
return baseMapper.queryMemFeedbacks(memFeedback);
}
/**
* 导出意见反馈
* @return
*/
@Override
public List<MemFeedback> export(MemFeedback memFeedback) {
List<MemFeedback> memFeedbackList = baseMapper.queryMemFeedbacks(memFeedback);
return memFeedbackList;
}
}
<?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="org.rcisoft.business.memFeedBack.dao.MemFeedbackRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.memFeedBack.entity.MemFeedback">
<id column="business_id" jdbcType="BIGINT" property="businessId"/>
<result column="feedback_type" jdbcType="VARCHAR" property="feedbackType"/>
<result column="title" jdbcType="VARCHAR" property="title"/>
<result column="content" jdbcType="VARCHAR" property="content"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
</resultMap>
<select id="queryMemFeedbacks" resultMap="BaseResultMap">
select * from mem_feedback
where 1=1
and del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' ">
and flag = #{entity.flag}
</if>
<if test="entity.feedbackType !=null and entity.feedbackType != '' ">
and feedback_type like concat('%',#{entity.feedbackType},'%')
</if>
<if test="entity.title !=null and entity.title != '' ">
and title like concat('%',#{entity.title},'%')
</if>
<if test="entity.content !=null and entity.content != '' ">
and content like concat('%',#{entity.content},'%')
</if>
ORDER BY business_id DESC
</select>
<select id="queryMemFeedbacksPaged" resultMap="BaseResultMap">
select * from mem_feedback
where 1=1
and del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' ">
and flag = #{entity.flag}
</if>
<if test="entity.feedbackType !=null and entity.feedbackType != '' ">
and feedback_type like concat('%',#{entity.feedbackType},'%')
</if>
<if test="entity.title !=null and entity.title != '' ">
and title like concat('%',#{entity.title},'%')
</if>
<if test="entity.content !=null and entity.content != '' ">
and content like concat('%',#{entity.content},'%')
</if>
ORDER BY business_id DESC
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment