优化代码生成

完成风险管理
main
liukewei 12 months ago
parent e1d3a417da
commit 274358c359

@ -1,4 +1,4 @@
package com.ruoyi.web.controller.ehs;
package com.ruoyi.ehsMaterial.controller;
import java.util.List;
import java.util.Arrays;
@ -28,7 +28,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
* Controller
*
* @author ruoyi
* @date 2023-12-01
* @date 2023-12-04
*/
@Api(tags="物资信息包含 通用应急救援装备”“防汛抗旱应急救援装备”“森林防灭火应急救援装备”“救灾物资”管理")
@RestController
@ -41,7 +41,6 @@ public class EhsMaterialController extends BaseController
/**
*
*/
@ApiOperation("查询物资信息包含 通用应急救援装备”“防汛抗旱应急救援装备”“森林防灭火应急救援装备”“救灾物资”列表")
@PreAuthorize("@ss.hasPermi('ehsMaterial:ehsMaterial:list')")
@GetMapping("/list")
public TableDataInfo list(EhsMaterial ehsMaterial)
@ -54,7 +53,6 @@ public class EhsMaterialController extends BaseController
/**
*
*/
@ApiOperation("导出物资信息包含 通用应急救援装备”“防汛抗旱应急救援装备”“森林防灭火应急救援装备”“救灾物资”列表")
@PreAuthorize("@ss.hasPermi('ehsMaterial:ehsMaterial:export')")
@Log(title = "物资信息包含 通用应急救援装备”“防汛抗旱应急救援装备”“森林防灭火应急救援装备”“救灾物资”", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ -68,12 +66,11 @@ public class EhsMaterialController extends BaseController
/**
*
*/
@ApiOperation("获取物资信息包含 通用应急救援装备”“防汛抗旱应急救援装备”“森林防灭火应急救援装备”“救灾物资”详细信息")
@PreAuthorize("@ss.hasPermi('ehsMaterial:ehsMaterial:query')")
@GetMapping(value = "/{materialId}")
public AjaxResult getInfo(@PathVariable("materialId") Long materialId)
{
return success(ehsMaterialService.getById(materialId));
return success(ehsMaterialService.selectEhsMaterialByMaterialId(materialId));
}
/**

@ -4,6 +4,7 @@ import java.util.List;
import java.util.Arrays;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.ehsRisk.domain.EhsRisk;
import com.ruoyi.ehsRisk.service.IEhsRiskService;
import org.springframework.security.access.prepost.PreAuthorize;
@ -29,7 +30,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
* Controller
*
* @author ruoyi
* @date 2023-11-30
* @date 2023-12-04
*/
@Api(tags="风险信息管理")
@RestController
@ -39,10 +40,10 @@ public class EhsRiskController extends BaseController
@Autowired
private IEhsRiskService ehsRiskService;
/**
*
*/
@ApiOperation("查询风险信息列表")
@PreAuthorize("@ss.hasPermi('system:risk:list')")
@GetMapping("/list")
public TableDataInfo list(EhsRisk ehsRisk)
@ -55,12 +56,12 @@ public class EhsRiskController extends BaseController
/**
*
*/
@ApiOperation("导出风险信息列表")
@PreAuthorize("@ss.hasPermi('system:risk:export')")
@Log(title = "风险信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EhsRisk ehsRisk)
{
List<EhsRisk> list = ehsRiskService.selectEhsRiskList(ehsRisk);
ExcelUtil<EhsRisk> util = new ExcelUtil<EhsRisk>(EhsRisk.class);
util.exportExcel(response, list, "风险信息数据");
@ -69,12 +70,11 @@ public class EhsRiskController extends BaseController
/**
*
*/
@ApiOperation("获取风险信息详细信息")
@PreAuthorize("@ss.hasPermi('system:risk:query')")
@GetMapping(value = "/{riskId}")
public AjaxResult getInfo(@PathVariable("riskId") Long riskId)
{
return success(ehsRiskService.getById(riskId));
return success(ehsRiskService.selectEhsRiskByRiskId(riskId));
}
/**

@ -129,4 +129,16 @@ public class SysDeptController extends BaseController
deptService.checkDeptDataScope(deptId);
return toAjax(deptService.deleteDeptById(deptId));
}
/**
* idname
*
* @param dept
* @return
*/
@GetMapping("/getAllDeptList")
public AjaxResult selectAllDeptList(SysDept dept)
{
List<SysDept> depts = deptService.selectAllDeptList(dept);
return success(depts);
}
}

@ -45,18 +45,19 @@ public class GenConstants
"bit", "bigint", "float", "double", "decimal" };
/** 页面不需要编辑字段 */
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag", "create_user_id", "update_user_id" };
/** 页面不需要显示的列表字段 */
public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
"update_time" };
"update_time" , "create_user_id", "update_user_id"};
/** 页面不需要查询字段 */
public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by",
"update_time", "remark" };
"update_time", "remark" , "createUserId", "updateUserId"};
/** Entity基类字段 */
public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" };
public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark",
"deptId", "createUserId", "updateUserId", "deptName" };
/** Tree基类字段 */
public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" };

@ -9,12 +9,15 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
/**
* Entity
*
* @author ruoyi
*/
@Data
public class BaseEntity implements Serializable
{
private static final long serialVersionUID = 1L;
@ -33,6 +36,9 @@ public class BaseEntity implements Serializable
/** 创建者 */
@TableField(fill = FieldFill.INSERT)
private Long deptId;
/** 上报部门 */
@Excel(name = "上报部门")
private String deptName;
/** 创建时间 */
@TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -58,89 +64,7 @@ public class BaseEntity implements Serializable
private Map<String, Object> params;
public Long getCreateUserId() {
return createUserId;
}
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public Long getUpdateUserId() {
return updateUserId;
}
public void setUpdateUserId(Long updateUserId) {
this.updateUserId = updateUserId;
}
public String getSearchValue()
{
return searchValue;
}
public void setSearchValue(String searchValue)
{
this.searchValue = searchValue;
}
public String getCreateBy()
{
return createBy;
}
public void setCreateBy(String createBy)
{
this.createBy = createBy;
}
public Date getCreateTime()
{
return createTime;
}
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
public String getUpdateBy()
{
return updateBy;
}
public void setUpdateBy(String updateBy)
{
this.updateBy = updateBy;
}
public Date getUpdateTime()
{
return updateTime;
}
public void setUpdateTime(Date updateTime)
{
this.updateTime = updateTime;
}
public String getRemark()
{
return remark;
}
public void setRemark(String remark)
{
this.remark = remark;
}
public Map<String, Object> getParams()
{

@ -59,6 +59,8 @@ public class CreateAndUpdateMetaObjectHandler implements MetaObjectHandler {
// 当前已登录 更新人填充(不管为不为空)
if (StringUtils.isNotBlank(username)) {
baseEntity.setUpdateBy(username);
Long userId = baseEntity.getCreateUserId()!=null ? baseEntity.getCreateUserId() : SecurityUtils.getUserId();
baseEntity.setUpdateUserId(userId);
}
}
} catch (Exception e) {

@ -333,6 +333,7 @@ public class GenTableColumn extends BaseEntity
return StringUtils.equalsAnyIgnoreCase(javaField,
// BaseEntity
"createBy", "createTime", "updateBy", "updateTime", "remark",
"updateUserId", "deptId","createUserId",
// TreeEntity
"parentName", "parentId", "orderNum", "ancestors");
}

@ -0,0 +1,141 @@
package ${packageName}.controller;
import java.util.List;
import java.util.Arrays;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import ${packageName}.domain.${ClassName};
import ${packageName}.service.I${ClassName}Service;
import com.ruoyi.common.utils.poi.ExcelUtil;
#if($table.crud || $table.sub)
import com.ruoyi.common.core.page.TableDataInfo;
#elseif($table.tree)
#end
/**
* ${functionName}Controller
*
* @author ${author}
* @date ${datetime}
*/
@Api(tags="${functionName}管理")
@RestController
@RequestMapping("/${moduleName}/${businessName}")
public class ${ClassName}Controller extends BaseController
{
@Autowired
private I${ClassName}Service ${className}Service;
/**
* 查询${functionName}列表
*/
@ApiOperation("查询${functionName}列表")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
@GetMapping("/list")
#if($table.crud || $table.sub)
public TableDataInfo list(${ClassName} ${className})
{
startPage();
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
return getDataTable(list);
}
#elseif($table.tree)
public AjaxResult list(${ClassName} ${className})
{
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
return success(list);
}
#end
/**
* 导出${functionName}列表
*/
@ApiOperation("导出${functionName}列表")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ${ClassName} ${className})
{
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
util.exportExcel(response, list, "${functionName}数据");
}
/**
* 获取${functionName}详细信息
*/
@ApiOperation("获取${functionName}详细信息")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')")
@GetMapping(value = "/{${pkColumn.javaField}}")
public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
{
#if($table.sub)
return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}));
#else
return success(${className}Service.getById(${pkColumn.javaField}));
#end
}
/**
* 新增${functionName}
*/
@ApiOperation("新增${functionName}")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')")
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ${ClassName} ${className})
{
#if($table.sub)
return toAjax(${className}Service.insert${ClassName}(${className}));
#else
return toAjax(${className}Service.save(${className}));
#end
}
/**
* 修改${functionName}
*/
@ApiOperation("修改${functionName}")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')")
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ${ClassName} ${className})
{
#if($table.sub)
return toAjax(${className}Service.update${ClassName}(${className}));
#else
return toAjax(${className}Service.updateById(${className}));
#end
}
/**
* 删除${functionName}
*/
@ApiOperation("删除${functionName}")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')")
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
@DeleteMapping("/{${pkColumn.javaField}s}")
public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s)
{
#if($table.sub)
return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s));
#else
return toAjax(${className}Service.removeByIds(Arrays.asList(${pkColumn.javaField}s)));
#end
}
}

@ -0,0 +1,72 @@
package ${packageName}.domain;
#foreach ($import in $importList)
import ${import};
#end
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import com.ruoyi.common.annotation.Excel;
#if($table.crud || $table.sub)
import com.ruoyi.common.core.domain.BaseEntity;
#elseif($table.tree)
import com.ruoyi.common.core.domain.TreeEntity;
#end
/**
* ${functionName}对象 ${tableName}
*
* @author ${author}
* @date ${datetime}
*/
#if($table.crud || $table.sub)
#set($Entity="BaseEntity")
#elseif($table.tree)
#set($Entity="TreeEntity")
#end
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName("${tableName}")
public class ${ClassName} extends ${Entity}
{
private static final long serialVersionUID = 1L;
#foreach ($column in $columns)
#if(!$table.isSuperColumn($column.javaField))
/** $column.columnComment */
#if($column.list)
#set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else
#set($comment=$column.columnComment)
#end
#if($parentheseIndex != -1)
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
#elseif($column.javaType == 'Date')
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
#else
@Excel(name = "${comment}")
#end
#end
#if($column.pk)
@TableId(type= IdType.AUTO)
#end
private $column.javaType $column.javaField;
#end
#end
#if($table.sub)
/** $table.subTable.functionName信息 */
@TableField(exist = false)
private List<${subClassName}> ${subclassName}List;
#end
}

@ -0,0 +1,43 @@
package ${packageName}.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import ${packageName}.domain.${ClassName};
#if($table.sub)
import java.util.List;
import org.apache.ibatis.annotations.Param;
import ${packageName}.domain.${subClassName};
#end
/**
* ${functionName}Mapper接口
*
* @author ${author}
* @date ${datetime}
*/
public interface ${ClassName}Mapper extends BaseMapper<${ClassName}> {
#if($table.sub)
/**
* 查询${functionName}
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return ${functionName}
*/
List<${subClassName}> select${subClassName}By${pkColumn.capJavaField}(@Param("${pkColumn.javaField}")${pkColumn.javaType} ${pkColumn.javaField});
/**
* 删除${functionName}信息
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return 结果
*/
int delete${subClassName}By${subTableFkClassName}(@Param("${pkColumn.javaField}")${pkColumn.javaType} ${pkColumn.javaField});
/**
* 批量新增${subTable.functionName}
*
* @param ${subclassName}List ${subTable.functionName}列表
* @return 结果
*/
int batchInsert${subClassName}(List<${subClassName}> ${subclassName}List);
#end
}

@ -0,0 +1,64 @@
package ${packageName}.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import ${packageName}.domain.${ClassName};
/**
* ${functionName}Service接口
*
* @author ${author}
* @date ${datetime}
*/
public interface I${ClassName}Service extends IService<${ClassName}> {
/**
* 查询${functionName}列表
*
* @param ${className} ${functionName}
* @return ${functionName}集合
*/
public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
#if($table.sub)
/**
* 查询${functionName}
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return ${functionName}
*/
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
/**
* 新增${functionName}
*
* @param ${className} ${functionName}
* @return 结果
*/
public int insert${ClassName}(${ClassName} ${className});
/**
* 修改${functionName}
*
* @param ${className} ${functionName}
* @return 结果
*/
public int update${ClassName}(${ClassName} ${className});
/**
* 批量删除${functionName}
*
* @param ${pkColumn.javaField}s 需要删除的${functionName}主键集合
* @return 结果
*/
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
/**
* 删除${functionName}信息
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return 结果
*/
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
#end
}

@ -0,0 +1,179 @@
package ${packageName}.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.common.utils.StringUtils;
import java.util.List;
import java.util.Map;
#if($table.sub)
import java.util.Arrays;
import org.springframework.transaction.annotation.Transactional;
import ${packageName}.domain.${subClassName};
#end
import ${packageName}.mapper.${ClassName}Mapper;
import ${packageName}.domain.${ClassName};
import ${packageName}.service.I${ClassName}Service;
/**
* ${functionName}Service业务层处理
*
* @author ${author}
* @date ${datetime}
*/
@Service
public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements I${ClassName}Service {
@Autowired
private ${ClassName}Mapper ${className}Mapper;
/**
* 查询${functionName}列表
*
* @param ${className} ${functionName}
* @return ${functionName}
*/
@Override
public List<${ClassName}> select${ClassName}List(${ClassName} ${className})
{
List<${ClassName}> ${className}List = ${className}Mapper.selectList(buildQueryWrapper(${className}));
#if($table.sub)
if (StringUtils.isNotNull(${className}List)) {
for (${ClassName} temp : ${className}List) {
List<${subClassName}> ${subclassName}List = ${className}Mapper.select${subClassName}By${pkColumn.capJavaField}(temp.get${pkColumn.capJavaField}());
temp.set${subClassName}List(${subclassName}List);
}
}
#end
return ${className}List;
}
#if($table.sub)
/**
* 查询${functionName}
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return ${functionName}
*/
@Override
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
{
${ClassName} ${className} = ${className}Mapper.selectById(${pkColumn.javaField});
List<${subClassName}> ${subclassName}List = ${className}Mapper.select${subClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
${className}.set${subClassName}List(${subclassName}List);
return ${className};
}
/**
* 新增${functionName}
*
* @param ${className} ${functionName}
* @return 结果
*/
@Transactional
@Override
public int insert${ClassName}(${ClassName} ${className})
{
int rows = ${className}Mapper.insert(${className});
insert${subClassName}(${className});
return rows;
}
/**
* 修改${functionName}
*
* @param ${className} ${functionName}
* @return 结果
*/
@Transactional
@Override
public int update${ClassName}(${ClassName} ${className})
{
${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}());
insert${subClassName}(${className});
return ${className}Mapper.updateById(${className});
}
/**
* 批量删除${functionName}
*
* @param ${pkColumn.javaField}s 需要删除的${functionName}主键
* @return 结果
*/
@Transactional
@Override
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s)
{
List<${pkColumn.javaType}> ${pkColumn.javaField}List = Arrays.asList(${pkColumn.javaField}s);
for (${pkColumn.javaType} ${pkColumn.javaField} : ${pkColumn.javaField}List) {
${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField});
}
return ${className}Mapper.deleteBatchIds(${pkColumn.javaField}List);
}
/**
* 删除${functionName}信息
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return 结果
*/
@Transactional
@Override
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
{
${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField});
return ${className}Mapper.deleteById(${pkColumn.javaField});
}
/**
* 新增${subTable.functionName}信息
*
* @param ${className} ${functionName}对象
*/
private void insert${subClassName}(${ClassName} ${className})
{
List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List();
${pkColumn.javaType} ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}();
if (StringUtils.isNotNull(${subclassName}List)) {
for (${subClassName} ${subclassName} : ${subclassName}List) {
${subclassName}.set${subTableFkClassName}(${pkColumn.javaField});
}
${className}Mapper.batchInsert${subClassName}(${subclassName}List);
}
}
#end
private LambdaQueryWrapper<${ClassName}> buildQueryWrapper(${ClassName} query) {
Map<String, Object> params = query.getParams();
LambdaQueryWrapper<${ClassName}> lqw = Wrappers.lambdaQuery();
#foreach($column in $columns)
#if($column.query)
#set($queryType=$column.queryType)
#set($javaField=$column.javaField)
#set($javaType=$column.javaType)
#set($columnName=$column.columnName)
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#set($mpMethod=$column.queryType.toLowerCase())
#if($queryType != 'BETWEEN')
#if($javaType == 'String')
#set($condition='StringUtils.isNotBlank(query.get'+$AttrName+'())')
#else
#set($condition='query.get'+$AttrName+'() != null')
#end
lqw.$mpMethod($condition, ${ClassName}::get$AttrName, query.get$AttrName());
#else
lqw.between(params.get("begin$AttrName") != null && params.get("end$AttrName") != null,
${ClassName}::get$AttrName ,params.get("begin$AttrName"), params.get("end$AttrName"));
#end
#end
#if($column.javaField == 'createTime')
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
lqw.orderByDesc(${ClassName}::get$AttrName);
#end
#end
return lqw;
}
}

@ -0,0 +1,61 @@
package ${packageName}.domain;
#foreach ($import in $subImportList)
import ${import};
#end
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* ${subTable.functionName}对象 ${subTableName}
*
* @author ${author}
* @date ${datetime}
*/
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName("${subTableName}")
@ApiModel(value = "${subClassName}", description = "${subTable.functionName}实体")
public class ${subClassName} extends BaseEntity
{
private static final long serialVersionUID = 1L;
#foreach ($column in $subTable.columns)
#if(!$table.isSuperColumn($column.javaField))
/** $column.columnComment */
#if($column.list)
#set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else
#set($comment=$column.columnComment)
#end
#if($parentheseIndex != -1)
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
#elseif($column.javaType == 'Date')
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
#else
@Excel(name = "${comment}")
#end
#end
#if($column.pk)
@TableId(type= IdType.AUTO)
#end
@ApiModelProperty("$column.columnComment")
private $column.javaType $column.javaField;
#end
#end
}

@ -41,31 +41,29 @@ public class ${ClassName}Controller extends BaseController
@Autowired
private I${ClassName}Service ${className}Service;
/**
/**
* 查询${functionName}列表
*/
@ApiOperation("查询${functionName}列表")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
@GetMapping("/list")
#if($table.crud || $table.sub)
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
@GetMapping("/list")
#if($table.crud || $table.sub)
public TableDataInfo list(${ClassName} ${className})
{
startPage();
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
return getDataTable(list);
}
#elseif($table.tree)
#elseif($table.tree)
public AjaxResult list(${ClassName} ${className})
{
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
return success(list);
}
#end
#end
/**
* 导出${functionName}列表
*/
@ApiOperation("导出${functionName}列表")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ -79,16 +77,11 @@ public class ${ClassName}Controller extends BaseController
/**
* 获取${functionName}详细信息
*/
@ApiOperation("获取${functionName}详细信息")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')")
@GetMapping(value = "/{${pkColumn.javaField}}")
public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
{
#if($table.sub)
return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}));
#else
return success(${className}Service.getById(${pkColumn.javaField}));
#end
}
/**

@ -2,6 +2,7 @@ package ${packageName}.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import ${packageName}.domain.${ClassName};
import java.util.List;
#if($table.sub)
import java.util.List;
import org.apache.ibatis.annotations.Param;
@ -15,14 +16,22 @@ import ${packageName}.domain.${subClassName};
* @date ${datetime}
*/
public interface ${ClassName}Mapper extends BaseMapper<${ClassName}> {
#if($table.sub)
/**
* 查询${functionName}
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return ${functionName}
*/
List<${subClassName}> select${subClassName}By${pkColumn.capJavaField}(@Param("${pkColumn.javaField}")${pkColumn.javaType} ${pkColumn.javaField});
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
/**
* 查询${functionName}列表
*
* @param ${className} ${functionName}
* @return ${functionName}集合
*/
public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
#if($table.sub)
/**
* 删除${functionName}信息

@ -12,6 +12,14 @@ import ${packageName}.domain.${ClassName};
*/
public interface I${ClassName}Service extends IService<${ClassName}> {
/**
* 查询${functionName}
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return ${functionName}
*/
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
/**
* 查询${functionName}列表
*
@ -20,14 +28,8 @@ public interface I${ClassName}Service extends IService<${ClassName}> {
*/
public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
#if($table.sub)
/**
* 查询${functionName}
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return ${functionName}
*/
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
#if($table.sub)
/**
* 新增${functionName}
@ -60,5 +62,5 @@ public interface I${ClassName}Service extends IService<${ClassName}> {
* @return 结果
*/
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
#end
#end
}

@ -8,11 +8,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.common.utils.StringUtils;
import java.util.List;
import java.util.Map;
#if($table.sub)
import java.util.Arrays;
import org.springframework.transaction.annotation.Transactional;
import ${packageName}.domain.${subClassName};
#end
#if($table.sub)
import java.util.Arrays;
import org.springframework.transaction.annotation.Transactional;
import ${packageName}.domain.${subClassName};
#end
import ${packageName}.mapper.${ClassName}Mapper;
import ${packageName}.domain.${ClassName};
import ${packageName}.service.I${ClassName}Service;
@ -30,42 +30,30 @@ public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${C
private ${ClassName}Mapper ${className}Mapper;
/**
* 查询${functionName}列表
* 查询${functionName}
*
* @param ${className} ${functionName}
* @param ${pkColumn.javaField} ${functionName}主键
* @return ${functionName}
*/
@Override
public List<${ClassName}> select${ClassName}List(${ClassName} ${className})
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
{
List<${ClassName}> ${className}List = ${className}Mapper.selectList(buildQueryWrapper(${className}));
#if($table.sub)
if (StringUtils.isNotNull(${className}List)) {
for (${ClassName} temp : ${className}List) {
List<${subClassName}> ${subclassName}List = ${className}Mapper.select${subClassName}By${pkColumn.capJavaField}(temp.get${pkColumn.capJavaField}());
temp.set${subClassName}List(${subclassName}List);
}
}
#end
return ${className}List;
return ${className}Mapper.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
}
#if($table.sub)
/**
* 查询${functionName}
* 查询${functionName}列表
*
* @param ${pkColumn.javaField} ${functionName}主键
* @param ${className} ${functionName}
* @return ${functionName}
*/
@Override
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
public List<${ClassName}> select${ClassName}List(${ClassName} ${className})
{
${ClassName} ${className} = ${className}Mapper.selectById(${pkColumn.javaField});
List<${subClassName}> ${subclassName}List = ${className}Mapper.select${subClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
${className}.set${subClassName}List(${subclassName}List);
return ${className};
return ${className}Mapper.select${ClassName}List(${className});
}
#if($table.sub)
/**
* 新增${functionName}
*
@ -143,12 +131,12 @@ public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${C
${className}Mapper.batchInsert${subClassName}(${subclassName}List);
}
}
#end
#end
private LambdaQueryWrapper<${ClassName}> buildQueryWrapper(${ClassName} query) {
Map<String, Object> params = query.getParams();
LambdaQueryWrapper<${ClassName}> lqw = Wrappers.lambdaQuery();
#foreach($column in $columns)
#foreach($column in $columns)
#if($column.query)
#set($queryType=$column.queryType)
#set($javaField=$column.javaField)
@ -172,7 +160,7 @@ public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${C
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
lqw.orderByDesc(${ClassName}::get$AttrName);
#end
#end
#end
return lqw;
}

@ -0,0 +1,36 @@
<?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="${packageName}.mapper.${ClassName}Mapper">
<resultMap type="${ClassName}" id="${ClassName}Result">
#foreach ($column in $columns)
<result property="${column.javaField}" column="${column.columnName}" />
#end
</resultMap>
#if($table.sub)
<resultMap type="${subClassName}" id="${subClassName}Result">
#foreach ($column in $subTable.columns)
<result property="${column.javaField}" column="${column.columnName}" />
#end
</resultMap>
<select id="select${subClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}" resultType="${packageName}.domain.${subClassName}">
select * from ${subTableName} where ${subTableFkName} = #{${pkColumn.javaField}}
</select>
<delete id="delete${subClassName}By${subTableFkClassName}" parameterType="${pkColumn.javaType}">
delete from ${subTableName} where ${subTableFkName} = #{${pkColumn.javaField}}
</delete>
<insert id="batchInsert${subClassName}">
insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end) values
<foreach item="item" index="index" collection="list" separator=",">
(#foreach($column in $subTable.columns) #{item.$column.javaField}#if($foreach.count != $subTable.columns.size()),#end#end)
</foreach>
</insert>
#end
</mapper>

@ -1,36 +1,78 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${packageName}.mapper.${ClassName}Mapper">
<resultMap type="${ClassName}" id="${ClassName}Result">
#foreach ($column in $columns)
#foreach ($column in $columns)
<result property="${column.javaField}" column="${column.columnName}" />
#end
#end
</resultMap>
#if($table.sub)
<resultMap id="${ClassName}${subClassName}Result" type="${ClassName}" extends="${ClassName}Result">
<collection property="${subclassName}List" notNullColumn="sub_${subTable.pkColumn.columnName}" javaType="java.util.List" resultMap="${subClassName}Result" />
</resultMap>
#if($table.sub)
<resultMap type="${subClassName}" id="${subClassName}Result">
#foreach ($column in $subTable.columns)
<result property="${column.javaField}" column="${column.columnName}" />
<result property="${column.javaField}" column="sub_${column.columnName}" />
#end
</resultMap>
#end
<sql id="select${ClassName}Vo">
select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName}
</sql>
<select id="select${subClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}" resultType="${packageName}.domain.${subClassName}">
select * from ${subTableName} where ${subTableFkName} = #{${pkColumn.javaField}}
<select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}Result">
<include refid="select${ClassName}Vo"/>
<where>
#foreach($column in $columns)
#set($queryType=$column.queryType)
#set($javaField=$column.javaField)
#set($javaType=$column.javaType)
#set($columnName=$column.columnName)
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#if($column.query)
#if($column.queryType == "EQ")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName = #{$javaField}</if>
#elseif($queryType == "NE")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName != #{$javaField}</if>
#elseif($queryType == "GT")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &gt; #{$javaField}</if>
#elseif($queryType == "GTE")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &gt;= #{$javaField}</if>
#elseif($queryType == "LT")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &lt; #{$javaField}</if>
#elseif($queryType == "LTE")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &lt;= #{$javaField}</if>
#elseif($queryType == "LIKE")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if>
#elseif($queryType == "BETWEEN")
<if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if>
#end
#end
#end
</where>
</select>
<delete id="delete${subClassName}By${subTableFkClassName}" parameterType="${pkColumn.javaType}">
delete from ${subTableName} where ${subTableFkName} = #{${pkColumn.javaField}}
</delete>
<insert id="batchInsert${subClassName}">
insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end) values
<foreach item="item" index="index" collection="list" separator=",">
(#foreach($column in $subTable.columns) #{item.$column.javaField}#if($foreach.count != $subTable.columns.size()),#end#end)
</foreach>
</insert>
#end
<select id="select${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}" resultMap="#if($table.sub)${ClassName}${subClassName}Result#else${ClassName}Result#end">
#if($table.crud || $table.tree)
<include refid="select${ClassName}Vo"/>
where ${pkColumn.columnName} = #{${pkColumn.javaField}}
#elseif($table.sub)
select#foreach($column in $columns) a.$column.columnName#if($foreach.count != $columns.size()),#end#end,
#foreach($column in $subTable.columns) b.$column.columnName as sub_$column.columnName#if($foreach.count != $subTable.columns.size()),#end#end
from ${tableName} a
left join ${subTableName} b on b.${subTableFkName} = a.${pkColumn.columnName}
where a.${pkColumn.columnName} = #{${pkColumn.javaField}}
#end
</select>
</mapper>

@ -15,7 +15,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* ehs_material
*
* @author ruoyi
* @date 2023-12-01
* @date 2023-12-04
*/
@Data
@ToString
@ -66,13 +66,6 @@ public class EhsMaterial extends BaseEntity
@Excel(name = "联系电话")
private String tel;
/** 创建者部门 */
private Long deptId;
/** 创建者id */
private Long createUserId;
/** 修改着id */
private Long updateUserId;
}

@ -3,11 +3,28 @@ package com.ruoyi.ehsMaterial.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.ehsMaterial.domain.EhsMaterial;
import java.util.List;
/**
* Mapper
*
* @author ruoyi
* @date 2023-12-01
* @date 2023-12-04
*/
public interface EhsMaterialMapper extends BaseMapper<EhsMaterial> {
/**
*
*
* @param materialId
* @return
*/
public EhsMaterial selectEhsMaterialByMaterialId(Long materialId);
/**
*
*
* @param ehsMaterial
* @return
*/
public List<EhsMaterial> selectEhsMaterialList(EhsMaterial ehsMaterial);
}

@ -8,10 +8,18 @@ import com.ruoyi.ehsMaterial.domain.EhsMaterial;
* Service
*
* @author ruoyi
* @date 2023-12-01
* @date 2023-12-04
*/
public interface IEhsMaterialService extends IService<EhsMaterial> {
/**
*
*
* @param materialId
* @return
*/
public EhsMaterial selectEhsMaterialByMaterialId(Long materialId);
/**
*
*

@ -16,7 +16,7 @@ import com.ruoyi.ehsMaterial.service.IEhsMaterialService;
* Service
*
* @author ruoyi
* @date 2023-12-01
* @date 2023-12-04
*/
@Service
public class EhsMaterialServiceImpl extends ServiceImpl<EhsMaterialMapper, EhsMaterial> implements IEhsMaterialService {
@ -24,6 +24,18 @@ public class EhsMaterialServiceImpl extends ServiceImpl<EhsMaterialMapper, EhsMa
@Autowired
private EhsMaterialMapper ehsMaterialMapper;
/**
*
*
* @param materialId
* @return
*/
@Override
public EhsMaterial selectEhsMaterialByMaterialId(Long materialId)
{
return ehsMaterialMapper.selectEhsMaterialByMaterialId(materialId);
}
/**
*
*
@ -33,8 +45,7 @@ public class EhsMaterialServiceImpl extends ServiceImpl<EhsMaterialMapper, EhsMa
@Override
public List<EhsMaterial> selectEhsMaterialList(EhsMaterial ehsMaterial)
{
List<EhsMaterial> ehsMaterialList = ehsMaterialMapper.selectList(buildQueryWrapper(ehsMaterial));
return ehsMaterialList;
return ehsMaterialMapper.selectEhsMaterialList(ehsMaterial);
}

@ -72,5 +72,4 @@ public class EhsRisk extends BaseEntity
/** 联系电话 */
@Excel(name = "联系电话")
private String tel2;
}

@ -3,6 +3,8 @@ package com.ruoyi.ehsRisk.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.ehsRisk.domain.EhsRisk;
import java.util.List;
/**
* Mapper
*
@ -10,4 +12,19 @@ import com.ruoyi.ehsRisk.domain.EhsRisk;
* @date 2023-11-30
*/
public interface EhsRiskMapper extends BaseMapper<EhsRisk> {
/**
*
*
* @param riskId
* @return
*/
public EhsRisk selectEhsRiskByRiskId(Long riskId);
/**
*
*
* @param ehsRisk
* @return
*/
public List<EhsRisk> selectEhsRiskList(EhsRisk ehsRisk);
}

@ -12,6 +12,14 @@ import com.ruoyi.ehsRisk.domain.EhsRisk;
*/
public interface IEhsRiskService extends IService<EhsRisk> {
/**
*
*
* @param riskId
* @return
*/
public EhsRisk selectEhsRiskByRiskId(Long riskId);
/**
*
*
@ -19,5 +27,4 @@ public interface IEhsRiskService extends IService<EhsRisk> {
* @return
*/
public List<EhsRisk> selectEhsRiskList(EhsRisk ehsRisk);
}

@ -3,6 +3,7 @@ package com.ruoyi.ehsRisk.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.ehsRisk.domain.EhsRisk;
import com.ruoyi.ehsRisk.mapper.EhsRiskMapper;
import com.ruoyi.ehsRisk.service.IEhsRiskService;
@ -23,6 +24,17 @@ public class EhsRiskServiceImpl extends ServiceImpl<EhsRiskMapper, EhsRisk> impl
@Autowired
private EhsRiskMapper ehsRiskMapper;
/**
*
*
* @param riskId
* @return
*/
@Override
public EhsRisk selectEhsRiskByRiskId(Long riskId)
{
return ehsRiskMapper.selectEhsRiskByRiskId(riskId);
}
/**
*
@ -33,8 +45,11 @@ public class EhsRiskServiceImpl extends ServiceImpl<EhsRiskMapper, EhsRisk> impl
@Override
public List<EhsRisk> selectEhsRiskList(EhsRisk ehsRisk)
{
List<EhsRisk> ehsRiskList = ehsRiskMapper.selectList(buildQueryWrapper(ehsRisk));
return ehsRiskList;
if(SecurityUtils.getLoginUser().getUser().getDept().getParentId()!=null &&
SecurityUtils.getLoginUser().getUser().getDept().getParentId().longValue()!=0){
ehsRisk.setDeptId(SecurityUtils.getLoginUser().getUser().getDept().getParentId().longValue());
}
return ehsRiskMapper.selectEhsRiskList(ehsRisk);
}
@ -43,15 +58,18 @@ public class EhsRiskServiceImpl extends ServiceImpl<EhsRiskMapper, EhsRisk> impl
LambdaQueryWrapper<EhsRisk> lqw = Wrappers.lambdaQuery();
lqw.eq(query.getRiskGrade() != null, EhsRisk::getRiskGrade, query.getRiskGrade());
lqw.eq(StringUtils.isNotBlank(query.getReportAddressType()), EhsRisk::getReportAddressType, query.getReportAddressType());
lqw.eq(StringUtils.isNotBlank(query.getRiskLocation()), EhsRisk::getRiskLocation, query.getRiskLocation());
lqw.eq(StringUtils.isNotBlank(query.getTel()), EhsRisk::getTel, query.getTel());
lqw.eq(StringUtils.isNotBlank(query.getPeopleQuantity()), EhsRisk::getPeopleQuantity, query.getPeopleQuantity());
lqw.eq(StringUtils.isNotBlank(query.getMaterialsQuantity()), EhsRisk::getMaterialsQuantity, query.getMaterialsQuantity());
lqw.eq(StringUtils.isNotBlank(query.getRepairTeam()), EhsRisk::getRepairTeam, query.getRepairTeam());
lqw.eq(StringUtils.isNotBlank(query.getPersonResponsible()), EhsRisk::getPersonResponsible, query.getPersonResponsible());
lqw.eq(StringUtils.isNotBlank(query.getVillagePersonResponsible()), EhsRisk::getVillagePersonResponsible, query.getVillagePersonResponsible());
lqw.eq(StringUtils.isNotBlank(query.getVillagePersonResponsible2()), EhsRisk::getVillagePersonResponsible2, query.getVillagePersonResponsible2());
lqw.eq(StringUtils.isNotBlank(query.getTel2()), EhsRisk::getTel2, query.getTel2());
lqw.like(StringUtils.isNotBlank(query.getRiskLocation()), EhsRisk::getRiskLocation, query.getRiskLocation());
lqw.like(StringUtils.isNotBlank(query.getTel()), EhsRisk::getTel, query.getTel());
lqw.between(params.get("beginPeopleQuantity") != null && params.get("endPeopleQuantity") != null,
EhsRisk::getPeopleQuantity ,params.get("beginPeopleQuantity"), params.get("endPeopleQuantity"));
lqw.between(params.get("beginMaterialsQuantity") != null && params.get("endMaterialsQuantity") != null,
EhsRisk::getMaterialsQuantity ,params.get("beginMaterialsQuantity"), params.get("endMaterialsQuantity"));
lqw.between(params.get("beginRepairTeam") != null && params.get("endRepairTeam") != null,
EhsRisk::getRepairTeam ,params.get("beginRepairTeam"), params.get("endRepairTeam"));
lqw.like(StringUtils.isNotBlank(query.getPersonResponsible()), EhsRisk::getPersonResponsible, query.getPersonResponsible());
lqw.like(StringUtils.isNotBlank(query.getVillagePersonResponsible()), EhsRisk::getVillagePersonResponsible, query.getVillagePersonResponsible());
lqw.like(StringUtils.isNotBlank(query.getVillagePersonResponsible2()), EhsRisk::getVillagePersonResponsible2, query.getVillagePersonResponsible2());
lqw.like(StringUtils.isNotBlank(query.getTel2()), EhsRisk::getTel2, query.getTel2());
lqw.orderByDesc(EhsRisk::getCreateTime);
return lqw;
}

@ -115,4 +115,12 @@ public interface SysDeptMapper
* @return
*/
public int deleteDeptById(Long deptId);
/**
* idname
*
* @param dept
* @return
*/
public List<SysDept> selectAllDeptList(SysDept dept);
}

@ -121,4 +121,11 @@ public interface ISysDeptService
* @return
*/
public int deleteDeptById(Long deptId);
/**
* idname
*
* @param dept
* @return
*/
public List<SysDept> selectAllDeptList(SysDept dept);
}

@ -335,4 +335,14 @@ public class SysDeptServiceImpl implements ISysDeptService
{
return getChildList(list, t).size() > 0;
}
/**
* idname
*
* @param dept
* @return
*/
public List<SysDept> selectAllDeptList(SysDept dept){
return deptMapper.selectAllDeptList(dept);
}
}

@ -1,7 +1,7 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.ehsMaterial.mapper.EhsMaterialMapper">
<resultMap type="EhsMaterial" id="EhsMaterialResult">
@ -25,5 +25,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateUserId" column="update_user_id" />
</resultMap>
<sql id="selectEhsMaterialVo">
select material_id, material_type, class_first, class_second, material_name, material_specs, material_quantity, reserve_location, Manager_person, tel, create_by, create_time, update_by, update_time, remark, dept_id, create_user_id, update_user_id from ehs_material
</sql>
<select id="selectEhsMaterialList" parameterType="EhsMaterial" resultMap="EhsMaterialResult">
<include refid="selectEhsMaterialVo"/>
<where>
<if test="materialType != null "> and material_type = #{materialType}</if>
<if test="classFirst != null "> and class_first = #{classFirst}</if>
<if test="classSecond != null and classSecond != ''"> and class_second = #{classSecond}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="materialSpecs != null and materialSpecs != ''"> and material_specs = #{materialSpecs}</if>
<if test="materialQuantity != null and materialQuantity != ''"> and material_quantity = #{materialQuantity}</if>
<if test="reserveLocation != null and reserveLocation != ''"> and reserve_location like concat('%', #{reserveLocation}, '%')</if>
<if test="managerPerson != null and managerPerson != ''"> and Manager_person like concat('%', #{managerPerson}, '%')</if>
<if test="tel != null and tel != ''"> and tel like concat('%', #{tel}, '%')</if>
</where>
</select>
<select id="selectEhsMaterialByMaterialId" parameterType="Long" resultMap="EhsMaterialResult">
<include refid="selectEhsMaterialVo"/>
where material_id = #{materialId}
</select>
</mapper>

@ -2,7 +2,7 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.EhsRiskMapper">
<mapper namespace="com.ruoyi.ehsRisk.mapper.EhsRiskMapper">
<resultMap type="EhsRisk" id="EhsRiskResult">
<result property="riskId" column="risk_id" />
@ -22,7 +22,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="createUserId" column="create_user_id" />
<result property="updateUserId" column="update_user_id" />
</resultMap>
<sql id="selectEhsRiskVo">
select r.*, d.dept_name
from ehs_risk r left join sys_dept d on r.dept_id = d.dept_id
</sql>
<select id="selectEhsRiskList" parameterType="EhsRisk" resultMap="EhsRiskResult">
<include refid="selectEhsRiskVo"/>
<where>
<if test="deptId != null "> and r.dept_Id = #{deptId}</if>
<if test="riskGrade != null "> and risk_grade = #{riskGrade}</if>
<if test="reportAddressType != null and reportAddressType != ''"> and report_address_type = #{reportAddressType}</if>
<if test="riskLocation != null and riskLocation != ''"> and risk_location like concat('%', #{riskLocation}, '%')</if>
<if test="tel != null and tel != ''"> and tel like concat('%', #{tel}, '%')</if>
<if test="params.beginPeopleQuantity != null and params.beginPeopleQuantity != '' and params.endPeopleQuantity != null and params.endPeopleQuantity != ''"> and people_quantity between #{params.beginPeopleQuantity} and #{params.endPeopleQuantity}</if>
<if test="params.beginMaterialsQuantity != null and params.beginMaterialsQuantity != '' and params.endMaterialsQuantity != null and params.endMaterialsQuantity != ''"> and materials_quantity between #{params.beginMaterialsQuantity} and #{params.endMaterialsQuantity}</if>
<if test="params.beginRepairTeam != null and params.beginRepairTeam != '' and params.endRepairTeam != null and params.endRepairTeam != ''"> and repair_team between #{params.beginRepairTeam} and #{params.endRepairTeam}</if>
<if test="personResponsible != null and personResponsible != ''"> and person_responsible like concat('%', #{personResponsible}, '%')</if>
<if test="villagePersonResponsible != null and villagePersonResponsible != ''"> and village_person_responsible like concat('%', #{villagePersonResponsible}, '%')</if>
<if test="villagePersonResponsible2 != null and villagePersonResponsible2 != ''"> and village_person_responsible2 like concat('%', #{villagePersonResponsible2}, '%')</if>
<if test="tel2 != null and tel2 != ''"> and tel2 like concat('%', #{tel2}, '%')</if>
</where>
</select>
<select id="selectEhsRiskByRiskId" parameterType="Long" resultMap="EhsRiskResult">
<include refid="selectEhsRiskVo"/>
where risk_id = #{riskId}
</select>
</mapper>

@ -57,7 +57,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
order by d.parent_id, d.order_num
</select>
<select id="selectAllDeptList" parameterType="SysDept" resultMap="SysDeptResult">
select d.dept_id,d.dept_name
from sys_dept d
order by d.order_num
</select>
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name

@ -50,3 +50,11 @@ export function delDept(deptId) {
method: 'delete'
})
}
//查询所有部门数据的id和name
export function listAllDept() {
return request({
url: '/system/dept/getAllDeptList',
method: 'get'
})
}

@ -29,6 +29,12 @@ const user = {
},
SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions
},
SET_PARENTID: (state, parentId) => {
state.parentId = parentId
},
SET_DEPTID: (state, deptid) => {
state.deptId = deptid
}
},
@ -65,6 +71,8 @@ const user = {
commit('SET_ID', user.userId)
commit('SET_NAME', user.userName)
commit('SET_AVATAR', avatar)
commit('SET_PARENTID', user.dept.parentId)
commit('SET_DEPTID', user.dept.deptId)
resolve(res)
}).catch(error => {
reject(error)

@ -1,22 +1,25 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="类别" prop="classFirst">
<!-- <el-form-item label="类别" prop="classFirst">
<el-input
v-model="queryParams.classFirst"
placeholder="请输入类别"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
</el-form-item>-->
<el-form-item label="类别" prop="classSecond">
<el-input
v-model="queryParams.classSecond"
placeholder="请输入类别"
clearable
@keyup.enter.native="handleQuery"
/>
<el-select v-model="queryParams.classSecond" placeholder="请选择类别" clearable>
<el-option
v-for="dict in curDict"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="物资名称" prop="materialName">
<el-input
v-model="queryParams.materialName"
@ -124,7 +127,7 @@
<el-table-column label="类别" align="center" prop="classFirst" />
<el-table-column label="类别" align="center" prop="classSecond">
<template slot-scope="scope">
<dict-tag :options="dict.type.material_class_1" :value="scope.row.classSecond"/>
<dict-tag :options="curDict" :value="scope.row.classSecond"/>
</template>
</el-table-column>
<el-table-column label="物资名称" align="center" prop="materialName" />
@ -164,11 +167,18 @@
<!-- 添加或修改物资信息包含 通用应急救援装备防汛抗旱应急救援装备森林防灭火应急救援装备救灾物资对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="类别" prop="classFirst">
<!--<el-form-item label="类别" prop="classFirst">
<el-input v-model="form.classFirst" placeholder="请输入类别" />
</el-form-item>
</el-form-item>-->
<el-form-item label="类别" prop="classSecond">
<el-input v-model="form.classSecond" placeholder="请输入类别" />
<el-select v-model="form.classSecond" placeholder="请选择类别">
<el-option
v-for="dict in curDict"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="物资名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入物资名称" />
@ -191,15 +201,6 @@
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="创建者部门" prop="deptId">
<el-input v-model="form.deptId" placeholder="请输入创建者部门" />
</el-form-item>
<el-form-item label="创建者id" prop="createUserId">
<el-input v-model="form.createUserId" placeholder="请输入创建者id" />
</el-form-item>
<el-form-item label="修改着id" prop="updateUserId">
<el-input v-model="form.updateUserId" placeholder="请输入修改着id" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -210,12 +211,15 @@
</template>
<script>
import { listEhsMaterial, getEhsMaterial, delEhsMaterial, addEhsMaterial, updateEhsMaterial } from "@/api/ehs/ehsMaterial";
export default {
import { listEhsMaterial, getEhsMaterial, delEhsMaterial, addEhsMaterial, updateEhsMaterial } from "@/api/ehs/ehsMaterial";
import { getDicts } from "@/api/system/dict/data";
export default {
name: "EhsMaterial",
// dicts: ['material_class_1','material_class_2','material_class_3','material_class_4'],
data() {
return {
curDict:[],
//
loading: true,
//
@ -234,6 +238,7 @@ export default {
title: "",
//
open: false,
materialClass:0,
//
queryParams: {
pageNum: 1,
@ -247,9 +252,12 @@ export default {
reserveLocation: null,
managerPerson: null,
tel: null,
classFirst:this.$route.query.classFirst
},
//
form: {},
form: {
classFirst:this.$route.query.classFirst
},
//
rules: {
}
@ -257,7 +265,10 @@ export default {
},
created() {
this.getList();
this.materialClass = this.$route.query.classFirst;
this.getDictList();
},
methods: {
/** 查询物资信息包含 通用应急救援装备”“防汛抗旱应急救援装备”“森林防灭火应急救援装备”“救灾物资”列表 */
getList() {
@ -268,6 +279,29 @@ export default {
this.loading = false;
});
},
getDictList() {
this.loading = true;
let str = "";
if(this.materialClass ==1)
str = "material_class_1";
else if(this.materialClass ==2)
str = "material_class_2";
else if(this.materialClass ==3)
str = "material_class_3";
else if(this.materialClass ==4)
str = "material_class_4";
else
str = this.materialClass;
getDicts(str).then(response => {
if(response.data!=null) {
response.data.forEach(item => {
console.log(item);
this.curDict.push({"label": item.dictLabel, "value": item.dictValue})
});
}
this.loading = false;
});
},
//
cancel() {
this.open = false;
@ -293,7 +327,8 @@ export default {
remark: null,
deptId: null,
createUserId: null,
updateUserId: null
updateUserId: null,
classFirst:this.$route.query.classFirst
};
this.resetForm("form");
},
@ -317,7 +352,7 @@ export default {
handleAdd() {
this.reset();
this.open = true;
this.title = "添加物资信息包含 通用应急救援装备”“防汛抗旱应急救援装备”“森林防灭火应急救援装备”“救灾物资”";
this.title = "添加物资信息包含";
},
/** 修改按钮操作 */
handleUpdate(row) {
@ -326,7 +361,7 @@ export default {
getEhsMaterial(materialId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改物资信息包含 通用应急救援装备”“防汛抗旱应急救援装备”“森林防灭火应急救援装备”“救灾物资”";
this.title = "修改物资信息";
});
},
/** 提交按钮 */
@ -352,7 +387,7 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const materialIds = row.materialId || this.ids;
this.$modal.confirm('是否确认删除物资信息包含 通用应急救援装备”“防汛抗旱应急救援装备”“森林防灭火应急救援装备”“救灾物资”编号为"' + materialIds + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除物资信息' + materialIds + '"的数据项?').then(function() {
return delEhsMaterial(materialIds);
}).then(() => {
this.getList();
@ -366,5 +401,5 @@ export default {
}, `ehsMaterial_${new Date().getTime()}.xlsx`)
}
}
};
};
</script>

@ -1,6 +1,16 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="部门" prop="deptId" v-show="deptShow">
<el-select v-model="queryParams.deptId" placeholder="请选择部门" clearable>
<el-option
v-for="dict in allDeptList"
:key="dict.deptId"
:label="dict.deptName"
:value="dict.deptId"
/>
</el-select>
</el-form-item>
<el-form-item label="风险点等级" prop="riskGrade">
<el-select v-model="queryParams.riskGrade" placeholder="请选择风险点等级" clearable>
<el-option
@ -158,6 +168,7 @@
<dict-tag :options="dict.type.risk_report_address_type" :value="scope.row.reportAddressType"/>
</template>
</el-table-column>
<el-table-column label="上报单位" align="center" prop="deptName" />
<el-table-column label="风险点位置" align="center" prop="riskLocation" />
<el-table-column label="联系电话" align="center" prop="tel" />
<el-table-column label="涉及群众数量" align="center" prop="peopleQuantity" />
@ -260,7 +271,7 @@
<script>
import { listRisk, getRisk, delRisk, addRisk, updateRisk } from "@/api/ehs/ehsRisk";
import {listAllDept } from "@/api/system/dept";
export default {
name: "Risk",
dicts: ['risk_grade', 'risk_report_address_type'],
@ -280,10 +291,14 @@ export default {
total: 0,
//
riskList: [],
//
allDeptList: [],
//
title: "",
//
open: false,
//
deptShow: false,
//
queryParams: {
pageNum: 1,
@ -309,6 +324,8 @@ export default {
},
created() {
this.getList();
this.getListAllDept();
this.deptShow = this.$store.state.user.parentId==0 ?true :false;
},
methods: {
/** 查询风险信息列表 */
@ -320,6 +337,15 @@ export default {
this.loading = false;
});
},
/** 单位信息列表 */
getListAllDept() {
console.log(this.$store.state.user.deptId);
this.loading = true;
listAllDept().then(response => {
this.allDeptList = response.data;
this.loading = false;
});
},
//
cancel() {
this.open = false;

Loading…
Cancel
Save