Conflicts:
	base-webapp/pom.xml
	pom.xml
This commit is contained in:
lvleigang 2024-09-14 14:23:02 +08:00
commit 3f68f17d62
7 changed files with 294 additions and 0 deletions

48
fw-nc/pom.xml Normal file
View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>kangarooDataCenterV3</artifactId>
<groupId>com.hzya.frame</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>fw-nc</artifactId>
<packaging>jar</packaging>
<version>${revision}</version>
<dependencies>
<dependency>
<groupId>com.hzya.frame</groupId>
<artifactId>base-service</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>none</mainClass> <!-- 取消查找本项目下的Main方法为了解决Unable to find main class的问题 -->
<classifier>execute</classifier> <!-- 为了解决依赖模块找不到此模块中的类或属性 -->
<skip>true</skip>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,27 @@
package com.hzya.frame.nc.entity;
import com.alibaba.fastjson2.JSON;
import com.hzya.frame.web.entity.BaseEntity;
import lombok.ToString;
/**
* @Content
* @Author 👻👻👻👻👻👻👻👻👻👻 gjh
* @Date 2023-06-14 10:20
* @Version 1.0
*/
//@ToString(callSuper=true)
public class NcInterface extends BaseEntity {
public static void main(String[] args) {
NcInterface s = new NcInterface();
s.setId("2");
s.setLimit(1L);
s.setSts("Y");
String str = JSON.toJSONString(s);
//System.out.println(str);
NcInterface s2 = JSON.parseObject(str,NcInterface.class);
//System.out.println(JSON.toJSONString(s2));
}
}

View File

@ -0,0 +1,31 @@
<?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.hzya.frame.nc.entity.NcInterface">
<resultMap id="get-entity-result" type="com.hzya.frame.nc.entity.NcInterface">
<!--主键 -->
<result property="id" column="id" />
</resultMap>
<sql id="Sysproduct_Base_Column_List">
ID as id,
code as code,
name as name,
classify as classify,
description as description,
production_company as production_company,
picture_path as picture_path,
sys_type as sys_type,
sorts as sorts,
org_id as org_id,
sts as sts,
create_user_id as create_user_id,
create_time as create_time,
modify_time as modify_time,
modify_user_id as modify_user_id
</sql>
<!-- 修改 -->
<update id="test_update_user" parameterType="com.hzya.frame.nc.entity.NcInterface">
update sys_user SET view_name = '超级管理员221' WHERE login_name = 'admin'
</update>
</mapper>

View File

@ -0,0 +1,26 @@
package com.hzya.frame.nc.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.hzya.frame.web.entity.JsonResultEntity;
/**
* @Content
* @Author 👻👻👻👻👻👻👻👻👻👻 gjh
* @Date 2023-06-13 14:13
* @Version 1.0
*/
public interface INcInterfaceService {
void queryNccBasicArchives(JSONObject req);
//@DSTransactional()
//JsonResultEntity updateUser(JSONObject jsonObject);
@DS("dataSource1")
int updateUser1(JSONObject jsonObject);
@DS("dataSource2")
int updateUser2(JSONObject jsonObject);
}

View File

@ -0,0 +1,10 @@
package com.hzya.frame.nc.service;
/**
* @Content
* @Author 👻👻👻👻👻👻👻👻👻👻 gjh
* @Date 2023-06-15 15:20
* @Version 1.0
*/
public interface Test01 {
}

View File

@ -0,0 +1,146 @@
package com.hzya.frame.nc.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
//import com.hzya.frame.demo.bean.Test;
//import com.hzya.frame.demo.mapper.TestMapper;
import com.hzya.frame.nc.entity.NcInterface;
import com.hzya.frame.nc.service.INcInterfaceService;
import com.hzya.frame.sys.user.service.IUserService;
import com.hzya.frame.web.action.ApplicationContextUtil;
import com.hzya.frame.web.entity.JsonResultEntity;
import com.hzya.frame.web.exception.BaseSystemException;
import org.apache.ibatis.session.SqlSessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* @Content
* @Author 👻👻👻👻👻👻👻👻👻👻 gjh
* @Date 2023-06-13 14:29
* @Version 1.0
*/
@Service(value = "ncInterfaceService")
public class NcInterfaceServiceImpl implements INcInterfaceService {
public final static Logger log = LoggerFactory.getLogger(NcInterfaceServiceImpl.class);
// @Resource
// private TestMapper testMapper;
@Resource
private IUserService userService;
@Override
public void queryNccBasicArchives(JSONObject req) {
JSONObject jsonStrObj = req.getJSONObject("jsonStr");
//基础档案类型
String type = jsonStrObj.getString("type");
//查询的参数
JSONObject queryParameters = jsonStrObj.getJSONObject("queryParameters");
switch (type) {
case "1":
//供应商视图
String view_name = "v_hzya_nc_supplier";
//验证参数是否存在视图内
checkingParametersKeyEffective(view_name, queryParameters);
break;
case "2":
break;
case "3":
break;
default:
throw new BaseSystemException("未匹配到档案类型!请确认档案类型 1、客户2、供应商3、人员、4项目");
}
}
/****
* 根据视图名称验证查询前参数是否有效
* @content:
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-08 16:20
* @param
* @return void
**/
private void checkingParametersKeyEffective(String view_name, JSONObject queryParameters) {
//查询视图所有列
List<String> viewFields = new ArrayList<>();
StringBuffer buffer = new StringBuffer();
for (String key : queryParameters.keySet()) {
boolean flag = viewFields.contains(key);
//不包含key的时候说明查询参数在视图内不存在需要抛出去异常
if (!flag) {
buffer.append("参数code" + key + "在视图内不存在!请检查后在传递查询。\n");
}
}
if (buffer.length() > 1) {
throw new BaseSystemException(buffer.toString());
}
}
// @Override
// public JsonResultEntity updateUser(JSONObject jsonObject) {
//
// NcInterface s2 = JSON.parseObject(jsonObject.getString("jsonStr"),NcInterface.class);
// //System.out.println(JSON.toJSONString(s2));
// userService.updateEntity(jsonObject);
//// int as = 1/0;
// JsonResultEntity jsonResultEntity = new JsonResultEntity();
//
//
// jsonResultEntity.setFlag(true);
//// throw new RuntimeException("系统异常");
// return jsonResultEntity;
// }
@Override
// @DS("dataSource1")
public int updateUser1(JSONObject jsonObject) {
// List<WhereCriterion> whereList = new ArrayList<>();
// WhereCriterion loginCondition = new WhereCriterion("", "login_name", ConditionType.等于.getValue(), "admin", "", ConnectType.AND);
// whereList.add(loginCondition);
// List<ModifyCriterion> modifyExamples = new ArrayList<>();
// ModifyCriterion modifyCriterion = new ModifyCriterion();
// modifyCriterion.setFiledName("view_name");
// modifyCriterion.setFiledValue("超级管理员1");
// modifyCriterion.setStringValue(true);
// modifyExamples.add(modifyCriterion);
SqlSessionFactory s = ApplicationContextUtil.getBeanByClass(SqlSessionFactory.class);
if (s == null) {
s = (SqlSessionFactory) ApplicationContextUtil.getBeanByName("mySqlSessionFactory");
}
Integer result = s.openSession().update("com.hzya.frame.nc.entity.NcInterface.test_update_user");
// Integer result = baseDaoUtilImpl.update("sys_user",modifyExamples,whereList);
log.info("ya251修改人员结果" + result);
return result;
}
@Override
// @DS("dataSource2")
public int updateUser2(JSONObject jsonObject) {
// List<WhereCriterion> whereList = new ArrayList<>();
// WhereCriterion loginCondition = new WhereCriterion("", "login_name", ConditionType.等于.getValue(), "admin", "", ConnectType.AND);
// whereList.add(loginCondition);
// List<ModifyCriterion> modifyExamples = new ArrayList<>();
// ModifyCriterion modifyCriterion = new ModifyCriterion();
// modifyCriterion.setFiledName("view_name");
// modifyCriterion.setFiledValue("超级管理员3");
// modifyCriterion.setStringValue(true);
// modifyExamples.add(modifyCriterion);
// DataSourceUtil.getDefaultSqlSession()
SqlSessionFactory s = ApplicationContextUtil.getBeanByClass(SqlSessionFactory.class);
Integer result = s.openSession().update("test_update_user");
// Integer result = baseDaoUtilImpl.update("sys_user",modifyExamples,whereList);
log.info("ya237修改人员结果" + result);
return result;
}
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
</web-app>