package com.woniu.community.entity;import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;@Data
@AllArgsConstructor
@NoArgsConstructor
public class PropertyInfo {private int id;private int typeId;private Double money;private String startDate;private String endDate;private Integer status;private int houseId;private String remarks;private String numbers;private String userName;private String typeName;}
package com.woniu.community.mapper;import com.woniu.community.entity.PropertyInfo;import java.util.List;public interface PropertyInfoMapper {List selectAll(int start,int size ,String numbers,Integer status);int count(String numbers,Integer status);int insertPropertyInfo(PropertyInfo propertyInfo);int deletePropertyInfo(int id);int updatePropertyInfo(PropertyInfo propertyInfo);PropertyInfo getById(int id);
}
package com.woniu.community.service;import com.woniu.community.entity.HttpResult;
import com.woniu.community.entity.PropertyInfo;import java.util.List;public interface IPropertyInfoService {HttpResult selectAll(int pageIndex, int pageSize , String numbers, Integer status);HttpResult insertPropertyInfo(PropertyInfo propertyInfo);HttpResult deletePropertyInfo(int id);HttpResult updatePropertyInfo(PropertyInfo propertyInfo);HttpResult getById(int id);}
package com.woniu.community.service.impl;import com.woniu.community.entity.HttpResult;
import com.woniu.community.entity.PropertyInfo;
import com.woniu.community.mapper.PropertyInfoMapper;
import com.woniu.community.service.IPropertyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.List;@Service
public class PropertyInfoServiceImpl implements IPropertyInfoService {@Autowired(required=false)private PropertyInfoMapper propertyInfoMapper;@Overridepublic HttpResult selectAll(int pageIndex, int pageSize, String numbers, Integer status) {HttpResult result=null;List propertyInfos = propertyInfoMapper.selectAll((pageIndex - 1) * pageSize, pageSize, numbers, status);int count = propertyInfoMapper.count(numbers, status);if (propertyInfos!=null&&propertyInfos.size()>0){result=new HttpResult(propertyInfos,count,200,null);}else{result=new HttpResult(null,0,500,null);}return result;}@Overridepublic HttpResult insertPropertyInfo(PropertyInfo propertyInfo) {HttpResult result=null;int count = propertyInfoMapper.insertPropertyInfo(propertyInfo);if (count>0){result=new HttpResult(null,0,200,"新增成功");}else{result=new HttpResult(null,0,500,"新增失败");}return result;}@Overridepublic HttpResult deletePropertyInfo(int id) {HttpResult result=null;int count = propertyInfoMapper.deletePropertyInfo(id);if (count>0){result=new HttpResult(null,0,200,"删除成功");}else{result=new HttpResult(null,0,500,"删除失败");}return result;}@Overridepublic HttpResult updatePropertyInfo(PropertyInfo propertyInfo) {HttpResult result=null;int count = propertyInfoMapper.updatePropertyInfo(propertyInfo);if (count>0){result=new HttpResult(null,0,200,"修改成功");}else{result=new HttpResult(null,0,500,"修改失败");}return result;}@Overridepublic HttpResult getById(int id) {HttpResult result=null;PropertyInfo info = propertyInfoMapper.getById(id);if (info!=null){result=new HttpResult(info,0,200,null);}else{result=new HttpResult(null,0,500,"没有更多数据");}return result;}
}
package com.woniu.community.controller;import com.woniu.community.entity.HttpResult;
import com.woniu.community.entity.PropertyInfo;
import com.woniu.community.service.IPropertyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
@RequestMapping ("/property")
@CrossOrigin(origins = "*")
public class PropertyInfoController {@Autowiredprivate IPropertyInfoService iPropertyInfoService;@RequestMapping("/list")HttpResult selectAll(int pageIndex, int pageSize , String numbers, Integer status){return iPropertyInfoService.selectAll(pageIndex,pageSize,numbers,status);}@RequestMapping("/add")HttpResult insertPropertyInfo(PropertyInfo propertyInfo){return iPropertyInfoService.insertPropertyInfo(propertyInfo);}@RequestMapping("/delete")HttpResult deletePropertyInfo(int id){return iPropertyInfoService.deletePropertyInfo(id);}@RequestMapping("/update")HttpResult updatePropertyInfo(PropertyInfo propertyInfo){return iPropertyInfoService.updatePropertyInfo(propertyInfo);}@RequestMapping("/info")HttpResult getById(int id){return iPropertyInfoService.getById(id);}
}
insert into property_info(house_id,type_id,start_date,end_date,money,status)values (#{houseId},#{typeId},#{startDate},#{endDate},#{money},#{status}) delete from property_info where id=#{id} update property_info set money=#{money},status=#{status} where id=#{id}
Title
Title
{{title}}房间号:
费用类型:
金额
状态: