Ver código fonte

优化员工关联小区

wuxw 1 ano atrás
pai
commit
e9d2cea09a

+ 90 - 0
java110-bean/src/main/java/com/java110/dto/staffCommunity/StaffCommunityDto.java

@@ -0,0 +1,90 @@
+package com.java110.dto.staffCommunity;
+
+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 StaffCommunityDto extends PageDto implements Serializable {
+
+    private String staffName;
+private String communityName;
+private String storeName;
+private String communityId;
+private String storeId;
+private String scId;
+private String staffId;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getStaffName() {
+        return staffName;
+    }
+public void setStaffName(String staffName) {
+        this.staffName = staffName;
+    }
+public String getCommunityName() {
+        return communityName;
+    }
+public void setCommunityName(String communityName) {
+        this.communityName = communityName;
+    }
+public String getStoreName() {
+        return storeName;
+    }
+public void setStoreName(String storeName) {
+        this.storeName = storeName;
+    }
+public String getCommunityId() {
+        return communityId;
+    }
+public void setCommunityId(String communityId) {
+        this.communityId = communityId;
+    }
+public String getStoreId() {
+        return storeId;
+    }
+public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+public String getScId() {
+        return scId;
+    }
+public void setScId(String scId) {
+        this.scId = scId;
+    }
+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;
+    }
+}

+ 89 - 0
java110-bean/src/main/java/com/java110/po/staffCommunity/StaffCommunityPo.java

