@@ -0,0 +1,127 @@ | |||||
package com.ruoyi.web.controller.system; | |||||
import com.ruoyi.common.annotation.Log; | |||||
import com.ruoyi.common.core.controller.BaseController; | |||||
import com.ruoyi.common.core.domain.AjaxResult; | |||||
import com.ruoyi.common.core.page.TableDataInfo; | |||||
import com.ruoyi.common.enums.BusinessType; | |||||
import com.ruoyi.common.utils.poi.ExcelUtil; | |||||
import com.ruoyi.common.utils.translation.TranslateUtils; | |||||
import com.ruoyi.system.domain.SysMenuapp; | |||||
import com.ruoyi.system.service.ISysMenuappService; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.security.access.prepost.PreAuthorize; | |||||
import org.springframework.web.bind.annotation.*; | |||||
import org.springframework.web.multipart.MultipartFile; | |||||
import javax.servlet.http.HttpServletResponse; | |||||
import java.util.List; | |||||
/** | |||||
* 手机菜单Controller | |||||
* | |||||
* @author rongxin | |||||
* @date 2025-09-02 | |||||
*/ | |||||
@RestController | |||||
@RequestMapping("/system/menuapp") | |||||
public class SysMenuappController extends BaseController | |||||
{ | |||||
@Autowired | |||||
private ISysMenuappService sysMenuappService; | |||||
/** | |||||
* 查询手机菜单列表 | |||||
*/ | |||||
@PreAuthorize("@ss.hasPermi('system:menuapp:list')") | |||||
@GetMapping("/list") | |||||
public TableDataInfo list(SysMenuapp sysMenuapp) | |||||
{ | |||||
startPage(); | |||||
List<SysMenuapp> list = sysMenuappService.selectSysMenuappList(sysMenuapp); | |||||
return getDataTable(list); | |||||
} | |||||
/** | |||||
* 导出手机菜单列表 | |||||
*/ | |||||
@PreAuthorize("@ss.hasPermi('system:menuapp:export')") | |||||
@Log(title = "手机菜单", businessType = BusinessType.EXPORT) | |||||
@PostMapping("/export") | |||||
public void export(HttpServletResponse response, SysMenuapp sysMenuapp) | |||||
{ | |||||
List<SysMenuapp> list = sysMenuappService.selectSysMenuappList(sysMenuapp); | |||||
ExcelUtil<SysMenuapp> util = new ExcelUtil<SysMenuapp>(SysMenuapp.class); | |||||
util.exportExcel(response, list, "手机菜单数据"); | |||||
} | |||||
/** | |||||
* 手机菜单导入模板 | |||||
*/ | |||||
@PostMapping("/importTemplate") | |||||
public void importTemplate(HttpServletResponse response) { | |||||
ExcelUtil<SysMenuapp> util = new ExcelUtil<SysMenuapp>(SysMenuapp.class); | |||||
util.importTemplateExcel(response, "手机菜单数据"); | |||||
} | |||||
/** | |||||
* 手机菜单导入 | |||||
*/ | |||||
@Log(title = "手机菜单", businessType = BusinessType.IMPORT) | |||||
@PreAuthorize("@ss.hasPermi('system:menuapp:import')") | |||||
@PostMapping("/importData") | |||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { | |||||
ExcelUtil<SysMenuapp> util = new ExcelUtil<SysMenuapp>(SysMenuapp.class); | |||||
List<SysMenuapp> list = util.importExcel(file.getInputStream(), 0); | |||||
String message = sysMenuappService.importSysMenuapp(list, updateSupport, getUsername()); | |||||
return AjaxResult.success(message); | |||||
} | |||||
/** | |||||
* 获取手机菜单详细信息 | |||||
*/ | |||||
@PreAuthorize("@ss.hasPermi('system:menuapp:query')") | |||||
@GetMapping(value = "/{id}") | |||||
public AjaxResult getInfo(@PathVariable("id") Long id) | |||||
{ | |||||
SysMenuapp detail = sysMenuappService.selectSysMenuappById(id); | |||||
TranslateUtils.translate(detail, false); | |||||
return success(detail); | |||||
} | |||||
/** | |||||
* 新增手机菜单 | |||||
*/ | |||||
@PreAuthorize("@ss.hasPermi('system:menuapp:add')") | |||||
@Log(title = "手机菜单", businessType = BusinessType.INSERT) | |||||
@PostMapping | |||||
public AjaxResult add(@RequestBody SysMenuapp sysMenuapp) | |||||
{ | |||||
return toAjax(sysMenuappService.insertSysMenuapp(sysMenuapp)); | |||||
} | |||||
/** | |||||
* 修改手机菜单 | |||||
*/ | |||||
@PreAuthorize("@ss.hasPermi('system:menuapp:edit')") | |||||
@Log(title = "手机菜单", businessType = BusinessType.UPDATE) | |||||
@PutMapping | |||||
public AjaxResult edit(@RequestBody SysMenuapp sysMenuapp) | |||||
{ | |||||
return toAjax(sysMenuappService.updateSysMenuapp(sysMenuapp)); | |||||
} | |||||
/** | |||||
* 删除手机菜单 | |||||
*/ | |||||
@PreAuthorize("@ss.hasPermi('system:menuapp:remove')") | |||||
@Log(title = "手机菜单", businessType = BusinessType.DELETE) | |||||
@DeleteMapping("/{ids}") | |||||
public AjaxResult remove(@PathVariable Long[] ids) | |||||
{ | |||||
return toAjax(sysMenuappService.deleteSysMenuappByIds(ids)); | |||||
} | |||||
} |
@@ -100,7 +100,9 @@ public class ${ClassName}Controller extends BaseController | |||||
@GetMapping(value = "/{${pkColumn.javaField}}") | @GetMapping(value = "/{${pkColumn.javaField}}") | ||||
public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) | public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) | ||||
{ | { | ||||
return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField})); | |||||
${ClassName} detail = ${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}); | |||||
TranslateUtils.translate(detail, false); | |||||
return success(detail); | |||||
} | } | ||||
/** | /** | ||||
@@ -1,6 +1,6 @@ | |||||
-- 菜单 SQL | -- 菜单 SQL | ||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) | insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) | ||||
values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', sysdate(), '', null, '${functionName}菜单'); | |||||
values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', 'rate', 'admin', sysdate(), '', null, '${functionName}菜单'); | |||||
-- 按钮父菜单ID | -- 按钮父菜单ID | ||||
SELECT @parentId := LAST_INSERT_ID(); | SELECT @parentId := LAST_INSERT_ID(); | ||||
@@ -27,6 +27,4 @@ values('导入', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPre | |||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) | insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) | ||||
values('打印', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:import', '#', 'admin', sysdate(), '', null, ''); | values('打印', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:import', '#', 'admin', sysdate(), '', null, ''); | ||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) | |||||
values('附件', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:attach', '#', 'admin', sysdate(), '', null, ''); | |||||
@@ -191,7 +191,7 @@ | |||||
#set($comment=$column.columnComment) | #set($comment=$column.columnComment) | ||||
#end | #end | ||||
#set($dictType=$column.dictType) | #set($dictType=$column.dictType) | ||||
<el-descriptions-item label="${comment}">#if(($column.htmlType == "select" || $column.htmlType == "checkbox" || $column.htmlType == "radio") && "" != $dictType)<el-tooltip effect="light" :content="form.${field}" placement="right"><dict-tag :options="dict.type.dictType" :value="form.${field}"/></el-tooltip>#elseif($column.htmlType == "imageUpload")<div v-if="!!form.${field}"><el-tooltip effect="light" :content="item" placement="bottom" v-for="(item, index) in form.${field}.split(',')" :key="index"><el-image style="height: 64px; width: 64px; margin: 2px; display: inline-block;" fit="scale-down" :src="baseRoutingUrll + item" :preview-src-list="form.${field}.split(',').map((x) => baseRoutingUrll + x)"/></el-tooltip></div>#elseif($column.htmlType == "editor")<el-tooltip placement="bottom" effect="light"><div slot="content" v-html="form.${field}"/><div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px;">{{ form.${field} }}</div></el-tooltip>#elseif($column.htmlType == "fileUpload")<div v-if="!!form.${field}"><el-tooltip effect="light" :content="item.substr(item.lastIndexOf('/') + 1)" placement="bottom" v-for="(item, index) in form.${field}.split(',')" :key="index"><a :href="baseRoutingUrll + item" target="_blank" style="height: 48px; width: 48px; margin: 2px; display: inline-block; text-align: center;"><img :src="getFileIcon(item)" style="height: 100%;"/></a></el-tooltip></div>#else{{ form.${field} }}#end</el-descriptions-item> | |||||
<el-descriptions-item label="${comment}">{{ form.${field} }}</el-descriptions-item> | |||||
#end | #end | ||||
#end | #end | ||||
#end | #end | ||||
@@ -245,13 +245,7 @@ | |||||
#elseif($column.htmlType == "select" && "" != $dictType) | #elseif($column.htmlType == "select" && "" != $dictType) | ||||
<el-form-item label="${comment}" prop="${field}"> | <el-form-item label="${comment}" prop="${field}"> | ||||
<el-select v-model="form.${field}" placeholder="请选择${comment}"> | <el-select v-model="form.${field}" placeholder="请选择${comment}"> | ||||
<el-option v-for="dict in dict.type.${dictType}" :key="dict.value" :label="dict.label" | |||||
#if($column.javaType == "Integer" || $column.javaType == "Long") | |||||
:value="parseInt(dict.value)" | |||||
#else | |||||
:value="dict.value" | |||||
#end | |||||
></el-option> | |||||
<el-option v-for="dict in dict.type.${dictType}" :key="dict.value" :label="dict.label" #if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.value)" #else:value="dict.value"#end></el-option> | |||||
</el-select> | </el-select> | ||||
</el-form-item> | </el-form-item> | ||||
#elseif($column.htmlType == "select" && $dictType) | #elseif($column.htmlType == "select" && $dictType) | ||||
@@ -275,13 +269,7 @@ | |||||
#elseif($column.htmlType == "radio" && "" != $dictType) | #elseif($column.htmlType == "radio" && "" != $dictType) | ||||
<el-form-item label="${comment}" prop="${field}"> | <el-form-item label="${comment}" prop="${field}"> | ||||
<el-radio-group v-model="form.${field}"> | <el-radio-group v-model="form.${field}"> | ||||
<el-radio v-for="dict in dict.type.${dictType}" :key="dict.value" | |||||
#if($column.javaType == "Integer" || $column.javaType == "Long") | |||||
:label="parseInt(dict.value)" | |||||
#else | |||||
:label="dict.value" | |||||
#end | |||||
>{{dict.label}}</el-radio> | |||||
<el-radio v-for="dict in dict.type.${dictType}" :key="dict.value" #if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)" #else:label="dict.value"#end>{{dict.label}}</el-radio> | |||||
</el-radio-group> | </el-radio-group> | ||||
</el-form-item> | </el-form-item> | ||||
#elseif($column.htmlType == "radio" && $dictType) | #elseif($column.htmlType == "radio" && $dictType) | ||||
@@ -0,0 +1,132 @@ | |||||
package com.ruoyi.system.domain; | |||||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||||
import org.apache.commons.lang3.builder.ToStringStyle; | |||||
import com.ruoyi.common.annotation.Excel; | |||||
import com.ruoyi.common.core.domain.BaseEntity; | |||||
/** | |||||
* 手机菜单对象 sys_menuapp | |||||
* | |||||
* @author rongxin | |||||
* @date 2025-09-02 | |||||
*/ | |||||
public class SysMenuapp extends BaseEntity | |||||
{ | |||||
private static final long serialVersionUID = 1L; | |||||
/** id */ | |||||
private Long id; | |||||
/** 模块名称 */ | |||||
@Excel(name = "模块名称", dictType = "model_type") | |||||
private String modelType; | |||||
/** 菜单名称 */ | |||||
@Excel(name = "菜单名称") | |||||
private String menuName; | |||||
/** 菜单路径 */ | |||||
@Excel(name = "菜单路径") | |||||
private String menuUrl; | |||||
/** 菜单图标 */ | |||||
@Excel(name = "菜单图标") | |||||
private String menuIcon; | |||||
/** 显示顺序 */ | |||||
@Excel(name = "显示顺序") | |||||
private Integer menuNum; | |||||
/** 菜单状态 */ | |||||
@Excel(name = "菜单状态", dictType = "sys_normal_disable") | |||||
private String menuStatus; | |||||
public void setId(Long id) | |||||
{ | |||||
this.id = id; | |||||
} | |||||
public Long getId() | |||||
{ | |||||
return id; | |||||
} | |||||
public void setModelType(String modelType) | |||||
{ | |||||
this.modelType = modelType; | |||||
} | |||||
public String getModelType() | |||||
{ | |||||
return modelType; | |||||
} | |||||
public void setMenuName(String menuName) | |||||
{ | |||||
this.menuName = menuName; | |||||
} | |||||
public String getMenuName() | |||||
{ | |||||
return menuName; | |||||
} | |||||
public void setMenuUrl(String menuUrl) | |||||
{ | |||||
this.menuUrl = menuUrl; | |||||
} | |||||
public String getMenuUrl() | |||||
{ | |||||
return menuUrl; | |||||
} | |||||
public void setMenuIcon(String menuIcon) | |||||
{ | |||||
this.menuIcon = menuIcon; | |||||
} | |||||
public String getMenuIcon() | |||||
{ | |||||
return menuIcon; | |||||
} | |||||
public void setMenuNum(Integer menuNum) | |||||
{ | |||||
this.menuNum = menuNum; | |||||
} | |||||
public Integer getMenuNum() | |||||
{ | |||||
return menuNum; | |||||
} | |||||
public void setMenuStatus(String menuStatus) | |||||
{ | |||||
this.menuStatus = menuStatus; | |||||
} | |||||
public String getMenuStatus() | |||||
{ | |||||
return menuStatus; | |||||
} | |||||
@Override | |||||
public String toString() { | |||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |||||
.append("id", getId()) | |||||
.append("modelType", getModelType()) | |||||
.append("menuName", getMenuName()) | |||||
.append("menuUrl", getMenuUrl()) | |||||
.append("menuIcon", getMenuIcon()) | |||||
.append("menuNum", getMenuNum()) | |||||
.append("menuStatus", getMenuStatus()) | |||||
.append("remark", getRemark()) | |||||
.append("createBy", getCreateBy()) | |||||
.append("createTime", getCreateTime()) | |||||
.append("updateBy", getUpdateBy()) | |||||
.append("updateTime", getUpdateTime()) | |||||
.toString(); | |||||
} | |||||
} |
@@ -0,0 +1,78 @@ | |||||
package com.ruoyi.system.mapper; | |||||
import com.ruoyi.system.domain.SysMenuapp; | |||||
import java.util.List; | |||||
/** | |||||
* 手机菜单Mapper接口 | |||||
* | |||||
* @author rongxin | |||||
* @date 2025-09-02 | |||||
*/ | |||||
public interface SysMenuappMapper | |||||
{ | |||||
/** | |||||
* 查询手机菜单 | |||||
* | |||||
* @param id 手机菜单主键 | |||||
* @return 手机菜单 | |||||
*/ | |||||
public SysMenuapp selectSysMenuappById(Long id); | |||||
/** | |||||
* 查询手机菜单列表 | |||||
* | |||||
* @param sysMenuapp 手机菜单 | |||||
* @return 手机菜单集合 | |||||
*/ | |||||
public List<SysMenuapp> selectSysMenuappList(SysMenuapp sysMenuapp); | |||||
/** | |||||
* 新增手机菜单 | |||||
* | |||||
* @param sysMenuapp 手机菜单 | |||||
* @return 结果 | |||||
*/ | |||||
public int insertSysMenuapp(SysMenuapp sysMenuapp); | |||||
/** | |||||
* 批量新增手机菜单 | |||||
* | |||||
* @param list 手机菜单 | |||||
* @return 结果 | |||||
*/ | |||||
public int insertSysMenuappBatch(List<SysMenuapp> list); | |||||
/** | |||||
* 修改手机菜单 | |||||
* | |||||
* @param sysMenuapp 手机菜单 | |||||
* @return 结果 | |||||
*/ | |||||
public int updateSysMenuapp(SysMenuapp sysMenuapp); | |||||
/** | |||||
* 批量修改 手机菜单 | |||||
* | |||||
* @param list 手机菜单 | |||||
* @return 结果 | |||||
*/ | |||||
public int updateSysMenuappBatch(List<SysMenuapp> list); | |||||
/** | |||||
* 删除手机菜单 | |||||
* | |||||
* @param id 手机菜单主键 | |||||
* @return 结果 | |||||
*/ | |||||
public int deleteSysMenuappById(Long id); | |||||
/** | |||||
* 批量删除手机菜单 | |||||
* | |||||
* @param ids 需要删除的数据主键集合 | |||||
* @return 结果 | |||||
*/ | |||||
public int deleteSysMenuappByIds(Long[] ids); | |||||
} |
@@ -0,0 +1,88 @@ | |||||
package com.ruoyi.system.service; | |||||
import com.ruoyi.system.domain.SysMenuapp; | |||||
import java.util.List; | |||||
/** | |||||
* 手机菜单Service接口 | |||||
* | |||||
* @author rongxin | |||||
* @date 2025-09-02 | |||||
*/ | |||||
public interface ISysMenuappService | |||||
{ | |||||
/** | |||||
* 查询手机菜单 | |||||
* | |||||
* @param id 手机菜单主键 | |||||
* @return 手机菜单 | |||||
*/ | |||||
public SysMenuapp selectSysMenuappById(Long id); | |||||
/** | |||||
* 查询手机菜单列表 | |||||
* | |||||
* @param sysMenuapp 手机菜单 | |||||
* @return 手机菜单集合 | |||||
*/ | |||||
public List<SysMenuapp> selectSysMenuappList(SysMenuapp sysMenuapp); | |||||
/** | |||||
* 导入手机菜单数据 | |||||
* | |||||
* @param list 手机菜单数据列表 | |||||
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 | |||||
* @param userName 操作用户 | |||||
* @return 结果 | |||||
*/ | |||||
public String importSysMenuapp(List<SysMenuapp> list, Boolean isUpdateSupport, String userName); | |||||
/** | |||||
* 新增手机菜单 | |||||
* | |||||
* @param sysMenuapp 手机菜单 | |||||
* @return 结果 | |||||
*/ | |||||
public int insertSysMenuapp(SysMenuapp sysMenuapp); | |||||
/** | |||||
* 批量新增手机菜单 | |||||
* | |||||
* @param list 手机菜单 | |||||
* @return 结果 | |||||
*/ | |||||
public int insertSysMenuappBatch(List<SysMenuapp> list); | |||||
/** | |||||
* 修改手机菜单 | |||||
* | |||||
* @param sysMenuapp 手机菜单 | |||||
* @return 结果 | |||||
*/ | |||||
public int updateSysMenuapp(SysMenuapp sysMenuapp); | |||||
/** | |||||
* 批量修改 手机菜单 | |||||
* | |||||
* @param list 手机菜单 | |||||
* @return 结果 | |||||
*/ | |||||
public int updateSysMenuappBatch(List<SysMenuapp> list); | |||||
/** | |||||
* 批量删除手机菜单 | |||||
* | |||||
* @param ids 需要删除的手机菜单主键集合 | |||||
* @return 结果 | |||||
*/ | |||||
public int deleteSysMenuappByIds(Long[] ids); | |||||
/** | |||||
* 删除手机菜单信息 | |||||
* | |||||
* @param id 手机菜单主键 | |||||
* @return 结果 | |||||
*/ | |||||
public int deleteSysMenuappById(Long id); | |||||
} |
@@ -0,0 +1,197 @@ | |||||
package com.ruoyi.system.service.impl; | |||||
import com.ruoyi.common.exception.ServiceException; | |||||
import com.ruoyi.common.utils.DateUtils; | |||||
import com.ruoyi.common.utils.StringUtils; | |||||
import com.ruoyi.system.domain.SysMenuapp; | |||||
import com.ruoyi.system.mapper.SysMenuappMapper; | |||||
import com.ruoyi.system.service.ISysMenuappService; | |||||
import org.apache.commons.collections4.ListUtils; | |||||
import org.apache.commons.compress.utils.Lists; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | |||||
import org.springframework.transaction.annotation.Transactional; | |||||
import java.util.List; | |||||
import java.util.stream.Collectors; | |||||
/** | |||||
* 手机菜单Service业务层处理 | |||||
* | |||||
* @author rongxin | |||||
* @date 2025-09-02 | |||||
*/ | |||||
@Service | |||||
public class SysMenuappServiceImpl implements ISysMenuappService | |||||
{ | |||||
@Autowired | |||||
private SysMenuappMapper sysMenuappMapper; | |||||
/** | |||||
* 查询手机菜单 | |||||
* | |||||
* @param id 手机菜单主键 | |||||
* @return 手机菜单 | |||||
*/ | |||||
@Override | |||||
public SysMenuapp selectSysMenuappById(Long id) | |||||
{ | |||||
return sysMenuappMapper.selectSysMenuappById(id); | |||||
} | |||||
/** | |||||
* 查询手机菜单列表 | |||||
* | |||||
* @param sysMenuapp 手机菜单 | |||||
* @return 手机菜单 | |||||
*/ | |||||
@Override | |||||
public List<SysMenuapp> selectSysMenuappList(SysMenuapp sysMenuapp) | |||||
{ | |||||
return sysMenuappMapper.selectSysMenuappList(sysMenuapp); | |||||
} | |||||
/** | |||||
* 导入手机菜单数据 | |||||
* | |||||
* @param list 手机菜单数据列表 | |||||
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 | |||||
* @param operName 操作用户 | |||||
* @return 结果 | |||||
*/ | |||||
@Override | |||||
@Transactional | |||||
public String importSysMenuapp(List<SysMenuapp> list, Boolean isUpdateSupport, String operName) { | |||||
if (StringUtils.isEmpty(list)) { | |||||
throw new ServiceException("导入手机菜单数据不能为空!"); | |||||
} | |||||
int successNum = 0; | |||||
int failureNum = 0; | |||||
StringBuilder successMsg = new StringBuilder(); | |||||
StringBuilder failureMsg = new StringBuilder(); | |||||
List<SysMenuapp> insertList = Lists.newArrayList(); | |||||
List<SysMenuapp> updateList = Lists.newArrayList(); | |||||
// 缓存已存在的数据 | |||||
SysMenuapp sysMenuapp = new SysMenuapp(); | |||||
List<SysMenuapp> sysMenuappList = sysMenuappMapper.selectSysMenuappList(sysMenuapp); | |||||
for (SysMenuapp item : list) { | |||||
// 验证是否存在这个手机菜单信息 | |||||
Long id = item.getId(); | |||||
List<SysMenuapp> filters = sysMenuappList.stream().filter(a -> a.getId().equals(id)).collect(Collectors.toList()); | |||||
if (StringUtils.isEmpty(filters)) { //不存在时,直接插入 | |||||
item.setCreateBy(operName); | |||||
item.setCreateTime(DateUtils.getNowDate()); | |||||
insertList.add(item); | |||||
successNum++; | |||||
} else { //存在时 | |||||
if(isUpdateSupport){ //勾选则更新 | |||||
item.setUpdateBy(operName); | |||||
item.setUpdateTime(DateUtils.getNowDate()); | |||||
item.setId(filters.get(0).getId()); | |||||
updateList.add(item); | |||||
successNum++; | |||||
} | |||||
} | |||||
} | |||||
// 执行更新或者保存 | |||||
List<List<SysMenuapp>> insertSplists = ListUtils.partition(insertList, 50); | |||||
insertSplists.forEach(insertSplist ->{ | |||||
sysMenuappMapper.insertSysMenuappBatch(insertSplist); | |||||
}); | |||||
List<List<SysMenuapp>> updateSplists = ListUtils.partition(updateList, 30); | |||||
updateSplists.forEach(updateSplist ->{ | |||||
sysMenuappMapper.updateSysMenuappBatch(updateSplist); | |||||
}); | |||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条。"); | |||||
return successMsg.toString(); | |||||
} | |||||
/** | |||||
* 新增手机菜单 | |||||
* | |||||
* @param sysMenuapp 手机菜单 | |||||
* @return 结果 | |||||
*/ | |||||
@Override | |||||
public int insertSysMenuapp(SysMenuapp sysMenuapp) | |||||
{ | |||||
sysMenuapp.setCreateTime(DateUtils.getNowDate()); | |||||
return sysMenuappMapper.insertSysMenuapp(sysMenuapp); | |||||
} | |||||
/** | |||||
* 批量新增手机菜单 | |||||
* | |||||
* @param list 手机菜单 | |||||
* @return 结果 | |||||
*/ | |||||
@Override | |||||
@Transactional | |||||
public int insertSysMenuappBatch(List<SysMenuapp> list){ | |||||
List<List<SysMenuapp>> splists = ListUtils.partition(list, 50); | |||||
splists.forEach(splist->{ | |||||
sysMenuappMapper.insertSysMenuappBatch(splist); | |||||
}); | |||||
return 1; | |||||
} | |||||
/** | |||||
* 修改手机菜单 | |||||
* | |||||
* @param sysMenuapp 手机菜单 | |||||
* @return 结果 | |||||
*/ | |||||
@Override | |||||
public int updateSysMenuapp(SysMenuapp sysMenuapp) | |||||
{ | |||||
sysMenuapp.setUpdateTime(DateUtils.getNowDate()); | |||||
return sysMenuappMapper.updateSysMenuapp(sysMenuapp); | |||||
} | |||||
/** | |||||
* 批量修改 手机菜单 | |||||
* | |||||
* @param list 手机菜单 | |||||
* @return 结果 | |||||
*/ | |||||
@Override | |||||
@Transactional | |||||
public int updateSysMenuappBatch(List<SysMenuapp> list) { | |||||
List<List<SysMenuapp>> splists = ListUtils.partition(list, 30); | |||||
splists.forEach(splist->{ | |||||
sysMenuappMapper.updateSysMenuappBatch(splist); | |||||
}); | |||||
return 1; | |||||
} | |||||
/** | |||||
* 批量删除手机菜单 | |||||
* | |||||
* @param ids 需要删除的手机菜单主键 | |||||
* @return 结果 | |||||
*/ | |||||
@Override | |||||
public int deleteSysMenuappByIds(Long[] ids) | |||||
{ | |||||
return sysMenuappMapper.deleteSysMenuappByIds(ids); | |||||
} | |||||
/** | |||||
* 删除手机菜单信息 | |||||
* | |||||
* @param id 手机菜单主键 | |||||
* @return 结果 | |||||
*/ | |||||
@Override | |||||
public int deleteSysMenuappById(Long id) | |||||
{ | |||||
return sysMenuappMapper.deleteSysMenuappById(id); | |||||
} | |||||
} |
@@ -67,7 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||
</select> | </select> | ||||
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult"> | <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 d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.import_code, d.org_code, d.longitude, d.latitude, d.del_flag, | |||||
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name | (select dept_name from sys_dept where dept_id = d.parent_id) parent_name | ||||
from sys_dept d | from sys_dept d | ||||
where d.dept_id = #{deptId} | where d.dept_id = #{deptId} | ||||
@@ -0,0 +1,152 @@ | |||||
<?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.ruoyi.system.mapper.SysMenuappMapper"> | |||||
<resultMap type="SysMenuapp" id="SysMenuappResult"> | |||||
<result property="id" column="id" /> | |||||
<result property="modelType" column="model_type" /> | |||||
<result property="menuName" column="menu_name" /> | |||||
<result property="menuUrl" column="menu_url" /> | |||||
<result property="menuIcon" column="menu_icon" /> | |||||
<result property="menuNum" column="menu_num" /> | |||||
<result property="menuStatus" column="menu_status" /> | |||||
<result property="remark" column="remark" /> | |||||
<result property="createBy" column="create_by" /> | |||||
<result property="createTime" column="create_time" /> | |||||
<result property="updateBy" column="update_by" /> | |||||
<result property="updateTime" column="update_time" /> | |||||
</resultMap> | |||||
<sql id="selectSysMenuappVo"> | |||||
select id, model_type, menu_name, menu_url, menu_icon, menu_num, menu_status, remark, create_by, create_time, update_by, update_time from sys_menuapp | |||||
</sql> | |||||
<select id="selectSysMenuappList" parameterType="SysMenuapp" resultMap="SysMenuappResult"> | |||||
<include refid="selectSysMenuappVo"/> | |||||
<where> | |||||
<if test="modelType != null and modelType != ''"> and model_type = #{modelType}</if> | |||||
<if test="menuName != null and menuName != ''"> and menu_name like concat('%', #{menuName}, '%')</if> | |||||
<if test="menuStatus != null and menuStatus != ''"> and menu_status = #{menuStatus}</if> | |||||
</where> | |||||
</select> | |||||
<select id="selectSysMenuappById" parameterType="Long" resultMap="SysMenuappResult"> | |||||
<include refid="selectSysMenuappVo"/> | |||||
where id = #{id} | |||||
</select> | |||||
<insert id="insertSysMenuapp" parameterType="SysMenuapp" useGeneratedKeys="true" keyProperty="id"> | |||||
insert into sys_menuapp | |||||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||||
<if test="modelType != null and modelType != ''">model_type,</if> | |||||
<if test="menuName != null and menuName != ''">menu_name,</if> | |||||
<if test="menuUrl != null and menuUrl != ''">menu_url,</if> | |||||
<if test="menuIcon != null and menuIcon != ''">menu_icon,</if> | |||||
<if test="menuNum != null">menu_num,</if> | |||||
<if test="menuStatus != null and menuStatus != ''">menu_status,</if> | |||||
<if test="remark != null">remark,</if> | |||||
<if test="createBy != null">create_by,</if> | |||||
<if test="createTime != null">create_time,</if> | |||||
<if test="updateBy != null">update_by,</if> | |||||
<if test="updateTime != null">update_time,</if> | |||||
</trim> | |||||
<trim prefix="values (" suffix=")" suffixOverrides=","> | |||||
<if test="modelType != null and modelType != ''">#{modelType},</if> | |||||
<if test="menuName != null and menuName != ''">#{menuName},</if> | |||||
<if test="menuUrl != null and menuUrl != ''">#{menuUrl},</if> | |||||
<if test="menuIcon != null and menuIcon != ''">#{menuIcon},</if> | |||||
<if test="menuNum != null">#{menuNum},</if> | |||||
<if test="menuStatus != null and menuStatus != ''">#{menuStatus},</if> | |||||
<if test="remark != null">#{remark},</if> | |||||
<if test="createBy != null">#{createBy},</if> | |||||
<if test="createTime != null">#{createTime},</if> | |||||
<if test="updateBy != null">#{updateBy},</if> | |||||
<if test="updateTime != null">#{updateTime},</if> | |||||
</trim> | |||||
</insert> | |||||
<insert id="insertSysMenuappBatch" parameterType="list" useGeneratedKeys="true" keyProperty="id"> | |||||
insert into sys_menuapp | |||||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||||
model_type, | |||||
menu_name, | |||||
menu_url, | |||||
menu_icon, | |||||
menu_num, | |||||
menu_status, | |||||
remark, | |||||
create_by, | |||||
create_time, | |||||
update_by, | |||||
update_time, | |||||
</trim> | |||||
values | |||||
<foreach item="item" collection="list" separator="," > | |||||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||||
#{item.modelType}, | |||||
#{item.menuName}, | |||||
#{item.menuUrl}, | |||||
#{item.menuIcon}, | |||||
#{item.menuNum}, | |||||
#{item.menuStatus}, | |||||
#{item.remark}, | |||||
#{item.createBy}, | |||||
#{item.createTime}, | |||||
#{item.updateBy}, | |||||
#{item.updateTime}, | |||||
</trim> | |||||
</foreach> | |||||
</insert> | |||||
<update id="updateSysMenuapp" parameterType="SysMenuapp"> | |||||
update sys_menuapp | |||||
<trim prefix="SET" suffixOverrides=","> | |||||
<if test="modelType != null and modelType != ''">model_type = #{modelType},</if> | |||||
<if test="menuName != null and menuName != ''">menu_name = #{menuName},</if> | |||||
<if test="menuUrl != null and menuUrl != ''">menu_url = #{menuUrl},</if> | |||||
<if test="menuIcon != null and menuIcon != ''">menu_icon = #{menuIcon},</if> | |||||
<if test="menuNum != null">menu_num = #{menuNum},</if> | |||||
<if test="menuStatus != null and menuStatus != ''">menu_status = #{menuStatus},</if> | |||||
<if test="remark != null">remark = #{remark},</if> | |||||
<if test="createBy != null">create_by = #{createBy},</if> | |||||
<if test="createTime != null">create_time = #{createTime},</if> | |||||
<if test="updateBy != null">update_by = #{updateBy},</if> | |||||
<if test="updateTime != null">update_time = #{updateTime},</if> | |||||
</trim> | |||||
where id = #{id} | |||||
</update> | |||||
<!--批量更新--> | |||||
<update id="updateSysMenuappBatch" parameterType="list" > | |||||
<foreach collection="list" item="item" index="index" open="" close="" separator=";"> | |||||
update sys_menuapp | |||||
<set> | |||||
<if test="item.modelType != null and item.modelType != ''">model_type = #{item.modelType},</if> | |||||
<if test="item.menuName != null and item.menuName != ''">menu_name = #{item.menuName},</if> | |||||
<if test="item.menuUrl != null and item.menuUrl != ''">menu_url = #{item.menuUrl},</if> | |||||
<if test="item.menuIcon != null and item.menuIcon != ''">menu_icon = #{item.menuIcon},</if> | |||||
<if test="item.menuNum != null">menu_num = #{item.menuNum},</if> | |||||
<if test="item.menuStatus != null and item.menuStatus != ''">menu_status = #{item.menuStatus},</if> | |||||
<if test="item.remark != null">remark = #{item.remark},</if> | |||||
<if test="item.createBy != null">create_by = #{item.createBy},</if> | |||||
<if test="item.createTime != null">create_time = #{item.createTime},</if> | |||||
<if test="item.updateBy != null">update_by = #{item.updateBy},</if> | |||||
<if test="item.updateTime != null">update_time = #{item.updateTime},</if> | |||||
</set> | |||||
where id = #{item.id} | |||||
</foreach> | |||||
</update> | |||||
<delete id="deleteSysMenuappById" parameterType="Long"> | |||||
delete from sys_menuapp where id = #{id} | |||||
</delete> | |||||
<delete id="deleteSysMenuappByIds" parameterType="String"> | |||||
delete from sys_menuapp where id in | |||||
<foreach item="id" collection="array" open="(" separator="," close=")"> | |||||
#{id} | |||||
</foreach> | |||||
</delete> | |||||
</mapper> |