设备管理-检查项维护初始化

highway
wws 1 year ago
parent 4a0b3dc0b2
commit 6e57dfe409

@ -0,0 +1,97 @@
package com.op.device.controller;
import java.util.List;
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.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.device.domain.EquCheckItem;
import com.op.device.service.IEquCheckItemService;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author wws
* @date 2023-10-09
*/
@RestController
@RequestMapping("/item")
public class EquCheckItemController extends BaseController {
@Autowired
private IEquCheckItemService equCheckItemService;
/**
*
*/
@RequiresPermissions("device:item:list")
@GetMapping("/list")
public TableDataInfo list(EquCheckItem equCheckItem) {
startPage();
List<EquCheckItem> list = equCheckItemService.selectEquCheckItemList(equCheckItem);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("device:item:export")
@Log(title = "检查项维护", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EquCheckItem equCheckItem) {
List<EquCheckItem> list = equCheckItemService.selectEquCheckItemList(equCheckItem);
ExcelUtil<EquCheckItem> util = new ExcelUtil<EquCheckItem>(EquCheckItem.class);
util.exportExcel(response, list, "检查项维护数据");
}
/**
*
*/
@RequiresPermissions("device:item:query")
@GetMapping(value = "/{itemId}")
public AjaxResult getInfo(@PathVariable("itemId") String itemId) {
return success(equCheckItemService.selectEquCheckItemByItemId(itemId));
}
/**
*
*/
@RequiresPermissions("device:item:add")
@Log(title = "检查项维护", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EquCheckItem equCheckItem) {
return toAjax(equCheckItemService.insertEquCheckItem(equCheckItem));
}
/**
*
*/
@RequiresPermissions("device:item:edit")
@Log(title = "检查项维护", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EquCheckItem equCheckItem) {
return toAjax(equCheckItemService.updateEquCheckItem(equCheckItem));
}
/**
*
*/
@RequiresPermissions("device:item:remove")
@Log(title = "检查项维护", businessType = BusinessType.DELETE)
@DeleteMapping("/{itemIds}")
public AjaxResult remove(@PathVariable String[] itemIds) {
return toAjax(equCheckItemService.deleteEquCheckItemByItemIds(itemIds));
}
}

@ -0,0 +1,218 @@
package com.op.device.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
/**
* equ_check_item
*
* @author wws
* @date 2023-10-09
*/
public class EquCheckItem extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键 */
private String itemId;
/** 检查项编码 */
@Excel(name = "检查项编码")
private String itemCode;
/** 检查项名称 */
@Excel(name = "检查项名称")
private String itemName;
/** 检查项方法/工具 */
@Excel(name = "检查项方法/工具")
private String itemMethod;
/** 维护类型编码 */
@Excel(name = "维护类型编码")
private String itemType;
/** 维护类型名称 */
@Excel(name = "维护类型名称")
private String itemTypeName;
/** 检查项备注 */
@Excel(name = "检查项备注")
private String itemRemark;
/** 工厂 */
@Excel(name = "工厂")
private String factory;
/** 备用字段1 */
@Excel(name = "备用字段1")
private String attr1;
/** 备用字段2 */
@Excel(name = "备用字段2")
private String attr2;
/** 备用字段3 */
@Excel(name = "备用字段3")
private String attr3;
/** 删除标识 */
@Excel(name = "删除标识")
private String delFlag;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdTime;
/** 创建人 */
@Excel(name = "创建人")
private String createdBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedTime;
/** 更新人 */
@Excel(name = "更新人")
private String updatedBy;
public void setItemId(String itemId) {
this.itemId = itemId;
}
public String getItemId() {
return itemId;
}
public void setItemCode(String itemCode) {
this.itemCode = itemCode;
}
public String getItemCode() {
return itemCode;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public String getItemName() {
return itemName;
}
public void setItemMethod(String itemMethod) {
this.itemMethod = itemMethod;
}
public String getItemMethod() {
return itemMethod;
}
public void setItemType(String itemType) {
this.itemType = itemType;
}
public String getItemType() {
return itemType;
}
public void setItemTypeName(String itemTypeName) {
this.itemTypeName = itemTypeName;
}
public String getItemTypeName() {
return itemTypeName;
}
public void setItemRemark(String itemRemark) {
this.itemRemark = itemRemark;
}
public String getItemRemark() {
return itemRemark;
}
public void setFactory(String factory) {
this.factory = factory;
}
public String getFactory() {
return factory;
}
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(String attr3) {
this.attr3 = attr3;
}
public String getAttr3() {
return attr3;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag() {
return delFlag;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public String getCreatedBy() {
return createdBy;
}
public void setUpdatedTime(Date updatedTime) {
this.updatedTime = updatedTime;
}
public Date getUpdatedTime() {
return updatedTime;
}
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
public String getUpdatedBy() {
return updatedBy;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("itemId", getItemId())
.append("itemCode", getItemCode())
.append("itemName", getItemName())
.append("itemMethod", getItemMethod())
.append("itemType", getItemType())
.append("itemTypeName", getItemTypeName())
.append("itemRemark", getItemRemark())
.append("factory", getFactory())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("delFlag", getDelFlag())
.append("createdTime", getCreatedTime())
.append("createdBy", getCreatedBy())
.append("updatedTime", getUpdatedTime())
.append("updatedBy", getUpdatedBy())
.toString();
}
}

@ -0,0 +1,61 @@
package com.op.device.mapper;
import java.util.List;
import com.op.device.domain.EquCheckItem;
/**
* Mapper
*
* @author wws
* @date 2023-10-09
*/
public interface EquCheckItemMapper {
/**
*
*
* @param itemId
* @return
*/
public EquCheckItem selectEquCheckItemByItemId(String itemId);
/**
*
*
* @param equCheckItem
* @return
*/
public List<EquCheckItem> selectEquCheckItemList(EquCheckItem equCheckItem);
/**
*
*
* @param equCheckItem
* @return
*/
public int insertEquCheckItem(EquCheckItem equCheckItem);
/**
*
*
* @param equCheckItem
* @return
*/
public int updateEquCheckItem(EquCheckItem equCheckItem);
/**
*
*
* @param itemId
* @return
*/
public int deleteEquCheckItemByItemId(String itemId);
/**
*
*
* @param itemIds
* @return
*/
public int deleteEquCheckItemByItemIds(String[] itemIds);
}

@ -0,0 +1,60 @@
package com.op.device.service;
import java.util.List;
import com.op.device.domain.EquCheckItem;
/**
* Service
*
* @author wws
* @date 2023-10-09
*/
public interface IEquCheckItemService {
/**
*
*
* @param itemId
* @return
*/
public EquCheckItem selectEquCheckItemByItemId(String itemId);
/**
*
*
* @param equCheckItem
* @return
*/
public List<EquCheckItem> selectEquCheckItemList(EquCheckItem equCheckItem);
/**
*
*
* @param equCheckItem
* @return
*/
public int insertEquCheckItem(EquCheckItem equCheckItem);
/**
*
*
* @param equCheckItem
* @return
*/
public int updateEquCheckItem(EquCheckItem equCheckItem);
/**
*
*
* @param itemIds
* @return
*/
public int deleteEquCheckItemByItemIds(String[] itemIds);
/**
*
*
* @param itemId
* @return
*/
public int deleteEquCheckItemByItemId(String itemId);
}

@ -0,0 +1,94 @@
package com.op.device.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.op.device.mapper.EquCheckItemMapper;
import com.op.device.domain.EquCheckItem;
import com.op.device.service.IEquCheckItemService;
/**
* Service
*
* @author wws
* @date 2023-10-09
*/
@Service
public class EquCheckItemServiceImpl implements IEquCheckItemService {
@Autowired
private EquCheckItemMapper equCheckItemMapper;
/**
*
*
* @param itemId
* @return
*/
@Override
@DS("#header.poolName")
public EquCheckItem selectEquCheckItemByItemId(String itemId) {
return equCheckItemMapper.selectEquCheckItemByItemId(itemId);
}
/**
*
*
* @param equCheckItem
* @return
*/
@Override
@DS("#header.poolName")
public List<EquCheckItem> selectEquCheckItemList(EquCheckItem equCheckItem) {
return equCheckItemMapper.selectEquCheckItemList(equCheckItem);
}
/**
*
*
* @param equCheckItem
* @return
*/
@Override
@DS("#header.poolName")
public int insertEquCheckItem(EquCheckItem equCheckItem) {
return equCheckItemMapper.insertEquCheckItem(equCheckItem);
}
/**
*
*
* @param equCheckItem
* @return
*/
@Override
@DS("#header.poolName")
public int updateEquCheckItem(EquCheckItem equCheckItem) {
return equCheckItemMapper.updateEquCheckItem(equCheckItem);
}
/**
*
*
* @param itemIds
* @return
*/
@Override
@DS("#header.poolName")
public int deleteEquCheckItemByItemIds(String[] itemIds) {
return equCheckItemMapper.deleteEquCheckItemByItemIds(itemIds);
}
/**
*
*
* @param itemId
* @return
*/
@Override
@DS("#header.poolName")
public int deleteEquCheckItemByItemId(String itemId) {
return equCheckItemMapper.deleteEquCheckItemByItemId(itemId);
}
}

@ -0,0 +1,128 @@
<?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.op.device.mapper.EquCheckItemMapper">
<resultMap type="EquCheckItem" id="EquCheckItemResult">
<result property="itemId" column="item_id" />
<result property="itemCode" column="item_code" />
<result property="itemName" column="item_name" />
<result property="itemMethod" column="item_method" />
<result property="itemType" column="item_type" />
<result property="itemTypeName" column="item_type_name" />
<result property="itemRemark" column="item_remark" />
<result property="factory" column="factory" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="delFlag" column="del_flag" />
<result property="createdTime" column="created_time" />
<result property="createdBy" column="created_by" />
<result property="updatedTime" column="updated_time" />
<result property="updatedBy" column="updated_by" />
</resultMap>
<sql id="selectEquCheckItemVo">
select item_id, item_code, item_name, item_method, item_type, item_type_name, item_remark, factory, attr1, attr2, attr3, del_flag, created_time, created_by, updated_time, updated_by from equ_check_item
</sql>
<select id="selectEquCheckItemList" parameterType="EquCheckItem" resultMap="EquCheckItemResult">
<include refid="selectEquCheckItemVo"/>
<where>
<if test="itemCode != null and itemCode != ''"> and item_code = #{itemCode}</if>
<if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>
<if test="itemMethod != null and itemMethod != ''"> and item_method = #{itemMethod}</if>
<if test="itemType != null and itemType != ''"> and item_type = #{itemType}</if>
<if test="itemTypeName != null and itemTypeName != ''"> and item_type_name like concat('%', #{itemTypeName}, '%')</if>
<if test="itemRemark != null and itemRemark != ''"> and item_remark = #{itemRemark}</if>
<if test="factory != null and factory != ''"> and factory = #{factory}</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
</where>
</select>
<select id="selectEquCheckItemByItemId" parameterType="String" resultMap="EquCheckItemResult">
<include refid="selectEquCheckItemVo"/>
where item_id = #{itemId}
</select>
<insert id="insertEquCheckItem" parameterType="EquCheckItem">
insert into equ_check_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="itemId != null">item_id,</if>
<if test="itemCode != null and itemCode != ''">item_code,</if>
<if test="itemName != null and itemName != ''">item_name,</if>
<if test="itemMethod != null and itemMethod != ''">item_method,</if>
<if test="itemType != null and itemType != ''">item_type,</if>
<if test="itemTypeName != null and itemTypeName != ''">item_type_name,</if>
<if test="itemRemark != null and itemRemark != ''">item_remark,</if>
<if test="factory != null">factory,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createdTime != null">created_time,</if>
<if test="createdBy != null and createdBy != ''">created_by,</if>
<if test="updatedTime != null">updated_time,</if>
<if test="updatedBy != null and updatedBy != ''">updated_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="itemId != null">#{itemId},</if>
<if test="itemCode != null and itemCode != ''">#{itemCode},</if>
<if test="itemName != null and itemName != ''">#{itemName},</if>
<if test="itemMethod != null and itemMethod != ''">#{itemMethod},</if>
<if test="itemType != null and itemType != ''">#{itemType},</if>
<if test="itemTypeName != null and itemTypeName != ''">#{itemTypeName},</if>
<if test="itemRemark != null and itemRemark != ''">#{itemRemark},</if>
<if test="factory != null">#{factory},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="createdBy != null and createdBy != ''">#{createdBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
<if test="updatedBy != null and updatedBy != ''">#{updatedBy},</if>
</trim>
</insert>
<update id="updateEquCheckItem" parameterType="EquCheckItem">
update equ_check_item
<trim prefix="SET" suffixOverrides=",">
<if test="itemCode != null and itemCode != ''">item_code = #{itemCode},</if>
<if test="itemName != null and itemName != ''">item_name = #{itemName},</if>
<if test="itemMethod != null and itemMethod != ''">item_method = #{itemMethod},</if>
<if test="itemType != null and itemType != ''">item_type = #{itemType},</if>
<if test="itemTypeName != null and itemTypeName != ''">item_type_name = #{itemTypeName},</if>
<if test="itemRemark != null and itemRemark != ''">item_remark = #{itemRemark},</if>
<if test="factory != null">factory = #{factory},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="createdBy != null and createdBy != ''">created_by = #{createdBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
<if test="updatedBy != null and updatedBy != ''">updated_by = #{updatedBy},</if>
</trim>
where item_id = #{itemId}
</update>
<delete id="deleteEquCheckItemByItemId" parameterType="String">
delete from equ_check_item where item_id = #{itemId}
</delete>
<delete id="deleteEquCheckItemByItemIds" parameterType="String">
delete from equ_check_item where item_id in
<foreach item="itemId" collection="array" open="(" separator="," close=")">
#{itemId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save