| | |
| | | import com.java110.dto.contract.ContractCollectionDetailDto; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.mybatis.spring.SqlSessionTemplate; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | return ResponseEntity.ok(resJson.toJSONString()); |
| | | } |
| | | |
| | | @RequestMapping(value = "/deleteContractCollectionDetail", method = RequestMethod.POST) |
| | | public ResponseEntity<String> deleteContractCollectionDetail(@RequestBody JSONObject reqJson) { |
| | | // 主键/合同ID校验(二选一) |
| | | Assert.hasKey(reqJson, "id", "请求报文中未包含主键ID"); |
| | | // Assert.hasKey(reqJson, "contractId", "请求报文中未包含合同ID"); |
| | | |
| | | ContractCollectionDetailDto dto = BeanConvertUtil.covertBean(reqJson, ContractCollectionDetailDto.class); |
| | | |
| | | // 调用Mapper修改方法 |
| | | int update = sqlSessionTemplate.delete("contractCollectionDetailDaoImpl.deleteContractCollectionDetail", |
| | | BeanConvertUtil.beanCovertMap(dto)); |
| | | |
| | | JSONObject resJson = new JSONObject(); |
| | | if (update > 0) { |
| | | resJson.put("code", "0000"); |
| | | resJson.put("msg", "删除合同收款明细信息成功"); |
| | | } else { |
| | | resJson.put("code", "0001"); |
| | | resJson.put("msg", "删除合同收款明细信息失败,未找到对应记录"); |
| | | } |
| | | resJson.put("count", update); |
| | | return ResponseEntity.ok(resJson.toJSONString()); |
| | | } |
| | | /** |
| | | * 分页查询合同收款明细信息列表 |
| | | * |
| | |
| | | } |
| | | |
| | | // 查询列表数据(MyBatis自动识别String[]并遍历) |
| | | List<Map<String, Object>> list = sqlSessionTemplate.selectList( |
| | | List<ContractCollectionDetailDto> list = BeanConvertUtil.covertBeanList(sqlSessionTemplate.selectList( |
| | | "contractCollectionDetailDaoImpl.getContractCollectionDetail", |
| | | BeanConvertUtil.beanCovertMap(queryDto)); |
| | | BeanConvertUtil.beanCovertMap(queryDto)), ContractCollectionDetailDto.class); |
| | | |
| | | // 查询总数 |
| | | Object total = ((HashMap) sqlSessionTemplate.selectOne( |
| | | "contractCollectionDetailDaoImpl.queryContractCollectionDetailCount", |
| | | BeanConvertUtil.beanCovertMap(queryDto))).get("count"); |
| | | |
| | | // 构造分页响应 |
| | | JSONObject resJson = new JSONObject(); |
| | | resJson.put("code", "0000"); |
| | | resJson.put("msg", "查询合同收款明细信息成功"); |
| | | resJson.put("page", page); |
| | | resJson.put("row", row); |
| | | resJson.put("total", total); |
| | | resJson.put("data", list); |
| | | |
| | | return ResponseEntity.ok(resJson.toJSONString()); |
| | | |
| | | // 构造分页响应 |
| | | ResultVo resultVo = new ResultVo(); |
| | | resultVo.setCode(0000); |
| | | resultVo.setMsg("查询合同收款明细信息成功"); |
| | | resultVo.setPage(page); |
| | | resultVo.setRows(row); |
| | | resultVo.setTotal(Integer.parseInt(total.toString())); |
| | | resultVo.setData(list); |
| | | |
| | | // ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) payFeeAuditDto.getRow()), count, payFeeAuditDtos); |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |
| | | return responseEntity; |
| | | } |
| | | |
| | | /** |