From 3e255f9fed38e768a5fb6857186deecb6567b66f Mon Sep 17 00:00:00 2001 From: YUANYE <418471657@qq.com> Date: Wed, 23 Jun 2021 17:58:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bweb/controller/CommonController.java | 55 +++ .../OutRechargeOrderController.java | 22 +- .../com/hai/common/exception/ErrorCode.java | 1 + .../java/com/hai/dao/SecConfigMapper.java | 89 ++++ .../java/com/hai/dao/SecConfigMapperExt.java | 7 + .../com/hai/dao/SecConfigSqlProvider.java | 206 +++++++++ .../java/com/hai/entity/OutRechargeOrder.java | 12 +- .../main/java/com/hai/entity/SecConfig.java | 87 ++++ .../java/com/hai/entity/SecConfigExample.java | 422 ++++++++++++++++++ .../java/com/hai/service/CommonService.java | 18 + .../com/hai/service/SecConfigService.java | 43 ++ .../hai/service/impl/CommonServiceImpl.java | 24 + .../service/impl/SecConfigServiceImpl.java | 44 ++ 13 files changed, 1019 insertions(+), 11 deletions(-) create mode 100644 hai-service/src/main/java/com/hai/dao/SecConfigMapper.java create mode 100644 hai-service/src/main/java/com/hai/dao/SecConfigMapperExt.java create mode 100644 hai-service/src/main/java/com/hai/dao/SecConfigSqlProvider.java create mode 100644 hai-service/src/main/java/com/hai/entity/SecConfig.java create mode 100644 hai-service/src/main/java/com/hai/entity/SecConfigExample.java create mode 100644 hai-service/src/main/java/com/hai/service/SecConfigService.java create mode 100644 hai-service/src/main/java/com/hai/service/impl/SecConfigServiceImpl.java diff --git a/hai-bweb/src/main/java/com/bweb/controller/CommonController.java b/hai-bweb/src/main/java/com/bweb/controller/CommonController.java index 20d0c1f1..e5adf140 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/CommonController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/CommonController.java @@ -1,8 +1,11 @@ package com.bweb.controller; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.entity.SecConfig; +import com.hai.entity.SecDictionary; import com.hai.model.ResponseData; import com.hai.service.CommonService; +import com.hai.service.SecConfigService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; @@ -22,6 +25,10 @@ public class CommonController { @Resource private CommonService commonService; + @Resource + private SecConfigService secConfigService; + + @RequestMapping(value="/getRegionsByParentId",method= RequestMethod.GET) @ResponseBody @ApiOperation(value = "分级查询区域信息") @@ -86,6 +93,54 @@ public class CommonController { } } + @RequestMapping(value="/mappingSysNameOl",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据 码值类型 查询数据字典") + public ResponseData mappingSysNameOl(@RequestParam(name = "codeType", required = true) String codeType) { + try { + + return ResponseMsgUtil.success(commonService.mappingSysNameOl(codeType)); + + } catch (Exception e) { + log.error("CommonController --> getDictionaryByCodeType() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/getDictionaryByCodeTypeOl",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据 码值类型 查询数据字典") + public ResponseData getDictionaryByCodeTypeOl(@RequestParam(name = "codeType", required = true) String codeType) { + try { + + return ResponseMsgUtil.success(secConfigService.findByCodeType(codeType)); + + } catch (Exception e) { + log.error("CommonController --> getDictionaryByCodeType() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/updateDictionary",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据 码值类型 查询数据字典") + public ResponseData updateDictionary( + @RequestParam(name = "codeType", required = true) String codeType, + @RequestParam(name = "codeValue", required = true) String codeValue + ) { + try { + + SecConfig secConfig = secConfigService.findByCodeType(codeType); + secConfig.setCodeValue(codeValue); + secConfigService.updateSecConfig(secConfig); + + return ResponseMsgUtil.success("修改成功"); + } catch (Exception e) { + log.error("CommonController --> getDictionaryByCodeType() error!", e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="/getDictionaryByCodeTypeAndExt",method = RequestMethod.GET) @ResponseBody diff --git a/hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java index 700495b2..abd04bf2 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java @@ -16,12 +16,15 @@ import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.*; +import com.hai.dao.SecDictionaryMapper; import com.hai.entity.*; import com.hai.model.HighUserModel; import com.hai.model.OrderRefundModel; import com.hai.model.ResponseData; import com.hai.model.ResultProfitSharing; +import com.hai.service.CommonService; import com.hai.service.OutRechargeOrderService; +import com.hai.service.SecConfigService; import com.hai.service.TelApiService; import com.hai.service.pay.impl.GoodsOrderServiceImpl; import io.swagger.annotations.Api; @@ -67,6 +70,13 @@ public class OutRechargeOrderController { @Resource private GoodsOrderServiceImpl goodsOrderService; + @Resource + private CommonService commonService; + + @Resource + private SecConfigService secConfigService; + + @RequestMapping(value="/addOrder",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "增加订单") @@ -80,9 +90,15 @@ public class OutRechargeOrderController { outRechargeOrder.getPayPrice() == null || outRechargeOrder.getOrderPrice() == null ) { - log.error("orderToPay error!"); + log.error("addOrder error!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } + + if (!secConfigService.isConfig("RECHARGE" , "1")) { + log.error("addOrder error!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.RECHARGE_CLOSE, ""); + } + String remarks = ""; // 支付类型 1.微信支付 outRechargeOrder.setPayType(1); @@ -118,10 +134,6 @@ public class OutRechargeOrderController { outRechargeOrder.setUserName(userInfoModel.getHighUser().getName()); outRechargeOrder.setUserPhone(userInfoModel.getHighUser().getPhone()); - if (outRechargeOrder.getCodeValue() != null) { - outRechargeOrder.setAgentKey(outRechargeOrder.getCodeValue()); - } - outRechargeOrder.setCreateTimed(new Date()); outRechargeOrder.setStatus(1); outRechargeOrderService.insertOrder(outRechargeOrder); diff --git a/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java b/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java index bedb3473..28896be1 100644 --- a/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java +++ b/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java @@ -108,6 +108,7 @@ public enum ErrorCode { NOT_FOUND_DISCOUNT("2125","未找到优惠券信息"), NOT_FOUND_AGENT("2126","未找到代理商信息"), DISCOUNT_STOCK_COUNT_ERROR("2127","优惠券库存数量不足"), + RECHARGE_CLOSE("2128","系统已关闭,请稍后充值"), STATUS_ERROR("3000","状态错误"), ADD_DATA_ERROR("3001","增加数据失败"), diff --git a/hai-service/src/main/java/com/hai/dao/SecConfigMapper.java b/hai-service/src/main/java/com/hai/dao/SecConfigMapper.java new file mode 100644 index 00000000..d6028f7f --- /dev/null +++ b/hai-service/src/main/java/com/hai/dao/SecConfigMapper.java @@ -0,0 +1,89 @@ +package com.hai.dao; + +import com.hai.entity.SecConfig; +import com.hai.entity.SecConfigExample; +import java.util.List; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.DeleteProvider; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.InsertProvider; +import org.apache.ibatis.annotations.Options; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Result; +import org.apache.ibatis.annotations.Results; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.SelectProvider; +import org.apache.ibatis.annotations.Update; +import org.apache.ibatis.annotations.UpdateProvider; +import org.apache.ibatis.type.JdbcType; +import org.springframework.stereotype.Repository; + +/** + * + * 代码由工具生成,请勿修改!!! + * 如果需要扩展请在其父类进行扩展 + * + **/ +@Repository +public interface SecConfigMapper extends SecConfigMapperExt { + @SelectProvider(type=SecConfigSqlProvider.class, method="countByExample") + long countByExample(SecConfigExample example); + + @DeleteProvider(type=SecConfigSqlProvider.class, method="deleteByExample") + int deleteByExample(SecConfigExample example); + + @Delete({ + "delete from sec_config", + "where id = #{id,jdbcType=INTEGER}" + }) + int deleteByPrimaryKey(Integer id); + + @Insert({ + "insert into sec_config (code_type, code_value)", + "values (#{codeType,jdbcType=VARCHAR}, #{codeValue,jdbcType=VARCHAR})" + }) + @Options(useGeneratedKeys=true,keyProperty="id") + int insert(SecConfig record); + + @InsertProvider(type=SecConfigSqlProvider.class, method="insertSelective") + @Options(useGeneratedKeys=true,keyProperty="id") + int insertSelective(SecConfig record); + + @SelectProvider(type=SecConfigSqlProvider.class, method="selectByExample") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true), + @Result(column="code_type", property="codeType", jdbcType=JdbcType.VARCHAR), + @Result(column="code_value", property="codeValue", jdbcType=JdbcType.VARCHAR) + }) + List selectByExample(SecConfigExample example); + + @Select({ + "select", + "id, code_type, code_value", + "from sec_config", + "where id = #{id,jdbcType=INTEGER}" + }) + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true), + @Result(column="code_type", property="codeType", jdbcType=JdbcType.VARCHAR), + @Result(column="code_value", property="codeValue", jdbcType=JdbcType.VARCHAR) + }) + SecConfig selectByPrimaryKey(Integer id); + + @UpdateProvider(type=SecConfigSqlProvider.class, method="updateByExampleSelective") + int updateByExampleSelective(@Param("record") SecConfig record, @Param("example") SecConfigExample example); + + @UpdateProvider(type=SecConfigSqlProvider.class, method="updateByExample") + int updateByExample(@Param("record") SecConfig record, @Param("example") SecConfigExample example); + + @UpdateProvider(type=SecConfigSqlProvider.class, method="updateByPrimaryKeySelective") + int updateByPrimaryKeySelective(SecConfig record); + + @Update({ + "update sec_config", + "set code_type = #{codeType,jdbcType=VARCHAR},", + "code_value = #{codeValue,jdbcType=VARCHAR}", + "where id = #{id,jdbcType=INTEGER}" + }) + int updateByPrimaryKey(SecConfig record); +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/dao/SecConfigMapperExt.java b/hai-service/src/main/java/com/hai/dao/SecConfigMapperExt.java new file mode 100644 index 00000000..11c65408 --- /dev/null +++ b/hai-service/src/main/java/com/hai/dao/SecConfigMapperExt.java @@ -0,0 +1,7 @@ +package com.hai.dao; + +/** + * mapper扩展类 + */ +public interface SecConfigMapperExt { +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/dao/SecConfigSqlProvider.java b/hai-service/src/main/java/com/hai/dao/SecConfigSqlProvider.java new file mode 100644 index 00000000..d39aa393 --- /dev/null +++ b/hai-service/src/main/java/com/hai/dao/SecConfigSqlProvider.java @@ -0,0 +1,206 @@ +package com.hai.dao; + +import com.hai.entity.SecConfig; +import com.hai.entity.SecConfigExample.Criteria; +import com.hai.entity.SecConfigExample.Criterion; +import com.hai.entity.SecConfigExample; +import java.util.List; +import java.util.Map; +import org.apache.ibatis.jdbc.SQL; + +public class SecConfigSqlProvider { + + public String countByExample(SecConfigExample example) { + SQL sql = new SQL(); + sql.SELECT("count(*)").FROM("sec_config"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String deleteByExample(SecConfigExample example) { + SQL sql = new SQL(); + sql.DELETE_FROM("sec_config"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String insertSelective(SecConfig record) { + SQL sql = new SQL(); + sql.INSERT_INTO("sec_config"); + + if (record.getCodeType() != null) { + sql.VALUES("code_type", "#{codeType,jdbcType=VARCHAR}"); + } + + if (record.getCodeValue() != null) { + sql.VALUES("code_value", "#{codeValue,jdbcType=VARCHAR}"); + } + + return sql.toString(); + } + + public String selectByExample(SecConfigExample example) { + SQL sql = new SQL(); + if (example != null && example.isDistinct()) { + sql.SELECT_DISTINCT("id"); + } else { + sql.SELECT("id"); + } + sql.SELECT("code_type"); + sql.SELECT("code_value"); + sql.FROM("sec_config"); + applyWhere(sql, example, false); + + if (example != null && example.getOrderByClause() != null) { + sql.ORDER_BY(example.getOrderByClause()); + } + + return sql.toString(); + } + + public String updateByExampleSelective(Map parameter) { + SecConfig record = (SecConfig) parameter.get("record"); + SecConfigExample example = (SecConfigExample) parameter.get("example"); + + SQL sql = new SQL(); + sql.UPDATE("sec_config"); + + if (record.getId() != null) { + sql.SET("id = #{record.id,jdbcType=INTEGER}"); + } + + if (record.getCodeType() != null) { + sql.SET("code_type = #{record.codeType,jdbcType=VARCHAR}"); + } + + if (record.getCodeValue() != null) { + sql.SET("code_value = #{record.codeValue,jdbcType=VARCHAR}"); + } + + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByExample(Map parameter) { + SQL sql = new SQL(); + sql.UPDATE("sec_config"); + + sql.SET("id = #{record.id,jdbcType=INTEGER}"); + sql.SET("code_type = #{record.codeType,jdbcType=VARCHAR}"); + sql.SET("code_value = #{record.codeValue,jdbcType=VARCHAR}"); + + SecConfigExample example = (SecConfigExample) parameter.get("example"); + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByPrimaryKeySelective(SecConfig record) { + SQL sql = new SQL(); + sql.UPDATE("sec_config"); + + if (record.getCodeType() != null) { + sql.SET("code_type = #{codeType,jdbcType=VARCHAR}"); + } + + if (record.getCodeValue() != null) { + sql.SET("code_value = #{codeValue,jdbcType=VARCHAR}"); + } + + sql.WHERE("id = #{id,jdbcType=INTEGER}"); + + return sql.toString(); + } + + protected void applyWhere(SQL sql, SecConfigExample example, boolean includeExamplePhrase) { + if (example == null) { + return; + } + + String parmPhrase1; + String parmPhrase1_th; + String parmPhrase2; + String parmPhrase2_th; + String parmPhrase3; + String parmPhrase3_th; + if (includeExamplePhrase) { + parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; + parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; + parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; + parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; + parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; + parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; + } else { + parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; + parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; + parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; + parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; + parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; + parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; + } + + StringBuilder sb = new StringBuilder(); + List oredCriteria = example.getOredCriteria(); + boolean firstCriteria = true; + for (int i = 0; i < oredCriteria.size(); i++) { + Criteria criteria = oredCriteria.get(i); + if (criteria.isValid()) { + if (firstCriteria) { + firstCriteria = false; + } else { + sb.append(" or "); + } + + sb.append('('); + List criterions = criteria.getAllCriteria(); + boolean firstCriterion = true; + for (int j = 0; j < criterions.size(); j++) { + Criterion criterion = criterions.get(j); + if (firstCriterion) { + firstCriterion = false; + } else { + sb.append(" and "); + } + + if (criterion.isNoValue()) { + sb.append(criterion.getCondition()); + } else if (criterion.isSingleValue()) { + if (criterion.getTypeHandler() == null) { + sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); + } else { + sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); + } + } else if (criterion.isBetweenValue()) { + if (criterion.getTypeHandler() == null) { + sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); + } else { + sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); + } + } else if (criterion.isListValue()) { + sb.append(criterion.getCondition()); + sb.append(" ("); + List listItems = (List) criterion.getValue(); + boolean comma = false; + for (int k = 0; k < listItems.size(); k++) { + if (comma) { + sb.append(", "); + } else { + comma = true; + } + if (criterion.getTypeHandler() == null) { + sb.append(String.format(parmPhrase3, i, j, k)); + } else { + sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); + } + } + sb.append(')'); + } + } + sb.append(')'); + } + } + + if (sb.length() > 0) { + sql.WHERE(sb.toString()); + } + } +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java b/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java index c3f71596..9cead854 100644 --- a/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java +++ b/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java @@ -139,14 +139,14 @@ public class OutRechargeOrder implements Serializable { */ private String agentKey; - private String codeValue; + private String code; - public String getCodeValue() { - return codeValue; + public String getCode() { + return code; } - public void setCodeValue(String codeValue) { - this.codeValue = codeValue; + public void setCode(String code) { + this.code = code; } private static final long serialVersionUID = 1L; @@ -457,4 +457,4 @@ public class OutRechargeOrder implements Serializable { sb.append("]"); return sb.toString(); } -} \ No newline at end of file +} diff --git a/hai-service/src/main/java/com/hai/entity/SecConfig.java b/hai-service/src/main/java/com/hai/entity/SecConfig.java new file mode 100644 index 00000000..eca81da5 --- /dev/null +++ b/hai-service/src/main/java/com/hai/entity/SecConfig.java @@ -0,0 +1,87 @@ +package com.hai.entity; + +import java.io.Serializable; + +/** + * sec_config + * @author + */ +/** + * + * 代码由工具生成 + * + **/ +public class SecConfig implements Serializable { + private Integer id; + + private String codeType; + + private String codeValue; + + private static final long serialVersionUID = 1L; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getCodeType() { + return codeType; + } + + public void setCodeType(String codeType) { + this.codeType = codeType; + } + + public String getCodeValue() { + return codeValue; + } + + public void setCodeValue(String codeValue) { + this.codeValue = codeValue; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + SecConfig other = (SecConfig) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getCodeType() == null ? other.getCodeType() == null : this.getCodeType().equals(other.getCodeType())) + && (this.getCodeValue() == null ? other.getCodeValue() == null : this.getCodeValue().equals(other.getCodeValue())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getCodeType() == null) ? 0 : getCodeType().hashCode()); + result = prime * result + ((getCodeValue() == null) ? 0 : getCodeValue().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", codeType=").append(codeType); + sb.append(", codeValue=").append(codeValue); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/entity/SecConfigExample.java b/hai-service/src/main/java/com/hai/entity/SecConfigExample.java new file mode 100644 index 00000000..1521608f --- /dev/null +++ b/hai-service/src/main/java/com/hai/entity/SecConfigExample.java @@ -0,0 +1,422 @@ +package com.hai.entity; + +import java.util.ArrayList; +import java.util.List; + +public class SecConfigExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public SecConfigExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andCodeTypeIsNull() { + addCriterion("code_type is null"); + return (Criteria) this; + } + + public Criteria andCodeTypeIsNotNull() { + addCriterion("code_type is not null"); + return (Criteria) this; + } + + public Criteria andCodeTypeEqualTo(String value) { + addCriterion("code_type =", value, "codeType"); + return (Criteria) this; + } + + public Criteria andCodeTypeNotEqualTo(String value) { + addCriterion("code_type <>", value, "codeType"); + return (Criteria) this; + } + + public Criteria andCodeTypeGreaterThan(String value) { + addCriterion("code_type >", value, "codeType"); + return (Criteria) this; + } + + public Criteria andCodeTypeGreaterThanOrEqualTo(String value) { + addCriterion("code_type >=", value, "codeType"); + return (Criteria) this; + } + + public Criteria andCodeTypeLessThan(String value) { + addCriterion("code_type <", value, "codeType"); + return (Criteria) this; + } + + public Criteria andCodeTypeLessThanOrEqualTo(String value) { + addCriterion("code_type <=", value, "codeType"); + return (Criteria) this; + } + + public Criteria andCodeTypeLike(String value) { + addCriterion("code_type like", value, "codeType"); + return (Criteria) this; + } + + public Criteria andCodeTypeNotLike(String value) { + addCriterion("code_type not like", value, "codeType"); + return (Criteria) this; + } + + public Criteria andCodeTypeIn(List values) { + addCriterion("code_type in", values, "codeType"); + return (Criteria) this; + } + + public Criteria andCodeTypeNotIn(List values) { + addCriterion("code_type not in", values, "codeType"); + return (Criteria) this; + } + + public Criteria andCodeTypeBetween(String value1, String value2) { + addCriterion("code_type between", value1, value2, "codeType"); + return (Criteria) this; + } + + public Criteria andCodeTypeNotBetween(String value1, String value2) { + addCriterion("code_type not between", value1, value2, "codeType"); + return (Criteria) this; + } + + public Criteria andCodeValueIsNull() { + addCriterion("code_value is null"); + return (Criteria) this; + } + + public Criteria andCodeValueIsNotNull() { + addCriterion("code_value is not null"); + return (Criteria) this; + } + + public Criteria andCodeValueEqualTo(String value) { + addCriterion("code_value =", value, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueNotEqualTo(String value) { + addCriterion("code_value <>", value, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueGreaterThan(String value) { + addCriterion("code_value >", value, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueGreaterThanOrEqualTo(String value) { + addCriterion("code_value >=", value, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueLessThan(String value) { + addCriterion("code_value <", value, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueLessThanOrEqualTo(String value) { + addCriterion("code_value <=", value, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueLike(String value) { + addCriterion("code_value like", value, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueNotLike(String value) { + addCriterion("code_value not like", value, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueIn(List values) { + addCriterion("code_value in", values, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueNotIn(List values) { + addCriterion("code_value not in", values, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueBetween(String value1, String value2) { + addCriterion("code_value between", value1, value2, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueNotBetween(String value1, String value2) { + addCriterion("code_value not between", value1, value2, "codeValue"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/service/CommonService.java b/hai-service/src/main/java/com/hai/service/CommonService.java index 7b2ab953..89dcfa6c 100644 --- a/hai-service/src/main/java/com/hai/service/CommonService.java +++ b/hai-service/src/main/java/com/hai/service/CommonService.java @@ -60,6 +60,15 @@ public interface CommonService { */ SecDictionary mappingSysCode(String codeType, String codeValue); + /** + * @ClassName CommonService.java + * @author Sum1Dream + * @version 1.0.0 + * @Description //TODO + * @createTime 14:53 2021/6/23 + **/ + Boolean findValue(String codeType, String codeValue); + /** * * @Title: mappingSysName @@ -72,6 +81,14 @@ public interface CommonService { */ SecDictionary mappingSysName(String codeType, String codeName); + /** + * @ClassName CommonService.java + * @author Sum1Dream + * @version 1.0.0 + * @Description //TODO + * @createTime 16:30 2021/6/23 + **/ + List mappingSysNameOl(String codeType); /** * 根据codeType获取该类的所有字典数据 @@ -163,6 +180,7 @@ public interface CommonService { SecRegion getParentByRegion(Long regionId); + void updateDictionary(SecDictionary secDictionary); } diff --git a/hai-service/src/main/java/com/hai/service/SecConfigService.java b/hai-service/src/main/java/com/hai/service/SecConfigService.java new file mode 100644 index 00000000..42dea3b1 --- /dev/null +++ b/hai-service/src/main/java/com/hai/service/SecConfigService.java @@ -0,0 +1,43 @@ +package com.hai.service; + +import com.hai.entity.SecConfig; + +/** + * @ClassName SecConfigService.java + * @author Sum1Dream + * @version 1.0.0 + * @Description //TODO + * @createTime 17:29 2021/6/23 + **/ +public interface SecConfigService { + + /** + * @ClassName SecConfigService.java + * @author Sum1Dream + * @version 1.0.0 + * @Description //TODO + * @createTime 17:30 2021/6/23 + **/ + SecConfig findById(Integer id); + + /** + * @ClassName SecConfigService.java + * @author Sum1Dream + * @version 1.0.0 + * @Description //TODO + * @createTime 17:31 2021/6/23 + **/ + void updateSecConfig(SecConfig secConfig); + + /** + * @ClassName SecConfigService.java + * @author Sum1Dream + * @version 1.0.0 + * @Description //TODO + * @createTime 17:36 2021/6/23 + **/ + SecConfig findByCodeType(String codeType); + + Boolean isConfig(String codeType , String codeValue); + +} diff --git a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java index aaf99a7d..c830ffe4 100644 --- a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java @@ -405,4 +405,28 @@ public class CommonServiceImpl implements CommonService { } return secRegion; } + + @Override + public Boolean findValue(String codeType, String codeValue) { + SecDictionaryExample example = new SecDictionaryExample(); + example.createCriteria().andCodeTypeEqualTo(codeType).andCodeValueEqualTo(codeValue); + + List list = dicMapper.selectByExample(example); + + return list.size() > 0; + } + + @Override + public List mappingSysNameOl(String codeType) { + SecDictionaryExample example = new SecDictionaryExample(); + example.createCriteria().andCodeTypeEqualTo(codeType); + return dicMapper.selectByExample(example); + } + + @Override + public void updateDictionary(SecDictionary secDictionary) { + dicMapper.updateByPrimaryKeySelective(secDictionary); + } + + } diff --git a/hai-service/src/main/java/com/hai/service/impl/SecConfigServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/SecConfigServiceImpl.java new file mode 100644 index 00000000..8531688e --- /dev/null +++ b/hai-service/src/main/java/com/hai/service/impl/SecConfigServiceImpl.java @@ -0,0 +1,44 @@ +package com.hai.service.impl; + +import com.hai.dao.SecConfigMapper; +import com.hai.entity.SecConfig; +import com.hai.entity.SecConfigExample; +import com.hai.entity.SecDictionary; +import com.hai.entity.SecDictionaryExample; +import com.hai.service.SecConfigService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service("secConfigServiceImpl") +public class SecConfigServiceImpl implements SecConfigService { + + @Resource + private SecConfigMapper secConfigMapper; + + @Override + public SecConfig findById(Integer id) { + return secConfigMapper.selectByPrimaryKey(id); + } + + @Override + public void updateSecConfig(SecConfig secConfig) { + secConfigMapper.updateByPrimaryKeySelective(secConfig); + } + + @Override + public SecConfig findByCodeType(String codeType) { + SecConfigExample example = new SecConfigExample(); + example.createCriteria().andCodeTypeEqualTo(codeType); + return secConfigMapper.selectByExample(example).get(0); + } + + @Override + public Boolean isConfig(String codeType, String codeValue) { + SecConfigExample example = new SecConfigExample(); + example.createCriteria().andCodeTypeEqualTo(codeType).andCodeValueEqualTo(codeValue); + List list = secConfigMapper.selectByExample(example); + return list.size() > 0; + } +}