CHECKBOX
This commit is contained in:
parent
7dbadb12a4
commit
efaface48b
@ -3,7 +3,10 @@ package com.ktg.mes.qc.controller;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import com.ktg.common.constant.UserConstants;
|
import com.ktg.common.constant.UserConstants;
|
||||||
|
import com.ktg.common.utils.StringUtils;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -30,7 +33,7 @@ import com.ktg.common.core.page.TableDataInfo;
|
|||||||
* @date 2022-05-17
|
* @date 2022-05-17
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/qc/qctemplate")
|
@RequestMapping("/mes/qc/qctemplate")
|
||||||
public class QcTemplateController extends BaseController
|
public class QcTemplateController extends BaseController
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -39,19 +42,28 @@ public class QcTemplateController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 查询检测模板列表
|
* 查询检测模板列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('qc:qctemplate:list')")
|
@PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(QcTemplate qcTemplate)
|
public TableDataInfo list(QcTemplate qcTemplate)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<QcTemplate> list = qcTemplateService.selectQcTemplateList(qcTemplate);
|
List<QcTemplate> list = qcTemplateService.selectQcTemplateList(qcTemplate);
|
||||||
|
if(CollUtil.isNotEmpty(list)){
|
||||||
|
int i=0;
|
||||||
|
for (QcTemplate template: list
|
||||||
|
) {
|
||||||
|
template.setQcTypesParam(template.getQcTypes().split(","));
|
||||||
|
list.set(i,template);
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出检测模板列表
|
* 导出检测模板列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('qc:qctemplate:export')")
|
@PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:export')")
|
||||||
@Log(title = "检测模板", businessType = BusinessType.EXPORT)
|
@Log(title = "检测模板", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, QcTemplate qcTemplate)
|
public void export(HttpServletResponse response, QcTemplate qcTemplate)
|
||||||
@ -64,7 +76,7 @@ public class QcTemplateController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 获取检测模板详细信息
|
* 获取检测模板详细信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('qc:qctemplate:query')")
|
@PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:query')")
|
||||||
@GetMapping(value = "/{templateId}")
|
@GetMapping(value = "/{templateId}")
|
||||||
public AjaxResult getInfo(@PathVariable("templateId") Long templateId)
|
public AjaxResult getInfo(@PathVariable("templateId") Long templateId)
|
||||||
{
|
{
|
||||||
@ -74,7 +86,7 @@ public class QcTemplateController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 新增检测模板
|
* 新增检测模板
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('qc:qctemplate:add')")
|
@PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:add')")
|
||||||
@Log(title = "检测模板", businessType = BusinessType.INSERT)
|
@Log(title = "检测模板", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody QcTemplate qcTemplate)
|
public AjaxResult add(@RequestBody QcTemplate qcTemplate)
|
||||||
@ -82,13 +94,26 @@ public class QcTemplateController extends BaseController
|
|||||||
if(UserConstants.NOT_UNIQUE.equals(qcTemplateService.checkTemplateCodeUnique(qcTemplate))){
|
if(UserConstants.NOT_UNIQUE.equals(qcTemplateService.checkTemplateCodeUnique(qcTemplate))){
|
||||||
return AjaxResult.error("检测模板编号已存在!");
|
return AjaxResult.error("检测模板编号已存在!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ArrayUtil.isNotEmpty(qcTemplate.getQcTypesParam())){
|
||||||
|
String[] types = qcTemplate.getQcTypesParam();
|
||||||
|
for (String type:types
|
||||||
|
) {
|
||||||
|
if(StringUtils.isNotNull(qcTemplate.getQcTypes())){
|
||||||
|
qcTemplate.setQcTypes(qcTemplate.getQcTypes()+','+type);
|
||||||
|
}else{
|
||||||
|
qcTemplate.setQcTypes(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return toAjax(qcTemplateService.insertQcTemplate(qcTemplate));
|
return toAjax(qcTemplateService.insertQcTemplate(qcTemplate));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改检测模板
|
* 修改检测模板
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('qc:qctemplate:edit')")
|
@PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:edit')")
|
||||||
@Log(title = "检测模板", businessType = BusinessType.UPDATE)
|
@Log(title = "检测模板", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody QcTemplate qcTemplate)
|
public AjaxResult edit(@RequestBody QcTemplate qcTemplate)
|
||||||
@ -96,13 +121,24 @@ public class QcTemplateController extends BaseController
|
|||||||
if(UserConstants.NOT_UNIQUE.equals(qcTemplateService.checkTemplateCodeUnique(qcTemplate))){
|
if(UserConstants.NOT_UNIQUE.equals(qcTemplateService.checkTemplateCodeUnique(qcTemplate))){
|
||||||
return AjaxResult.error("检测模板编号已存在!");
|
return AjaxResult.error("检测模板编号已存在!");
|
||||||
}
|
}
|
||||||
|
if(ArrayUtil.isNotEmpty(qcTemplate.getQcTypesParam())){
|
||||||
|
String[] types = qcTemplate.getQcTypesParam();
|
||||||
|
for (String type:types
|
||||||
|
) {
|
||||||
|
if(StringUtils.isNotNull(qcTemplate.getQcTypes())){
|
||||||
|
qcTemplate.setQcTypes(qcTemplate.getQcTypes()+','+type);
|
||||||
|
}else{
|
||||||
|
qcTemplate.setQcTypes(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return toAjax(qcTemplateService.updateQcTemplate(qcTemplate));
|
return toAjax(qcTemplateService.updateQcTemplate(qcTemplate));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除检测模板
|
* 删除检测模板
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('qc:qctemplate:remove')")
|
@PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:remove')")
|
||||||
@Log(title = "检测模板", businessType = BusinessType.DELETE)
|
@Log(title = "检测模板", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{templateIds}")
|
@DeleteMapping("/{templateIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] templateIds)
|
public AjaxResult remove(@PathVariable Long[] templateIds)
|
||||||
|
@ -30,6 +30,11 @@ public class QcTemplate extends BaseEntity
|
|||||||
@Excel(name = "检测种类")
|
@Excel(name = "检测种类")
|
||||||
private String qcTypes;
|
private String qcTypes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用来传递检测种类参数
|
||||||
|
*/
|
||||||
|
private String[] qcTypesParam;
|
||||||
|
|
||||||
/** 是否启用 */
|
/** 是否启用 */
|
||||||
@Excel(name = "是否启用")
|
@Excel(name = "是否启用")
|
||||||
private String enableFlag;
|
private String enableFlag;
|
||||||
@ -82,7 +87,16 @@ public class QcTemplate extends BaseEntity
|
|||||||
{
|
{
|
||||||
return qcTypes;
|
return qcTypes;
|
||||||
}
|
}
|
||||||
public void setEnableFlag(String enableFlag)
|
|
||||||
|
public String[] getQcTypesParam() {
|
||||||
|
return qcTypesParam;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQcTypesParam(String[] qcTypesParam) {
|
||||||
|
this.qcTypesParam = qcTypesParam;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnableFlag(String enableFlag)
|
||||||
{
|
{
|
||||||
this.enableFlag = enableFlag;
|
this.enableFlag = enableFlag;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user