package com.whyc.service;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.whyc.dto.Response;
|
import com.whyc.mapper.NjHomeConfigMapper;
|
import com.whyc.pojo.NjHomeConfig;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
|
@Service
|
public class NjHomeConfigService {
|
@Resource
|
private NjHomeConfigMapper mapper;
|
|
//获取首页配置信息
|
public Response getAllConfig() {
|
QueryWrapper wrapper=new QueryWrapper();
|
wrapper.lt("config_type",10);
|
wrapper.orderByAsc("num");
|
List list=mapper.selectList(wrapper);
|
return new Response().setII(1,list!=null,list,"获取首页配置信息");
|
}
|
//编辑首页配置信息
|
@Transactional
|
public Response alterConfig(List<NjHomeConfig> list) {
|
if (list != null && list.size() > 0) {
|
for (NjHomeConfig hc : list) {
|
UpdateWrapper wrapper = new UpdateWrapper();
|
//wrapper.set("config_name", hc.getConfigName());
|
//wrapper.set("config_value", hc.getConfigValue());
|
// wrapper.set("config_type", hc.getConfigType());
|
wrapper.set("config_flag", hc.getConfigFlag());
|
//wrapper.set("config_class", hc.getConfigClass());
|
wrapper.eq("num", hc.getNum());
|
mapper.update(null, wrapper);
|
}
|
}
|
return new Response().set(1,true);
|
}
|
}
|