wuxw
2025-03-31 b7940b1a7da751915436ed44b52d38a591f7d0d7
优化代码
8个文件已添加
752 ■■■■■ 已修改文件
java110-bean/src/main/java/com/java110/dto/repairEvent/RepairEventDto.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/po/repairEvent/RepairEventPo.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/community/RepairEventV1ServiceDaoImplMapper.xml 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-interface/src/main/java/com/java110/intf/community/IRepairEventV1InnerServiceSMO.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-community/src/main/java/com/java110/community/cmd/repair/ListRepairEventCmd.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-community/src/main/java/com/java110/community/dao/IRepairEventV1ServiceDao.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-community/src/main/java/com/java110/community/dao/impl/RepairEventV1ServiceDaoImpl.java 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-community/src/main/java/com/java110/community/smo/impl/RepairEventV1InnerServiceSMOImpl.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/dto/repairEvent/RepairEventDto.java
New file
@@ -0,0 +1,113 @@
package com.java110.dto.repairEvent;
import com.java110.dto.PageDto;
import java.io.Serializable;
import java.util.Date;
/**
 * @ClassName FloorDto
 * @Description 报修事件数据层封装
 * @Author wuxw
 * @Date 2019/4/24 8:52
 * @Version 1.0
 * add by wuxw 2019/4/24
 **/
