更新物料模块菜单与权限配置,新增ON DUPLICATE KEY UPDATE语句以优化插入逻辑,确保菜单项的唯一性和更新能力。同时,更新pnpm-lock.yaml以添加新依赖项和版本信息。
This commit is contained in:
@@ -1,53 +1,91 @@
|
||||
-- MES 物料模块菜单与权限(JeecgBoot)
|
||||
-- 执行前可按需改 ID;默认授权 admin 角色(role_id=f6817f48af4fb3af11b9e8bf182f618b)
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
-- 一级菜单:MES管理
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, menu_type, perms, perms_type, sort_no, is_route, is_leaf, hidden, status, del_flag, always_show, keep_alive, internal_or_external, create_by, create_time)
|
||||
VALUES ('1860000000000000001', NULL, 'MES管理', '/mes', 'layouts/RouteView', 'MesRoot', 0, NULL, '1', 50, 0, 0, 0, '1', 0, 1, 0, 0, 'admin', NOW());
|
||||
VALUES ('1860000000000000001', NULL, 'MES管理', '/mes', 'layouts/RouteView', 'MesRoot', 0, NULL, '1', 50, 0, 0, 0, '1', 0, 1, 0, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id=VALUES(parent_id), name=VALUES(name), url=VALUES(url), component=VALUES(component), component_name=VALUES(component_name),
|
||||
menu_type=VALUES(menu_type), perms=VALUES(perms), perms_type=VALUES(perms_type), sort_no=VALUES(sort_no),
|
||||
is_route=VALUES(is_route), is_leaf=VALUES(is_leaf), hidden=VALUES(hidden), status=VALUES(status), del_flag=VALUES(del_flag),
|
||||
always_show=VALUES(always_show), keep_alive=VALUES(keep_alive), internal_or_external=VALUES(internal_or_external);
|
||||
|
||||
-- 二级菜单:物料信息
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, menu_type, perms, perms_type, sort_no, is_route, is_leaf, hidden, status, del_flag, keep_alive, internal_or_external, create_by, create_time)
|
||||
VALUES ('1860000000000000011', '1860000000000000001', '物料信息', '/mes/materialinfo', 'mes/materialinfo/index', 'MesMaterialList', 1, NULL, '1', 1, 1, 1, 0, '1', 0, 1, 0, 'admin', NOW());
|
||||
VALUES ('1860000000000000011', '1860000000000000001', '物料信息', '/mes/materialinfo', 'mes/materialinfo/index', 'MesMaterialList', 1, NULL, '1', 1, 1, 1, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id=VALUES(parent_id), name=VALUES(name), url=VALUES(url), component=VALUES(component), component_name=VALUES(component_name),
|
||||
menu_type=VALUES(menu_type), perms=VALUES(perms), perms_type=VALUES(perms_type), sort_no=VALUES(sort_no),
|
||||
is_route=VALUES(is_route), is_leaf=VALUES(is_leaf), hidden=VALUES(hidden), status=VALUES(status), del_flag=VALUES(del_flag),
|
||||
keep_alive=VALUES(keep_alive), internal_or_external=VALUES(internal_or_external);
|
||||
INSERT INTO sys_permission(id,parent_id,name,menu_type,perms,perms_type,status,del_flag,create_by,create_time) VALUES
|
||||
('1860000000000000012','1860000000000000011','新增',2,'mes:mes_material:add','1','1',0,'admin',NOW()),
|
||||
('1860000000000000013','1860000000000000011','编辑',2,'mes:mes_material:edit','1','1',0,'admin',NOW()),
|
||||
('1860000000000000014','1860000000000000011','删除',2,'mes:mes_material:delete','1','1',0,'admin',NOW()),
|
||||
('1860000000000000015','1860000000000000011','批量删除',2,'mes:mes_material:deleteBatch','1','1',0,'admin',NOW()),
|
||||
('1860000000000000016','1860000000000000011','导出',2,'mes:mes_material:exportXls','1','1',0,'admin',NOW()),
|
||||
('1860000000000000017','1860000000000000011','导入',2,'mes:mes_material:importExcel','1','1',0,'admin',NOW());
|
||||
('1860000000000000017','1860000000000000011','导入',2,'mes:mes_material:importExcel','1','1',0,'admin',NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id=VALUES(parent_id), name=VALUES(name), menu_type=VALUES(menu_type), perms=VALUES(perms), perms_type=VALUES(perms_type),
|
||||
status=VALUES(status), del_flag=VALUES(del_flag);
|
||||
|
||||
-- 二级菜单:单位信息
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, menu_type, perms, perms_type, sort_no, is_route, is_leaf, hidden, status, del_flag, keep_alive, internal_or_external, create_by, create_time)
|
||||
VALUES ('1860000000000000021', '1860000000000000001', '单位信息', '/mes/materialunit', 'mes/materialunit/index', 'MesUnitList', 1, NULL, '1', 2, 1, 1, 0, '1', 0, 1, 0, 'admin', NOW());
|
||||
VALUES ('1860000000000000021', '1860000000000000001', '单位信息', '/mes/materialunit', 'mes/materialunit/index', 'MesUnitList', 1, NULL, '1', 2, 1, 1, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id=VALUES(parent_id), name=VALUES(name), url=VALUES(url), component=VALUES(component), component_name=VALUES(component_name),
|
||||
menu_type=VALUES(menu_type), perms=VALUES(perms), perms_type=VALUES(perms_type), sort_no=VALUES(sort_no),
|
||||
is_route=VALUES(is_route), is_leaf=VALUES(is_leaf), hidden=VALUES(hidden), status=VALUES(status), del_flag=VALUES(del_flag),
|
||||
keep_alive=VALUES(keep_alive), internal_or_external=VALUES(internal_or_external);
|
||||
INSERT INTO sys_permission(id,parent_id,name,menu_type,perms,perms_type,status,del_flag,create_by,create_time) VALUES
|
||||
('1860000000000000022','1860000000000000021','新增',2,'mes:mes_unit:add','1','1',0,'admin',NOW()),
|
||||
('1860000000000000023','1860000000000000021','编辑',2,'mes:mes_unit:edit','1','1',0,'admin',NOW()),
|
||||
('1860000000000000024','1860000000000000021','删除',2,'mes:mes_unit:delete','1','1',0,'admin',NOW()),
|
||||
('1860000000000000025','1860000000000000021','批量删除',2,'mes:mes_unit:deleteBatch','1','1',0,'admin',NOW()),
|
||||
('1860000000000000026','1860000000000000021','导出',2,'mes:mes_unit:exportXls','1','1',0,'admin',NOW()),
|
||||
('1860000000000000027','1860000000000000021','导入',2,'mes:mes_unit:importExcel','1','1',0,'admin',NOW());
|
||||
('1860000000000000027','1860000000000000021','导入',2,'mes:mes_unit:importExcel','1','1',0,'admin',NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id=VALUES(parent_id), name=VALUES(name), menu_type=VALUES(menu_type), perms=VALUES(perms), perms_type=VALUES(perms_type),
|
||||
status=VALUES(status), del_flag=VALUES(del_flag);
|
||||
|
||||
-- 二级菜单:物料分类
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, menu_type, perms, perms_type, sort_no, is_route, is_leaf, hidden, status, del_flag, keep_alive, internal_or_external, create_by, create_time)
|
||||
VALUES ('1860000000000000031', '1860000000000000001', '物料分类', '/mes/materialcategory', 'mes/materialcategory/index', 'MesMaterialCategoryList', 1, NULL, '1', 3, 1, 1, 0, '1', 0, 1, 0, 'admin', NOW());
|
||||
VALUES ('1860000000000000031', '1860000000000000001', '物料分类', '/mes/materialcategory', 'mes/materialcategory/index', 'MesMaterialCategoryList', 1, NULL, '1', 3, 1, 1, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id=VALUES(parent_id), name=VALUES(name), url=VALUES(url), component=VALUES(component), component_name=VALUES(component_name),
|
||||
menu_type=VALUES(menu_type), perms=VALUES(perms), perms_type=VALUES(perms_type), sort_no=VALUES(sort_no),
|
||||
is_route=VALUES(is_route), is_leaf=VALUES(is_leaf), hidden=VALUES(hidden), status=VALUES(status), del_flag=VALUES(del_flag),
|
||||
keep_alive=VALUES(keep_alive), internal_or_external=VALUES(internal_or_external);
|
||||
INSERT INTO sys_permission(id,parent_id,name,menu_type,perms,perms_type,status,del_flag,create_by,create_time) VALUES
|
||||
('1860000000000000032','1860000000000000031','新增',2,'mes:mes_material_category:add','1','1',0,'admin',NOW()),
|
||||
('1860000000000000033','1860000000000000031','编辑',2,'mes:mes_material_category:edit','1','1',0,'admin',NOW()),
|
||||
('1860000000000000034','1860000000000000031','删除',2,'mes:mes_material_category:delete','1','1',0,'admin',NOW()),
|
||||
('1860000000000000035','1860000000000000031','批量删除',2,'mes:mes_material_category:deleteBatch','1','1',0,'admin',NOW()),
|
||||
('1860000000000000036','1860000000000000031','导出',2,'mes:mes_material_category:exportXls','1','1',0,'admin',NOW()),
|
||||
('1860000000000000037','1860000000000000031','导入',2,'mes:mes_material_category:importExcel','1','1',0,'admin',NOW());
|
||||
('1860000000000000037','1860000000000000031','导入',2,'mes:mes_material_category:importExcel','1','1',0,'admin',NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id=VALUES(parent_id), name=VALUES(name), menu_type=VALUES(menu_type), perms=VALUES(perms), perms_type=VALUES(perms_type),
|
||||
status=VALUES(status), del_flag=VALUES(del_flag);
|
||||
|
||||
-- 二级菜单:ERP映射
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, menu_type, perms, perms_type, sort_no, is_route, is_leaf, hidden, status, del_flag, keep_alive, internal_or_external, create_by, create_time)
|
||||
VALUES ('1860000000000000041', '1860000000000000001', 'ERP映射', '/mes/materialerpmap', 'mes/materialerpmap/index', 'MesMaterialErpMapList', 1, NULL, '1', 4, 1, 1, 0, '1', 0, 1, 0, 'admin', NOW());
|
||||
VALUES ('1860000000000000041', '1860000000000000001', 'ERP映射', '/mes/materialerpmap', 'mes/materialerpmap/index', 'MesMaterialErpMapList', 1, NULL, '1', 4, 1, 1, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id=VALUES(parent_id), name=VALUES(name), url=VALUES(url), component=VALUES(component), component_name=VALUES(component_name),
|
||||
menu_type=VALUES(menu_type), perms=VALUES(perms), perms_type=VALUES(perms_type), sort_no=VALUES(sort_no),
|
||||
is_route=VALUES(is_route), is_leaf=VALUES(is_leaf), hidden=VALUES(hidden), status=VALUES(status), del_flag=VALUES(del_flag),
|
||||
keep_alive=VALUES(keep_alive), internal_or_external=VALUES(internal_or_external);
|
||||
INSERT INTO sys_permission(id,parent_id,name,menu_type,perms,perms_type,status,del_flag,create_by,create_time) VALUES
|
||||
('1860000000000000042','1860000000000000041','新增',2,'mes:mes_material_erp_map:add','1','1',0,'admin',NOW()),
|
||||
('1860000000000000043','1860000000000000041','编辑',2,'mes:mes_material_erp_map:edit','1','1',0,'admin',NOW()),
|
||||
('1860000000000000044','1860000000000000041','删除',2,'mes:mes_material_erp_map:delete','1','1',0,'admin',NOW()),
|
||||
('1860000000000000045','1860000000000000041','批量删除',2,'mes:mes_material_erp_map:deleteBatch','1','1',0,'admin',NOW()),
|
||||
('1860000000000000046','1860000000000000041','导出',2,'mes:mes_material_erp_map:exportXls','1','1',0,'admin',NOW()),
|
||||
('1860000000000000047','1860000000000000041','导入',2,'mes:mes_material_erp_map:importExcel','1','1',0,'admin',NOW());
|
||||
('1860000000000000047','1860000000000000041','导入',2,'mes:mes_material_erp_map:importExcel','1','1',0,'admin',NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id=VALUES(parent_id), name=VALUES(name), menu_type=VALUES(menu_type), perms=VALUES(perms), perms_type=VALUES(perms_type),
|
||||
status=VALUES(status), del_flag=VALUES(del_flag);
|
||||
|
||||
-- admin 角色授权
|
||||
INSERT INTO sys_role_permission(id, role_id, permission_id, operate_date, operate_ip)
|
||||
@@ -59,6 +97,11 @@ WHERE p.id IN (
|
||||
'1860000000000000021','1860000000000000022','1860000000000000023','1860000000000000024','1860000000000000025','1860000000000000026','1860000000000000027',
|
||||
'1860000000000000031','1860000000000000032','1860000000000000033','1860000000000000034','1860000000000000035','1860000000000000036','1860000000000000037',
|
||||
'1860000000000000041','1860000000000000042','1860000000000000043','1860000000000000044','1860000000000000045','1860000000000000046','1860000000000000047'
|
||||
) AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM sys_role_permission rp
|
||||
WHERE rp.role_id = 'f6817f48af4fb3af11b9e8bf182f618b'
|
||||
AND rp.permission_id = p.id
|
||||
);
|
||||
|
||||
-- ======================================================
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
package org.jeecg.modules.print.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.print.entity.PrintTemplate;
|
||||
import org.jeecg.modules.print.service.IPrintTemplateService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 打印模板维护(Hiprint)
|
||||
*/
|
||||
@Slf4j
|
||||
@Tag(name = "打印模板")
|
||||
@RestController
|
||||
@RequestMapping("/print/template")
|
||||
public class PrintTemplateController extends JeecgController<PrintTemplate, IPrintTemplateService> {
|
||||
|
||||
@Operation(summary = "打印模板-分页列表")
|
||||
@GetMapping(value = "/list")
|
||||
@RequiresPermissions("print:template:list")
|
||||
public Result<IPage<PrintTemplate>> list(
|
||||
PrintTemplate query,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<PrintTemplate> qw = QueryGenerator.initQueryWrapper(query, req.getParameterMap());
|
||||
qw.orderByDesc("create_time");
|
||||
Page<PrintTemplate> page = new Page<>(pageNo, pageSize);
|
||||
return Result.OK(service.page(page, qw));
|
||||
}
|
||||
|
||||
@AutoLog(value = "打印模板-添加")
|
||||
@Operation(summary = "打印模板-添加")
|
||||
@PostMapping(value = "/add")
|
||||
@RequiresPermissions("print:template:add")
|
||||
public Result<String> add(@RequestBody PrintTemplate entity) {
|
||||
if (StringUtils.isBlank(entity.getTemplateCode())) {
|
||||
return Result.error("模板编码不能为空");
|
||||
}
|
||||
if (service.getByCode(entity.getTemplateCode()) != null) {
|
||||
return Result.error("模板编码已存在");
|
||||
}
|
||||
if (StringUtils.isBlank(entity.getTemplateJson())) {
|
||||
entity.setTemplateJson("{}");
|
||||
}
|
||||
service.save(entity);
|
||||
return Result.OK("添加成功");
|
||||
}
|
||||
|
||||
@AutoLog(value = "打印模板-编辑")
|
||||
@Operation(summary = "打印模板-编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
@RequiresPermissions("print:template:edit")
|
||||
public Result<String> edit(@RequestBody PrintTemplate entity) {
|
||||
PrintTemplate db = service.getById(entity.getId());
|
||||
if (db == null) {
|
||||
return Result.error("记录不存在");
|
||||
}
|
||||
if (StringUtils.isNotBlank(entity.getTemplateCode())
|
||||
&& !entity.getTemplateCode().equals(db.getTemplateCode())) {
|
||||
if (service.getByCode(entity.getTemplateCode()) != null) {
|
||||
return Result.error("模板编码已存在");
|
||||
}
|
||||
}
|
||||
service.updateById(entity);
|
||||
return Result.OK("修改成功");
|
||||
}
|
||||
|
||||
@AutoLog(value = "打印模板-保存JSON")
|
||||
@Operation(summary = "打印模板-保存模板JSON")
|
||||
@PostMapping(value = "/saveJson")
|
||||
@RequiresPermissions("print:template:edit")
|
||||
public Result<String> saveJson(@RequestBody Map<String, String> body) {
|
||||
String id = body.get("id");
|
||||
String templateJson = body.get("templateJson");
|
||||
if (StringUtils.isBlank(id)) {
|
||||
return Result.error("id 不能为空");
|
||||
}
|
||||
if (templateJson == null) {
|
||||
return Result.error("templateJson 不能为空");
|
||||
}
|
||||
PrintTemplate db = service.getById(id);
|
||||
if (db == null) {
|
||||
return Result.error("记录不存在");
|
||||
}
|
||||
db.setTemplateJson(templateJson);
|
||||
service.updateById(db);
|
||||
return Result.OK("保存成功");
|
||||
}
|
||||
|
||||
@AutoLog(value = "打印模板-删除")
|
||||
@Operation(summary = "打印模板-删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
@RequiresPermissions("print:template:delete")
|
||||
public Result<String> delete(@RequestParam(name = "id") String id) {
|
||||
service.removeById(id);
|
||||
return Result.OK("删除成功");
|
||||
}
|
||||
|
||||
@AutoLog(value = "打印模板-批量删除")
|
||||
@Operation(summary = "打印模板-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
@RequiresPermissions("print:template:delete")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids") String ids) {
|
||||
if (StringUtils.isBlank(ids)) {
|
||||
return Result.error("参数 ids 不能为空");
|
||||
}
|
||||
service.removeByIds(java.util.Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功");
|
||||
}
|
||||
|
||||
@Operation(summary = "打印模板-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
@RequiresPermissions("print:template:list")
|
||||
public Result<PrintTemplate> queryById(@RequestParam(name = "id") String id) {
|
||||
return Result.OK(service.getById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "打印模板-通过编码查询")
|
||||
@GetMapping(value = "/queryByCode")
|
||||
@RequiresPermissions("print:template:list")
|
||||
public Result<PrintTemplate> queryByCode(@RequestParam(name = "code") String code) {
|
||||
PrintTemplate t = service.getByCode(code);
|
||||
if (t == null) {
|
||||
return Result.error("未找到模板: " + code);
|
||||
}
|
||||
return Result.OK(t);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package org.jeecg.modules.print.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.system.base.entity.JeecgEntity;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* 打印模板(Hiprint JSON 存储)
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@Schema(description = "打印模板")
|
||||
@TableName("print_template")
|
||||
public class PrintTemplate extends JeecgEntity implements Serializable {
|
||||
|
||||
@Excel(name = "模板编码", width = 20)
|
||||
@Schema(description = "模板编码,业务调用唯一标识")
|
||||
@TableField("template_code")
|
||||
private String templateCode;
|
||||
|
||||
@Excel(name = "模板名称", width = 25)
|
||||
@Schema(description = "模板名称")
|
||||
@TableField("template_name")
|
||||
private String templateName;
|
||||
|
||||
@Excel(name = "分类", width = 12)
|
||||
@Schema(description = "barcode=条码标签 form=表单套打 report=报表")
|
||||
@TableField("category")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "纸张宽度(mm)")
|
||||
@TableField("paper_width_mm")
|
||||
private BigDecimal paperWidthMm;
|
||||
|
||||
@Schema(description = "纸张高度(mm)")
|
||||
@TableField("paper_height_mm")
|
||||
private BigDecimal paperHeightMm;
|
||||
|
||||
@Excel(name = "方向", width = 10)
|
||||
@Schema(description = "portrait 纵向 landscape 横向")
|
||||
@TableField("paper_orientation")
|
||||
private String paperOrientation;
|
||||
|
||||
@Schema(description = "Hiprint 模板 JSON")
|
||||
@TableField("template_json")
|
||||
private String templateJson;
|
||||
|
||||
@Excel(name = "备注", width = 30)
|
||||
@Schema(description = "备注")
|
||||
@TableField("remark")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.jeecg.modules.print.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.print.entity.PrintTemplate;
|
||||
|
||||
/**
|
||||
* 打印模板 Mapper
|
||||
*/
|
||||
public interface PrintTemplateMapper extends BaseMapper<PrintTemplate> {}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.jeecg.modules.print.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.print.entity.PrintTemplate;
|
||||
|
||||
/**
|
||||
* 打印模板 Service
|
||||
*/
|
||||
public interface IPrintTemplateService extends IService<PrintTemplate> {
|
||||
|
||||
/**
|
||||
* 按编码查询(未删除)
|
||||
*/
|
||||
PrintTemplate getByCode(String templateCode);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.jeecg.modules.print.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.modules.print.entity.PrintTemplate;
|
||||
import org.jeecg.modules.print.mapper.PrintTemplateMapper;
|
||||
import org.jeecg.modules.print.service.IPrintTemplateService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 打印模板 Service 实现
|
||||
*/
|
||||
@Service
|
||||
public class PrintTemplateServiceImpl extends ServiceImpl<PrintTemplateMapper, PrintTemplate>
|
||||
implements IPrintTemplateService {
|
||||
|
||||
@Override
|
||||
public PrintTemplate getByCode(String templateCode) {
|
||||
LambdaQueryWrapper<PrintTemplate> q = new LambdaQueryWrapper<>();
|
||||
q.eq(PrintTemplate::getTemplateCode, templateCode);
|
||||
q.last("LIMIT 1");
|
||||
return getOne(q);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user