wuxw
2022-09-28 be471607f2aa697f35158499125df1994674ee94
加入 数据权限 单元 关系表
11个文件已添加
981 ■■■■■ 已修改文件
java110-bean/src/main/java/com/java110/dto/dataPrivilegeUnit/DataPrivilegeUnitDto.java 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/po/dataPrivilegeUnit/DataPrivilegeUnitPo.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/dataPrivilegeUnit/DataPrivilegeUnitV1ServiceDaoImplMapper.xml 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-interface/src/main/java/com/java110/intf/community/IDataPrivilegeUnitV1InnerServiceSMO.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-community/src/main/java/com/java110/community/cmd/dataPrivilegeUnit/DeleteDataPrivilegeUnitCmd.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-community/src/main/java/com/java110/community/cmd/dataPrivilegeUnit/ListDataPrivilegeUnitCmd.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-community/src/main/java/com/java110/community/cmd/dataPrivilegeUnit/SaveDataPrivilegeUnitCmd.java 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-community/src/main/java/com/java110/community/cmd/dataPrivilegeUnit/UpdateDataPrivilegeUnitCmd.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-community/src/main/java/com/java110/community/dao/IDataPrivilegeUnitV1ServiceDao.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-community/src/main/java/com/java110/community/dao/impl/DataPrivilegeUnitV1ServiceDaoImpl.java 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-community/src/main/java/com/java110/community/smo/impl/DataPrivilegeUnitV1InnerServiceSMOImpl.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/dto/dataPrivilegeUnit/DataPrivilegeUnitDto.java
New file
@@ -0,0 +1,97 @@
package com.java110.dto.dataPrivilegeUnit;
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 DataPrivilegeUnitDto extends PageDto implements Serializable {
    private String floorId;
private String dpUnitId;
private String dpId;
private String unitNum;
private String unitId;
private String remark;
private String communityId;
private String floorNum;
    private Date createTime;
    private String statusCd = "0";
    public String getFloorId() {
        return floorId;
    }
public void setFloorId(String floorId) {
        this.floorId = floorId;
    }
public String getDpUnitId() {
        return dpUnitId;
    }
public void setDpUnitId(String dpUnitId) {
        this.dpUnitId = dpUnitId;
    }
public String getDpId() {
        return dpId;
    }
public void setDpId(String dpId) {
        this.dpId = dpId;
    }
public String getUnitNum() {
        return unitNum;
    }
public void setUnitNum(String unitNum) {
        this.unitNum = unitNum;
    }
public String getUnitId() {
        return unitId;
    }
public void setUnitId(String unitId) {
        this.unitId = unitId;
    }
public String getRemark() {
        return remark;
    }
public void setRemark(String remark) {
        this.remark = remark;
    }
public String getCommunityId() {
        return communityId;
    }
public void setCommunityId(String communityId) {
        this.communityId = communityId;
    }
public String getFloorNum() {
        return floorNum;
    }
public void setFloorNum(String floorNum) {
        this.floorNum = floorNum;
    }
    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;
    }
}
java110-bean/src/main/java/com/java110/po/dataPrivilegeUnit/DataPrivilegeUnitPo.java
New file
@@ -0,0 +1,96 @@
/*
 * 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.dataPrivilegeUnit;
import java.io.Serializable;
import java.util.Date;
/**
 * 类表述: Po 数据模型实体对象 基本保持与数据库模型一直 用于 增加修改删除 等时的数据载体
 * add by 吴学文 at 2022-09-28 16:32:34 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 DataPrivilegeUnitPo implements Serializable {
    private String floorId;
private String dpUnitId;
private String dpId;
private String unitNum;
private String unitId;
private String remark;
private String statusCd = "0";
private String communityId;
private String floorNum;
public String getFloorId() {
        return floorId;
    }
public void setFloorId(String floorId) {
        this.floorId = floorId;
    }
public String getDpUnitId() {
        return dpUnitId;
    }
public void setDpUnitId(String dpUnitId) {
        this.dpUnitId = dpUnitId;
    }
public String getDpId() {
        return dpId;
    }
public void setDpId(String dpId) {
        this.dpId = dpId;
    }
public String getUnitNum() {
        return unitNum;
    }
public void setUnitNum(String unitNum) {
        this.unitNum = unitNum;
    }
public String getUnitId() {
        return unitId;
    }
public void setUnitId(String unitId) {
        this.unitId = unitId;
    }
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 getCommunityId() {
        return communityId;
    }
public void setCommunityId(String communityId) {
        this.communityId = communityId;
    }
public String getFloorNum() {
        return floorNum;
    }
public void setFloorNum(String floorNum) {
        this.floorNum = floorNum;
    }
}
java110-db/src/main/resources/mapper/dataPrivilegeUnit/DataPrivilegeUnitV1ServiceDaoImplMapper.xml
New file
@@ -0,0 +1,131 @@
<?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="dataPrivilegeUnitV1ServiceDaoImpl">
    <!-- 保存系统配置信息 add by wuxw 2018-07-03 -->
    <insert id="saveDataPrivilegeUnitInfo" parameterType="Map">
        insert into data_privilege_unit(
        floor_id,dp_unit_id,dp_id,unit_num,unit_id,remark,community_id,floor_num
        ) values (
        #{floorId},#{dpUnitId},#{dpId},#{unitNum},#{unitId},#{remark},#{communityId},#{floorNum}
        )
    </insert>
    <!-- 查询系统配置信息 add by wuxw 2018-07-03 -->
    <select id="getDataPrivilegeUnitInfo" parameterType="Map" resultType="Map">
        select t.floor_id,t.floor_id floorId,t.dp_unit_id,t.dp_unit_id dpUnitId,t.dp_id,t.dp_id
        dpId,t.unit_num,t.unit_num unitNum,t.unit_id,t.unit_id unitId,t.remark,t.status_cd,t.status_cd
        statusCd,t.community_id,t.community_id communityId,t.floor_num,t.floor_num floorNum
        from data_privilege_unit t
        where 1 =1
        <if test="floorId !=null and floorId != ''">
            and t.floor_id= #{floorId}
        </if>
        <if test="dpUnitId !=null and dpUnitId != ''">
            and t.dp_unit_id= #{dpUnitId}
        </if>
        <if test="dpId !=null and dpId != ''">
            and t.dp_id= #{dpId}
        </if>
        <if test="unitNum !=null and unitNum != ''">
            and t.unit_num= #{unitNum}
        </if>
        <if test="unitId !=null and unitId != ''">
            and t.unit_id= #{unitId}
        </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="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="floorNum !=null and floorNum != ''">
            and t.floor_num= #{floorNum}
        </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="updateDataPrivilegeUnitInfo" parameterType="Map">
        update data_privilege_unit t set t.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,t.b_id = #{newBId}
        </if>
        <if test="floorId !=null and floorId != ''">
            , t.floor_id= #{floorId}
        </if>
        <if test="dpId !=null and dpId != ''">
            , t.dp_id= #{dpId}
        </if>
        <if test="unitNum !=null and unitNum != ''">
            , t.unit_num= #{unitNum}
        </if>
        <if test="unitId !=null and unitId != ''">
            , t.unit_id= #{unitId}
        </if>
        <if test="remark !=null and remark != ''">
            , t.remark= #{remark}
        </if>
        <if test="floorNum !=null and floorNum != ''">
            , t.floor_num= #{floorNum}
        </if>
        where 1=1
        <if test="dpUnitId !=null and dpUnitId != ''">
            and t.dp_unit_id= #{dpUnitId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
    </update>
    <!-- 查询系统配置数量 add by wuxw 2018-07-03 -->
    <select id="queryDataPrivilegeUnitsCount" parameterType="Map" resultType="Map">
        select count(1) count
        from data_privilege_unit t
        where 1 =1
        <if test="floorId !=null and floorId != ''">
            and t.floor_id= #{floorId}
        </if>
        <if test="dpUnitId !=null and dpUnitId != ''">
            and t.dp_unit_id= #{dpUnitId}
        </if>
        <if test="dpId !=null and dpId != ''">
            and t.dp_id= #{dpId}
        </if>
        <if test="unitNum !=null and unitNum != ''">
            and t.unit_num= #{unitNum}
        </if>
        <if test="unitId !=null and unitId != ''">
            and t.unit_id= #{unitId}
        </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="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="floorNum !=null and floorNum != ''">
            and t.floor_num= #{floorNum}
        </if>
    </select>
</mapper>
java110-interface/src/main/java/com/java110/intf/community/IDataPrivilegeUnitV1InnerServiceSMO.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.dataPrivilegeUnit.DataPrivilegeUnitDto;
import com.java110.po.dataPrivilegeUnit.DataPrivilegeUnitPo;
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 2022-09-28 16:32:34 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("/dataPrivilegeUnitV1Api")
public interface IDataPrivilegeUnitV1InnerServiceSMO {
    @RequestMapping(value = "/saveDataPrivilegeUnit", method = RequestMethod.POST)
    public int saveDataPrivilegeUnit(@RequestBody DataPrivilegeUnitPo dataPrivilegeUnitPo);
    @RequestMapping(value = "/updateDataPrivilegeUnit", method = RequestMethod.POST)
    public int updateDataPrivilegeUnit(@RequestBody DataPrivilegeUnitPo dataPrivilegeUnitPo);
    @RequestMapping(value = "/deleteDataPrivilegeUnit", method = RequestMethod.POST)
    public int deleteDataPrivilegeUnit(@RequestBody DataPrivilegeUnitPo dataPrivilegeUnitPo);
    /**
     * <p>查询小区楼信息</p>
     *
     *
     * @param dataPrivilegeUnitDto 数据对象分享
     * @return DataPrivilegeUnitDto 对象数据
     */
    @RequestMapping(value = "/queryDataPrivilegeUnits", method = RequestMethod.POST)
    List<DataPrivilegeUnitDto> queryDataPrivilegeUnits(@RequestBody DataPrivilegeUnitDto dataPrivilegeUnitDto);
    /**
     * 查询<p>小区楼</p>总记录数
     *
     * @param dataPrivilegeUnitDto 数据对象分享
     * @return 小区下的小区楼记录数
     */
    @RequestMapping(value = "/queryDataPrivilegeUnitsCount", method = RequestMethod.POST)
    int queryDataPrivilegeUnitsCount(@RequestBody DataPrivilegeUnitDto dataPrivilegeUnitDto);
}
service-community/src/main/java/com/java110/community/cmd/dataPrivilegeUnit/DeleteDataPrivilegeUnitCmd.java
New file
@@ -0,0 +1,72 @@
/*
 * 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.dataPrivilegeUnit;
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.community.IDataPrivilegeUnitV1InnerServiceSMO;
import com.java110.po.dataPrivilegeUnit.DataPrivilegeUnitPo;
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;
/**
 * 类表述:删除
 * 服务编码:dataPrivilegeUnit.deleteDataPrivilegeUnit
 * 请求路劲:/app/dataPrivilegeUnit.DeleteDataPrivilegeUnit
 * add by 吴学文 at 2022-09-28 16:32:34 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 = "dataPrivilegeUnit.deleteDataPrivilegeUnit")
public class DeleteDataPrivilegeUnitCmd extends Cmd {
    private static Logger logger = LoggerFactory.getLogger(DeleteDataPrivilegeUnitCmd.class);
    @Autowired
    private IDataPrivilegeUnitV1InnerServiceSMO dataPrivilegeUnitV1InnerServiceSMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
        Assert.hasKeyAndValue(reqJson, "dpUnitId", "dpUnitId不能为空");
        Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
    }
    @Override
    @Java110Transactional
    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
        DataPrivilegeUnitPo dataPrivilegeUnitPo = BeanConvertUtil.covertBean(reqJson, DataPrivilegeUnitPo.class);
        int flag = dataPrivilegeUnitV1InnerServiceSMOImpl.deleteDataPrivilegeUnit(dataPrivilegeUnitPo);
        if (flag < 1) {
            throw new CmdException("删除数据失败");
        }
        cmdDataFlowContext.setResponseEntity(ResultVo.success());
    }
}
service-community/src/main/java/com/java110/community/cmd/dataPrivilegeUnit/ListDataPrivilegeUnitCmd.java
New file
@@ -0,0 +1,84 @@
/*
 * 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.dataPrivilegeUnit;
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.community.IDataPrivilegeUnitV1InnerServiceSMO;
import com.java110.po.dataPrivilegeUnit.DataPrivilegeUnitPo;
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.dataPrivilegeUnit.DataPrivilegeUnitDto;
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;
/**
 * 类表述:查询
 * 服务编码:dataPrivilegeUnit.listDataPrivilegeUnit
 * 请求路劲:/app/dataPrivilegeUnit.ListDataPrivilegeUnit
 * add by 吴学文 at 2022-09-28 16:32:34 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 = "dataPrivilegeUnit.listDataPrivilegeUnit")
public class ListDataPrivilegeUnitCmd extends Cmd {
  private static Logger logger = LoggerFactory.getLogger(ListDataPrivilegeUnitCmd.class);
    @Autowired
    private IDataPrivilegeUnitV1InnerServiceSMO dataPrivilegeUnitV1InnerServiceSMOImpl;
    @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 {
           DataPrivilegeUnitDto dataPrivilegeUnitDto = BeanConvertUtil.covertBean(reqJson, DataPrivilegeUnitDto.class);
           int count = dataPrivilegeUnitV1InnerServiceSMOImpl.queryDataPrivilegeUnitsCount(dataPrivilegeUnitDto);
           List<DataPrivilegeUnitDto> dataPrivilegeUnitDtos = null;
           if (count > 0) {
               dataPrivilegeUnitDtos = dataPrivilegeUnitV1InnerServiceSMOImpl.queryDataPrivilegeUnits(dataPrivilegeUnitDto);
           } else {
               dataPrivilegeUnitDtos = new ArrayList<>();
           }
           ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, dataPrivilegeUnitDtos);
           ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
           cmdDataFlowContext.setResponseEntity(responseEntity);
    }
}
service-community/src/main/java/com/java110/community/cmd/dataPrivilegeUnit/SaveDataPrivilegeUnitCmd.java
New file
@@ -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.community.cmd.dataPrivilegeUnit;
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.community.IDataPrivilegeUnitV1InnerServiceSMO;
import com.java110.po.dataPrivilegeUnit.DataPrivilegeUnitPo;
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;
/**
 * 类表述:保存
 * 服务编码:dataPrivilegeUnit.saveDataPrivilegeUnit
 * 请求路劲:/app/dataPrivilegeUnit.SaveDataPrivilegeUnit
 * add by 吴学文 at 2022-09-28 16:32:34 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 = "dataPrivilegeUnit.saveDataPrivilegeUnit")
public class SaveDataPrivilegeUnitCmd extends Cmd {
    private static Logger logger = LoggerFactory.getLogger(SaveDataPrivilegeUnitCmd.class);
    public static final String CODE_PREFIX_ID = "10";
    @Autowired
    private IDataPrivilegeUnitV1InnerServiceSMO dataPrivilegeUnitV1InnerServiceSMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
        Assert.hasKeyAndValue(reqJson, "dpId", "请求报文中未包含dpId");
Assert.hasKeyAndValue(reqJson, "floorNum", "请求报文中未包含floorNum");
Assert.hasKeyAndValue(reqJson, "floorId", "请求报文中未包含floorId");
Assert.hasKeyAndValue(reqJson, "unitNum", "请求报文中未包含unitNum");
Assert.hasKeyAndValue(reqJson, "unitId", "请求报文中未包含unitId");
Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
    }
    @Override
    @Java110Transactional
    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
       DataPrivilegeUnitPo dataPrivilegeUnitPo = BeanConvertUtil.covertBean(reqJson, DataPrivilegeUnitPo.class);
        dataPrivilegeUnitPo.setDpUnitId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
        int flag = dataPrivilegeUnitV1InnerServiceSMOImpl.saveDataPrivilegeUnit(dataPrivilegeUnitPo);
        if (flag < 1) {
            throw new CmdException("保存数据失败");
        }
        cmdDataFlowContext.setResponseEntity(ResultVo.success());
    }
}
service-community/src/main/java/com/java110/community/cmd/dataPrivilegeUnit/UpdateDataPrivilegeUnitCmd.java
New file
@@ -0,0 +1,75 @@
/*
 * 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.dataPrivilegeUnit;
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.community.IDataPrivilegeUnitV1InnerServiceSMO;
import com.java110.po.dataPrivilegeUnit.DataPrivilegeUnitPo;
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;
/**
 * 类表述:更新
 * 服务编码:dataPrivilegeUnit.updateDataPrivilegeUnit
 * 请求路劲:/app/dataPrivilegeUnit.UpdateDataPrivilegeUnit
 * add by 吴学文 at 2022-09-28 16:32:34 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 = "dataPrivilegeUnit.updateDataPrivilegeUnit")
public class UpdateDataPrivilegeUnitCmd extends Cmd {
  private static Logger logger = LoggerFactory.getLogger(UpdateDataPrivilegeUnitCmd.class);
    @Autowired
    private IDataPrivilegeUnitV1InnerServiceSMO dataPrivilegeUnitV1InnerServiceSMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
        Assert.hasKeyAndValue(reqJson, "dpUnitId", "dpUnitId不能为空");
Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
    }
    @Override
    @Java110Transactional
    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
       DataPrivilegeUnitPo dataPrivilegeUnitPo = BeanConvertUtil.covertBean(reqJson, DataPrivilegeUnitPo.class);
        int flag = dataPrivilegeUnitV1InnerServiceSMOImpl.updateDataPrivilegeUnit(dataPrivilegeUnitPo);
        if (flag < 1) {
            throw new CmdException("更新数据失败");
        }
        cmdDataFlowContext.setResponseEntity(ResultVo.success());
    }
}
service-community/src/main/java/com/java110/community/dao/IDataPrivilegeUnitV1ServiceDao.java
New file
@@ -0,0 +1,77 @@
/*
 * 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 com.java110.entity.merchant.BoMerchant;
import com.java110.entity.merchant.BoMerchantAttr;
import com.java110.entity.merchant.Merchant;
import com.java110.entity.merchant.MerchantAttr;
import java.util.List;
import java.util.Map;
/**
 * 类表述:
 * add by 吴学文 at 2022-09-28 16:32:34 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 IDataPrivilegeUnitV1ServiceDao {
    /**
     * 保存 系统配置信息
     * @param info
     * @throws DAOException DAO异常
     */
    int saveDataPrivilegeUnitInfo(Map info) throws DAOException;
    /**
     * 查询系统配置信息(instance过程)
     * 根据bId 查询系统配置信息
     * @param info bId 信息
     * @return 系统配置信息
     * @throws DAOException DAO异常
     */
    List<Map> getDataPrivilegeUnitInfo(Map info) throws DAOException;
    /**
     * 修改系统配置信息
     * @param info 修改信息
     * @throws DAOException DAO异常
     */
    int updateDataPrivilegeUnitInfo(Map info) throws DAOException;
    /**
     * 查询系统配置总数
     *
     * @param info 系统配置信息
     * @return 系统配置数量
     */
    int queryDataPrivilegeUnitsCount(Map info);
}
service-community/src/main/java/com/java110/community/dao/impl/DataPrivilegeUnitV1ServiceDaoImpl.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.IDataPrivilegeUnitV1ServiceDao;
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 2022-09-28 16:32:34 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("dataPrivilegeUnitV1ServiceDaoImpl")
public class DataPrivilegeUnitV1ServiceDaoImpl extends BaseServiceDao implements IDataPrivilegeUnitV1ServiceDao {
    private static Logger logger = LoggerFactory.getLogger(DataPrivilegeUnitV1ServiceDaoImpl.class);
    /**
     * 保存系统配置信息 到 instance
     * @param info   bId 信息
     * @throws DAOException DAO异常
     */
    @Override
    public int saveDataPrivilegeUnitInfo(Map info) throws DAOException {
        logger.debug("保存 saveDataPrivilegeUnitInfo 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.insert("dataPrivilegeUnitV1ServiceDaoImpl.saveDataPrivilegeUnitInfo",info);
        return saveFlag;
    }
    /**
     * 查询系统配置信息(instance)
     * @param info bId 信息
     * @return List<Map>
     * @throws DAOException DAO异常
     */
    @Override
    public List<Map> getDataPrivilegeUnitInfo(Map info) throws DAOException {
        logger.debug("查询 getDataPrivilegeUnitInfo 入参 info : {}",info);
        List<Map> businessDataPrivilegeUnitInfos = sqlSessionTemplate.selectList("dataPrivilegeUnitV1ServiceDaoImpl.getDataPrivilegeUnitInfo",info);
        return businessDataPrivilegeUnitInfos;
    }
    /**
     * 修改系统配置信息
     * @param info 修改信息
     * @throws DAOException DAO异常
     */
    @Override
    public int updateDataPrivilegeUnitInfo(Map info) throws DAOException {
        logger.debug("修改 updateDataPrivilegeUnitInfo 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("dataPrivilegeUnitV1ServiceDaoImpl.updateDataPrivilegeUnitInfo",info);
        return saveFlag;
    }
     /**
     * 查询系统配置数量
     * @param info 系统配置信息
     * @return 系统配置数量
     */
    @Override
    public int queryDataPrivilegeUnitsCount(Map info) {
        logger.debug("查询 queryDataPrivilegeUnitsCount 入参 info : {}",info);
        List<Map> businessDataPrivilegeUnitInfos = sqlSessionTemplate.selectList("dataPrivilegeUnitV1ServiceDaoImpl.queryDataPrivilegeUnitsCount", info);
        if (businessDataPrivilegeUnitInfos.size() < 1) {
            return 0;
        }
        return Integer.parseInt(businessDataPrivilegeUnitInfos.get(0).get("count").toString());
    }
}
service-community/src/main/java/com/java110/community/smo/impl/DataPrivilegeUnitV1InnerServiceSMOImpl.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.IDataPrivilegeUnitV1ServiceDao;
import com.java110.intf.community.IDataPrivilegeUnitV1InnerServiceSMO;
import com.java110.dto.dataPrivilegeUnit.DataPrivilegeUnitDto;
import com.java110.po.dataPrivilegeUnit.DataPrivilegeUnitPo;
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 2022-09-28 16:32:34 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 DataPrivilegeUnitV1InnerServiceSMOImpl extends BaseServiceSMO implements IDataPrivilegeUnitV1InnerServiceSMO {
    @Autowired
    private IDataPrivilegeUnitV1ServiceDao dataPrivilegeUnitV1ServiceDaoImpl;
    @Override
    public int saveDataPrivilegeUnit(@RequestBody  DataPrivilegeUnitPo dataPrivilegeUnitPo) {
        int saveFlag = dataPrivilegeUnitV1ServiceDaoImpl.saveDataPrivilegeUnitInfo(BeanConvertUtil.beanCovertMap(dataPrivilegeUnitPo));
        return saveFlag;
    }
     @Override
    public int updateDataPrivilegeUnit(@RequestBody  DataPrivilegeUnitPo dataPrivilegeUnitPo) {
        int saveFlag = dataPrivilegeUnitV1ServiceDaoImpl.updateDataPrivilegeUnitInfo(BeanConvertUtil.beanCovertMap(dataPrivilegeUnitPo));
        return saveFlag;
    }
     @Override
    public int deleteDataPrivilegeUnit(@RequestBody  DataPrivilegeUnitPo dataPrivilegeUnitPo) {
       dataPrivilegeUnitPo.setStatusCd("1");
       int saveFlag = dataPrivilegeUnitV1ServiceDaoImpl.updateDataPrivilegeUnitInfo(BeanConvertUtil.beanCovertMap(dataPrivilegeUnitPo));
       return saveFlag;
    }
    @Override
    public List<DataPrivilegeUnitDto> queryDataPrivilegeUnits(@RequestBody  DataPrivilegeUnitDto dataPrivilegeUnitDto) {
        //校验是否传了 分页信息
        int page = dataPrivilegeUnitDto.getPage();
        if (page != PageDto.DEFAULT_PAGE) {
            dataPrivilegeUnitDto.setPage((page - 1) * dataPrivilegeUnitDto.getRow());
        }
        List<DataPrivilegeUnitDto> dataPrivilegeUnits = BeanConvertUtil.covertBeanList(dataPrivilegeUnitV1ServiceDaoImpl.getDataPrivilegeUnitInfo(BeanConvertUtil.beanCovertMap(dataPrivilegeUnitDto)), DataPrivilegeUnitDto.class);
        return dataPrivilegeUnits;
    }
    @Override
    public int queryDataPrivilegeUnitsCount(@RequestBody DataPrivilegeUnitDto dataPrivilegeUnitDto) {
        return dataPrivilegeUnitV1ServiceDaoImpl.queryDataPrivilegeUnitsCount(BeanConvertUtil.beanCovertMap(dataPrivilegeUnitDto));    }
}