门口门禁进出记录

pull/10/head
zhaoyu 2024-01-18 16:26:59 +08:00
parent 5e9aaf7bdd
commit 7a721799b7
5 changed files with 453 additions and 1 deletions

View File

@ -0,0 +1,122 @@
package com.zcloud.controller.mkmj;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.map.util.ReturnMap;
import com.zcloud.service.mkmj.MkmjAreaGateService;
import com.zcloud.service.mkmj.MkmjGateLogService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.Tools;
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.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* zhaoyu
* 2024-01-16
* www.zcloudchina.com
*/
@Controller
@RequestMapping("/mkmjAreaGate")
public class MkmjGateLogController extends BaseController {
@Autowired
private MkmjGateLogService mkmjGateLogService;
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/add")
@RequiresPermissions("mkmjAreaGate:add")
@ResponseBody
public ReturnMap add() throws Exception{
PageData pd = new PageData();
pd = this.getPageData();
pd.put("CREATOR", Jurisdiction.getUSER_ID()); // 添加人
pd.put("CREATTIME", DateUtil.date2Str(new Date())); // 添加时间
pd.put("ISDELETE", "0"); //是否删除
pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date()));//修改时间
return mkmjGateLogService.save(pd);
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/delete")
@RequiresPermissions("mkmjAreaGate:del")
@ResponseBody
public ReturnMap delete() throws Exception{
PageData pd = new PageData();
pd = this.getPageData();
return mkmjGateLogService.delete(pd);
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/edit")
@RequiresPermissions("mkmjAreaGate:edit")
@ResponseBody
public ReturnMap edit() throws Exception{
PageData pd = new PageData();
pd = this.getPageData();
pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date()));//修改时间
return mkmjGateLogService.edit(pd);
}
/**
* @param page
* @throws Exception
*/
@RequestMapping(value="/list")
@RequiresPermissions("mkmjAreaGate: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();
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim());
page.setPd(pd);
List<PageData> varList = mkmjGateLogService.list(page); //列出Coursectk列表
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/goEdit")
@RequiresPermissions("mkmjAreaGate: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 = mkmjGateLogService.findById(pd); //根据ID读取
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
}

View File

@ -0,0 +1,60 @@
package com.zcloud.service.mkmj;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.map.util.ReturnMap;
import java.util.List;
/**
*
* zhaoyu
* 2024-01-16
* www.zcloudchina.com
*/
public interface MkmjGateLogService {
/**
* @param pd
* @throws Exception
*/
public ReturnMap save(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
public ReturnMap delete(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
public ReturnMap edit(PageData pd)throws Exception;
/**
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception;
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception;
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception;
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
public ReturnMap deleteAll(String[] ArrayDATA_IDS)throws Exception;
}

View File

@ -0,0 +1,92 @@
package com.zcloud.service.mkmj.impl;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.mkmj.MkmjAreaGateMapper;
import com.zcloud.mapper.datasource.mkmj.MkmjGateLogMapper;
import com.zcloud.service.map.util.ReturnMap;
import com.zcloud.service.mkmj.MkmjAreaGateService;
import com.zcloud.service.mkmj.MkmjGateLogService;
import com.zcloud.util.UuidUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import java.util.List;
/**
*
* zhaoyu
* 2024-01-16
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class MkmjGateLogServiceImpl implements MkmjGateLogService {
@Autowired
private MkmjGateLogMapper mkmjGateLogMapper;
/**
* @param pd
* @throws Exception
*/
public ReturnMap save(PageData pd)throws Exception{
mkmjGateLogMapper.save(pd);
return ReturnMap.ok("保存成功");
}
/**
* @param pd
* @throws Exception
*/
public ReturnMap delete(PageData pd)throws Exception{
mkmjGateLogMapper.delete(pd);
return ReturnMap.ok("删除成功");
}
/**
* @param pd
* @throws Exception
*/
public ReturnMap edit(PageData pd)throws Exception{
mkmjGateLogMapper.edit(pd);
return ReturnMap.ok("编辑成功");
}
/**
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception{
return mkmjGateLogMapper.datalistPage(page);
}
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception{
return mkmjGateLogMapper.listAll(pd);
}
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception{
return mkmjGateLogMapper.findById(pd);
}
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
public ReturnMap deleteAll(String[] ArrayDATA_IDS)throws Exception{
mkmjGateLogMapper.deleteAll(ArrayDATA_IDS);
return ReturnMap.ok("删除成功");
}
}

View File

@ -101,7 +101,7 @@
update
<include refid="tableName"></include>
set
AREA_GATE_ID= AREA_GATE_ID
AREA_GATE_ID= AREA_GATE_ID,
GATE_NUMBER=#{GATE_NUMBER},
AREA_ID=#{AREA_ID},
GATE_NAME=#{GATE_NAME},
@ -149,6 +149,9 @@
-->
)
</if>
<if test="pd.AREA_ID != null and pd.AREA_ID != ''"><!-- 关键词检索 -->
and f.AREA_ID=#{pd.AREA_ID}
</if>
</select>
<!-- 列表(全部) -->

View File

@ -0,0 +1,175 @@
<?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.datasource.mkmj.MkmjGateLogMapper">
<!--表名 -->
<sql id="tableName">
MKMJ_GATE_LOG
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.AREA_LOG_ID,
f.AREA_GATE_ID,
f.STATE,
f.LOG_TIME,
f.USER_CARD,
f.GATE_TYPE,
f.CREATOR,
f.CREATTIME,
f.OPERATOR,
f.OPERATTIME,
f.ISDELETE,
f.EX1,
f.EX2,
f.EX3,
f.EX4,
f.EX5
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
AREA_LOG_ID,
AREA_GATE_ID,
STATE,
LOG_TIME,
USER_CARD,
GATE_TYPE,
CREATOR,
CREATTIME,
OPERATOR,
OPERATTIME,
ISDELETE,
EX1,
EX2,
EX3,
EX4,
EX5
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{AREA_LOG_ID},
#{AREA_GATE_ID},
#{STATE},
#{LOG_TIME},
#{USER_CARD},
#{GATE_TYPE},
#{CREATOR},
#{CREATTIME},
#{OPERATOR},
#{OPERATTIME},
#{ISDELETE},
#{EX1},
#{EX2},
#{EX3},
#{EX4},
#{EX5}
</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
ISDELETE = '1'
where
AREA_LOG_ID = #{AREA_LOG_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
AREA_LOG_ID= AREA_LOG_ID,
AREA_GATE_ID=#{AREA_GATE_ID},
STATE=#{STATE},
LOG_TIME=#{LOG_TIME},
USER_CARD=#{USER_CARD},
GATE_TYPE=#{GATE_TYPE},
CREATOR=#{CREATOR},
CREATTIME=#{CREATTIME},
OPERATOR=#{OPERATOR},
OPERATTIME=#{OPERATTIME},
ISDELETE=#{ISDELETE},
EX1=#{EX1},
EX2=#{EX2},
EX3=#{EX3},
EX4=#{EX4},
EX5=#{EX5}
where
AREA_LOG_ID=#{AREA_LOG_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.AREA_LOG_ID=#{AREA_LOG_ID}
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
and
(
<!-- 根据需求自己加检索条件
字段1 LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
or
字段2 LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
-->
)
</if>
<if test="pd.AREA_GATE_ID != null and pd.AREA_GATE_ID != ''"><!-- 关键词检索 -->
and f.AREA_GATE_ID=#{pd.AREA_GATE_ID}
</if>
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="String">
update
<include refid="tableName"></include>
set
ISDELETE = '1'
where
AREA_LOG_ID in
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>