@@ -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.staffCommunity;
+
+import java.io.Serializable;
+import java.util.Date;
+/**
+ * 类表述: Po 数据模型实体对象 基本保持与数据库模型一直 用于 增加修改删除 等时的数据载体
+ * add by 吴学文 at 2025-03-18 14:06:45 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 StaffCommunityPo implements Serializable {
+
+    private String staffName;
+private String communityName;
+private String storeName;
+private String statusCd = "0";
+private String communityId;
+private String storeId;
+private String scId;
+private String staffId;
+public String getStaffName() {
+        return staffName;
+    }
+public void setStaffName(String staffName) {
+        this.staffName = staffName;
+    }
+public String getCommunityName() {
+        return communityName;
+    }
+public void setCommunityName(String communityName) {
+        this.communityName = communityName;
+    }
+public String getStoreName() {
+        return storeName;
+    }
+public void setStoreName(String storeName) {
+        this.storeName = storeName;
+    }
+public String getStatusCd() {
+        return statusCd;
+    }
+public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+public String getCommunityId() {
+        return communityId;
+    }
+public void setCommunityId(String communityId) {
+        this.communityId = communityId;
+    }
+public String getStoreId() {
+        return storeId;
+    }
+public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+public String getScId() {
+        return scId;
+    }
+public void setScId(String scId) {
+        this.scId = scId;
+    }
+public String getStaffId() {
+        return staffId;
+    }
+public void setStaffId(String staffId) {
+        this.staffId = staffId;
+    }
+
+
+
+}

+ 120 - 0
java110-db/src/main/resources/mapper/user/StaffCommunityV1ServiceDaoImplMapper.xml

@@ -0,0 +1,120 @@
+<?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="staffCommunityV1ServiceDaoImpl">
+
+
+    <!-- 保存员工小区信息 add by wuxw 2018-07-03 -->
+    <insert id="saveStaffCommunityInfo" parameterType="Map">
+        insert into staff_community(
+        staff_name,community_name,store_name,community_id,store_id,sc_id,staff_id
+        ) values (
+        #{staffName},#{communityName},#{storeName},#{communityId},#{storeId},#{scId},#{staffId}
+        )
+    </insert>
+
+
+    <!-- 查询员工小区信息 add by wuxw 2018-07-03 -->
+    <select id="getStaffCommunityInfo" parameterType="Map" resultType="Map">
+        select t.staff_name staffName,t.community_name communityName,t.store_name storeName,t.status_cd
+        statusCd,t.community_id communityId,t.store_id storeId,t.sc_id scId,t.staff_id staffId,t.create_time createTime
+        from staff_community t
+        where 1 =1
+        <if test="staffName !=null and staffName != ''">
+            and t.staff_name= #{staffName}
+        </if>
+        <if test="communityName !=null and communityName != ''">
+            and t.community_name= #{communityName}
+        </if>
+        <if test="storeName !=null and storeName != ''">
+            and t.store_name= #{storeName}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="scId !=null and scId != ''">
+            and t.sc_id= #{scId}
+        </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="updateStaffCommunityInfo" parameterType="Map">
+        update staff_community 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="communityName !=null and communityName != ''">
+            , t.community_name= #{communityName}
+        </if>
+        <if test="storeName !=null and storeName != ''">
+            , t.store_name= #{storeName}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            , t.community_id= #{communityId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            , t.store_id= #{storeId}
+        </if>
+        <if test="staffId !=null and staffId != ''">
+            , t.staff_id= #{staffId}
+        </if>
+        where 1=1
+        <if test="scId !=null and scId != ''">
+            and t.sc_id= #{scId}
+        </if>
+
+    </update>
+
+    <!-- 查询员工小区数量 add by wuxw 2018-07-03 -->
+    <select id="queryStaffCommunitysCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from staff_community t
+        where 1 =1
+        <if test="staffName !=null and staffName != ''">
+            and t.staff_name= #{staffName}
+        </if>
+        <if test="communityName !=null and communityName != ''">
+            and t.community_name= #{communityName}
+        </if>
+        <if test="storeName !=null and storeName != ''">
+            and t.store_name= #{storeName}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="scId !=null and scId != ''">
+            and t.sc_id= #{scId}
+        </if>
+        <if test="staffId !=null and staffId != ''">
+            and t.staff_id= #{staffId}
+        </if>
+
+
+    </select>
+
+</mapper>

+ 67 - 0
java110-interface/src/main/java/com/java110/intf/user/IStaffCommunityV1InnerServiceSMO.java

@@ -0,0 +1,67 @@
+/*
+ * 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.user;
+
+import com.java110.config.feign.FeignConfiguration;
+import com.java110.dto.staffCommunity.StaffCommunityDto;
+import com.java110.po.staffCommunity.StaffCommunityPo;
+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-18 14:06:45 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 = "user-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/staffCommunityV1Api")
+public interface IStaffCommunityV1InnerServiceSMO {
+
+
+    @RequestMapping(value = "/saveStaffCommunity", method = RequestMethod.POST)
+    int saveStaffCommunity(@RequestBody StaffCommunityPo staffCommunityPo);
+
+    @RequestMapping(value = "/updateStaffCommunity", method = RequestMethod.POST)
+    int updateStaffCommunity(@RequestBody StaffCommunityPo staffCommunityPo);
+
+    @RequestMapping(value = "/deleteStaffCommunity", method = RequestMethod.POST)
+    int deleteStaffCommunity(@RequestBody StaffCommunityPo staffCommunityPo);
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     * @param staffCommunityDto 数据对象分享
+     * @return StaffCommunityDto 对象数据
+     */
+    @RequestMapping(value = "/queryStaffCommunitys", method = RequestMethod.POST)
+    List<StaffCommunityDto> queryStaffCommunitys(@RequestBody StaffCommunityDto staffCommunityDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param staffCommunityDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryStaffCommunitysCount", method = RequestMethod.POST)
+    int queryStaffCommunitysCount(@RequestBody StaffCommunityDto staffCommunityDto);
+}

+ 70 - 0
service-user/src/main/java/com/java110/user/cmd/role/DeleteStaffCommunityCmd.java

