feiyu02
2022-11-15 23bd719cebe5feeff4e48fde925b0b39755eea93
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/LawServiceImpl.kt
@@ -3,8 +3,10 @@
import cn.flightfeather.supervision.domain.entity.Law
import cn.flightfeather.supervision.domain.entity.LawsRegulations
import cn.flightfeather.supervision.domain.enumeration.SceneType
import cn.flightfeather.supervision.domain.mapper.BaseInfoMapper
import cn.flightfeather.supervision.domain.mapper.LawMapper
import cn.flightfeather.supervision.domain.mapper.LawsRegulationsMapper
import cn.flightfeather.supervision.domain.mapper.UserinfoMapper
import cn.flightfeather.supervision.lightshare.service.LawService
import cn.flightfeather.supervision.lightshare.vo.LawVo
import cn.flightfeather.supervision.lightshare.vo.LawsRegulationsCondition
@@ -14,7 +16,12 @@
import javax.servlet.http.HttpServletResponse
@Service
class LawServiceImpl(val lawMapper: LawMapper, val lawsRegulationsMapper: LawsRegulationsMapper) : LawService {
class LawServiceImpl(
    val lawMapper: LawMapper,
    val lawsRegulationsMapper: LawsRegulationsMapper,
    val userinfoMapper: UserinfoMapper,
    val baseInfoMapper: BaseInfoMapper
) : LawService {
    override fun getLaws(page: Int, per_page: Int, response: HttpServletResponse): ArrayList<LawVo> {
        val counts = lawMapper.selectCountByExample(Example(Law::class.java))
@@ -50,8 +57,10 @@
        return law.laText
    }
    override fun getLawsRegulations(
            condition: LawsRegulationsCondition, page: Int, per_page: Int, response: HttpServletResponse): List<LawsRegulations> {
    override fun getLawsRegulations(userId: String,
                                    condition: LawsRegulationsCondition, page: Int, per_page: Int, response: HttpServletResponse): List<LawsRegulations> {
//        val userInfo = userinfoMapper.selectByPrimaryKey(userId)
        val baseInfo = baseInfoMapper.selectByPrimaryKey(userId)
        val example = Example(LawsRegulations::class.java).apply {
            createCriteria().apply {
                condition.apply {
@@ -71,6 +80,9 @@
                        andEqualTo("lrResourcefiletype", it)
                    }
                }
//                baseInfo?.biDistrictCode?.let {
//                    andEqualTo("biDistrictCode", it)
//                }
            }
            condition.sceneTypeId?.let {
                if (it != SceneType.NoType.value) {
@@ -99,4 +111,11 @@
                condition.isForeign, condition.category, condition.keywords,
                condition.isOpen, condition.isUsing, condition.count, condition.sceneTypeId)
    }
    override fun getSeries(userId: String, seriesId: String): List<LawsRegulations> {
        return lawsRegulationsMapper.selectByExample(Example(LawsRegulations::class.java).apply {
            createCriteria().andEqualTo("lrExtension2", seriesId)
            orderBy("lrExtension3")
        })
    }
}