public class RepairEventDto extends PageDto implements Serializable {
    private String eventId;
    private String staffName;
    private String repairId;
    private String remark;
    private String eventType;
    private String eventTypeName;
    private String communityId;
    private String staffId;
    private Date createTime;
    private String statusCd = "0";
    public String getEventId() {
        return eventId;
    }
    public void setEventId(String eventId) {
        this.eventId = eventId;
    }
    public String getStaffName() {
        return staffName;
    }
    public void setStaffName(String staffName) {
        this.staffName = staffName;
    }
    public String getRepairId() {
        return repairId;
    }
    public void setRepairId(String repairId) {
        this.repairId = repairId;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getEventType() {
        return eventType;
    }
    public void setEventType(String eventType) {
        this.eventType = eventType;
    }
    public String getCommunityId() {
        return communityId;
    }
    public void setCommunityId(String communityId) {
        this.communityId = communityId;
    }
    public String getStaffId() {
        return staffId;
    }
    public void setStaffId(String staffId) {
        this.staffId = staffId;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getStatusCd() {
        return statusCd;
    }
    public void setStatusCd(String statusCd) {
        this.statusCd = statusCd;
    }
    public String getEventTypeName() {
        return eventTypeName;
    }
    public void setEventTypeName(String eventTypeName) {
        this.eventTypeName = eventTypeName;
    }
}
java110-bean/src/main/java/com/java110/po/repairEvent/RepairEventPo.java
New file
@@ -0,0 +1,89 @@
/*
 * Copyright 2017-2020 吴学文 and java110 team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.java110.po.repairEvent;
import java.io.Serializable;
import java.util.Date;
/**
 * 类表述: Po 数据模型实体对象 基本保持与数据库模型一直 用于 增加修改删除 等时的数据载体
 * add by 吴学文 at 2025-03-31 15:58:51 mail: 928255095@qq.com
 * open source address: https://gitee.com/wuxw7/MicroCommunity
 * 官网:http://www.homecommunity.cn
 * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
 * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
 */
public class RepairEventPo implements Serializable {
    private String eventId;
private String staffName;
private String repairId;
private String remark;
private String statusCd = "0";
private String eventType;
private String communityId;
private String staffId;
public String getEventId() {
        return eventId;
    }
public void setEventId(String eventId) {
        this.eventId = eventId;
    }
public String getStaffName() {
        return staffName;
    }
public void setStaffName(String staffName) {
        this.staffName = staffName;
    }
public String getRepairId() {
        return repairId;
    }
public void setRepairId(String repairId) {
        this.repairId = repairId;
    }
public String getRemark() {
        return remark;
    }
public void setRemark(String remark) {
        this.remark = remark;
    }
public String getStatusCd() {
        return statusCd;
    }
public void setStatusCd(String statusCd) {
        this.statusCd = statusCd;
    }
public String getEventType() {
        return eventType;
    }
public void setEventType(String eventType) {
        this.eventType = eventType;
    }
public String getCommunityId() {
        return communityId;
    }
public void setCommunityId(String communityId) {
        this.communityId = communityId;
    }
public String getStaffId() {
        return staffId;
    }
public void setStaffId(String staffId) {
        this.staffId = staffId;
    }
}
java110-db/src/main/resources/mapper/community/RepairEventV1ServiceDaoImplMapper.xml
New file
@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="repairEventV1ServiceDaoImpl">
    <!-- 保存报修事件信息 add by wuxw 2018-07-03 -->
    <insert id="saveRepairEventInfo" parameterType="Map">
        insert into r_repair_event(
        event_id,staff_name,repair_id,remark,event_type,community_id,staff_id
        ) values (
        #{eventId},#{staffName},#{repairId},#{remark},#{eventType},#{communityId},#{staffId}
        )
    </insert>
    <!-- 查询报修事件信息 add by wuxw 2018-07-03 -->
    <select id="getRepairEventInfo" parameterType="Map" resultType="Map">
        select t.event_id eventId,t.staff_name staffName,t.repair_id repairId,t.remark,t.status_cd statusCd,t.event_type
        eventType,t.community_id communityId,t.staff_id staffId,t.create_time createTime,td.name eventTypeName
        from r_repair_event t
        LEFT JOIN t_dict td on t.acct_type = td.status_cd and td.table_name = 'r_repair_event' and td.table_columns = 'event_type'
        where 1 =1
        <if test="eventId !=null and eventId != ''">
            and t.event_id= #{eventId}
        </if>
        <if test="staffName !=null and staffName != ''">
            and t.staff_name= #{staffName}
        </if>
        <if test="repairId !=null and repairId != ''">
            and t.repair_id= #{repairId}
        </if>
        <if test="remark !=null and remark != ''">
            and t.remark= #{remark}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="eventType !=null and eventType != ''">
            and t.event_type= #{eventType}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="staffId !=null and staffId != ''">
            and t.staff_id= #{staffId}
        </if>
        order by t.create_time desc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
    </select>
    <!-- 修改报修事件信息 add by wuxw 2018-07-03 -->
    <update id="updateRepairEventInfo" parameterType="Map">
        update r_repair_event t set t.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,t.b_id = #{newBId}
        </if>
        <if test="staffName !=null and staffName != ''">
            , t.staff_name= #{staffName}
        </if>
        <if test="repairId !=null and repairId != ''">
            , t.repair_id= #{repairId}
        </if>
        <if test="remark !=null and remark != ''">
            , t.remark= #{remark}
        </if>
        <if test="eventType !=null and eventType != ''">
            , t.event_type= #{eventType}
        </if>
        <if test="staffId !=null and staffId != ''">
            , t.staff_id= #{staffId}
        </if>
        where 1=1
        <if test="eventId !=null and eventId != ''">
            and t.event_id= #{eventId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
    </update>
    <!-- 查询报修事件数量 add by wuxw 2018-07-03 -->
    <select id="queryRepairEventsCount" parameterType="Map" resultType="Map">
        select count(1) count
        from r_repair_event t
        where 1 =1
        <if test="eventId !=null and eventId != ''">
            and t.event_id= #{eventId}
        </if>
        <if test="staffName !=null and staffName != ''">
            and t.staff_name= #{staffName}
        </if>
        <if test="repairId !=null and repairId != ''">
            and t.repair_id= #{repairId}
        </if>
        <if test="remark !=null and remark != ''">
            and t.remark= #{remark}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="eventType !=null and eventType != ''">
            and t.event_type= #{eventType}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="staffId !=null and staffId != ''">
            and t.staff_id= #{staffId}
        </if>
    </select>
</mapper>
java110-interface/src/main/java/com/java110/intf/community/IRepairEventV1InnerServiceSMO.java
New file
@@ -0,0 +1,68 @@
/*
 * Copyright 2017-2020 吴学文 and java110 team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.java110.intf.community;
import com.java110.config.feign.FeignConfiguration;
import com.java110.dto.repairEvent.RepairEventDto;
import com.java110.po.repairEvent.RepairEventPo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.List;
/**
 * 类表述: 服务之前调用的接口类,不对外提供接口能力 只用于接口建调用
 * add by 吴学文 at 2025-03-31 15:58:51 mail: 928255095@qq.com
 * open source address: https://gitee.com/wuxw7/MicroCommunity
 * 官网:http://www.homecommunity.cn
 * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
 * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
 */
@FeignClient(name = "community-service", configuration = {FeignConfiguration.class})
@RequestMapping("/repairEventV1Api")
public interface IRepairEventV1InnerServiceSMO {
    @RequestMapping(value = "/saveRepairEvent", method = RequestMethod.POST)
    public int saveRepairEvent(@RequestBody  RepairEventPo repairEventPo);
    @RequestMapping(value = "/updateRepairEvent", method = RequestMethod.POST)
    public int updateRepairEvent(@RequestBody  RepairEventPo repairEventPo);
    @RequestMapping(value = "/deleteRepairEvent", method = RequestMethod.POST)
    public int deleteRepairEvent(@RequestBody  RepairEventPo repairEventPo);
    /**
     * <p>查询小区楼信息</p>
     *
     *
     * @param repairEventDto 数据对象分享
     * @return RepairEventDto 对象数据
     */
    @RequestMapping(value = "/queryRepairEvents", method = RequestMethod.POST)
    List<RepairEventDto> queryRepairEvents(@RequestBody RepairEventDto repairEventDto);
    /**
     * 查询<p>小区楼</p>总记录数
     *
     * @param repairEventDto 数据对象分享
     * @return 小区下的小区楼记录数
     */
    @RequestMapping(value = "/queryRepairEventsCount", method = RequestMethod.POST)
    int queryRepairEventsCount(@RequestBody RepairEventDto repairEventDto);
}
service-community/src/main/java/com/java110/community/cmd/repair/ListRepairEventCmd.java
New file
@@ -0,0 +1,86 @@
/*
 * Copyright 2017-2020 吴学文 and java110 team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.java110.community.cmd.repair;
import com.alibaba.fastjson.JSONObject;
import com.java110.core.annotation.Java110Cmd;
import com.java110.core.context.ICmdDataFlowContext;
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
import com.java110.intf.community.IRepairEventV1InnerServiceSMO;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import com.java110.dto.repairEvent.RepairEventDto;
import java.util.List;
import java.util.ArrayList;
import org.springframework.http.ResponseEntity;
import org.springframework.http.HttpStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 * 类表述:查询
 * 服务编码:repairEvent.listRepairEvent
 * 请求路劲:/app/repairEvent.ListRepairEvent
 * add by 吴学文 at 2025-03-31 15:58:51 mail: 928255095@qq.com
 * open source address: https://gitee.com/wuxw7/MicroCommunity
 * 官网:http://www.homecommunity.cn
 * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
 * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
 */
@Java110Cmd(serviceCode = "repair.listRepairEvent")
public class ListRepairEventCmd extends Cmd {
    private static Logger logger = LoggerFactory.getLogger(ListRepairEventCmd.class);
    @Autowired
    private IRepairEventV1InnerServiceSMO repairEventV1InnerServiceSMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
        super.validatePageInfo(reqJson);
        Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区信息");
        super.validateProperty(cmdDataFlowContext);
    }
    @Override
    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
        RepairEventDto repairEventDto = BeanConvertUtil.covertBean(reqJson, RepairEventDto.class);
        int count = repairEventV1InnerServiceSMOImpl.queryRepairEventsCount(repairEventDto);
        List<RepairEventDto> repairEventDtos = null;
        if (count > 0) {
            repairEventDtos = repairEventV1InnerServiceSMOImpl.queryRepairEvents(repairEventDto);
        } else {
            repairEventDtos = new ArrayList<>();
        }
        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, repairEventDtos);
        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
        cmdDataFlowContext.setResponseEntity(responseEntity);
    }
}
service-community/src/main/java/com/java110/community/dao/IRepairEventV1ServiceDao.java
New file
@@ -0,0 +1,73 @@
/*
 * Copyright 2017-2020 吴学文 and java110 team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.java110.community.dao;
import com.java110.utils.exception.DAOException;
import java.util.List;
import java.util.Map;
/**
 * 类表述:
 * add by 吴学文 at 2025-03-31 15:58:51 mail: 928255095@qq.com
 * open source address: https://gitee.com/wuxw7/MicroCommunity
 * 官网:http://www.homecommunity.cn
 * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
 * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
 */