@@ -0,0 +1,70 @@
+/*
+ * 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.user.cmd.role;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.intf.user.IStaffCommunityV1InnerServiceSMO;
+import com.java110.po.staffCommunity.StaffCommunityPo;
+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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+/**
+ * 类表述:删除
+ * 服务编码:staffCommunity.deleteStaffCommunity
+ * 请求路劲:/app/staffCommunity.DeleteStaffCommunity
+ * add by 吴学文 at 2025-03-18 14:06:45 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 = "role.deleteStaffCommunity")
+public class DeleteStaffCommunityCmd extends Cmd {
+  private static Logger logger = LoggerFactory.getLogger(DeleteStaffCommunityCmd.class);
+
+    @Autowired
+    private IStaffCommunityV1InnerServiceSMO staffCommunityV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "scId", "scId不能为空");
+Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+       StaffCommunityPo staffCommunityPo = BeanConvertUtil.covertBean(reqJson, StaffCommunityPo.class);
+        int flag = staffCommunityV1InnerServiceSMOImpl.deleteStaffCommunity(staffCommunityPo);
+
+        if (flag < 1) {
+            throw new CmdException("删除数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 80 - 0
service-user/src/main/java/com/java110/user/cmd/role/ListStaffCommunityCmd.java

@@ -0,0 +1,80 @@
+/*
+ * 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.user.cmd.role;
+
+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.user.IStaffCommunityV1InnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.java110.dto.staffCommunity.StaffCommunityDto;
+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;
+
+
+/**
+ * 类表述:查询
+ * 服务编码:staffCommunity.listStaffCommunity
+ * 请求路劲:/app/staffCommunity.ListStaffCommunity
+ * add by 吴学文 at 2025-03-18 14:06:45 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 = "role.listStaffCommunity")
+public class ListStaffCommunityCmd extends Cmd {
+
+  private static Logger logger = LoggerFactory.getLogger(ListStaffCommunityCmd.class);
+    @Autowired
+    private IStaffCommunityV1InnerServiceSMO staffCommunityV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        super.validatePageInfo(reqJson);
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+           StaffCommunityDto staffCommunityDto = BeanConvertUtil.covertBean(reqJson, StaffCommunityDto.class);
+
+           int count = staffCommunityV1InnerServiceSMOImpl.queryStaffCommunitysCount(staffCommunityDto);
+
+           List<StaffCommunityDto> staffCommunityDtos = null;
+
+           if (count > 0) {
+               staffCommunityDtos = staffCommunityV1InnerServiceSMOImpl.queryStaffCommunitys(staffCommunityDto);
+           } else {
+               staffCommunityDtos = new ArrayList<>();
+           }
+
+           ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, staffCommunityDtos);
+
+           ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+           cmdDataFlowContext.setResponseEntity(responseEntity);
+    }
+}

+ 80 - 0
service-user/src/main/java/com/java110/user/cmd/role/SaveStaffCommunityCmd.java

@@ -0,0 +1,80 @@
+/*
+ * 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.user.cmd.role;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.intf.user.IStaffCommunityV1InnerServiceSMO;
+import com.java110.po.staffCommunity.StaffCommunityPo;
+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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * 类表述:保存
+ * 服务编码:staffCommunity.saveStaffCommunity
+ * 请求路劲:/app/staffCommunity.SaveStaffCommunity
+ * add by 吴学文 at 2025-03-18 14:06:45 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 = "role.saveStaffCommunity")
+public class SaveStaffCommunityCmd extends Cmd {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveStaffCommunityCmd.class);
+
+    public static final String CODE_PREFIX_ID = "10";
+
+    @Autowired
+    private IStaffCommunityV1InnerServiceSMO staffCommunityV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "staffId", "请求报文中未包含staffId");
+        Assert.hasKeyAndValue(reqJson, "staffName", "请求报文中未包含staffName");
+        Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
+        Assert.hasKeyAndValue(reqJson, "communityName", "请求报文中未包含communityName");
+        Assert.hasKeyAndValue(reqJson, "storeId", "请求报文中未包含storeId");
+        Assert.hasKeyAndValue(reqJson, "storeName", "请求报文中未包含storeName");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        StaffCommunityPo staffCommunityPo = BeanConvertUtil.covertBean(reqJson, StaffCommunityPo.class);
+        staffCommunityPo.setScId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
+        int flag = staffCommunityV1InnerServiceSMOImpl.saveStaffCommunity(staffCommunityPo);
+
+        if (flag < 1) {
+            throw new CmdException("保存数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 74 - 0
service-user/src/main/java/com/java110/user/cmd/role/UpdateStaffCommunityCmd.java

@@ -0,0 +1,74 @@
+/*
+ * 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.user.cmd.role;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.intf.user.IStaffCommunityV1InnerServiceSMO;
+import com.java110.po.staffCommunity.StaffCommunityPo;
+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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * 类表述:更新
+ * 服务编码:staffCommunity.updateStaffCommunity
+ * 请求路劲:/app/staffCommunity.UpdateStaffCommunity
+ * add by 吴学文 at 2025-03-18 14:06:45 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 = "role.updateStaffCommunity")
+public class UpdateStaffCommunityCmd extends Cmd {
+
+  private static Logger logger = LoggerFactory.getLogger(UpdateStaffCommunityCmd.class);
+
+
+    @Autowired
+    private IStaffCommunityV1InnerServiceSMO staffCommunityV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "scId", "scId不能为空");
+Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+       StaffCommunityPo staffCommunityPo = BeanConvertUtil.covertBean(reqJson, StaffCommunityPo.class);
+        int flag = staffCommunityV1InnerServiceSMOImpl.updateStaffCommunity(staffCommunityPo);
+
+        if (flag < 1) {
+            throw new CmdException("更新数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 3 - 3
service-user/src/main/java/com/java110/user/cmd/roleCommunity/UpdateRoleCommunityCmd.java

@@ -45,7 +45,7 @@ import org.slf4j.LoggerFactory;
 @Java110Cmd(serviceCode = "roleCommunity.updateRoleCommunity")
 public class UpdateRoleCommunityCmd extends Cmd {
 
-  private static Logger logger = LoggerFactory.getLogger(UpdateRoleCommunityCmd.class);
+    private static Logger logger = LoggerFactory.getLogger(UpdateRoleCommunityCmd.class);
 
 
     @Autowired
@@ -54,7 +54,7 @@ public class UpdateRoleCommunityCmd extends Cmd {
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "rcId", "rcId不能为空");
-Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
+        Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
 
     }
 
@@ -62,7 +62,7 @@ Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
-       RoleCommunityPo roleCommunityPo = BeanConvertUtil.covertBean(reqJson, RoleCommunityPo.class);
+        RoleCommunityPo roleCommunityPo = BeanConvertUtil.covertBean(reqJson, RoleCommunityPo.class);
         int flag = roleCommunityV1InnerServiceSMOImpl.updateRoleCommunity(roleCommunityPo);
 
         if (flag < 1) {

+ 73 - 0
service-user/src/main/java/com/java110/user/dao/IStaffCommunityV1ServiceDao.java

@@ -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.user.dao;
+
+
+import com.java110.utils.exception.DAOException;
+
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 类表述:
+ * add by 吴学文 at 2025-03-18 14:06:45 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 IStaffCommunityV1ServiceDao {
+
+
+    /**
+     * 保存 员工小区信息
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    int saveStaffCommunityInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询员工小区信息(instance过程)
+     * 根据bId 查询员工小区信息
+     * @param info bId 信息
+     * @return 员工小区信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getStaffCommunityInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改员工小区信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    int updateStaffCommunityInfo(Map info) throws DAOException;
+
+
+    /**
+     * 查询员工小区总数
+     *
+     * @param info 员工小区信息
+     * @return 员工小区数量
+     */
+    int queryStaffCommunitysCount(Map info);
+
+}

