dev #1

Merged
wangpeng merged 2 commits from integrated_whb/integrated_whb_admin:dev into dev 2024-02-22 11:21:21 +08:00
6 changed files with 523 additions and 4 deletions

View File

@ -0,0 +1,160 @@
package com.zcloud.controller.termLibrary;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.termLibrary.HiddenTermLibraryService;
import com.zcloud.util.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* zhangyanli
* 2024-02-20
* www.zcloudchina.com
*/
@Controller
@RequestMapping("/hiddenTermLibrary")
public class HiddenTermLibraryController extends BaseController {
@Autowired
private HiddenTermLibraryService hiddenTermLibraryService;
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/add")
@RequiresPermissions("hiddenTermLibrary:add")
@ResponseBody
public Object add() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("TERM_LIBRARY_ID", this.get32UUID());
pd.put("CREATE_TIME", DateUtil.getTime());
pd.put("IS_DELETE", '0');
hiddenTermLibraryService.save(pd);
map.put("result", errInfo);
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/delete")
@RequiresPermissions("hiddenTermLibrary:del")
@ResponseBody
public Object delete() throws Exception {
Map<String, String> map = new HashMap<String, String>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
hiddenTermLibraryService.delete(pd);
map.put("result", errInfo); //返回结果
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/edit")
@RequiresPermissions("hiddenTermLibrary:edit")
@ResponseBody
public Object edit() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
hiddenTermLibraryService.edit(pd);
map.put("result", errInfo);
return map;
}
/**
*
*
* @param page
* @throws Exception
*/
@RequestMapping(value = "/list")
@RequiresPermissions("hiddenTermLibrary:list")
@ResponseBody
public Object list(Page page) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
page.setPd(pd);
List<PageData> varList = hiddenTermLibraryService.list(page);
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/goEdit")
@RequiresPermissions("hiddenTermLibrary:edit")
@ResponseBody
public Object goEdit() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd = hiddenTermLibraryService.findById(pd); //根据ID读取
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/deleteAll")
@RequiresPermissions("hiddenTermLibrary:del")
@ResponseBody
public Object deleteAll() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
String DATA_IDS = pd.getString("DATA_IDS");
if (Tools.notEmpty(DATA_IDS)) {
String ArrayDATA_IDS[] = DATA_IDS.split(",");
PageData del = new PageData();
del.put("ArrayDATA_IDS", ArrayDATA_IDS);
hiddenTermLibraryService.deleteAll(del);
errInfo = "success";
} else {
errInfo = "error";
}
map.put("result", errInfo); //返回结果
return map;
}
}

View File

@ -0,0 +1,58 @@
package com.zcloud.mapper.dsno2.termLibrary;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* zhangyanli
* 2024-02-20
* www.zcloudchina.com
*/
public interface HiddenTermLibraryMapper {
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
/**
* @param page
* @throws Exception
*/
List<PageData> datalistPage(Page page);
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd);
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd);
/**
* @param pd
* @throws Exception
*/
void deleteAll(PageData pd);
}

View File

@ -0,0 +1,59 @@
package com.zcloud.service.termLibrary;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* zhangyanli
* 2024-02-20
* www.zcloudchina.com
*/
public interface HiddenTermLibraryService {
/**
* @param pd
* @throws Exception
*/
void save(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd)throws Exception;
/**
* @param page
* @throws Exception
*/
List<PageData> list(Page page)throws Exception;
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd)throws Exception;
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
void deleteAll(PageData pd)throws Exception;
}

View File

@ -0,0 +1,103 @@
package com.zcloud.service.termLibrary.impl;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.dsno2.termLibrary.HiddenTermLibraryMapper;
import com.zcloud.service.termLibrary.HiddenTermLibraryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
*
* zhangyanli
* 2024-02-20
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class HiddenTermLibraryServiceImpl implements HiddenTermLibraryService {
@Resource
private HiddenTermLibraryMapper hiddenTermLibraryMapper;
/**
*
*
* @param pd
* @throws Exception
*/
@Override
public void save(PageData pd) throws Exception {
hiddenTermLibraryMapper.save(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
@Override
public void delete(PageData pd) throws Exception {
hiddenTermLibraryMapper.delete(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
@Override
public void edit(PageData pd) throws Exception {
hiddenTermLibraryMapper.edit(pd);
}
/**
*
*
* @param page
* @throws Exception
*/
@Override
public List<PageData> list(Page page) throws Exception {
return hiddenTermLibraryMapper.datalistPage(page);
}
/**
* ()
*
* @param pd
* @throws Exception
*/
@Override
public List<PageData> listAll(PageData pd) throws Exception {
return hiddenTermLibraryMapper.listAll(pd);
}
/**
* id
*
* @param pd
* @throws Exception
*/
@Override
public PageData findById(PageData pd) throws Exception {
return hiddenTermLibraryMapper.findById(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
@Override
public void deleteAll(PageData pd) throws Exception {
hiddenTermLibraryMapper.deleteAll(pd);
}
}

View File

@ -207,10 +207,10 @@
<include refid="Field"></include>
from
<include refid="tableName"></include> f
left join bus_hiddendangercheckstandard_common_item cca on cca.CHECK_CATEGORY = f.DICTIONARY_ID
left join bus_hiddendangercheckstandard_common_item cci on cci.CHECK_ITEM = f.DICTIONARY_ID
left join bus_hiddendangercheckstandard_custom_item cua on cua.CHECK_CATEGORY = f.DICTIONARY_ID
left join bus_hiddendangercheckstandard_custom_item cui on cui.CHECK_ITEM = f.DICTIONARY_ID
left join bus_hiddendangercheckstandard_common_item cca on cca.CHECK_CATEGORY = f.DICTIONARY_ID and cca.ISDELETE = '0'
left join bus_hiddendangercheckstandard_common_item cci on cci.CHECK_ITEM = f.DICTIONARY_ID and cci.ISDELETE = '0'
left join bus_hiddendangercheckstandard_custom_item cua on cua.CHECK_CATEGORY = f.DICTIONARY_ID and cua.ISDELETE = '0'
left join bus_hiddendangercheckstandard_custom_item cui on cui.CHECK_ITEM = f.DICTIONARY_ID and cui.ISDELETE = '0'
where f.ISDELETE = '0'
group by f.DICTIONARY_ID
order by f.DICTIONARY_LEVEL asc, f.DICTIONARY_SORT asc

View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.dsno2.termLibrary.HiddenTermLibraryMapper">
<!--表名 -->
<sql id="tableName">
BUS_HIDDENDANGERCHECKSTANDARD_TERM_LIBRARY
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.TERM_LIBRARY_ID,
f.TASK_NUM,
f.TERM_DESCRIBE,
f.WORK_TYPE,
f.IS_DELETE,
f.CREATE_TIME,
f.SORT
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
TERM_LIBRARY_ID,
TASK_NUM,
TERM_DESCRIBE,
WORK_TYPE,
IS_DELETE,
CREATE_TIME,
SORT
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{TERM_LIBRARY_ID},
#{TASK_NUM},
#{TERM_DESCRIBE},
#{WORK_TYPE},
#{IS_DELETE},
#{CREATE_TIME},
#{SORT}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 删除-->
<delete id="delete" parameterType="pd">
update
<include refid="tableName"></include>
set
IS_DELETE = '1'
where
TERM_LIBRARY_ID = #{TERM_LIBRARY_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
<if test="TASK_NUM != null and TASK_NUM != ''">
TASK_NUM = #{TASK_NUM},
</if>
<if test="TERM_DESCRIBE != null and TERM_DESCRIBE != ''">
TERM_DESCRIBE = #{TERM_DESCRIBE},
</if>
<if test="WORK_TYPE != null and WORK_TYPE != ''">
WORK_TYPE = #{WORK_TYPE},
</if>
<if test="SORT != null and SORT != ''">
SORT = #{SORT},
</if>
TERM_LIBRARY_ID = TERM_LIBRARY_ID
where
TERM_LIBRARY_ID = #{TERM_LIBRARY_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.TERM_LIBRARY_ID = #{TERM_LIBRARY_ID}
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.IS_DELETE = '0'
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''">
and f.TERM_DESCRIBE LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
</if>
<if test="pd.WORK_TYPE != null and pd.WORK_TYPE != ''">
and f.WORK_TYPE = #{pd.WORK_TYPE}
</if>
order by f.WORK_TYPE,f.SORT
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.IS_DELETE = '0'
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="pd">
update
<include refid="tableName"></include>
set
IS_DELETE = '1',
where
TERM_LIBRARY_ID in
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>