10 changed files with 872 additions and 0 deletions
-
1.idea/MyBatisCodeHelperDatasource.xml
-
151src/main/java/com/spring/modules/base/controller/PropertiesController.java
-
104src/main/java/com/spring/modules/base/dao/PropertiesMapper.java
-
8src/main/java/com/spring/modules/base/data/PlmPropertiesItemAvailableData.java
-
17src/main/java/com/spring/modules/base/data/PlmPropertiesItemData.java
-
196src/main/java/com/spring/modules/base/entity/PlmPropertiesItem.java
-
103src/main/java/com/spring/modules/base/entity/PlmPropertiesItemAvailable.java
-
112src/main/java/com/spring/modules/base/service/Impl/PropertiesServiceImpl.java
-
91src/main/java/com/spring/modules/base/service/PropertiesService.java
-
89src/main/resources/mapper/base/PropertiesMapper.xml
@ -0,0 +1,151 @@ |
|||||
|
package com.spring.modules.base.controller; |
||||
|
|
||||
|
import com.spring.common.utils.PageUtils; |
||||
|
import com.spring.common.utils.R; |
||||
|
import com.spring.modules.base.data.PlmPropertiesItemAvailableData; |
||||
|
import com.spring.modules.base.data.PlmPropertiesItemData; |
||||
|
import com.spring.modules.base.service.PropertiesService; |
||||
|
import com.spring.modules.base.utils.ResponseData; |
||||
|
import com.spring.modules.sys.controller.AbstractController; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Controller |
||||
|
@RequestMapping(value = "/properties") |
||||
|
public class PropertiesController extends AbstractController { |
||||
|
@Autowired |
||||
|
private PropertiesService propertiesService; |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @Description 查询点检项目 |
||||
|
* @Title propertiesItemSearch |
||||
|
* @param data |
||||
|
* @author rq |
||||
|
* @date 2023/1/29 15:12 |
||||
|
* @return Object |
||||
|
* @throw |
||||
|
*/ |
||||
|
@PostMapping(value="/propertiesItemSearch") |
||||
|
@ResponseBody |
||||
|
public R propertiesItemSearch(@RequestBody PlmPropertiesItemData data){ |
||||
|
PageUtils page = propertiesService.propertiesItemSearch(data); |
||||
|
return R.ok().put("page", page); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Description TODO |
||||
|
* @Title plmAdminSave |
||||
|
* @param data |
||||
|
* @author rq |
||||
|
* @date 2023/1/29 15:13 |
||||
|
* @return Object |
||||
|
* @throw |
||||
|
*/ |
||||
|
@PostMapping(value="/propertiesItemSave") |
||||
|
@ResponseBody |
||||
|
public Object propertiesItemSave(@RequestBody PlmPropertiesItemData data){ |
||||
|
ResponseData responseData = new ResponseData(); |
||||
|
try { |
||||
|
responseData = propertiesService.propertiesItemSave(data); |
||||
|
} catch (Exception e) { |
||||
|
responseData.setCode("400"); |
||||
|
responseData.setMsg(e.getMessage()); |
||||
|
} |
||||
|
return responseData; |
||||
|
} |
||||
|
/** |
||||
|
* @Description TODO |
||||
|
* @Title plmAdminEdit |
||||
|
* @param data |
||||
|
* @author rq |
||||
|
* @date 2023/1/29 16:49 |
||||
|
* @return Object |
||||
|
* @throw |
||||
|
*/ |
||||
|
@PostMapping(value="/propertiesItemEdit") |
||||
|
@ResponseBody |
||||
|
public Object propertiesItemEdit(@RequestBody PlmPropertiesItemData data){ |
||||
|
ResponseData responseData = new ResponseData(); |
||||
|
try { |
||||
|
responseData = propertiesService.propertiesItemEdit(data); |
||||
|
} catch (Exception e) { |
||||
|
responseData.setCode("400"); |
||||
|
responseData.setMsg(e.getMessage()); |
||||
|
} |
||||
|
return responseData; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Description TODO |
||||
|
* @Title |
||||
|
* @param data |
||||
|
* @author rq |
||||
|
* @date 2023/1/29 16:49 |
||||
|
* @return Object |
||||
|
* @throw |
||||
|
*/ |
||||
|
@PostMapping(value="/propertiesItemDelete") |
||||
|
@ResponseBody |
||||
|
public Object propertiesItemDelete(@RequestBody PlmPropertiesItemData data){ |
||||
|
ResponseData responseData = new ResponseData(); |
||||
|
try { |
||||
|
responseData = propertiesService.propertiesItemDelete(data); |
||||
|
} catch (Exception e) { |
||||
|
responseData.setCode("400"); |
||||
|
responseData.setMsg(e.getMessage()); |
||||
|
} |
||||
|
return responseData; |
||||
|
} |
||||
|
/** |
||||
|
* @Description 获取可选值清单 |
||||
|
* @Title searchItemAvailable |
||||
|
* @param inData |
||||
|
* @author rq |
||||
|
* @date 2023/2/23 10:50 |
||||
|
* @return R |
||||
|
* @throw |
||||
|
*/ |
||||
|
@PostMapping("/searchItemAvailable") |
||||
|
public R searchItemAvailable(@RequestBody PlmPropertiesItemAvailableData inData){ |
||||
|
List<PlmPropertiesItemAvailableData> resultList = propertiesService.searchItemAvailable(inData); |
||||
|
return R.ok().put("rows", resultList).put("total",resultList.size()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Description 保存 编辑可选值 |
||||
|
* @Title saveItemAvailable |
||||
|
* @param inData |
||||
|
* @author rq |
||||
|
* @date 2023/2/23 10:56 |
||||
|
* @return R |
||||
|
* @throw |
||||
|
*/ |
||||
|
@PostMapping("/saveItemAvailable") |
||||
|
public R saveItemAvailable(@RequestBody PlmPropertiesItemAvailableData inData){ |
||||
|
propertiesService.saveItemAvailable(inData); |
||||
|
return R.ok(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Description TODO |
||||
|
* @Title saveItemAvailable |
||||
|
* @param inData |
||||
|
* @author rq |
||||
|
* @date 2023/2/23 11:42 |
||||
|
* @return R |
||||
|
* @throw |
||||
|
*/ |
||||
|
@PostMapping("/deleteItemAvailable") |
||||
|
public R deleteItemAvailable(@RequestBody PlmPropertiesItemAvailableData inData){ |
||||
|
propertiesService.deleteItemAvailable(inData); |
||||
|
return R.ok(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,104 @@ |
|||||
|
package com.spring.modules.base.dao; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.spring.modules.base.data.PlmPropertiesItemAvailableData; |
||||
|
import com.spring.modules.base.data.PlmPropertiesItemData; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface PropertiesMapper { |
||||
|
IPage<PlmPropertiesItemData> plmPropertiesItemSearch(Page<PlmPropertiesItemData> PlmPropertiesItemDataPage, @Param("query") PlmPropertiesItemData inData); |
||||
|
|
||||
|
/** |
||||
|
* @Description 检查设备分类编码 |
||||
|
* @Title checkEamAdminLevel |
||||
|
* @param inData |
||||
|
* @author rq |
||||
|
* @date 2023/1/29 15:39 |
||||
|
* @return List<EamAdminLevelData> |
||||
|
* @throw |
||||
|
*/ |
||||
|
List<PlmPropertiesItemData> checkEamPropertiesItem(PlmPropertiesItemData inData); |
||||
|
|
||||
|
/** |
||||
|
* @Description 保存新的分类 |
||||
|
* @Title saveNewEamAdminLevel |
||||
|
* @param inData |
||||
|
* @author rq |
||||
|
* @date 2023/1/29 16:12 |
||||
|
* @return void |
||||
|
* @throw |
||||
|
*/ |
||||
|
void saveNewEamPropertiesItem(PlmPropertiesItemData inData); |
||||
|
/** |
||||
|
* @Description 编辑分类 |
||||
|
* @Title saveNewEamAdminLevel |
||||
|
* @param inData |
||||
|
* @author rq |
||||
|
* @date 2023/1/29 16:12 |
||||
|
* @return void |
||||
|
* @throw |
||||
|
*/ |
||||
|
void plmPropertiesItemEdit(PlmPropertiesItemData inData); |
||||
|
/** |
||||
|
* @Description TODO |
||||
|
* @Title plmAdminLevelDelete |
||||
|
* @param inData |
||||
|
* @author rq |
||||
|
* @date 2023/1/29 17:25 |
||||
|
* @return void |
||||
|
* @throw |
||||
|
*/ |
||||
|
void propertiesItemDelete(PlmPropertiesItemData inData); |
||||
|
|
||||
|
/** |
||||
|
* @Description TODO |
||||
|
* @Title searchItemAvailable |
||||
|
* @param inData |
||||
|
* @author rq |
||||
|
* @date 2023/2/23 10:52 |
||||
|
* @return List<PlmPropertiesItemAvailableData> |
||||
|
* @throw |
||||
|
*/ |
||||
|
List<PlmPropertiesItemAvailableData> searchItemAvailable(PlmPropertiesItemAvailableData inData); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @Description 获取值编号 |
||||
|
* @Title getItemValueNo |
||||
|
* @param inData |
||||
|
* @author rq |
||||
|
* @date 2023/2/23 11:21 |
||||
|
* @return Float |
||||
|
* @throw |
||||
|
*/ |
||||
|
Double getItemValueNo(PlmPropertiesItemAvailableData inData); |
||||
|
|
||||
|
/** |
||||
|
* @Description TODO |
||||
|
* @Title saveItemAvailable |
||||
|
* @param inData |
||||
|
* @author rq |
||||
|
* @date 2023/2/23 11:38 |
||||
|
* @return void |
||||
|
* @throw |
||||
|
*/ |
||||
|
void saveItemAvailable(PlmPropertiesItemAvailableData inData); |
||||
|
|
||||
|
/** |
||||
|
* @Description TODO |
||||
|
* @Title updateItemAvailable |
||||
|
* @param inData |
||||
|
* @author rq |
||||
|
* @date 2023/2/23 11:38 |
||||
|
* @return void |
||||
|
* @throw |
||||
|
*/ |
||||
|
void updateItemAvailable(PlmPropertiesItemAvailableData inData); |
||||
|
|
||||
|
void deleteItemAvailable(PlmPropertiesItemAvailableData inData); |
||||
|
} |
||||
@ -0,0 +1,8 @@ |
|||||
|
package com.spring.modules.base.data; |
||||
|
|
||||
|
import com.spring.modules.base.entity.PlmPropertiesItemAvailable; |
||||
|
import org.apache.ibatis.type.Alias; |
||||
|
|
||||
|
@Alias("PlmPropertiesItemAvailableData") |
||||
|
public class PlmPropertiesItemAvailableData extends PlmPropertiesItemAvailable { |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
package com.spring.modules.base.data; |
||||
|
|
||||
|
import com.spring.modules.base.entity.PlmPropertiesItem; |
||||
|
import org.apache.ibatis.type.Alias; |
||||
|
|
||||
|
@Alias("PlmPropertiesItemData") |
||||
|
public class PlmPropertiesItemData extends PlmPropertiesItem { |
||||
|
private Integer flag; |
||||
|
|
||||
|
public Integer getFlag() { |
||||
|
return flag; |
||||
|
} |
||||
|
|
||||
|
public void setFlag(Integer flag) { |
||||
|
this.flag = flag; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,196 @@ |
|||||
|
package com.spring.modules.base.entity; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.spring.common.utils.QueryPage; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
public class PlmPropertiesItem extends QueryPage { |
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private String site; |
||||
|
|
||||
|
/** |
||||
|
* 属性编码 |
||||
|
*/ |
||||
|
private String itemNo; |
||||
|
|
||||
|
/** |
||||
|
* 属性名称 |
||||
|
*/ |
||||
|
private String itemDesc; |
||||
|
|
||||
|
/** |
||||
|
* 默认值 |
||||
|
*/ |
||||
|
private String defaultValue; |
||||
|
|
||||
|
/** |
||||
|
* 值类型(中文) |
||||
|
*/ |
||||
|
private String valueType; |
||||
|
|
||||
|
/** |
||||
|
* 值类型 |
||||
|
*/ |
||||
|
private String valueTypeDb; |
||||
|
|
||||
|
/** |
||||
|
* 是否值可选 |
||||
|
*/ |
||||
|
private String valueChooseFlag; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
||||
|
private Date createdDate; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 最大值 |
||||
|
*/ |
||||
|
private Double maxValue; |
||||
|
|
||||
|
/** |
||||
|
* 最小值 |
||||
|
*/ |
||||
|
private Double minValue; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private String itemType; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
||||
|
private Date updateDate; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private String updateBy; |
||||
|
|
||||
|
public String getSite() { |
||||
|
return site; |
||||
|
} |
||||
|
|
||||
|
public void setSite(String site) { |
||||
|
this.site = site; |
||||
|
} |
||||
|
|
||||
|
public String getItemNo() { |
||||
|
return itemNo; |
||||
|
} |
||||
|
|
||||
|
public void setItemNo(String itemNo) { |
||||
|
this.itemNo = itemNo; |
||||
|
} |
||||
|
|
||||
|
public String getItemDesc() { |
||||
|
return itemDesc; |
||||
|
} |
||||
|
|
||||
|
public void setItemDesc(String itemDesc) { |
||||
|
this.itemDesc = itemDesc; |
||||
|
} |
||||
|
|
||||
|
public String getDefaultValue() { |
||||
|
return defaultValue; |
||||
|
} |
||||
|
|
||||
|
public void setDefaultValue(String defaultValue) { |
||||
|
this.defaultValue = defaultValue; |
||||
|
} |
||||
|
|
||||
|
public String getValueType() { |
||||
|
return valueType; |
||||
|
} |
||||
|
|
||||
|
public void setValueType(String valueType) { |
||||
|
this.valueType = valueType; |
||||
|
} |
||||
|
|
||||
|
public String getValueTypeDb() { |
||||
|
return valueTypeDb; |
||||
|
} |
||||
|
|
||||
|
public void setValueTypeDb(String valueTypeDb) { |
||||
|
this.valueTypeDb = valueTypeDb; |
||||
|
} |
||||
|
|
||||
|
public String getValueChooseFlag() { |
||||
|
return valueChooseFlag; |
||||
|
} |
||||
|
|
||||
|
public void setValueChooseFlag(String valueChooseFlag) { |
||||
|
this.valueChooseFlag = valueChooseFlag; |
||||
|
} |
||||
|
|
||||
|
public Date getCreatedDate() { |
||||
|
return createdDate; |
||||
|
} |
||||
|
|
||||
|
public void setCreatedDate(Date createdDate) { |
||||
|
this.createdDate = createdDate; |
||||
|
} |
||||
|
|
||||
|
public String getCreatedBy() { |
||||
|
return createdBy; |
||||
|
} |
||||
|
|
||||
|
public void setCreatedBy(String createdBy) { |
||||
|
this.createdBy = createdBy; |
||||
|
} |
||||
|
|
||||
|
public Double getMaxValue() { |
||||
|
return maxValue; |
||||
|
} |
||||
|
|
||||
|
public void setMaxValue(Double maxValue) { |
||||
|
this.maxValue = maxValue; |
||||
|
} |
||||
|
|
||||
|
public Double getMinValue() { |
||||
|
return minValue; |
||||
|
} |
||||
|
|
||||
|
public void setMinValue(Double minValue) { |
||||
|
this.minValue = minValue; |
||||
|
} |
||||
|
|
||||
|
public String getItemType() { |
||||
|
return itemType; |
||||
|
} |
||||
|
|
||||
|
public void setItemType(String itemType) { |
||||
|
this.itemType = itemType; |
||||
|
} |
||||
|
|
||||
|
public Date getUpdateDate() { |
||||
|
return updateDate; |
||||
|
} |
||||
|
|
||||
|
public void setUpdateDate(Date updateDate) { |
||||
|
this.updateDate = updateDate; |
||||
|
} |
||||
|
|
||||
|
public String getUpdateBy() { |
||||
|
return updateBy; |
||||
|
} |
||||
|
|
||||
|
public void setUpdateBy(String updateBy) { |
||||
|
this.updateBy = updateBy; |
||||
|
} |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,103 @@ |
|||||
|
package com.spring.modules.base.entity; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.spring.common.utils.QueryPage; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
public class PlmPropertiesItemAvailable extends QueryPage { |
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private String site; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private String itemNo; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private String itemType; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private Double valueNo; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private String availableValue; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
||||
|
private Date createdDate; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
public String getSite() { |
||||
|
return site; |
||||
|
} |
||||
|
|
||||
|
public void setSite(String site) { |
||||
|
this.site = site; |
||||
|
} |
||||
|
|
||||
|
public String getItemNo() { |
||||
|
return itemNo; |
||||
|
} |
||||
|
|
||||
|
public void setItemNo(String itemNo) { |
||||
|
this.itemNo = itemNo; |
||||
|
} |
||||
|
|
||||
|
public String getItemType() { |
||||
|
return itemType; |
||||
|
} |
||||
|
|
||||
|
public void setItemType(String itemType) { |
||||
|
this.itemType = itemType; |
||||
|
} |
||||
|
|
||||
|
public Double getValueNo() { |
||||
|
return valueNo; |
||||
|
} |
||||
|
|
||||
|
public void setValueNo(Double valueNo) { |
||||
|
this.valueNo = valueNo; |
||||
|
} |
||||
|
|
||||
|
public String getAvailableValue() { |
||||
|
return availableValue; |
||||
|
} |
||||
|
|
||||
|
public void setAvailableValue(String availableValue) { |
||||
|
this.availableValue = availableValue; |
||||
|
} |
||||
|
|
||||
|
public Date getCreatedDate() { |
||||
|
return createdDate; |
||||
|
} |
||||
|
|
||||
|
public void setCreatedDate(Date createdDate) { |
||||
|
this.createdDate = createdDate; |
||||
|
} |
||||
|
|
||||
|
public String getCreatedBy() { |
||||
|
return createdBy; |
||||
|
} |
||||
|
|
||||
|
public void setCreatedBy(String createdBy) { |
||||
|
this.createdBy = createdBy; |
||||
|
} |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,112 @@ |
|||||
|
package com.spring.modules.base.service.Impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.spring.common.utils.PageUtils; |
||||
|
import com.spring.modules.base.dao.PropertiesMapper; |
||||
|
import com.spring.modules.base.data.PlmPropertiesItemAvailableData; |
||||
|
import com.spring.modules.base.data.PlmPropertiesItemData; |
||||
|
import com.spring.modules.base.service.PropertiesService; |
||||
|
import com.spring.modules.base.utils.ResponseData; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Service |
||||
|
public class PropertiesServiceImpl implements PropertiesService { |
||||
|
@Autowired |
||||
|
private PropertiesMapper propertiesMapper; |
||||
|
|
||||
|
@Override |
||||
|
public PageUtils propertiesItemSearch(PlmPropertiesItemData inData){ |
||||
|
IPage<PlmPropertiesItemData> resultList = this.propertiesMapper.plmPropertiesItemSearch(new Page<PlmPropertiesItemData>(inData.getPage(), inData.getLimit()), inData); |
||||
|
return new PageUtils(resultList); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public ResponseData propertiesItemSave(PlmPropertiesItemData inData){ |
||||
|
ResponseData responseData = new ResponseData(); |
||||
|
if("T".equals(inData.getValueTypeDb())){ |
||||
|
inData.setValueType("文本"); |
||||
|
inData.setMaxValue(null); |
||||
|
inData.setMinValue(null); |
||||
|
}else { |
||||
|
inData.setValueType("数字"); |
||||
|
if(inData.getMaxValue() != null&&inData.getMinValue()!=null){ |
||||
|
if(inData.getMaxValue() < inData.getMinValue()){ |
||||
|
throw new RuntimeException("最大值不能小于最小值!"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
List<PlmPropertiesItemData> checkPropertiesItemLevel = propertiesMapper.checkEamPropertiesItem(inData); |
||||
|
if(checkPropertiesItemLevel.size() > 0){ |
||||
|
throw new RuntimeException("该编码已存在!"); |
||||
|
} |
||||
|
propertiesMapper.saveNewEamPropertiesItem(inData); |
||||
|
responseData.setMsg("保存成功!"); |
||||
|
responseData.setSuccess(true); |
||||
|
responseData.setCode("0"); |
||||
|
return responseData; |
||||
|
} |
||||
|
@Override |
||||
|
public ResponseData propertiesItemEdit(PlmPropertiesItemData inData){ |
||||
|
ResponseData responseData = new ResponseData(); |
||||
|
if("T".equals(inData.getValueTypeDb())){ |
||||
|
inData.setValueType("文本"); |
||||
|
inData.setMaxValue(null); |
||||
|
inData.setMinValue(null); |
||||
|
}else { |
||||
|
inData.setValueType("数字"); |
||||
|
if(inData.getMaxValue() != null&&inData.getMinValue() != null) { |
||||
|
if (inData.getMaxValue() < inData.getMinValue()) { |
||||
|
throw new RuntimeException("最大值不能小于最小值!"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
List<PlmPropertiesItemData> checkEamPropertiesItem = propertiesMapper.checkEamPropertiesItem(inData); |
||||
|
if(checkEamPropertiesItem.size() == 0) { |
||||
|
throw new RuntimeException("该属性不存在请刷新数据!"); |
||||
|
} |
||||
|
// 修改项目内容 |
||||
|
propertiesMapper.plmPropertiesItemEdit(inData); |
||||
|
responseData.setMsg("修改成功!"); |
||||
|
responseData.setSuccess(true); |
||||
|
responseData.setCode("0"); |
||||
|
return responseData; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResponseData propertiesItemDelete(PlmPropertiesItemData inData){ |
||||
|
ResponseData responseData = new ResponseData(); |
||||
|
propertiesMapper.propertiesItemDelete(inData); |
||||
|
responseData.setMsg("删除成功!"); |
||||
|
responseData.setSuccess(true); |
||||
|
responseData.setCode("0"); |
||||
|
return responseData; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<PlmPropertiesItemAvailableData> searchItemAvailable(PlmPropertiesItemAvailableData inData) { |
||||
|
return propertiesMapper.searchItemAvailable(inData); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void saveItemAvailable(PlmPropertiesItemAvailableData inData){ |
||||
|
//判断是新增还是修改 |
||||
|
if(inData.getValueNo() == 0){ |
||||
|
//新增 |
||||
|
Double valueNo = propertiesMapper.getItemValueNo(inData); |
||||
|
inData.setValueNo(valueNo); |
||||
|
propertiesMapper.saveItemAvailable(inData); |
||||
|
}else { |
||||
|
propertiesMapper.updateItemAvailable(inData); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void deleteItemAvailable(PlmPropertiesItemAvailableData inData){ |
||||
|
propertiesMapper.deleteItemAvailable(inData); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,91 @@ |
|||||
|
package com.spring.modules.base.service; |
||||
|
|
||||
|
import com.spring.common.utils.PageUtils; |
||||
|
import com.spring.modules.base.data.PlmPropertiesItemAvailableData; |
||||
|
import com.spring.modules.base.data.PlmPropertiesItemData; |
||||
|
import com.spring.modules.base.utils.ResponseData; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface PropertiesService { |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @param inData |
||||
|
* @return List<EamAdminLevelData> |
||||
|
* @Description |
||||
|
* @Title EamPropertiesItem |
||||
|
* @author rq |
||||
|
* @date 2023/1/29 13:34 |
||||
|
* @throw |
||||
|
*/ |
||||
|
PageUtils propertiesItemSearch(PlmPropertiesItemData inData); |
||||
|
|
||||
|
/** |
||||
|
* @param inData |
||||
|
* @return ResponseData |
||||
|
* @Description |
||||
|
* @Title |
||||
|
* @author rq |
||||
|
* @date 2023/1/29 15:19 |
||||
|
* @throw |
||||
|
*/ |
||||
|
ResponseData propertiesItemSave(PlmPropertiesItemData inData); |
||||
|
|
||||
|
/** |
||||
|
* @param inData |
||||
|
* @return ResponseData |
||||
|
* @Description |
||||
|
* @Title |
||||
|
* @author rq |
||||
|
* @date 2023/1/29 16:50 |
||||
|
* @throw |
||||
|
*/ |
||||
|
ResponseData propertiesItemEdit(PlmPropertiesItemData inData); |
||||
|
|
||||
|
/** |
||||
|
* @param inData |
||||
|
* @return ResponseData |
||||
|
* @Description |
||||
|
* @Title |
||||
|
* @author rq |
||||
|
* @date 2023/1/29 16:50 |
||||
|
* @throw |
||||
|
*/ |
||||
|
ResponseData propertiesItemDelete(PlmPropertiesItemData inData); |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @param inData |
||||
|
* @return List<PlmPropertiesItemAvailableData> |
||||
|
* @Description TODO |
||||
|
* @Title searchItemAvailable |
||||
|
* @author rq |
||||
|
* @date 2023/2/23 10:52 |
||||
|
* @throw |
||||
|
*/ |
||||
|
List<PlmPropertiesItemAvailableData> searchItemAvailable(PlmPropertiesItemAvailableData inData); |
||||
|
|
||||
|
/** |
||||
|
* @param inData |
||||
|
* @return void |
||||
|
* @Description 保存可选值 |
||||
|
* @Title saveItemAvailable |
||||
|
* @author rq |
||||
|
* @date 2023/2/23 10:57 |
||||
|
* @throw |
||||
|
*/ |
||||
|
void saveItemAvailable(PlmPropertiesItemAvailableData inData); |
||||
|
|
||||
|
/** |
||||
|
* @param |
||||
|
* @return void |
||||
|
* @Description TODO |
||||
|
* @Title deleteItemAvailable |
||||
|
* @author rq |
||||
|
* @date 2023/2/23 11:43 |
||||
|
* @throw |
||||
|
*/ |
||||
|
void deleteItemAvailable(PlmPropertiesItemAvailableData inData); |
||||
|
} |
||||
@ -0,0 +1,89 @@ |
|||||
|
<?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.spring.modules.base.dao.PropertiesMapper"> |
||||
|
|
||||
|
<!-- 查询点检项目 --> |
||||
|
<select id="plmPropertiesItemSearch" parameterType="PlmPropertiesItemData" resultType="PlmPropertiesItemData"> |
||||
|
SELECT |
||||
|
ItemNo, |
||||
|
ItemDesc, |
||||
|
DefaultValue, |
||||
|
ValueType, |
||||
|
ValueType_DB as valueTypeDb, |
||||
|
ValueChooseFlag, |
||||
|
CreatedDate, |
||||
|
CreatedBy, |
||||
|
update_date, |
||||
|
update_by, |
||||
|
MaxValue, |
||||
|
MinValue, |
||||
|
ItemType |
||||
|
FROM plm_properties_item |
||||
|
<where> |
||||
|
site = #{query.site} |
||||
|
<if test="query.itemType != null and query.itemType != ''"> |
||||
|
and ItemType = #{query.itemType} |
||||
|
</if> |
||||
|
<if test="query.itemNo != null and query.itemNo != ''"> |
||||
|
AND ItemNo LIKE '%' + #{query.itemNo}+'%' |
||||
|
</if> |
||||
|
<if test="query.itemDesc != null and query.itemDesc != ''"> |
||||
|
AND ItemDesc LIKE '%' + #{query.itemDesc}+'%' |
||||
|
</if> |
||||
|
</where> |
||||
|
order by ItemType ,ItemNo |
||||
|
</select> |
||||
|
|
||||
|
<select id="checkEamPropertiesItem" resultType="PlmPropertiesItemData"> |
||||
|
SELECT ItemNo,ItemDesc FROM plm_properties_item WHERE ItemNo = #{itemNo} and ItemType = #{itemType} and site = #{site} |
||||
|
</select> |
||||
|
|
||||
|
<insert id="saveNewEamPropertiesItem" > |
||||
|
Insert into plm_properties_item (site,ItemNo,ItemDesc,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,CreatedDate |
||||
|
,CreatedBy,MaxValue,MinValue,ItemType) values |
||||
|
(#{site},#{itemNo},#{itemDesc},#{defaultValue},#{valueType},#{valueTypeDb},#{valueChooseFlag},GetDate(), |
||||
|
#{createdBy},#{maxValue,jdbcType=DOUBLE},#{minValue,jdbcType=DOUBLE},#{itemType}) |
||||
|
</insert> |
||||
|
|
||||
|
<update id="plmPropertiesItemEdit" > |
||||
|
update plm_properties_item |
||||
|
set ItemDesc=#{itemDesc},DefaultValue=#{defaultValue},ValueType=#{valueType},ValueType_DB=#{valueTypeDb}, |
||||
|
ValueChooseFlag=#{valueChooseFlag},update_date=GetDate() |
||||
|
,update_by=#{updateBy},MaxValue=#{maxValue,jdbcType=DOUBLE},MinValue=#{minValue,jdbcType=DOUBLE},ItemType=#{itemType} |
||||
|
WHERE ItemNo = #{itemNo} and ItemType = #{itemType} and site = #{site} |
||||
|
</update> |
||||
|
|
||||
|
<delete id="propertiesItemDelete"> |
||||
|
Delete FROM plm_properties_item WHERE ItemNo = #{itemNo} and ItemType = #{itemType} and site = #{site} |
||||
|
</delete> |
||||
|
<select id="searchItemAvailable" resultType="PlmPropertiesItemAvailableData"> |
||||
|
SELECT |
||||
|
site, |
||||
|
ItemNo, |
||||
|
ValueNo, |
||||
|
AvailableValue, |
||||
|
CreatedDate, |
||||
|
CreatedBy, |
||||
|
ItemType |
||||
|
from plm_properties_item_available |
||||
|
where itemNo = #{itemNo} and ItemType = #{itemType} and site = #{site} |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
<select id="getItemValueNo" resultType="Double"> |
||||
|
SELECT isnull( max(valueNo),0)+1 from plm_properties_item_available where itemNo = #{itemNo} and ItemType = #{itemType} and site = #{site} |
||||
|
</select> |
||||
|
|
||||
|
<insert id="saveItemAvailable"> |
||||
|
insert into plm_properties_item_available (ItemNo,ValueNo,AvailableValue,CreatedDate,CreatedBy,ItemType,site) |
||||
|
values(#{itemNo},#{valueNo},#{availableValue},GetDate(),#{createdBy},#{itemType},#{site}) |
||||
|
</insert> |
||||
|
|
||||
|
<update id="updateItemAvailable"> |
||||
|
update plm_properties_item_available set AvailableValue = #{availableValue} where itemNo = #{itemNo} and ItemType = #{itemType} and ValueNo = #{valueNo} and site = #{site} |
||||
|
</update> |
||||
|
|
||||
|
<delete id="deleteItemAvailable"> |
||||
|
delete from eam_properties_item_available where itemNo = #{itemNo} and ItemType = #{itemType} and ValueNo = #{valueNo} and site = #{site} |
||||
|
</delete> |
||||
|
</mapper> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue