工装夹具类型设置

This commit is contained in:
JinLu.Yin 2022-05-11 00:34:29 +08:00
parent 57dbd98530
commit 663ae29d96
5 changed files with 534 additions and 0 deletions

View File

@ -0,0 +1,118 @@
package com.ktg.mes.tm.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ktg.common.constant.UserConstants;
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.ktg.common.annotation.Log;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.enums.BusinessType;
import com.ktg.mes.tm.domain.TmToolType;
import com.ktg.mes.tm.service.ITmToolTypeService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
/**
* 工装夹具类型Controller
*
* @author yinjinlu
* @date 2022-05-10
*/
@RestController
@RequestMapping("/mes/tm/tooltype")
public class TmToolTypeController extends BaseController
{
@Autowired
private ITmToolTypeService tmToolTypeService;
/**
* 查询工装夹具类型列表
*/
@PreAuthorize("@ss.hasPermi('mes:tm:tooltype:list')")
@GetMapping("/list")
public TableDataInfo list(TmToolType tmToolType)
{
startPage();
List<TmToolType> list = tmToolTypeService.selectTmToolTypeList(tmToolType);
return getDataTable(list);
}
/**
* 导出工装夹具类型列表
*/
@PreAuthorize("@ss.hasPermi('mes:tm:tooltype:export')")
@Log(title = "工装夹具类型", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TmToolType tmToolType)
{
List<TmToolType> list = tmToolTypeService.selectTmToolTypeList(tmToolType);
ExcelUtil<TmToolType> util = new ExcelUtil<TmToolType>(TmToolType.class);
util.exportExcel(response, list, "工装夹具类型数据");
}
/**
* 获取工装夹具类型详细信息
*/
@PreAuthorize("@ss.hasPermi('mes:tm:tooltype:query')")
@GetMapping(value = "/{toolTypeId}")
public AjaxResult getInfo(@PathVariable("toolTypeId") Long toolTypeId)
{
return AjaxResult.success(tmToolTypeService.selectTmToolTypeByToolTypeId(toolTypeId));
}
/**
* 新增工装夹具类型
*/
@PreAuthorize("@ss.hasPermi('mes:tm:tooltype:add')")
@Log(title = "工装夹具类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TmToolType tmToolType)
{
if(UserConstants.NOT_UNIQUE.equals(tmToolTypeService.checkToolTypeCodeUnique(tmToolType))){
return AjaxResult.error("类型编码已存在!");
}
if(UserConstants.NOT_UNIQUE.equals(tmToolTypeService.checkToolTypeNameUnique(tmToolType))){
return AjaxResult.error("类型名称已存在!");
}
return toAjax(tmToolTypeService.insertTmToolType(tmToolType));
}
/**
* 修改工装夹具类型
*/
@PreAuthorize("@ss.hasPermi('mes:tm:tooltype:edit')")
@Log(title = "工装夹具类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TmToolType tmToolType)
{
if(UserConstants.NOT_UNIQUE.equals(tmToolTypeService.checkToolTypeCodeUnique(tmToolType))){
return AjaxResult.error("类型编码已存在!");
}
if(UserConstants.NOT_UNIQUE.equals(tmToolTypeService.checkToolTypeNameUnique(tmToolType))){
return AjaxResult.error("类型名称已存在!");
}
return toAjax(tmToolTypeService.updateTmToolType(tmToolType));
}
/**
* 删除工装夹具类型
*/
@PreAuthorize("@ss.hasPermi('mes:tm:tooltype:remove')")
@Log(title = "工装夹具类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{toolTypeIds}")
public AjaxResult remove(@PathVariable Long[] toolTypeIds)
{
return toAjax(tmToolTypeService.deleteTmToolTypeByToolTypeIds(toolTypeIds));
}
}

View File

@ -0,0 +1,164 @@
package com.ktg.mes.tm.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
/**
* 工装夹具类型对象 tm_tool_type
*
* @author yinjinlu
* @date 2022-05-10
*/
public class TmToolType extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 类型ID */
private Long toolTypeId;
/** 类型编码 */
@Excel(name = "类型编码")
private String toolTypeCode;
/** 类型名称 */
@Excel(name = "类型名称")
private String toolTypeName;
/** 是否启用 */
@Excel(name = "是否启用")
private String codeFlag;
/** 保养维护类型 */
@Excel(name = "保养维护类型")
private String maintenType;
/** 保养周期 */
@Excel(name = "保养周期")
private Long maintenPeriod;
/** 预留字段1 */
private String attr1;
/** 预留字段2 */
private String attr2;
/** 预留字段3 */
private Long attr3;
/** 预留字段4 */
private Long attr4;
public void setToolTypeId(Long toolTypeId)
{
this.toolTypeId = toolTypeId;
}
public Long getToolTypeId()
{
return toolTypeId;
}
public void setToolTypeCode(String toolTypeCode)
{
this.toolTypeCode = toolTypeCode;
}
public String getToolTypeCode()
{
return toolTypeCode;
}
public void setToolTypeName(String toolTypeName)
{
this.toolTypeName = toolTypeName;
}
public String getToolTypeName()
{
return toolTypeName;
}
public void setCodeFlag(String codeFlag)
{
this.codeFlag = codeFlag;
}
public String getCodeFlag()
{
return codeFlag;
}
public void setMaintenType(String maintenType)
{
this.maintenType = maintenType;
}
public String getMaintenType()
{
return maintenType;
}
public void setMaintenPeriod(Long maintenPeriod)
{
this.maintenPeriod = maintenPeriod;
}
public Long getMaintenPeriod()
{
return maintenPeriod;
}
public void setAttr1(String attr1)
{
this.attr1 = attr1;
}
public String getAttr1()
{
return attr1;
}
public void setAttr2(String attr2)
{
this.attr2 = attr2;
}
public String getAttr2()
{
return attr2;
}
public void setAttr3(Long attr3)
{
this.attr3 = attr3;
}
public Long getAttr3()
{
return attr3;
}
public void setAttr4(Long attr4)
{
this.attr4 = attr4;
}
public Long getAttr4()
{
return attr4;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("toolTypeId", getToolTypeId())
.append("toolTypeCode", getToolTypeCode())
.append("toolTypeName", getToolTypeName())
.append("codeFlag", getCodeFlag())
.append("maintenType", getMaintenType())
.append("maintenPeriod", getMaintenPeriod())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,65 @@
package com.ktg.mes.tm.mapper;
import java.util.List;
import com.ktg.mes.tm.domain.TmToolType;
/**
* 工装夹具类型Mapper接口
*
* @author yinjinlu
* @date 2022-05-10
*/
public interface TmToolTypeMapper
{
/**
* 查询工装夹具类型
*
* @param toolTypeId 工装夹具类型主键
* @return 工装夹具类型
*/
public TmToolType selectTmToolTypeByToolTypeId(Long toolTypeId);
/**
* 查询工装夹具类型列表
*
* @param tmToolType 工装夹具类型
* @return 工装夹具类型集合
*/
public List<TmToolType> selectTmToolTypeList(TmToolType tmToolType);
public TmToolType checkToolTypeCodeUnique(TmToolType tmToolType);
public TmToolType checkToolTypeNameUnique(TmToolType tmToolType);
/**
* 新增工装夹具类型
*
* @param tmToolType 工装夹具类型
* @return 结果
*/
public int insertTmToolType(TmToolType tmToolType);
/**
* 修改工装夹具类型
*
* @param tmToolType 工装夹具类型
* @return 结果
*/
public int updateTmToolType(TmToolType tmToolType);
/**
* 删除工装夹具类型
*
* @param toolTypeId 工装夹具类型主键
* @return 结果
*/
public int deleteTmToolTypeByToolTypeId(Long toolTypeId);
/**
* 批量删除工装夹具类型
*
* @param toolTypeIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteTmToolTypeByToolTypeIds(Long[] toolTypeIds);
}

View File

@ -0,0 +1,65 @@
package com.ktg.mes.tm.service;
import java.util.List;
import com.ktg.mes.tm.domain.TmToolType;
/**
* 工装夹具类型Service接口
*
* @author yinjinlu
* @date 2022-05-10
*/
public interface ITmToolTypeService
{
/**
* 查询工装夹具类型
*
* @param toolTypeId 工装夹具类型主键
* @return 工装夹具类型
*/
public TmToolType selectTmToolTypeByToolTypeId(Long toolTypeId);
/**
* 查询工装夹具类型列表
*
* @param tmToolType 工装夹具类型
* @return 工装夹具类型集合
*/
public List<TmToolType> selectTmToolTypeList(TmToolType tmToolType);
public String checkToolTypeCodeUnique(TmToolType tmToolType);
public String checkToolTypeNameUnique(TmToolType tmToolType);
/**
* 新增工装夹具类型
*
* @param tmToolType 工装夹具类型
* @return 结果
*/
public int insertTmToolType(TmToolType tmToolType);
/**
* 修改工装夹具类型
*
* @param tmToolType 工装夹具类型
* @return 结果
*/
public int updateTmToolType(TmToolType tmToolType);
/**
* 批量删除工装夹具类型
*
* @param toolTypeIds 需要删除的工装夹具类型主键集合
* @return 结果
*/
public int deleteTmToolTypeByToolTypeIds(Long[] toolTypeIds);
/**
* 删除工装夹具类型信息
*
* @param toolTypeId 工装夹具类型主键
* @return 结果
*/
public int deleteTmToolTypeByToolTypeId(Long toolTypeId);
}

View File

@ -0,0 +1,122 @@
<?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.ktg.mes.tm.mapper.TmToolTypeMapper">
<resultMap type="TmToolType" id="TmToolTypeResult">
<result property="toolTypeId" column="tool_type_id" />
<result property="toolTypeCode" column="tool_type_code" />
<result property="toolTypeName" column="tool_type_name" />
<result property="codeFlag" column="code_flag" />
<result property="maintenType" column="mainten_type" />
<result property="maintenPeriod" column="mainten_period" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTmToolTypeVo">
select tool_type_id, tool_type_code, tool_type_name, code_flag, mainten_type, mainten_period, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from tm_tool_type
</sql>
<select id="selectTmToolTypeList" parameterType="TmToolType" resultMap="TmToolTypeResult">
<include refid="selectTmToolTypeVo"/>
<where>
<if test="toolTypeCode != null and toolTypeCode != ''"> and tool_type_code = #{toolTypeCode}</if>
<if test="toolTypeName != null and toolTypeName != ''"> and tool_type_name like concat('%', #{toolTypeName}, '%')</if>
<if test="codeFlag != null and codeFlag != ''"> and code_flag = #{codeFlag}</if>
<if test="maintenType != null and maintenType != ''"> and mainten_type = #{maintenType}</if>
<if test="maintenPeriod != null "> and mainten_period = #{maintenPeriod}</if>
</where>
</select>
<select id="selectTmToolTypeByToolTypeId" parameterType="Long" resultMap="TmToolTypeResult">
<include refid="selectTmToolTypeVo"/>
where tool_type_id = #{toolTypeId}
</select>
<select id="checkToolTypeCodeUnique" parameterType="TmToolType" resultMap="TmToolTypeResult">
<include refid="selectTmToolTypeVo"/>
where tool_type_code = #{toolTypeCode} limit 1
</select>
<select id="checkToolTypeNameUnique" parameterType="TmToolType" resultMap="TmToolTypeResult">
<include refid="selectTmToolTypeVo"/>
where tool_type_name = #{toolTypeName} limit 1
</select>
<insert id="insertTmToolType" parameterType="TmToolType" useGeneratedKeys="true" keyProperty="toolTypeId">
insert into tm_tool_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="toolTypeCode != null and toolTypeCode != ''">tool_type_code,</if>
<if test="toolTypeName != null and toolTypeName != ''">tool_type_name,</if>
<if test="codeFlag != null and codeFlag != ''">code_flag,</if>
<if test="maintenType != null">mainten_type,</if>
<if test="maintenPeriod != null">mainten_period,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="toolTypeCode != null and toolTypeCode != ''">#{toolTypeCode},</if>
<if test="toolTypeName != null and toolTypeName != ''">#{toolTypeName},</if>
<if test="codeFlag != null and codeFlag != ''">#{codeFlag},</if>
<if test="maintenType != null">#{maintenType},</if>
<if test="maintenPeriod != null">#{maintenPeriod},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTmToolType" parameterType="TmToolType">
update tm_tool_type
<trim prefix="SET" suffixOverrides=",">
<if test="toolTypeCode != null and toolTypeCode != ''">tool_type_code = #{toolTypeCode},</if>
<if test="toolTypeName != null and toolTypeName != ''">tool_type_name = #{toolTypeName},</if>
<if test="codeFlag != null and codeFlag != ''">code_flag = #{codeFlag},</if>
<if test="maintenType != null">mainten_type = #{maintenType},</if>
<if test="maintenPeriod != null">mainten_period = #{maintenPeriod},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where tool_type_id = #{toolTypeId}
</update>
<delete id="deleteTmToolTypeByToolTypeId" parameterType="Long">
delete from tm_tool_type where tool_type_id = #{toolTypeId}
</delete>
<delete id="deleteTmToolTypeByToolTypeIds" parameterType="String">
delete from tm_tool_type where tool_type_id in
<foreach item="toolTypeId" collection="array" open="(" separator="," close=")">
#{toolTypeId}
</foreach>
</delete>
</mapper>