Commit 1d6e4105 authored by sml's avatar sml

配置第二数据源azkaban提交

parent 51a717e0
package com.jz.dmp.azkaban.dao;
import java.util.List;
import java.util.Map;
import com.jz.dmp.azkaban.entity.ProjectFlows;
import com.jz.dmp.modules.controller.azkaban.bean.ProjectFlowsDto;
/** mapper
* @author ybz
*
*/
public interface ProjectFlowsMapper {
/**新增
* @param projectFlows
* @return
* @throws Exception
*/
public int insert(ProjectFlows projectFlows)throws Exception;
/**选择性增加
* @param projectFlows
* @return
* @throws Exception
*/
public int insertSelective(ProjectFlows projectFlows)throws Exception;
/**主键修改
* @param projectFlows
* @return
* @throws Exception
*/
public int updateByPrimaryKey(ProjectFlows projectFlows)throws Exception;
/**选择性修改
* @param projectFlows
* @return
* @throws Exception
*/
public int updateByPrimaryKeySelective(ProjectFlows projectFlows)throws Exception;
/**主键查询
* @param projectId
* @return
* @throws Exception
*/
public ProjectFlows selectByPrimaryKey(Integer projectId)throws Exception;
/**主键删除
* @param projectId
* @return
* @throws Exception
*/
public int deleteByPrimaryKey(Integer projectId)throws Exception;
/**主键软删除
* @param projectId
* @return
* @throws Exception
*/
public int softDeleteByPrimaryKey(Integer projectId)throws Exception;
/**主键删除
* @param projectId
* @return
* @throws Exception
*/
public int delete(Map<String, Object> param)throws Exception;
/**主键软删除
* @param projectId
* @return
* @throws Exception
*/
public int softDelete(Map<String, Object> param)throws Exception;
/**条件查询
* @param param
* @return
* @throws Exception
*/
public List<ProjectFlowsDto> findList(Map<String, Object> param)throws Exception;
/**主键查询
* @param projectId
* @return
* @throws Exception
*/
public ProjectFlowsDto findById(Integer projectId)throws Exception;
/**批量新增
* @param projectFlowss
* @throws Exception
*/
public void insertBatch(List<ProjectFlows> projectFlowss)throws Exception;
}
package com.jz.dmp.azkaban.entity;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author ybz
*
*/
@ApiModel(value = "", description = "")
public class ProjectFlows implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
*
*/
@ApiModelProperty(value = "")
private Integer projectId;
/**
*
*/
@ApiModelProperty(value = "")
private Integer version;
/**
*
*/
@ApiModelProperty(value = "")
private String flowId;
/**
*
*/
@ApiModelProperty(value = "")
private Long modifiedTime;
/**
*
*/
@ApiModelProperty(value = "")
private Byte encodingType;
/**
*
*/
@ApiModelProperty(value = "")
private String json;
public Integer getProjectId() {
return projectId;
}
public void setProjectId(Integer projectId) {
this.projectId = projectId;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public String getFlowId() {
return flowId;
}
public void setFlowId(String flowId) {
this.flowId = flowId;
}
public Long getModifiedTime() {
return modifiedTime;
}
public void setModifiedTime(Long modifiedTime) {
this.modifiedTime = modifiedTime;
}
public Byte getEncodingType() {
return encodingType;
}
public void setEncodingType(Byte encodingType) {
this.encodingType = encodingType;
}
public String getJson() {
return json;
}
public void setJson(String json) {
this.json = json;
}
}
...@@ -20,11 +20,11 @@ import com.zaxxer.hikari.HikariDataSource; ...@@ -20,11 +20,11 @@ import com.zaxxer.hikari.HikariDataSource;
* @author pactera * @author pactera
* *
*/ */
//@Configuration @Configuration
//@MapperScan(basePackages = DataSourceConfig2.PACKAGE, sqlSessionFactoryRef = "sqlSessionFactory2") @MapperScan(basePackages = DataSourceConfig2.PACKAGE, sqlSessionFactoryRef = "sqlSessionFactory2")
public class DataSourceConfig2 { public class DataSourceConfig2 {
static final String PACKAGE = "com.jz.dmp.web.ui.modules.api.repository"; static final String PACKAGE = "com.jz.dmp.azkaban.dao";
@Value("${spring.datasource2.driver-class-name}") @Value("${spring.datasource2.driver-class-name}")
private String driverClassName; private String driverClassName;
...@@ -69,7 +69,7 @@ public class DataSourceConfig2 { ...@@ -69,7 +69,7 @@ public class DataSourceConfig2 {
sessionFactory.setConfigLocation(new ClassPathResource("mybatis-config.xml")); sessionFactory.setConfigLocation(new ClassPathResource("mybatis-config.xml"));
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver() sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources("classpath:mapper/api/*.xml")); .getResources("classpath:azkabanmapper/*.xml"));
return sessionFactory.getObject(); return sessionFactory.getObject();
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
......
package com.jz.dmp.config;
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
import org.springframework.stereotype.Component;
@Component
public class SecurityInitializer extends AbstractSecurityWebApplicationInitializer {
public SecurityInitializer() {
super(SessionConfig.class);
}
}
package com.jz.dmp.config;
import java.util.List;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisClusterConfiguration;
import org.springframework.data.redis.connection.RedisNode;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
@Configuration
@EnableRedisHttpSession
@ConfigurationProperties(prefix = "spring.redis.cluster")
public class SessionConfig {
private List<String> nodes;
@Bean
public JedisConnectionFactory connectionFactory() {
RedisClusterConfiguration redisClusterConfiguration = new RedisClusterConfiguration();
nodes.stream().forEach(node->{
String[] strs = node.split(":");
String host = strs[0];
int port = Integer.parseInt(strs[1]);
RedisNode redisNode = new RedisNode(host, port);
redisClusterConfiguration.addClusterNode(redisNode);
});
return new JedisConnectionFactory(redisClusterConfiguration);
}
public List<String> getNodes() {
return nodes;
}
public void setNodes(List<String> nodes) {
this.nodes = nodes;
}
}
...@@ -6,15 +6,20 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -6,15 +6,20 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.jz.common.bean.BaseBeanResponse; import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.StatuConstant; import com.jz.common.constant.StatuConstant;
import com.jz.dmp.modules.controller.bean.DmpProjectDto; import com.jz.dmp.modules.controller.bean.DmpProjectDto;
import com.jz.dmp.modules.controller.bean.DmpProjectRequest; import com.jz.dmp.modules.controller.bean.DmpProjectRequest;
import com.jz.dmp.modules.model.DmpProject;
import com.jz.dmp.modules.service.DmpProjectService; import com.jz.dmp.modules.service.DmpProjectService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
/** /**
...@@ -35,14 +40,53 @@ public class DmpProjectController { ...@@ -35,14 +40,53 @@ public class DmpProjectController {
* @param dmpProjectRequest * @param dmpProjectRequest
* @return * @return
*/ */
@RequestMapping(method = RequestMethod.POST, value = "/findList") @RequestMapping(method = RequestMethod.POST, value = "/findListWithPage")
@ApiOperation(value = "列表查询项目信息", notes = "列表查询项目信息") @ApiOperation(value = "分頁列表查询项目信息", notes = "分頁列表查询项目信息")
public BaseBeanResponse<DmpProjectDto> findList(@RequestBody DmpProjectRequest dmpProjectRequest, HttpServletRequest httpRequest){ public PageInfoResponse<DmpProjectDto> findListWithPage(@RequestBody DmpProjectRequest dmpProjectRequest, HttpServletRequest httpRequest){
BaseBeanResponse<DmpProjectDto> baseBeanResponse = new BaseBeanResponse<DmpProjectDto>(); PageInfoResponse<DmpProjectDto> pageInfo = new PageInfoResponse<DmpProjectDto>();
try { try {
baseBeanResponse = dmpProjectService.findList(dmpProjectRequest, httpRequest); pageInfo = dmpProjectService.findListWithPage(dmpProjectRequest, httpRequest);
} catch (Exception e) { } catch (Exception e) {
baseBeanResponse.setMessage("查询失败"); pageInfo.setMessage("查询失败");
pageInfo.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return pageInfo;
}
/**软删除项目信息
* @param id
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/softDelete")
@ApiOperation(value = "软删除项目信息", notes = "软删除项目信息")
@ApiImplicitParam(name = "id", value = "项目信息主键")
public BaseResponse softDelete(@RequestParam(name = "id", required = true ) Integer id, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse();
try {
baseResponse = dmpProjectService.softDeleteById(id, httpRequest);
} catch (Exception e) {
baseResponse.setMessage("软删除失败");
baseResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseResponse;
}
/**新增项目信息
* @param dmpProjectRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/add")
@ApiOperation(value = "新增项目信息", notes = "新增项目信息")
public BaseBeanResponse<DmpProject> add(@RequestBody DmpProject dmpProject, HttpServletRequest httpRequest){
BaseBeanResponse<DmpProject> baseBeanResponse = new BaseBeanResponse<DmpProject>();
try {
baseBeanResponse = dmpProjectService.add(dmpProject, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("新增失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE); baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace(); e.printStackTrace();
} }
......
package com.jz.dmp.modules.controller.azkaban.bean;
import com.jz.dmp.azkaban.entity.ProjectFlows;
import io.swagger.annotations.ApiModel;
/**Dto
* @author ybz
*
*/
@ApiModel(value = "Dto", description = "Dto")
public class ProjectFlowsDto extends ProjectFlows {
}
...@@ -3,6 +3,7 @@ package com.jz.dmp.modules.dao; ...@@ -3,6 +3,7 @@ package com.jz.dmp.modules.dao;
import com.jz.common.persistence.CrudDao; import com.jz.common.persistence.CrudDao;
import com.jz.dmp.modules.model.DmpProject; import com.jz.dmp.modules.model.DmpProject;
import com.jz.dmp.modules.model.DmpProjectSystemInfo; import com.jz.dmp.modules.model.DmpProjectSystemInfo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -17,7 +18,9 @@ public interface DmpProjectDao extends CrudDao<DmpProject> { ...@@ -17,7 +18,9 @@ public interface DmpProjectDao extends CrudDao<DmpProject> {
public List<Map<String, ?>> getHeaderProjectList(DmpProject params); public List<Map<String, ?>> getHeaderProjectList(DmpProject params);
public void disable(Long id);public void enable(Long id); public void disable(Long id);
public void enable(Long id);
public List<Map<String, ?>> getProjectOrgPermission(); public List<Map<String, ?>> getProjectOrgPermission();
...@@ -30,4 +33,11 @@ public interface DmpProjectDao extends CrudDao<DmpProject> { ...@@ -30,4 +33,11 @@ public interface DmpProjectDao extends CrudDao<DmpProject> {
public List<DmpProjectSystemInfo> getProjectSystemInfo(Long projectId); public List<DmpProjectSystemInfo> getProjectSystemInfo(Long projectId);
DmpProjectSystemInfo queryProjectSystemInfo(Long projectId); DmpProjectSystemInfo queryProjectSystemInfo(Long projectId);
/**条件查询项目信息
* @param param
* @return
* @throws Exception
*/
public List<DmpProject> findListByMap(Map<String, Object> param)throws Exception;
} }
...@@ -3,6 +3,7 @@ package com.jz.dmp.modules.model; ...@@ -3,6 +3,7 @@ package com.jz.dmp.modules.model;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -11,7 +12,12 @@ import java.util.List; ...@@ -11,7 +12,12 @@ import java.util.List;
* *
*/ */
@ApiModel(value = "资源表", description = "资源表") @ApiModel(value = "资源表", description = "资源表")
public class DmpPermission { public class DmpPermission implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/** /**
* 资源ID * 资源ID
*/ */
......
...@@ -3,6 +3,7 @@ package com.jz.dmp.modules.model; ...@@ -3,6 +3,7 @@ package com.jz.dmp.modules.model;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
/**角色表 /**角色表
...@@ -10,7 +11,12 @@ import java.util.Date; ...@@ -10,7 +11,12 @@ import java.util.Date;
* *
*/ */
@ApiModel(value = "角色表", description = "角色表") @ApiModel(value = "角色表", description = "角色表")
public class DmpRole { public class DmpRole implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
/** /**
* 角色ID * 角色ID
*/ */
......
...@@ -18,14 +18,29 @@ import com.jz.dmp.modules.model.DmpProject; ...@@ -18,14 +18,29 @@ import com.jz.dmp.modules.model.DmpProject;
*/ */
public interface DmpProjectService { public interface DmpProjectService {
/**条件查询所有项目信息 /**条件分頁查询所有项目信息
* @param dmpProjectRequest * @param dmpProjectRequest
* @param httpRequest * @param httpRequest
* @return * @return
* @throws Exception * @throws Exception
*/ */
public BaseBeanResponse<DmpProjectDto> findList(DmpProjectRequest dmpProjectRequest, HttpServletRequest httpRequest)throws Exception; public PageInfoResponse<DmpProjectDto> findListWithPage(DmpProjectRequest dmpProjectRequest, HttpServletRequest httpRequest)throws Exception;
/**主键软删除项目信息
* @param id
* @param httpRequest
* @return
* @throws Exception
*/
public BaseResponse softDeleteById(Integer id, HttpServletRequest httpRequest)throws Exception;
/**新增项目信息
* @param dmpProject
* @param httpRequest
* @return
* @throws Exception
*/
public BaseBeanResponse<DmpProject> add(DmpProject dmpProject, HttpServletRequest httpRequest)throws Exception;
} }
package com.jz.dmp.modules.service.impl; package com.jz.dmp.modules.service.impl;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -10,15 +11,22 @@ import org.slf4j.Logger; ...@@ -10,15 +11,22 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.BaseBeanResponse; import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.StatuConstant; import com.jz.common.constant.StatuConstant;
import com.jz.common.persistence.BaseService; import com.jz.common.persistence.BaseService;
import com.jz.common.utils.web.SessionUtils;
import com.jz.dmp.modules.controller.bean.DmpProjectDto; import com.jz.dmp.modules.controller.bean.DmpProjectDto;
import com.jz.dmp.modules.controller.bean.DmpProjectRequest; import com.jz.dmp.modules.controller.bean.DmpProjectRequest;
import com.jz.dmp.modules.controller.bean.MyDmpProjectConverter; import com.jz.dmp.modules.controller.bean.MyDmpProjectConverter;
import com.jz.dmp.modules.dao.DmpProjectDao; import com.jz.dmp.modules.dao.DmpProjectDao;
import com.jz.dmp.modules.model.DmpMember;
import com.jz.dmp.modules.model.DmpProject; import com.jz.dmp.modules.model.DmpProject;
import com.jz.dmp.modules.service.DmpProjectService; import com.jz.dmp.modules.service.DmpProjectService;
...@@ -39,9 +47,9 @@ public class DmpProjectServiceImpl extends BaseService implements DmpProjectServ ...@@ -39,9 +47,9 @@ public class DmpProjectServiceImpl extends BaseService implements DmpProjectServ
* @see com.ycxc.vmts.service.DmpProjectService#findList(com.ycxc.vmts.controller.bean.DmpProjectRequest, javax.servlet.http.HttpServletRequest) * @see com.ycxc.vmts.service.DmpProjectService#findList(com.ycxc.vmts.controller.bean.DmpProjectRequest, javax.servlet.http.HttpServletRequest)
*/ */
@Override @Override
public BaseBeanResponse<DmpProjectDto> findList(DmpProjectRequest dmpProjectRequest, HttpServletRequest httpRequest) public PageInfoResponse<DmpProjectDto> findListWithPage(DmpProjectRequest dmpProjectRequest, HttpServletRequest httpRequest)
throws Exception { throws Exception {
BaseBeanResponse<DmpProjectDto> baseBeanResponse = new BaseBeanResponse<>(); PageInfoResponse<DmpProjectDto> pageInfoResponse = new PageInfoResponse<>();
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
//ID //ID
...@@ -149,13 +157,64 @@ public class DmpProjectServiceImpl extends BaseService implements DmpProjectServ ...@@ -149,13 +157,64 @@ public class DmpProjectServiceImpl extends BaseService implements DmpProjectServ
param.put("updateTimeEnd", dmpProjectRequest.getUpdateTimeEnd()); param.put("updateTimeEnd", dmpProjectRequest.getUpdateTimeEnd());
} }
List<DmpProject> dmpProjects = dmpProjectDao.getExampleQuery(param); PageHelper.startPage(dmpProjectRequest.getPageNum(), dmpProjectRequest.getPageSize());
List<DmpProject> dmpProjects = dmpProjectDao.findListByMap(param);
List<DmpProjectDto> list = MyDmpProjectConverter.INSTANCE().domain2dto(dmpProjects); List<DmpProjectDto> list = MyDmpProjectConverter.INSTANCE().domain2dto(dmpProjects);
PageInfo<DmpProjectDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(StatuConstant.SUCCESS_CODE);
pageInfoResponse.setMessage("查询成功");
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpProjectService#deleteById(com.ycxc.vmts.controller.bean.DmpProjectRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseResponse softDeleteById(Integer id, HttpServletRequest httpRequest)
throws Exception {
BaseResponse baseResponse = new BaseResponse();
dmpProjectDao.delete(id);
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("软删除成功");
return baseResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpProjectService#add(com.ycxc.vmts.entity.DmpProject, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseBeanResponse<DmpProject> add(DmpProject dmpProject, HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DmpProject> baseBeanResponse = new BaseBeanResponse<>();
DmpMember member = SessionUtils.getSecurityUser();
if (member==null) {
baseBeanResponse.setCode(StatuConstant.CODE_NOT_SIGNED);
baseBeanResponse.setMessage("用户未登录");
return baseBeanResponse;
}
//设置拥有者
dmpProject.setOwnerId(member.getUsername());
//创建人
dmpProject.setCreateUserId(member.getUserId().toString());
//创建时间
dmpProject.setCreateTime(new Date());
//默认data_status
dmpProject.setDataStatus("1");
dmpProjectDao.insert(dmpProject);
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE); baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("查询成功"); baseBeanResponse.setMessage("新增成功");
baseBeanResponse.setDatas(list); baseBeanResponse.setData(dmpProject);
return baseBeanResponse; return baseBeanResponse;
} }
......
...@@ -22,10 +22,10 @@ spring: ...@@ -22,10 +22,10 @@ spring:
connectionTimeout: 30000 connectionTimeout: 30000
idleTimeout: 600000 idleTimeout: 600000
datasource2: datasource2:
url: jdbc:mysql://119.23.32.151:3306/dmp_openapi?characterEncoding=utf8&autoReconnect=true&useSSL=false url: jdbc:mysql://192.168.1.221:3306/azkaban?characterEncoding=utf8&autoReconnect=true&useSSL=false
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
username: dmp username: root
password: Ioubuy@2019@! password:
hikari: hikari:
maxLifetime: 1765000 maxLifetime: 1765000
maximumPoolSize: 20 maximumPoolSize: 20
...@@ -60,18 +60,6 @@ spring: ...@@ -60,18 +60,6 @@ spring:
starttls: starttls:
enable: true enable: true
required: true required: true
# ldap:
# urls: ldap://localhost:389
# base: dc=maxcrc,dc=com
# username: cn=Manager,dc=maxcrc,dc=com
# password: secret
ldap:
urls: ldap://120.78.64.146:389
base: dc=ioubuy,dc=cn
username: cn=Manager,dc=ioubuy,dc=cn
password: 'Ioubuy123'
remote: remote:
execute: execute:
......
<?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.jz.dmp.azkaban.dao.ProjectFlowsMapper" >
<resultMap id="BaseResultMap" type="com.jz.dmp.azkaban.entity.ProjectFlows">
<result column="project_id" property="projectId" jdbcType="INTEGER" />
<result column="version" property="version" jdbcType="INTEGER" />
<result column="flow_id" property="flowId" jdbcType="VARCHAR" />
<result column="modified_time" property="modifiedTime" jdbcType="BIGINT" />
<result column="encoding_type" property="encodingType" jdbcType="TINYINT" />
<result column="json" property="json" jdbcType="BLOB" />
</resultMap>
<resultMap id="BaseDtoResultMap" type="com.jz.dmp.modules.controller.azkaban.bean.ProjectFlowsDto" extends="BaseResultMap">
<!-- /*$BaseDtoResultMapContent$*/ -->
</resultMap>
<sql id="Base_Column_List">
project_id, version, flow_id, modified_time, encoding_type,
json
</sql>
<sql id="BaseDto_Column_List">
<include refid="Base_Column_List" />
<!-- /*$BaseDtoColumnListContent$*/ -->
</sql>
<!-- 根据主键查询 -->
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List" />
from project_flows
where project_id = #{projectId,jdbcType=INTEGER}
AND data_status='1'
</select>
<!-- 根据主键删除 -->
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from project_flows
where project_id = #{projectId,jdbcType=INTEGER}
</delete>
<!-- 根据主键软删除 -->
<update id="softDeleteByPrimaryKey" parameterType="java.lang.String">
update project_flows
<set>
data_status = '0'
</set>
where project_id = #{projectId,jdbcType=INTEGER}
</update>
<!-- 条件删除 -->
<delete id="delete" parameterType="java.lang.String">
delete from project_flows
<where>
<if test="projectId != null" >
AND project_id = #{projectId,jdbcType=INTEGER}
</if>
<if test="version != null" >
AND version = #{version,jdbcType=INTEGER}
</if>
<if test="flowId != null" >
AND flow_id = #{flowId,jdbcType=VARCHAR}
</if>
<if test="modifiedTime != null" >
AND modified_time = #{modifiedTime,jdbcType=BIGINT}
</if>
<if test="encodingType != null" >
AND encoding_type = #{encodingType,jdbcType=TINYINT}
</if>
<if test="json != null" >
AND json = #{json,jdbcType=BLOB}
</if>
AND data_status='1'
</where>
</delete>
<!-- 条件软删除 -->
<update id="softDelete" parameterType="java.lang.String">
update project_flows
<set>
data_status = '0'
</set>
<where>
<if test="projectId != null" >
AND project_id = #{projectId,jdbcType=INTEGER}
</if>
<if test="version != null" >
AND version = #{version,jdbcType=INTEGER}
</if>
<if test="flowId != null" >
AND flow_id = #{flowId,jdbcType=VARCHAR}
</if>
<if test="modifiedTime != null" >
AND modified_time = #{modifiedTime,jdbcType=BIGINT}
</if>
<if test="encodingType != null" >
AND encoding_type = #{encodingType,jdbcType=TINYINT}
</if>
<if test="json != null" >
AND json = #{json,jdbcType=BLOB}
</if>
AND data_status='1'
</where>
</update>
<!-- 插入 -->
<insert id="insert" parameterType="com.jz.dmp.azkaban.entity.ProjectFlows">
insert into project_flows (
project_id, version, flow_id, modified_time, encoding_type,
json
)
values (
#{projectId,jdbcType=INTEGER}, #{version,jdbcType=INTEGER}, #{flowId,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=BIGINT}, #{encodingType,jdbcType=TINYINT},
#{json,jdbcType=BLOB}
)
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="com.jz.dmp.azkaban.entity.ProjectFlows">
insert into project_flows (
project_id, version, flow_id, modified_time, encoding_type,
json
)
values
<foreach collection="list" item="item" separator=",">
(
#{item.projectId,jdbcType=INTEGER}, #{item.version,jdbcType=INTEGER}, #{item.flowId,jdbcType=VARCHAR}, #{item.modifiedTime,jdbcType=BIGINT}, #{item.encodingType,jdbcType=TINYINT},
#{item.json,jdbcType=BLOB}
)
</foreach>
</insert>
<!-- 选择性插入 -->
<insert id="insertSelective" parameterType="com.jz.dmp.azkaban.entity.ProjectFlows">
insert into project_flows
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="projectId != null" >
project_id,
</if>
<if test="version != null" >
version,
</if>
<if test="flowId != null" >
flow_id,
</if>
<if test="modifiedTime != null" >
modified_time,
</if>
<if test="encodingType != null" >
encoding_type,
</if>
<if test="json != null" >
json,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectId != null" >
#{projectId,jdbcType=INTEGER},
</if>
<if test="version != null" >
#{version,jdbcType=INTEGER},
</if>
<if test="flowId != null" >
#{flowId,jdbcType=VARCHAR},
</if>
<if test="modifiedTime != null" >
#{modifiedTime,jdbcType=BIGINT},
</if>
<if test="encodingType != null" >
#{encodingType,jdbcType=TINYINT},
</if>
<if test="json != null" >
#{json,jdbcType=BLOB},
</if>
</trim>
</insert>
<!-- 修改 -->
<update id="updateByPrimaryKey" parameterType="com.jz.dmp.azkaban.entity.ProjectFlows">
update project_flows set
project_id = #{projectId,jdbcType=INTEGER},
version = #{version,jdbcType=INTEGER},
flow_id = #{flowId,jdbcType=VARCHAR},
modified_time = #{modifiedTime,jdbcType=BIGINT},
encoding_type = #{encodingType,jdbcType=TINYINT},
json = #{json,jdbcType=BLOB}
where project_id = #{projectId,jdbcType=INTEGER}
</update>
<!-- 选择性修改 -->
<update id="updateByPrimaryKeySelective" parameterType="com.jz.dmp.azkaban.entity.ProjectFlows">
update project_flows
<set>
<if test="projectId != null" >
project_id = #{projectId,jdbcType=INTEGER},
</if>
<if test="version != null" >
version = #{version,jdbcType=INTEGER},
</if>
<if test="flowId != null" >
flow_id = #{flowId,jdbcType=VARCHAR},
</if>
<if test="modifiedTime != null" >
modified_time = #{modifiedTime,jdbcType=BIGINT},
</if>
<if test="encodingType != null" >
encoding_type = #{encodingType,jdbcType=TINYINT},
</if>
<if test="json != null" >
json = #{json,jdbcType=BLOB},
</if>
</set>
where project_id = #{projectId,jdbcType=INTEGER}
</update>
<!-- 条件查询 -->
<select id="findList" resultMap="BaseDtoResultMap">
SELECT
<include refid="BaseDto_Column_List"/>
FROM project_flows
<where>
<if test="projectId != null" >
AND project_id = #{projectId,jdbcType=INTEGER}
</if>
<if test="version != null" >
AND version = #{version,jdbcType=INTEGER}
</if>
<if test="flowId != null" >
AND flow_id = #{flowId,jdbcType=VARCHAR}
</if>
<if test="modifiedTime != null" >
AND modified_time = #{modifiedTime,jdbcType=BIGINT}
</if>
<if test="encodingType != null" >
AND encoding_type = #{encodingType,jdbcType=TINYINT}
</if>
<if test="json != null" >
AND json = #{json,jdbcType=BLOB}
</if>
AND data_status='1'
</where>
</select>
<!-- 主键查询 -->
<select id="findById" resultMap="BaseDtoResultMap" parameterType="java.lang.String">
select
<include refid="BaseDto_Column_List" />
from project_flows
where project_id = #{projectId,jdbcType=INTEGER}
AND data_status='1'
</select>
</mapper>
...@@ -63,9 +63,30 @@ ...@@ -63,9 +63,30 @@
FROM dmp_project WHERE data_status = '1' and id = #{id} FROM dmp_project WHERE data_status = '1' and id = #{id}
</select> </select>
<select id="findList" parameterType="com.jz.dmp.modules.model.DmpProject" resultType="com.jz.dmp.modules.model.DmpProject"> <select id="findList"
SELECT <include refid="FIND_ALL_COLUMN" /> FROM dmp_project WHERE 1=1 parameterType="com.jz.dmp.modules.model.DmpProject"
<if test="ownerId != null">AND owner_id = #{ownerId}</if><if test="productionId != null">AND production_id = #{productionId}</if><if test="dataWarehouseId != null">AND data_warehouse_id = #{dataWarehouseId}</if><if test="name != null">AND name = #{name}</if><if test="displayName != null">AND display_name = #{displayName}</if><if test="projectDesc != null">AND project_desc = #{projectDesc}</if><if test="publishTargetId != null">AND publish_target_id = #{publishTargetId}</if><if test="isEnableScheduler != null">AND is_enable_scheduler = #{isEnableScheduler}</if><if test="isEditTaskCode != null">AND is_edit_task_code = #{isEditTaskCode}</if><if test="isEnableSelect != null">AND is_enable_select = #{isEnableSelect}</if><if test="dwName != null">AND dw_name = #{dwName}</if><if test="dwAccessType != null">AND dw_access_type = #{dwAccessType}</if><if test="dwIsEnableAcl != null">AND dw_is_enable_acl = #{dwIsEnableAcl}</if><if test="dwIsEnableAccessObj != null">AND dw_is_enable_access_obj = #{dwIsEnableAccessObj}</if><if test="dwIsEnableAuthObj != null">AND dw_is_enable_auth_obj = #{dwIsEnableAuthObj}</if><if test="dwIsProtectData != null">AND dw_is_protect_data = #{dwIsProtectData}</if><if test="dataStatus != null">AND data_status = #{dataStatus}</if> resultType="com.jz.dmp.modules.model.DmpProject">
SELECT
<include refid="FIND_ALL_COLUMN" />
FROM dmp_project
WHERE data_status <![CDATA[<>]]> '0'
<if test="ownerId != null">AND owner_id = #{ownerId}</if>
<if test="productionId != null">AND production_id = #{productionId}</if>
<if test="dataWarehouseId != null">AND data_warehouse_id = #{dataWarehouseId}</if>
<if test="name != null">AND name = #{name}</if>
<if test="displayName != null">AND display_name = #{displayName}</if>
<if test="projectDesc != null">AND project_desc = #{projectDesc}</if>
<if test="publishTargetId != null">AND publish_target_id = #{publishTargetId}</if>
<if test="isEnableScheduler != null">AND is_enable_scheduler = #{isEnableScheduler}</if>
<if test="isEditTaskCode != null">AND is_edit_task_code = #{isEditTaskCode}</if>
<if test="isEnableSelect != null">AND is_enable_select = #{isEnableSelect}</if>
<if test="dwName != null">AND dw_name = #{dwName}</if>
<if test="dwAccessType != null">AND dw_access_type = #{dwAccessType}</if>
<if test="dwIsEnableAcl != null">AND dw_is_enable_acl = #{dwIsEnableAcl}</if>
<if test="dwIsEnableAccessObj != null">AND dw_is_enable_access_obj = #{dwIsEnableAccessObj}</if>
<if test="dwIsEnableAuthObj != null">AND dw_is_enable_auth_obj = #{dwIsEnableAuthObj}</if>
<if test="dwIsProtectData != null">AND dw_is_protect_data = #{dwIsProtectData}</if>
<if test="dataStatus != null">AND data_status = #{dataStatus}</if>
</select> </select>
<select id="findAllList" resultType="com.jz.dmp.modules.model.DmpProject"> <select id="findAllList" resultType="com.jz.dmp.modules.model.DmpProject">
...@@ -511,4 +532,29 @@ ...@@ -511,4 +532,29 @@
WHERE data_status = '1' and PROJECT_ID = #{projectId} WHERE data_status = '1' and PROJECT_ID = #{projectId}
</select> </select>
<select id="findListByMap"
resultType="com.jz.dmp.modules.model.DmpProject">
SELECT
<include refid="FIND_ALL_COLUMN" />
FROM dmp_project
WHERE data_status <![CDATA[<>]]> '0'
<if test="ownerId != null">AND owner_id = #{ownerId}</if>
<if test="productionId != null">AND production_id = #{productionId}</if>
<if test="dataWarehouseId != null">AND data_warehouse_id = #{dataWarehouseId}</if>
<if test="name != null">AND name = #{name}</if>
<if test="displayName != null">AND display_name = #{displayName}</if>
<if test="projectDesc != null">AND project_desc = #{projectDesc}</if>
<if test="publishTargetId != null">AND publish_target_id = #{publishTargetId}</if>
<if test="isEnableScheduler != null">AND is_enable_scheduler = #{isEnableScheduler}</if>
<if test="isEditTaskCode != null">AND is_edit_task_code = #{isEditTaskCode}</if>
<if test="isEnableSelect != null">AND is_enable_select = #{isEnableSelect}</if>
<if test="dwName != null">AND dw_name = #{dwName}</if>
<if test="dwAccessType != null">AND dw_access_type = #{dwAccessType}</if>
<if test="dwIsEnableAcl != null">AND dw_is_enable_acl = #{dwIsEnableAcl}</if>
<if test="dwIsEnableAccessObj != null">AND dw_is_enable_access_obj = #{dwIsEnableAccessObj}</if>
<if test="dwIsEnableAuthObj != null">AND dw_is_enable_auth_obj = #{dwIsEnableAuthObj}</if>
<if test="dwIsProtectData != null">AND dw_is_protect_data = #{dwIsProtectData}</if>
<if test="dataStatus != null">AND data_status = #{dataStatus}</if>
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment