change - 添加测试页面
parent
4fc0614ad9
commit
bf5cc2784a
@ -0,0 +1,105 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
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.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.system.domain.BaseFactoryInfo;
|
||||
import com.ruoyi.system.service.IBaseFactoryInfoService;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 工厂信息Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-07-01
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/info")
|
||||
public class BaseFactoryInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBaseFactoryInfoService baseFactoryInfoService;
|
||||
|
||||
/**
|
||||
* 查询工厂信息列表
|
||||
*/
|
||||
@RequiresPermissions("system:info:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BaseFactoryInfo baseFactoryInfo)
|
||||
{
|
||||
startPage();
|
||||
List<BaseFactoryInfo> list = baseFactoryInfoService.selectBaseFactoryInfoList(baseFactoryInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出工厂信息列表
|
||||
*/
|
||||
@RequiresPermissions("system:info:export")
|
||||
@Log(title = "工厂信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BaseFactoryInfo baseFactoryInfo)
|
||||
{
|
||||
List<BaseFactoryInfo> list = baseFactoryInfoService.selectBaseFactoryInfoList(baseFactoryInfo);
|
||||
ExcelUtil<BaseFactoryInfo> util = new ExcelUtil<BaseFactoryInfo>(BaseFactoryInfo.class);
|
||||
util.exportExcel(response, list, "工厂信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工厂信息详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:info:query")
|
||||
@GetMapping(value = "/{objId}")
|
||||
public AjaxResult getInfo(@PathVariable("objId") Long objId)
|
||||
{
|
||||
return success(baseFactoryInfoService.selectBaseFactoryInfoByObjId(objId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工厂信息
|
||||
*/
|
||||
@RequiresPermissions("system:info:add")
|
||||
@Log(title = "工厂信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BaseFactoryInfo baseFactoryInfo)
|
||||
{
|
||||
return toAjax(baseFactoryInfoService.insertBaseFactoryInfo(baseFactoryInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工厂信息
|
||||
*/
|
||||
@RequiresPermissions("system:info:edit")
|
||||
@Log(title = "工厂信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BaseFactoryInfo baseFactoryInfo)
|
||||
{
|
||||
return toAjax(baseFactoryInfoService.updateBaseFactoryInfo(baseFactoryInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工厂信息
|
||||
*/
|
||||
@RequiresPermissions("system:info:remove")
|
||||
@Log(title = "工厂信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{objIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] objIds)
|
||||
{
|
||||
return toAjax(baseFactoryInfoService.deleteBaseFactoryInfoByObjIds(objIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.BaseFactoryInfo;
|
||||
|
||||
/**
|
||||
* 工厂信息Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-07-01
|
||||
*/
|
||||
public interface BaseFactoryInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询工厂信息
|
||||
*
|
||||
* @param objId 工厂信息主键
|
||||
* @return 工厂信息
|
||||
*/
|
||||
public BaseFactoryInfo selectBaseFactoryInfoByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询工厂信息列表
|
||||
*
|
||||
* @param baseFactoryInfo 工厂信息
|
||||
* @return 工厂信息集合
|
||||
*/
|
||||
public List<BaseFactoryInfo> selectBaseFactoryInfoList(BaseFactoryInfo baseFactoryInfo);
|
||||
|
||||
/**
|
||||
* 新增工厂信息
|
||||
*
|
||||
* @param baseFactoryInfo 工厂信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseFactoryInfo(BaseFactoryInfo baseFactoryInfo);
|
||||
|
||||
/**
|
||||
* 修改工厂信息
|
||||
*
|
||||
* @param baseFactoryInfo 工厂信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseFactoryInfo(BaseFactoryInfo baseFactoryInfo);
|
||||
|
||||
/**
|
||||
* 删除工厂信息
|
||||
*
|
||||
* @param objId 工厂信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseFactoryInfoByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 批量删除工厂信息
|
||||
*
|
||||
* @param objIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseFactoryInfoByObjIds(Long[] objIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.BaseFactoryInfo;
|
||||
|
||||
/**
|
||||
* 工厂信息Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-07-01
|
||||
*/
|
||||
public interface IBaseFactoryInfoService
|
||||
{
|
||||
/**
|
||||
* 查询工厂信息
|
||||
*
|
||||
* @param objId 工厂信息主键
|
||||
* @return 工厂信息
|
||||
*/
|
||||
public BaseFactoryInfo selectBaseFactoryInfoByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询工厂信息列表
|
||||
*
|
||||
* @param baseFactoryInfo 工厂信息
|
||||
* @return 工厂信息集合
|
||||
*/
|
||||
public List<BaseFactoryInfo> selectBaseFactoryInfoList(BaseFactoryInfo baseFactoryInfo);
|
||||
|
||||
/**
|
||||
* 新增工厂信息
|
||||
*
|
||||
* @param baseFactoryInfo 工厂信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseFactoryInfo(BaseFactoryInfo baseFactoryInfo);
|
||||
|
||||
/**
|
||||
* 修改工厂信息
|
||||
*
|
||||
* @param baseFactoryInfo 工厂信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseFactoryInfo(BaseFactoryInfo baseFactoryInfo);
|
||||
|
||||
/**
|
||||
* 批量删除工厂信息
|
||||
*
|
||||
* @param objIds 需要删除的工厂信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseFactoryInfoByObjIds(Long[] objIds);
|
||||
|
||||
/**
|
||||
* 删除工厂信息信息
|
||||
*
|
||||
* @param objId 工厂信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseFactoryInfoByObjId(Long objId);
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.BaseFactoryInfoMapper;
|
||||
import com.ruoyi.system.domain.BaseFactoryInfo;
|
||||
import com.ruoyi.system.service.IBaseFactoryInfoService;
|
||||
|
||||
/**
|
||||
* 工厂信息Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-07-01
|
||||
*/
|
||||
@Service
|
||||
public class BaseFactoryInfoServiceImpl implements IBaseFactoryInfoService
|
||||
{
|
||||
@Autowired
|
||||
private BaseFactoryInfoMapper baseFactoryInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询工厂信息
|
||||
*
|
||||
* @param objId 工厂信息主键
|
||||
* @return 工厂信息
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public BaseFactoryInfo selectBaseFactoryInfoByObjId(Long objId)
|
||||
{
|
||||
return baseFactoryInfoMapper.selectBaseFactoryInfoByObjId(objId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工厂信息列表
|
||||
*
|
||||
* @param baseFactoryInfo 工厂信息
|
||||
* @return 工厂信息
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public List<BaseFactoryInfo> selectBaseFactoryInfoList(BaseFactoryInfo baseFactoryInfo)
|
||||
{
|
||||
return baseFactoryInfoMapper.selectBaseFactoryInfoList(baseFactoryInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工厂信息
|
||||
*
|
||||
* @param baseFactoryInfo 工厂信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int insertBaseFactoryInfo(BaseFactoryInfo baseFactoryInfo)
|
||||
{
|
||||
return baseFactoryInfoMapper.insertBaseFactoryInfo(baseFactoryInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工厂信息
|
||||
*
|
||||
* @param baseFactoryInfo 工厂信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int updateBaseFactoryInfo(BaseFactoryInfo baseFactoryInfo)
|
||||
{
|
||||
return baseFactoryInfoMapper.updateBaseFactoryInfo(baseFactoryInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除工厂信息
|
||||
*
|
||||
* @param objIds 需要删除的工厂信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteBaseFactoryInfoByObjIds(Long[] objIds)
|
||||
{
|
||||
return baseFactoryInfoMapper.deleteBaseFactoryInfoByObjIds(objIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工厂信息信息
|
||||
*
|
||||
* @param objId 工厂信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteBaseFactoryInfoByObjId(Long objId)
|
||||
{
|
||||
return baseFactoryInfoMapper.deleteBaseFactoryInfoByObjId(objId);
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
<?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.BaseFactoryInfoMapper">
|
||||
|
||||
<resultMap type="BaseFactoryInfo" id="BaseFactoryInfoResult">
|
||||
<result property="objId" column="obj_id" />
|
||||
<result property="companyCode" column="company_code" />
|
||||
<result property="factoryCode" column="factory_code" />
|
||||
<result property="factoryName" column="factory_name" />
|
||||
<result property="factoryStatus" column="factory_status" />
|
||||
<result property="isFlag" column="is_flag" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createdBy" column="created_by" />
|
||||
<result property="createdTime" column="created_time" />
|
||||
<result property="updatedBy" column="updated_by" />
|
||||
<result property="updatedTime" column="updated_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBaseFactoryInfoVo">
|
||||
select obj_id, company_code, factory_code, factory_name, factory_status, is_flag, remark, created_by, created_time, updated_by, updated_time from base_factory_info
|
||||
</sql>
|
||||
|
||||
<select id="selectBaseFactoryInfoList" parameterType="BaseFactoryInfo" resultMap="BaseFactoryInfoResult">
|
||||
<include refid="selectBaseFactoryInfoVo"/>
|
||||
<where>
|
||||
<if test="companyCode != null and companyCode != ''"> and company_code = #{companyCode}</if>
|
||||
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
|
||||
<if test="factoryName != null and factoryName != ''"> and factory_name like concat('%', #{factoryName}, '%')</if>
|
||||
<if test="factoryStatus != null "> and factory_status = #{factoryStatus}</if>
|
||||
<if test="isFlag != null "> and is_flag = #{isFlag}</if>
|
||||
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
|
||||
<if test="createdTime != null "> and created_time = #{createdTime}</if>
|
||||
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
|
||||
<if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBaseFactoryInfoByObjId" parameterType="Long" resultMap="BaseFactoryInfoResult">
|
||||
<include refid="selectBaseFactoryInfoVo"/>
|
||||
where obj_id = #{objId}
|
||||
</select>
|
||||
|
||||
<insert id="insertBaseFactoryInfo" parameterType="BaseFactoryInfo" useGeneratedKeys="true" keyProperty="objId">
|
||||
insert into base_factory_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="companyCode != null">company_code,</if>
|
||||
<if test="factoryCode != null">factory_code,</if>
|
||||
<if test="factoryName != null">factory_name,</if>
|
||||
<if test="factoryStatus != null">factory_status,</if>
|
||||
<if test="isFlag != null">is_flag,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createdBy != null">created_by,</if>
|
||||
<if test="createdTime != null">created_time,</if>
|
||||
<if test="updatedBy != null">updated_by,</if>
|
||||
<if test="updatedTime != null">updated_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="companyCode != null">#{companyCode},</if>
|
||||
<if test="factoryCode != null">#{factoryCode},</if>
|
||||
<if test="factoryName != null">#{factoryName},</if>
|
||||
<if test="factoryStatus != null">#{factoryStatus},</if>
|
||||
<if test="isFlag != null">#{isFlag},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createdBy != null">#{createdBy},</if>
|
||||
<if test="createdTime != null">#{createdTime},</if>
|
||||
<if test="updatedBy != null">#{updatedBy},</if>
|
||||
<if test="updatedTime != null">#{updatedTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBaseFactoryInfo" parameterType="BaseFactoryInfo">
|
||||
update base_factory_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="companyCode != null">company_code = #{companyCode},</if>
|
||||
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
|
||||
<if test="factoryName != null">factory_name = #{factoryName},</if>
|
||||
<if test="factoryStatus != null">factory_status = #{factoryStatus},</if>
|
||||
<if test="isFlag != null">is_flag = #{isFlag},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="createdBy != null">created_by = #{createdBy},</if>
|
||||
<if test="createdTime != null">created_time = #{createdTime},</if>
|
||||
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
|
||||
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
|
||||
</trim>
|
||||
where obj_id = #{objId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBaseFactoryInfoByObjId" parameterType="Long">
|
||||
delete from base_factory_info where obj_id = #{objId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBaseFactoryInfoByObjIds" parameterType="String">
|
||||
delete from base_factory_info where obj_id in
|
||||
<foreach item="objId" collection="array" open="(" separator="," close=")">
|
||||
#{objId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询工厂信息列表
|
||||
export function listInfo(query) {
|
||||
return request({
|
||||
url: '/system/info/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询工厂信息详细
|
||||
export function getInfo(objId) {
|
||||
return request({
|
||||
url: '/system/info/' + objId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增工厂信息
|
||||
export function addInfo(data) {
|
||||
return request({
|
||||
url: '/system/info',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改工厂信息
|
||||
export function updateInfo(data) {
|
||||
return request({
|
||||
url: '/system/info',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除工厂信息
|
||||
export function delInfo(objId) {
|
||||
return request({
|
||||
url: '/system/info/' + objId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue