去除多余的app等三张表

This commit is contained in:
季圣华
2019-10-03 18:05:08 +08:00
parent 5e560832f0
commit a87d9ba8a1
20 changed files with 9 additions and 3220 deletions

View File

@@ -1,273 +0,0 @@
package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.App;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.entities.UserBusiness;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.app.AppService;
import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.BaseResponseInfo;
import com.jsh.erp.utils.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
/**
* @author ji_sheng_hua 752*718*920
*/
@RestController
@RequestMapping(value = "/app")
public class AppController {
private Logger logger = LoggerFactory.getLogger(AppController.class);
@Resource
private AppService appService;
@Resource
private UserBusinessService userBusinessService;
/**
* 根据用户查询有权限的app
* @param userId
* @param request
* @return
*/
@GetMapping(value = "/findAppByUserId")
public JSONObject findAppByUserId(@RequestParam("userId") String userId, HttpServletRequest request)throws Exception {
List<UserBusiness> roleList = userBusinessService.findRoleByUserId(userId);
String roles = null;
if(roleList!=null && roleList.size()>0 && roleList.get(0)!=null){
roles = roleList.get(0).getValue();
}
if(roles!=null) {
roles = roles.replaceAll("\\]\\[",",").replaceAll("\\]","").replaceAll("\\[",""); //转为逗号隔开的
}
List<UserBusiness> appList = userBusinessService.findAppByRoles(roles);
String apps = null;
if(appList!=null && appList.size()>0 && appList.get(0)!=null){
apps = appList.get(0).getValue();
}
if(apps!=null) {
apps = apps.replaceAll("\\]\\[",",").replaceAll("\\]","").replaceAll("\\[",""); //转为逗号隔开的
}
JSONObject obj = new JSONObject();
List<App> dockList = appService.findAppInIds(apps,"dock");
JSONArray dockArray = new JSONArray();
if (null != dockList) {
for (App app : dockList) {
JSONObject item = new JSONObject();
item.put("id", app.getId());
item.put("title", app.getName());
item.put("type", app.getType());
item.put("icon", "../../upload/images/deskIcon/" + app.getIcon());
item.put("url", app.getUrl());
item.put("width", app.getWidth());
item.put("height", app.getHeight());
item.put("isresize", app.getResize());
item.put("isopenmax", app.getOpenmax());
item.put("isflash", app.getFlash());
dockArray.add(item);
}
}
obj.put("dock",dockArray);
List<App> deskList = appService.findAppInIds(apps,"desk");
JSONArray deskArray = new JSONArray();
if (null != deskList) {
for (App app : deskList) {
JSONObject item = new JSONObject();
item.put("id", app.getId());
item.put("title", app.getName());
item.put("type", app.getType());
item.put("icon", "../../upload/images/deskIcon/" + app.getIcon());
item.put("url", "../../pages/common/menu.html?appID=" + app.getNumber() + "&id=" + app.getId());
item.put("width", app.getWidth());
item.put("height", app.getHeight());
item.put("isresize", app.getResize());
item.put("isopenmax", app.getOpenmax());
item.put("isflash", app.getFlash());
deskArray.add(item);
}
}
obj.put("desk",deskArray);
return obj;
}
@GetMapping(value = "/findDesk")
public JSONObject findDesk(HttpServletRequest request)throws Exception {
JSONObject obj = new JSONObject();
List<App> dockList = appService.findDock();
JSONArray dockArray = new JSONArray();
if (null != dockList) {
for (App app : dockList) {
JSONObject item = new JSONObject();
item.put("id", app.getId());
item.put("title", app.getName());
item.put("type", app.getType());
item.put("icon", "../../upload/images/deskIcon/" + app.getIcon());
item.put("url", app.getUrl());
item.put("width", app.getWidth());
item.put("height", app.getHeight());
item.put("isresize", app.getResize());
item.put("isopenmax", app.getOpenmax());
item.put("isflash", app.getFlash());
dockArray.add(item);
}
}
obj.put("dock",dockArray);
List<App> deskList = appService.findDesk();
JSONArray deskArray = new JSONArray();
if (null != deskList) {
for (App app : deskList) {
JSONObject item = new JSONObject();
item.put("id", app.getId());
item.put("title", app.getName());
item.put("type", app.getType());
item.put("icon", "../../upload/images/deskIcon/" + app.getIcon());
item.put("url", "../../pages/common/menu.html?appID=" + app.getNumber() + "&id=" + app.getId());
item.put("width", app.getWidth());
item.put("height", app.getHeight());
item.put("isresize", app.getResize());
item.put("isopenmax", app.getOpenmax());
item.put("isflash", app.getFlash());
deskArray.add(item);
}
}
obj.put("desk",deskArray);
return obj;
}
/**
* 角色对应应用显示
* @param request
* @return
*/
@PostMapping(value = "/findRoleAPP")
public JSONArray findRoleAPP(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
HttpServletRequest request)throws Exception {
JSONArray arr = new JSONArray();
try {
List<App> dataListApp = appService.findRoleAPP();
//开始拼接json数据
JSONObject outer = new JSONObject();
outer.put("id", 1);
outer.put("text", "应用列表");
outer.put("state", "open");
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataListApp) {
//根据条件从列表里面移除"系统管理"
List<App> dataList = new ArrayList<App>();
for (App appOne : dataListApp) {
//从session中获取租户id
String loginName = null;
Object userInfo = request.getSession().getAttribute("user");
if(userInfo != null) {
User user = (User) userInfo;
loginName = user.getLoginame();
}
if(("admin").equals(loginName)) {
dataList.add(appOne);
} else {
if(!("系统管理").equals(appOne.getName())) {
dataList.add(appOne);
}
}
}
//筛选应用列表
for (App app : dataList) {
JSONObject item = new JSONObject();
item.put("id", app.getId());
item.put("text", app.getName());
//勾选判断1
Boolean flag = false;
try {
flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + app.getId().toString() + "]");
} catch (Exception e) {
logger.error(">>>>>>>>>>>>>>>>>设置角色对应的应用:类型" + type + " KeyId为 " + keyId + " 存在异常!");
}
if (flag == true) {
item.put("checked", true);
}
//结束
dataArray.add(item);
}
}
outer.put("children", dataArray);
arr.add(outer);
} catch (Exception e) {
e.printStackTrace();
}
return arr;
}
/**
* 上传图片
* @param fileInfo
* @param request
*/
@PostMapping(value = "/uploadImg")
public BaseResponseInfo uploadImg(MultipartFile fileInfo, @RequestParam("fileInfoName") String fileName,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
if (fileInfo != null) {
String basePath = request.getSession().getServletContext().getRealPath("/"); //默认windows文件路径linux环境下生成的目录与项目同级而不是下级
String path = basePath + "upload/images/deskIcon/"; //windows环境下的路径
Properties pro = System.getProperties();
String osName = pro.getProperty("os.name");//获得当前操作系统的名称
if("Linux".equals(osName) || "linux".equals(osName) || "LINUX".equals(osName)){
path = basePath + "/upload/images/deskIcon/"; //linux环境下的路径
}
FileUtils.SaveFileFromInputStream(fileInfo.getInputStream(), path, fileName);
res.code = 200;
res.data = "上传图片成功";
}
} catch (FileNotFoundException e) {
e.printStackTrace();
res.code = 500;
res.data = "获取图片失败";
} catch (IOException e) {
e.printStackTrace();
res.code = 500;
res.data = "上传图片失败";
}
return res;
}
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
* 批量删除应用信息
* create time: 2019/3/29 11:15
* @Param: ids
* @return java.lang.Object
*/
@RequestMapping(value = "/batchDeleteAppByIds")
public Object batchDeleteAppByIds(@RequestParam("ids") String ids) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess();
int i= appService.batchDeleteAppByIds(ids);
if(i<1){
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
ExceptionConstants.APP_DELETE_FAILED_CODE,ExceptionConstants.APP_DELETE_FAILED_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.APP_DELETE_FAILED_CODE,
ExceptionConstants.APP_DELETE_FAILED_MSG);
}
return result;
}
}

