|
|
@ -1,8 +1,15 @@ |
|
|
|
package com.lzbi.special.controller; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
import com.alibaba.fastjson2.JSONArray; |
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
|
import com.lzbi.common.utils.DateUtils; |
|
|
|
import com.lzbi.special.domain.DcBaseWorkSpecial; |
|
|
|
import com.lzbi.special.service.DcBaseWorkSpecialService; |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -18,7 +25,6 @@ import com.lzbi.common.annotation.Log; |
|
|
|
import com.lzbi.common.core.controller.BaseController; |
|
|
|
import com.lzbi.common.core.domain.AjaxResult; |
|
|
|
import com.lzbi.common.enums.BusinessType; |
|
|
|
import com.lzbi.special.domain.DcBaseWorkSpecialDao; |
|
|
|
import com.lzbi.common.utils.poi.ExcelUtil; |
|
|
|
import com.lzbi.common.core.page.TableDataInfo; |
|
|
|
|
|
|
@ -40,10 +46,10 @@ public class DcBaseWorkSpecialController extends BaseController |
|
|
|
*/ |
|
|
|
@PreAuthorize("@ss.hasPermi('special:specialManager:list')") |
|
|
|
@GetMapping("/list") |
|
|
|
public TableDataInfo list(DcBaseWorkSpecialDao dcBaseWorkSpecialDao) |
|
|
|
public TableDataInfo list(DcBaseWorkSpecial dcBaseWorkSpecial) |
|
|
|
{ |
|
|
|
startPage(); |
|
|
|
List<DcBaseWorkSpecialDao> list = dcBaseWorkSpecialService.selectDcBaseWorkSpecialDaoList(dcBaseWorkSpecialDao); |
|
|
|
List<DcBaseWorkSpecial> list = dcBaseWorkSpecialService.selectDcBaseWorkSpecialDaoList(dcBaseWorkSpecial); |
|
|
|
return getDataTable(list); |
|
|
|
} |
|
|
|
|
|
|
@ -53,10 +59,10 @@ public class DcBaseWorkSpecialController extends BaseController |
|
|
|
@PreAuthorize("@ss.hasPermi('special:specialManager:export')") |
|
|
|
@Log(title = "生产专业管理", businessType = BusinessType.EXPORT) |
|
|
|
@PostMapping("/export") |
|
|
|
public void export(HttpServletResponse response, DcBaseWorkSpecialDao dcBaseWorkSpecialDao) |
|
|
|
public void export(HttpServletResponse response, DcBaseWorkSpecial dcBaseWorkSpecial) |
|
|
|
{ |
|
|
|
List<DcBaseWorkSpecialDao> list = dcBaseWorkSpecialService.selectDcBaseWorkSpecialDaoList(dcBaseWorkSpecialDao); |
|
|
|
ExcelUtil<DcBaseWorkSpecialDao> util = new ExcelUtil<DcBaseWorkSpecialDao>(DcBaseWorkSpecialDao.class); |
|
|
|
List<DcBaseWorkSpecial> list = dcBaseWorkSpecialService.selectDcBaseWorkSpecialDaoList(dcBaseWorkSpecial); |
|
|
|
ExcelUtil<DcBaseWorkSpecial> util = new ExcelUtil<DcBaseWorkSpecial>(DcBaseWorkSpecial.class); |
|
|
|
util.exportExcel(response, list, "生产专业管理数据"); |
|
|
|
} |
|
|
|
|
|
|
@ -67,7 +73,7 @@ public class DcBaseWorkSpecialController extends BaseController |
|
|
|
@GetMapping(value = "/{id}") |
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id) |
|
|
|
{ |
|
|
|
return success(dcBaseWorkSpecialService.selectDcBaseWorkSpecialDaoById(id)); |
|
|
|
return success(dcBaseWorkSpecialService.selectDcBaseWorkSpecialById(id)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -76,9 +82,9 @@ public class DcBaseWorkSpecialController extends BaseController |
|
|
|
@PreAuthorize("@ss.hasPermi('special:specialManager:add')") |
|
|
|
@Log(title = "生产专业管理", businessType = BusinessType.INSERT) |
|
|
|
@PostMapping |
|
|
|
public AjaxResult add(@RequestBody DcBaseWorkSpecialDao dcBaseWorkSpecialDao) |
|
|
|
public AjaxResult add(@RequestBody DcBaseWorkSpecial dcBaseWorkSpecial) |
|
|
|
{ |
|
|
|
return toAjax(dcBaseWorkSpecialService.insertDcBaseWorkSpecialDao(dcBaseWorkSpecialDao)); |
|
|
|
return toAjax(dcBaseWorkSpecialService.insertDcBaseWorkSpecial(dcBaseWorkSpecial)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -87,9 +93,9 @@ public class DcBaseWorkSpecialController extends BaseController |
|
|
|
@PreAuthorize("@ss.hasPermi('special:specialManager:edit')") |
|
|
|
@Log(title = "生产专业管理", businessType = BusinessType.UPDATE) |
|
|
|
@PutMapping |
|
|
|
public AjaxResult edit(@RequestBody DcBaseWorkSpecialDao dcBaseWorkSpecialDao) |
|
|
|
public AjaxResult edit(@RequestBody DcBaseWorkSpecial dcBaseWorkSpecial) |
|
|
|
{ |
|
|
|
return toAjax(dcBaseWorkSpecialService.updateDcBaseWorkSpecialDao(dcBaseWorkSpecialDao)); |
|
|
|
return toAjax(dcBaseWorkSpecialService.updateDcBaseWorkSpecialDao(dcBaseWorkSpecial)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -100,7 +106,7 @@ public class DcBaseWorkSpecialController extends BaseController |
|
|
|
@DeleteMapping("/{ids}") |
|
|
|
public AjaxResult remove(@PathVariable Long[] ids) |
|
|
|
{ |
|
|
|
return toAjax(dcBaseWorkSpecialService.deleteDcBaseWorkSpecialDaoByIds(ids)); |
|
|
|
return toAjax(dcBaseWorkSpecialService.deleteDcBaseWorkSpecialByIds(ids)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -109,12 +115,70 @@ public class DcBaseWorkSpecialController extends BaseController |
|
|
|
*/ |
|
|
|
@PreAuthorize("@ss.hasPermi('special:specialManager:list')") |
|
|
|
@GetMapping("/listNoPage") |
|
|
|
public AjaxResult listNoPage(DcBaseWorkSpecialDao dcBaseWorkSpecialDao) |
|
|
|
public AjaxResult listNoPage(DcBaseWorkSpecial dcBaseWorkSpecial) |
|
|
|
{ |
|
|
|
List<DcBaseWorkSpecialDao> list = dcBaseWorkSpecialService.selectDcBaseWorkSpecialDaoList(dcBaseWorkSpecialDao); |
|
|
|
List<DcBaseWorkSpecial> list = dcBaseWorkSpecialService.selectDcBaseWorkSpecialDaoList(dcBaseWorkSpecial); |
|
|
|
return AjaxResult.success(list); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 新增生产专业管理 |
|
|
|
*/ |
|
|
|
@PreAuthorize("@ss.hasPermi('special:specialManager:add')") |
|
|
|
@Log(title = "生产专业管理", businessType = BusinessType.INSERT) |
|
|
|
@PostMapping("/addBatch") |
|
|
|
public AjaxResult addBatch(@RequestBody JSONArray jsonArray) |
|
|
|
{ |
|
|
|
if (jsonArray == null) { |
|
|
|
throw new IllegalArgumentException("未能接收任何参数!"); |
|
|
|
} |
|
|
|
List<DcBaseWorkSpecial> beanList = new ArrayList<>(); |
|
|
|
try { |
|
|
|
for (int i = 0; i < jsonArray.size(); i++) { |
|
|
|
JSONObject beanObject = jsonArray.getJSONObject(i); |
|
|
|
// 移除ID属性
|
|
|
|
beanObject.remove("id"); |
|
|
|
DcBaseWorkSpecial dcBaseWorkSpecial = JSON.toJavaObject(beanObject, DcBaseWorkSpecial.class); |
|
|
|
dcBaseWorkSpecial.setCreatedTime(DateUtils.getNowDate()); |
|
|
|
dcBaseWorkSpecial.setDeptId(getDeptId()); |
|
|
|
dcBaseWorkSpecial.setUserId(getUserId()); |
|
|
|
dcBaseWorkSpecial.setCreatedBy(String.valueOf(getUserId())); |
|
|
|
dcBaseWorkSpecial.setCreatedTime(DateUtils.getNowDate()); |
|
|
|
beanList.add(dcBaseWorkSpecial); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
throw new IllegalArgumentException("解析list对象异常!"); |
|
|
|
} |
|
|
|
return toAjax(dcBaseWorkSpecialService.saveBatch(beanList)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 修改生产专业管理 |
|
|
|
*/ |
|
|
|
@PreAuthorize("@ss.hasPermi('special:specialManager:edit')") |
|
|
|
@Log(title = "生产专业管理", businessType = BusinessType.UPDATE) |
|
|
|
@PutMapping("editBatch") |
|
|
|
public AjaxResult editBatch(@RequestBody JSONArray jsonArray) |
|
|
|
{ |
|
|
|
if (jsonArray == null) { |
|
|
|
throw new IllegalArgumentException("未能接收任何参数!"); |
|
|
|
} |
|
|
|
List<DcBaseWorkSpecial> dcBaseWorkSpecialList = new ArrayList<>(); |
|
|
|
try { |
|
|
|
for (int i = 0; i < jsonArray.size(); i++) { |
|
|
|
JSONObject beanObject = jsonArray.getJSONObject(i); |
|
|
|
DcBaseWorkSpecial dcBaseWorkSpecial = JSON.toJavaObject(beanObject, DcBaseWorkSpecial.class); |
|
|
|
dcBaseWorkSpecial.setUpdatedBy(String.valueOf(getUserId())); |
|
|
|
dcBaseWorkSpecial.setUpdatedTime(DateUtils.getNowDate()); |
|
|
|
dcBaseWorkSpecialList.add(dcBaseWorkSpecial); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
throw new IllegalArgumentException("解析list对象异常!"); |
|
|
|
} |
|
|
|
return toAjax(dcBaseWorkSpecialService.updateBatchById(dcBaseWorkSpecialList)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|