+ 112 - 0
service-user/src/main/java/com/java110/user/dao/impl/StaffCommunityV1ServiceDaoImpl.java

@@ -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.user.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.user.dao.IStaffCommunityV1ServiceDao;
+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-18 14:06:45 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("staffCommunityV1ServiceDaoImpl")
+public class StaffCommunityV1ServiceDaoImpl extends BaseServiceDao implements IStaffCommunityV1ServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(StaffCommunityV1ServiceDaoImpl.class);
+
+
+
+
+
+    /**
+     * 保存员工小区信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public int saveStaffCommunityInfo(Map info) throws DAOException {
+        logger.debug("保存 saveStaffCommunityInfo 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("staffCommunityV1ServiceDaoImpl.saveStaffCommunityInfo",info);
+
+        return saveFlag;
+    }
+
+
+    /**
+     * 查询员工小区信息(instance)
+     * @param info bId 信息
+     * @return List<Map>
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getStaffCommunityInfo(Map info) throws DAOException {
+        logger.debug("查询 getStaffCommunityInfo 入参 info : {}",info);
+
+        List<Map> infos = sqlSessionTemplate.selectList("staffCommunityV1ServiceDaoImpl.getStaffCommunityInfo",info);
+
+        return infos;
+    }
+
+
+    /**
+     * 修改员工小区信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public int updateStaffCommunityInfo(Map info) throws DAOException {
+        logger.debug("修改 updateStaffCommunityInfo 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("staffCommunityV1ServiceDaoImpl.updateStaffCommunityInfo",info);
+
+        return saveFlag;
+    }
+
+     /**
+     * 查询员工小区数量
+     * @param info 员工小区信息
+     * @return 员工小区数量
+     */
+    @Override
+    public int queryStaffCommunitysCount(Map info) {
+        logger.debug("查询 queryStaffCommunitysCount 入参 info : {}",info);
+
+        List<Map> infos = sqlSessionTemplate.selectList("staffCommunityV1ServiceDaoImpl.queryStaffCommunitysCount", info);
+        if (infos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(infos.get(0).get("count").toString());
+    }
+
+
+}

