|
|
|
@ -2,17 +2,16 @@ package cn.chjyj.szwh.service.impl; |
|
|
|
|
|
|
|
import cn.chjyj.szwh.bean.Admin; |
|
|
|
import cn.chjyj.szwh.bean.Classify; |
|
|
|
import cn.chjyj.szwh.bean.OperationLog; |
|
|
|
import cn.chjyj.szwh.mapper.AdminMapper; |
|
|
|
import cn.chjyj.szwh.mapper.ClassifyMapper; |
|
|
|
import cn.chjyj.szwh.mapper.OperationLogMapper; |
|
|
|
import cn.chjyj.szwh.service.ClassifyService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class ClassifyServiceImpl implements ClassifyService { |
|
|
|
@ -20,6 +19,9 @@ public class ClassifyServiceImpl implements ClassifyService { |
|
|
|
private ClassifyMapper classifyMapper; |
|
|
|
@Autowired |
|
|
|
private AdminMapper adminMapper; |
|
|
|
// 操作日志
|
|
|
|
@Autowired |
|
|
|
private OperationLogMapper operationLogMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map getClassifyList(Map<String, Object> qmap, int limit,int page) { |
|
|
|
@ -72,4 +74,31 @@ public class ClassifyServiceImpl implements ClassifyService { |
|
|
|
|
|
|
|
return classifyMapper.getTop(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public int updateStatus(Integer id,String accountName) { |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
Classify classify = classifyMapper.getClassifyById(id); |
|
|
|
int status=0; |
|
|
|
String message="";//日志内容
|
|
|
|
if (classify.getStatus()==0){ |
|
|
|
status=1; |
|
|
|
message=sdf.format(new Date())+"由"+accountName+"停用"; |
|
|
|
}else{ |
|
|
|
message=sdf.format(new Date())+"由"+accountName+"启用"; |
|
|
|
} |
|
|
|
// 执行更新操作
|
|
|
|
int a1 =classifyMapper.updateStatus(classify.getId(),status); |
|
|
|
//
|
|
|
|
OperationLog oplog = new OperationLog(); |
|
|
|
oplog.setLogid(id); |
|
|
|
oplog.setType("class"); |
|
|
|
oplog.setMessage(message); |
|
|
|
//
|
|
|
|
int a2=operationLogMapper.addLog(oplog); |
|
|
|
//
|
|
|
|
int ret=a1&a1; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|