wangyangyang 4 سال پیش
والد
کامیت
2567e04c62

+ 84 - 0
sms_water/src/main/java/com/huaxu/controller/ThingSettingController.java

@@ -0,0 +1,84 @@
+package com.huaxu.controller;
+
+import com.huaxu.entity.SceneEntity;
+import com.huaxu.model.AjaxMessage;
+import com.huaxu.model.ResultStatus;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.ui.ModelMap;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Date;
+import org.springframework.web.bind.annotation.*;
+import com.huaxu.entity.ThingSettingEntity;
+import com.huaxu.service.ThingSettingService;
+
+/**
+ * 物品设置页面控制器
+ * @author WYY
+ * @date 2020-12-28 15:18
+ */
+@Controller
+@RequestMapping("/thingsetting")
+@Api(tags = "物品设置")
+public class ThingSettingController{
+    @Autowired
+    private ThingSettingService thingSettingService;
+
+        
+    @RequestMapping(value = "/findList",method = RequestMethod.GET)
+    @ResponseBody
+    @ApiOperation(value = "查询物品统计信息")
+    public AjaxMessage<List<ThingSettingEntity>> findList(@ApiParam(value = "物品类型(1管网 2窨井 3阀门 4消防栓)", required = true) @RequestParam Integer thingType) {
+        ThingSettingEntity thingSettingEntity = new ThingSettingEntity();
+        thingSettingEntity.setThingType(thingType);
+        List<ThingSettingEntity> thingSettingEntities = thingSettingService.findList(thingSettingEntity);
+        return new AjaxMessage<>(ResultStatus.OK, thingSettingEntities);
+    }
+    /**
+     * 新增
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.POST)
+    @ResponseBody
+    public  AjaxMessage<Integer> addThingSetting(@ApiParam(value = "物品统计设置", required = true) @RequestBody ThingSettingEntity thingSetting) {
+        //校验参数
+        int result = thingSettingService.addThingSetting(thingSetting) ? 1 : 0;
+        return new AjaxMessage<>(ResultStatus.OK, result);
+    }
+    
+
+    
+    /**
+     * 修改
+     */
+    @RequestMapping(value = "/selectById", method = RequestMethod.GET)
+    public AjaxMessage<ThingSettingEntity> selectById(@ApiParam(value = "id", required = true) @RequestParam Long id){
+        ThingSettingEntity thingSetting = thingSettingService.findThingSettingById(id);
+        return  new AjaxMessage<>(ResultStatus.OK, thingSetting);
+    }
+
+    /**
+     * 修改保存物品设置
+     */
+    @RequestMapping(value = "/updateById", method = RequestMethod.POST)
+    @ResponseBody
+    public AjaxMessage<Integer> editThingSetting(@ApiParam(value = "物品统计设置", required = true) @RequestBody ThingSettingEntity thingSetting) {
+        int result = thingSettingService.updateThingSettingById(thingSetting) ? 1 : 0;
+        return new AjaxMessage<>(ResultStatus.OK, result);
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/deleteByIds", method = RequestMethod.POST)
+    @ResponseBody
+    public AjaxMessage<Integer>  del(@ApiParam(value = "ids", required = true) @RequestBody Long[] ids) {
+        int result =  thingSettingService.delThingSettingByIds(ids)? 1: 0;
+        return new AjaxMessage<>(ResultStatus.OK, result);
+    }
+}

+ 83 - 0
sms_water/src/main/java/com/huaxu/controller/ThingyearSettingController.java

@@ -0,0 +1,83 @@
+package com.huaxu.controller;
+
+import com.huaxu.entity.SceneEntity;
+import com.huaxu.entity.ThingSettingEntity;
+import com.huaxu.model.AjaxMessage;
+import com.huaxu.model.LoginUser;
+import com.huaxu.model.ResultStatus;
+import com.huaxu.util.UserUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.ui.ModelMap;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Date;
+import org.springframework.web.bind.annotation.*;
+import com.huaxu.entity.ThingyearSettingEntity;
+import com.huaxu.service.ThingyearSettingService;
+
+/**
+ * 物品年代设置页面控制器
+ * @author WYY
+ * @date 2020-12-28 15:18
+ */
+@RestController
+@RequestMapping("/thingyearsetting")
+@Api(tags = "物品年代设置")
+public class ThingyearSettingController {
+    @Autowired
+    private ThingyearSettingService thingyearSettingService;
+
+    @RequestMapping(value = "/findList",method = RequestMethod.GET)
+    @ResponseBody
+    public AjaxMessage<List<ThingyearSettingEntity>> findList(@ApiParam(value = "物品类型(1管网 2窨井 3阀门 4消防栓)", required = true)@RequestParam Integer thingType) {
+        ThingyearSettingEntity thingyearSettingEntity = new ThingyearSettingEntity();
+        thingyearSettingEntity.setThingType(thingType);
+        List<ThingyearSettingEntity> thingyearSettingEntities = thingyearSettingService.findList(thingyearSettingEntity);
+        return new AjaxMessage<>(ResultStatus.OK, thingyearSettingEntities);
+    }
+
+    /**
+     * 新增
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.POST)
+    @ResponseBody
+    public  AjaxMessage<Integer> addThingyearSetting(@ApiParam(value = "物品年代统计设置", required = true) @RequestBody ThingyearSettingEntity thingyearSetting){
+        //校验参数
+        int result =  thingyearSettingService.addThingyearSetting(thingyearSetting)? 1: 0;
+        return new AjaxMessage<>(ResultStatus.OK, result);
+    }    
+
+    /**
+     * 修改
+     */
+    @RequestMapping(value = "/selectById", method = RequestMethod.GET)
+    public AjaxMessage<ThingyearSettingEntity> selectById(@ApiParam(value = "id", required = true) @RequestParam Long id){
+        ThingyearSettingEntity thingyearSetting = thingyearSettingService.findThingyearSettingById(id);
+        return  new AjaxMessage<>(ResultStatus.OK, thingyearSetting);
+    }
+
+    /**
+     * 修改保存物品年代设置
+     */
+    @RequestMapping(value = "/updateById", method = RequestMethod.POST)
+    @ResponseBody
+    public AjaxMessage<Integer>  editThingyearSetting(@ApiParam(value = "物品年代统计设置", required = true) @RequestBody ThingyearSettingEntity thingyearSetting){
+        int result = thingyearSettingService.updateThingyearSettingById(thingyearSetting)? 1 : 0;
+        return new AjaxMessage<>(ResultStatus.OK, result);
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/deleteById", method = RequestMethod.POST)
+    @ResponseBody
+    public AjaxMessage<Integer> del(@ApiParam(value = "ids", required = true) @RequestBody Long[] ids) {
+        int result = thingyearSettingService.delThingyearSettingByIds(ids) ? 1 : 0;
+        return new AjaxMessage<>(ResultStatus.OK, result);
+    }
+}

+ 34 - 0
sms_water/src/main/java/com/huaxu/dao/ThingSettingMapper.java

@@ -0,0 +1,34 @@
+package com.huaxu.dao;
+
+import com.huaxu.entity.ThingSettingEntity;
+import java.io.Serializable;
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+/**
+ *
+ * sms_thing_settingDAO接口
+ * @author: WYY
+ * @date 2020-12-28 15:18
+ */
+@Mapper
+public interface ThingSettingMapper extends BaseMapper<ThingSettingEntity> {
+
+	/**
+     * 自定义分页查询
+     * @param  page 
+     * @param  thingSettingEntity 实体类
+     */
+     Page<ThingSettingEntity> findPage(IPage<ThingSettingEntity> page,
+                                       @Param("thingSetting") ThingSettingEntity thingSettingEntity);
+
+     ThingSettingEntity findThingSettingById(Serializable id);
+
+
+     List<ThingSettingEntity> findList( @Param("thingSetting")ThingSettingEntity thingSettingEntity);
+
+     /**删除相关方法  使用mybatis-plus集成的 **/
+}

+ 34 - 0
sms_water/src/main/java/com/huaxu/dao/ThingyearSettingMapper.java

@@ -0,0 +1,34 @@
+package com.huaxu.dao;
+
+import com.huaxu.entity.ThingyearSettingEntity;
+import java.io.Serializable;
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+/**
+ *
+ * sms_thingyear_settingDAO接口
+ * @author: WYY
+ * @date 2020-12-28 15:18
+ */
+@Mapper
+public interface ThingyearSettingMapper extends BaseMapper<ThingyearSettingEntity> {
+
+	/**
+     * 自定义分页查询
+     * @param  page 
+     * @param  thingyearSettingEntity 实体类
+     */
+     Page<ThingyearSettingEntity> findPage(IPage<ThingyearSettingEntity> page,
+                                       @Param("thingyearSetting") ThingyearSettingEntity thingyearSettingEntity);
+
+     ThingyearSettingEntity findThingyearSettingById(Serializable id);
+
+
+     List<ThingyearSettingEntity> findList(@Param("thingyearSetting") ThingyearSettingEntity thingyearSettingEntity);
+
+     /**删除相关方法  使用mybatis-plus集成的 **/
+}

+ 124 - 0
sms_water/src/main/java/com/huaxu/entity/ThingSettingEntity.java

@@ -0,0 +1,124 @@
+package com.huaxu.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.huaxu.model.ProgramItem;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * sms_thing_setting
+ * @author: WYY
+ * @date 2020-12-28 15:18
+ */
+@Data
+@TableName("sms_thing_setting")
+public class ThingSettingEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    @ApiModelProperty(value = "主键")
+	@TableId(type = IdType.AUTO)
+    private Long id;
+
+    /** 租户标识 */
+    @ApiModelProperty(value = "租户标识")
+    private String tenantId;
+
+    /** 所属公司 */
+    @ApiModelProperty(value = "所属公司")
+    private Long companyOrgId;
+
+    /** 所属公司 */
+    @ApiModelProperty(value = "所属公司")
+    @TableField(exist = false)
+    private String companyOrgName;
+
+    /** 所属部门 */
+    @ApiModelProperty(value = "所属部门")
+    @TableField(exist = false)
+    private String deptOrgName;
+
+    /** 所属部门 */
+    @ApiModelProperty(value = "所属部门")
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private Long deptOrgId;
+
+    /** 物品类型 */
+    @ApiModelProperty(value = "物品类型")
+    private Integer thingType;
+
+    /** 物品材质类型 */
+    @ApiModelProperty(value = "物品材质类型")
+    private Integer thingObjectType;
+
+
+    /** 物品口径 */
+    @ApiModelProperty(value = "物品口径")
+    private Integer thingBore;
+
+    /** 物品长度 */
+    @ApiModelProperty(value = "物品长度")
+    private Double thingLength;
+
+    /** 物品个数 */
+    @ApiModelProperty(value = "物品个数")
+    private Integer thingCount;
+
+    /**
+     * 数据删除标识
+     */
+    @ApiModelProperty(value = "数据删除标识")
+    @TableLogic
+    @JsonIgnore
+    private Integer status;
+    /**
+     * 创建人
+     */
+    @ApiModelProperty(value = "创建人")
+    @JsonIgnore
+    private String createBy;
+    /**
+     * 创建时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
+    @JsonIgnore
+    private Date dateCreate;
+    /**
+     * 更新人
+     */
+    @ApiModelProperty(value = "更新人")
+    @JsonIgnore
+    private String updateBy;
+    /**
+     * 更新时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+    @ApiModelProperty(value = "更新时间")
+    private Date dateUpdate;
+
+    @ApiModelProperty(value ="权限",hidden = true)
+    @TableField(exist = false)
+    @JsonIgnore
+    private List<ProgramItem> programItems;
+
+    @ApiModelProperty(value="用户权限类型")
+    @TableField(exist = false)
+    @JsonIgnore
+    private Integer permissonType;
+
+    /** 用户类型 */
+    @ApiModelProperty(value = "用户类型(-9999 超管 -999普通用户 2普通用户)")
+    @TableField(exist = false)
+    @JsonIgnore
+    private String userType;
+
+}

+ 116 - 0
sms_water/src/main/java/com/huaxu/entity/ThingyearSettingEntity.java

@@ -0,0 +1,116 @@
+package com.huaxu.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.huaxu.model.ProgramItem;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * sms_thingyear_setting
+ * @author: WYY
+ * @date 2020-12-28 15:18
+ */
+@Data
+@TableName("sms_thingyear_setting")
+public class ThingyearSettingEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    @ApiModelProperty(value = "主键")
+	@TableId(type = IdType.AUTO)
+    private Long id;
+
+    /** 租户标识 */
+    @ApiModelProperty(value = "租户标识")
+    private String tenantId;
+
+    /** 所属公司 */
+    @ApiModelProperty(value = "所属公司")
+    private Long companyOrgId;
+
+    /** 所属部门 */
+    @ApiModelProperty(value = "所属部门")
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private Long deptOrgId;
+
+    /** 所属公司 */
+    @ApiModelProperty(value = "所属公司")
+    @TableField(exist = false)
+    private String companyOrgName;
+
+    /** 所属部门 */
+    @ApiModelProperty(value = "所属部门")
+    @TableField(exist = false)
+    private String deptOrgName;
+
+    /** 物品类型 */
+    @ApiModelProperty(value = "物品类型")
+    private Integer thingType;
+
+    /** 物品年代类型 */
+    @ApiModelProperty(value = "物品年代类型")
+    private Integer thingYearType;
+
+
+    /** 物品个数 */
+    @ApiModelProperty(value = "物品个数")
+    private Integer thingCount;
+
+    /**
+     * 数据删除标识
+     */
+    @ApiModelProperty(value = "数据删除标识")
+    @TableLogic
+    @JsonIgnore
+    private Integer status;
+    /**
+     * 创建人
+     */
+    @ApiModelProperty(value = "创建人")
+    @JsonIgnore
+    private String createBy;
+    /**
+     * 创建时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
+    @JsonIgnore
+    private Date dateCreate;
+    /**
+     * 更新人
+     */
+    @ApiModelProperty(value = "更新人")
+    @JsonIgnore
+    private String updateBy;
+    /**
+     * 更新时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+    @ApiModelProperty(value = "更新时间")
+    private Date dateUpdate;
+
+    @ApiModelProperty(value ="权限",hidden = true)
+    @TableField(exist = false)
+    @JsonIgnore
+    private List<ProgramItem> programItems;
+
+    @ApiModelProperty(value="用户权限类型")
+    @TableField(exist = false)
+    @JsonIgnore
+    private Integer permissonType;
+
+    /** 用户类型 */
+    @ApiModelProperty(value = "用户类型(-9999 超管 -999普通用户 2普通用户)")
+    @TableField(exist = false)
+    @JsonIgnore
+    private String userType;
+
+}

