| | |
| | | |
| | | import com.yuanchu.mom.pojo.RawInspect; |
| | | import com.yuanchu.mom.service.*; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | | import com.yuanchu.mom.utils.Jwt; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.*; |
| | |
| | | |
| | | @ApiOperation(value = "æ°å¢æ£éªå") |
| | | @PostMapping("/addRawInspects") |
| | | public Result addRawInspects(@RequestHeader("token") String token, @RequestBody RawInspect rawInspect) throws JSONException { |
| | | Map<String, String> map = jwt.readJWT(token); |
| | | String data = map.get("data"); |
| | | JSONObject jsonObject = new JSONObject(data); |
| | | String userName = jsonObject.getString("name"); |
| | | return Result.success(rawInspectService.addRawInspects(userName, rawInspect)); |
| | | public Result addRawInspects(@RequestHeader("token") String token, @RequestBody RawInspect rawInspect) throws Exception { |
| | | Map<String, String> data = JackSonUtil.unmarshal(jwt.readJWT(token).get("data"), Map.class); |
| | | return Result.success(rawInspectService.addRawInspects(data.get("name").replaceAll("\"", ""), rawInspect)); |
| | | } |
| | | |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.yuanchu.mom.mapper.InspectUnacceptedMapper"> |
| | | <select id="selectUnRawInspectsList" resultType="java.util.Map"> |
| | | select DATE_FORMAT(form_time, '%Y-%m-%d') 'æ¥ææ¥æ', |
| | | select |
| | | DATE_FORMAT(form_time, '%Y-%m-%d') 'æ¥ææ¥æ', |
| | | reason, |
| | | code, |
| | | name, |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.yuanchu.mom.mapper.RepertoryMapper"> |
| | | <select id="selectAllRepertory" resultType="java.util.Map"> |
| | | select name, |
| | | select id, |
| | | name, |
| | | specifications, |
| | | code, |
| | | requirements, |
| | |
| | | @ApiImplicitParam(name = "id", value = "éå®åid", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/updateSaleById") |
| | | public Result updateSaleById(@RequestHeader("token") String token, Integer id, @RequestBody SaleVo saleVo) throws JSONException { |
| | | Map<String, String> map = jwt.readJWT(token); |
| | | String data = map.get("data"); |
| | | JSONObject jsonObject = new JSONObject(data); |
| | | String saleman = jsonObject.getString("name"); |
| | | saleService.updateSaleById(saleman,id, saleVo); |
| | | public Result updateSaleById(@RequestHeader("token") String token, Integer id, @RequestBody SaleVo saleVo) throws Exception { |
| | | Map<String, String> data = JackSonUtil.unmarshal(jwt.readJWT(token).get("data"), Map.class); |
| | | saleService.updateSaleById(data.get("name").replaceAll("\"", ""),id, saleVo); |
| | | return Result.success("ä¿®æ¹æå!"); |
| | | } |
| | | |
| | |
| | | @ApiImplicitParam(name = "type", value = "ç¶æ", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/check") |
| | | public Result check(@RequestHeader("token") String token,Integer id,Integer type) throws JSONException { |
| | | Map<String, String> map = jwt.readJWT(token); |
| | | String data = map.get("data"); |
| | | JSONObject jsonObject = new JSONObject(data); |
| | | String checkname = jsonObject.getString("name"); |
| | | saleService.check(checkname,id,type); |
| | | public Result check(@RequestHeader("token") String token,Integer id,Integer type) throws Exception { |
| | | Map<String, String> data = JackSonUtil.unmarshal(jwt.readJWT(token).get("data"), Map.class); |
| | | saleService.check(data.get("name").replaceAll("\"", ""),id,type); |
| | | return Result.success("å®¡æ ¸æå"); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.pojo.dto.TechnologyTemplateDto; |
| | | import com.yuanchu.mom.pojo.vo.TechnologyTemplateVo1; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | return Result.success(technologyTemplateService.seleType()); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢å·¥åºæ¨¡çå表") |
| | | @ApiOperation(value = "æ¥è¯¢å·¥åºæ¨¡çå表(äºçº§æ )") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "pageSize", value = "页æ°", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "countSize", value = "æ¡æ°/页", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "element", value = "å
ä»¶", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "father", value = "å·¥åº(ç¶ç±»)", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "type", value = "ç±»å", dataTypeClass = Integer.class,required = true) |
| | | }) |
| | | @GetMapping("/selTech") |
| | | public Result selTech(Integer pageSize,Integer countSize,String element,String father,Integer type){ |
| | | IPage<Map<String, Object>> salePage = technologyTemplateService.selTech(new Page<Object>(pageSize, countSize), element, father, type); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("total", salePage.getTotal()); |
| | | map.put("row", salePage.getRecords()); |
| | | public Result selTech(String element,String father,Integer type){ |
| | | List<TechnologyTemplateVo1> map = technologyTemplateService.selTech(element, father, type); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢å·¥åºæ¨¡ç详æ
") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "å·¥åºid", dataTypeClass = Integer.class,required = true) |
| | | }) |
| | | @GetMapping("/selTechById") |
| | | public Result selTechById(Integer id){ |
| | | return Result.success(technologyTemplateService.selTechById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "ç¼è¾") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "å·¥åºid", dataTypeClass = Integer.class,required = true) |
| | | }) |
| | | @PostMapping("/updaTechById") |
| | | public Result updaTechById(Integer id,@RequestBody TechnologyTemplateDto technologyTemplateDto){ |
| | | technologyTemplateService.updaTechById(id,technologyTemplateDto); |
| | | return Result.success("ä¿®æ¹æå!"); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®éå®åidå é¤") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "å·¥åºid", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/delTech") |
| | | public Result delTech(Integer id) { |
| | | technologyTemplateService.delTech(id); |
| | | return Result.success("å 餿å!"); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¹éå é¤") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "ids", value = "éå®åid", dataTypeClass = String.class, dataType = "List", required = true) |
| | | }) |
| | | @PostMapping("/delAllTech") |
| | | public Result delAllTech( List<Integer> ids) { |
| | | technologyTemplateService.delAllTech(ids); |
| | | return Result.success("æ¹éå 餿å!"); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.pojo.TechnologyTemplate; |
| | | import com.yuanchu.mom.pojo.vo.TechnologyTemplateVo1; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | |
| | | List<Integer> seleType(); |
| | | |
| | | //æ¥è¯¢å·¥åºæ¨¡çå表 |
| | | IPage<Map<String, Object>> selTech(Page<Object> page, String element, String father, Integer type); |
| | | List<TechnologyTemplateVo1> selTech(String element, String father, Integer type); |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.pojo.vo; |
| | | |
| | | |
| | | import com.yuanchu.mom.pojo.dto.ProductDto2; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class TechnologyTemplateVo1 { |
| | | |
| | | /** |
| | | * 项ç®åç§° |
| | | */ |
| | | private String father; |
| | | |
| | | List<TechnologyTemplateVo2> children; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.pojo.vo; |
| | | |
| | | |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class TechnologyTemplateVo2 { |
| | | |
| | | @JsonSerialize |
| | | private Integer id; |
| | | |
| | | //å·¥åºåç§° |
| | | @JsonSerialize |
| | | private String name; |
| | | |
| | | //å
ä»¶ |
| | | @JsonSerialize |
| | | private String element; |
| | | |
| | | //åºæ¬è¦æ± |
| | | @JsonSerialize |
| | | private String base; |
| | | |
| | | //æ§å¶è¦ç¹ |
| | | @JsonSerialize |
| | | private String control; |
| | | |
| | | //夿³¨ |
| | | @JsonSerialize |
| | | private String note; |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.mom.pojo.TechnologyTemplate; |
| | | import com.yuanchu.mom.pojo.dto.TechnologyTemplateDto; |
| | | import com.yuanchu.mom.pojo.vo.TechnologyTemplateVo1; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @param type |
| | | * @return |
| | | */ |
| | | IPage<Map<String, Object>> selTech(Page<Object> page, String element, String father, Integer type); |
| | | List<TechnologyTemplateVo1> selTech(String element, String father, Integer type); |
| | | |
| | | /** |
| | | * æ ¹æ®idæ¥è¯¢è¯¦æ
|
| | | * @param id |
| | | * @return |
| | | */ |
| | | TechnologyTemplateDto selTechById(Integer id); |
| | | |
| | | /** |
| | | * æ ¹æ®idä¿®æ¹ |
| | | * @param id |
| | | * @param technologyTemplateDto |
| | | */ |
| | | void updaTechById(Integer id, TechnologyTemplateDto technologyTemplateDto); |
| | | |
| | | /** |
| | | * æ ¹æ®idå é¤ |
| | | * @param id |
| | | */ |
| | | void delTech(Integer id); |
| | | |
| | | /** |
| | | * æ¹éå é¤ |
| | | * @param ids |
| | | */ |
| | | void delAllTech(List<Integer> ids); |
| | | } |
| | | |
| | |
| | | import com.yuanchu.mom.mapper.TechnologyTemplateMapper; |
| | | import com.yuanchu.mom.pojo.TechnologyTemplate; |
| | | import com.yuanchu.mom.pojo.dto.TechnologyTemplateDto; |
| | | import com.yuanchu.mom.pojo.vo.TechnologyTemplateVo1; |
| | | import com.yuanchu.mom.service.TechnologyTemplateService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | //æ¥è¯¢å·¥åºæ¨¡çå表 |
| | | @Override |
| | | public IPage<Map<String, Object>> selTech(Page<Object> page, String element, String father, Integer type) { |
| | | return technologyTemplateMapper.selTech(page,element,father,type); |
| | | public List<TechnologyTemplateVo1> selTech( String element, String father, Integer type) { |
| | | return technologyTemplateMapper.selTech(element,father,type); |
| | | } |
| | | |
| | | //æ ¹æ®idæ¥çå·¥åºè¯¦æ
|
| | | @Override |
| | | public TechnologyTemplateDto selTechById(Integer id) { |
| | | TechnologyTemplate technologyTemplate = technologyTemplateMapper.selectById(id); |
| | | TechnologyTemplateDto technologyTemplateDto = new TechnologyTemplateDto(); |
| | | BeanUtils.copyProperties(technologyTemplate,technologyTemplateDto); |
| | | return technologyTemplateDto; |
| | | } |
| | | |
| | | //æ ¹æ®idä¿®æ¹ |
| | | @Override |
| | | public void updaTechById(Integer id, TechnologyTemplateDto technologyTemplateDto) { |
| | | TechnologyTemplate technologyTemplate = technologyTemplateMapper.selectById(id); |
| | | BeanUtils.copyProperties(technologyTemplateDto,technologyTemplate); |
| | | technologyTemplateMapper.updateById(technologyTemplate); |
| | | } |
| | | |
| | | //æ ¹æ®idå é¤ |
| | | @Override |
| | | public void delTech(Integer id) { |
| | | TechnologyTemplate technologyTemplate = technologyTemplateMapper.selectById(id); |
| | | technologyTemplate.setState(0); |
| | | technologyTemplateMapper.updateById(technologyTemplate); |
| | | } |
| | | |
| | | //æ¹éå é¤ |
| | | @Override |
| | | public void delAllTech(List<Integer> ids) { |
| | | List<TechnologyTemplate> technologyTemplates = technologyTemplateMapper.selectBatchIds(ids); |
| | | for (TechnologyTemplate technologyTemplate : technologyTemplates) { |
| | | technologyTemplate.setState(0); |
| | | technologyTemplateMapper.updateById(technologyTemplate); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | from mom_ocean.technology_template |
| | | where state = 1 |
| | | </select> |
| | | <select id="selTech" resultType="java.util.Map"> |
| | | select name, |
| | | |
| | | <resultMap id="selTech" type="com.yuanchu.mom.pojo.vo.TechnologyTemplateVo1"> |
| | | <id property="father" column="father" jdbcType="VARCHAR"/> |
| | | <collection property="children" resultMap="TechnologyTemplateVo2ListMap"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="TechnologyTemplateVo2ListMap" type="com.yuanchu.mom.pojo.vo.TechnologyTemplateVo2"> |
| | | <id property="id" column="id" jdbcType="INTEGER"/> |
| | | <result property="name" column="name" jdbcType="VARCHAR"/> |
| | | <result property="element" column="element" jdbcType="VARCHAR"/> |
| | | <result property="base" column="base" jdbcType="VARCHAR"/> |
| | | <result property="control" column="control" jdbcType="VARCHAR"/> |
| | | <result property="note" column="note" jdbcType="VARCHAR"/> |
| | | </resultMap> |
| | | <select id="selTech" resultMap="selTech"> |
| | | select id, |
| | | father, |
| | | name, |
| | | element, |
| | | base, |
| | | control, |
| | |
| | | and type=#{type} |
| | | </if> |
| | | <if test="element!=null"> |
| | | and element=#{element} |
| | | and element like concat('%',#{element},'%') |
| | | </if> |
| | | <if test="father!=null"> |
| | | and father=#{father} |
| | | and father like concat('%',#{father},'%') |
| | | </if> |
| | | </where> |
| | | group by father |
| | | |
| | | </select> |
| | | </mapper> |