public interface IRepairEventV1ServiceDao {
    /**
     * 保存 报修事件信息
     * @param info
     * @throws DAOException DAO异常
     */
    int saveRepairEventInfo(Map info) throws DAOException;
    /**
     * 查询报修事件信息(instance过程)
     * 根据bId 查询报修事件信息
     * @param info bId 信息
     * @return 报修事件信息
     * @throws DAOException DAO异常
     */
    List<Map> getRepairEventInfo(Map info) throws DAOException;
    /**
     * 修改报修事件信息
     * @param info 修改信息
     * @throws DAOException DAO异常
     */
    int updateRepairEventInfo(Map info) throws DAOException;
    /**
     * 查询报修事件总数
     *
     * @param info 报修事件信息
     * @return 报修事件数量
     */
    int queryRepairEventsCount(Map info);
}
service-community/src/main/java/com/java110/community/dao/impl/RepairEventV1ServiceDaoImpl.java
New file
@@ -0,0 +1,112 @@
/*
 * Copyright 2017-2020 吴学文 and java110 team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.java110.community.dao.impl;
import com.alibaba.fastjson.JSONObject;
import com.java110.utils.constant.ResponseConstant;
import com.java110.utils.exception.DAOException;
import com.java110.utils.util.DateUtil;
import com.java110.core.base.dao.BaseServiceDao;
import com.java110.community.dao.IRepairEventV1ServiceDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
 * 类表述:
 * add by 吴学文 at 2025-03-31 15:58:51 mail: 928255095@qq.com
 * open source address: https://gitee.com/wuxw7/MicroCommunity
 * 官网:http://www.homecommunity.cn
 * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
 * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
 */