View File

@@ -1,515 +0,0 @@
package com.jsh.erp.datasource.entities;
public class App {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_app.Id
*
* @mbggenerated
*/
private Long id;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_app.Number
*
* @mbggenerated
*/
private String number;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_app.Name
*
* @mbggenerated
*/
private String name;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_app.Type
*
* @mbggenerated
*/
private String type;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_app.Icon
*
* @mbggenerated
*/
private String icon;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_app.URL
*
* @mbggenerated
*/
private String url;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_app.Width
*
* @mbggenerated
*/
private String width;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_app.Height
*
* @mbggenerated
*/
private String height;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_app.ReSize
*
* @mbggenerated
*/
private Boolean resize;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_app.OpenMax
*
* @mbggenerated
*/
private Boolean openmax;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_app.Flash
*
* @mbggenerated
*/
private Boolean flash;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_app.ZL
*
* @mbggenerated
*/
private String zl;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_app.Sort
*
* @mbggenerated
*/
private String sort;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_app.Remark
*
* @mbggenerated
*/
private String remark;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_app.Enabled
*
* @mbggenerated
*/
private Boolean enabled;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_app.delete_Flag
*
* @mbggenerated
*/
private String deleteFlag;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_app.Id
*
* @return the value of jsh_app.Id
*
* @mbggenerated
*/
public Long getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_app.Id
*
* @param id the value for jsh_app.Id
*
* @mbggenerated
*/
public void setId(Long id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_app.Number
*
* @return the value of jsh_app.Number
*
* @mbggenerated
*/
public String getNumber() {
return number;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_app.Number
*
* @param number the value for jsh_app.Number
*
* @mbggenerated
*/
public void setNumber(String number) {
this.number = number == null ? null : number.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_app.Name
*
* @return the value of jsh_app.Name
*
* @mbggenerated
*/
public String getName() {
return name;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_app.Name
*
* @param name the value for jsh_app.Name
*
* @mbggenerated
*/
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_app.Type
*
* @return the value of jsh_app.Type
*
* @mbggenerated
*/
public String getType() {
return type;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_app.Type
*
* @param type the value for jsh_app.Type
*
* @mbggenerated
*/
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_app.Icon
*
* @return the value of jsh_app.Icon
*
* @mbggenerated
*/
public String getIcon() {
return icon;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_app.Icon
*
* @param icon the value for jsh_app.Icon
*
* @mbggenerated
*/
public void setIcon(String icon) {
this.icon = icon == null ? null : icon.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_app.URL
*
* @return the value of jsh_app.URL
*
* @mbggenerated
*/
public String getUrl() {
return url;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_app.URL
*
* @param url the value for jsh_app.URL
*
* @mbggenerated
*/
public void setUrl(String url) {
this.url = url == null ? null : url.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_app.Width
*
* @return the value of jsh_app.Width
*
* @mbggenerated
*/
public String getWidth() {
return width;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_app.Width
*
* @param width the value for jsh_app.Width
*
* @mbggenerated
*/
public void setWidth(String width) {
this.width = width == null ? null : width.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_app.Height
*
* @return the value of jsh_app.Height
*
* @mbggenerated
*/
public String getHeight() {
return height;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_app.Height
*
* @param height the value for jsh_app.Height
*
* @mbggenerated
*/
public void setHeight(String height) {
this.height = height == null ? null : height.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_app.ReSize
*
* @return the value of jsh_app.ReSize
*
* @mbggenerated
*/
public Boolean getResize() {
return resize;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_app.ReSize
*
* @param resize the value for jsh_app.ReSize
*
* @mbggenerated
*/
public void setResize(Boolean resize) {
this.resize = resize;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_app.OpenMax
*
* @return the value of jsh_app.OpenMax
*
* @mbggenerated
*/
public Boolean getOpenmax() {
return openmax;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_app.OpenMax
*
* @param openmax the value for jsh_app.OpenMax
*
* @mbggenerated
*/
public void setOpenmax(Boolean openmax) {
this.openmax = openmax;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_app.Flash
*
* @return the value of jsh_app.Flash
*
* @mbggenerated
*/
public Boolean getFlash() {
return flash;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_app.Flash
*
* @param flash the value for jsh_app.Flash
*
* @mbggenerated
*/
public void setFlash(Boolean flash) {
this.flash = flash;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_app.ZL
*
* @return the value of jsh_app.ZL
*
* @mbggenerated
*/
public String getZl() {
return zl;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_app.ZL
*
* @param zl the value for jsh_app.ZL
*
* @mbggenerated
*/
public void setZl(String zl) {
this.zl = zl == null ? null : zl.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_app.Sort
*
* @return the value of jsh_app.Sort
*
* @mbggenerated
*/
public String getSort() {
return sort;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_app.Sort
*
* @param sort the value for jsh_app.Sort
*
* @mbggenerated
*/
public void setSort(String sort) {
this.sort = sort == null ? null : sort.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_app.Remark
*
* @return the value of jsh_app.Remark
*
* @mbggenerated
*/
public String getRemark() {
return remark;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_app.Remark
*
* @param remark the value for jsh_app.Remark
*
* @mbggenerated
*/
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_app.Enabled
*
* @return the value of jsh_app.Enabled
*
* @mbggenerated
*/
public Boolean getEnabled() {
return enabled;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_app.Enabled
*
* @param enabled the value for jsh_app.Enabled
*
* @mbggenerated
*/
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_app.delete_Flag
*
* @return the value of jsh_app.delete_Flag
*
* @mbggenerated
*/
public String getDeleteFlag() {
return deleteFlag;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_app.delete_Flag
*
* @param deleteFlag the value for jsh_app.delete_Flag
*
* @mbggenerated
*/
public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,96 +0,0 @@
package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.App;
import com.jsh.erp.datasource.entities.AppExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface AppMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_app
*
* @mbggenerated
*/
int countByExample(AppExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_app
*
* @mbggenerated
*/
int deleteByExample(AppExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_app
*
* @mbggenerated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_app
*
* @mbggenerated
*/
int insert(App record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_app
*
* @mbggenerated
*/
int insertSelective(App record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_app
*
* @mbggenerated
*/
List<App> selectByExample(AppExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_app
*
* @mbggenerated
*/
App selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_app
*
* @mbggenerated
*/
int updateByExampleSelective(@Param("record") App record, @Param("example") AppExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_app
*
* @mbggenerated
*/
int updateByExample(@Param("record") App record, @Param("example") AppExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_app
*
* @mbggenerated
*/
int updateByPrimaryKeySelective(App record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_app
*
* @mbggenerated
*/
int updateByPrimaryKey(App record);
}

View File

@@ -1,23 +0,0 @@
package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.App;
import com.jsh.erp.datasource.entities.AppExample;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface AppMapperEx {
List<App> selectByConditionApp(
@Param("name") String name,
@Param("type") String type,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
Long countsByApp(
@Param("name") String name,
@Param("type") String type);
int batchDeleteAppByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
}

View File

@@ -6,7 +6,6 @@ import java.lang.annotation.*;
* @author jishenghua 2018-10-7 15:25:39
* user-5
* role-10
* app-15
* depot-20
* log-25
* functions-30

View File

@@ -1,72 +0,0 @@
package com.jsh.erp.service.app;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@Service(value = "app_component")
@AppResource
public class AppComponent implements ICommonQuery {
@Resource
private AppService appService;
@Override
public Object selectOne(Long id) throws Exception {
return appService.getApp(id);
}
@Override
public List<?> select(Map<String, String> map)throws Exception {
return getAppList(map);
}
private List<?> getAppList(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name");
String type = StringUtil.getInfo(search, "type");
String order = QueryUtils.order(map);
return appService.select(name, type, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
public Long counts(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name");
String type = StringUtil.getInfo(search, "type");
return appService.countApp(name, type);
}
@Override
public int insert(String beanJson, HttpServletRequest request)throws Exception {
return appService.insertApp(beanJson, request);
}
@Override
public int update(String beanJson, Long id)throws Exception {
return appService.updateApp(beanJson, id);
}
@Override
public int delete(Long id)throws Exception {
return appService.deleteApp(id);
}
@Override
public int batchDelete(String ids)throws Exception {
return appService.batchDeleteApp(ids);
}
@Override
public int checkIsNameExist(Long id, String name)throws Exception {
return 0;
}
}

View File

@@ -1,15 +0,0 @@
package com.jsh.erp.service.app;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* @author jishenghua qq752718920 2018-10-7 15:26:27
*/
@ResourceInfo(value = "app", type = 15)
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface AppResource {
}

View File

@@ -1,254 +0,0 @@
package com.jsh.erp.service.app;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.App;
import com.jsh.erp.datasource.entities.AppExample;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.entities.UserBusiness;
import com.jsh.erp.datasource.mappers.AppMapper;
import com.jsh.erp.datasource.mappers.AppMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
@Service
public class AppService {
private Logger logger = LoggerFactory.getLogger(AppService.class);
@Resource
private AppMapper appMapper;
@Resource
private AppMapperEx appMapperEx;
@Resource
private UserService userService;
@Resource
private LogService logService;
@Resource
private UserBusinessService userBusinessService;
public List<App> findDock()throws Exception{
AppExample example = new AppExample();
example.createCriteria().andZlEqualTo("dock").andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort");
List<App> list=null;
try{
list=appMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
/**
* create by: cjl
* description:
* 桌面功能菜单初始化列表
* create time: 2019/1/11 16:59
* @Param: null
* @return
*/
public List<App> findDesk()throws Exception{
AppExample example = new AppExample();
example.createCriteria().andZlEqualTo("desk").andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort");
List<App> list=null;
try{
list=appMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public App getApp(long id)throws Exception {
App result=null;
try{
result=appMapper.selectByPrimaryKey(id);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
public List<App> getApp()throws Exception {
AppExample example = new AppExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<App> list=null;
try{
list=appMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<App> select(String name, String type, int offset, int rows)throws Exception {
List<App> list=null;
try{
list=appMapperEx.selectByConditionApp(name, type, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public Long countApp(String name, String type)throws Exception {
Long result=null;
try{
result=appMapperEx.countsByApp(name, type);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertApp(String beanJson, HttpServletRequest request)throws Exception {
App app = JSONObject.parseObject(beanJson, App.class);
int result=0;
try{
result=appMapper.insertSelective(app);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateApp(String beanJson, Long id) throws Exception{
App app = JSONObject.parseObject(beanJson, App.class);
app.setId(id);
int result=0;
try{
result=appMapper.updateByPrimaryKeySelective(app);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteApp(Long id)throws Exception {
int result=0;
try{
result=appMapper.deleteByPrimaryKey(id);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteApp(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
AppExample example = new AppExample();
example.createCriteria().andIdIn(idList);
int result=0;
try{
result=appMapper.deleteByExample(example);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
public List<App> findRoleAPP()throws Exception{
AppExample example = new AppExample();
example.createCriteria().andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort");
List<App> list=null;
try{
list=appMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<App> findAppInIds(String ids, String type)throws Exception{
List<Long> idList = StringUtil.strToLongList(ids);
AppExample example = new AppExample();
example.createCriteria().andZlEqualTo(type).andEnabledEqualTo(true).andIdIn(idList)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort");
List<App> list=null;
try{
list=appMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAppByIds(String ids) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_APP,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
int result=0;
try{
result=appMapperEx.batchDeleteAppByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
public List<App> findAppByUserId(String userId)throws Exception {
List<UserBusiness> roleList = userBusinessService.findRoleByUserId(userId);
String roles = null;
if(roleList!=null && roleList.size()>0 && roleList.get(0)!=null){
roles = roleList.get(0).getValue();
}
if(roles!=null) {
roles = roles.replaceAll("\\]\\[",",").replaceAll("\\]","").replaceAll("\\[",""); //转为逗号隔开的
}
List<UserBusiness> appList = userBusinessService.findAppByRoles(roles);
String apps = null;
if(appList!=null && appList.size()>0 && appList.get(0)!=null){
apps = appList.get(0).getValue();
}
if(apps!=null) {
apps = apps.replaceAll("\\]\\[",",").replaceAll("\\]","").replaceAll("\\[",""); //转为逗号隔开的
}
List<App> deskList = findAppInIds(apps,"desk");
return deskList;
}
/**
* 通过number列表查询app list
* @param numberList
* @return
*/
public List<App> findAppByNumber(List<String> numberList) throws Exception{
AppExample example = new AppExample();
example.createCriteria().andEnabledEqualTo(true).andNumberIn(numberList);
List<App> list=null;
try{
list=appMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
}

View File

@@ -1,7 +1,6 @@
package com.jsh.erp.service.depot;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.service.app.AppResource;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil;

View File

@@ -1,7 +1,6 @@
package com.jsh.erp.service.functions;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.service.app.AppResource;
import com.jsh.erp.service.functions.FunctionsService;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;

View File

@@ -1,7 +1,6 @@
package com.jsh.erp.service.unit;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.service.app.AppResource;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil;

View File

@@ -9,7 +9,6 @@ import com.jsh.erp.datasource.mappers.UserBusinessMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.CommonQueryManager;
import com.jsh.erp.service.app.AppService;
import com.jsh.erp.service.functions.FunctionsService;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
@@ -42,9 +41,6 @@ public class UserBusinessService {
@Resource
private FunctionsService functionsService;
@Resource
private AppService appService;
@Resource
private CommonQueryManager configResourceManager;
@@ -79,10 +75,6 @@ public class UserBusinessService {
}catch(Exception e){
JshException.writeFail(logger, e);
}
// 更新应用权限
if (BusinessConstants.TYPE_NAME_ROLE_FUNCTIONS.equals(userBusiness.getType()) && result > 0) {
result = insertOrUpdateAppValue(BusinessConstants.TYPE_NAME_ROLE_APP, userBusiness.getKeyid(), userBusiness.getValue());
}
return result;
}
@@ -96,10 +88,6 @@ public class UserBusinessService {
}catch(Exception e){
JshException.writeFail(logger, e);
}
// 更新应用权限
if (BusinessConstants.TYPE_NAME_ROLE_FUNCTIONS.equals(userBusiness.getType()) && result > 0) {
result = insertOrUpdateAppValue(BusinessConstants.TYPE_NAME_ROLE_APP, userBusiness.getKeyid(), userBusiness.getValue());
}
return result;
}
@@ -245,51 +233,4 @@ public class UserBusinessService {
}
return result;
}
/**
* 通过功能RoleFunctions权限更新应用RoleApp权限
* @param type
* @param keyId
* @param functionIds
* @return
*/
public int insertOrUpdateAppValue(String type, String keyId, String functionIds) throws Exception{
int result=0;
functionIds = functionIds.replaceAll("\\]\\[", ",").
replaceAll("\\[","").replaceAll("\\]","");
List<Functions> functionsList = functionsService.findByIds(functionIds);
if (!CollectionUtils.isEmpty(functionsList)) {
Set<String> appNumbers = new HashSet<>();
String appNumber;
for (Functions functions : functionsList) {
appNumber = functions.getNumber().substring(0, 2);
appNumbers.add(appNumber);
}
List<String> appNumberList = new ArrayList<>(appNumbers);
List<App> appList = appService.findAppByNumber(appNumberList);
StringBuilder appIdSb = new StringBuilder();
if (!CollectionUtils.isEmpty(appList)) {
for (App app : appList) {
appIdSb.append("[" + app.getId() + "]");
}
List<UserBusiness> userBusinessList = getBasicData(keyId, type);
try{
if(userBusinessList.size() > 0) {
UserBusiness userBusiness = userBusinessList.get(0);
userBusiness.setValue(appIdSb.toString());
result = userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
} else {
UserBusiness userBusiness = new UserBusiness();
userBusiness.setType(type);
userBusiness.setKeyid(keyId);
userBusiness.setValue(appIdSb.toString());
result = userBusinessMapper.insertSelective(userBusiness);
}
}catch(Exception e){
JshException.writeFail(logger, e);
}
}
}
return result;
}
}

View File

@@ -2,7 +2,7 @@ server.port=8080
#server.port=443
#server.ssl.key-store=classpath:jishenghua.jks
#server.ssl.key-alias=alias
#server.ssl.key-store-password=password
#server.ssl.key-store-password=M9z21aFp
#server.ssl.key-store-type=JKS
#ssl的开关
server.ssl.enable=false

View File

@@ -1,443 +0,0 @@
<?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.jsh.erp.datasource.mappers.AppMapper">
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.App">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="Id" jdbcType="BIGINT" property="id" />
<result column="Number" jdbcType="VARCHAR" property="number" />
<result column="Name" jdbcType="VARCHAR" property="name" />
<result column="Type" jdbcType="VARCHAR" property="type" />
<result column="Icon" jdbcType="VARCHAR" property="icon" />
<result column="URL" jdbcType="VARCHAR" property="url" />
<result column="Width" jdbcType="VARCHAR" property="width" />
<result column="Height" jdbcType="VARCHAR" property="height" />
<result column="ReSize" jdbcType="BIT" property="resize" />
<result column="OpenMax" jdbcType="BIT" property="openmax" />
<result column="Flash" jdbcType="BIT" property="flash" />
<result column="ZL" jdbcType="VARCHAR" property="zl" />
<result column="Sort" jdbcType="VARCHAR" property="sort" />
<result column="Remark" jdbcType="VARCHAR" property="remark" />
<result column="Enabled" jdbcType="BIT" property="enabled" />
<result column="delete_Flag" jdbcType="VARCHAR" property="deleteFlag" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
Id, Number, Name, Type, Icon, URL, Width, Height, ReSize, OpenMax, Flash, ZL, Sort,
Remark, Enabled, delete_Flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.AppExample" resultMap="BaseResultMap">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from jsh_app
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from jsh_app
where Id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_app
where Id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.AppExample">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_app
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.App">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_app (Id, Number, Name,
Type, Icon, URL, Width,
Height, ReSize, OpenMax, Flash,
ZL, Sort, Remark, Enabled,
delete_Flag)
values (#{id,jdbcType=BIGINT}, #{number,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{width,jdbcType=VARCHAR},
#{height,jdbcType=VARCHAR}, #{resize,jdbcType=BIT}, #{openmax,jdbcType=BIT}, #{flash,jdbcType=BIT},
#{zl,jdbcType=VARCHAR}, #{sort,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{enabled,jdbcType=BIT},
#{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.App">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_app
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
Id,
</if>
<if test="number != null">
Number,
</if>
<if test="name != null">
Name,
</if>
<if test="type != null">
Type,
</if>
<if test="icon != null">
Icon,
</if>
<if test="url != null">
URL,
</if>
<if test="width != null">
Width,
</if>
<if test="height != null">
Height,
</if>
<if test="resize != null">
ReSize,
</if>
<if test="openmax != null">
OpenMax,
</if>
<if test="flash != null">
Flash,
</if>
<if test="zl != null">
ZL,
</if>
<if test="sort != null">
Sort,
</if>
<if test="remark != null">
Remark,
</if>
<if test="enabled != null">
Enabled,
</if>
<if test="deleteFlag != null">
delete_Flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="number != null">
#{number,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="icon != null">
#{icon,jdbcType=VARCHAR},
</if>
<if test="url != null">
#{url,jdbcType=VARCHAR},
</if>
<if test="width != null">
#{width,jdbcType=VARCHAR},
</if>
<if test="height != null">
#{height,jdbcType=VARCHAR},
</if>
<if test="resize != null">
#{resize,jdbcType=BIT},
</if>
<if test="openmax != null">
#{openmax,jdbcType=BIT},
</if>
<if test="flash != null">
#{flash,jdbcType=BIT},
</if>
<if test="zl != null">
#{zl,jdbcType=VARCHAR},
</if>
<if test="sort != null">
#{sort,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="enabled != null">
#{enabled,jdbcType=BIT},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.AppExample" resultType="java.lang.Integer">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from jsh_app
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_app
<set>
<if test="record.id != null">
Id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.number != null">
Number = #{record.number,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
Name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
Type = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.icon != null">
Icon = #{record.icon,jdbcType=VARCHAR},
</if>
<if test="record.url != null">
URL = #{record.url,jdbcType=VARCHAR},
</if>
<if test="record.width != null">
Width = #{record.width,jdbcType=VARCHAR},
</if>
<if test="record.height != null">
Height = #{record.height,jdbcType=VARCHAR},
</if>
<if test="record.resize != null">
ReSize = #{record.resize,jdbcType=BIT},
</if>
<if test="record.openmax != null">
OpenMax = #{record.openmax,jdbcType=BIT},
</if>
<if test="record.flash != null">
Flash = #{record.flash,jdbcType=BIT},
</if>
<if test="record.zl != null">
ZL = #{record.zl,jdbcType=VARCHAR},
</if>
<if test="record.sort != null">
Sort = #{record.sort,jdbcType=VARCHAR},
</if>
<if test="record.remark != null">
Remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.enabled != null">
Enabled = #{record.enabled,jdbcType=BIT},
</if>
<if test="record.deleteFlag != null">
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_app
set Id = #{record.id,jdbcType=BIGINT},
Number = #{record.number,jdbcType=VARCHAR},
Name = #{record.name,jdbcType=VARCHAR},
Type = #{record.type,jdbcType=VARCHAR},
Icon = #{record.icon,jdbcType=VARCHAR},
URL = #{record.url,jdbcType=VARCHAR},
Width = #{record.width,jdbcType=VARCHAR},
Height = #{record.height,jdbcType=VARCHAR},
ReSize = #{record.resize,jdbcType=BIT},
OpenMax = #{record.openmax,jdbcType=BIT},
Flash = #{record.flash,jdbcType=BIT},
ZL = #{record.zl,jdbcType=VARCHAR},
Sort = #{record.sort,jdbcType=VARCHAR},
Remark = #{record.remark,jdbcType=VARCHAR},
Enabled = #{record.enabled,jdbcType=BIT},
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.App">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_app
<set>
<if test="number != null">
Number = #{number,jdbcType=VARCHAR},
</if>
<if test="name != null">
Name = #{name,jdbcType=VARCHAR},
</if>
<if test="type != null">
Type = #{type,jdbcType=VARCHAR},
</if>
<if test="icon != null">
Icon = #{icon,jdbcType=VARCHAR},
</if>
<if test="url != null">
URL = #{url,jdbcType=VARCHAR},
</if>
<if test="width != null">
Width = #{width,jdbcType=VARCHAR},
</if>
<if test="height != null">
Height = #{height,jdbcType=VARCHAR},
</if>
<if test="resize != null">
ReSize = #{resize,jdbcType=BIT},
</if>
<if test="openmax != null">
OpenMax = #{openmax,jdbcType=BIT},
</if>
<if test="flash != null">
Flash = #{flash,jdbcType=BIT},
</if>
<if test="zl != null">
ZL = #{zl,jdbcType=VARCHAR},
</if>
<if test="sort != null">
Sort = #{sort,jdbcType=VARCHAR},
</if>
<if test="remark != null">
Remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="enabled != null">
Enabled = #{enabled,jdbcType=BIT},
</if>
<if test="deleteFlag != null">
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
</if>
</set>
where Id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.App">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_app
set Number = #{number,jdbcType=VARCHAR},
Name = #{name,jdbcType=VARCHAR},
Type = #{type,jdbcType=VARCHAR},
Icon = #{icon,jdbcType=VARCHAR},
URL = #{url,jdbcType=VARCHAR},
Width = #{width,jdbcType=VARCHAR},
Height = #{height,jdbcType=VARCHAR},
ReSize = #{resize,jdbcType=BIT},
OpenMax = #{openmax,jdbcType=BIT},
Flash = #{flash,jdbcType=BIT},
ZL = #{zl,jdbcType=VARCHAR},
Sort = #{sort,jdbcType=VARCHAR},
Remark = #{remark,jdbcType=VARCHAR},
Enabled = #{enabled,jdbcType=BIT},
delete_Flag = #{deleteFlag,jdbcType=VARCHAR}
where Id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -1,43 +0,0 @@
<?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.jsh.erp.datasource.mappers.AppMapperEx">
<select id="selectByConditionApp" parameterType="com.jsh.erp.datasource.entities.AppExample" resultMap="com.jsh.erp.datasource.mappers.AppMapper.BaseResultMap">
select *
FROM jsh_app
where 1=1
<if test="name != null">
and name like '%${name}%'
</if>
<if test="type != null">
and type='${type}'
</if>
and ifnull(delete_Flag,'0') !='1'
order by sort asc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
</select>
<select id="countsByApp" resultType="java.lang.Long">
SELECT
COUNT(id)
FROM jsh_app
WHERE 1=1
<if test="name != null">
and name like '%${name}%'
</if>
<if test="type != null">
and type='${type}'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<update id="batchDeleteAppByIds">
update jsh_app
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>

View File

@@ -44,7 +44,6 @@
<!-- <table tableName="jsh_account" domainObjectName="Account"></table>
<table tableName="jsh_accounthead" domainObjectName="AccountHead"></table>
<table tableName="jsh_accountitem" domainObjectName="AccountItem"></table>
<table tableName="jsh_app" domainObjectName="App"></table>
<table tableName="jsh_depot" domainObjectName="Depot"></table>
<table tableName="jsh_depothead" domainObjectName="DepotHead"></table>
<table tableName="jsh_depotitem" domainObjectName="DepotItem"></table>