ソースを参照

外部根据idCard调用接口

shiqian 3 年 前
コミット
2d6ef5f757

+ 26 - 0
boman-api/boman-domain/src/main/java/com/boman/domain/IpColumns.java

@@ -0,0 +1,26 @@
+package com.boman.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.experimental.SuperBuilder;
+
+import java.sql.Timestamp;
+
+/**
+ * @author shiqian
+ * @date 2022年01月24日 11:11
+ **/
+@Data
+@SuperBuilder
+public class IpColumns {
+
+    private Long id;
+    private Long ipTimesId;
+    private String columnNames;
+    private String createBy;
+    private String updateBy;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Timestamp createTime;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Timestamp updateTime;
+}

+ 33 - 0
boman-api/boman-domain/src/main/java/com/boman/domain/IpTimes.java

@@ -0,0 +1,33 @@
+package com.boman.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.SuperBuilder;
+
+import java.sql.Timestamp;
+
+/**
+ * @author shiqian
+ * @date 2022年01月24日 10:37
+ * @description 可以访问的ip, 以及一天的访问次数
+ **/
+@Data
+@SuperBuilder
+@NoArgsConstructor
+public class IpTimes {
+
+    private Long id;
+    private String ip;
+    private String tableName;
+    private Integer times;
+    private String columnNames;
+    private String createBy;
+    private String updateBy;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Timestamp createTime;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Timestamp updateTime;
+
+}

+ 2 - 0
boman-common/boman-common-redis/src/main/java/com/boman/common/redis/RedisKey.java

@@ -42,4 +42,6 @@ public class RedisKey {
     public static final String STS_CZRK_ = "sts:czrk:";
     /** 常住人口统计 **/
     public static final String CHINA_AREA = "CHINA_AREA";
+    /** 外部访问接口的次数限制 key **/
+    public static final String IP_TIMES = "IP:TIMES:";
 }

+ 16 - 5
boman-web-core/src/main/java/com/boman/web/core/controller/CzrkController.java

@@ -1,20 +1,19 @@
 package com.boman.web.core.controller;
 
-import com.boman.common.core.utils.poi.ExcelUtil;
+import com.alibaba.fastjson.JSON;
+import com.boman.common.core.utils.DateUtils;
 import com.boman.common.core.web.controller.BaseController;
 import com.boman.common.log.annotation.Log;
 import com.boman.common.log.enums.BusinessType;
 import com.boman.domain.Czrk;
 import com.boman.domain.TableDataInfo;
-import com.boman.domain.VaccineInfoOperation;
 import com.boman.domain.dto.AjaxResult;
 import com.boman.web.core.service.czrk.ICzrkService;
-import org.checkerframework.checker.units.qual.C;
+import com.boman.web.core.utils.AuthUtils;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
 import java.util.List;
 
 /**
@@ -25,6 +24,7 @@ import java.util.List;
  */
 @RestController
 @RequestMapping("/core/czrk")
+@Slf4j
 public class CzrkController extends BaseController {
 
     @Autowired
@@ -71,6 +71,8 @@ public class CzrkController extends BaseController {
 //    @PreAuthorize("@ss.hasPermi('system:czrk:query')")
     @GetMapping(value = "/{id}")
     public AjaxResult getInfo(@PathVariable("id") Long id) {
+        log.info("{}于{}根据id:{},获取信息"
+                , AuthUtils.getLoginUser().getSysUser().getUserName(), DateUtils.dateTimeNow(), id);
         return AjaxResult.success(czrkService.selectCzrkById(id));
     }
 
@@ -156,4 +158,13 @@ public class CzrkController extends BaseController {
         Czrk hjInfo = czrkService.findHjInfo(czrk);
         return AjaxResult.success(hjInfo);
     }
+
+    /**
+     * 外部访问czrk的字段
+     */
+    @PostMapping("/getInfo")
+    public AjaxResult getInfo(String appKey, String appSecret, String idCard) {
+        return czrkService.getInfo(appKey, appSecret, idCard);
+    }
+
 }

+ 81 - 0
boman-web-core/src/main/java/com/boman/web/core/controller/IpTimesColumnsController.java

@@ -0,0 +1,81 @@
+package com.boman.web.core.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.boman.common.core.web.controller.BaseController;
+import com.boman.domain.Fxry;
+import com.boman.domain.IpColumns;
+import com.boman.domain.IpTimes;
+import com.boman.domain.TableDataInfo;
+import com.boman.domain.dto.AjaxResult;
+import com.boman.web.core.domain.SysRegion;
+import com.boman.web.core.mapper.SysRegionMapper;
+import com.boman.web.core.service.fxry.FxryService;
+import com.boman.web.core.service.ip.IpColumnsService;
+import com.boman.web.core.service.ip.IpTimesService;
+import org.checkerframework.checker.units.qual.A;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author shiqian
+ * @description 给外部用的接口的限制点配置
+ * @date 2022年01月05日 15:39
+ **/
+@RestController
+@RequestMapping
+public class IpTimesColumnsController extends BaseController {
+
+    private static final String APP_KEY = "";
+    private static final String APP_SECRET = "";
+
+    @Resource
+    private IpTimesService ipTimesService;
+
+
+    /**
+     * 功能描述: 外部访问接口 IpTimes
+     *
+     * @param ip    ip
+     * @param times times
+     * @return com.boman.domain.TableDataInfo
+     */
+    @GetMapping("/ipTimes/list")
+    public AjaxResult list(String ip, String times) {
+        List<JSONObject> list = ipTimesService.list(ip, times);
+        return AjaxResult.success(list);
+    }
+
+    /**
+     * 功能描述: 根据表明获取字段名称和comment
+     *
+     * @param tableName tableName
+     * @return AjaxResult
+     */
+    @GetMapping("/ipTimes/{tableName}")
+    public AjaxResult getAllColumns(@PathVariable("tableName") String tableName) {
+        List<JSONObject> allColumns = ipTimesService.getAllColumns(tableName);
+        return AjaxResult.success(allColumns);
+    }
+
+    @GetMapping("/ipTimes/get/{id}")
+    public AjaxResult getById(@PathVariable Long id) {
+        JSONObject jsonObject = ipTimesService.getById(id);
+        return AjaxResult.success(jsonObject);
+    }
+
+    @PostMapping("/ipTimes/saveOrUpdate")
+    public AjaxResult saveOrUpdate(@RequestBody JSONObject jsonObject) {
+        int rows = ipTimesService.saveOrUpdate(jsonObject);
+        return toAjax(rows);
+    }
+
+    @PostMapping("/ipTimes/delete")
+    public AjaxResult delete(@RequestBody Long[] idArr) {
+        int rows = ipTimesService.delete(idArr);
+        return toAjax(rows);
+    }
+
+}

+ 2 - 0
boman-web-core/src/main/java/com/boman/web/core/mapper/CzrkMapper.java

@@ -133,4 +133,6 @@ public interface CzrkMapper {
     List<Czrk> listByCzJs1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("deptIdList") List<Long> deptIdList);
 
     Czrk getHzByCode(String code);
+
+    Czrk getColumnNamesByIdCard(@Param("columnNames") String columnNames, @Param("idCard") String idCard);
 }

+ 23 - 0
boman-web-core/src/main/java/com/boman/web/core/mapper/IpColumnsMapper.java

@@ -0,0 +1,23 @@
+package com.boman.web.core.mapper;
+
+import com.boman.domain.IpColumns;
+import com.boman.domain.IpTimes;
+
+import java.util.List;
+
+/**
+ * @author shiqian
+ * @date 2022年01月24日 11:17
+ **/
+public interface IpColumnsMapper {
+
+    List<IpColumns> list(IpColumns ipColumns);
+
+    IpColumns getById(Long id);
+
+    int update(IpColumns ipColumns);
+
+    int save(IpColumns ipColumns);
+
+    int delete(Long id);
+}

+ 28 - 0
boman-web-core/src/main/java/com/boman/web/core/mapper/IpTimesMapper.java

@@ -0,0 +1,28 @@
+package com.boman.web.core.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import com.boman.domain.IpTimes;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author shiqian
+ * @date 2022年01月24日 11:17
+ **/
+public interface IpTimesMapper {
+
+    List<JSONObject> list(@Param("ip") String ip, @Param("times") String times);
+
+    JSONObject getById(Long id);
+
+    int update(JSONObject jsonObject);
+
+    int save(JSONObject jsonObject);
+
+    int delete(Long id);
+
+    JSONObject getByIp(String ip);
+
+    List<JSONObject> getAllColumns(String tableName);
+}

+ 59 - 0
boman-web-core/src/main/java/com/boman/web/core/service/czrk/CzrkServiceImpl.java

