Browse Source

[feat] 工程管理

产品型号管理前端新增导出按钮,前端新增区分选择导出和分别导出的js方法
产品型号管理Controller层新增导出全包后端接口和根据选择的产品型号id导出对应的产品型号数据
新增 根据产品型号管理ID数组查询产品型号管理集合后端接口
dev
liuxiaoxu 2 months ago
parent
commit
b91891283a
  1. 22
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysProductModelController.java
  2. 5
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysProductModelMapper.java
  3. 5
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysProductModelService.java
  4. 8
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysProductModelServiceImpl.java
  5. 10
      ruoyi-admin/src/main/resources/mapper/system/SysProductModelMapper.xml
  6. 57
      ruoyi-admin/src/main/resources/templates/system/model/model.html

22
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysProductModelController.java

@ -62,15 +62,33 @@ public class SysProductModelController extends BaseController
*/
@RequiresPermissions("system:model:export")
@Log(title = "产品型号管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@PostMapping("/exportAll")
@ResponseBody
public AjaxResult export(SysProductModel sysProductModel)
public AjaxResult exportAll(SysProductModel sysProductModel)
{
List<SysProductModel> list = sysProductModelService.selectSysProductModelList(sysProductModel);
ExcelUtil<SysProductModel> util = new ExcelUtil<SysProductModel>(SysProductModel.class);
return util.exportExcel(list, "产品型号管理数据");
}
/**
* 导出产品型号管理列表
*/
@RequiresPermissions("system:model:export")
@Log(title = "产品型号管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(@RequestBody String[] pcodes)
{
List<SysProductModel> list = sysProductModelService.selectSysProductModelListByCodes(pcodes);
ExcelUtil<SysProductModel> util = new ExcelUtil<SysProductModel>(SysProductModel.class);
return util.exportExcel(list, "产品型号管理数据");
}
/**
* 新增产品型号管理
*/

5
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysProductModelMapper.java

@ -75,4 +75,9 @@ public interface SysProductModelMapper
* @return 结果
*/
public int restoreSysProductModelById(Long pid);
/**
* 根据产品型号管理ID数组查询产品型号管理集合
*/
List<SysProductModel> selectSysProductModelListByCodes(String[] pcodes);
}

5
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysProductModelService.java

@ -78,4 +78,9 @@ public interface ISysProductModelService
* 产品型号管理详情
* */
int detailSysProductModel(SysProductModel sysProductModel);
/**
* 根据产品型号id数组查询产品型号列表集合
* */
List<SysProductModel> selectSysProductModelListByCodes(String[] pcodes);
}

8
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysProductModelServiceImpl.java

@ -170,4 +170,12 @@ public class SysProductModelServiceImpl implements ISysProductModelService
return 1;
}
/**
* 根据产品型号id数组查询产品型号列表集合
* */
@Override
public List<SysProductModel> selectSysProductModelListByCodes(String[] pcodes) {
return sysProductModelMapper.selectSysProductModelListByCodes(pcodes);
}
}

10
ruoyi-admin/src/main/resources/mapper/system/SysProductModelMapper.xml

@ -64,7 +64,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
on s.pid = att.rel_id and att.source_type = 'sysProductModel' and att.source_sub_type = 'photo'
where s.pid = #{pid}
</select>
<select id="selectSysProductModelListByCodes" parameterType="String" resultMap="SysProductModelResult">
<include refid="selectSysProductModelVo"/>
where pcode in
<foreach collection="array" item="pcode" open="(" separator="," close=")">
#{pcode}
</foreach>
</select>
<insert id="insertSysProductModel" parameterType="SysProductModel" useGeneratedKeys="true" keyProperty="pid">
insert into sys_product_model
<trim prefix="(" suffix=")" suffixOverrides=",">

57
ruoyi-admin/src/main/resources/templates/system/model/model.html

@ -55,7 +55,7 @@
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:model:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:model:export">
<a class="btn btn-warning" onclick="exportExcel()" shiro:hasPermission="system:model:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
@ -123,6 +123,61 @@
}
//导出
function exportExcel(formId) {
// $.table.set();
var pcodeData = [];
var selections = $("#bootstrap-table").bootstrapTable("getSelections");
if(selections.length === 0){
$.modal.confirm("确定导出所有产品型号管理吗?", function() {
var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
var params = $("#bootstrap-table").bootstrapTable('getOptions');
var dataParam = $("#" + currentId).serializeArray();
dataParam.push({ "name": "orderByColumn", "value": params.sortName });
dataParam.push({ "name": "isAsc", "value": params.sortOrder });
$.modal.loading("正在导出数据,请稍后...");
$.post(prefix + '/exportAll', dataParam, function(result) {
if (result.code == web_status.SUCCESS) {
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
} else if (result.code == web_status.WARNING) {
$.modal.alertWarning(result.msg)
} else {
$.modal.alertError(result.msg);
}
$.modal.closeLoading();
});
});
}else {
$.modal.confirm("确定导出选中的所有产品型号管理吗?", function () {
//·拼接单号
for(let i=0;i<selections.length;i++){
pcodeData.push(selections[i].pcode);
}
var pcodes = JSON.stringify(pcodeData);
// console.log(bomNos);
$.modal.loading("正在导出数据,请稍后...");
var config = {
url: prefix + '/export',
type: "post",
dataType: "json",
contentType: "application/json;charset=utf-8",
data: pcodes,
success: function(result) {
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
$.modal.alertSuccess("导出成功!")
$.modal.closeLoading();
},
error: function (result){
$.modal.alertError(result.msg);
}
};
$.ajax(config)
});
}
};
//查询工程员
function engineer(){
$.ajax({

Loading…
Cancel
Save