+ 89 - 0
service-user/src/main/java/com/java110/user/smo/impl/StaffCommunityV1InnerServiceSMOImpl.java

@@ -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.user.smo.impl;
+
+
+import com.java110.user.dao.IStaffCommunityV1ServiceDao;
+import com.java110.intf.user.IStaffCommunityV1InnerServiceSMO;
+import com.java110.dto.staffCommunity.StaffCommunityDto;
+import com.java110.po.staffCommunity.StaffCommunityPo;
+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-18 14:06:45 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 StaffCommunityV1InnerServiceSMOImpl extends BaseServiceSMO implements IStaffCommunityV1InnerServiceSMO {
+
+    @Autowired
+    private IStaffCommunityV1ServiceDao staffCommunityV1ServiceDaoImpl;
+
+
+    @Override
+    public int saveStaffCommunity(@RequestBody  StaffCommunityPo staffCommunityPo) {
+        int saveFlag = staffCommunityV1ServiceDaoImpl.saveStaffCommunityInfo(BeanConvertUtil.beanCovertMap(staffCommunityPo));
+        return saveFlag;
+    }
+
+     @Override
+    public int updateStaffCommunity(@RequestBody  StaffCommunityPo staffCommunityPo) {
+        int saveFlag = staffCommunityV1ServiceDaoImpl.updateStaffCommunityInfo(BeanConvertUtil.beanCovertMap(staffCommunityPo));
+        return saveFlag;
+    }
+
+     @Override
+    public int deleteStaffCommunity(@RequestBody  StaffCommunityPo staffCommunityPo) {
+       staffCommunityPo.setStatusCd("1");
+       int saveFlag = staffCommunityV1ServiceDaoImpl.updateStaffCommunityInfo(BeanConvertUtil.beanCovertMap(staffCommunityPo));
+       return saveFlag;
+    }
+
+    @Override
+    public List<StaffCommunityDto> queryStaffCommunitys(@RequestBody  StaffCommunityDto staffCommunityDto) {
+
+        //校验是否传了 分页信息
+
+        int page = staffCommunityDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            staffCommunityDto.setPage((page - 1) * staffCommunityDto.getRow());
+        }
+
+        List<StaffCommunityDto> staffCommunitys = BeanConvertUtil.covertBeanList(staffCommunityV1ServiceDaoImpl.getStaffCommunityInfo(BeanConvertUtil.beanCovertMap(staffCommunityDto)), StaffCommunityDto.class);
+
+        return staffCommunitys;
+    }
+
+
+    @Override
+    public int queryStaffCommunitysCount(@RequestBody StaffCommunityDto staffCommunityDto) {
+        return staffCommunityV1ServiceDaoImpl.queryStaffCommunitysCount(BeanConvertUtil.beanCovertMap(staffCommunityDto));    }
+
+}