@@ -1,9 +1,11 @@
 package com.boman.web.core.service.czrk;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.boman.common.core.utils.DateUtils;
 import com.boman.common.core.utils.SecurityUtils;
 import com.boman.common.core.utils.StringUtils;
+import com.boman.common.core.utils.ip.IpUtils;
 import com.boman.common.core.utils.number.NumberUtils;
 import com.boman.common.core.utils.obj.ObjectUtils;
 import com.boman.common.core.utils.sql.SqlUtil;
@@ -17,6 +19,8 @@ import com.boman.system.api.RemoteDeptService;
 import com.boman.web.core.domain.GridInfo;
 import com.boman.web.core.mapper.CzrkMapper;
 import com.boman.web.core.mapper.GridInfoMapper;
+import com.boman.web.core.service.ip.IpTimesService;
+import com.boman.web.core.service.ip.IpTimesServiceImpl;
 import com.boman.web.core.utils.AuthUtils;
 import com.boman.web.core.utils.IdCardUtils;
 import com.github.pagehelper.PageHelper;
@@ -26,6 +30,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
 
 import javax.annotation.Resource;
 import java.sql.Date;
@@ -39,6 +45,7 @@ import java.util.concurrent.TimeUnit;
 import static com.boman.common.core.utils.StringUtils.isNotEmpty;
 import static com.boman.common.core.utils.fieldTranslator.IdCardUtils.getSex;
 import static com.boman.common.core.utils.obj.ObjectUtils.*;
+import static com.boman.common.redis.RedisKey.IP_TIMES;
 import static com.boman.common.redis.RedisKey.STS_CZRK_;
 import static com.boman.web.core.utils.IdCardUtils.getAge;
 import static com.google.common.base.Strings.nullToEmpty;
@@ -66,6 +73,8 @@ public class CzrkServiceImpl implements ICzrkService {
 
     @Resource
     private GridInfoMapper gridInfoMapper;
+    @Resource
+    private IpTimesService ipTimesService;
 
     /**
      * 功能描述: 市领导查询,deptId不起作用,具体到村,需要czrk的villageId有值就可以,只是villageId起作用
@@ -76,6 +85,8 @@ public class CzrkServiceImpl implements ICzrkService {
      */
     @Override
     public List<Czrk> listByRlry(Czrk czrk) {
+        log.info("{}于{}查询常住人员列表,查询条件:{}"
+                , AuthUtils.getLoginUser().getSysUser().getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
         setDeptIdList(czrk);
         setAgeScope(czrk);
 
@@ -123,6 +134,8 @@ public class CzrkServiceImpl implements ICzrkService {
 
     @Override
     public List<Czrk> listByXz(Czrk czrk) {
+        log.info("{}于{}查询新增常住人员列表,查询条件:{}"
+                , AuthUtils.getLoginUser().getSysUser().getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
         setDeptIdList(czrk);
 
         czrk.setStartTime(DateUtils.getTodayStartStr());
@@ -135,6 +148,8 @@ public class CzrkServiceImpl implements ICzrkService {
 
     @Override
     public List<Czrk> listByJs(Czrk czrk) {
+        log.info("{}于{}查询减少常住人员列表,查询条件:{}"
+                , AuthUtils.getLoginUser().getSysUser().getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
         setDeptIdList(czrk);
 
         czrk.setStartTime(DateUtils.getTodayStartStr());
@@ -257,6 +272,8 @@ public class CzrkServiceImpl implements ICzrkService {
      */
     @Override
     public Czrk selectCzrkById(Long id) {
+        log.info("{}于{}根据id:{},获取信息"
+                , AuthUtils.getLoginUser().getSysUser().getUserName(), DateUtils.dateTimeNow(), id);
         Czrk czrk = czrkMapper.selectCzrkById(id);
         if (czrk != null){
             Long gridId = czrk.getGridId();
@@ -290,6 +307,8 @@ public class CzrkServiceImpl implements ICzrkService {
      */
     @Override
     public int insertCzrk(Czrk czrk) {
+        log.info("{}于{}新增常住人口:{}"
+                , AuthUtils.getLoginUser().getSysUser().getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
         return czrkMapper.insertCzrk(czrk);
     }
 
@@ -301,6 +320,8 @@ public class CzrkServiceImpl implements ICzrkService {
      */
     @Override
     public int updateCzrk(Czrk czrk) {
+        log.info("{}于{}修改常住人口:{}"
+                , AuthUtils.getLoginUser().getSysUser().getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
         return czrkMapper.updateCzrk(czrk);
     }
 
@@ -313,6 +334,8 @@ public class CzrkServiceImpl implements ICzrkService {
     @Override
     @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
     public int deleteCzrk(Czrk czrk) {
+        log.info("{}于{}删除常住人口:{}"
+                , AuthUtils.getLoginUser().getSysUser().getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
         czrk.setUpdateBy(AuthUtils.getLoginUser().getSysUser().getUserName());
         if (isEmpty(czrk.getDeleteReason())) {
             log.error("删除原因不能为空, id={}", czrk.getId());
@@ -347,6 +370,8 @@ public class CzrkServiceImpl implements ICzrkService {
      */
     @Override
     public int reduction(String id) {
+        log.info("{}于{}使用回收站还原功能,id:{}"
+                , AuthUtils.getLoginUser().getSysUser().getUserName(), DateUtils.dateTimeNow(), id);
         if (isEmpty(id)) return 0;
 
         return czrkMapper.reduction(id);
@@ -354,6 +379,8 @@ public class CzrkServiceImpl implements ICzrkService {
 
     @Override
     public List<Czrk> family(String code) {
+        log.info("{}于{}根据户号查找家庭中所有人员,户号:{}"
+                , AuthUtils.getLoginUser().getSysUser().getUserName(), DateUtils.dateTimeNow(), code);
         if (isEmpty(code)) {
             return Collections.emptyList();
         }
@@ -972,6 +999,38 @@ public class CzrkServiceImpl implements ICzrkService {
         return hjInfo;
     }
 
+    @Override
+    public AjaxResult getInfo(String appKey, String appSecret, String idCard) {
+        // checkAuth(appKey, appSecret);
+        String ip = IpUtils.getIpAddr(((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
+        JSONObject jsonObject = ipTimesService.getByIp(ip);
+        if (jsonObject == null || jsonObject.size() == 0) {
+            String errorMsg = "当前ip非法访问, ip: " + ip;
+            log.error(errorMsg + "appKey:{}, appSecret:{}, idCard:{}", appKey, appSecret, idCard);
+            return AjaxResult.error(errorMsg);
+        }
+
+        String today = DateUtils.getDate();
+        String redisKey = IP_TIMES + jsonObject.getString("ip") + ":" + today;
+        Integer cacheTimes = redisService.getCacheObject(redisKey);
+        if (cacheTimes == null) cacheTimes = 0;
+        int times = jsonObject.getIntValue("times");
+        if (++cacheTimes > times) {
+            log.error("ip:{}, 时间:{}, 访问超次数, 已经查询了 {} 次", ip, today, cacheTimes);
+            return AjaxResult.error("今日访问次数已用尽,请明日再试");
+        }
+
+        Czrk czrk = czrkMapper.getColumnNamesByIdCard(jsonObject.getString("column_names"), idCard);
+        if (czrk == null) {
+            log.error("ip:{}, 时间:{}, 根据idCard:{}, 未查询到信息, 已经查询了 {} 次", ip, today, idCard, cacheTimes);
+            return AjaxResult.error("根据身份证号码未查询到信息");
+        }
+
+        long time = DateUtils.getTodayEnd().getTime(),time1 = DateUtils.getNowDate().getTime();
+        redisService.setCacheObject(redisKey, cacheTimes, ((time - time1) / 1000), TimeUnit.SECONDS);
+        return AjaxResult.success(czrk);
+    }
+
     private String packRedisKey(String deptId) {
         return STS_CZRK_ + deptId + ":" + DateUtils.getDate();
     }

+ 2 - 0
boman-web-core/src/main/java/com/boman/web/core/service/czrk/ICzrkService.java

@@ -88,4 +88,6 @@ public interface ICzrkService {
     Czrk findHjInfo(Czrk czrk);
 
     JSONObject hjczLine();
+
+    AjaxResult getInfo(String appKey, String appSecret, String idCard);
 }

+ 19 - 0
boman-web-core/src/main/java/com/boman/web/core/service/ip/IpColumnsService.java

@@ -0,0 +1,19 @@
+package com.boman.web.core.service.ip;
+
+import com.boman.domain.IpColumns;
+import com.boman.domain.IpTimes;
+
+import java.util.List;
+
+/**
+ * @author shiqian
+ * @date 2022年01月24日 11:14
+ **/
+public interface IpColumnsService {
+    List<IpColumns> list(IpColumns ipColumns);
+
+    IpColumns getById(Long id);
+
+    int saveOrUpdate(IpColumns ipColumns);
+    int delete(Long id);
+}

+ 51 - 0
boman-web-core/src/main/java/com/boman/web/core/service/ip/IpColumnsServiceImpl.java

@@ -0,0 +1,51 @@
+package com.boman.web.core.service.ip;
+
+import com.boman.domain.IpColumns;
+import com.boman.domain.IpTimes;
+import com.boman.web.core.mapper.IpColumnsMapper;
+import com.boman.web.core.mapper.IpTimesMapper;
+import com.boman.web.core.utils.AuthUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author shiqian
+ * @date 2022年01月24日 11:15
+ **/
+@Service
+public class IpColumnsServiceImpl implements IpColumnsService {
+
+    @Resource
+    private IpColumnsMapper mapper;
+
+    @Override
+    public List<IpColumns> list(IpColumns ipColumns) {
+        return mapper.list(ipColumns);
+    }
+
+    @Override
+    public IpColumns getById(Long id) {
+        return mapper.getById(id);
+    }
+
+    @Override
+    public int saveOrUpdate(IpColumns ipColumns) {
+        String userName = AuthUtils.getLoginUser().getSysUser().getUserName();
+        Long id = ipColumns.getId();
+        ipColumns.setUpdateBy(userName);
+
+        if (null == id) {
+            ipColumns.setCreateBy(userName);
+            return mapper.save(ipColumns);
+        }
+
+        return mapper.update(ipColumns);
+    }
+
+    @Override
+    public int delete(Long id) {
+        return mapper.delete(id);
+    }
+}

+ 22 - 0
boman-web-core/src/main/java/com/boman/web/core/service/ip/IpTimesService.java

@@ -0,0 +1,22 @@
+package com.boman.web.core.service.ip;
+
+import com.alibaba.fastjson.JSONObject;
+import com.boman.domain.IpTimes;
+
+import java.util.List;
+
+/**
+ * @author shiqian
+ * @date 2022年01月24日 11:14
+ **/
+public interface IpTimesService {
+    List<JSONObject> list(String ip, String times);
+
+    JSONObject getById(Long id);
+    JSONObject getByIp(String ip);
+
+    int saveOrUpdate(JSONObject jsonObject);
+    int delete(Long[] idArr);
+
+    List<JSONObject> getAllColumns(String tableName);
+}

+ 79 - 0
boman-web-core/src/main/java/com/boman/web/core/service/ip/IpTimesServiceImpl.java

@@ -0,0 +1,79 @@
+package com.boman.web.core.service.ip;
+
+import com.alibaba.fastjson.JSONObject;
+import com.boman.common.core.utils.obj.ObjectUtils;
+import com.boman.domain.IpTimes;
+import com.boman.domain.SysUser;
+import com.boman.web.core.mapper.IpTimesMapper;
+import com.boman.web.core.utils.AuthUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author shiqian
+ * @date 2022年01月24日 11:15
+ **/
+@Service
+public class IpTimesServiceImpl implements IpTimesService {
+
+    @Resource
+    private IpTimesMapper mapper;
+
+    @Override
+    public List<JSONObject> list(String ip, String times) {
+        return mapper.list(ip, times);
+    }
+
+    @Override
+    public JSONObject getById(Long id) {
+        return mapper.getById(id);
+    }
+
+    @Override
+    public JSONObject getByIp(String ip) {
+        return mapper.getByIp(ip);
+    }
+
+    @Override
+    public int saveOrUpdate(JSONObject jsonObject) {
+        String userName = AuthUtils.getLoginUser().getSysUser().getUserName();
+        Long id = jsonObject.getLong("id");
+//        ipTimes.setUpdateBy(userName);
+        jsonObject.put("update_by", userName);
+
+        if (null == id) {
+//            ipTimes.setCreateBy(userName);
+            jsonObject.put("create_by", userName);
+            return mapper.save(jsonObject);
+        }
+
+        return mapper.update(jsonObject);
+    }
+
+    @Override
+    public int delete(Long[] idArr) {
+        int i = 0;
+        for (Long aLong : idArr) {
+            i += mapper.delete(aLong);
+        }
+        return i;
+    }
+
+    @Override
+    public List<JSONObject> getAllColumns(String tableName) {
+        if (ObjectUtils.isEmpty(tableName)) throw new IllegalArgumentException("tableName is empty");
+        List<JSONObject> allColumns = mapper.getAllColumns(tableName);
+        List<JSONObject> result = new ArrayList<>();
+        for (JSONObject column : allColumns) {
+            JSONObject jsonObject = new JSONObject(2);
+            jsonObject.put("label", column.getString("Comment"));
+            jsonObject.put("value", column.getString("Field"));
+            result.add(jsonObject);
+        }
+
+        return result;
+    }
+}

+ 6 - 0
boman-web-core/src/main/resources/mapper/CzrkMapper.xml

@@ -545,6 +545,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where house_type = '是' and code = #{code} limit 1;
     </select>
 
+    <select id="getColumnNamesByIdCard" resultMap="CzrkResult">
+        SELECT ${columnNames}
+        from czrk
+        where id_card = #{idCard} limit 1;
+    </select>
+
     <select id="stsByWrl" resultType="int">
         select count(vi.id)
         from czrk vi

+ 50 - 0
boman-web-core/src/main/resources/mapper/IpColumnsMapper.xml

@@ -0,0 +1,50 @@
+<?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.boman.web.core.mapper.IpColumnsMapper">
+
+    <delete id="delete">
+        delete from ip_columns where id = #{id}
+    </delete>
+
+    <select id="list" resultType="com.boman.domain.IpTimes">
+        select * from ip_columns
+    </select>
+
+    <select id="getById" resultType="com.boman.domain.IpTimes">
+        select * from ip_columns where id = #{id}
+    </select>
+
+    <insert id="save">
+        insert into ip_columns
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="ip != null">ip,</if>
+            <if test="ipTimesId != null">ip_times_id,</if>
+            <if test="columnNames != null">column_names,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="updateBy != null">update_by,</if>
+            create_time, update_time
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="ip != null">#{ip},</if>
+            <if test="ipTimesId != null">#{ipTimesId},</if>
+            <if test="columnNames != null">#{columnNames},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            sysdate(), sysdate()
+        </trim>
+    </insert>
+
+    <update id="update">
+        update ip_columns
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="ip != null">ip = #{ip},</if>
+            <if test="ipTimesId != null">ip_times_id = #{ipTimesId},</if>
+            <if test="columnNames != null">column_names = #{columnNames},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+        </trim>
+        where id = #{id}
+    </update>
+</mapper>

+ 64 - 0
boman-web-core/src/main/resources/mapper/IpTimesMapper.xml

@@ -0,0 +1,64 @@
+<?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.boman.web.core.mapper.IpTimesMapper">
+
+    <delete id="delete">
+        delete from ip_times where id = #{id}
+    </delete>
+
+    <select id="list" resultType="com.alibaba.fastjson.JSONObject">
+        select * from ip_times
+        where 1 = 1
+        <if test="ip != null and ip != ''">
+            and ip like concat('%', #{ip},'%')
+        </if>
+        <if test="times != null">
+            and times = #{times}
+        </if>
+    </select>
+
+    <select id="getById" resultType="com.alibaba.fastjson.JSONObject">
+        select * from ip_times where id = #{id}
+    </select>
+    <select id="getByIp" resultType="com.alibaba.fastjson.JSONObject">
+        select * from ip_times where ip = #{ip} limit 1;
+    </select>
+
+    <select id="getAllColumns" resultType="com.alibaba.fastjson.JSONObject">
+        show full columns from czrk;
+    </select>
+
+    <insert id="save">
+        insert into ip_times
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="ip != null">ip,</if>
+            <if test="times != null">times,</if>
+            <if test="column_names != null">column_names,</if>
+            <if test="create_by != null">create_by,</if>
+            <if test="update_by != null">update_by,</if>
+            create_time, update_time
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="ip != null">#{ip},</if>
+            <if test="times != null">#{times},</if>
+            <if test="column_names != null">#{column_names},</if>
+            <if test="create_by != null">#{create_by},</if>
+            <if test="update_by != null">#{update_by},</if>
+            sysdate(), sysdate()
+        </trim>
+    </insert>
+
+    <update id="update">
+        update ip_times
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="ip != null">ip = #{ip},</if>
+            <if test="times != null">times = #{times},</if>
+            <if test="column_names != null">column_names = #{column_names},</if>
+            <if test="create_by != null">create_by = #{create_by},</if>
+            <if test="update_by != null">update_by = #{update_by},</if>
+        </trim>
+        where id = #{id}
+    </update>
+</mapper>