|
|
@ -15,7 +15,7 @@ |
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/ |
|
|
|
|
|
|
|
package com.elink.esua.epdc.news.controller; |
|
|
|
package com.elink.esua.epdc.controller; |
|
|
|
|
|
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
|
|
@ -65,6 +65,12 @@ public class NewsCategoryController { |
|
|
|
public Result save(@RequestBody NewsCategoryDTO dto){ |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|
|
|
if(newsCategoryService.checkCodeCategory(dto.getCategoryCode(),dto.getId())>0){ |
|
|
|
return new Result().error("类别编码已存在"); |
|
|
|
} |
|
|
|
if(newsCategoryService.checkNameCategory(dto.getCategoryName(),dto.getId())>0){ |
|
|
|
return new Result().error("类别名称已存在"); |
|
|
|
} |
|
|
|
newsCategoryService.save(dto); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
@ -73,6 +79,12 @@ public class NewsCategoryController { |
|
|
|
public Result update(@RequestBody NewsCategoryDTO dto){ |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|
|
|
if(newsCategoryService.checkCodeCategory(dto.getCategoryCode(),dto.getId())>0){ |
|
|
|
return new Result().error("类别编码已存在"); |
|
|
|
} |
|
|
|
if(newsCategoryService.checkNameCategory(dto.getCategoryName(),dto.getId())>0){ |
|
|
|
return new Result().error("类别名称已存在"); |
|
|
|
} |
|
|
|
newsCategoryService.update(dto); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|