+ 117 - 0
sms_water/src/main/java/com/huaxu/service/ThingSettingService.java

@@ -0,0 +1,117 @@
+package com.huaxu.service;
+
+
+import com.huaxu.dao.ThingSettingMapper;
+import com.huaxu.entity.SceneEntity;
+import com.huaxu.entity.ThingSettingEntity;
+import com.huaxu.model.LoginUser;
+import com.huaxu.util.OrgInfoUtil;
+import com.huaxu.util.UserUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+
+import javax.annotation.Resource;
+
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.List;
+import java.util.Arrays;
+
+/**
+ * 物品设置Service接口
+ *
+ * @author: WYY
+ * @date 2020-12-28 15:18
+ */
+@Service
+public class ThingSettingService extends ServiceImpl<ThingSettingMapper, ThingSettingEntity> {
+
+    @Resource
+    private ThingSettingMapper thingSettingMapper;
+    @Autowired
+    private OrgInfoUtil orgInfoUtil;
+
+
+    /**
+     * 查列表
+     */
+    public List<ThingSettingEntity> findList(ThingSettingEntity thingSettingEntity) {
+        LoginUser currentUser = UserUtil.getCurrentUser();
+        thingSettingEntity.setTenantId(currentUser.getTenantId());
+        thingSettingEntity.setProgramItems(currentUser.getProgramItemList());
+        thingSettingEntity.setUserType(currentUser.getType());
+        //1是公司,2是公司及以下,3部门,4部门及以下,5自定义
+        thingSettingEntity.setPermissonType(currentUser.getPermissonType());
+        List<ThingSettingEntity> thingSettingEntities = thingSettingMapper.findList(thingSettingEntity);
+
+        for (ThingSettingEntity item : thingSettingEntities) {
+            if (item.getCompanyOrgId() != null)
+                item.setCompanyOrgName(orgInfoUtil.getOrgName(item.getCompanyOrgId().intValue()));
+            if (item.getDeptOrgId() != null)
+                item.setDeptOrgName(orgInfoUtil.getOrgName(item.getDeptOrgId().intValue()));
+        }
+        return thingSettingEntities;
+    }
+
+    /**
+     * 批量删除
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public boolean delThingSettingByIds(Long[] ids) {
+        return this.removeByIds(Arrays.asList(ids));
+    }
+
+    /**
+     * 单个删除
+     */
+    public boolean delThingSettingById(Long id) {
+        return this.removeById(id);
+    }
+
+    /**
+     * 保存
+     */
+    public boolean addThingSetting(ThingSettingEntity thingSetting) {
+        LoginUser currentUser = UserUtil.getCurrentUser();
+        thingSetting.setTenantId(currentUser.getTenantId());
+        thingSetting.setStatus(1);
+        if (currentUser != null) {
+            thingSetting.setCreateBy(currentUser.getName());
+            thingSetting.setUpdateBy(currentUser.getName());
+            thingSetting.setDateUpdate(new Date());
+            thingSetting.setDateCreate(new Date());
+        }
+        if (thingSetting.getDeptOrgId() != null && thingSetting.getDeptOrgId() == 0)
+            thingSetting.setDeptOrgId(null);
+        if (this.save(thingSetting)) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * 修改根居ID
+     */
+    public boolean updateThingSettingById(ThingSettingEntity thingSetting) {
+        LoginUser currentUser = UserUtil.getCurrentUser();
+        thingSetting.setUpdateBy(currentUser.getName());
+        if (thingSetting.getDeptOrgId() != null && thingSetting.getDeptOrgId() == 0)
+            thingSetting.setDeptOrgId(null);
+        if (this.updateById(thingSetting)) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * 根居ID获取对象
+     */
+    public ThingSettingEntity findThingSettingById(Long id) {
+        return thingSettingMapper.findThingSettingById(id);
+    }
+}

+ 116 - 0
sms_water/src/main/java/com/huaxu/service/ThingyearSettingService.java

@@ -0,0 +1,116 @@
+package com.huaxu.service;
+
+
+import com.huaxu.dao.ThingyearSettingMapper;
+import com.huaxu.entity.ThingSettingEntity;
+import com.huaxu.entity.ThingyearSettingEntity;
+import com.huaxu.model.LoginUser;
+import com.huaxu.util.OrgInfoUtil;
+import com.huaxu.util.UserUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+
+import javax.annotation.Resource;
+
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.List;
+import java.util.Arrays;
+
+/**
+ * 物品年代设置Service接口
+ *
+ * @author: WYY
+ * @date 2020-12-28 15:18
+ */
+@Service
+public class ThingyearSettingService extends ServiceImpl<ThingyearSettingMapper, ThingyearSettingEntity> {
+
+    @Resource
+    private ThingyearSettingMapper thingyearSettingMapper;
+    @Autowired
+    private OrgInfoUtil orgInfoUtil;
+
+    /**
+     * 查列表
+     */
+    public List<ThingyearSettingEntity> findList(ThingyearSettingEntity thingyearSettingEntity) {
+        LoginUser currentUser = UserUtil.getCurrentUser();
+        thingyearSettingEntity.setTenantId(currentUser.getTenantId());
+        thingyearSettingEntity.setTenantId(currentUser.getTenantId());
+        thingyearSettingEntity.setProgramItems(currentUser.getProgramItemList());
+        thingyearSettingEntity.setUserType(currentUser.getType());
+        //1是公司,2是公司及以下,3部门,4部门及以下,5自定义
+        thingyearSettingEntity.setPermissonType(currentUser.getPermissonType());
+        List<ThingyearSettingEntity> thingSettingEntities = thingyearSettingMapper.findList(thingyearSettingEntity);
+        for (ThingyearSettingEntity item : thingSettingEntities) {
+            if (item.getCompanyOrgId() != null)
+                item.setCompanyOrgName(orgInfoUtil.getOrgName(item.getCompanyOrgId().intValue()));
+            if (item.getDeptOrgId() != null)
+                item.setDeptOrgName(orgInfoUtil.getOrgName(item.getDeptOrgId().intValue()));
+        }
+        return thingSettingEntities;
+    }
+
+    /**
+     * 批量删除
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public boolean delThingyearSettingByIds(Long[] ids) {
+        return this.removeByIds(Arrays.asList(ids));
+    }
+
+    /**
+     * 单个删除
+     */
+    public boolean delThingyearSettingById(Long id) {
+        return this.removeById(id);
+    }
+
+    /**
+     * 保存
+     */
+    public boolean addThingyearSetting(ThingyearSettingEntity thingyearSetting) {
+        LoginUser currentUser = UserUtil.getCurrentUser();
+        thingyearSetting.setTenantId(currentUser.getTenantId());
+        thingyearSetting.setStatus(1);
+        if (currentUser != null) {
+            thingyearSetting.setCreateBy(currentUser.getName());
+            thingyearSetting.setUpdateBy(currentUser.getName());
+            thingyearSetting.setDateUpdate(new Date());
+            thingyearSetting.setDateCreate(new Date());
+        }
+        if (thingyearSetting.getDeptOrgId() != null && thingyearSetting.getDeptOrgId() == 0)
+            thingyearSetting.setDeptOrgId(null);
+        if (this.save(thingyearSetting)) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * 修改根居ID
+     */
+    public boolean updateThingyearSettingById(ThingyearSettingEntity thingyearSetting) {
+        LoginUser currentUser = UserUtil.getCurrentUser();
+        thingyearSetting.setUpdateBy(currentUser.getName());
+        if (thingyearSetting.getDeptOrgId() != null && thingyearSetting.getDeptOrgId() == 0)
+            thingyearSetting.setDeptOrgId(null);
+        if (this.updateById(thingyearSetting)) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * 根居ID获取对象
+     */
+    public ThingyearSettingEntity findThingyearSettingById(Long id) {
+        return thingyearSettingMapper.findThingyearSettingById(id);
+    }
+}

+ 9 - 4
sms_water/src/main/resources/mapper/DeviceParmMapper.xml

@@ -22,6 +22,7 @@
             ,p.CREATE_BY as "createBy"
             ,p.DATE_UPDATE as "dateUpdate"
             ,p.UPDATE_BY as "updateBy"
+            ,p.parm_type as "parmType"
             ,t.`NAME` as "attributeName"
     </sql>
 
@@ -74,6 +75,7 @@
                     ,p.CREATE_BY as "createBy"
                     ,p.DATE_UPDATE as "dateUpdate"
                     ,p.UPDATE_BY as "updateBy"
+                    ,p.parm_type as "parmType"
                     ,b.`NAME` as "attributeName"
         from sms_device  a
          inner join sms_device_parm p on p.DEVICE_ID=a.id and p.parent_scene_id = #{sceneId} and p.`STATUS`=1
@@ -111,17 +113,17 @@
 
     <!-- 新增所有列 -->
     <insert id="insert" keyProperty="id" useGeneratedKeys="true">
-        INSERT INTO sms_device_parm (TENANT_ID ,parent_scene_id,scene_id,DEVICE_ID ,ATTRIBUTE_ID ,IS_SUSPENSION ,IS_REPORT ,IS_CHART ,IS_MAP ,IS_ALARM ,IS_ARTWORK ,REMARK ,SEQ,STATUS ,DATE_CREATE ,CREATE_BY ,DATE_UPDATE ,UPDATE_BY )
-        VALUES(#{tenantId},#{parentSceneId},#{sceneId},#{deviceId},#{attributeId},#{isSuspension},#{isReport},#{isChart},#{isMap},#{isAlarm},#{isArtwork},#{remark},#{seq},#{status},#{dateCreate},#{createBy},#{dateUpdate},#{updateBy})
+        INSERT INTO sms_device_parm (TENANT_ID ,parent_scene_id,scene_id,DEVICE_ID ,ATTRIBUTE_ID ,IS_SUSPENSION ,IS_REPORT ,IS_CHART ,IS_MAP ,IS_ALARM ,IS_ARTWORK,PARM_TYPE ,REMARK ,SEQ,STATUS ,DATE_CREATE ,CREATE_BY ,DATE_UPDATE ,UPDATE_BY )
+        VALUES(#{tenantId},#{parentSceneId},#{sceneId},#{deviceId},#{attributeId},#{isSuspension},#{isReport},#{isChart},#{isMap},#{isAlarm},#{isArtwork},#{parmType},#{remark},#{seq},#{status},#{dateCreate},#{createBy},#{dateUpdate},#{updateBy})
    </insert>
 
     <!-- 批量新增 -->
     <insert id="batchInsert">
         INSERT INTO sms_device_parm (TENANT_ID ,parent_scene_id,scene_id,DEVICE_ID ,ATTRIBUTE_ID ,IS_SUSPENSION ,IS_REPORT ,IS_CHART ,IS_MAP
-        ,IS_ALARM ,IS_ARTWORK ,REMARK ,SEQ,STATUS ,DATE_CREATE ,CREATE_BY ,DATE_UPDATE ,UPDATE_BY )
+        ,IS_ALARM ,IS_ARTWORK ,PARM_TYPE,REMARK ,SEQ,STATUS ,DATE_CREATE ,CREATE_BY ,DATE_UPDATE ,UPDATE_BY )
         values
         <foreach collection="deviceParms" item="item" index="index" separator=",">
-            (#{item.tenantId},#{item.parentSceneId},#{item.sceneId},#{item.deviceId},#{item.attributeId},#{item.isSuspension},#{item.isReport},#{item.isChart},#{item.isMap},#{item.isAlarm},#{item.isArtwork},#{item.remark},#{seq},#{item.status},#{item.dateCreate},#{item.createBy},#{item.dateUpdate},#{item.updateBy})
+            (#{item.tenantId},#{item.parentSceneId},#{item.sceneId},#{item.deviceId},#{item.attributeId},#{item.isSuspension},#{item.isReport},#{item.isChart},#{item.isMap},#{item.isAlarm},#{item.isArtwork},#{item.parmType},#{item.remark},#{seq},#{item.status},#{item.dateCreate},#{item.createBy},#{item.dateUpdate},#{item.updateBy})
         </foreach>
     </insert>
 
@@ -159,6 +161,9 @@
             <if test="remark != null and remark != '' ">
                 REMARK = #{remark},
             </if>
+            <if test="parmType != null and parmType != '' ">
+                parm_type = #{parmType},
+            </if>
             <if test="seq != null and seq != '' ">
                 SEQ = #{seq},
             </if>

+ 111 - 0
sms_water/src/main/resources/mapper/ThingSettingMapper.xml

@@ -0,0 +1,111 @@
+<?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="com.huaxu.dao.ThingSettingMapper">
+
+
+    <resultMap type="ThingSettingEntity" id="ThingSettingResult">
+        <result property="id" column="id"/>
+        <result property="tenantId" column="tenant_id"/>
+        <result property="companyOrgId" column="company_org_id"/>
+        <result property="deptOrgId" column="dept_org_id"/>
+        <result property="thingType" column="thing_type"/>
+        <result property="thingObjectType" column="thing_object_type"/>
+        <result property="thingBore" column="thing_bore"/>
+        <result property="thingLength" column="thing_length"/>
+        <result property="thingCount" column="thing_count"/>
+        <result property="remark" column="remark"/>
+        <result property="status" column="status"/>
+        <result property="dateCreate" column="date_create"/>
+        <result property="createBy" column="create_by"/>
+        <result property="dateUpdate" column="date_update"/>
+        <result property="updateBy" column="update_by"/>
+    </resultMap>
+
+    <!--  实体栏位  -->
+    <sql id="thingSettingColumns">
+         a.id as "id" ,
+         a.tenant_id as "tenantId" ,
+         a.company_org_id as "companyOrgId" ,
+         a.dept_org_id as "deptOrgId" ,
+         a.thing_type as "thingType" ,
+         a.thing_object_type as "thingObjectType" ,
+         a.thing_bore as "thingBore" ,
+         a.thing_length as "thingLength" ,
+         a.thing_count as "thingCount" ,
+         a.remark as "remark" ,
+         a.status as "status" ,
+         a.date_create as "dateCreate" ,
+         a.create_by as "createBy" ,
+         a.date_update as "dateUpdate" ,
+         a.update_by as "updateBy" 
+     </sql>
+
+    <!--  根据主键获取实体   -->
+    <select id="findThingSettingById" resultType="com.huaxu.entity.ThingSettingEntity">
+        SELECT
+        <include refid="thingSettingColumns"/>
+        FROM sms_thing_setting a
+
+        WHERE a.id = #{id} and a.status=1
+    </select>
+
+    <!--  根据获取实体List   -->
+    <select id="findList" resultType="com.huaxu.entity.ThingSettingEntity">
+        SELECT
+        <include refid="thingSettingColumns"/>
+        FROM sms_thing_setting a
+
+        <where>
+            a.status=1
+            <if test="thingSetting.tenantId != null  and thingSetting.tenantId != ''">and a.tenant_id = #{thingSetting.tenantId}</if>
+            <if test="thingSetting.thingType != null ">and a.thing_type = #{thingSetting.thingType}</if>
+            <if test="thingSetting.thingObjectType != null ">and a.thing_object_type = #{thingSetting.thingObjectType}</if>
+            <if test="thingSetting.userType!=null and thingSetting.userType!=-999 and thingSetting.userType!=-9999 and  thingSetting.programItems != null and thingSetting.programItems.size() > 0">
+                <if test="thingSetting.permissonType == 5 or thingSetting.permissonType == 2">
+                    and ( a.DEPT_ORG_ID in
+                    <foreach collection="thingSetting.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    or
+                    a.COMPANY_ORG_ID in
+                    <foreach collection="thingSetting.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    )
+                </if>
+                <if test="thingSetting.permissonType == 4 or thingSetting.permissonType == 3">
+                    and a.DEPT_ORG_ID in
+                    <foreach collection="thingSetting.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                </if>
+                <if test="thingSetting.permissonType == 1">
+                    and a.COMPANY_ORG_ID in
+                    <foreach collection="thingSetting.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    and (a.DEPT_ORG_ID is null or a.DEPT_ORG_ID =0)
+                </if>
+            </if>
+        </where>
+    </select>
+
+    <!--  根据获取实体 page   -->
+    <select id="findPage" resultType="com.huaxu.entity.ThingSettingEntity">
+        SELECT
+        <include refid="thingSettingColumns"/>
+        FROM sms_thing_setting a
+
+        <where>
+            a.status=1
+            <if test="thingSetting.tenantId != null  and thingSetting.tenantId != ''">and a.tenant_id =
+                #{thingSetting.tenantId}
+            </if>
+            <if test="thingSetting.thingType != null ">and a.thing_type = #{thingSetting.thingType}</if>
+            <if test="thingSetting.thingObjectType != null ">and a.thing_object_type = #{thingSetting.thingObjectType}
+            </if>
+        </where>
+    </select>
+</mapper>

+ 103 - 0
sms_water/src/main/resources/mapper/ThingyearSettingMapper.xml

@@ -0,0 +1,103 @@
+<?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="com.huaxu.dao.ThingyearSettingMapper">
+
+
+    <resultMap type="ThingyearSettingEntity" id="ThingyearSettingResult">
+        <result property="id" column="id"/>
+        <result property="tenantId" column="tenant_id"/>
+        <result property="companyOrgId" column="company_org_id"/>
+        <result property="deptOrgId" column="dept_org_id"/>
+        <result property="thingType" column="thing_type"/>
+        <result property="thingYearType" column="thing_year_type"/>
+        <result property="thingCount" column="thing_count"/>
+        <result property="remark" column="remark"/>
+        <result property="status" column="status"/>
+        <result property="dateCreate" column="date_create"/>
+        <result property="createBy" column="create_by"/>
+        <result property="dateUpdate" column="date_update"/>
+        <result property="updateBy" column="update_by"/>
+    </resultMap>
+
+    <!--  实体栏位  -->
+    <sql id="thingyearSettingColumns">
+         a.id as "id" ,
+         a.tenant_id as "tenantId" ,
+         a.company_org_id as "companyOrgId" ,
+         a.dept_org_id as "deptOrgId" ,
+         a.thing_type as "thingType" ,
+         a.thing_year_type as "thingYearType" ,
+         a.thing_count as "thingCount" ,
+         a.remark as "remark" ,
+         a.status as "status" ,
+         a.date_create as "dateCreate" ,
+         a.create_by as "createBy" ,
+         a.date_update as "dateUpdate" ,
+         a.update_by as "updateBy" 
+     </sql>
+
+
+    <!--  根据主键获取实体   -->
+    <select id="findThingyearSettingById" resultType="com.huaxu.entity.ThingyearSettingEntity">
+        SELECT
+        <include refid="thingyearSettingColumns"/>
+        FROM sms_thingyear_setting a
+        WHERE a.id = #{id} and a.status=1
+    </select>
+
+    <!--  根据获取实体List   -->
+    <select id="findList" resultType="com.huaxu.entity.ThingyearSettingEntity">
+        SELECT
+        <include refid="thingyearSettingColumns"/>
+        FROM sms_thingyear_setting a
+
+        <where>
+            a.status=1
+            <if test="thingyearSetting.tenantId != null  and thingyearSetting.tenantId != ''">and a.tenant_id = #{thingyearSetting.tenantId}</if>
+            <if test="thingyearSetting.thingType != null ">and a.thing_type = #{thingyearSetting.thingType}</if>
+            <if test="thingyearSetting.userType!=null and thingyearSetting.userType!=-999 and thingyearSetting.userType!=-9999 and  thingyearSetting.programItems != null and thingyearSetting.programItems.size() > 0">
+                <if test="thingyearSetting.permissonType == 5 or thingyearSetting.permissonType == 2">
+                    and ( a.DEPT_ORG_ID in
+                    <foreach collection="thingyearSetting.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    or
+                    a.COMPANY_ORG_ID in
+                    <foreach collection="v.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    )
+                </if>
+                <if test="thingyearSetting.permissonType == 4 or thingyearSetting.permissonType == 3">
+                    and a.DEPT_ORG_ID in
+                    <foreach collection="thingyearSetting.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                </if>
+                <if test="thingyearSetting.permissonType == 1">
+                    and a.COMPANY_ORG_ID in
+                    <foreach collection="thingyearSetting.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    and (a.DEPT_ORG_ID is null or a.DEPT_ORG_ID =0)
+                </if>
+            </if>
+        </where>
+    </select>
+
+    <!--  根据获取实体 page   -->
+    <select id="findPage" resultType="com.huaxu.entity.ThingyearSettingEntity">
+        SELECT
+        <include refid="thingyearSettingColumns"/>
+        FROM sms_thingyear_setting a
+        <where>
+            a.status=1
+            <if test="thingyearSetting.tenantId != null  and thingyearSetting.tenantId != ''">and a.tenant_id =
+                #{thingyearSetting.tenantId}
+            </if>
+            <if test="thingyearSetting.thingType != null ">and a.thing_type = #{thingyearSetting.thingType}</if>
+        </where>
+    </select>
+</mapper>