This commit is contained in:
alittlekang 2024-11-30 22:36:50 +08:00
parent 2a3d36a7b0
commit 9eee085d49
6 changed files with 449 additions and 0 deletions

View File

@ -0,0 +1,104 @@
package com.ruoyi.system.controller.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
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.system.domain.Fee;
import com.ruoyi.system.service.IFeeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* FeeController
*
* @author ruoyi
* @date 2024-11-30
*/
@RestController
@RequestMapping("/system/Fee")
public class FeeController extends BaseController
{
@Autowired
private IFeeService feeService;
/**
* 查询Fee列表
*/
@PreAuthorize("@ss.hasPermi('system:Fee:list')")
@GetMapping("/list")
public TableDataInfo list(Fee fee)
{
startPage();
List<Fee> list = feeService.selectFeeList(fee);
return getDataTable(list);
}
/**
* 导出Fee列表
*/
@PreAuthorize("@ss.hasPermi('system:Fee:export')")
@Log(title = "Fee", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Fee fee)
{
List<Fee> list = feeService.selectFeeList(fee);
ExcelUtil<Fee> util = new ExcelUtil<Fee>(Fee.class);
util.exportExcel(response, list, "Fee数据");
}
/**
* 获取Fee详细信息
*/
@PreAuthorize("@ss.hasPermi('system:Fee:query')")
@GetMapping(value = "/{sort}")
public AjaxResult getInfo(@PathVariable("sort") String sort)
{
return success(feeService.selectFeeBySort(sort));
}
/**
* 新增Fee
*/
@PreAuthorize("@ss.hasPermi('system:Fee:add')")
@Log(title = "Fee", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Fee fee)
{
return toAjax(feeService.insertFee(fee));
}
/**
* 修改Fee
*/
@PreAuthorize("@ss.hasPermi('system:Fee:edit')")
@Log(title = "Fee", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Fee fee)
{
return toAjax(feeService.updateFee(fee));
}
/**
* 删除Fee
*/
@PreAuthorize("@ss.hasPermi('system:Fee:remove')")
@Log(title = "Fee", businessType = BusinessType.DELETE)
@DeleteMapping("/{sorts}")
public AjaxResult remove(@PathVariable String[] sorts)
{
return toAjax(feeService.deleteFeeBySorts(sorts));
}
}

View File

