API收费标准建表
This commit is contained in:
parent
734c33dc18
commit
50b70e14ce
|
@ -41,14 +41,16 @@ public class ${ClassName} extends ${Entity}
|
|||
#end
|
||||
#if($parentheseIndex != -1)
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
@ApiModelProperty("${comment}")
|
||||
#elseif($column.javaType == 'Date')
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("${comment}")
|
||||
#else
|
||||
@Excel(name = "${comment}")
|
||||
#end
|
||||
#end
|
||||
@ApiModelProperty("${comment}")
|
||||
#end
|
||||
#end
|
||||
private $column.javaType $column.javaField;
|
||||
|
||||
#end
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package com.ruoyi.ss.apiPrice.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
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;
|
||||
|
||||
/**
|
||||
* API收费标准对象 ss_api_price
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
@Data
|
||||
public class ApiPrice extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@Excel(name = "类型")
|
||||
@ApiModelProperty("类型")
|
||||
private String type;
|
||||
|
||||
@Excel(name = "数值")
|
||||
@ApiModelProperty("数值")
|
||||
private Long num;
|
||||
|
||||
@Excel(name = "单位")
|
||||
@ApiModelProperty("单位")
|
||||
private String unit;
|
||||
|
||||
@Excel(name = "标准名称")
|
||||
@ApiModelProperty("标准名称")
|
||||
private String name;
|
||||
|
||||
@Excel(name = "标准描述")
|
||||
@ApiModelProperty("标准描述")
|
||||
private String description;
|
||||
|
||||
@Excel(name = "价格", readConverterExp = "元=")
|
||||
@ApiModelProperty("价格")
|
||||
private BigDecimal price;
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.ruoyi.ss.apiPrice.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/8/8
|
||||
*/
|
||||
@Data
|
||||
public class ApiPriceQuery extends ApiPriceVO{
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.ruoyi.ss.apiPrice.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/8/8
|
||||
*/
|
||||
@Data
|
||||
public class ApiPriceVO extends ApiPrice{
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package com.ruoyi.ss.apiPrice.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.ss.apiPrice.domain.ApiPrice;
|
||||
import com.ruoyi.ss.apiPrice.domain.ApiPriceVO;
|
||||
import com.ruoyi.ss.apiPrice.domain.ApiPriceQuery;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* API收费标准Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
public interface ApiPriceMapper
|
||||
{
|
||||
/**
|
||||
* 查询API收费标准
|
||||
*
|
||||
* @param id API收费标准主键
|
||||
* @return API收费标准
|
||||
*/
|
||||
public ApiPriceVO selectApiPriceById(Long id);
|
||||
|
||||
/**
|
||||
* 查询API收费标准列表
|
||||
*
|
||||
* @param query API收费标准
|
||||
* @return API收费标准集合
|
||||
*/
|
||||
public List<ApiPriceVO> selectApiPriceList(@Param("query")ApiPriceQuery query);
|
||||
|
||||
/**
|
||||
* 新增API收费标准
|
||||
*
|
||||
* @param apiPrice API收费标准
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertApiPrice(ApiPrice apiPrice);
|
||||
|
||||
/**
|
||||
* 修改API收费标准
|
||||
*
|
||||
* @param apiPrice API收费标准
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateApiPrice(@Param("data") ApiPrice apiPrice);
|
||||
|
||||
/**
|
||||
* 删除API收费标准
|
||||
*
|
||||
* @param id API收费标准主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteApiPriceById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除API收费标准
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteApiPriceByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
<?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.ss.apiPrice.mapper.ApiPriceMapper">
|
||||
|
||||
<resultMap type="ApiPriceVO" id="ApiPriceResult" autoMapping="true"/>
|
||||
|
||||
<sql id="selectApiPriceVo">
|
||||
select
|
||||
id,
|
||||
type,
|
||||
num,
|
||||
unit,
|
||||
name,
|
||||
description,
|
||||
price,
|
||||
create_time,
|
||||
create_by,
|
||||
update_time,
|
||||
update_by,
|
||||
deleted
|
||||
from ss_api_price
|
||||
</sql>
|
||||
|
||||
<sql id="searchCondition">
|
||||
<if test="query.id != null "> and id = #{query.id}</if>
|
||||
<if test="query.type != null and query.type != ''"> and type = #{query.type}</if>
|
||||
<if test="query.unit != null and query.unit != ''"> and unit = #{query.unit}</if>
|
||||
<if test="query.name != null and query.name != ''"> and name like concat('%', #{query.name}, '%')</if>
|
||||
<if test="query.description != null and query.description != ''"> and description like concat('%', #{query.description}, '%')</if>
|
||||
<if test="query.price != null "> and price = #{query.price}</if>
|
||||
<if test="query.createBy != null and query.createBy != ''"> and create_by like concat('%', #{query.createBy}, '%')</if>
|
||||
<if test="query.updateBy != null "> and update_by like concat('%', #{query.updateBy}, '%')</if>
|
||||
<if test="query.deleted != null "> and deleted = #{query.deleted}</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectApiPriceList" parameterType="ApiPriceQuery" resultMap="ApiPriceResult">
|
||||
<include refid="selectApiPriceVo"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectApiPriceById" parameterType="Long" resultMap="ApiPriceResult">
|
||||
<include refid="selectApiPriceVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertApiPrice" parameterType="ApiPrice" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ss_api_price
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="type != null">type,</if>
|
||||
<if test="num != null">num,</if>
|
||||
<if test="unit != null">unit,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="price != null">price,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="deleted != null">deleted,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="num != null">#{num},</if>
|
||||
<if test="unit != null">#{unit},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="price != null">#{price},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="deleted != null">#{deleted},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateApiPrice" parameterType="ApiPrice">
|
||||
update ss_api_price
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="data.type != null">type = #{data.type},</if>
|
||||
<if test="data.num != null">num = #{data.num},</if>
|
||||
<if test="data.unit != null">unit = #{data.unit},</if>
|
||||
<if test="data.name != null">name = #{data.name},</if>
|
||||
<if test="data.description != null">description = #{data.description},</if>
|
||||
<if test="data.price != null">price = #{data.price},</if>
|
||||
<if test="data.createTime != null">create_time = #{data.createTime},</if>
|
||||
<if test="data.createBy != null">create_by = #{data.createBy},</if>
|
||||
<if test="data.updateTime != null">update_time = #{data.updateTime},</if>
|
||||
<if test="data.updateBy != null">update_by = #{data.updateBy},</if>
|
||||
<if test="data.deleted != null">deleted = #{data.deleted},</if>
|
||||
</trim>
|
||||
where id = #{data.id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteApiPriceById" parameterType="Long">
|
||||
delete from ss_api_price where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteApiPriceByIds" parameterType="String">
|
||||
delete from ss_api_price where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,63 @@
|
|||
package com.ruoyi.ss.apiPrice.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.ss.apiPrice.domain.ApiPrice;
|
||||
import com.ruoyi.ss.apiPrice.domain.ApiPriceVO;
|
||||
import com.ruoyi.ss.apiPrice.domain.ApiPriceQuery;
|
||||
|
||||
/**
|
||||
* API收费标准Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
public interface IApiPriceService
|
||||
{
|
||||
/**
|
||||
* 查询API收费标准
|
||||
*
|
||||
* @param id API收费标准主键
|
||||
* @return API收费标准
|
||||
*/
|
||||
public ApiPriceVO selectApiPriceById(Long id);
|
||||
|
||||
/**
|
||||
* 查询API收费标准列表
|
||||
*
|
||||
* @param apiPrice API收费标准
|
||||
* @return API收费标准集合
|
||||
*/
|
||||
public List<ApiPriceVO> selectApiPriceList(ApiPriceQuery apiPrice);
|
||||
|
||||
/**
|
||||
* 新增API收费标准
|
||||
*
|
||||
* @param apiPrice API收费标准
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertApiPrice(ApiPrice apiPrice);
|
||||
|
||||
/**
|
||||
* 修改API收费标准
|
||||
*
|
||||
* @param apiPrice API收费标准
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateApiPrice(ApiPrice apiPrice);
|
||||
|
||||
/**
|
||||
* 批量删除API收费标准
|
||||
*
|
||||
* @param ids 需要删除的API收费标准主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteApiPriceByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除API收费标准信息
|
||||
*
|
||||
* @param id API收费标准主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteApiPriceById(Long id);
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package com.ruoyi.ss.apiPrice.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.ss.apiPrice.mapper.ApiPriceMapper;
|
||||
import com.ruoyi.ss.apiPrice.domain.ApiPrice;
|
||||
import com.ruoyi.ss.apiPrice.domain.ApiPriceVO;
|
||||
import com.ruoyi.ss.apiPrice.domain.ApiPriceQuery;
|
||||
import com.ruoyi.ss.apiPrice.service.IApiPriceService;
|
||||
|
||||
/**
|
||||
* API收费标准Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
@Service
|
||||
public class ApiPriceServiceImpl implements IApiPriceService
|
||||
{
|
||||
@Autowired
|
||||
private ApiPriceMapper apiPriceMapper;
|
||||
|
||||
/**
|
||||
* 查询API收费标准
|
||||
*
|
||||
* @param id API收费标准主键
|
||||
* @return API收费标准
|
||||
*/
|
||||
@Override
|
||||
public ApiPriceVO selectApiPriceById(Long id)
|
||||
{
|
||||
return apiPriceMapper.selectApiPriceById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询API收费标准列表
|
||||
*
|
||||
* @param apiPrice API收费标准
|
||||
* @return API收费标准
|
||||
*/
|
||||
@Override
|
||||
public List<ApiPriceVO> selectApiPriceList(ApiPriceQuery apiPrice)
|
||||
{
|
||||
return apiPriceMapper.selectApiPriceList(apiPrice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增API收费标准
|
||||
*
|
||||
* @param apiPrice API收费标准
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertApiPrice(ApiPrice apiPrice)
|
||||
{
|
||||
apiPrice.setCreateTime(DateUtils.getNowDate());
|
||||
return apiPriceMapper.insertApiPrice(apiPrice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改API收费标准
|
||||
*
|
||||
* @param apiPrice API收费标准
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateApiPrice(ApiPrice apiPrice)
|
||||
{
|
||||
apiPrice.setUpdateTime(DateUtils.getNowDate());
|
||||
return apiPriceMapper.updateApiPrice(apiPrice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除API收费标准
|
||||
*
|
||||
* @param ids 需要删除的API收费标准主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteApiPriceByIds(Long[] ids)
|
||||
{
|
||||
return apiPriceMapper.deleteApiPriceByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除API收费标准信息
|
||||
*
|
||||
* @param id API收费标准主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteApiPriceById(Long id)
|
||||
{
|
||||
return apiPriceMapper.deleteApiPriceById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
package com.ruoyi.web.controller.ss;
|
||||
|
||||
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.ss.apiPrice.domain.ApiPrice;
|
||||
import com.ruoyi.ss.apiPrice.domain.ApiPriceVO;
|
||||
import com.ruoyi.ss.apiPrice.domain.ApiPriceQuery;
|
||||
import com.ruoyi.ss.apiPrice.service.IApiPriceService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* API收费标准Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ss/apiPrice")
|
||||
public class ApiPriceController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IApiPriceService apiPriceService;
|
||||
|
||||
/**
|
||||
* 查询API收费标准列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:apiPrice:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ApiPriceQuery query)
|
||||
{
|
||||
startPage();
|
||||
startOrderBy();
|
||||
List<ApiPriceVO> list = apiPriceService.selectApiPriceList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出API收费标准列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:apiPrice:export')")
|
||||
@Log(title = "API收费标准", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ApiPriceQuery query)
|
||||
{
|
||||
List<ApiPriceVO> list = apiPriceService.selectApiPriceList(query);
|
||||
ExcelUtil<ApiPriceVO> util = new ExcelUtil<ApiPriceVO>(ApiPriceVO.class);
|
||||
util.exportExcel(response, list, "API收费标准数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取API收费标准详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:apiPrice:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(apiPriceService.selectApiPriceById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增API收费标准
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:apiPrice:add')")
|
||||
@Log(title = "API收费标准", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ApiPrice apiPrice)
|
||||
{
|
||||
return toAjax(apiPriceService.insertApiPrice(apiPrice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改API收费标准
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:apiPrice:edit')")
|
||||
@Log(title = "API收费标准", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ApiPrice apiPrice)
|
||||
{
|
||||
return toAjax(apiPriceService.updateApiPrice(apiPrice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除API收费标准
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:apiPrice:remove')")
|
||||
@Log(title = "API收费标准", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(apiPriceService.deleteApiPriceByIds(ids));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user