package com.newfiber.api.pc.service.impl; import com.baomidou.mybatisplus.plugins.Page; import com.newfiber.api.core.utils.UUIDPK.UUIDGenerator; import com.newfiber.api.pc.dao.SysButtonsDao; import com.newfiber.api.pc.dao.SysJurisdictionDao; import com.newfiber.api.pc.dao.Sys_MenusDao; import com.newfiber.api.pc.model.entity.SysJurisdiction; import com.newfiber.api.pc.model.entity.Sys_Menu_Button; import com.newfiber.api.pc.model.entity.SysMenus; import com.newfiber.api.pc.service.SysJurisdictionService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; @Service @Transactional(rollbackFor = Exception.class) public class SysJurisdictionServiceImpl implements SysJurisdictionService { @Autowired private SysJurisdictionDao sysJurisdictionDao; @Override public Page<SysJurisdiction> JurisdictonList(String sort, String order, int pageNo, int pageSize, String fuzzyQuery) throws Exception { Page<SysJurisdiction> result = new Page<>(); SysJurisdiction jurisdiction = new SysJurisdiction(); jurisdiction.setFuzzyQuery(fuzzyQuery); jurisdiction.setPageNo(pageNo); jurisdiction.setPageSize(pageSize); jurisdiction.setSort(sort); jurisdiction.setOrder(order); int total = sysJurisdictionDao.GetJurisdictionCount(jurisdiction); result.setTotal(total); List<SysJurisdiction> jlist = sysJurisdictionDao.selectJurisdictionList(jurisdiction); result.setRecords(jlist); return result; } @Override public String addJurisdictonList(String Jurisdiction_No, String Jurisdiction_Name, int Jurisdiction_Type, int Jurisdiction_State, String Remark, int OrderSort) throws Exception { SysJurisdiction jurisdiction=new SysJurisdiction(); jurisdiction.setJurisdictionNo(UUIDGenerator.getUUID()); jurisdiction.setJurisdictionName(Jurisdiction_Name); jurisdiction.setJurisdictionType(Jurisdiction_Type); if(Jurisdiction_Type==0){ jurisdiction.setJurisdictionTypeZn("内部权限"); }else{ jurisdiction.setJurisdictionTypeZn("外部权限"); } jurisdiction.setJurisdictionState(Jurisdiction_State); if(Jurisdiction_State==0){ jurisdiction.setJurisdictionStateZn("初始化"); }else if(Jurisdiction_State==1){ jurisdiction.setJurisdictionStateZn("停用"); }else { jurisdiction.setJurisdictionStateZn("正在使用"); } jurisdiction.setRemark(Remark); jurisdiction.setCreateTime(new Date()); jurisdiction.setOrderSort(OrderSort); sysJurisdictionDao.addJurisdiction(jurisdiction); return "0"; } @Override public int updateJurisdictonList(Long Serial, String Jurisdiction_No, String Jurisdiction_Name, int Jurisdiction_Type, int Jurisdiction_State, String Remark, int OrderSort) throws Exception { SysJurisdiction jurisdiction=new SysJurisdiction(); jurisdiction.setSerial(Serial); jurisdiction.setJurisdictionNo(Jurisdiction_No); jurisdiction.setJurisdictionName(Jurisdiction_Name); jurisdiction.setJurisdictionType(Jurisdiction_Type); if(Jurisdiction_Type==0){ jurisdiction.setJurisdictionTypeZn("内部权限"); }else{ jurisdiction.setJurisdictionTypeZn("外部权限"); } jurisdiction.setJurisdictionState(Jurisdiction_State); if(Jurisdiction_State==0){ jurisdiction.setJurisdictionStateZn("初始化"); }else if(Jurisdiction_State==1){ jurisdiction.setJurisdictionStateZn("停用"); }else { jurisdiction.setJurisdictionStateZn("正在使用"); } jurisdiction.setRemark(Remark); jurisdiction.setUpdateTime(new Date()); jurisdiction.setOrderSort(OrderSort); sysJurisdictionDao.updateJurisdiction(jurisdiction); return 0; } @Override public void deleteJurisdictonList(String Serial) throws Exception { if(Serial!=null&&Serial!=""){ String[] serial=Serial.split(","); List<String> strings = Arrays.asList(serial); sysJurisdictionDao.deleteJurisdiction(strings); } } }