|
@@ -10,6 +10,10 @@ import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+import com.cuidian.srm.baseCode.entity.BaseProductArchive;
|
|
|
+import com.cuidian.srm.baseCode.service.ISerialPatternService;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.common.system.query.QueryRuleEnum;
|
|
@@ -39,131 +43,166 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
|
|
- /**
|
|
|
+/**
|
|
|
* @Description: 船舶档案
|
|
|
* @Author: jeecg-boot
|
|
|
- * @Date: 2024-11-05
|
|
|
+ * @Date: 2024-11-05
|
|
|
* @Version: V1.0
|
|
|
*/
|
|
|
-@Api(tags="船舶档案")
|
|
|
+@Api(tags = "船舶档案")
|
|
|
@RestController
|
|
|
@RequestMapping("/baseCode/baseShipArchive")
|
|
|
@Slf4j
|
|
|
public class BaseShipArchiveController extends JeecgController<BaseShipArchive, IBaseShipArchiveService> {
|
|
|
- @Autowired
|
|
|
- private IBaseShipArchiveService baseShipArchiveService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 分页列表查询
|
|
|
- *
|
|
|
- * @param baseShipArchive
|
|
|
- * @param pageNo
|
|
|
- * @param pageSize
|
|
|
- * @param req
|
|
|
- * @return
|
|
|
- */
|
|
|
- //@AutoLog(value = "船舶档案-分页列表查询")
|
|
|
- @ApiOperation(value="船舶档案-分页列表查询", notes="船舶档案-分页列表查询")
|
|
|
- @GetMapping(value = "/list")
|
|
|
- public Result<IPage<BaseShipArchive>> queryPageList(BaseShipArchive baseShipArchive,
|
|
|
- @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
- @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
- HttpServletRequest req) {
|
|
|
+ @Autowired
|
|
|
+ private IBaseShipArchiveService baseShipArchiveService;
|
|
|
+ @Autowired
|
|
|
+ private ISerialPatternService serialPatternService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页列表查询
|
|
|
+ *
|
|
|
+ * @param baseShipArchive
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "船舶档案-分页列表查询")
|
|
|
+ @ApiOperation(value = "船舶档案-分页列表查询", notes = "船舶档案-分页列表查询")
|
|
|
+ @GetMapping(value = "/list")
|
|
|
+ public Result<IPage<BaseShipArchive>> queryPageList(BaseShipArchive baseShipArchive,
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
// 自定义查询规则
|
|
|
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
|
|
// 自定义多选的查询规则为:LIKE_WITH_OR
|
|
|
customeRuleMap.put("status", QueryRuleEnum.LIKE_WITH_OR);
|
|
|
customeRuleMap.put("shipType", QueryRuleEnum.LIKE_WITH_OR);
|
|
|
customeRuleMap.put("shipFactory", QueryRuleEnum.LIKE_WITH_OR);
|
|
|
- QueryWrapper<BaseShipArchive> queryWrapper = QueryGenerator.initQueryWrapper(baseShipArchive, req.getParameterMap(),customeRuleMap);
|
|
|
- Page<BaseShipArchive> page = new Page<BaseShipArchive>(pageNo, pageSize);
|
|
|
- IPage<BaseShipArchive> pageList = baseShipArchiveService.page(page, queryWrapper);
|
|
|
- return Result.OK(pageList);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 添加
|
|
|
- *
|
|
|
- * @param baseShipArchive
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "船舶档案-添加")
|
|
|
- @ApiOperation(value="船舶档案-添加", notes="船舶档案-添加")
|
|
|
- @RequiresPermissions("baseCode:base_ship_archive:add")
|
|
|
- @PostMapping(value = "/add")
|
|
|
- public Result<String> add(@RequestBody BaseShipArchive baseShipArchive) {
|
|
|
- baseShipArchiveService.save(baseShipArchive);
|
|
|
- return Result.OK("添加成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 编辑
|
|
|
- *
|
|
|
- * @param baseShipArchive
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "船舶档案-编辑")
|
|
|
- @ApiOperation(value="船舶档案-编辑", notes="船舶档案-编辑")
|
|
|
- @RequiresPermissions("baseCode:base_ship_archive:edit")
|
|
|
- @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
- public Result<String> edit(@RequestBody BaseShipArchive baseShipArchive) {
|
|
|
- baseShipArchiveService.updateById(baseShipArchive);
|
|
|
- return Result.OK("编辑成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过id删除
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "船舶档案-通过id删除")
|
|
|
- @ApiOperation(value="船舶档案-通过id删除", notes="船舶档案-通过id删除")
|
|
|
- @RequiresPermissions("baseCode:base_ship_archive:delete")
|
|
|
- @DeleteMapping(value = "/delete")
|
|
|
- public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
- baseShipArchiveService.removeById(id);
|
|
|
- return Result.OK("删除成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 批量删除
|
|
|
- *
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "船舶档案-批量删除")
|
|
|
- @ApiOperation(value="船舶档案-批量删除", notes="船舶档案-批量删除")
|
|
|
- @RequiresPermissions("baseCode:base_ship_archive:deleteBatch")
|
|
|
- @DeleteMapping(value = "/deleteBatch")
|
|
|
- public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
- this.baseShipArchiveService.removeByIds(Arrays.asList(ids.split(",")));
|
|
|
- return Result.OK("批量删除成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过id查询
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- //@AutoLog(value = "船舶档案-通过id查询")
|
|
|
- @ApiOperation(value="船舶档案-通过id查询", notes="船舶档案-通过id查询")
|
|
|
- @GetMapping(value = "/queryById")
|
|
|
- public Result<BaseShipArchive> queryById(@RequestParam(name="id",required=true) String id) {
|
|
|
- BaseShipArchive baseShipArchive = baseShipArchiveService.getById(id);
|
|
|
- if(baseShipArchive==null) {
|
|
|
- return Result.error("未找到对应数据");
|
|
|
- }
|
|
|
- return Result.OK(baseShipArchive);
|
|
|
- }
|
|
|
+ QueryWrapper<BaseShipArchive> queryWrapper = QueryGenerator.initQueryWrapper(baseShipArchive, req.getParameterMap(), customeRuleMap);
|
|
|
+ Page<BaseShipArchive> page = new Page<BaseShipArchive>(pageNo, pageSize);
|
|
|
+ IPage<BaseShipArchive> pageList = baseShipArchiveService.page(page, queryWrapper);
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ *
|
|
|
+ * @param baseShipArchive
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "船舶档案-添加")
|
|
|
+ @ApiOperation(value = "船舶档案-添加", notes = "船舶档案-添加")
|
|
|
+ @RequiresPermissions("baseCode:base_ship_archive:add")
|
|
|
+ @PostMapping(value = "/add")
|
|
|
+ public Result<String> add(@RequestBody BaseShipArchive baseShipArchive) {
|
|
|
+//
|
|
|
+// String code = baseShipArchive.getImo();
|
|
|
+// if (StringUtils.isNotBlank(code)) {
|
|
|
+//
|
|
|
+// QueryWrapper<BaseShipArchive> queryWrapper = new QueryWrapper();
|
|
|
+// queryWrapper.eq("imo", code);
|
|
|
+// queryWrapper.eq("del_flag", "0");
|
|
|
+//
|
|
|
+// List<BaseShipArchive> list = baseShipArchiveService.list(queryWrapper);
|
|
|
+// if (list.size() != 0) {
|
|
|
+// return Result.error("imo编码重复,请修改!");
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+//
|
|
|
+// Result<String> result = serialPatternService.getNextSerial("base_ship_archive", "imo");
|
|
|
+// if (!result.isSuccess()) {
|
|
|
+// return result;
|
|
|
+// }
|
|
|
+// baseShipArchive.setImo(result.getMessage());
|
|
|
+// }
|
|
|
+
|
|
|
+ baseShipArchiveService.save(baseShipArchive);
|
|
|
+ return Result.OK("添加成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑
|
|
|
+ *
|
|
|
+ * @param baseShipArchive
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "船舶档案-编辑")
|
|
|
+ @ApiOperation(value = "船舶档案-编辑", notes = "船舶档案-编辑")
|
|
|
+ @RequiresPermissions("baseCode:base_ship_archive:edit")
|
|
|
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
|
|
+ public Result<String> edit(@RequestBody BaseShipArchive baseShipArchive) {
|
|
|
+
|
|
|
+ String code = baseShipArchive.getImo();
|
|
|
+ QueryWrapper<BaseShipArchive> queryWrapper = new QueryWrapper();
|
|
|
+ queryWrapper.eq("imo", code);
|
|
|
+ queryWrapper.eq("del_flag", "0");
|
|
|
+ queryWrapper.notIn("id", baseShipArchive.getId());
|
|
|
+
|
|
|
+ List<BaseShipArchive> list = baseShipArchiveService.list(queryWrapper);
|
|
|
+ if (list.size() != 0) {
|
|
|
+ return Result.error("imo编码重复,请修改!");
|
|
|
+ }
|
|
|
+
|
|
|
+ baseShipArchiveService.updateById(baseShipArchive);
|
|
|
+ return Result.OK("编辑成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id删除
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "船舶档案-通过id删除")
|
|
|
+ @ApiOperation(value = "船舶档案-通过id删除", notes = "船舶档案-通过id删除")
|
|
|
+ @RequiresPermissions("baseCode:base_ship_archive:delete")
|
|
|
+ @DeleteMapping(value = "/delete")
|
|
|
+ public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ baseShipArchiveService.removeById(id);
|
|
|
+ return Result.OK("删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "船舶档案-批量删除")
|
|
|
+ @ApiOperation(value = "船舶档案-批量删除", notes = "船舶档案-批量删除")
|
|
|
+ @RequiresPermissions("baseCode:base_ship_archive:deleteBatch")
|
|
|
+ @DeleteMapping(value = "/deleteBatch")
|
|
|
+ public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
+ this.baseShipArchiveService.removeByIds(Arrays.asList(ids.split(",")));
|
|
|
+ return Result.OK("批量删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "船舶档案-通过id查询")
|
|
|
+ @ApiOperation(value = "船舶档案-通过id查询", notes = "船舶档案-通过id查询")
|
|
|
+ @GetMapping(value = "/queryById")
|
|
|
+ public Result<BaseShipArchive> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ BaseShipArchive baseShipArchive = baseShipArchiveService.getById(id);
|
|
|
+ if (baseShipArchive == null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+ return Result.OK(baseShipArchive);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
- * 导出excel
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param baseShipArchive
|
|
|
- */
|
|
|
+ * 导出excel
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param baseShipArchive
|
|
|
+ */
|
|
|
@RequiresPermissions("baseCode:base_ship_archive:exportXls")
|
|
|
@RequestMapping(value = "/exportXls")
|
|
|
public ModelAndView exportXls(HttpServletRequest request, BaseShipArchive baseShipArchive) {
|
|
@@ -171,12 +210,12 @@ public class BaseShipArchiveController extends JeecgController<BaseShipArchive,
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 通过excel导入数据
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param response
|
|
|
- * @return
|
|
|
- */
|
|
|
+ * 通过excel导入数据
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@RequiresPermissions("baseCode:base_ship_archive:importExcel")
|
|
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|