Commit 93bd69b0 authored by sml's avatar sml

代码提交

parent a0981050
...@@ -56,6 +56,25 @@ public class DmpProjectController { ...@@ -56,6 +56,25 @@ public class DmpProjectController {
return pageInfo; return pageInfo;
} }
/**列表查询项目信息
* @param dmpProjectRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/findList")
@ApiOperation(value = "列表查询项目信息", notes = "列表查询项目信息")
public BaseBeanResponse<DmpProjectDto> findList(@RequestBody DmpProjectRequest dmpProjectRequest, HttpServletRequest httpRequest){
BaseBeanResponse<DmpProjectDto> baseBeanResponse = new BaseBeanResponse<DmpProjectDto>();
try {
baseBeanResponse = dmpProjectService.findList(dmpProjectRequest, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("查询失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**软删除项目信息 /**软删除项目信息
* @param id * @param id
* @return * @return
......
package com.jz.dmp.modules.controller.sys; package com.jz.dmp.modules.controller.sys;
import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -98,16 +101,22 @@ public class DmpMemberController { ...@@ -98,16 +101,22 @@ public class DmpMemberController {
} }
/**删除用户表 /**删除用户表
* @param dmpMemberRequest * @param userId
* @return * @return
*/ */
//@RequestMapping(method = RequestMethod.GET, value = "/delete") //@RequestMapping(method = RequestMethod.GET, value = "/delete")
//@ApiOperation(value = "删除用户表", notes = "删除用户表") //@ApiOperation(value = "删除用户表", notes = "删除用户表")
//@ApiImplicitParam(name = "userId", value = "用户表主键") //@ApiImplicitParam(name = "ids", value = "用户表主键集(逗号隔开)")
public BaseResponse delete(@RequestParam(name = "userId", required = true ) Integer userId, HttpServletRequest httpRequest){ public BaseResponse delete(@RequestParam(name = "ids", required = true ) String ids, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse(); BaseResponse baseResponse = new BaseResponse();
try { try {
baseResponse = dmpMemberService.deleteById(userId, httpRequest); //参数封装
String[] idStrs = ids.split(",");
List<Integer> idList = Arrays.asList(idStrs).stream().map(x->{
return Integer.parseInt(x);
}).collect(Collectors.toList());
baseResponse = dmpMemberService.deleteByIds(idList, httpRequest);
} catch (Exception e) { } catch (Exception e) {
baseResponse.setMessage("删除失败"); baseResponse.setMessage("删除失败");
baseResponse.setCode(StatuConstant.FAILURE_CODE); baseResponse.setCode(StatuConstant.FAILURE_CODE);
...@@ -123,11 +132,17 @@ public class DmpMemberController { ...@@ -123,11 +132,17 @@ public class DmpMemberController {
*/ */
@RequestMapping(method = RequestMethod.GET, value = "/softDelete") @RequestMapping(method = RequestMethod.GET, value = "/softDelete")
@ApiOperation(value = "软删除用户表", notes = "软删除用户表") @ApiOperation(value = "软删除用户表", notes = "软删除用户表")
@ApiImplicitParam(name = "userId", value = "用户表主键") @ApiImplicitParam(name = "ids", value = "用户表主键集(逗号隔开)")
public BaseResponse softDelete(@RequestParam(name = "userId", required = true ) Integer userId, HttpServletRequest httpRequest){ public BaseResponse softDelete(@RequestParam(name = "ids", required = true ) String ids, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse(); BaseResponse baseResponse = new BaseResponse();
try { try {
baseResponse = dmpMemberService.softDeleteById(userId, httpRequest); //参数封装
String[] idStrs = ids.split(",");
List<Integer> idList = Arrays.asList(idStrs).stream().map(x->{
return Integer.parseInt(x);
}).collect(Collectors.toList());
baseResponse = dmpMemberService.softDeleteByIds(idList, httpRequest);
} catch (Exception e) { } catch (Exception e) {
baseResponse.setMessage("软删除失败"); baseResponse.setMessage("软删除失败");
baseResponse.setCode(StatuConstant.FAILURE_CODE); baseResponse.setCode(StatuConstant.FAILURE_CODE);
......
...@@ -3,6 +3,8 @@ package com.jz.dmp.modules.dao.sys; ...@@ -3,6 +3,8 @@ package com.jz.dmp.modules.dao.sys;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberDto; import com.jz.dmp.modules.controller.sys.bean.DmpMemberDto;
import com.jz.dmp.modules.model.DmpMember; import com.jz.dmp.modules.model.DmpMember;
...@@ -92,4 +94,24 @@ public interface DmpMemberMapper { ...@@ -92,4 +94,24 @@ public interface DmpMemberMapper {
*/ */
public DmpMember findByUserName(String userName)throws Exception; public DmpMember findByUserName(String userName)throws Exception;
/**
* @Title: deleteByIds
* @Description: TODO(批量删除)
* @param @param idList
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
public void deleteByIds(@Param("idList")List<Integer> idList)throws Exception;
/**
* @Title: softDeleteByIds
* @Description: TODO(批量软删除)
* @param @param idList
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
public void softDeleteByIds(@Param("idList")List<Integer> idList)throws Exception;
} }
...@@ -3,6 +3,8 @@ package com.jz.dmp.modules.model; ...@@ -3,6 +3,8 @@ package com.jz.dmp.modules.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
/** /**
* 项目信息(DmpProject)实体类 * 项目信息(DmpProject)实体类
* *
...@@ -90,6 +92,7 @@ public class DmpProject implements Serializable { ...@@ -90,6 +92,7 @@ public class DmpProject implements Serializable {
/** /**
* 数据创建时间 * 数据创建时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
/** /**
* 创建用户ID * 创建用户ID
...@@ -102,6 +105,7 @@ public class DmpProject implements Serializable { ...@@ -102,6 +105,7 @@ public class DmpProject implements Serializable {
/** /**
* 数据更新时间 * 数据更新时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
......
...@@ -27,6 +27,14 @@ public interface DmpProjectService { ...@@ -27,6 +27,14 @@ public interface DmpProjectService {
*/ */
public PageInfoResponse<DmpProjectDto> findListWithPage(DmpProjectRequest dmpProjectRequest, HttpServletRequest httpRequest)throws Exception; public PageInfoResponse<DmpProjectDto> findListWithPage(DmpProjectRequest dmpProjectRequest, HttpServletRequest httpRequest)throws Exception;
/**条件查询所有项目信息
* @param dmpProjectRequest
* @param httpRequest
* @return
* @throws Exception
*/
public BaseBeanResponse<DmpProjectDto> findList(DmpProjectRequest dmpProjectRequest, HttpServletRequest httpRequest)throws Exception;
/**主键软删除项目信息 /**主键软删除项目信息
* @param id * @param id
* @param httpRequest * @param httpRequest
......
...@@ -174,6 +174,129 @@ public class DmpProjectServiceImpl extends BaseService implements DmpProjectServ ...@@ -174,6 +174,129 @@ public class DmpProjectServiceImpl extends BaseService implements DmpProjectServ
return pageInfoResponse; return pageInfoResponse;
} }
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpProjectService#findList(com.ycxc.vmts.controller.bean.DmpProjectRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
public BaseBeanResponse<DmpProjectDto> findList(DmpProjectRequest dmpProjectRequest, HttpServletRequest httpRequest)
throws Exception {
BaseBeanResponse<DmpProjectDto> baseBeanResponse = new BaseBeanResponse<>();
Map<String, Object> param = new HashMap<>();
//ID
if (dmpProjectRequest.getId() != null) {
param.put("id", dmpProjectRequest.getId());
}
//管理员帐号
if (!StringUtils.isEmpty(dmpProjectRequest.getOwnerId())) {
param.put("ownerId", dmpProjectRequest.getOwnerId());
}
//生产帐号
if (!StringUtils.isEmpty(dmpProjectRequest.getProductionId())) {
param.put("productionId", dmpProjectRequest.getProductionId());
}
//数据仓库帐号
if (!StringUtils.isEmpty(dmpProjectRequest.getDataWarehouseId())) {
param.put("dataWarehouseId", dmpProjectRequest.getDataWarehouseId());
}
//项目名称
if (!StringUtils.isEmpty(dmpProjectRequest.getName())) {
param.put("name", dmpProjectRequest.getName());
}
//项目显示名称
if (!StringUtils.isEmpty(dmpProjectRequest.getDisplayName())) {
param.put("displayName", dmpProjectRequest.getDisplayName());
}
//项目描述
if (!StringUtils.isEmpty(dmpProjectRequest.getProjectDesc())) {
param.put("projectDesc", dmpProjectRequest.getProjectDesc());
}
//发布目标
if (dmpProjectRequest.getPublishTargetId() != null) {
param.put("publishTargetId", dmpProjectRequest.getPublishTargetId());
}
//启动调度周期
if (!StringUtils.isEmpty(dmpProjectRequest.getIsEnableScheduler())) {
param.put("isEnableScheduler", dmpProjectRequest.getIsEnableScheduler());
}
//允许在本项目中直接编辑任务和代码
if (!StringUtils.isEmpty(dmpProjectRequest.getIsEditTaskCode())) {
param.put("isEditTaskCode", dmpProjectRequest.getIsEditTaskCode());
}
//能否下载select结果
if (!StringUtils.isEmpty(dmpProjectRequest.getIsEnableSelect())) {
param.put("isEnableSelect", dmpProjectRequest.getIsEnableSelect());
}
//数据仓库项目名称
if (!StringUtils.isEmpty(dmpProjectRequest.getDwName())) {
param.put("dwName", dmpProjectRequest.getDwName());
}
//数据仓库访问身份类型
if (!StringUtils.isEmpty(dmpProjectRequest.getDwAccessType())) {
param.put("dwAccessType", dmpProjectRequest.getDwAccessType());
}
//使用ACL授权
if (!StringUtils.isEmpty(dmpProjectRequest.getDwIsEnableAcl())) {
param.put("dwIsEnableAcl", dmpProjectRequest.getDwIsEnableAcl());
}
//允许对象创建者访问对象
if (!StringUtils.isEmpty(dmpProjectRequest.getDwIsEnableAccessObj())) {
param.put("dwIsEnableAccessObj", dmpProjectRequest.getDwIsEnableAccessObj());
}
//允许对象创建者授权对象
if (!StringUtils.isEmpty(dmpProjectRequest.getDwIsEnableAuthObj())) {
param.put("dwIsEnableAuthObj", dmpProjectRequest.getDwIsEnableAuthObj());
}
//项目空间数据保护
if (!StringUtils.isEmpty(dmpProjectRequest.getDwIsProtectData())) {
param.put("dwIsProtectData", dmpProjectRequest.getDwIsProtectData());
}
//数据状态
if (!StringUtils.isEmpty(dmpProjectRequest.getDataStatus())) {
param.put("dataStatus", dmpProjectRequest.getDataStatus());
}
//创建用户ID
if (!StringUtils.isEmpty(dmpProjectRequest.getCreateUserId())) {
param.put("createUserId", dmpProjectRequest.getCreateUserId());
}
//数据创建时间起
if (dmpProjectRequest.getCreateTimeStart() != null) {
param.put("createTimeStart", dmpProjectRequest.getCreateTimeStart());
}
//数据创建时间止
if (dmpProjectRequest.getCreateTimeEnd() != null) {
param.put("createTimeEnd", dmpProjectRequest.getCreateTimeEnd());
}
//创建用户ID
if (!StringUtils.isEmpty(dmpProjectRequest.getUpdateUserId())) {
param.put("updateUserId", dmpProjectRequest.getUpdateUserId());
}
//
if (!StringUtils.isEmpty(dmpProjectRequest.getImpalaJdbcUrl())) {
param.put("impalaJdbcUrl", dmpProjectRequest.getImpalaJdbcUrl());
}
//
if (!StringUtils.isEmpty(dmpProjectRequest.getImpalaMasterFqdn())) {
param.put("impalaMasterFqdn", dmpProjectRequest.getImpalaMasterFqdn());
}
//数据更新时间起
if (dmpProjectRequest.getUpdateTimeStart() != null) {
param.put("updateTimeStart", dmpProjectRequest.getUpdateTimeStart());
}
//数据更新时间止
if (dmpProjectRequest.getUpdateTimeEnd() != null) {
param.put("updateTimeEnd", dmpProjectRequest.getUpdateTimeEnd());
}
List<DmpProject> dmpProjects = dmpProjectDao.findListByMap(param);
List<DmpProjectDto> list = MyDmpProjectConverter.INSTANCE().domain2dto(dmpProjects);
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("查询成功");
baseBeanResponse.setDatas(list);
return baseBeanResponse;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpProjectService#deleteById(com.ycxc.vmts.controller.bean.DmpProjectRequest, javax.servlet.http.HttpServletRequest) * @see com.ycxc.vmts.service.DmpProjectService#deleteById(com.ycxc.vmts.controller.bean.DmpProjectRequest, javax.servlet.http.HttpServletRequest)
*/ */
......
package com.jz.dmp.modules.service.sys; package com.jz.dmp.modules.service.sys;
import java.util.List;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -120,4 +121,28 @@ public interface DmpMemberService { ...@@ -120,4 +121,28 @@ public interface DmpMemberService {
*/ */
public BaseBeanResponse<DmpMember> switchProj(Integer projectId, HttpServletRequest httpRequest)throws Exception; public BaseBeanResponse<DmpMember> switchProj(Integer projectId, HttpServletRequest httpRequest)throws Exception;
/**
* @Title: deleteByIds
* @Description: TODO(根据主键批量删除)
* @param @param idList
* @param @param httpRequest
* @param @return
* @param @throws Exception 参数
* @return BaseResponse 返回类型
* @throws
*/
public BaseResponse deleteByIds(List<Integer> idList, HttpServletRequest httpRequest)throws Exception;
/**
* @Title: softDeleteByIds
* @Description: TODO(根据主键批量软删除)
* @param @param idList
* @param @param httpRequest
* @param @return
* @param @throws Exception 参数
* @return BaseResponse 返回类型
* @throws
*/
public BaseResponse softDeleteByIds(List<Integer> idList, HttpServletRequest httpRequest)throws Exception;
} }
...@@ -484,4 +484,38 @@ public class DmpMemberServiceImpl extends BaseService implements DmpMemberServic ...@@ -484,4 +484,38 @@ public class DmpMemberServiceImpl extends BaseService implements DmpMemberServic
return baseBeanResponse; return baseBeanResponse;
} }
/**
*批量删除
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseResponse deleteByIds(List<Integer> idList, HttpServletRequest httpRequest) throws Exception {
BaseResponse baseResponse = new BaseResponse();
dmpMemberMapper.deleteByIds(idList);
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("删除成功");
return baseResponse;
}
/**
*批量软删除
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseResponse softDeleteByIds(List<Integer> idList, HttpServletRequest httpRequest) throws Exception {
BaseResponse baseResponse = new BaseResponse();
dmpMemberMapper.softDeleteByIds(idList);
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("软删除成功");
return baseResponse;
}
} }
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<resultMap id="BaseDtoResultMap" type="com.jz.dmp.modules.controller.sys.bean.DmpMemberDto" extends="BaseResultMap"> <resultMap id="BaseDtoResultMap" type="com.jz.dmp.modules.controller.sys.bean.DmpMemberDto" extends="BaseResultMap">
<!-- /*$BaseDtoResultMapContent$*/ --> <!-- /*$BaseDtoResultMapContent$*/ -->
<collection property="roles" ofType="java.lang.String" javaType="java.util.List" <collection property="roles" ofType="java.lang.String" javaType="java.util.List"
column="userId" select="getRoleNamesByUserid"> column="user_id" select="getRoleNamesByUserid">
</collection> </collection>
</resultMap> </resultMap>
...@@ -371,4 +371,25 @@ ...@@ -371,4 +371,25 @@
AND data_status='1' AND data_status='1'
</select> </select>
<!-- 根据主键批量删除用户表 -->
<delete id="deleteByIds">
delete from dmp_member
where user_id in
<foreach collection="idList" item="item" open="(" separator="," close=")">
item
</foreach>
</delete>
<!-- 根据主键批量软删除用户表 -->
<update id="softDeleteByIds">
update dmp_member
<set>
data_status = '0'
</set>
where user_id in
<foreach collection="idList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
</mapper> </mapper>
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