提交 19700df3 编写于 作者: L laijiaping

修改不同系统编辑器模板类型的同名校验规则

上级 460b4512
......@@ -32,8 +32,7 @@ public class SysEveModelController {
public void querySysEveModelList(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveModelService.querySysEveModelList(inputObject, outputObject);
}
/**
*
* @Title: insertSysEveModelMation
......
......@@ -23,8 +23,6 @@ public interface SysEveModelDao {
public Map<String, Object> querySysEveModelMationByNameAndType(Map<String, Object> map) throws Exception;
public Map<String, Object> querySysEveModelMationByNameAndUser(Map<String, Object> map) throws Exception;
public int insertSysEveModelMation(Map<String, Object> map) throws Exception;
public int deleteSysEveModelById(Map<String, Object> map) throws Exception;
......
......@@ -36,12 +36,12 @@ public class SysEveModelServiceImpl implements SysEveModelService {
@Autowired
private SysEveModelDao sysEveModelDao;
@Autowired
public JedisClientService jedisClient;
/**
*
*
* @Title: querySysEveModelList
* @Description: 获取系统编辑器模板表
* @param inputObject
......@@ -53,14 +53,15 @@ public class SysEveModelServiceImpl implements SysEveModelService {
@Override
public void querySysEveModelList(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
map.put("userId", inputObject.getLogParams().get("id"));
Page pages = PageHelper.startPage(Integer.parseInt(map.get("page").toString()), Integer.parseInt(map.get("limit").toString()));
List<Map<String, Object>> beans = sysEveModelDao.querySysEveModelList(map);
outputObject.setBeans(beans);
outputObject.settotal(pages.getTotal());
}
/**
*
*
* @Title: insertSysEveModelMation
* @Description: 新增系统编辑器模板
* @param inputObject
......@@ -74,30 +75,17 @@ public class SysEveModelServiceImpl implements SysEveModelService {
public void insertSysEveModelMation(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
map.put("userId", inputObject.getLogParams().get("id"));
Map<String, Object> bean = judgeSimpleTitle(map);
if(bean != null && !bean.isEmpty()){
Map<String, Object> bean = sysEveModelDao.querySysEveModelMationByNameAndType(map);
if (bean != null && !bean.isEmpty()) {
outputObject.setreturnMessage("该系统编辑器模板已存在,请更换");
}else{
Map<String, Object> user = inputObject.getLogParams();
} else {
map.put("id", ToolUtil.getSurFaceId());
map.put("pageNum", ToolUtil.getUniqueKey().substring(10, 20));
map.put("createTime", DateUtil.getTimeAndToString());
sysEveModelDao.insertSysEveModelMation(map);
}
}
private Map<String, Object> judgeSimpleTitle(Map<String, Object> map) throws Exception {
Map<String, Object> bean = new HashMap<>();
String type = map.get("type").toString();
if ("1".equals(type)) {
bean = sysEveModelDao.querySysEveModelMationByNameAndType(map);
} else if ("2".equals(type)) {
bean = sysEveModelDao.querySysEveModelMationByNameAndUser(map);
}
return bean;
}
/**
/**
*
* @Title: deleteSysEveModelById
* @Description: 删除编辑器模板
......@@ -115,7 +103,7 @@ public class SysEveModelServiceImpl implements SysEveModelService {
}
/**
*
*
* @Title: selectSysEveModelById
* @Description: 通过id查找对应的编辑器模板
* @param inputObject
......@@ -133,7 +121,7 @@ public class SysEveModelServiceImpl implements SysEveModelService {
}
/**
*
*
* @Title: editSysEveModelMationById
* @Description: 通过id编辑对应的编辑器模板
* @param inputObject
......@@ -147,10 +135,10 @@ public class SysEveModelServiceImpl implements SysEveModelService {
public void editSysEveModelMationById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
map.put("userId", inputObject.getLogParams().get("id"));
Map<String, Object> bean = judgeSimpleTitle(map);
if(bean != null && !bean.isEmpty()){
Map<String, Object> bean = sysEveModelDao.querySysEveModelMationByNameAndType(map);
if (bean != null && !bean.isEmpty()) {
outputObject.setreturnMessage("该编辑器模板已存在,请更换");
}else{
} else {
map.put("lastUpdateTime", DateUtil.getTimeAndToString());
sysEveModelDao.editSysEveModelMationById(map);
}
......
......@@ -27,6 +27,9 @@
<if test="secondTypeId != '' and secondTypeId != null">
AND a.second_type_id = #{secondTypeId}
</if>
<if test="type == '2'.toString()">
AND a.create_id = #{userId}
</if>
ORDER BY a.create_time DESC
</select>
......@@ -41,21 +44,11 @@
<if test="id != '' and id != null">
AND a.id != #{id}
</if>
</select>
<select id="querySysEveModelMationByNameAndUser" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id
FROM
sys_eve_model a
WHERE
a.title = #{title}
<if test="type == '2'.toString()">
AND a.create_id = #{userId}
<if test="id != '' and id != null">
AND a.id != #{id}
</if>
</select>
<insert id="insertSysEveModelMation" parameterType="java.util.Map">
INSERT INTO sys_eve_model
(id, title, content, type, create_id, create_time, first_type_id, second_type_id, last_update_id, last_update_time)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册