@Service("repairEventV1ServiceDaoImpl")
public class RepairEventV1ServiceDaoImpl extends BaseServiceDao implements IRepairEventV1ServiceDao {
    private static Logger logger = LoggerFactory.getLogger(RepairEventV1ServiceDaoImpl.class);
    /**
     * 保存报修事件信息 到 instance
     * @param info   bId 信息
     * @throws DAOException DAO异常
     */
    @Override
    public int saveRepairEventInfo(Map info) throws DAOException {
        logger.debug("保存 saveRepairEventInfo 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.insert("repairEventV1ServiceDaoImpl.saveRepairEventInfo",info);
        return saveFlag;
    }
    /**
     * 查询报修事件信息(instance)
     * @param info bId 信息
     * @return List<Map>
     * @throws DAOException DAO异常
     */
    @Override
    public List<Map> getRepairEventInfo(Map info) throws DAOException {
        logger.debug("查询 getRepairEventInfo 入参 info : {}",info);
        List<Map> infos = sqlSessionTemplate.selectList("repairEventV1ServiceDaoImpl.getRepairEventInfo",info);
        return infos;
    }
    /**
     * 修改报修事件信息
     * @param info 修改信息
     * @throws DAOException DAO异常
     */
    @Override
    public int updateRepairEventInfo(Map info) throws DAOException {
        logger.debug("修改 updateRepairEventInfo 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("repairEventV1ServiceDaoImpl.updateRepairEventInfo",info);
        return saveFlag;
    }
     /**
     * 查询报修事件数量
     * @param info 报修事件信息
     * @return 报修事件数量
     */
    @Override
    public int queryRepairEventsCount(Map info) {
        logger.debug("查询 queryRepairEventsCount 入参 info : {}",info);
        List<Map> infos = sqlSessionTemplate.selectList("repairEventV1ServiceDaoImpl.queryRepairEventsCount", info);
        if (infos.size() < 1) {
            return 0;
        }
        return Integer.parseInt(infos.get(0).get("count").toString());
    }
}
service-community/src/main/java/com/java110/community/smo/impl/RepairEventV1InnerServiceSMOImpl.java
New file
@@ -0,0 +1,89 @@
/*
 * Copyright 2017-2020 吴学文 and java110 team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.java110.community.smo.impl;
import com.java110.community.dao.IRepairEventV1ServiceDao;
import com.java110.intf.community.IRepairEventV1InnerServiceSMO;
import com.java110.dto.repairEvent.RepairEventDto;
import com.java110.po.repairEvent.RepairEventPo;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.core.base.smo.BaseServiceSMO;
import com.java110.dto.user.UserDto;
import com.java110.dto.PageDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
 * 类表述: 服务之前调用的接口实现类,不对外提供接口能力 只用于接口建调用
 * add by 吴学文 at 2025-03-31 15:58:51 mail: 928255095@qq.com
 * open source address: https://gitee.com/wuxw7/MicroCommunity
 * 官网:http://www.homecommunity.cn
 * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
 * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
 */
@RestController
public class RepairEventV1InnerServiceSMOImpl extends BaseServiceSMO implements IRepairEventV1InnerServiceSMO {
    @Autowired
    private IRepairEventV1ServiceDao repairEventV1ServiceDaoImpl;
    @Override
    public int saveRepairEvent(@RequestBody  RepairEventPo repairEventPo) {
        int saveFlag = repairEventV1ServiceDaoImpl.saveRepairEventInfo(BeanConvertUtil.beanCovertMap(repairEventPo));
        return saveFlag;
    }
     @Override
    public int updateRepairEvent(@RequestBody  RepairEventPo repairEventPo) {
        int saveFlag = repairEventV1ServiceDaoImpl.updateRepairEventInfo(BeanConvertUtil.beanCovertMap(repairEventPo));
        return saveFlag;
    }
     @Override
    public int deleteRepairEvent(@RequestBody  RepairEventPo repairEventPo) {
       repairEventPo.setStatusCd("1");
       int saveFlag = repairEventV1ServiceDaoImpl.updateRepairEventInfo(BeanConvertUtil.beanCovertMap(repairEventPo));
       return saveFlag;
    }
    @Override
    public List<RepairEventDto> queryRepairEvents(@RequestBody  RepairEventDto repairEventDto) {
        //校验是否传了 分页信息
        int page = repairEventDto.getPage();
        if (page != PageDto.DEFAULT_PAGE) {
            repairEventDto.setPage((page - 1) * repairEventDto.getRow());
        }
        List<RepairEventDto> repairEvents = BeanConvertUtil.covertBeanList(repairEventV1ServiceDaoImpl.getRepairEventInfo(BeanConvertUtil.beanCovertMap(repairEventDto)), RepairEventDto.class);
        return repairEvents;
    }
    @Override
    public int queryRepairEventsCount(@RequestBody RepairEventDto repairEventDto) {
        return repairEventV1ServiceDaoImpl.queryRepairEventsCount(BeanConvertUtil.beanCovertMap(repairEventDto));    }
}