This commit is contained in:
alittlekang 2024-12-02 22:24:55 +08:00
parent 9eee085d49
commit bb94bfd30a
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.Test;
import com.ruoyi.system.service.ITestService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* kController
*
* @author ruoyi
* @date 2024-12-02
*/
@RestController
@RequestMapping("/system/test")
public class TestController extends BaseController
{
@Autowired
private ITestService testService;
/**
* 查询k列表
*/
@PreAuthorize("@ss.hasPermi('system:test:list')")
@GetMapping("/list")
public TableDataInfo list(Test test)
{
startPage();
List<Test> list = testService.selectTestList(test);
return getDataTable(list);
}
/**
* 导出k列表
*/
@PreAuthorize("@ss.hasPermi('system:test:export')")
@Log(title = "k", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Test test)
{
List<Test> list = testService.selectTestList(test);
ExcelUtil<Test> util = new ExcelUtil<Test>(Test.class);
util.exportExcel(response, list, "k数据");
}
/**
* 获取k详细信息
*/
@PreAuthorize("@ss.hasPermi('system:test:query')")
@GetMapping(value = "/{fy}")
public AjaxResult getInfo(@PathVariable("fy") String fy)
{
return success(testService.selectTestByFy(fy));
}
/**
* 新增k
*/
@PreAuthorize("@ss.hasPermi('system:test:add')")
@Log(title = "k", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Test test)
{
return toAjax(testService.insertTest(test));
}
/**
* 修改k
*/
@PreAuthorize("@ss.hasPermi('system:test:edit')")
@Log(title = "k", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Test test)
{
return toAjax(testService.updateTest(test));
}
/**
* 删除k
*/
@PreAuthorize("@ss.hasPermi('system:test:remove')")
@Log(title = "k", businessType = BusinessType.DELETE)
@DeleteMapping("/{fys}")
public AjaxResult remove(@PathVariable String[] fys)
{
return toAjax(testService.deleteTestByFys(fys));
}
}

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;
/**
* k对象 test
*
* @author ruoyi
* @date 2024-12-02
*/
public class Test extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String fy;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String ll;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String gg;
public void setFy(String fy)
{
this.fy = fy;
}
public String getFy()
{
return fy;
}
public void setLl(String ll)
{
this.ll = ll;
}
public String getLl()
{
return ll;
}
public void setGg(String gg)
{
this.gg = gg;
}
public String getGg()
{
return gg;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("fy", getFy())
.append("ll", getLl())
.append("gg", getGg())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.Test;
/**
* kMapper接口
*
* @author ruoyi
* @date 2024-12-02
*/
public interface TestMapper
{
/**
* 查询k
*
* @param fy k主键
* @return k
*/
public Test selectTestByFy(String fy);
/**
* 查询k列表
*
* @param test k
* @return k集合
*/
public List<Test> selectTestList(Test test);
/**
* 新增k
*
* @param test k
* @return 结果
*/
public int insertTest(Test test);
/**
* 修改k
*
* @param test k
* @return 结果
*/
public int updateTest(Test test);
/**
* 删除k
*
* @param fy k主键
* @return 结果
*/
public int deleteTestByFy(String fy);
/**
* 批量删除k
*
* @param fys 需要删除的数据主键集合
* @return 结果
*/
public int deleteTestByFys(String[] fys);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.Test;
/**
* kService接口
*
* @author ruoyi
* @date 2024-12-02
*/
public interface ITestService
{
/**
* 查询k
*
* @param fy k主键
* @return k
*/
public Test selectTestByFy(String fy);
/**
* 查询k列表
*
* @param test k
* @return k集合
*/
public List<Test> selectTestList(Test test);
/**
* 新增k
*
* @param test k
* @return 结果
*/
public int insertTest(Test test);
/**
* 修改k
*
* @param test k
* @return 结果
*/
public int updateTest(Test test);
/**
* 批量删除k
*
* @param fys 需要删除的k主键集合
* @return 结果
*/
public int deleteTestByFys(String[] fys);
/**
* 删除k信息
*
* @param fy k主键
* @return 结果
*/
public int deleteTestByFy(String fy);
}

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.TestMapper;
import com.ruoyi.system.domain.Test;
import com.ruoyi.system.service.ITestService;
/**
* kService业务层处理
*
* @author ruoyi
* @date 2024-12-02
*/
@Service
public class TestServiceImpl implements ITestService
{
@Autowired
private TestMapper testMapper;
/**
* 查询k
*
* @param fy k主键
* @return k
*/
@Override
public Test selectTestByFy(String fy)
{
return testMapper.selectTestByFy(fy);
}
/**
* 查询k列表
*
* @param test k
* @return k
*/
@Override
public List<Test> selectTestList(Test test)
{
return testMapper.selectTestList(test);
}
/**
* 新增k
*
* @param test k
* @return 结果
*/
@Override
public int insertTest(Test test)
{
return testMapper.insertTest(test);
}
/**
* 修改k
*
* @param test k
* @return 结果
*/
@Override
public int updateTest(Test test)
{
return testMapper.updateTest(test);
}
/**
* 批量删除k
*
* @param fys 需要删除的k主键
* @return 结果
*/
@Override
public int deleteTestByFys(String[] fys)
{
return testMapper.deleteTestByFys(fys);
}
/**
* 删除k信息
*
* @param fy k主键
* @return 结果
*/
@Override
public int deleteTestByFy(String fy)
{
return testMapper.deleteTestByFy(fy);
}
}

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.TestMapper">
<resultMap type="Test" id="TestResult">
<result property="fy" column="fy" />
<result property="ll" column="ll" />
<result property="gg" column="gg" />
</resultMap>
<sql id="selectTestVo">
select fy, ll, gg from test
</sql>
<select id="selectTestList" parameterType="Test" resultMap="TestResult">
<include refid="selectTestVo"/>
<where>
<if test="fy != null and fy != ''"> and fy = #{fy}</if>
<if test="ll != null and ll != ''"> and ll = #{ll}</if>
<if test="gg != null and gg != ''"> and gg = #{gg}</if>
</where>
</select>
<select id="selectTestByFy" parameterType="String" resultMap="TestResult">
<include refid="selectTestVo"/>
where fy = #{fy}
</select>
<insert id="insertTest" parameterType="Test">
insert into test
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fy != null">fy,</if>
<if test="ll != null">ll,</if>
<if test="gg != null">gg,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fy != null">#{fy},</if>
<if test="ll != null">#{ll},</if>
<if test="gg != null">#{gg},</if>
</trim>
</insert>
<update id="updateTest" parameterType="Test">
update test
<trim prefix="SET" suffixOverrides=",">
<if test="ll != null">ll = #{ll},</if>
<if test="gg != null">gg = #{gg},</if>
</trim>
where fy = #{fy}
</update>
<delete id="deleteTestByFy" parameterType="String">
delete from test where fy = #{fy}
</delete>
<delete id="deleteTestByFys" parameterType="String">
delete from test where fy in
<foreach item="fy" collection="array" open="(" separator="," close=")">
#{fy}
</foreach>
</delete>
</mapper>