| | |
| | | val userinfoMapper: UserinfoMapper |
| | | ) : NightConstructionService { |
| | | |
| | | override fun getRecord(cityCode: String?, districtCode: String, page: Int, perPage: Int): BaseResponse<List<NightConstruction?>> { |
| | | override fun getRecord(cityCode: String?, districtCode: String, page: Int, perPage: Int): Pair<DataHead, List<NightConstruction?>> { |
| | | val p = PageHelper.startPage<NightConstruction>(page, perPage) |
| | | val result = nightConstructionMapper.selectByExample(Example(NightConstruction::class.java).apply { |
| | | createCriteria().andEqualTo("ncCityCode", cityCode ?: "3100") |
| | | .andEqualTo("ncDistrictCode", districtCode) |
| | | orderBy("ncRead").orderBy("ncId").desc() |
| | | }) |
| | | return BaseResponse(true, head = DataHead(p.pageNum, p.pages, p.total), data = result) |
| | | return DataHead(p.pageNum, p.pages, p.total) to result |
| | | } |
| | | |
| | | override fun getNightWorkFile(userId: String, isRead: Boolean?, page: Int, perPage: Int): BaseResponse<List<NightConstruction?>> { |
| | | override fun getNightWorkFile(userId: String, isRead: Boolean?, page: Int, perPage: Int): Pair<DataHead, List<NightConstruction?>> { |
| | | val userInfo = userinfoMapper.selectByPrimaryKey(userId) |
| | | val p = PageHelper.startPage<NightConstruction>(page, perPage) |
| | | val result = nightConstructionMapper.selectByExample(Example(NightConstruction::class.java).apply { |
| | |
| | | orderBy("ncCreateTime").desc() |
| | | }) |
| | | |
| | | return BaseResponse(true, head = DataHead(p.pageNum, p.pages), data = result) |
| | | return DataHead(p.pageNum, p.pages, p.total) to result |
| | | } |
| | | |
| | | override fun signFile(userId: String, fileNum: String, id: Int): BaseResponse<Int> { |
| | | override fun signFile(userId: String, fileNum: String, id: Int): Int { |
| | | val record = nightConstructionMapper.selectByExample(Example(NightConstruction::class.java).apply { |
| | | createCriteria().andEqualTo("ncId", id) |
| | | .andEqualTo("ncNum", fileNum) |
| | |
| | | return if (record.isNotEmpty()) { |
| | | record[0]?.ncRead = true |
| | | val result = nightConstructionMapper.updateByPrimaryKey(record[0]) |
| | | BaseResponse(true, data = result) |
| | | result |
| | | } else { |
| | | BaseResponse(false, "夜间许可证记录不存在") |
| | | throw BizException("夜间许可证记录不存在") |
| | | } |
| | | } |
| | | |
| | |
| | | return record |
| | | } |
| | | |
| | | override fun getSummary(cityCode: String?, districtCode: String): BaseResponse<NightWorkSummary> { |
| | | override fun getSummary(cityCode: String?, districtCode: String): NightWorkSummary { |
| | | val total = nightConstructionMapper.selectCountByExample(Example(NightConstruction::class.java).apply { |
| | | createCriteria().andEqualTo("ncCityCode", cityCode ?: "3100") |
| | | .andEqualTo("ncDistrictCode", districtCode) |
| | |
| | | .andEqualTo("ncDistrictCode", districtCode) |
| | | .andEqualTo("ncRead", true) |
| | | }) |
| | | return BaseResponse(true, data = NightWorkSummary(total, signed)) |
| | | return NightWorkSummary(total, signed) |
| | | } |
| | | } |