@ -0,0 +1,66 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* Fee对象 Fee
*
* @author ruoyi
* @date 2024-11-30
*/
public class Fee extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String sort;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long fee;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long number;
public void setSort(String sort)
{
this.sort = sort;
}
public String getSort()
{
return sort;
}
public void setFee(Long fee)
{
this.fee = fee;
}
public Long getFee()
{
return fee;
}
public void setNumber(Long number)
{
this.number = number;
}
public Long getNumber()
{
return number;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("sort", getSort())
.append("fee", getFee())
.append("number", getNumber())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.Fee;
/**
* FeeMapper接口
*
* @author ruoyi
* @date 2024-11-30
*/
public interface FeeMapper
{
/**
* 查询Fee
*
* @param sort Fee主键
* @return Fee
*/
public Fee selectFeeBySort(String sort);
/**
* 查询Fee列表
*
* @param fee Fee
* @return Fee集合
*/
public List<Fee> selectFeeList(Fee fee);
/**
* 新增Fee
*
* @param fee Fee
* @return 结果
*/
public int insertFee(Fee fee);
/**
* 修改Fee
*
* @param fee Fee
* @return 结果
*/
public int updateFee(Fee fee);
/**
* 删除Fee
*
* @param sort Fee主键
* @return 结果
*/
public int deleteFeeBySort(String sort);
/**
* 批量删除Fee
*
* @param sorts 需要删除的数据主键集合
* @return 结果
*/
public int deleteFeeBySorts(String[] sorts);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.Fee;
/**
* FeeService接口
*
* @author ruoyi
* @date 2024-11-30
*/
public interface IFeeService
{
/**
* 查询Fee
*
* @param sort Fee主键
* @return Fee
*/
public Fee selectFeeBySort(String sort);
/**
* 查询Fee列表
*
* @param fee Fee
* @return Fee集合
*/
public List<Fee> selectFeeList(Fee fee);
/**
* 新增Fee
*
* @param fee Fee
* @return 结果
*/
public int insertFee(Fee fee);
/**
* 修改Fee
*
* @param fee Fee
* @return 结果
*/
public int updateFee(Fee fee);
/**
* 批量删除Fee
*
* @param sorts 需要删除的Fee主键集合
* @return 结果
*/
public int deleteFeeBySorts(String[] sorts);
/**
* 删除Fee信息
*
* @param sort Fee主键
* @return 结果
*/
public int deleteFeeBySort(String sort);
}

View File

@ -0,0 +1,93 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.FeeMapper;
import com.ruoyi.system.domain.Fee;
import com.ruoyi.system.service.IFeeService;
/**
* FeeService业务层处理
*
* @author ruoyi
* @date 2024-11-30
*/
@Service
public class FeeServiceImpl implements IFeeService
{
@Autowired
private FeeMapper feeMapper;
/**
* 查询Fee
*
* @param sort Fee主键
* @return Fee
*/
@Override
public Fee selectFeeBySort(String sort)
{
return feeMapper.selectFeeBySort(sort);
}
/**
* 查询Fee列表
*
* @param fee Fee
* @return Fee
*/
@Override
public List<Fee> selectFeeList(Fee fee)
{
return feeMapper.selectFeeList(fee);
}
/**
* 新增Fee
*
* @param fee Fee
* @return 结果
*/
@Override
public int insertFee(Fee fee)
{
return feeMapper.insertFee(fee);
}
/**
* 修改Fee
*
* @param fee Fee
* @return 结果
*/
@Override
public int updateFee(Fee fee)
{
return feeMapper.updateFee(fee);
}
/**
* 批量删除Fee
*
* @param sorts 需要删除的Fee主键
* @return 结果
*/
@Override
public int deleteFeeBySorts(String[] sorts)
{
return feeMapper.deleteFeeBySorts(sorts);
}
/**
* 删除Fee信息
*
* @param sort Fee主键
* @return 结果
*/
@Override
public int deleteFeeBySort(String sort)
{
return feeMapper.deleteFeeBySort(sort);
}
}

View File

@ -0,0 +1,64 @@
<?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.system.mapper.FeeMapper">
<resultMap type="Fee" id="FeeResult">
<result property="sort" column="sort" />
<result property="fee" column="fee" />
<result property="number" column="number" />
</resultMap>
<sql id="selectFeeVo">
select sort, fee, number from Fee
</sql>
<select id="selectFeeList" parameterType="Fee" resultMap="FeeResult">
<include refid="selectFeeVo"/>
<where>
<if test="sort != null and sort != ''"> and sort = #{sort}</if>
<if test="fee != null "> and fee = #{fee}</if>
<if test="number != null "> and number = #{number}</if>
</where>
</select>
<select id="selectFeeBySort" parameterType="String" resultMap="FeeResult">
<include refid="selectFeeVo"/>
where sort = #{sort}
</select>
<insert id="insertFee" parameterType="Fee">
insert into Fee
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sort != null">sort,</if>
<if test="fee != null">fee,</if>
<if test="number != null">number,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sort != null">#{sort},</if>
<if test="fee != null">#{fee},</if>
<if test="number != null">#{number},</if>
</trim>
</insert>
<update id="updateFee" parameterType="Fee">
update Fee
<trim prefix="SET" suffixOverrides=",">
<if test="fee != null">fee = #{fee},</if>
<if test="number != null">number = #{number},</if>
</trim>
where sort = #{sort}
</update>
<delete id="deleteFeeBySort" parameterType="String">
delete from Fee where sort = #{sort}
</delete>
<delete id="deleteFeeBySorts" parameterType="String">
delete from Fee where sort in
<foreach item="sort" collection="array" open="(" separator="," close=")">
#{sort}
</foreach>
</delete>
</mapper>