| ¶Ô±ÈÐÂÎļþ |
| | |
| | | INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:ywgateway:create', 'æ°å»ºç½å
³ç®¡ç', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); |
| | | INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:ywgateway:delete', 'å é¤ç½å
³ç®¡ç', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); |
| | | INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:ywgateway:update', 'ä¿®æ¹ç½å
³ç®¡ç', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); |
| | | INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:ywgateway:query', 'æ¥è¯¢ç½å
³ç®¡ç', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); |
| | | INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:ywgateway:exportExcel', '导åºç½å
³ç®¡ç(Excel)', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | CREATE TABLE `yw_gateway` ( |
| | | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主é®', |
| | | `creator` int(11) DEFAULT NULL COMMENT 'å建人ç¼ç ', |
| | | `create_date` datetime DEFAULT NULL COMMENT 'å建æ¶é´', |
| | | `editor` int(11) DEFAULT NULL COMMENT 'æ´æ°äººç¼ç ', |
| | | `edit_date` datetime DEFAULT NULL COMMENT 'æ´æ°æ¶é´', |
| | | `isdeleted` int(1) DEFAULT '0' COMMENT 'æ¯å¦å é¤ 0å¦ 1æ¯', |
| | | `name` varchar(100) DEFAULT NULL COMMENT 'ç½å
³åç§°', |
| | | `remark` varchar(500) DEFAULT NULL COMMENT '夿³¨', |
| | | `status` int(1) DEFAULT '0' COMMENT 'ç¶æ 0å¯ç¨ 1ç¦ç¨', |
| | | `sortnum` int(11) DEFAULT NULL COMMENT 'æåºç ', |
| | | `gateway_model` varchar(100) DEFAULT NULL COMMENT 'ç½å
³åå·', |
| | | `gateway_code` varchar(100) DEFAULT NULL COMMENT 'ç½å
³è®¾å¤å·', |
| | | `last_heartbeat_time` datetime DEFAULT NULL COMMENT 'æåå¿è·³æ¶é´', |
| | | `project_id` int(11) DEFAULT NULL COMMENT 'æå±é¡¹ç®ç¼ç ï¼å
³èyw_projectï¼', |
| | | PRIMARY KEY (`id`), |
| | | KEY `idx_gateway_code` (`gateway_code`), |
| | | KEY `idx_project_id` (`project_id`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='ç½å
³ç®¡ç'; |
| | |
| | | spring: |
| | | cloud: |
| | | nacos: |
| | | server-addr: http://192.168.0.7:8848 #é
ç½®Nacoså°å |
| | | server-addr: http://192.168.0.3:8848 #é
ç½®Nacoså°å |
| | | username: nacos |
| | | password: nacos |
| | | discovery: |
| | | server-addr: http://192.168.0.7:8848 #é
ç½®Nacoså°å |
| | | server-addr: http://192.168.0.3:8848 #é
ç½®Nacoså°å |
| | | # namespace: dmvisit |
| | | namespace: funingyunwei_dev |
| | | username: nacos |
| | |
| | | spring: |
| | | cloud: |
| | | nacos: |
| | | server-addr: http://192.168.0.7:8848 #é
ç½®Nacoså°å |
| | | server-addr: http://192.168.0.3:8848 #é
ç½®Nacoså°å |
| | | username: nacos |
| | | password: nacos |
| | | discovery: |
| | | server-addr: http://192.168.0.7:8848 #é
ç½®Nacoså°å |
| | | server-addr: http://192.168.0.3:8848 #é
ç½®Nacoså°å |
| | | namespace: funingyunwei_test |
| | | # namespace: dev_renkang |
| | | username: nacos |
| | |
| | | # ææ¶å
³éç¼å |
| | | enabled: false |
| | | nacos: |
| | | server-addr: http://192.168.0.7:8848 #é
ç½®Nacoså°å |
| | | server-addr: http://192.168.0.3:8848 #é
ç½®Nacoså°å |
| | | username: nacos |
| | | password: nacos |
| | | # config: |
| | |
| | | # group: dev |
| | | # data-id: com.doumee.meeting.admin |
| | | discovery: |
| | | server-addr: http://192.168.0.7:8848 #é
ç½®Nacoså°å |
| | | server-addr: http://192.168.0.3:8848 #é
ç½®Nacoså°å |
| | | namespace: funingyunwei_dev |
| | | username: nacos |
| | | password: nacos |
| | |
| | | # ææ¶å
³éç¼å |
| | | enabled: false |
| | | nacos: |
| | | server-addr: http://192.168.0.7:8848 #é
ç½®Nacoså°å |
| | | server-addr: http://192.168.0.3:8848 #é
ç½®Nacoså°å |
| | | username: nacos |
| | | password: nacos |
| | | # config: |
| | |
| | | # group: dev |
| | | # data-id: com.doumee.meeting.admin |
| | | discovery: |
| | | server-addr: http://192.168.0.7:8848 #é
ç½®Nacoså°å |
| | | server-addr: http://192.168.0.3:8848 #é
ç½®Nacoså°å |
| | | namespace: funingyunwei_test |
| | | username: nacos |
| | | password: nacos |
| | |
| | | # ææ¶å
³éç¼å |
| | | enabled: false |
| | | nacos: |
| | | server-addr: http://192.168.0.7:8848 #é
ç½®Nacoså°å |
| | | server-addr: http://192.168.0.3:8848 #é
ç½®Nacoså°å |
| | | username: nacos |
| | | password: nacos |
| | | # config: |
| | |
| | | # group: dev |
| | | # data-id: com.doumee.meeting.admin |
| | | discovery: |
| | | server-addr: http://192.168.0.7:8848 #é
ç½®Nacoså°å |
| | | server-addr: http://192.168.0.3:8848 #é
ç½®Nacoså°å |
| | | namespace: funingyunwei_dev |
| | | username: nacos |
| | | password: nacos |
| | |
| | | # ææ¶å
³éç¼å |
| | | enabled: false |
| | | nacos: |
| | | server-addr: http://192.168.0.7:8848 #é
ç½®Nacoså°å |
| | | server-addr: http://192.168.0.3:8848 #é
ç½®Nacoså°å |
| | | username: nacos |
| | | password: nacos |
| | | # config: |
| | |
| | | # group: dev |
| | | # data-id: com.doumee.meeting.admin |
| | | discovery: |
| | | server-addr: http://192.168.0.7:8848 #é
ç½®Nacoså°å |
| | | server-addr: http://192.168.0.3:8848 #é
ç½®Nacoså°å |
| | | namespace: funingyunwei_test |
| | | username: nacos |
| | | password: nacos |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.cloud.admin; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.model.YwGateway; |
| | | import com.doumee.service.business.YwGatewayService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import com.doumee.config.annotation.CloudRequiredPermission; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç½å
³ç®¡ç |
| | | * @author renkang |
| | | * @date 2026/04/02 |
| | | */ |
| | | @Api(tags = "ç½å
³ç®¡ç") |
| | | @RestController |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX + "/business/ywGateway") |
| | | public class YwGatewayCloudController extends BaseController { |
| | | |
| | | @Autowired |
| | | private YwGatewayService ywGatewayService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:ywgateway:create") |
| | | public ApiResponse create(@RequestBody YwGateway ywGateway, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ywGateway.setLoginUserInfo(this.getLoginUser(token)); |
| | | return ApiResponse.success(ywGatewayService.create(ywGateway)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:ywgateway:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ywGatewayService.deleteById(id, this.getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:ywgateway:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | String[] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | ywGatewayService.deleteByIdInBatch(idList, this.getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:ywgateway:update") |
| | | public ApiResponse updateById(@RequestBody YwGateway ywGateway, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ywGateway.setLoginUserInfo(this.getLoginUser(token)); |
| | | ywGatewayService.updateById(ywGateway); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("ç¦å¯ç¨") |
| | | @PostMapping("/updateStatusById") |
| | | @CloudRequiredPermission("business:ywgateway:update") |
| | | public ApiResponse updateStatusById(@RequestBody YwGateway ywGateway, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ywGateway.setLoginUserInfo(this.getLoginUser(token)); |
| | | ywGatewayService.updateStatusById(ywGateway); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:ywgateway:query") |
| | | public ApiResponse<PageData<YwGateway>> findPage(@RequestBody PageWrap<YwGateway> pageWrap, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token)); |
| | | return ApiResponse.success(ywGatewayService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:ywgateway:query") |
| | | public ApiResponse findById(@PathVariable Integer id, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywGatewayService.findById(id)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:ywgateway:exportExcel") |
| | | public void exportExcel(@RequestBody PageWrap<YwGateway> pageWrap, HttpServletResponse response, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token)); |
| | | ExcelExporter.build(YwGateway.class).export(ywGatewayService.findPage(pageWrap).getRecords(), "ç½å
³ç®¡ç", response); |
| | | } |
| | | } |
| | |
| | | # ææ¶å
³éç¼å |
| | | enabled: false |
| | | nacos: |
| | | server-addr: http://192.168.0.7:8848 #é
ç½®Nacoså°å |
| | | server-addr: http://192.168.0.3:8848 #é
ç½®Nacoså°å |
| | | username: nacos |
| | | password: nacos |
| | | # config: |
| | |
| | | # group: dev |
| | | # data-id: com.doumee.meeting.admin |
| | | discovery: |
| | | server-addr: http://192.168.0.7:8848 #é
ç½®Nacoså°å |
| | | server-addr: http://192.168.0.3:8848 #é
ç½®Nacoså°å |
| | | # namespace: dmvisit |
| | | namespace: funingyunwei_dev |
| | | username: nacos |
| | |
| | | # ææ¶å
³éç¼å |
| | | enabled: false |
| | | nacos: |
| | | server-addr: http://192.168.0.7:8848 #é
ç½®Nacoså°å |
| | | server-addr: http://192.168.0.3:8848 #é
ç½®Nacoså°å |
| | | username: nacos |
| | | password: nacos |
| | | # config: |
| | |
| | | # group: dev |
| | | # data-id: com.doumee.meeting.admin |
| | | discovery: |
| | | server-addr: http://192.168.0.7:8848 #é
ç½®Nacoså°å |
| | | server-addr: http://192.168.0.3:8848 #é
ç½®Nacoså°å |
| | | namespace: funingyunwei_test |
| | | username: nacos |
| | | password: nacos |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.dao.business; |
| | | |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.doumee.dao.business.model.YwGateway; |
| | | |
| | | /** |
| | | * ç½å
³ç®¡çMapper |
| | | * @author renkang |
| | | * @date 2026/04/02 |
| | | */ |
| | | public interface YwGatewayMapper extends MPJBaseMapper<YwGateway> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.dao.business.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import com.doumee.core.model.LoginUserModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * ç½å
³ç®¡ç |
| | | * @author renkang |
| | | * @date 2026/04/02 |
| | | */ |
| | | @Data |
| | | @ApiModel("ç½å
³ç®¡ç") |
| | | @TableName("`yw_gateway`") |
| | | public class YwGateway extends LoginUserModel { |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | | @ApiModelProperty(value = "主é®", example = "1") |
| | | @ExcelColumn(name = "主é®") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "å建人ç¼ç ", example = "1") |
| | | @ExcelColumn(name = "å建人ç¼ç ") |
| | | private Integer creator; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @ExcelColumn(name = "å建æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createDate; |
| | | |
| | | @ApiModelProperty(value = "æ´æ°äººç¼ç ", example = "1") |
| | | @ExcelColumn(name = "æ´æ°äººç¼ç ") |
| | | private Integer editor; |
| | | |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´") |
| | | @ExcelColumn(name = "æ´æ°æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date editDate; |
| | | |
| | | @ApiModelProperty(value = "æ¯å¦å é¤0å¦ 1æ¯", example = "0") |
| | | @ExcelColumn(name = "æ¯å¦å é¤0å¦ 1æ¯") |
| | | private Integer isdeleted; |
| | | |
| | | @ApiModelProperty(value = "ç½å
³åç§°") |
| | | @ExcelColumn(name = "ç½å
³åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "夿³¨") |
| | | @ExcelColumn(name = "夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "ç¶æ 0å¯ç¨ 1ç¦ç¨", example = "0") |
| | | @ExcelColumn(name = "ç¶æ 0å¯ç¨ 1ç¦ç¨") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "æåºç ", example = "1") |
| | | @ExcelColumn(name = "æåºç ") |
| | | private Integer sortnum; |
| | | |
| | | @ApiModelProperty(value = "ç½å
³åå·") |
| | | @ExcelColumn(name = "ç½å
³åå·") |
| | | private String gatewayModel; |
| | | |
| | | @ApiModelProperty(value = "ç½å
³è®¾å¤å·") |
| | | @ExcelColumn(name = "ç½å
³è®¾å¤å·") |
| | | private String gatewayCode; |
| | | |
| | | @ApiModelProperty(value = "æåå¿è·³æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @ExcelColumn(name = "æåå¿è·³æ¶é´") |
| | | private Date lastHeartbeatTime; |
| | | |
| | | @ApiModelProperty(value = "æå±é¡¹ç®ç¼ç ï¼å
³èyw_project)", example = "1") |
| | | private Integer projectId; |
| | | |
| | | @ApiModelProperty(value = "项ç®åç§°") |
| | | @TableField(exist = false) |
| | | private String projectName; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.service.business; |
| | | |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.dao.business.model.YwGateway; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç½å
³ç®¡çServiceå®ä¹ |
| | | * @author renkang |
| | | * @date 2026/04/02 |
| | | */ |
| | | public interface YwGatewayService { |
| | | |
| | | /** |
| | | * å建 |
| | | * |
| | | * @param ywGateway å®ä½å¯¹è±¡ |
| | | * @return Integer |
| | | */ |
| | | Integer create(YwGateway ywGateway); |
| | | |
| | | /** |
| | | * 主é®å é¤ |
| | | * |
| | | * @param id ä¸»é® |
| | | * @param user ç»å½ç¨æ· |
| | | */ |
| | | void deleteById(Integer id, LoginUserInfo user); |
| | | |
| | | /** |
| | | * æ¹é主é®å é¤ |
| | | * |
| | | * @param ids 主é®é |
| | | * @param user ç»å½ç¨æ· |
| | | */ |
| | | void deleteByIdInBatch(List<Integer> ids, LoginUserInfo user); |
| | | |
| | | /** |
| | | * 䏻鮿´æ° |
| | | * |
| | | * @param ywGateway å®ä½å¯¹è±¡ |
| | | */ |
| | | void updateById(YwGateway ywGateway); |
| | | |
| | | /** |
| | | * æ´æ°ç¶æ |
| | | * |
| | | * @param ywGateway å®ä½å¯¹è±¡ï¼id + statusï¼ |
| | | */ |
| | | void updateStatusById(YwGateway ywGateway); |
| | | |
| | | /** |
| | | * 䏻鮿¥è¯¢è¯¦æ
|
| | | * |
| | | * @param id ä¸»é® |
| | | * @return YwGateway |
| | | */ |
| | | YwGateway findById(Integer id); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param pageWrap å页对象 |
| | | * @return PageData<YwGateway> |
| | | */ |
| | | PageData<YwGateway> findPage(PageWrap<YwGateway> pageWrap); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.YwGatewayMapper; |
| | | import com.doumee.dao.business.model.YwGateway; |
| | | import com.doumee.service.business.YwGatewayService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * ç½å
³ç®¡çServiceå®ç° |
| | | * @author renkang |
| | | * @date 2026/04/02 |
| | | */ |
| | | @Service |
| | | public class YwGatewayServiceImpl implements YwGatewayService { |
| | | |
| | | @Autowired |
| | | private YwGatewayMapper ywGatewayMapper; |
| | | |
| | | @Override |
| | | public Integer create(YwGateway ywGateway) { |
| | | if (Objects.isNull(ywGateway) |
| | | || StringUtils.isBlank(ywGateway.getName()) |
| | | || StringUtils.isBlank(ywGateway.getGatewayCode())) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | LoginUserInfo loginUserInfo = ywGateway.getLoginUserInfo(); |
| | | // æ ¡éªç½å
³è®¾å¤å·å¯ä¸ |
| | | if (ywGatewayMapper.selectCount(new QueryWrapper<YwGateway>().lambda() |
| | | .eq(YwGateway::getIsdeleted, Constants.ZERO) |
| | | .eq(YwGateway::getGatewayCode, ywGateway.getGatewayCode())) > Constants.ZERO) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "ç½å
³è®¾å¤å·éå¤!"); |
| | | } |
| | | ywGateway.setCreateDate(new Date()); |
| | | ywGateway.setCreator(loginUserInfo.getId()); |
| | | ywGateway.setEditDate(new Date()); |
| | | ywGateway.setEditor(loginUserInfo.getId()); |
| | | ywGateway.setIsdeleted(Constants.ZERO); |
| | | ywGatewayMapper.insert(ywGateway); |
| | | return ywGateway.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteById(Integer id, LoginUserInfo user) { |
| | | ywGatewayMapper.update(new UpdateWrapper<YwGateway>() |
| | | .lambda() |
| | | .set(YwGateway::getIsdeleted, Constants.ONE) |
| | | .set(YwGateway::getEditDate, DateUtil.getCurrDateTime()) |
| | | .set(YwGateway::getEditor, user.getId()) |
| | | .eq(YwGateway::getId, id) |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByIdInBatch(List<Integer> ids, LoginUserInfo user) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return; |
| | | } |
| | | for (Integer id : ids) { |
| | | this.deleteById(id, user); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void updateById(YwGateway ywGateway) { |
| | | if (Objects.isNull(ywGateway) |
| | | || Objects.isNull(ywGateway.getId()) |
| | | || StringUtils.isBlank(ywGateway.getName()) |
| | | || StringUtils.isBlank(ywGateway.getGatewayCode())) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | LoginUserInfo loginUserInfo = ywGateway.getLoginUserInfo(); |
| | | // æ ¡éªç½å
³è®¾å¤å·å¯ä¸ï¼æé¤èªèº«ï¼ |
| | | if (ywGatewayMapper.selectCount(new QueryWrapper<YwGateway>().lambda() |
| | | .eq(YwGateway::getIsdeleted, Constants.ZERO) |
| | | .eq(YwGateway::getGatewayCode, ywGateway.getGatewayCode()) |
| | | .ne(YwGateway::getId, ywGateway.getId())) > Constants.ZERO) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "ç½å
³è®¾å¤å·éå¤!"); |
| | | } |
| | | ywGateway.setEditDate(new Date()); |
| | | ywGateway.setEditor(loginUserInfo.getId()); |
| | | ywGatewayMapper.updateById(ywGateway); |
| | | } |
| | | |
| | | @Override |
| | | public void updateStatusById(YwGateway ywGateway) { |
| | | YwGateway model = new YwGateway(); |
| | | model.setId(ywGateway.getId()); |
| | | model.setStatus(ywGateway.getStatus()); |
| | | ywGatewayMapper.updateById(model); |
| | | } |
| | | |
| | | @Override |
| | | public YwGateway findById(Integer id) { |
| | | return ywGatewayMapper.selectJoinOne(YwGateway.class, |
| | | new MPJLambdaWrapper<YwGateway>() |
| | | .selectAll(YwGateway.class) |
| | | .selectAs(com.doumee.dao.business.model.YwProject::getName, YwGateway::getProjectName) |
| | | .leftJoin(com.doumee.dao.business.model.YwProject.class, com.doumee.dao.business.model.YwProject::getId, YwGateway::getProjectId) |
| | | .eq(YwGateway::getId, id) |
| | | .last(" limit 1 ") |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | | public PageData<YwGateway> findPage(PageWrap<YwGateway> pageWrap) { |
| | | IPage<YwGateway> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | MPJLambdaWrapper<YwGateway> queryWrapper = new MPJLambdaWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | YwGateway model = pageWrap.getModel(); |
| | | queryWrapper.selectAll(YwGateway.class) |
| | | .selectAs(com.doumee.dao.business.model.YwProject::getName, YwGateway::getProjectName) |
| | | .leftJoin(com.doumee.dao.business.model.YwProject.class, com.doumee.dao.business.model.YwProject::getId, YwGateway::getProjectId) |
| | | .and(Objects.nonNull(model) && StringUtils.isNotBlank(model.getName()), |
| | | i -> i.like(YwGateway::getName, model.getName()).or().like(YwGateway::getGatewayCode, model.getName())) |
| | | .eq(Objects.nonNull(model) && Objects.nonNull(model.getStatus()), YwGateway::getStatus, model.getStatus()) |
| | | .eq(Objects.nonNull(model) && Objects.nonNull(model.getProjectId()), YwGateway::getProjectId, model.getProjectId()) |
| | | .eq(YwGateway::getIsdeleted, Constants.ZERO) |
| | | .orderByDesc(YwGateway::getCreateDate); |
| | | IPage<YwGateway> iPage = ywGatewayMapper.selectJoinPage(page, YwGateway.class, queryWrapper); |
| | | return PageData.from(iPage); |
| | | } |
| | | } |